diff options
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 8d4e4a7a6bb..742fc5004dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2472,11 +2472,24 @@ previous element of the minibuffer history in the minibuffer." (save-excursion (goto-char (1- prompt-end)) (current-column))) - 0) + 1) (current-column))))) (condition-case nil (with-no-warnings - (previous-line arg)) + (previous-line arg) + ;; Avoid moving point to the prompt + (when (< (point) (minibuffer-prompt-end)) + ;; If there is minibuffer contents on the same line + (if (<= (minibuffer-prompt-end) + (save-excursion + (if (or truncate-lines (not line-move-visual)) + (end-of-line) + (end-of-visual-line)) + (point))) + ;; Move to the beginning of minibuffer contents + (goto-char (minibuffer-prompt-end)) + ;; Otherwise, go to the previous history element + (signal 'beginning-of-buffer nil)))) (beginning-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. @@ -3978,6 +3991,9 @@ impose the use of a shell (with its need to quote arguments)." (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) (shell-mode) + (setq-local revert-buffer-function + (lambda (&rest _) + (async-shell-command command buffer))) (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). @@ -4244,6 +4260,9 @@ characters." buffer)))) ;; Report the output. (with-current-buffer buffer + (setq-local revert-buffer-function + (lambda (&rest _) + (shell-command command))) (setq mode-line-process (cond ((null exit-status) " - Error") |