GNU bug report logs - #3447
suggest minibuffer M-< go to start of text

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Mon, 1 Jun 2009 23:50:04 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 3447 <at> debbugs.gnu.org, user42 <at> zip.com.au
Subject: bug#3447: suggest minibuffer M-< go to start of text
Date: Tue, 01 Oct 2019 13:58:22 +0200
Eli Zaretskii <eliz <at> gnu.org> 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




This bug report was last modified 4 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.