diff options
| author | Eli Zaretskii | 2023-04-08 15:36:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-04-08 15:36:44 +0300 |
| commit | b63a9eda01c692d1c6dae8ef6563678f8ddd7faf (patch) | |
| tree | ed41e71cc34bc3257985d18e1b47563bd84e5931 | |
| parent | b36c21e27dc6fa96c7c09b0e3a8fe9dcbdcea78b (diff) | |
| download | emacs-b63a9eda01c692d1c6dae8ef6563678f8ddd7faf.tar.gz emacs-b63a9eda01c692d1c6dae8ef6563678f8ddd7faf.zip | |
Fix "C-h k" and "C-h c" with Paste from Kill Menu
* lisp/subr.el (event-basic-type, event-modifiers): Return nil if
EVENT is a string. (Bug#62626)
| -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 2e31929e548..46dcd97d829 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1520,31 +1520,32 @@ EVENT may be an event or an event type. If EVENT is a symbol | |||
| 1520 | that has never been used in an event that has been read as input | 1520 | that has never been used in an event that has been read as input |
| 1521 | in the current Emacs session, then this function may fail to include | 1521 | in the current Emacs session, then this function may fail to include |
| 1522 | the `click' modifier." | 1522 | the `click' modifier." |
| 1523 | (let ((type event)) | 1523 | (unless (stringp event) |
| 1524 | (if (listp type) | 1524 | (let ((type event)) |
| 1525 | (setq type (car type))) | 1525 | (if (listp type) |
| 1526 | (if (symbolp type) | 1526 | (setq type (car type))) |
| 1527 | ;; Don't read event-symbol-elements directly since we're not | 1527 | (if (symbolp type) |
| 1528 | ;; sure the symbol has already been parsed. | 1528 | ;; Don't read event-symbol-elements directly since we're not |
| 1529 | (cdr (internal-event-symbol-parse-modifiers type)) | 1529 | ;; sure the symbol has already been parsed. |
| 1530 | (let ((list nil) | 1530 | (cdr (internal-event-symbol-parse-modifiers type)) |
| 1531 | (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0 | 1531 | (let ((list nil) |
| 1532 | ?\H-\0 ?\s-\0 ?\A-\0))))) | 1532 | (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0 |
| 1533 | (if (not (zerop (logand type ?\M-\0))) | 1533 | ?\H-\0 ?\s-\0 ?\A-\0))))) |
| 1534 | (push 'meta list)) | 1534 | (if (not (zerop (logand type ?\M-\0))) |
| 1535 | (if (or (not (zerop (logand type ?\C-\0))) | 1535 | (push 'meta list)) |
| 1536 | (< char 32)) | 1536 | (if (or (not (zerop (logand type ?\C-\0))) |
| 1537 | (push 'control list)) | 1537 | (< char 32)) |
| 1538 | (if (or (not (zerop (logand type ?\S-\0))) | 1538 | (push 'control list)) |
| 1539 | (/= char (downcase char))) | 1539 | (if (or (not (zerop (logand type ?\S-\0))) |
| 1540 | (push 'shift list)) | 1540 | (/= char (downcase char))) |
| 1541 | (or (zerop (logand type ?\H-\0)) | 1541 | (push 'shift list)) |
| 1542 | (push 'hyper list)) | 1542 | (or (zerop (logand type ?\H-\0)) |
| 1543 | (or (zerop (logand type ?\s-\0)) | 1543 | (push 'hyper list)) |
| 1544 | (push 'super list)) | 1544 | (or (zerop (logand type ?\s-\0)) |
| 1545 | (or (zerop (logand type ?\A-\0)) | 1545 | (push 'super list)) |
| 1546 | (push 'alt list)) | 1546 | (or (zerop (logand type ?\A-\0)) |
| 1547 | list)))) | 1547 | (push 'alt list)) |
| 1548 | list))))) | ||
| 1548 | 1549 | ||
| 1549 | (defun event-basic-type (event) | 1550 | (defun event-basic-type (event) |
| 1550 | "Return the basic type of the given event (all modifiers removed). | 1551 | "Return the basic type of the given event (all modifiers removed). |
| @@ -1552,17 +1553,18 @@ The value is a printing character (not upper case) or a symbol. | |||
| 1552 | EVENT may be an event or an event type. If EVENT is a symbol | 1553 | EVENT may be an event or an event type. If EVENT is a symbol |
| 1553 | that has never been used in an event that has been read as input | 1554 | that has never been used in an event that has been read as input |
| 1554 | in the current Emacs session, then this function may return nil." | 1555 | in the current Emacs session, then this function may return nil." |
| 1555 | (if (consp event) | 1556 | (unless (stringp event) |
| 1556 | (setq event (car event))) | 1557 | (if (consp event) |
| 1557 | (if (symbolp event) | 1558 | (setq event (car event))) |
| 1558 | (car (get event 'event-symbol-elements)) | 1559 | (if (symbolp event) |
| 1559 | (let* ((base (logand event (1- ?\A-\0))) | 1560 | (car (get event 'event-symbol-elements)) |
| 1560 | (uncontrolled (if (< base 32) (logior base 64) base))) | 1561 | (let* ((base (logand event (1- ?\A-\0))) |
| 1561 | ;; There are some numbers that are invalid characters and | 1562 | (uncontrolled (if (< base 32) (logior base 64) base))) |
| 1562 | ;; cause `downcase' to get an error. | 1563 | ;; There are some numbers that are invalid characters and |
| 1563 | (condition-case () | 1564 | ;; cause `downcase' to get an error. |
| 1564 | (downcase uncontrolled) | 1565 | (condition-case () |
| 1565 | (error uncontrolled))))) | 1566 | (downcase uncontrolled) |
| 1567 | (error uncontrolled)))))) | ||
| 1566 | 1568 | ||
| 1567 | (defsubst mouse-movement-p (object) | 1569 | (defsubst mouse-movement-p (object) |
| 1568 | "Return non-nil if OBJECT is a mouse movement event." | 1570 | "Return non-nil if OBJECT is a mouse movement event." |