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
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 "
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
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?
___
> 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
__
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
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
> 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
> 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
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
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
>> (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
(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,
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
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
15 matches
Mail list logo