unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Use of `window-system' as a predicate is deprecated.  Why?
Date: Sat, 9 Jul 2022 13:27:43 +0000	[thread overview]
Message-ID: <YsmCT/XKZucmoNQn@ACM> (raw)
In-Reply-To: <831quu31dh.fsf@gnu.org>

Hello, Eli.

On Sat, Jul 09, 2022 at 15:40:42 +0300, Eli Zaretskii wrote:
> > Date: Sat, 9 Jul 2022 12:22:41 +0000
> > From: Alan Mackenzie <acm@muc.de>

> >    Do _not_ use `window-system' and `initial-window-system' as predicates
> >    or boolean flag variables, if you want to write code that works
> >    differently on text terminals and graphic displays.  That is because
> >    `window-system' is not a good indicator of Emacs capabilities on a
> >    given display type.  Instead, use `display-graphic-p' or any of the
> >    other `display-*-p' predicates described in Display Feature Testing.

> > ..  I am amending minibuf.c and wish to know only whether the current
> > terminal->focus_frame_hook is validly set.

> > The manual entry seems to be to be unnecessarily patronising.  It
> > insinuates that the only possible "capabilities" a user could be
> > interested in are graphic capabilities.

> The ELisp reference manual is written for Lisp programmers, not for
> people who work on the C sources.

:-)

> To check whether terminal->focus_frame_hook is set, test it for being
> non-NULL.

I think I did at one time, and it was set to x_focus_frame, even though I
was on a linux tty.  But maybe I'm mistaken.  Anyway, that doesn't really
matter, because ....

> More generally, if you want to know whether a frame is on a
> window-system, use the FRAME_WINDOW_P macro.

This indeed works well, on a linux tty, and in X Windows, both with and
without -nw.  Thanks!

Just as a matter of interest, I think we're nearly there with bug #56305
"29.0.50; 'yes-or-no-p' deselects minibuffer frame".  There are just one
or two things to clear up with Martin.

-- 
Alan Mackenzie (Nuremberg, Germany).



      reply	other threads:[~2022-07-09 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09 12:22 Use of `window-system' as a predicate is deprecated. Why? Alan Mackenzie
2022-07-09 12:36 ` Po Lu
2022-07-09 12:37   ` Po Lu
2022-07-09 12:40 ` Eli Zaretskii
2022-07-09 13:27   ` Alan Mackenzie [this message]

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=YsmCT/XKZucmoNQn@ACM \
    --to=acm@muc.de \
    --cc=eliz@gnu.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).