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: Vertical completions Date: Tue, 17 Nov 2009 19:45:54 +0200 Organization: JURTA Message-ID: <87bpj16pkh.fsf@mail.jurta.org> References: <61C01A08-8FB6-4908-B9F1-B9F1CE3E3D92@gmail.com> <20091111212658.GD12012@headley> <87fx8kjosa.fsf_-_@mail.jurta.org> <7b501d5c0911120209x7c8f493fm68fadef6f1311206@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1258480890 23133 80.91.229.12 (17 Nov 2009 18:01:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2009 18:01:30 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Deniz Dogan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 19:01:22 2009 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.50) id 1NASMc-0001nx-Lp for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2009 19:01:15 +0100 Original-Received: from localhost ([127.0.0.1]:33769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NASMc-0004hd-4e for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2009 13:01:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NASKg-00036y-60 for emacs-devel@gnu.org; Tue, 17 Nov 2009 12:59:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NASKb-00034G-1F for emacs-devel@gnu.org; Tue, 17 Nov 2009 12:59:13 -0500 Original-Received: from [199.232.76.173] (port=53331 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NASKa-000347-Td for emacs-devel@gnu.org; Tue, 17 Nov 2009 12:59:08 -0500 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:38781 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NASKa-0007K5-8M for emacs-devel@gnu.org; Tue, 17 Nov 2009 12:59:08 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.30.92.cable.starman.ee [82.131.30.92]) by mx1.starman.ee (Postfix) with ESMTP id 743B63F41A2; Tue, 17 Nov 2009 19:59:01 +0200 (EET) In-Reply-To: <7b501d5c0911120209x7c8f493fm68fadef6f1311206@mail.gmail.com> (Deniz Dogan's message of "Thu, 12 Nov 2009 11:09:33 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.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:117112 Archived-At: >>>> And speaking about *Completions*, would it be possible to fill the >>>> completions column-first, not row-first as it is now? =A0I find it q= uite >>>> unreasonable, as the display is column-wise, but not so filling, mak= ing >>>> it harder to quickly skim through the list. >> >> It's easier to skim through a list when completions are sorted >> vertically in columns down the screen. >> >> That's what `ls' does by default for the list of files unless >> `-x' (`--format=3Dhorizontal') is specified. =A0As well as readline >> completions in bash unless `print-completions-horizontally' is `On'. > > If it's not too problematic to implement, I'm all for the change (or > rather an option to have it). Not problematic at all. Below is a small patch that implements a new option for vertical completions with the default to traditional horizontal completions, of course. Index: lisp/minibuffer.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/minibuffer.el,v retrieving revision 1.96 diff -c -w -b -r1.96 minibuffer.el *** lisp/minibuffer.el 12 Nov 2009 23:10:06 -0000 1.96 --- lisp/minibuffer.el 17 Nov 2009 17:44:46 -0000 *************** *** 778,783 **** --- 778,793 ---- (defface completions-annotations '((t :inherit italic)) "Face to use for annotations in the *Completions* buffer.") =20 + (defcustom completions-format nil + "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' or nil, display completions sorted + horizontally in alphabetical order, rather than down the screen." + :type '(choice (const nil) (const horizontal) (const vertical)) + :group 'minibuffer + :version "23.2") +=20 (defun completion--insert-strings (strings) "Insert a list of STRINGS into the current buffer. Uses columns to keep the listing readable but compact. *************** *** 800,805 **** --- 810,817 ---- (max 1 (/ (length strings) 2)))) (colwidth (/ wwidth columns)) (column 0) + (rows (/ (length strings) columns)) + (row 0) (laststring nil)) ;; The insertion should be "sensible" no matter what choices were= made ;; for the parameters above. *************** *** 810,815 **** --- 822,840 ---- (+ (string-width (car str)) (string-width (cadr str))) (string-width str)))) + (cond + ((eq completions-format 'vertical) + ;; Vertical format + (when (> row rows) + (forward-line (- -1 rows)) + (setq row 0 column (setq column (+ column colwidth)))) + (when (> column 0) + (end-of-line) + (insert " \t") + (set-text-properties (- (point) 1) (point) + `(display (space :align-to ,column))))) + (t + ;; Horizontal format (unless (bolp) (if (< wwidth (+ (max colwidth length) column)) ;; No space for `str' at point, move to next line. *************** *** 823,829 **** ;; completion-setup-function will = kill all ;; local variables :-( `(display (space :align-to ,column= ))) ! nil)) (if (not (consp str)) (put-text-property (point) (progn (insert str) (point)) 'mouse-face 'highlight) --- 848,854 ---- ;; completion-setup-function will kill all ;; local variables :-( `(display (space :align-to ,column))) ! nil)))) (if (not (consp str)) (put-text-property (point) (progn (insert str) (point)) 'mouse-face 'highlight) *************** *** 832,841 **** (add-text-properties (point) (progn (insert (cadr str)) (= point)) '(mouse-face nil face completions-annotations))) ;; Next column to align to. (setq column (+ column ;; Round up to a whole number of columns. ! (* colwidth (ceiling length colwidth)))))))= ))) =20 (defvar completion-common-substring nil) (make-obsolete-variable 'completion-common-substring nil "23.1") --- 857,875 ---- (add-text-properties (point) (progn (insert (cadr str)) (= point)) '(mouse-face nil face completions-annotations))) + (cond + ((eq completions-format 'vertical) + ;; Vertical format + (if (> column 0) + (forward-line) + (insert "\n")) + (setq row (1+ row))) + (t + ;; Horizontal format ;; Next column to align to. (setq column (+ column ;; Round up to a whole number of columns. ! (* colwidth (ceiling length colwidth)))))))))))) =20 (defvar completion-common-substring nil) (make-obsolete-variable 'completion-common-substring nil "23.1") --=20 Juri Linkov http://www.jurta.org/emacs/