>> Please remove (= n 1) and replace (setq n 0) with (setq n (1- n)) to >> support the prefix arg with ‘M-N M-n’. > > When n > 0. > You mean this, right? diff --git a/lisp/simple.el b/lisp/simple.el index 63479e9ce0..0221881641 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9698,6 +9698,14 @@ next-completion (let ((tabcommand (member (this-command-keys) '("\t" [backtab]))) pos) (catch 'bound + (when (and (bobp) + (> n 0) + (get-text-property (point) 'mouse-face) + (not (get-text-property (point) 'first-completion))) + (let ((inhibit-read-only t)) + (add-text-properties (point) (1+ (point)) '(first-completion t))) + (setq n (1- n))) + (while (> n 0) (setq pos (point)) ;; If in a completion, move to the end of it. It took me a few minutes to understand what you meant by "support the prefix arg" in this case. And indeed with the previous version of the patch, M-x M-2 M- selects the third completion candidate (2C-split), whereas with this patch the second one (2C-command) is selected.