summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-12-23 16:41:08 +0200
committerEli Zaretskii <eliz@gnu.org>2022-12-23 16:41:08 +0200
commiteccb813a943f4b6898cbe241c636c2ba5e63d271 (patch)
tree4e242fa44867588012b0adab07156a6d71403319 /lisp/subr.el
parent6dda2106ece7c307ed5c0a6cb892e736516effeb (diff)
downloademacs-eccb813a943f4b6898cbe241c636c2ba5e63d271.tar.gz
emacs-eccb813a943f4b6898cbe241c636c2ba5e63d271.tar.bz2
emacs-eccb813a943f4b6898cbe241c636c2ba5e63d271.zip
Fix "C-h k" in recursive minibuffers
* lisp/subr.el (event--posn-at-point): Leave POSN alone if it doesn't have at least 6 members. This follows more faithfully what 'event-start' and 'event-end' did before they started using this function, see commit c1cead89f5f. Call posn-at-point with the minibuffer-window when in the minibuffer. (Bug#60252)
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index e142eaa8104..a5e66de27de 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1576,16 +1576,18 @@ in the current Emacs session, then this function may return nil."
;; Use `window-point' for the case when the current buffer
;; is temporarily switched to some other buffer (bug#50256)
(let* ((pos (window-point))
- (posn (posn-at-point pos)))
- (if (null posn) ;; `pos' is "out of sight".
- (list (selected-window) pos '(0 . 0) 0)
- ;; If `pos' is inside a chunk of text hidden by an `invisible'
- ;; or `display' property, `posn-at-point' returns the position
- ;; that *is* visible, whereas `event--posn-at-point' is used
- ;; when we have a keyboard event, whose position is `point' even
- ;; if that position is invisible.
- (setf (nth 5 posn) pos)
- posn)))
+ (posn (posn-at-point pos (if (minibufferp (current-buffer))
+ (minibuffer-window)))))
+ (cond ((null posn) ;; `pos' is "out of sight".
+ (setq posn (list (selected-window) pos '(0 . 0) 0)))
+ ;; If `pos' is inside a chunk of text hidden by an `invisible'
+ ;; or `display' property, `posn-at-point' returns the position
+ ;; that *is* visible, whereas `event--posn-at-point' is used
+ ;; when we have a keyboard event, whose position is `point' even
+ ;; if that position is invisible.
+ ((> (length posn) 5)
+ (setf (nth 5 posn) pos)))
+ posn))
(defun event-start (event)
"Return the starting position of EVENT.