From: Eli Zaretskii <eliz@gnu.org>
To: Alex Gramiak <agrambot@gmail.com>
Cc: alan@idiocy.org, emacs-devel@gnu.org
Subject: Re: [PATCH] Renaming non-X x_* identifiers
Date: Sat, 13 Apr 2019 22:00:16 +0300 [thread overview]
Message-ID: <83muktk9xb.fsf@gnu.org> (raw)
In-Reply-To: <87pnppu4ox.fsf@gmail.com> (message from Alex Gramiak on Sat, 13 Apr 2019 12:43:10 -0600)
> From: Alex Gramiak <agrambot@gmail.com>
> Cc: emacs-devel@gnu.org, alan@idiocy.org
> Date: Sat, 13 Apr 2019 12:43:10 -0600
>
> > I think we should soon push these to a scratch branch, so that people
> > could try that and provide feedback. It's hard to work with such
> > large changes otherwise.
>
> Sure. What's the policy is for rebasing on scratch branches?
Not sure I understand what you mean by "policy". Rebasing or not in
general is up to you, but maybe you are asking about something more
specific.
> I pushed the branch as scratch/x_emacs.
That's okay, thanks.
> > Some frame hooks are called after first making sure they are non-NULL,
> > others skip the test. Is there a reason for this inconsistency?
>
> The ones with no checks are in HAVE_WINDOW_SYSTEM and are assumed to
> exist, while the ones with checks are outside of HAVE_WINDOW_SYSTEM.
> Though it appears that I also checked a few that are in
> HAVE_WINDOW_SYSTEM. Would you prefer all of them to be checked, or just
> the ones outside of HAVE_WINDOW_SYSTEM?
If every window-system is required to provide these hooks, then I
think it will be enough to test only those which also have
implementations on TTY frames.
> >> store_frame_param (f, prop, val);
> >>
> >> - param_index = Fget (prop, Qx_frame_parameter);
> >> + param_index = Fget (prop, Qframe_parameter_pos);
> >
> > The x-frame-parameter property is visible from Lisp, no? You are here
> > replacing it with a different symbol, which is a backward-incompatible
> > change.
>
> While it is visible from Lisp, I don't see why anyone would change it
> considering that AFAIU it's used as an internal value in frame.c.
> frame.c sets it and uses the value of the property to call the
> appropriate element in frame_parm_table, which Lisp-code should not rely
> on.
>
> Then again, apparently cedet/semantic/util-modes.el accesses this
> property, but that could be changed.
Anything that gets put into frame-parameters can have some Lisp out
there using it. So I think we have 2 alternatives:
1) leave those symbols alone
2) declare them obsolete, but meanwhile put both the new and the old
symbols into frame-parameters
The above assumes that if a Lisp program does something with one of
these parameters, that will have no effect, i.e. that these parameters
are one-way communications from the Emacs internals to Lisp, as far as
Lisp programs are concerned. If the communications are two-way, then
I don't see how we can change these names; do you have any ideas?
> >> /* Store F's background color into *BGCOLOR. */
> >> static void
> >> -x_query_frame_background_color (struct frame *f, XColor *bgcolor)
> >> +gui_query_frame_background_color (struct frame *f, XColor *bgcolor)
> >> {
> >> -#ifndef HAVE_NS
> >> - bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
> >> - x_query_color (f, bgcolor);
> >> +#ifdef HAVE_NS
> >> + ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true);
> >> #else
> >> - ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, 1);
> >> + bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
> >> +# ifdef HAVE_NTGUI
> >> + w32_query_colors (f, bgcolor, 1);
> >> +# else
> >> + x_query_colors (f, bgcolor, 1);
> >> +# endif /* HAVE_NTGUI */
> >> #endif
> >
> > Why didn't you convert this to a terminal hook?
>
> In some cases I decided to leave some terminal hooks for a later patch
> to implement, just to make it easier to get this one accepted. I can add
> a hook for this if you'd like.
It's okay to do that in a followup, but please do that soon. I don't
want to risk leaving an unfinished job in the sources.
> > Any reason why some x_* functions in image.c were renamed image_*,
> > while others gui_* ?
>
> My intention is for the HAVE_WINDOW_SYSTEM-only procedures to be gui_*
> and the others to be image_*. I decided on this later on, so I may have
> a few gui_* procedures that should be image_*.
I think using image_* for all the functions in image.c would be
better.
> >> - (f, Qx_set_fullscreen, 0, 0, list2 (old_value, fullscreen));
> >> + (f, Qgui_set_fullscreen, 0, 0, list2 (old_value, fullscreen));
> >
> > This is also visible from Lisp, right? So renaming the symbol would
> > be an incompatible change.
>
> I believe frame_size_history_add only uses the symbols as a
> visual/debugging aid, so I don't believe this is, meaningfully, an
> incompatible change.
Are they in frame-parameters? If so, they are visible.
> >> diff --git a/src/menu.h b/src/menu.h
> >> index 0321c27454..4412948224 100644
> >> --- a/src/menu.h
> >> +++ b/src/menu.h
> >> @@ -47,14 +47,17 @@ extern widget_value *digest_single_submenu (int, int, bool);
> >> #if defined (HAVE_X_WINDOWS) || defined (MSDOS)
> >> extern Lisp_Object x_menu_show (struct frame *, int, int, int,
> >> Lisp_Object, const char **);
> >> +extern void x_activate_menubar (struct frame *);
> >> #endif
> >> #ifdef HAVE_NTGUI
> >> extern Lisp_Object w32_menu_show (struct frame *, int, int, int,
> >> Lisp_Object, const char **);
> >> +extern void w32_activate_menubar (struct frame *);
> >> #endif
> >> #ifdef HAVE_NS
> >> extern Lisp_Object ns_menu_show (struct frame *, int, int, int,
> >> Lisp_Object, const char **);
> >> +extern void ns_activate_menubar (struct frame *);
> >
> > Since you introduced activate_menubar_hook, why do we need to declare
> > prototypes for its implementation on menu.h, which is a
> > system-independent header?
>
> The implementations are defined in the *menu.c files, but are added as
> terminal hooks in the *term.c files.
I'm not sure I understand the answer. I didn't ask about the
implementations, I asked about the prototypes. Since these are hooks,
their names are not visible outside the corresponding *term.c file,
right? Then why do we need the prototypes of w32_activate_menubar,
ns_activate_menubar, etc. in menu.h?
> >> +/* Wrapper for defined_color_hook to support the extra argument in
> >> + ns_defined_color. */
> >
> > If the extra parameter is the only problem, we could add it to all the
> > terminal types, and just ignore it where it is not needed. Then we
> > won't need a wrapper.
>
> I wanted to avoid that (see my earlier thread about ns_defined_color),
> but if you prefer it I'll change it.
Yes, I think avoiding it makes the code less clean than having an
unused argument.
Thanks.
next prev parent reply other threads:[~2019-04-13 19:00 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-23 15:07 Renaming non-X x_* procedures in xdisp.c (and elsewhere) Alex
2019-03-23 15:38 ` Stefan Monnier
2019-03-23 16:10 ` Eli Zaretskii
2019-03-23 16:41 ` Paul Eggert
2019-03-23 16:59 ` Eli Zaretskii
2019-03-23 17:39 ` Alex
2019-03-23 17:54 ` Alex
2019-03-23 18:16 ` Eli Zaretskii
2019-03-23 18:55 ` Alex
2019-03-23 19:32 ` Eli Zaretskii
2019-03-24 4:14 ` Alex
2019-03-24 4:50 ` Alex
2019-03-24 5:39 ` Eli Zaretskii
2019-03-24 15:05 ` Alex
2019-03-24 16:01 ` Yuri Khan
2019-03-24 16:13 ` Eli Zaretskii
2019-03-24 17:03 ` Eli Zaretskii
2019-03-24 16:27 ` Eli Zaretskii
2019-03-24 18:30 ` Alex
2019-03-24 18:48 ` Eli Zaretskii
2019-03-25 19:21 ` Alex
2019-03-30 10:07 ` Eli Zaretskii
2019-03-30 17:26 ` Alex
2019-03-30 17:40 ` Eli Zaretskii
2019-03-30 17:59 ` Alex
2019-03-30 18:55 ` Eli Zaretskii
2019-03-30 23:27 ` Alex
2019-03-31 14:52 ` Eli Zaretskii
2019-04-11 19:07 ` Alex
2019-04-12 19:03 ` Eli Zaretskii
2019-04-12 19:50 ` Alex Gramiak
2019-04-12 20:10 ` Eli Zaretskii
2019-04-13 16:26 ` Alex Gramiak
2019-04-13 17:20 ` Eli Zaretskii
2019-04-13 16:13 ` [PATCH] Renaming non-X x_* identifiers (was: Renaming non-X x_* procedures in xdisp.c (and elsewhere)) Alex Gramiak
2019-04-13 17:17 ` Eli Zaretskii
2019-04-13 18:43 ` [PATCH] Renaming non-X x_* identifiers Alex Gramiak
2019-04-13 19:00 ` Eli Zaretskii [this message]
2019-04-14 3:35 ` Alex Gramiak
2019-04-14 14:02 ` Eli Zaretskii
2019-04-14 15:57 ` Alex Gramiak
2019-04-14 16:10 ` Eli Zaretskii
2019-04-14 17:34 ` Alex Gramiak
2019-04-15 14:51 ` Eli Zaretskii
2019-04-15 17:46 ` Alex Gramiak
2019-04-15 18:43 ` Eli Zaretskii
2019-04-16 16:24 ` Alex Gramiak
2019-04-16 16:45 ` Eli Zaretskii
2019-04-16 16:59 ` Alex Gramiak
2019-04-16 17:04 ` Eli Zaretskii
2019-04-16 17:07 ` Alex Gramiak
2019-04-16 18:09 ` Eli Zaretskii
2019-04-24 19:40 ` Alex Gramiak
2019-04-25 5:25 ` Eli Zaretskii
2019-04-25 9:56 ` Eli Zaretskii
2019-04-25 14:50 ` Alex Gramiak
2019-04-25 15:04 ` Eli Zaretskii
2019-04-26 6:52 ` Robert Pluim
2019-04-26 8:07 ` Eli Zaretskii
2019-04-26 23:12 ` Alex Gramiak
2019-04-15 22:01 ` Stefan Monnier
2019-04-16 2:29 ` Eli Zaretskii
2019-04-16 12:55 ` Stefan Monnier
2019-04-16 14:58 ` Eli Zaretskii
2019-04-14 3:47 ` Stefan Monnier
2019-04-27 1:53 ` Basil L. Contovounesios
2019-04-27 3:46 ` Alex Gramiak
2019-04-27 11:37 ` Basil L. Contovounesios
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83muktk9xb.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=agrambot@gmail.com \
--cc=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).