From bcd7a0a4c55f8226e9322d1ef438040fed2dc57e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 20 Apr 2013 12:24:04 -0400 Subject: Use add/remove-function to manipulate process-filters. * lisp/emacs-lisp/nadvice.el (advice--where-alist): Add :override. (remove-function): Autoload. * lisp/comint.el (comint-redirect-original-filter-function): Remove. (comint-redirect-cleanup, comint-redirect-send-command-to-process): * lisp/vc/vc-cvs.el (vc-cvs-annotate-process-filter,vc-cvs-annotate-command): * lisp/progmodes/octave-inf.el (inferior-octave-send-list-and-digest): * lisp/progmodes/prolog.el (prolog-consult-compile): * lisp/progmodes/gdb-mi.el (gdb, gdb--check-interpreter): Use add/remove-function instead. * lisp/progmodes/gud.el (gud-tooltip-original-filter): Remove. (gud-tooltip-process-output, gud-tooltip-tips): Use add/remove-function instead. * lisp/progmodes/xscheme.el (xscheme-previous-process-state): Remove. (scheme-interaction-mode, exit-scheme-interaction-mode): Use add/remove-function instead. * lisp/vc/vc-dispatcher.el: Use lexical-binding. (vc--process-sentinel): Rename from vc-process-sentinel. Change last arg to be the code to run. Don't use vc-previous-sentinel and vc-sentinel-commands any more. (vc-exec-after): Allow code to be a function. Use add/remove-function. (compilation-error-regexp-alist, view-old-buffer-read-only): Declare. --- lisp/comint.el | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'lisp/comint.el') diff --git a/lisp/comint.el b/lisp/comint.el index 93db4e24f2a..13a38e6e16e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3491,11 +3491,6 @@ buffer. The idea is that this regular expression should match a prompt string, and that there ought to be at least one copy of your prompt string in the process buffer already.") -(defvar comint-redirect-original-filter-function nil - "The process filter that was in place when redirection is started. -When redirection is completed, the process filter is restored to -this value.") - (defvar comint-redirect-subvert-readonly nil "Non-nil means `comint-redirect' can insert into read-only buffers. This works by binding `inhibit-read-only' around the insertion. @@ -3558,8 +3553,8 @@ and does not normally need to be invoked by the end user or programmer." ;; Release the last redirected string (setq comint-redirect-previous-input-string nil) ;; Restore the process filter - (set-process-filter (get-buffer-process (current-buffer)) - comint-redirect-original-filter-function) + (remove-function (process-filter (get-buffer-process (current-buffer))) + #'comint-redirect-filter) ;; Restore the mode line (setq mode-line-process comint-redirect-original-mode-line-process) ;; Set the completed flag @@ -3701,10 +3696,8 @@ If NO-DISPLAY is non-nil, do not show the output buffer." comint-prompt-regexp ; Finished Regexp echo) ; Echo input - ;; Set the filter - (setq comint-redirect-original-filter-function ; Save the old filter - (process-filter proc)) - (set-process-filter proc 'comint-redirect-filter) + ;; Set the filter. + (add-function :override (process-filter proc) #'comint-redirect-filter) ;; Send the command (process-send-string (current-buffer) (concat command "\n")) -- cgit v1.2.3