master 556b803339d 2/2: ; Fix last change

Eli Zaretskii <[email protected]> Thu, 23 Jul 2026 02:54:02 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 556b803339d2bf72f361851f4a6fae3954d14652
Author: Eli Zaretskii <[email protected]>
Commit: Eli Zaretskii <[email protected]>

    ; Fix last change
    
    * src/keyboard.c (Fposn_point): Doc and commentary fixes.
    
    * test/src/keyboard-tests.el (keyboard-tests-keymap-property): New
    test, taken from reproduction recipe by Spencer Baugh
    <[email protected]>.  (Bug#81386)
---
 src/keyboard.c             |  8 ++++----
 test/src/keyboard-tests.el | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index 8eb2e84b280..970023f1157 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -13100,7 +13100,7 @@ DEFUN ("posn-point", Fposn_point, Sposn_point, 1, 1, 0,
        doc: /* Return the buffer location in POSITION.
 POSITION should be a list of the form returned by the `event-start'
 and `event-end' functions.
-Returns nil if POSITION does not correspond to any buffer location (e.g.
+Return nil if POSITION does not correspond to any buffer location (e.g.,
 a click on a scroll bar).  */)
   (Lisp_Object position)
 {
@@ -13109,12 +13109,12 @@ a click on a scroll bar).  */)
     return posn;
   /* POSITION is a short position list (such as returned by
      `event--posn-at-point') without a POSN_BUFFER_POSN; fall back to
-     the location in POSN_POSN. */
+     the location in POSN_POSN.  */
   posn = POSN_POSN (position);
   if (CONSP (posn))
     return XCAR (posn);
-  /* Apparently this can also be `vertical-scroll-bar' (bug#13979).  */
-  if (INTEGERP (posn))
+  /* Apparently, POSN can also be `vertical-scroll-bar' (bug#13979).  */
+  if (FIXNUMP (posn))
     return posn;
   return Qnil;
 }
diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el
index b64b20fb6cb..6b64503fe8c 100644
--- a/test/src/keyboard-tests.el
+++ b/test/src/keyboard-tests.el
@@ -476,5 +476,20 @@ even if `input-decode-map' has not yet scanned the tail."
     (keyboard-tests--rks-execute (list ?\C-c ?\C-h) map)
     (should called)))
 
+(ert-deftest keyboard-tests-keymap-property ()
+  "Test `describe-key' when keymap is a text property."
+  (defvar-keymap my-test-map "<f5>" #'forward-line)
+  (with-temp-buffer
+    (pop-to-buffer (current-buffer))
+    (save-excursion (insert "hello world"))
+    (put-text-property (point-min) (point-max) 'keymap my-test-map)
+    (describe-key (list (cons (kbd "<f5>") (kbd "<f5>"))))
+    (with-current-buffer "*Help*"
+      (goto-char (point-min))
+      (should (string-match-p "(found in my-test-map)"
+                              (buffer-substring
+                               (line-beginning-position)
+                               (line-end-position)))))))
+
 (provide 'keyboard-tests)
 ;;; keyboard-tests.el ends here