From: Eshel Yaron Date: Mon, 8 Jul 2024 20:47:10 +0000 (+0200) Subject: Fix error when choosing 1-char completion candidates X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6ce701dd96ad51df2587ad8b3232a6e971afe78;p=emacs.git Fix error when choosing 1-char completion candidates --- diff --git a/lisp/simple.el b/lisp/simple.el index 47047ffa617..6d776e6e4dd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10006,25 +10006,10 @@ minibuffer, but don't quit the completions window." (base-position completion-base-position) (insert-function completion-list-insert-choice-function) (completion-no-auto-exit (if no-exit t completion-no-auto-exit)) - (choice - (save-excursion - (goto-char (posn-point (event-start event))) - (let (beg) - (cond - ((and (not (eobp)) - (get-text-property (point) 'completion--string)) - (setq beg (1+ (point)))) - ((and (not (bobp)) - (get-text-property (1- (point)) 'completion--string)) - (setq beg (point))) - (t (error "No completion here"))) - (setq beg (or (previous-single-property-change - beg 'completion--string) - beg)) - (get-text-property beg 'completion--string))))) - - (unless (buffer-live-p buffer) - (error "Destination buffer is dead")) + (choice (get-text-property (posn-point (event-start event)) + 'completion--string))) + (unless choice (error "No completion here")) + (unless (buffer-live-p buffer) (error "Destination buffer is dead")) (unless no-quit (quit-window nil (posn-window (event-start event)))) (let ((mstate completions-minibuffer-state))