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

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

Re: Problems with compile-mode


From: Stefan Monnier
Subject: Re: Problems with compile-mode
Date: 19 May 2004 17:37:36 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> In compilation-set-window-height I had added save-excursion to save the
> first problem about insertion point.

Could you explain in detail what was that problem (I mean I remember the
description, but I didn't understand your fix because I don't understand
what was the underlying problem)?

>        (save-current-buffer
>          (save-selected-window
>            (save-excursion
>              (select-window window)
>              (enlarge-window (- height (window-height))))))

How about placing the save-excursion before the save-selected-window ?
In other words throwing out save-current-buffer and replacing it with
save-excursion?

The way it's placed right now is prone to errors because each buffer has
several points, and save-excursion saves&restores the "current" point but
the "current" point is not necessarily the same at "save" and at "restore",
especially if a `select-window' was done in between the two.

Of course, maybe save-excursion should be fixed to remember which point it
saved and to restore the same one, just like `let' was fixed to restore the
value of a variable in the same buffer in which it was saved.

Also I don't see how the above code relates to the original problem about
insertion, since this code is only executed from compilation-goto-locus,
right?  I think I'm really missing something here.


        Stefan


PS: By the way: why does with-selected-window save&restore the selected
window on each and every frame?  I think it should only care about the
current frame.  Any objection to the patch below?


* auto-adding address@hidden/emacs--monnier--0--patch-44 to greedy revision 
library /part/00/Tmp/monnier/archlib
* found immediate ancestor revision in library 
(address@hidden/emacs--monnier--0--patch-43)
* patching for this revision (address@hidden/emacs--monnier--0--patch-44)
--- orig/lisp/subr.el
+++ mod/lisp/subr.el
@@ -1852,18 +1852,9 @@
 This does not alter the buffer list ordering.
 See also `with-temp-buffer'."
   (declare (indent 1) (debug t))
-  ;; Most of this code is a copy of save-selected-window.
-  `(let ((save-selected-window-window (selected-window))
-        (save-selected-window-alist
-         (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
-                 (frame-list))))
+  `(let ((save-selected-window-window (selected-window)))
      (unwind-protect
         (progn (select-window ,window 'norecord)
                ,@body)
-       (dolist (elt save-selected-window-alist)
-        (and (frame-live-p (car elt))
-             (window-live-p (cadr elt))
-             (set-frame-selected-window (car elt) (cadr elt))))
        (if (window-live-p save-selected-window-window)
-          ;; This is where the code differs from save-selected-window.
           (select-window save-selected-window-window 'norecord)))))




reply via email to

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