branch: externals/mct commit 21bd64318cd8f14f8a4982fa8bfa449919add880 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make motions account for completions-header-format (Emacs 29) --- mct.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mct.el b/mct.el index ca3d58c0c1..ed6c6dff1b 100644 --- a/mct.el +++ b/mct.el @@ -559,8 +559,9 @@ by `mct--completions-window-name'." (defun mct--first-completion-point () "Return the `point' of the first completion." (save-excursion - (goto-char (point-min)) - (next-completion 1) + (goto-char (point-max)) + (when completions-header-format + (next-completion 1)) (point))) (defun mct--last-completion-point () @@ -639,7 +640,11 @@ the minibuffer." "Return non-nil if backward ARG motion exceeds `point-min'." (let ((line (- (line-number-at-pos) arg))) (or (< line 1) - (= (save-excursion (previous-completion arg) (point)) (point-min))))) + (when completions-header-format + (= (save-excursion + (previous-completion arg) + (line-number-at-pos)) + (line-number-at-pos (point-max))))))) (defun mct--top-of-completions-p (arg) "Test if point is at the notional top of the Completions. @@ -827,7 +832,9 @@ Apply APP while inhibiting modification hooks." (defun mct--setup-appearance () "Set up variables for the appearance of the Completions buffer." (when mct-hide-completion-mode-line - (setq-local mode-line-format nil))) + (setq-local mode-line-format nil)) + (when completions-header-format + (setq-local display-line-numbers-offset -1))) ;;;;; Shadowed path