aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2020-11-25 22:24:11 +0200
committerJuri Linkov2020-11-25 22:24:11 +0200
commitb5e34c34bcd81a0f261a5ee6dedaf51261ae5025 (patch)
treeb5666f5db1233433d6edcb017a564190eb1e1168
parent1eb168fa9765ff62361b279a480388674e1b9745 (diff)
downloademacs-b5e34c34bcd81a0f261a5ee6dedaf51261ae5025.tar.gz
emacs-b5e34c34bcd81a0f261a5ee6dedaf51261ae5025.zip
* 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.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/minibuffer.el13
-rw-r--r--lisp/simple.el7
3 files changed, 17 insertions, 6 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d1e896ef70e..5f8f408c6f2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1346,6 +1346,9 @@ When non-nil, some commands like 'describe-symbol' show more detailed
1346completions with more information in completion prefix and suffix. 1346completions with more information in completion prefix and suffix.
1347 1347
1348--- 1348---
1349*** User option 'completions-format' supports a new value 'one-column'.
1350
1351---
1349*** New user option 'bibtex-unify-case-convert'. 1352*** New user option 'bibtex-unify-case-convert'.
1350This new option allows the user to customize how case is converted 1353This new option allows the user to customize how case is converted
1351when unifying entries. 1354when unifying entries.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 48bd39587bc..87bf3d36fa4 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1679,9 +1679,11 @@ Return nil if there is no valid completion, else t."
1679 "Define the appearance and sorting of completions. 1679 "Define the appearance and sorting of completions.
1680If the value is `vertical', display completions sorted vertically 1680If the value is `vertical', display completions sorted vertically
1681in columns in the *Completions* buffer. 1681in columns in the *Completions* buffer.
1682If the value is `horizontal', display completions sorted 1682If the value is `horizontal', display completions sorted in columns
1683horizontally in alphabetical order, rather than down the screen." 1683horizontally in alphabetical order, rather than down the screen.
1684 :type '(choice (const horizontal) (const vertical)) 1684If the value is `one-column', display completions down the screen
1685in one column."
1686 :type '(choice (const horizontal) (const vertical) (const one-column))
1685 :version "23.2") 1687 :version "23.2")
1686 1688
1687(defcustom completions-detailed nil 1689(defcustom completions-detailed nil
@@ -1727,6 +1729,9 @@ It also eliminates runs of equal strings."
1727 (apply #'+ (mapcar #'string-width str)) 1729 (apply #'+ (mapcar #'string-width str))
1728 (string-width str)))) 1730 (string-width str))))
1729 (cond 1731 (cond
1732 ((eq completions-format 'one-column)
1733 ;; Nothing special
1734 )
1730 ((eq completions-format 'vertical) 1735 ((eq completions-format 'vertical)
1731 ;; Vertical format 1736 ;; Vertical format
1732 (when (> row rows) 1737 (when (> row rows)
@@ -1790,6 +1795,8 @@ It also eliminates runs of equal strings."
1790 (font-lock-prepend-text-property 1795 (font-lock-prepend-text-property
1791 beg end 'face 'completions-annotations))))) 1796 beg end 'face 'completions-annotations)))))
1792 (cond 1797 (cond
1798 ((eq completions-format 'one-column)
1799 (insert "\n"))
1793 ((eq completions-format 'vertical) 1800 ((eq completions-format 'vertical)
1794 ;; Vertical format 1801 ;; Vertical format
1795 (if (> column 0) 1802 (if (> column 0)
diff --git a/lisp/simple.el b/lisp/simple.el
index 69b4639292a..c9f4f2bb445 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5477,15 +5477,16 @@ With ARG, rotate that many kills forward (or backward, if negative)."
5477 (completions 5477 (completions
5478 (mapcar (lambda (s) 5478 (mapcar (lambda (s)
5479 (let* ((s (query-replace-descr s)) 5479 (let* ((s (query-replace-descr s))
5480 (b 0)) 5480 (b 0)
5481 (limit (frame-width)))
5481 ;; Add ellipsis on leading whitespace 5482 ;; Add ellipsis on leading whitespace
5482 (when (string-match "\\`[[:space:]]+" s) 5483 (when (string-match "\\`[[:space:]]+" s)
5483 (setq b (match-end 0)) 5484 (setq b (match-end 0))
5484 (add-text-properties 0 b `(display ,ellipsis) s)) 5485 (add-text-properties 0 b `(display ,ellipsis) s))
5485 ;; Add ellipsis at the end of a long string 5486 ;; Add ellipsis at the end of a long string
5486 (when (> (length s) (+ 40 b)) 5487 (when (> (length s) (+ limit b))
5487 (add-text-properties 5488 (add-text-properties
5488 (min (+ 40 b) (length s)) (length s) 5489 (min (+ limit b) (length s)) (length s)
5489 `(display ,ellipsis) s)) 5490 `(display ,ellipsis) s))
5490 s)) 5491 s))
5491 read-from-kill-ring-history))) 5492 read-from-kill-ring-history)))