diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-22 19:15:33 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-22 19:16:09 +0100 |
commit | d0e457325d242466107e0c14f910eef0f1ae3599 (patch) | |
tree | ce6562362cefd3627f1e8148ff42d3c2545fe7ae /lisp/shell.el | |
parent | f2047fdca4f42cf0af568e1d62f286a91cce6d35 (diff) | |
download | emacs-d0e457325d242466107e0c14f910eef0f1ae3599.tar.gz emacs-d0e457325d242466107e0c14f910eef0f1ae3599.tar.bz2 emacs-d0e457325d242466107e0c14f910eef0f1ae3599.zip |
Add a shell-filter-ring-bell function
* lisp/shell.el (shell-mode): Mention it.
(shell-filter-ring-bell): New function (bug#21652).
Diffstat (limited to 'lisp/shell.el')
-rw-r--r-- | lisp/shell.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 565ededa1ef..008fcc4c4e8 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -570,7 +570,14 @@ the initialization of the input ring history, and history expansion. Variables `comint-output-filter-functions', a hook, and `comint-scroll-to-bottom-on-input' and `comint-scroll-to-bottom-on-output' control whether input and output cause the window to scroll to the end of the -buffer." +buffer. + +By default, shell mode does nothing special when it receives a +\"bell\" character (C-g or ^G). If you + (add-hook 'comint-output-filter-functions 'shell-filter-ring-bell nil t) +from `shell-mode-hook', Emacs will call the `ding' function +whenever it receives the bell character in output from a +command." :interactive nil (setq comint-prompt-regexp shell-prompt-pattern) (shell-completion-vars) @@ -681,6 +688,13 @@ This function can be put on `comint-preoutput-filter-functions'." (replace-regexp-in-string "[\C-a\C-b]" "" string t t) string)) +(defun shell-filter-ring-bell (string) + "Call `ding' if STRING contains a \"^G\" character. +This function can be put on `comint-output-filter-functions'." + (when (string-search "\a" string) + (ding)) + string) + (defun shell-write-history-on-exit (process event) "Called when the shell process is stopped. |