emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108832: * lisp/comint.el (comint-out


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108832: * lisp/comint.el (comint-output-filter): Filter out repeated prompts.
Date: Mon, 02 Jul 2012 12:18:02 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108832
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-07-02 12:18:02 -0400
message:
  * lisp/comint.el (comint-output-filter): Filter out repeated prompts.
modified:
  lisp/ChangeLog
  lisp/comint.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-02 13:31:15 +0000
+++ b/lisp/ChangeLog    2012-07-02 16:18:02 +0000
@@ -1,5 +1,7 @@
 2012-07-02  Stefan Monnier  <address@hidden>
 
+       * comint.el (comint-output-filter): Filter out repeated prompts.
+
        * net/ange-ftp.el (ange-ftp-expand-file-name): Use ange-ftp-ftp-name
        and file-name-absolute-p.
        (ange-ftp-file-exists-p): Use ange-ftp-file-exists-p for

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2012-06-30 21:23:38 +0000
+++ b/lisp/comint.el    2012-07-02 16:18:02 +0000
@@ -2006,6 +2006,20 @@
            (goto-char (process-mark process))
            (set-marker comint-last-output-start (point))
 
+            ;; Try to skip repeated prompts, which can occur as a result of
+            ;; commands sent without inserting them in the buffer.
+            (let ((bol (save-excursion (forward-line 0) (point)))) ;No fields.
+              (when (and (not (bolp))
+                         (looking-back comint-prompt-regexp bol))
+                (let* ((prompt (buffer-substring bol (point)))
+                       (prompt-re (concat "\\`" (regexp-quote prompt))))
+                  (while (string-match prompt-re string)
+                    (setq string (substring string (match-end 0)))))))
+            (while (string-match (concat "\\(^" comint-prompt-regexp
+                                         "\\)\\1+")
+                                 string)
+              (setq string (replace-match "\\1" nil nil string)))
+
            ;; insert-before-markers is a bad thing. XXX
            ;; Luckily we don't have to use it any more, we use
            ;; window-point-insertion-type instead.
@@ -2672,6 +2686,7 @@
 the case, this command just calls `kill-region' with all
 read-only properties intact.  The read-only status of newlines is
 updated using `comint-update-fence', if necessary."
+  (declare (advertised-calling-convention (beg end) "23.3"))
   (interactive "r")
   (save-excursion
     (let* ((true-beg (min beg end))
@@ -2690,8 +2705,6 @@
        (let ((inhibit-read-only t))
          (kill-region beg end yank-handler)
          (comint-update-fence))))))
-(set-advertised-calling-convention 'comint-kill-region '(beg end) "23.3")
-
 
 ;; Support for source-file processing commands.
 ;;============================================================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]