]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/comint.el (comint-strip-ctrl-m): Avoid `called-interactively-p`
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 12 Apr 2021 15:53:25 +0000 (11:53 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 12 Apr 2021 15:53:25 +0000 (11:53 -0400)
lisp/comint.el

index 9cbcfc03fa612a415d8d2288919e771f0d77884e..2745c5a26f65fb5f31f1ffd6c99b361f628cffcc 100644 (file)
@@ -2254,23 +2254,23 @@ This function could be on `comint-output-filter-functions' or bound to a key."
     (let ((inhibit-read-only t))
       (delete-region (point-min) (point)))))
 
-(defun comint-strip-ctrl-m (&optional _string)
+(defun comint-strip-ctrl-m (&optional _string interactive)
   "Strip trailing `^M' characters from the current output group.
 This function could be on `comint-output-filter-functions' or bound to a key."
-  (interactive)
+  (interactive (list nil 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)
+        (when 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)
+              (if interactive
                   comint-last-input-end comint-last-output-start))
            (error nil))
           (while (re-search-forward "\r+$" pmark t)