From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: kill-ring visualization Date: Fri, 26 Mar 2010 09:09:16 +0200 Organization: JURTA Message-ID: <87aatvogu3.fsf@mail.jurta.org> References: <87y6hib6vi.fsf@mail.jurta.org> <87aatwv12t.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269587393 4742 80.91.229.12 (26 Mar 2010 07:09:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Mar 2010 07:09:53 +0000 (UTC) Cc: Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 26 08:09:48 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv3fv-00042J-PO for ged-emacs-devel@m.gmane.org; Fri, 26 Mar 2010 08:09:48 +0100 Original-Received: from localhost ([127.0.0.1]:42871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv3fv-00015O-2b for ged-emacs-devel@m.gmane.org; Fri, 26 Mar 2010 03:09:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv3fo-00014M-4n for emacs-devel@gnu.org; Fri, 26 Mar 2010 03:09:40 -0400 Original-Received: from [140.186.70.92] (port=39995 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv3fk-00011J-K4 for emacs-devel@gnu.org; Fri, 26 Mar 2010 03:09:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv3fg-0004EX-V6 for emacs-devel@gnu.org; Fri, 26 Mar 2010 03:09:35 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:41170 helo=mx1.starman.ee) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv3fg-0004E1-Bk for emacs-devel@gnu.org; Fri, 26 Mar 2010 03:09:32 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.30.101.cable.starman.ee [82.131.30.101]) by mx1.starman.ee (Postfix) with ESMTP id 0A2643F40CD; Fri, 26 Mar 2010 09:09:25 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Thu, 25 Mar 2010 22:53:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:122692 Archived-At: >>> 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/