emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113764: * lisp/comint.el:


From: Christopher Schmidt
Subject: [Emacs-diffs] trunk r113764: * lisp/comint.el:
Date: Thu, 08 Aug 2013 19:23:41 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113764
revision-id: address@hidden
parent: address@hidden
committer: Christopher Schmidt <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-08 21:22:58 +0200
message:
  * lisp/comint.el:
  Do not use an overlay to highlight the last prompt.  (Bug#14744)
  (comint-mode): Make comint-last-prompt buffer local.
  (comint-last-prompt): New variable.
  (comint-last-prompt-overlay): Remove.  Superseded by
  comint-last-prompt.
  (comint-snapshot-last-prompt, comint-output-filter): Use
  comint-last-prompt.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/comint.el                 comint.el-20091113204419-o5vbwnq5f7feedwu-149
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-08 16:13:32 +0000
+++ b/lisp/ChangeLog    2013-08-08 19:22:58 +0000
@@ -1,3 +1,14 @@
+2013-08-08  Christopher Schmidt  <address@hidden>
+
+       * comint.el:
+       Do not use an overlay to highlight the last prompt.  (Bug#14744)
+       (comint-mode): Make comint-last-prompt buffer local.
+       (comint-last-prompt): New variable.
+       (comint-last-prompt-overlay): Remove.  Superseded by
+       comint-last-prompt.
+       (comint-snapshot-last-prompt, comint-output-filter): Use
+       comint-last-prompt.
+
 2013-08-08  Juanma Barranquero  <address@hidden>
 
        * frameset.el (frameset-valid-p): Check vector length.  Doc fix.

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2013-08-05 14:26:57 +0000
+++ b/lisp/comint.el    2013-08-08 19:22:58 +0000
@@ -636,7 +636,7 @@
   (setq-local comint-last-input-start (point-min-marker))
   (setq-local comint-last-input-end (point-min-marker))
   (setq-local comint-last-output-start (make-marker))
-  (make-local-variable 'comint-last-prompt-overlay)
+  (make-local-variable 'comint-last-prompt)
   (make-local-variable 'comint-prompt-regexp)        ; Don't set; default
   (make-local-variable 'comint-input-ring-size)      ; ...to global val.
   (make-local-variable 'comint-input-ring)
@@ -1902,21 +1902,24 @@
   "If nil, Comint will interpret `carriage control' characters in output.
 See `comint-carriage-motion' for details.")
 
-;; When non-nil, this is an overlay over the last recognized prompt in
-;; the buffer; it is used when highlighting the prompt.
-(defvar comint-last-prompt-overlay nil)
+(defvar comint-last-prompt nil
+  "Markers pointing to the last prompt.
+If non-nil, a cons cell containing markers.  The car points to
+the start, the cdr to the end of the last prompt recognized.")
 
 (defun comint-snapshot-last-prompt ()
-  "`snapshot' any current `comint-last-prompt-overlay'.
-Freeze its attributes in place, even when more input comes along
-and moves the prompt overlay."
-  (when comint-last-prompt-overlay
-    (let ((inhibit-read-only t))
-      (with-silent-modifications
-        (add-text-properties
-         (overlay-start comint-last-prompt-overlay)
-         (overlay-end comint-last-prompt-overlay)
-         (overlay-properties comint-last-prompt-overlay))))))
+  "Snapshot the current `comint-last-prompt'.
+Freezes the `font-lock-face' text property in place."
+  (when comint-last-prompt
+    (with-silent-modifications
+      (add-text-properties
+       (car comint-last-prompt)
+       (cdr comint-last-prompt)
+       '(font-lock-face comint-highlight-prompt)))
+    ;; Reset comint-last-prompt so later on comint-output-filter does
+    ;; not remove the font-lock-face text property of the previous
+    ;; (this) prompt.
+    (setq comint-last-prompt nil)))
 
 (defun comint-carriage-motion (start end)
   "Interpret carriage control characters in the region from START to END.
@@ -2063,20 +2066,15 @@
                   (add-text-properties
                    prompt-start (point)
                    '(read-only t rear-nonsticky t front-sticky (read-only)))))
-             (unless (and (bolp) (null comint-last-prompt-overlay))
-               ;; Need to create or move the prompt overlay (in the case
-               ;; where there is no prompt ((bolp) == t), we still do
-               ;; this if there's already an existing overlay).
-               (if comint-last-prompt-overlay
-                   ;; Just move an existing overlay
-                   (move-overlay comint-last-prompt-overlay
-                                 prompt-start (point))
-                 ;; Need to create the overlay
-                 (setq comint-last-prompt-overlay
-                       (make-overlay prompt-start (point)))
-                 (overlay-put comint-last-prompt-overlay
-                              'font-lock-face 'comint-highlight-prompt))))
-
+             (when comint-last-prompt
+               (remove-text-properties (car comint-last-prompt)
+                                       (cdr comint-last-prompt)
+                                       '(font-lock-face)))
+             (setq comint-last-prompt
+                   (cons (copy-marker prompt-start) (point-marker)))
+             (add-text-properties (car comint-last-prompt)
+                                  (cdr comint-last-prompt)
+                                  '(font-lock-face comint-highlight-prompt)))
            (goto-char saved-point)))))))
 
 (defun comint-preinput-scroll-to-bottom ()


reply via email to

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