[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b5e34c3: * lisp/minibuffer.el (completions-format): Add new value
From: |
Juri Linkov |
Subject: |
master b5e34c3: * lisp/minibuffer.el (completions-format): Add new value 'one-column'. |
Date: |
Wed, 25 Nov 2020 15:24:38 -0500 (EST) |
branch: master
commit b5e34c34bcd81a0f261a5ee6dedaf51261ae5025
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/minibuffer.el (completions-format): Add new value 'one-column'.
* lisp/minibuffer.el (completion--insert-strings): Support 'one-column'.
* lisp/simple.el (read-from-kill-ring): Truncate strings at frame-width.
---
etc/NEWS | 3 +++
lisp/minibuffer.el | 13 ++++++++++---
lisp/simple.el | 7 ++++---
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index d1e896e..5f8f408 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1346,6 +1346,9 @@ When non-nil, some commands like 'describe-symbol' show
more detailed
completions with more information in completion prefix and suffix.
---
+*** User option 'completions-format' supports a new value 'one-column'.
+
+---
*** New user option 'bibtex-unify-case-convert'.
This new option allows the user to customize how case is converted
when unifying entries.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 48bd395..87bf3d3 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1679,9 +1679,11 @@ Return nil if there is no valid completion, else t."
"Define the appearance and sorting of completions.
If the value is `vertical', display completions sorted vertically
in columns in the *Completions* buffer.
-If the value is `horizontal', display completions sorted
-horizontally in alphabetical order, rather than down the screen."
- :type '(choice (const horizontal) (const vertical))
+If the value is `horizontal', display completions sorted in columns
+horizontally in alphabetical order, rather than down the screen.
+If the value is `one-column', display completions down the screen
+in one column."
+ :type '(choice (const horizontal) (const vertical) (const one-column))
:version "23.2")
(defcustom completions-detailed nil
@@ -1727,6 +1729,9 @@ It also eliminates runs of equal strings."
(apply #'+ (mapcar #'string-width str))
(string-width str))))
(cond
+ ((eq completions-format 'one-column)
+ ;; Nothing special
+ )
((eq completions-format 'vertical)
;; Vertical format
(when (> row rows)
@@ -1790,6 +1795,8 @@ It also eliminates runs of equal strings."
(font-lock-prepend-text-property
beg end 'face 'completions-annotations)))))
(cond
+ ((eq completions-format 'one-column)
+ (insert "\n"))
((eq completions-format 'vertical)
;; Vertical format
(if (> column 0)
diff --git a/lisp/simple.el b/lisp/simple.el
index 69b4639..c9f4f2b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5477,15 +5477,16 @@ With ARG, rotate that many kills forward (or backward,
if negative)."
(completions
(mapcar (lambda (s)
(let* ((s (query-replace-descr s))
- (b 0))
+ (b 0)
+ (limit (frame-width)))
;; Add ellipsis on leading whitespace
(when (string-match "\\`[[:space:]]+" s)
(setq b (match-end 0))
(add-text-properties 0 b `(display ,ellipsis) s))
;; Add ellipsis at the end of a long string
- (when (> (length s) (+ 40 b))
+ (when (> (length s) (+ limit b))
(add-text-properties
- (min (+ 40 b) (length s)) (length s)
+ (min (+ limit b) (length s)) (length s)
`(display ,ellipsis) s))
s))
read-from-kill-ring-history)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b5e34c3: * lisp/minibuffer.el (completions-format): Add new value 'one-column'.,
Juri Linkov <=