Subject: Re: bug#35058: [PATCH] Use display-graphic-p in more cases

From: Eli Zaretskii <[email-masked]>
Date: Fri, 05 Apr 2019 10:29:43 +0300

> From: Alex <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 03 Apr 2019 14:26:30 -0600
> 
> I've attached a patch series below (including the logb change Basil
> recommended). Are these okay to apply?

Almost, we are close.  See the remaining few comments below.

> The first patch does still use display-graphic-p in a few cases in
> frame.el for the predicates concerning pixel dimensions. Do you really
> want them to use memq instead?

For the display-* functions, yes, I'd like to leave their definitions
explicit.

> +(defun display-symbol-keys-p (&optional display)
> +  "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)))
> +    (or (memq frame-type '(x w32 ns pc))
> +        (memq system-type '(ms-dos windows-nt)))))

Please add a comment here explaining that MS-Windows/MS-DOS terminals
are an exception because they have built-in support for function keys.

> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -55,6 +55,7 @@ term-file-aliases
>    :group 'terminals
>    :version "25.1")
>  
> +(declare-function display-graphic-p "frame" (&optional display))

Did you try to bootstrap with this?  frame.el is loaded after
faces.el.  (There are more similar declarations in the patches with
the same issues.)

> --- a/lisp/emulation/cua-base.el
> +++ b/lisp/emulation/cua-base.el
> @@ -427,7 +427,7 @@ cua-rectangle-mark-key
>  
>  (defcustom cua-rectangle-modifier-key 'meta
>    "Modifier key used for rectangle commands bindings.
> -On non-window systems, always use the meta modifier.
> +On non-window systems, use `cua-rectangle-terminal-modifier-key'.
>  Must be set prior to enabling CUA."
>    :type '(choice (const :tag "Meta key" meta)
>  		 (const :tag "Alt key" alt)
> @@ -435,6 +435,16 @@ cua-rectangle-modifier-key
>  		 (const :tag "Super key" super))
>    :group 'cua)
>  
> +(defcustom cua-rectangle-terminal-modifier-key 'meta
> +  "Modifier key used for rectangle commands bindings in terminals.
> +Must be set prior to enabling CUA."
> +  :type '(choice (const :tag "Meta key" meta)
> +		 (const :tag "Alt key" alt)
> +		 (const :tag "Hyper key" hyper)
> +		 (const :tag "Super key" super))
> +  :group 'cua
> +  :version "27.1")

This change should be called out in NEWS.

The new display-* predicates should probably also be mentioned in
NEWS.

Thanks.