aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-03 14:03:28 -0600
committerAlexander Gramiak2019-04-06 22:43:59 -0600
commitcffc04c48dfed59ab9d958b9b64948d5fa491fbe (patch)
treef60c348f1d7713ff2065d22de7dc16a17fc650e3
parentc6ea522de62d6064d5be9dd1ddf69dceb6506780 (diff)
downloademacs-cffc04c48dfed59ab9d958b9b64948d5fa491fbe.tar.gz
emacs-cffc04c48dfed59ab9d958b9b64948d5fa491fbe.zip
Define and use new procedure display-symbol-keys-p
* lisp/frame.el (display-symbol-keys-p): Define. * lisp/simple.el (normal-erase-is-backspace-setup-frame): Use eq instead of memq. (normal-erase-is-backspace-mode): Use display-symbol-keys-p.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/frame.el10
-rw-r--r--lisp/simple.el7
3 files changed, 20 insertions, 3 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 26c761ae01f..be4543c0166 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1230,6 +1230,12 @@ the 128...255 range, as expected.
1230This allows to create and parent immediately a minibuffer-only child 1230This allows to create and parent immediately a minibuffer-only child
1231frame when making a frame. 1231frame when making a frame.
1232 1232
1233---
1234*** New predicates 'display-blink-cursor-p' and 'display-symbol-keys-p'.
1235These predicates are to be preferred over 'display-graphic-p' when
1236testing for blinking cursor capability and the capability to have
1237symbols (e.g., [return], [tab], [backspace]) as keys respectively.
1238
1233** Tabulated List mode 1239** Tabulated List mode
1234 1240
1235+++ 1241+++
diff --git a/lisp/frame.el b/lisp/frame.el
index cc8ca49b3b7..aa14e87d7b8 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1927,6 +1927,16 @@ frame's display)."
1927 (t 1927 (t
1928 nil)))) 1928 nil))))
1929 1929
1930(defun display-symbol-keys-p (&optional display)
1931 "Return non-nil if DISPLAY supports symbol names as keys.
1932This means that, for example, DISPLAY can differentiate between
1933the keybinding RET and [return]."
1934 (let ((frame-type (framep-on-display display)))
1935 (or (memq frame-type '(x w32 ns pc))
1936 ;; MS-DOS and MS-Windows terminals have built-in support for
1937 ;; function (symbol) keys
1938 (memq system-type '(ms-dos windows-nt)))))
1939
1930(declare-function x-display-screens "xfns.c" (&optional terminal)) 1940(declare-function x-display-screens "xfns.c" (&optional terminal))
1931 1941
1932(defun display-screens (&optional display) 1942(defun display-screens (&optional display)
diff --git a/lisp/simple.el b/lisp/simple.el
index 306df967661..857e0fc001b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8690,7 +8690,7 @@ call `normal-erase-is-backspace-mode' (which see) instead."
8690 (and (not noninteractive) 8690 (and (not noninteractive)
8691 (or (memq system-type '(ms-dos windows-nt)) 8691 (or (memq system-type '(ms-dos windows-nt))
8692 (memq window-system '(w32 ns)) 8692 (memq window-system '(w32 ns))
8693 (and (memq window-system '(x)) 8693 (and (eq window-system 'x)
8694 (fboundp 'x-backspace-delete-keys-p) 8694 (fboundp 'x-backspace-delete-keys-p)
8695 (x-backspace-delete-keys-p)) 8695 (x-backspace-delete-keys-p))
8696 ;; If the terminal Emacs is running on has erase char 8696 ;; If the terminal Emacs is running on has erase char
@@ -8701,6 +8701,8 @@ call `normal-erase-is-backspace-mode' (which see) instead."
8701 normal-erase-is-backspace) 8701 normal-erase-is-backspace)
8702 1 0))))) 8702 1 0)))))
8703 8703
8704(declare-function display-symbol-keys-p "frame" (&optional display))
8705
8704(define-minor-mode normal-erase-is-backspace-mode 8706(define-minor-mode normal-erase-is-backspace-mode
8705 "Toggle the Erase and Delete mode of the Backspace and Delete keys. 8707 "Toggle the Erase and Delete mode of the Backspace and Delete keys.
8706 8708
@@ -8736,8 +8738,7 @@ See also `normal-erase-is-backspace'."
8736 (let ((enabled (eq 1 (terminal-parameter 8738 (let ((enabled (eq 1 (terminal-parameter
8737 nil 'normal-erase-is-backspace)))) 8739 nil 'normal-erase-is-backspace))))
8738 8740
8739 (cond ((or (memq window-system '(x w32 ns pc)) 8741 (cond ((display-symbol-keys-p)
8740 (memq system-type '(ms-dos windows-nt)))
8741 (let ((bindings 8742 (let ((bindings
8742 '(([M-delete] [M-backspace]) 8743 '(([M-delete] [M-backspace])
8743 ([C-M-delete] [C-M-backspace]) 8744 ([C-M-delete] [C-M-backspace])