Re: with-current-buffer

2005-09-12 Thread Emilio Lopes
Stefan Monnier writes: > If foo is displayed in a window, it has 2 points: its own and the > one of the window. My first thought was to ask if this is a new feature. It isn't. It's just plain embarrassing that one can work more than ten years with an editor without ever noting something as fund

Re: with-current-buffer

2005-09-11 Thread Stefan Monnier
nt? > The point in buffer "FOO", of course. If foo is displayed in a window, it has 2 points: its own and the one of the window. > I expected the point to stay at point max after `with-current-buffer' exits. It does stay there. Try (progn (with-current-buffer "

Re: with-current-buffer

2005-09-11 Thread Luc Teirlinck
Emilio Lopes wrote: Display a buffer, let's say "FOO", with some content. Move point to its beginning. Insert the following code in the "*scratch*" buffer: (with-current-buffer "FOO" (goto-char (point-max)) (insert "bar&qu

Re: with-current-buffer

2005-09-11 Thread Emilio Lopes
point? The point in buffer "FOO", of course. I expected the point to stay at point max after `with-current-buffer' exits. In the case 1 explained in the original message the code behaves as if it were wrapped with `save-excursion'. Can you reproduce it? ___

Re: with-current-buffer

2005-09-11 Thread Stefan Monnier
> In both cases the insertion is done at the right spot, but in case 1 > point in buffer "FOO" is restored after the code is executed. > Is that intended behavior? > I expected point to be moved permanently in both cases. Which point? Stefan __

with-current-buffer

2005-09-11 Thread Emilio Lopes
Start Emacs (latest CVS on GNU/Linux) with ./src/emacs --no-init-file --no-site-file Display a buffer, let's say "FOO", with some content. Move point to its beginning. Insert the following code in the "*scratch*" buffer: (with-current-buffer "F

Re: with-current-buffer

2005-06-29 Thread Kevin Rodgers
Stefan Monnier wrote: Should there be a with-selected-window macro, analogous to with-current-buffer? Ever tried C-h f ? Not in Emacs 22. -- Kevin ___ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs

next-error-hook (was: with-current-buffer)

2005-06-28 Thread Juri Linkov
> Or maybe `pop-to-buffer inside with-current-buffer' is not a suitable > programming construct (I mean mostly for the `next-error' command > where this problem occurred) > > There is nothing wrong with it in principle, no reason why it should > in general

Re: with-current-buffer

2005-06-28 Thread Stefan Monnier
> Should there be a with-selected-window macro, analogous to > with-current-buffer? Ever tried C-h f ? Stefan ___ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel

Re: with-current-buffer

2005-06-28 Thread Richard M. Stallman
actions on that buffer (e.g. run hooks). I don't understand what you mean by "trouble"--the scenario is not clearly specified. It is a basic feature that the main loop sets the current buffer. It is a basic feature that with-current-buffer preserves the current buffer. May

Re: with-current-buffer

2005-06-28 Thread Kevin Rodgers
desirable to perform some > actions on that buffer (e.g. run hooks). But you also changed the selected window. That is the cause of the trouble. > Maybe with-current-buffer should keep track of switching buffers > inside with-current-buffer, so it could anticipate what a buffer will > be

Re: with-current-buffer

2005-06-27 Thread Juri Linkov
>> (with-current-buffer "c" >> (pop-to-buffer "b")) >> (message "%s" (buffer-name (current-buffer >> >> At the end, it print "a" as the current buffer name, but actually >> this command makes the buffer &qu

Re: with-current-buffer (was: fit-window-to-buffer)

2005-06-27 Thread Richard M. Stallman
(defun test () (interactive) (set-buffer "a") (with-current-buffer "c" (pop-to-buffer "b")) (message "%s" (buffer-name (current-buffer (test) At the end, it print "a" as the current buffer name,

Re: with-current-buffer (was: fit-window-to-buffer)

2005-06-27 Thread Miles Bader
On 6/27/05, Juri Linkov <[EMAIL PROTECTED]> wrote: > (with-current-buffer "c" > (pop-to-buffer "b")) > (message "%s" (buffer-name (current-buffer > > At the end, it print "a" as the current buffer name, but actually > t

with-current-buffer (was: fit-window-to-buffer)

2005-06-26 Thread Juri Linkov
There is a similar problem related to switching buffers using `with-current-buffer' and co. I can't say if it's a bug or not. For example, `next-error' after finishing has the current buffer reported by (current-buffer) not the same as the buffer where the point eventually