From: Eli Zaretskii <eliz@gnu.org>
To: boruch_baum@gmx.com, martin rudalics <rudalics@gmx.at>
Cc: 48408@debbugs.gnu.org
Subject: bug#48408: BUGFIX: window-default-font-height: check for nil string
Date: Sun, 16 May 2021 09:29:22 +0300 [thread overview]
Message-ID: <83tun3ur7h.fsf@gnu.org> (raw)
In-Reply-To: <83zgwvuu5z.fsf@gnu.org> (message from Eli Zaretskii on Sun, 16 May 2021 08:25:28 +0300)
> Date: Sun, 16 May 2021 08:25:28 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 48408@debbugs.gnu.org
>
> > on tty frame: (#<frame F152 0x5599a3b27720>)
> > on gui frame: (#<frame F152 0x5599a3b27720>)
>
> Thanks. So you have just one frame in that session, which is a TTY
> frame? I thought it was a session with both GUI and TTY frames, is
> that not so?
>
> Anyway, the above probably means we set up frame parameters
> incorrectly somewhere. Hmm...
Turns out it's a feature, see this comment in server.el:
;; Note: TTY frames still get a `display' parameter set to the value of
;; $DISPLAY. This is useful when running from that tty frame
;; sub-processes that want to connect to the X server, but that means we
;; have to be careful here not to be tricked into thinking those frames
;; are on `display'.
Boruch, can you try the patch below?
Martin, any comments on this change? AFAIU we had this subtlety
waiting to bite us since about forever.
diff --git a/lisp/frame.el b/lisp/frame.el
index aff1d47..f6d6ddd 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2025,11 +2025,23 @@ frame-size-changed-p
(declare-function msdos-mouse-p "dosfns.c")
+(defun frame-type (&optional display)
+ "Return the type of frames on DISPLAY.
+DISPLAY can be a display name, a frame, or nil (meaning the selected
+frame's display).
+This function is almost like `framep-on-display', but it is safer
+when a session has both text-mode and GUI client frames, because
+text-mode frames can still have a non-nil `display' frame parameter."
+ (cond
+ ((null display) (framep (selected-frame)))
+ ((framep display) (framep display))
+ (t (framep-on-display display))))
+
(defun display-mouse-p (&optional display)
"Return non-nil if DISPLAY has a mouse available.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display)."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((eq frame-type 'pc)
(msdos-mouse-p))
@@ -2062,7 +2074,8 @@ display-graphic-p
that use a window system such as X, and false for text-only terminals.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display)."
- (not (null (memq (framep-on-display display) '(x w32 ns)))))
+ (let ((frame-type (frame-type display)))
+ (not (null (memq frame-type '(x w32 ns))))))
(defun display-images-p (&optional display)
"Return non-nil if DISPLAY can display images.
@@ -2083,7 +2096,7 @@ display-selections-p
via special system buffers called `selection' or `clipboard'.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display)."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((eq frame-type 'pc)
;; MS-DOS frames support selections when Emacs runs inside
@@ -2099,7 +2112,7 @@ display-symbol-keys-p
"Return non-nil if DISPLAY supports symbol names as keys.
This means that, for example, DISPLAY can differentiate between
the keybinding RET and [return]."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(or (memq frame-type '(x w32 ns pc))
;; MS-DOS and MS-Windows terminals have built-in support for
;; function (symbol) keys
@@ -2111,7 +2124,7 @@ display-screens
"Return the number of screens associated with DISPLAY.
DISPLAY should be either a frame or a display name (a string).
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-screens display))
@@ -2131,7 +2144,7 @@ display-pixel-height
refers to the pixel height for all physical monitors associated
with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-pixel-height display))
@@ -2151,7 +2164,7 @@ display-pixel-width
refers to the pixel width for all physical monitors associated
with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-pixel-width display))
@@ -2191,7 +2204,7 @@ display-mm-height
refers to the height in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
- (and (memq (framep-on-display display) '(x w32 ns))
+ (and (memq (frame-type display) '(x w32 ns))
(or (cddr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
(cddr (assoc t display-mm-dimensions-alist))
@@ -2212,7 +2225,7 @@ display-mm-width
refers to the width in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
- (and (memq (framep-on-display display) '(x w32 ns))
+ (and (memq (frame-type display) '(x w32 ns))
(or (cadr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
(cadr (assoc t display-mm-dimensions-alist))
@@ -2228,7 +2241,7 @@ display-backing-store
the question is inapplicable to a certain kind of display.
DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-backing-store display))
@@ -2241,7 +2254,7 @@ display-save-under
"Return non-nil if DISPLAY's screen supports the SaveUnder feature.
DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-save-under display))
@@ -2254,7 +2267,7 @@ display-planes
"Return the number of planes supported by DISPLAY.
DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-planes display))
@@ -2269,7 +2282,7 @@ display-color-cells
"Return the number of color cells supported by DISPLAY.
DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-color-cells display))
@@ -2286,7 +2299,7 @@ display-visual-class
`static-color', `pseudo-color', `true-color', or `direct-color'.
DISPLAY can be a display name or a frame.
If DISPLAY is omitted or nil, it defaults to the selected frame's display."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((memq frame-type '(x w32 ns))
(x-display-visual-class display))
@@ -2342,7 +2355,7 @@ display-monitor-attributes-list
in a graphical display is dominated by exactly one physical
monitor at a time, though it can span multiple (or no) physical
monitors."
- (let ((frame-type (framep-on-display display)))
+ (let ((frame-type (frame-type display)))
(cond
((eq frame-type 'x)
(x-display-monitor-attributes-list display))
next prev parent reply other threads:[~2021-05-16 6:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 1:15 bug#48408: BUGFIX: window-default-font-height: check for nil string Boruch Baum
2021-05-14 6:39 ` Eli Zaretskii
2021-05-16 3:06 ` Boruch Baum
2021-05-16 4:22 ` Eli Zaretskii
2021-05-16 4:42 ` Boruch Baum
2021-05-16 5:25 ` Eli Zaretskii
2021-05-16 6:05 ` Boruch Baum
2021-05-16 6:32 ` Eli Zaretskii
2021-05-16 6:29 ` Eli Zaretskii [this message]
[not found] ` <20210516065904.5wweuipi23oy5g2x@E15-2016.optimum.net>
2021-05-16 8:30 ` Eli Zaretskii
2021-05-16 8:35 ` martin rudalics
2021-05-16 8:56 ` Eli Zaretskii
2021-05-16 9:08 ` Eli Zaretskii
2021-05-16 9:28 ` martin rudalics
2021-05-16 9:36 ` Eli Zaretskii
2021-05-19 4:00 ` Boruch Baum
2021-05-19 7:45 ` martin rudalics
2021-05-19 10:39 ` Boruch Baum
2021-05-19 11:29 ` Eli Zaretskii
2021-05-19 11:55 ` Boruch Baum
2021-05-19 14:17 ` Eli Zaretskii
2021-05-19 16:01 ` Eli Zaretskii
2022-07-12 22:59 ` Lars Ingebrigtsen
2021-05-16 8:31 ` martin rudalics
2021-05-14 7:09 ` martin rudalics
2021-05-14 7:15 ` martin rudalics
2021-05-14 7:26 ` Eli Zaretskii
2021-05-14 8:15 ` martin rudalics
2021-05-14 10:45 ` Eli Zaretskii
2021-05-16 3:11 ` Boruch Baum
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=83tun3ur7h.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=48408@debbugs.gnu.org \
--cc=boruch_baum@gmx.com \
--cc=rudalics@gmx.at \
/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).