[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some Emacs outside Emacs
From: |
Stefan Monnier |
Subject: |
Re: Some Emacs outside Emacs |
Date: |
Fri, 29 Jul 2022 10:37:04 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> --8<---------------cut here---------------start------------->8---
> Lisp_Object frame;
> XFontSet fs;
>
> frame = menu_bar_to_frame(mw);
> if (FRAMEP (frame))
> fs = FRAME_XIC_FONTSET (XFRAME (frame));
> --8<---------------cut here---------------end--------------->8---
Style comment: I recommend you try to initialize your variables directly
in their declaration, as in:
Lisp_Object frame = menu_bar_to_frame(mw);
XFontSet fs = (FRAMEP (frame)
? FRAME_XIC_FONTSET (XFRAME (frame))
: ...);
This eliminates the possibility of having the variable be uninitialized,
and reduces the "risk" of leaving a unused variable declaration.
It also often results in more concise code.
Stefan