[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct b392b0b 15/70: Allow for completions-format to be c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct b392b0b 15/70: Allow for completions-format to be configured by the user |
Date: |
Thu, 11 Nov 2021 03:57:42 -0500 (EST) |
branch: externals/mct
commit b392b0bd64311bd63ef6a10bc63ef5980458c155
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Allow for completions-format to be configured by the user
When one-column is not used, a few situations have to be handled
differently, such as the highlighting of lines or the movement between
completions options in the "*Completions*" buffer.
---
mct.el | 51 +++++++++++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/mct.el b/mct.el
index 09e0f10..a027a1d 100644
--- a/mct.el
+++ b/mct.el
@@ -132,6 +132,15 @@ See Info node `(elisp) Displaying Buffers' for more
details."
alist)
:group 'mct)
+(defcustom mct-completions-format 'one-column
+ "The Appearance and sorting used by `mct-mode'.
+See `completions-format' for possible values."
+ :set (lambda (var val)
+ (when (bound-and-true-p mct-mode)
+ (setq completions-format val))
+ (set var val))
+ :type '(choice (const horizontal) (const vertical) (const one-column))
+ :group 'mct)
;;;; Basic helper functions
@@ -204,7 +213,8 @@ Add this to `completion-list-mode-hook'."
(defun mct--hl-line ()
"Set up line highlighting for the completions' buffer.
Add this to `completion-list-mode-hook'."
- (when (derived-mode-p 'completion-list-mode)
+ (when (and (derived-mode-p 'completion-list-mode)
+ (eq mct-completions-format 'one-column))
(face-remap-add-relative 'hl-line 'mct-hl-line)
(hl-line-mode 1)))
@@ -424,12 +434,14 @@ by `mct-completion-windows-regexp'."
(mct--switch-to-completions)
(goto-char (point-max))
(next-completion -1)
- (goto-char (point-at-bol))
- (recenter
- (- -1
- (min (max 0 scroll-margin)
- (truncate (/ (window-body-height) 4.0))))
- t))
+ (when (eq mct-completions-format 'one-column)
+ (goto-char (point-at-bol))
+ (recenter
+ (- -1
+ (min (max 0 scroll-margin)
+ (truncate (/ (window-body-height) 4.0))))
+ t)))
+
(defun mct-next-completion-or-mini (&optional arg)
"Move to the next completion or switch to the minibuffer.
@@ -438,8 +450,7 @@ point can no longer move in that direction it switches to
the
minibuffer."
(interactive "p" mct-mode)
(if (or (eobp)
- (eq (point-max)
- (save-excursion (forward-line 1) (point))))
+ (= (point-max) (save-excursion (next-completion (or arg t))
(point))))
(mct-focus-minibuffer)
(next-completion (or arg 1)))
(setq this-command 'next-line))
@@ -450,18 +461,14 @@ This performs a regular motion for optional ARG lines,
but when
point can no longer move in that direction it switches to the
minibuffer."
(interactive "p" mct-mode)
- (let ((num (when (and (numberp arg) (> arg 0)) (* -1 arg))))
- (if (or (bobp)
- (and (save-excursion ; NOTE 2021-07-23: This `and' is for Emacs28
group titles
- (next-completion -1)
- (eq (line-number-at-pos) 1))
- (not
- (save-excursion
- (next-completion -1)
- (get-text-property (point) 'completion--string))))
- (eq (point) (1+ (point-min)))) ; see hack in
`mct--clean-completions'
- (mct-focus-minibuffer)
- (next-completion (or num 1)))))
+ (if (or (bobp)
+ (save-excursion
+ (previous-completion 1)
+ (and (get-text-property (point) 'completion--string)
+ (= (point) (point-min))))
+ (eq (point) (1+ (point-min)))) ; see hack in `mct--clean-completions'
+ (mct-focus-minibuffer)
+ (previous-completion (if (natnump arg) arg 1))))
;;;;; Candidate selection
@@ -750,7 +757,7 @@ To be assigned to `minibuffer-setup-hook'."
(setq resize-mini-windows t
completion-show-help nil
completion-auto-help t
- completions-format 'one-column
+ completions-format mct-completions-format
completions-detailed t)
(let ((hook 'minibuffer-setup-hook))
(add-hook hook #'mct--setup-completions)
- [elpa] externals/mct 609fd0a 12/70: Move findex and vindex annotations to their actual mentions, (continued)
- [elpa] externals/mct 609fd0a 12/70: Move findex and vindex annotations to their actual mentions, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 4882ed6 17/70: Note display-buffer in mct-display-buffer-action, ELPA Syncer, 2021/11/11
- [elpa] externals/mct e75a6c6 19/70: Update mct-display-buffer-action with sample conf, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 982b4ee 20/70: Note mct-completions-format needs mct-mode restart, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 1b0ab0b 21/70: Untabify and re-indent, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 5c0e138 22/70: Recompile texi/info manuald, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 45c272e 25/70: Add a .dir-locals.el file, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 295bac0 28/70: Generate mct.info and mct.texi using a Makefile, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 789174f 31/70: Update sample code with useful built-in extras, ELPA Syncer, 2021/11/11
- [elpa] externals/mct a55130a 06/70: Avoid hardcoding the "Completions" string, ELPA Syncer, 2021/11/11
- [elpa] externals/mct b392b0b 15/70: Allow for completions-format to be configured by the user,
ELPA Syncer <=
- [elpa] externals/mct c36c7e8 11/70: Add new option mct-live-completion, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 1084f58 16/70: Clarify mct-live-completion doc string, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 310cc42 01/70: Initial commit, ELPA Syncer, 2021/11/11
- [elpa] externals/mct ccce90d 08/70: Make line number selection always exit minibuffer, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 436b24e 13/70: Allow customizing how the Completions buffer is displayed, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 9e0d523 18/70: Change default value of mct-display-buffer-action, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 51c1e17 23/70: Reuse existing Completions' before re-displaying, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 0d98ba7 30/70: Include mct-display-buffer-action in the manual, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 08f806e 29/70: Do not set completions-detailed, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 25f876c 34/70: Do not use line-based completion in grid views, ELPA Syncer, 2021/11/11