emacs-devel
[Top][All Lists]
Advanced

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

Re: Undesired point moves while compiling


From: Juri Linkov
Subject: Re: Undesired point moves while compiling
Date: Sat, 05 Nov 2005 11:47:11 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> There is special code in this function that uses beginning-of-line
>> to move point in the source buffer during fontification.
>> But I don't know is this intentional or not.  Or maybe
>> `save-excursion' is missing around `save-restriction'?
>
> Excellent suggestion! Inserting a `save-excursion' between the
> `with-current-buffer' and `save-restriction' (line 710) in the routine
> `compilation-internal-error-properties' fixed my problem. Thanks!

After looking more at this function I still can't decide if its current
behavior is intentional or not.  Someone might want to call `next-error'
on the first message, sit back and see how the cursor jumps around in the
source buffer.

But really I don't think this is useful.  Perhaps this should be
changed in CVS to save point?

Index: lisp/progmodes/compile.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.388
diff -c -w -b -r1.388 compile.el
*** lisp/progmodes/compile.el   16 Oct 2005 14:12:50 -0000      1.388
--- lisp/progmodes/compile.el   5 Nov 2005 09:44:18 -0000
***************
*** 707,712 ****
--- 707,713 ----
        (setq marker (nth 3 (cadr marker-line))
            marker-line (or (car marker-line) 1))
        (with-current-buffer (marker-buffer marker)
+       (save-excursion
          (save-restriction
            (widen)
            (goto-char (marker-position marker))
***************
*** 724,730 ****
              (compilation-move-to-column
               col compilation-error-screen-columns)
            (forward-to-indentation 0))
!         (setq marker (list (point-marker))))))
  
      (setq loc (compilation-assq line (cdr file-struct)))
      (if end-line
--- 725,731 ----
                (compilation-move-to-column
                 col compilation-error-screen-columns)
              (forward-to-indentation 0))
!           (setq marker (list (point-marker)))))))
  
      (setq loc (compilation-assq line (cdr file-struct)))
      (if end-line

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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