aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/minibuffer.el36
1 files changed, 36 insertions, 0 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3fa637f2acd..7227e83f878 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2233,6 +2233,7 @@ The completion method is determined by `completion-at-point-functions'."
2233 2233
2234(let ((map minibuffer-local-map)) 2234(let ((map minibuffer-local-map))
2235 (define-key map "\C-g" 'abort-recursive-edit) 2235 (define-key map "\C-g" 'abort-recursive-edit)
2236 (define-key map "\M-<" 'minibuffer-beginning-of-buffer)
2236 (define-key map "\r" 'exit-minibuffer) 2237 (define-key map "\r" 'exit-minibuffer)
2237 (define-key map "\n" 'exit-minibuffer)) 2238 (define-key map "\n" 'exit-minibuffer))
2238 2239
@@ -2529,6 +2530,14 @@ such as making the current buffer visit no file in the case of
2529`set-visited-file-name'." 2530`set-visited-file-name'."
2530 :type 'boolean) 2531 :type 'boolean)
2531 2532
2533(defcustom minibuffer-beginning-of-buffer-movement nil
2534 "Control how the `M-<' command in the minibuffer behaves.
2535If non-nil, the command will go to the end of the prompt (if
2536point is after the end of the prompt). If nil, it will behave
2537like the `beginning-of-buffer' command."
2538 :version "27.1"
2539 :type 'boolean)
2540
2532;; Not always defined, but only called if next-read-file-uses-dialog-p says so. 2541;; Not always defined, but only called if next-read-file-uses-dialog-p says so.
2533(declare-function x-file-dialog "xfns.c" 2542(declare-function x-file-dialog "xfns.c"
2534 (prompt dir &optional default-filename mustmatch only-dir-p)) 2543 (prompt dir &optional default-filename mustmatch only-dir-p))
@@ -3589,6 +3598,33 @@ See `completing-read' for the meaning of the arguments."
3589 (when file-name-at-point 3598 (when file-name-at-point
3590 (insert file-name-at-point)))) 3599 (insert file-name-at-point))))
3591 3600
3601(defun minibuffer-beginning-of-buffer (&optional arg)
3602 "Move to the logical beginning of the minibuffer.
3603This command behaves like `beginning-of-buffer', but if point is
3604after the end of the prompt, move to the end of the prompt.
3605Otherwise move to the start of the buffer."
3606 (declare (interactive-only "use `(goto-char (point-min))' instead."))
3607 (interactive "^P")
3608 (when (or (consp arg)
3609 (region-active-p))
3610 (push-mark))
3611 (goto-char (cond
3612 ;; We want to go N/10th of the way from the beginning.
3613 ((and arg (not (consp arg)))
3614 (+ (point-min) 1
3615 (/ (* (- (point-max) (point-min))
3616 (prefix-numeric-value arg))
3617 10)))
3618 ;; Go to the start of the buffer.
3619 ((or (null minibuffer-beginning-of-buffer-movement)
3620 (<= (point) (minibuffer-prompt-end)))
3621 (point-min))
3622 ;; Go to the end of the minibuffer.
3623 (t
3624 (minibuffer-prompt-end))))
3625 (when (and arg (not (consp arg)))
3626 (forward-line 1)))
3627
3592(provide 'minibuffer) 3628(provide 'minibuffer)
3593 3629
3594;;; minibuffer.el ends here 3630;;; minibuffer.el ends here