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: switch-to-completions Date: Wed, 18 Nov 2009 21:04:36 +0200 Organization: JURTA Message-ID: <87einv3e14.fsf@mail.jurta.org> References: <61C01A08-8FB6-4908-B9F1-B9F1CE3E3D92@gmail.com> <20091111212658.GD12012@headley> <87fx8kjosa.fsf_-_@mail.jurta.org> <7b501d5c0911120209x7c8f493fm68fadef6f1311206@mail.gmail.com> <87bpj16pkh.fsf@mail.jurta.org> <87hbssw5xd.fsf_-_@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258572946 8731 80.91.229.12 (18 Nov 2009 19:35:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Nov 2009 19:35:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 18 20:35:39 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 1NAqJS-0004Dh-4T for ged-emacs-devel@m.gmane.org; Wed, 18 Nov 2009 20:35:34 +0100 Original-Received: from localhost ([127.0.0.1]:46341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAqJR-0002D9-KC for ged-emacs-devel@m.gmane.org; Wed, 18 Nov 2009 14:35:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAqIC-0000xM-KV for emacs-devel@gnu.org; Wed, 18 Nov 2009 14:34:16 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAqI8-0000q1-4M for emacs-devel@gnu.org; Wed, 18 Nov 2009 14:34:15 -0500 Original-Received: from [199.232.76.173] (port=47359 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAqI7-0000pP-4X for emacs-devel@gnu.org; Wed, 18 Nov 2009 14:34:11 -0500 Original-Received: from smtp-out3.starman.ee ([85.253.0.5]:35580 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAqI6-0003P3-If for emacs-devel@gnu.org; Wed, 18 Nov 2009 14:34:10 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.31.20.cable.starman.ee [82.131.31.20]) by mx1.starman.ee (Postfix) with ESMTP id 07F523F40C5; Wed, 18 Nov 2009 21:34:03 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Wed, 18 Nov 2009 10:48:42 -0500") 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:117210 Archived-At: >> After scrolling with the help of `minibuffer-complete' or >> `minibuffer-complete-backward' to the middle of a long list >> of completions, and typing `M-v' or (bound to >> `switch-to-completions') to select a completion item using >> keyboard, point jumps to the beginning of the *Completions* >> buffer, thus requiring to scroll to the middle of the list >> again. I suppose moving point to the first item is necessary >> only in the new *Completions* buffer: > > Yes, that makes sense. An alternative would be to make > minibuffer-completion-help itself do the (search-forward "\n\n" nil t), > which would seem to make more sense (e.g. minibuffer-completion-help is > the function that fills the buffer and presumably knows that this \n\n > exists and is it the right place, whereas switch-to-completions only can > assume that minibuffer-completion-help places a \n\n at the right place). I'm not sure what function should take care about finding the right place since creation of the *Completions* buffer is shared among several functions: `display-completion-list' inserts the text "Possible completions are:\n", `completion-setup-function' inserts the help text with one newline or two newlines depending on `(display-mouse-p)' or no help text if `completion-show-help' is nil. And there are many packages that don't call `minibuffer-completion-help' - they use something like (with-output-to-temp-buffer "*Completions*" (display-completion-list ... Maybe `switch-to-completions' should simply call `(next-completion 1)'? It seems this is the most reliable way to move point to the first completion. -- Juri Linkov http://www.jurta.org/emacs/