aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-03-10 17:37:42 -0400
committerStefan Monnier2013-03-10 17:37:42 -0400
commitd0ebc8269faa78a0f91423ec75a60a36dacf7723 (patch)
tree2437b3beff4a8ce73415889c5cb2204a93cf859a
parent138c0ae83dcf3daede8d8a12459c9fca13d15fac (diff)
downloademacs-d0ebc8269faa78a0f91423ec75a60a36dacf7723.tar.gz
emacs-d0ebc8269faa78a0f91423ec75a60a36dacf7723.zip
* lisp/comint.el: Use with-silent-modifications.
(comint-send-input, comint-snapshot-last-prompt) (comint-output-filter, comint-update-fence): Use with-silent-modifications.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/comint.el94
2 files changed, 54 insertions, 48 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 20a3a6e1e50..8d2fdc9fcd6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * comint.el (comint-send-input, comint-snapshot-last-prompt)
4 (comint-output-filter, comint-update-fence):
5 Use with-silent-modifications.
6
12013-03-10 Jambunathan K <kjambunathan@gmail.com> 72013-03-10 Jambunathan K <kjambunathan@gmail.com>
2 8
3 * replace.el (occur-read-regexp-defaults-function): New var. 9 * replace.el (occur-read-regexp-defaults-function): New var.
@@ -21,7 +27,7 @@
21 Use Tramp default handler. 27 Use Tramp default handler.
22 [file-acl, file-selinux-context, process-file, set-file-acl]: 28 [file-acl, file-selinux-context, process-file, set-file-acl]:
23 [set-file-modes, set-file-selinux-context, shell-command]: 29 [set-file-modes, set-file-selinux-context, shell-command]:
24 [start-file-process ]: Remove handler. 30 [start-file-process]: Remove handler.
25 [verify-visited-file-modtime]: New handler. 31 [verify-visited-file-modtime]: New handler.
26 (tramp-gvfs-dbus-string-to-byte-array) 32 (tramp-gvfs-dbus-string-to-byte-array)
27 (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all 33 (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all
diff --git a/lisp/comint.el b/lisp/comint.el
index 21bd732b43c..93db4e24f2a 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1805,28 +1805,28 @@ Similarly for Soar, Scheme, etc."
1805 (concat input "\n"))) 1805 (concat input "\n")))
1806 1806
1807 (let ((beg (marker-position pmark)) 1807 (let ((beg (marker-position pmark))
1808 (end (if no-newline (point) (1- (point)))) 1808 (end (if no-newline (point) (1- (point)))))
1809 (inhibit-modification-hooks t)) 1809 (with-silent-modifications
1810 (when (> end beg) 1810 (when (> end beg)
1811 (add-text-properties beg end 1811 (add-text-properties beg end
1812 '(front-sticky t 1812 '(front-sticky t
1813 font-lock-face comint-highlight-input)) 1813 font-lock-face comint-highlight-input))
1814 (unless comint-use-prompt-regexp 1814 (unless comint-use-prompt-regexp
1815 ;; Give old user input a field property of `input', to 1815 ;; Give old user input a field property of `input', to
1816 ;; distinguish it from both process output and unsent 1816 ;; distinguish it from both process output and unsent
1817 ;; input. The terminating newline is put into a special 1817 ;; input. The terminating newline is put into a special
1818 ;; `boundary' field to make cursor movement between input 1818 ;; `boundary' field to make cursor movement between input
1819 ;; and output fields smoother. 1819 ;; and output fields smoother.
1820 (add-text-properties 1820 (add-text-properties
1821 beg end 1821 beg end
1822 '(mouse-face highlight 1822 '(mouse-face highlight
1823 help-echo "mouse-2: insert after prompt as new input")))) 1823 help-echo "mouse-2: insert after prompt as new input"))))
1824 (unless (or no-newline comint-use-prompt-regexp) 1824 (unless (or no-newline comint-use-prompt-regexp)
1825 ;; Cover the terminating newline 1825 ;; Cover the terminating newline
1826 (add-text-properties end (1+ end) 1826 (add-text-properties end (1+ end)
1827 '(rear-nonsticky t 1827 '(rear-nonsticky t
1828 field boundary 1828 field boundary
1829 inhibit-line-move-field-capture t)))) 1829 inhibit-line-move-field-capture t)))))
1830 1830
1831 (comint-snapshot-last-prompt) 1831 (comint-snapshot-last-prompt)
1832 1832
@@ -1909,11 +1909,12 @@ See `comint-carriage-motion' for details.")
1909Freeze its attributes in place, even when more input comes along 1909Freeze its attributes in place, even when more input comes along
1910and moves the prompt overlay." 1910and moves the prompt overlay."
1911 (when comint-last-prompt-overlay 1911 (when comint-last-prompt-overlay
1912 (let ((inhibit-read-only t) 1912 (let ((inhibit-read-only t))
1913 (inhibit-modification-hooks t)) 1913 (with-silent-modifications
1914 (add-text-properties (overlay-start comint-last-prompt-overlay) 1914 (add-text-properties
1915 (overlay-end comint-last-prompt-overlay) 1915 (overlay-start comint-last-prompt-overlay)
1916 (overlay-properties comint-last-prompt-overlay))))) 1916 (overlay-end comint-last-prompt-overlay)
1917 (overlay-properties comint-last-prompt-overlay))))))
1917 1918
1918(defun comint-carriage-motion (start end) 1919(defun comint-carriage-motion (start end)
1919 "Interpret carriage control characters in the region from START to END. 1920 "Interpret carriage control characters in the region from START to END.
@@ -2036,11 +2037,10 @@ Make backspaces delete the previous character."
2036 (run-hook-with-args 'comint-output-filter-functions string) 2037 (run-hook-with-args 'comint-output-filter-functions string)
2037 (set-marker saved-point (point)) 2038 (set-marker saved-point (point))
2038 2039
2039 (goto-char (process-mark process)) ; in case a filter moved it 2040 (goto-char (process-mark process)) ; In case a filter moved it.
2040 2041
2041 (unless comint-use-prompt-regexp 2042 (unless comint-use-prompt-regexp
2042 (let ((inhibit-read-only t) 2043 (with-silent-modifications
2043 (inhibit-modification-hooks t))
2044 (add-text-properties comint-last-output-start (point) 2044 (add-text-properties comint-last-output-start (point)
2045 '(front-sticky 2045 '(front-sticky
2046 (field inhibit-line-move-field-capture) 2046 (field inhibit-line-move-field-capture)
@@ -2051,16 +2051,16 @@ Make backspaces delete the previous character."
2051 ;; Highlight the prompt, where we define `prompt' to mean 2051 ;; Highlight the prompt, where we define `prompt' to mean
2052 ;; the most recent output that doesn't end with a newline. 2052 ;; the most recent output that doesn't end with a newline.
2053 (let ((prompt-start (save-excursion (forward-line 0) (point))) 2053 (let ((prompt-start (save-excursion (forward-line 0) (point)))
2054 (inhibit-read-only t) 2054 (inhibit-read-only t))
2055 (inhibit-modification-hooks t))
2056 (when comint-prompt-read-only 2055 (when comint-prompt-read-only
2057 (or (= (point-min) prompt-start) 2056 (with-silent-modifications
2058 (get-text-property (1- prompt-start) 'read-only) 2057 (or (= (point-min) prompt-start)
2059 (put-text-property 2058 (get-text-property (1- prompt-start) 'read-only)
2060 (1- prompt-start) prompt-start 'read-only 'fence)) 2059 (put-text-property
2061 (add-text-properties 2060 (1- prompt-start) prompt-start 'read-only 'fence))
2062 prompt-start (point) 2061 (add-text-properties
2063 '(read-only t rear-nonsticky t front-sticky (read-only)))) 2062 prompt-start (point)
2063 '(read-only t rear-nonsticky t front-sticky (read-only)))))
2064 (unless (and (bolp) (null comint-last-prompt-overlay)) 2064 (unless (and (bolp) (null comint-last-prompt-overlay))
2065 ;; Need to create or move the prompt overlay (in the case 2065 ;; Need to create or move the prompt overlay (in the case
2066 ;; where there is no prompt ((bolp) == t), we still do 2066 ;; where there is no prompt ((bolp) == t), we still do
@@ -2655,16 +2655,16 @@ read-only property of `fence', unless it already is read-only.
2655If the character after point does not have a front-sticky 2655If the character after point does not have a front-sticky
2656read-only property, any read-only property of `fence' on the 2656read-only property, any read-only property of `fence' on the
2657preceding newline is removed." 2657preceding newline is removed."
2658 (let* ((pt (point)) (lst (get-text-property pt 'front-sticky)) 2658 (let* ((pt (point)) (lst (get-text-property pt 'front-sticky)))
2659 (inhibit-modification-hooks t))
2660 (and (bolp) 2659 (and (bolp)
2661 (not (bobp)) 2660 (not (bobp))
2662 (if (and (get-text-property pt 'read-only) 2661 (with-silent-modifications
2663 (if (listp lst) (memq 'read-only lst) t)) 2662 (if (and (get-text-property pt 'read-only)
2664 (unless (get-text-property (1- pt) 'read-only) 2663 (if (listp lst) (memq 'read-only lst) t))
2665 (put-text-property (1- pt) pt 'read-only 'fence)) 2664 (unless (get-text-property (1- pt) 'read-only)
2666 (when (eq (get-text-property (1- pt) 'read-only) 'fence) 2665 (put-text-property (1- pt) pt 'read-only 'fence))
2667 (remove-list-of-text-properties (1- pt) pt '(read-only))))))) 2666 (when (eq (get-text-property (1- pt) 'read-only) 'fence)
2667 (remove-list-of-text-properties (1- pt) pt '(read-only))))))))
2668 2668
2669(defun comint-kill-whole-line (&optional count) 2669(defun comint-kill-whole-line (&optional count)
2670 "Kill current line, ignoring read-only and field properties. 2670 "Kill current line, ignoring read-only and field properties.