diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-02-10 21:56:55 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-02-10 21:56:55 +0100 |
commit | 2fcb85c3e780f1f2871ce0f300cfaffce9836eb0 (patch) | |
tree | a8857ccad8bff12080062a3edaad1a55a3eb8171 /lisp/comint.el | |
parent | 1f626e9662d8120acd5a937f847123cc2b8c6e31 (diff) | |
parent | 6bfdfeed36fab4680c8db90c22da8f6611694186 (diff) | |
download | emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.tar.gz emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.tar.bz2 emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.zip |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index e52d67d0e50..57df6bfb19f 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -700,8 +700,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'." ;; https://lists.gnu.org/r/emacs-devel/2007-08/msg00827.html ;; ;; This makes it really work to keep point at the bottom. - ;; (make-local-variable 'scroll-conservatively) - ;; (setq scroll-conservatively 10000) + ;; (setq-local scroll-conservatively 10000) (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom t t) (make-local-variable 'comint-ptyp) (make-local-variable 'comint-process-echoes) @@ -2253,15 +2252,23 @@ This function could be on `comint-output-filter-functions' or bound to a key." "Strip trailing `^M' characters from the current output group. This function could be on `comint-output-filter-functions' or bound to a key." (interactive) - (let ((pmark (process-mark (get-buffer-process (current-buffer))))) - (save-excursion - (condition-case nil - (goto-char - (if (called-interactively-p 'interactive) - comint-last-input-end comint-last-output-start)) - (error nil)) - (while (re-search-forward "\r+$" pmark t) - (replace-match "" t t))))) + (let ((process (get-buffer-process (current-buffer)))) + (if (not process) + ;; This function may be used in + ;; `comint-output-filter-functions', and in that case, if + ;; there's no process, then we should do nothing. If + ;; interactive, report an error. + (when (called-interactively-p 'interactive) + (error "No process in the current buffer")) + (let ((pmark (process-mark process))) + (save-excursion + (condition-case nil + (goto-char + (if (called-interactively-p 'interactive) + comint-last-input-end comint-last-output-start)) + (error nil)) + (while (re-search-forward "\r+$" pmark t) + (replace-match "" t t))))))) (define-obsolete-function-alias 'shell-strip-ctrl-m #'comint-strip-ctrl-m "27.1") (defun comint-show-maximum-output () @@ -2375,12 +2382,11 @@ a buffer local variable." ;; saved -- typically passwords to ftp, telnet, or somesuch. ;; Just enter m-x comint-send-invisible and type in your line. -(defvar comint-password-function nil +(defvar-local comint-password-function nil "Abnormal hook run when prompted for a password. This function gets one argument, a string containing the prompt. It may return a string containing the password, or nil if normal password prompting should occur.") -(make-variable-buffer-local 'comint-password-function) (defun comint-send-invisible (&optional prompt) "Read a string without echoing. |