From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#3447: suggest minibuffer M-< go to start of text Date: Tue, 01 Oct 2019 13:58:22 +0200 Message-ID: <877e5oad9d.fsf@gnus.org> References: <873aajttak.fsf@blah.blah> <87d0fidwfl.fsf@gnus.org> <83muemcgh7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="180528"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 3447@debbugs.gnu.org, user42@zip.com.au To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 01 13:59:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iFGoD-000kqc-Rw for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Oct 2019 13:59:14 +0200 Original-Received: from localhost ([::1]:40762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFGoC-00077h-MD for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Oct 2019 07:59:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37250) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFGo3-00076t-SM for bug-gnu-emacs@gnu.org; Tue, 01 Oct 2019 07:59:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFGo2-00077Y-Ly for bug-gnu-emacs@gnu.org; Tue, 01 Oct 2019 07:59:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52138) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFGo2-00077P-Im for bug-gnu-emacs@gnu.org; Tue, 01 Oct 2019 07:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iFGo2-00018j-G4 for bug-gnu-emacs@gnu.org; Tue, 01 Oct 2019 07:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Oct 2019 11:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3447 X-GNU-PR-Package: emacs Original-Received: via spool by 3447-submit@debbugs.gnu.org id=B3447.15699311104324 (code B ref 3447); Tue, 01 Oct 2019 11:59:02 +0000 Original-Received: (at 3447) by debbugs.gnu.org; 1 Oct 2019 11:58:30 +0000 Original-Received: from localhost ([127.0.0.1]:60956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFGnV-00017g-Jk for submit@debbugs.gnu.org; Tue, 01 Oct 2019 07:58:29 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:48862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFGnT-00017X-Go for 3447@debbugs.gnu.org; Tue, 01 Oct 2019 07:58:28 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iFGnO-00027z-8C; Tue, 01 Oct 2019 13:58:24 +0200 In-Reply-To: <83muemcgh7.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Sep 2019 11:53:40 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:167976 Archived-At: Eli Zaretskii writes: > As an opt-in behavior, please. We can make it the default later, if > there's enough demand. I can do that, but after using this for a bit, it just seems like very natural behaviour, which makes me wonder whether anybody really enjoys the previous behaviour. I mean, there's very little of use you can do before the end of the minibuffer prompt. The only use case I can see is if you want to copy the entire buffer contents to the kill ring... but... how often is that done? Perhaps we could just do the change below (calling it out in NEWS) and see whether anybody complains? And if they do, we'll introduce the variable. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3fa637f2ac..20be32f307 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2233,6 +2233,7 @@ completion-help-at-point (let ((map minibuffer-local-map)) (define-key map "\C-g" 'abort-recursive-edit) + (define-key map "\M-<" 'minibuffer-beginning-of-buffer) (define-key map "\r" 'exit-minibuffer) (define-key map "\n" 'exit-minibuffer)) @@ -3589,6 +3590,32 @@ minibuffer-insert-file-name-at-point (when file-name-at-point (insert file-name-at-point)))) +(defun minibuffer-beginning-of-buffer (&optional arg) + "Move to the logical beginning of the minibuffer. +This command behaves like `beginning-of-buffer', but if point is +after the end of the prompt, move to the end of the prompt. +Otherwise move to the start of the buffer." + (declare (interactive-only "use `(goto-char (point-min))' instead.")) + (interactive "^P") + (when (or (consp arg) + (region-active-p)) + (push-mark)) + (goto-char (cond + ;; We want to go N/10th of the way from the beginning. + ((and arg (not (consp arg))) + (+ (point-min) 1 + (/ (* (- (point-max) (point-min)) + (prefix-numeric-value arg)) + 10))) + ;; Go to the start of the buffer. + ((<= (point) (minibuffer-prompt-end)) + (point-min)) + ;; Go to the end of the minibuffer. + (t + (minibuffer-prompt-end)))) + (when (and arg (not (consp arg))) + (forward-line 1))) + (provide 'minibuffer) ;;; minibuffer.el ends here -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no