]> git.eshelyaron.com Git - emacs.git/commitdiff
* progmodes/compile.el (compilation-start): Don't disable undo in
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 13 Jun 2008 16:22:16 +0000 (16:22 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 13 Jun 2008 16:22:16 +0000 (16:22 +0000)
comint buffer.  Don't override the comint-filter with our own.
(compilation-filter): Change point's insertion-type.
* comint.el (comint-output-filter): Use copy-marker.

lisp/ChangeLog
lisp/comint.el
lisp/progmodes/compile.el

index 7e310e10c335a9ac995663e52890143b10d888f5..932dc0b10e92affe16225004ec2a3c1f2c80d773 100644 (file)
@@ -1,3 +1,11 @@
+2008-06-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/compile.el (compilation-start): Don't disable undo in
+       comint buffer.  Don't override the comint-filter with our own.
+       (compilation-filter): Change point's insertion-type.
+
+       * comint.el (comint-output-filter): Use copy-marker.
+
 2008-06-13  David Reitter  <david.reitter@gmail.com>
 
        * textmodes/flyspell.el (mail-mode-flyspell-verify):
index 4abb17ed17af670af0fefeb6aed6e30518633210..00528f38ab0c4bd1fc5e1b012becea767341546f 100644 (file)
@@ -1740,12 +1740,8 @@ Make backspaces delete the previous character."
 
        ;; Insert STRING
        (let ((inhibit-read-only t)
-             ;; Avoid the overhead of save-excursion, since we just
-             ;; fiddle with the point
-             (saved-point (point-marker)))
-
-         ;; The point should float after any insertion we do
-         (set-marker-insertion-type saved-point t)
+              ;; The point should float after any insertion we do.
+             (saved-point (copy-marker (point) t)))
 
          ;; We temporarly remove any buffer narrowing, in case the
          ;; process mark is outside of the restriction
index 07e5600d3730ee8f4581531f0e6a2b70bd0a1a43..65e8f952b64eda3ac29339f3022da7cc5f5e35ba 100644 (file)
@@ -1159,7 +1159,6 @@ Returns the compilation buffer created."
                  (error nil))
              (error "Cannot have two processes in `%s' at once"
                     (buffer-name)))))
-      (buffer-disable-undo (current-buffer))
       ;; first transfer directory from where M-x compile was called
       (setq default-directory thisdir)
       ;; Make compilation buffer read-only.  The filter can still write it.
@@ -1177,7 +1176,9 @@ Returns the compilation buffer created."
        (erase-buffer)
        ;; Select the desired mode.
        (if (not (eq mode t))
-           (funcall mode)
+            (progn
+              (buffer-disable-undo)
+              (funcall mode))
          (setq buffer-read-only nil)
          (with-no-warnings (comint-mode))
          (compilation-shell-minor-mode))
@@ -1262,7 +1263,10 @@ Returns the compilation buffer created."
          (setq mode-line-process
                (list (propertize ":%s" 'face 'compilation-warning)))
          (set-process-sentinel proc 'compilation-sentinel)
-         (set-process-filter proc 'compilation-filter)
+          (unless (eq mode t)
+            ;; Keep the comint filter, since it's needed for proper handling
+            ;; of the prompts.
+            (set-process-filter proc 'compilation-filter))
          ;; Use (point-max) here so that output comes in
          ;; after the initial text,
          ;; regardless of where the user sees point.
@@ -1666,17 +1670,21 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'."
 (defun compilation-filter (proc string)
   "Process filter for compilation buffers.
 Just inserts the text, and runs `compilation-filter-hook'."
-  (if (buffer-live-p (process-buffer proc))
-      (with-current-buffer (process-buffer proc)
-       (let ((inhibit-read-only t))
-         (save-excursion
-           (goto-char (process-mark proc))
-            ;; We used to use `insert-before-markers', so that windows with
-            ;; point at `process-mark' scroll along with the output, but we
-            ;; now use window-point-insertion-type instead.
-           (insert string)
-            (set-marker (process-mark proc) (point))
-           (run-hooks 'compilation-filter-hook))))))
+  (when (buffer-live-p (process-buffer proc))
+    (with-current-buffer (process-buffer proc)
+      (let ((inhibit-read-only t)
+            ;; `save-excursion' doesn't use the right insertion-type for us.
+            (pos (copy-marker (point) t)))
+        (unwind-protect
+            (progn
+              (goto-char (process-mark proc))
+              ;; We used to use `insert-before-markers', so that windows with
+              ;; point at `process-mark' scroll along with the output, but we
+              ;; now use window-point-insertion-type instead.
+              (insert string)
+              (set-marker (process-mark proc) (point))
+              (run-hooks 'compilation-filter-hook))
+          (goto-char pos))))))
 
 ;;; test if a buffer is a compilation buffer, assuming we're in the buffer
 (defsubst compilation-buffer-internal-p ()