diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-04-15 12:43:37 -0400 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-04-15 12:43:37 -0400 |
commit | 5fecdbcd81db3d4a06277400c458d8ca7dcf7462 (patch) | |
tree | e8a6e1cca4f6f7642a268575ecf5243347a87ee8 /lisp/subr.el | |
parent | 4c086bf2951596d04677c343eb49fb32a3831e18 (diff) | |
parent | 5ef7ff05736b9d1b4d806cfe04ec5d99c090e748 (diff) | |
download | emacs-5fecdbcd81db3d4a06277400c458d8ca7dcf7462.tar.gz |
Merge from origin/emacs-29
5ef7ff05736 ; Start a new ChangeLog.4 file.
11126c6d30a Fix 'C-h k' for "Paste from Kill Menu" in context menus
74ddfe811f9 ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (b...
08cda286c3f Improve the documentation of the XDS support
14d1c00e806 Allow reindentation of images inserted by 'mm-inline-image'
b63a9eda01c Fix "C-h k" and "C-h c" with Paste from Kill Menu
b36c21e27dc Change cursor color on NS port when it matches the face b...
96714c106b7 Improve documentation of image-related commands
6a2863ca016 Fix handling of sliced images
5be79fd05a5 ; * etc/NEWS: Announce 'cyrillic-mongolian' IM.
ca1a0fda98a ; Fix last change.
ce63462dbda Add cyrillic-mongolian input method
58801792706 ; Minor addition to the Emacs FAQ
88847dee125 Jsonrpc: don't bind inhibit-read-only to t so early
cb8c87a423a Allow active region when IM is used
# Conflicts:
# etc/NEWS
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index f90026534e8..a7a67c570b6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1555,31 +1555,32 @@ EVENT may be an event or an event type. If EVENT is a symbol that has never been used in an event that has been read as input in the current Emacs session, then this function may fail to include the `click' modifier." - (let ((type event)) - (if (listp type) - (setq type (car type))) - (if (symbolp type) - ;; Don't read event-symbol-elements directly since we're not - ;; sure the symbol has already been parsed. - (cdr (internal-event-symbol-parse-modifiers type)) - (let ((list nil) - (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0 - ?\H-\0 ?\s-\0 ?\A-\0))))) - (if (not (zerop (logand type ?\M-\0))) - (push 'meta list)) - (if (or (not (zerop (logand type ?\C-\0))) - (< char 32)) - (push 'control list)) - (if (or (not (zerop (logand type ?\S-\0))) - (/= char (downcase char))) - (push 'shift list)) - (or (zerop (logand type ?\H-\0)) - (push 'hyper list)) - (or (zerop (logand type ?\s-\0)) - (push 'super list)) - (or (zerop (logand type ?\A-\0)) - (push 'alt list)) - list)))) + (unless (stringp event) + (let ((type event)) + (if (listp type) + (setq type (car type))) + (if (symbolp type) + ;; Don't read event-symbol-elements directly since we're not + ;; sure the symbol has already been parsed. + (cdr (internal-event-symbol-parse-modifiers type)) + (let ((list nil) + (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0 + ?\H-\0 ?\s-\0 ?\A-\0))))) + (if (not (zerop (logand type ?\M-\0))) + (push 'meta list)) + (if (or (not (zerop (logand type ?\C-\0))) + (< char 32)) + (push 'control list)) + (if (or (not (zerop (logand type ?\S-\0))) + (/= char (downcase char))) + (push 'shift list)) + (or (zerop (logand type ?\H-\0)) + (push 'hyper list)) + (or (zerop (logand type ?\s-\0)) + (push 'super list)) + (or (zerop (logand type ?\A-\0)) + (push 'alt list)) + list))))) (defun event-basic-type (event) "Return the basic type of the given event (all modifiers removed). @@ -1587,17 +1588,18 @@ The value is a printing character (not upper case) or a symbol. EVENT may be an event or an event type. If EVENT is a symbol that has never been used in an event that has been read as input in the current Emacs session, then this function may return nil." - (if (consp event) - (setq event (car event))) - (if (symbolp event) - (car (get event 'event-symbol-elements)) - (let* ((base (logand event (1- ?\A-\0))) - (uncontrolled (if (< base 32) (logior base 64) base))) - ;; There are some numbers that are invalid characters and - ;; cause `downcase' to get an error. - (condition-case () - (downcase uncontrolled) - (error uncontrolled))))) + (unless (stringp event) + (if (consp event) + (setq event (car event))) + (if (symbolp event) + (car (get event 'event-symbol-elements)) + (let* ((base (logand event (1- ?\A-\0))) + (uncontrolled (if (< base 32) (logior base 64) base))) + ;; There are some numbers that are invalid characters and + ;; cause `downcase' to get an error. + (condition-case () + (downcase uncontrolled) + (error uncontrolled)))))) (defsubst mouse-movement-p (object) "Return non-nil if OBJECT is a mouse movement event." |