bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#2350: 23.0.90; compilation-mode inserts output in the wrong location


From: Richard M Stallman
Subject: bug#2350: 23.0.90; compilation-mode inserts output in the wrong location
Date: Wed, 18 Feb 2009 18:05:32 -0500

    But what isn't clear is whether it's always the right thing to do: it's
    clear in this particular use of narrow, but there might be other uses of
    narrow in conjunction with compilation buffers where it would be the
    wrong thing to do.

I looked at the code, and I think it is clear what to do: make sure
that narrowing does not prevent insertion at the specified insertion point.

Does this change make it work?

*** compile.el.~1.486.~ 2009-02-17 13:06:13.000000000 -0500
--- compile.el  2009-02-18 12:23:10.000000000 -0500
***************
*** 1733,1741 ****
      (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
--- 1733,1747 ----
      (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))
!           (min (point-min-marker))
!           (max (point-max-marker)))
          (unwind-protect
              (progn
+             ;; If we are inserting at the end of the visible region,
+             ;; keep the inserted text visible.
+             (set-marker-insertion-type max t)
+             (widen)
                (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
***************
*** 1745,1751 ****
                  (comint-carriage-motion (process-mark proc) (point)))
                (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 ()
--- 1751,1760 ----
                  (comint-carriage-motion (process-mark proc) (point)))
                (set-marker (process-mark proc) (point))
                (run-hooks 'compilation-filter-hook))
!         (goto-char pos)
!           (narrow-to-region min max)
!         (set-marker min nil)
!         (set-marker max nil))))))
  
  ;;; test if a buffer is a compilation buffer, assuming we're in the buffer
  (defsubst compilation-buffer-internal-p ()
Unless and until we come across a real case






reply via email to

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