From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48408: BUGFIX: window-default-font-height: check for nil string Date: Sun, 16 May 2021 09:29:22 +0300 Message-ID: <83tun3ur7h.fsf@gnu.org> References: <20210514011519.vsy5jbhyxd4v6kpt@E15-2016.optimum.net> <83mtsxzund.fsf@gnu.org> <20210516030618.7caj6icukblavhbp@E15-2016.optimum.net> <835yzjwbnj.fsf@gnu.org> <20210516044215.23yd5ae3yeby6kaq@E15-2016.optimum.net> <83zgwvuu5z.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4065"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48408@debbugs.gnu.org To: boruch_baum@gmx.com, martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 16 08:30:59 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1liAIk-0000um-FJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 May 2021 08:30:58 +0200 Original-Received: from localhost ([::1]:45556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liAIi-0005FQ-Mk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 May 2021 02:30:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liAHt-0005FF-Tt for bug-gnu-emacs@gnu.org; Sun, 16 May 2021 02:30:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1liAHq-00076T-RZ for bug-gnu-emacs@gnu.org; Sun, 16 May 2021 02:30:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1liAHq-00074U-L2 for bug-gnu-emacs@gnu.org; Sun, 16 May 2021 02:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 May 2021 06:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48408 X-GNU-PR-Package: emacs Original-Received: via spool by 48408-submit@debbugs.gnu.org id=B48408.162114657327118 (code B ref 48408); Sun, 16 May 2021 06:30:02 +0000 Original-Received: (at 48408) by debbugs.gnu.org; 16 May 2021 06:29:33 +0000 Original-Received: from localhost ([127.0.0.1]:49591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1liAHN-00073K-8e for submit@debbugs.gnu.org; Sun, 16 May 2021 02:29:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1liAHL-000737-6k for 48408@debbugs.gnu.org; Sun, 16 May 2021 02:29:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42532) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liAHE-0006pA-OW; Sun, 16 May 2021 02:29:24 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2999 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liAHD-0006TE-Eb; Sun, 16 May 2021 02:29:24 -0400 In-Reply-To: <83zgwvuu5z.fsf@gnu.org> (message from Eli Zaretskii on Sun, 16 May 2021 08:25:28 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206637 Archived-At: > Date: Sun, 16 May 2021 08:25:28 +0300 > From: Eli Zaretskii > Cc: 48408@debbugs.gnu.org > > > on tty frame: (#) > > on gui frame: (#) > > 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))