GNU bug report logs - #2350
23.0.90; compilation-mode inserts output in the wrong location

Previous Next

Package: emacs;

Reported by: Eric Hanchrow <erich <at> cozi.com>

Date: Tue, 17 Feb 2009 00:30:03 UTC

Severity: normal

Tags: patch

Fixed in version 25.1

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Richard M Stallman <rms <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2350 <at> debbugs.gnu.org, erich <at> cozi.com, emacs-pretest-bug <at> gnu.org
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




This bug report was last modified 9 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.