From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: kill-ring visualization
Date: Fri, 26 Mar 2010 09:09:16 +0200 [thread overview]
Message-ID: <87aatvogu3.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvy6hf2645.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 25 Mar 2010 22:53:34 -0400")
>>> If you use a `substring' style completion, you're already closer (tho
>>> it's not a regexp-search).
>> Is the below what you mean?
>
> Yes. Here's my "not for installation" code, FWIW,
>
> [...]
> +(defun yank-browse ()
> + "Browse the `kill-ring' to choose which entry to yank."
> + (interactive)
> + (minibuffer-with-setup-hook
> + (lambda ()
> + (set (make-local-variable 'completion-styles) '(substring))
> + ;; FIXME: use more separation between entries in *Completions*,
> + ;; somehow cleanup the \n in there as well. Maybe indent the
> + ;; entries a little bit.
This requires implementing a new option in `completions-format'
and let-binding it in `yank-browse'. It does more separation
with ^L or with a line of dashes, and cleans up the \n with
`query-replace-descr':
=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el 2010-03-23 00:59:49 +0000
+++ lisp/minibuffer.el 2010-03-26 07:09:08 +0000
@@ -818,11 +818,22 @@ (defcustom completions-format nil
If the value is `vertical', display completions sorted vertically
in columns in the *Completions* buffer.
If the value is `horizontal' or nil, display completions sorted
-horizontally in alphabetical order, rather than down the screen."
- :type '(choice (const nil) (const horizontal) (const vertical))
+horizontally in alphabetical order, rather than down the screen.
+If the value is `line', display completions in one column where
+every completion is displayed on one line with newlines and
+control characters converted to readable format and lines separated
+with a string defined by the variable `completions-format-separator'."
+ :type '(choice (const nil)
+ (const horizontal)
+ (const vertical)
+ (const line))
:group 'minibuffer
:version "23.2")
+(defvar completions-format-separator "\f" ; "--------"
+ "String inserted between completions in the *Completions* buffer.
+Used only when `completions-format' is `line'.")
+
(defun completion--insert-strings (strings)
"Insert a list of STRINGS into the current buffer.
Uses columns to keep the listing readable but compact.
@@ -858,6 +869,9 @@ (defun completion--insert-strings (strin
(string-width (cadr str)))
(string-width str))))
(cond
+ ((eq completions-format 'line)
+ ;; One-line format
+ (setq str (query-replace-descr str)))
((eq completions-format 'vertical)
;; Vertical format
(when (> row rows)
@@ -898,6 +912,9 @@ (defun completion--insert-strings (strin
'(mouse-face nil
face completions-annotations)))
(cond
+ ((eq completions-format 'line)
+ ;; One-line format
+ (insert "\n" (or completions-format-separator "") "\n"))
((eq completions-format 'vertical)
;; Vertical format
(if (> column 0)
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2010-03-26 7:09 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 6:18 kill-ring visualization joakim
2010-03-18 14:06 ` Stefan Monnier
2010-03-18 18:39 ` Leo
2010-03-18 19:37 ` joakim
2010-03-24 9:34 ` Juri Linkov
2010-03-24 13:54 ` Stefan Monnier
2010-03-25 7:04 ` Juri Linkov
2010-03-25 9:47 ` Thierry Volpiatto
2010-03-25 10:13 ` joakim
2010-03-25 10:20 ` Thierry Volpiatto
2010-03-25 13:56 ` anything.el inclusion (was: kill-ring visualization) Ted Zlatanov
2010-03-25 17:28 ` anything.el inclusion Juri Linkov
2010-03-26 6:37 ` Thierry Volpiatto
2010-03-26 7:01 ` Juri Linkov
2010-03-26 7:22 ` Thierry Volpiatto
2010-03-26 20:19 ` Stefan Monnier
2010-03-29 18:32 ` Ted Zlatanov
2010-03-29 19:34 ` Thierry Volpiatto
2010-04-03 5:44 ` Thierry Volpiatto
2010-04-03 13:53 ` Stefan Monnier
2010-04-03 14:17 ` Thierry Volpiatto
2010-04-03 19:08 ` Stefan Monnier
2010-03-26 17:09 ` Ted Zlatanov
2010-03-27 19:38 ` Juri Linkov
2010-03-27 21:35 ` Johan Busk Eriksson
2010-03-28 7:58 ` Yoni Rabkin
2010-03-28 17:39 ` joakim
2010-03-29 18:25 ` Ted Zlatanov
2010-03-26 2:00 ` regexp completion (was: kill-ring visualization) Stefan Monnier
2010-03-25 17:29 ` kill-ring visualization Juri Linkov
2010-03-26 2:53 ` Stefan Monnier
2010-03-26 7:09 ` Juri Linkov [this message]
2010-03-26 20:17 ` Stefan Monnier
2010-03-27 19:42 ` Juri Linkov
2010-03-27 20:37 ` Stefan Monnier
2010-03-30 16:07 ` Juri Linkov
2010-03-30 20:35 ` Stefan Monnier
2010-03-31 15:04 ` Juri Linkov
2010-03-25 16:49 ` Drew Adams
2010-03-18 15:16 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87aatvogu3.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.