* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
@ 2009-10-07 4:01 ` Juanma Barranquero
2009-10-07 5:41 ` Stefan Monnier
2010-01-10 7:36 ` bug#5273: marked as done (23.1; format-alist encode vs write-region-post-annotation-function) Emacs bug Tracking System
` (8 subsequent siblings)
9 siblings, 1 reply; 32+ messages in thread
From: Juanma Barranquero @ 2009-10-07 4:01 UTC (permalink / raw)
To: Markus Rost; +Cc: 4655
> (let ((bufA (get-buffer-create "A"))
> (bufB (get-buffer-create "B")))
> (set-buffer bufA)
> (message "buffer-msg-1 %s" (current-buffer))
> (save-excursion
> (buffer-swap-text bufB))
> (message "buffer-msg-2 %s" (current-buffer)))
>
> the *Messages* buffer contains
>
> buffer-msg-1 A
> buffer-msg-2 B
>
> With the save-excursion I would have expected the messages
>
> buffer-msg-1 A
> buffer-msg-2 A
Why "with the save-excursion"? I would expect A/A both with and
without it (and I'm quite surprised to find that it is not so).
Why do you expect buffer-swap-text to switch the current buffer? And,
why it is doing it?
Juanma
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 4:01 ` Juanma Barranquero
@ 2009-10-07 5:41 ` Stefan Monnier
2009-10-07 8:53 ` Markus Rost
2009-10-07 10:07 ` Juanma Barranquero
0 siblings, 2 replies; 32+ messages in thread
From: Stefan Monnier @ 2009-10-07 5:41 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: Markus Rost, 4655
> Why do you expect buffer-swap-text to switch the current buffer?
I'm not sure he expects it. And if he does, I can't tell you why, so
I'll pass.
> And, why it is doing it?
I don't think it does when not called within save-excursion.
But when called within the save-excursion, the reason is simple:
1- markers are swapped along with the buffer texts (with a some
exceptions, mostly window-markers).
2- save-excursion saves the "position and current buffer" as a marker.
Combine 1 and 2 together, and you'll see that save-excursion ends up
changing the current buffer.
Stefan
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 5:41 ` Stefan Monnier
@ 2009-10-07 8:53 ` Markus Rost
2009-10-07 10:07 ` Juanma Barranquero
1 sibling, 0 replies; 32+ messages in thread
From: Markus Rost @ 2009-10-07 8:53 UTC (permalink / raw)
To: Stefan Monnier; +Cc: lekktu, 4655
Juanma wrote:
> I would expect A/A both with and
> without it (and I'm quite surprised to find that it is not so).
Exactly.
> Why do you expect buffer-swap-text to switch the current buffer?
I don't. See below for the concrete situation which led to my
example.
Stefan wrote:
> 1- markers are swapped along with the buffer texts (with a some
> exceptions, mostly window-markers).
> 2- save-excursion saves the "position and current buffer" as a marker.
> Combine 1 and 2 together, and you'll see that save-excursion ends up
> changing the current buffer.
That explains what happened, thanks. But 2- is not obvious from the
documentation of save-excursion. And the conclusion "save-excursion
ends up changing the current buffer" is very, very surprising.
Since I am not the only one to be surprised, it seems to me that if
save-excursion/buffer-swap-text keeps having this behavior, it should
be documented, perhaps with a warning for lisp programmers.
==========
Here is the concrete scenario which induced my buffer-swap-text
example: I have set
(defadvice rmail-cease-edit (after update-rmail-summary preactivate)
"Recompute Summary-line immediately."
(rmail-summary))
I expected this to behave like hitting 'h' after editing an rmail
buffer. But I get an error:
rmail-new-summary: No RMAIL buffer found
The reason is that rmail-cease-edit contains the piece
(save-excursion
(rmail-show-message)
(rmail-toggle-header (if pruned 1 0))))
and rmail-show-message has some buffer/text swapping in it. Moreover,
the swap partner rmail-view-buffer (an odd name by the way) doesn't
know its rmail-buffer (maybe it should?), so calling rmail-summary
from it triggers the error.
==========
On a general note: Thank you for all the great developments in Emacs
22/23.
Markus
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 5:41 ` Stefan Monnier
2009-10-07 8:53 ` Markus Rost
@ 2009-10-07 10:07 ` Juanma Barranquero
2009-10-07 14:29 ` Stefan Monnier
1 sibling, 1 reply; 32+ messages in thread
From: Juanma Barranquero @ 2009-10-07 10:07 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Markus Rost, 4655
On Wed, Oct 7, 2009 at 07:41, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 2- save-excursion saves the "position and current buffer" as a marker.
> Combine 1 and 2 together, and you'll see that save-excursion ends up
> changing the current buffer.
Oops. Yes, I see.
Well, we could document it, but from my POV it looks more like a bug
than a "feature".
Juanma
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 10:07 ` Juanma Barranquero
@ 2009-10-07 14:29 ` Stefan Monnier
2009-10-08 16:48 ` Markus Rost
2011-07-13 14:08 ` Lars Magne Ingebrigtsen
0 siblings, 2 replies; 32+ messages in thread
From: Stefan Monnier @ 2009-10-07 14:29 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: Markus Rost, 4655
>> 2- save-excursion saves the "position and current buffer" as a marker.
>> Combine 1 and 2 together, and you'll see that save-excursion ends up
>> changing the current buffer.
> Oops. Yes, I see.
> Well, we could document it, but from my POV it looks more like a bug
> than a "feature".
Agreed. This said, we have a problem.
If we consider the buffer-swap-text as a kind of "two-way copy&paste",
just with a more efficient implementation, then it would be OK for
save-excursion to not preserve the position, i.e. handle save-excursion
markers similarly to window-markers.
I see some problems with it, tho:
1- how to find all the save-excursion markers (we'd probably have to
walk the specpdl list and compare the restore function with
save_excursion_restore, which is very ugly).
2- if we reset those marker's position in buffer-swap-text, then
(save-excursion (buffer-swap-text BUF) (dosomething) (buffer-swap-text BUF))
would end up moving point to (point-min) for no good reason, which is
rather inconvenient and might be worse than the OP.
3- we could change save-excursion itself to check the the markers still
points to the same buffer. That would solve the OP, but the cost of
making all save-excursions more expensive (for the sake of a rare
corner case).
4- should save-excursion care more about preserving the position inside
the current text, or preserving the current buffer?
5- most uses of save-excursion are wrong, and the OP is among them.
I.e. I'd tend to prefer documenting it (in buffer-swap-text), and remind
people that they should usually use with-current-buffer rather than
save-excursion.
Stefan "who thinks save-excursion is an ugly beast"
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 14:29 ` Stefan Monnier
@ 2009-10-08 16:48 ` Markus Rost
2011-07-13 14:08 ` Lars Magne Ingebrigtsen
1 sibling, 0 replies; 32+ messages in thread
From: Markus Rost @ 2009-10-08 16:48 UTC (permalink / raw)
To: Stefan Monnier; +Cc: lekktu, 4655
A follow up to my previous message:
If you look at the end of rmail-cease-edit:
(save-excursion
(rmail-show-message)
(rmail-toggle-header (if pruned 1 0))))
(run-hooks 'rmail-mode-hook))
the question arises in which buffer rmail-mode-hook should be run?
One may check with
(add-hook 'rmail-mode-hook
(lambda () (message "foo: %s" (current-buffer))))
that currently it runs in rmail-view-buffer, which is perhaps not what
one expects. Changing to
(rmail-show-message)
(save-excursion
(rmail-toggle-header (if pruned 1 0))))
(run-hooks 'rmail-mode-hook))
is probably OK. That would be in line with Stefan's point:
> 5- most uses of save-excursion are wrong,
=======
Here are more issues related to the usage of buffer-swap-text:
I tried to fix
<URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00052.html>
<URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00054.html>
(I think this bug should be fixed before the next release: The mbox
files should not be corrupted.)
with the patch below. See also the thread of
<URL:http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00468.html>
It seems to work, except that after a save ('s' in Rmail) the
rmail-buffer gets a wrong value of buffer-file-coding-system (to be
seen in the mode line). Only temporarily, switching back and forth to
another message in Rmail restores the correct value of
buffer-file-coding-system.
After further debugging, it turned out that the problem sits in
;; Used in `write-region-annotate-functions' to write rmail files.
(defun rmail-write-region-annotate (start end)
(when (and (null start) (rmail-buffers-swapped-p))
(set-buffer rmail-view-buffer)
(widen)
nil))
Namely, when rmail-expunge-and-save calls save-buffer, then, with
rmail-write-region-annotate in write-region-annotate-functions,
save-buffer and basic-save-buffer* write the rmail-view-buffer to the
file (which is correct) but then set the buffer-file-coding-system to
last-coding-system-used in the rmail-buffer (which is not correct).
It seems that generally write-region-annotate-functions should not
change the buffer to be written. (What if arg START of write-region
is a buffer position?)
===File ~/.emacs.d/rmail/rmail23/bug/rmail-swap.diff========
*** rmail.el 06 Oct 2009 13:20:10 +0200 1.554
--- rmail.el 08 Oct 2009 14:07:01 +0200
***************
*** 1306,1320 ****
(defun rmail-swap-buffers ()
"Swap text between current buffer and `rmail-view-buffer'.
! This function preserves the current buffer's modified flag, and also
! sets the current buffer's `buffer-file-coding-system' to that of
! `rmail-view-buffer'."
(let ((modp (buffer-modified-p))
(coding
(with-current-buffer rmail-view-buffer
buffer-file-coding-system)))
(buffer-swap-text rmail-view-buffer)
(setq buffer-file-coding-system coding)
(restore-buffer-modified-p modp)))
(defun rmail-buffers-swapped-p ()
--- 1306,1322 ----
(defun rmail-swap-buffers ()
"Swap text between current buffer and `rmail-view-buffer'.
! This function preserves the current buffer's modified flag and
! also swaps the value of `buffer-file-coding-system'."
(let ((modp (buffer-modified-p))
+ (coding0 buffer-file-coding-system)
(coding
(with-current-buffer rmail-view-buffer
buffer-file-coding-system)))
(buffer-swap-text rmail-view-buffer)
(setq buffer-file-coding-system coding)
+ (with-current-buffer rmail-view-buffer
+ (setq buffer-file-coding-system coding0))
(restore-buffer-modified-p modp)))
(defun rmail-buffers-swapped-p ()
============================================================
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2009-10-07 14:29 ` Stefan Monnier
2009-10-08 16:48 ` Markus Rost
@ 2011-07-13 14:08 ` Lars Magne Ingebrigtsen
2016-07-11 1:58 ` npostavs
1 sibling, 1 reply; 32+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-13 14:08 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Markus Rost, Juanma Barranquero, 4655
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> 2- save-excursion saves the "position and current buffer" as a marker.
>>> Combine 1 and 2 together, and you'll see that save-excursion ends up
>>> changing the current buffer.
>
>> Oops. Yes, I see.
>> Well, we could document it, but from my POV it looks more like a bug
>> than a "feature".
>
> Agreed. This said, we have a problem.
Has this been fixed? I seem to be unable to reproduce this bug in Emacs
24...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2011-07-13 14:08 ` Lars Magne Ingebrigtsen
@ 2016-07-11 1:58 ` npostavs
2016-07-11 14:37 ` Eli Zaretskii
0 siblings, 1 reply; 32+ messages in thread
From: npostavs @ 2016-07-11 1:58 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen
Cc: Markus Rost, Juanma Barranquero, 4655, Stefan Monnier
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
tags 4655 patch
quit
Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>> 2- save-excursion saves the "position and current buffer" as a marker.
>>>> Combine 1 and 2 together, and you'll see that save-excursion ends up
>>>> changing the current buffer.
>>
>>> Oops. Yes, I see.
>>> Well, we could document it, but from my POV it looks more like a bug
>>> than a "feature".
>>
>> Agreed. This said, we have a problem.
>
> Has this been fixed? I seem to be unable to reproduce this bug in Emacs
> 24...
Reproduces for me with 23.4 up through 25.0.95. So here's a patch to
mention it in the manual:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1126 bytes --]
From 7c79e2f1aef7e59d80d7b46533a93f2f23ad6759 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 10 Jul 2016 21:52:23 -0400
Subject: [PATCH v1] Document buffer-swap-text+save-excursion interaction
* doc/lispref/buffers.texi (Swapping Text): Add warning about
interaction of `buffer-swap-text' and `save-excursion' (Bug #4655).
---
doc/lispref/buffers.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 1f7f263..22c6726 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1211,6 +1211,11 @@ Swapping Text
overlays, the text properties, the undo list, the value of the
@code{enable-multibyte-characters} flag (@pxref{Text Representations,
enable-multibyte-characters}), etc.
+
+@strong{Warning:} The current buffer will be set to @var{buffer} if
+this function is called from within @code{save-excursion}, since the
+marker used by @code{save-excursion} to save the position and buffer
+will be swapped as well.
@end defun
If you use @code{buffer-swap-text} on a file-visiting buffer, you
--
2.8.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-11 1:58 ` npostavs
@ 2016-07-11 14:37 ` Eli Zaretskii
2016-07-11 18:50 ` Markus Rost
0 siblings, 1 reply; 32+ messages in thread
From: Eli Zaretskii @ 2016-07-11 14:37 UTC (permalink / raw)
To: npostavs; +Cc: rost, lekktu, larsi, 4655, monnier
> From: npostavs@users.sourceforge.net
> Date: Sun, 10 Jul 2016 21:58:36 -0400
> Cc: Markus Rost <rost@math.uni-bielefeld.de>,
> Juanma Barranquero <lekktu@gmail.com>, 4655@debbugs.gnu.org,
> Stefan Monnier <monnier@iro.umontreal.ca>
>
> --- a/doc/lispref/buffers.texi
> +++ b/doc/lispref/buffers.texi
> @@ -1211,6 +1211,11 @@ Swapping Text
> overlays, the text properties, the undo list, the value of the
> @code{enable-multibyte-characters} flag (@pxref{Text Representations,
> enable-multibyte-characters}), etc.
> +
> +@strong{Warning:} The current buffer will be set to @var{buffer} if
> +this function is called from within @code{save-excursion}, since the
> +marker used by @code{save-excursion} to save the position and buffer
> +will be swapped as well.
> @end defun
Fine with me, but I think we should also add a single sentence to the
doc string, something like
Using this function from `save-excursion' might produce surprising
results, see Info node `(elisp)Swapping Text'.
With that taken care of, please push to emacs-25.
Thanks.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-11 14:37 ` Eli Zaretskii
@ 2016-07-11 18:50 ` Markus Rost
2016-07-11 19:07 ` Dmitry Gutov
0 siblings, 1 reply; 32+ messages in thread
From: Markus Rost @ 2016-07-11 18:50 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, larsi, npostavs, 4655, monnier
> please push to emacs-25.
Oh, I am still using
GNU Emacs 22.3.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2015-11-14 on euclid
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-11 18:50 ` Markus Rost
@ 2016-07-11 19:07 ` Dmitry Gutov
2016-07-12 1:58 ` npostavs
0 siblings, 1 reply; 32+ messages in thread
From: Dmitry Gutov @ 2016-07-11 19:07 UTC (permalink / raw)
To: Markus Rost, Eli Zaretskii; +Cc: lekktu, larsi, npostavs, 4655, monnier
On 07/11/2016 09:50 PM, Markus Rost wrote:
>> please push to emacs-25.
>
> Oh, I am still using
>
> GNU Emacs 22.3.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2015-11-14 on euclid
Sorry, you'll have to upgrade to Emacs 25 when it comes out, to see this
fixed. Emacs 24 and earlier are not supported anymore.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-11 19:07 ` Dmitry Gutov
@ 2016-07-12 1:58 ` npostavs
2016-07-12 5:16 ` Eli Zaretskii
0 siblings, 1 reply; 32+ messages in thread
From: npostavs @ 2016-07-12 1:58 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: lekktu, monnier, Markus Rost, 4655, larsi
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 07/11/2016 09:50 PM, Markus Rost wrote:
>>> please push to emacs-25.
I'm thinking also to tweak the wording a bit to make it clear that the
buffer change happens at the end of the save-excursion, not when
buffer-swap-text is called.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-v2 --]
[-- Type: text/x-diff, Size: 1783 bytes --]
From 3c66c6f163e72da7b8f5d40dab7cb2655faddf47 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 10 Jul 2016 21:52:23 -0400
Subject: [PATCH v2] Document buffer-swap-text+save-excursion interaction
* doc/lispref/buffers.texi (Swapping Text):
* src/buffer.c (Fbuffer_swap_text): Add warning about interaction of
`buffer-swap-text' and `save-excursion' (Bug #4655).
---
doc/lispref/buffers.texi | 5 +++++
src/buffer.c | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 1f7f263..e10c2b3 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1211,6 +1211,11 @@ Swapping Text
overlays, the text properties, the undo list, the value of the
@code{enable-multibyte-characters} flag (@pxref{Text Representations,
enable-multibyte-characters}), etc.
+
+@strong{Warning:} If called from within @code{save-excursion}, this
+function will set the saved buffer to @var{buffer}, since the
+marker used by @code{save-excursion} to save the position and buffer
+will be swapped as well.
@end defun
If you use @code{buffer-swap-text} on a file-visiting buffer, you
diff --git a/src/buffer.c b/src/buffer.c
index e4269c0..89f4479 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2231,7 +2231,9 @@ advance_to_char_boundary (ptrdiff_t byte_pos)
DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
1, 1, 0,
- doc: /* Swap the text between current buffer and BUFFER. */)
+ doc: /* Swap the text between current buffer and BUFFER.
+Using this function from `save-excursion' might produce surprising
+results, see Info node `(elisp)Swapping Text'. */)
(Lisp_Object buffer)
{
struct buffer *other_buffer;
--
2.8.0
[-- Attachment #3: Type: text/plain, Size: 462 bytes --]
>>
>> Oh, I am still using
>>
>> GNU Emacs 22.3.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2015-11-14 on euclid
>
> Sorry, you'll have to upgrade to Emacs 25 when it comes out, to see
> this fixed. Emacs 24 and earlier are not supported anymore.
To be clear, the particular behaviour that prompted this bug report will
not be fixed/changed, I'm just documenting it (obviously there are a lot
of other changes and improvements between 22.3 and 25).
^ permalink raw reply related [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-12 1:58 ` npostavs
@ 2016-07-12 5:16 ` Eli Zaretskii
2016-07-13 23:50 ` npostavs
0 siblings, 1 reply; 32+ messages in thread
From: Eli Zaretskii @ 2016-07-12 5:16 UTC (permalink / raw)
To: npostavs; +Cc: lekktu, monnier, dgutov, rost, 4655, larsi
> From: npostavs@users.sourceforge.net
> Cc: Markus Rost <rost@math.uni-bielefeld.de>, Eli Zaretskii <eliz@gnu.org>, 4655@debbugs.gnu.org, lekktu@gmail.com, larsi@gnus.org, monnier@iro.umontreal.ca
> Date: Mon, 11 Jul 2016 21:58:59 -0400
>
> I'm thinking also to tweak the wording a bit to make it clear that the
> buffer change happens at the end of the save-excursion, not when
> buffer-swap-text is called.
Yes, something like "upon return from this form ...". I think it's a
good idea.
Otherwise the text is good, IMO.
Thanks.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-12 5:16 ` Eli Zaretskii
@ 2016-07-13 23:50 ` npostavs
2016-07-14 15:03 ` Eli Zaretskii
0 siblings, 1 reply; 32+ messages in thread
From: npostavs @ 2016-07-13 23:50 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, monnier, dgutov, rost, 4655, larsi
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> Yes, something like "upon return from this form ...". I think it's a
> good idea.
>
> Otherwise the text is good, IMO.
Okay, here is my final version, I will push tomorrow.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-v3 --]
[-- Type: text/x-diff, Size: 1822 bytes --]
From f0295dbfceb3264f93d583537ff184b63779adea Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 10 Jul 2016 21:52:23 -0400
Subject: [PATCH v3] Document buffer-swap-text+save-excursion interaction
* doc/lispref/buffers.texi (Swapping Text):
* src/buffer.c (Fbuffer_swap_text): Add warning about interaction of
`buffer-swap-text' and `save-excursion' (Bug #4655).
---
doc/lispref/buffers.texi | 6 ++++++
src/buffer.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 1f7f263..740d7cf 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1211,6 +1211,12 @@ Swapping Text
overlays, the text properties, the undo list, the value of the
@code{enable-multibyte-characters} flag (@pxref{Text Representations,
enable-multibyte-characters}), etc.
+
+@strong{Warning:} If this function is called from within a
+@code{save-excursion} form, the current buffer will be set to
+@var{buffer} upon leaving the form, since the marker used by
+@code{save-excursion} to save the position and buffer will be swapped
+as well.
@end defun
If you use @code{buffer-swap-text} on a file-visiting buffer, you
diff --git a/src/buffer.c b/src/buffer.c
index e4269c0..89f4479 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2231,7 +2231,9 @@ advance_to_char_boundary (ptrdiff_t byte_pos)
DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
1, 1, 0,
- doc: /* Swap the text between current buffer and BUFFER. */)
+ doc: /* Swap the text between current buffer and BUFFER.
+Using this function from `save-excursion' might produce surprising
+results, see Info node `(elisp)Swapping Text'. */)
(Lisp_Object buffer)
{
struct buffer *other_buffer;
--
2.8.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-13 23:50 ` npostavs
@ 2016-07-14 15:03 ` Eli Zaretskii
2016-07-15 0:05 ` npostavs
0 siblings, 1 reply; 32+ messages in thread
From: Eli Zaretskii @ 2016-07-14 15:03 UTC (permalink / raw)
To: npostavs; +Cc: lekktu, monnier, dgutov, rost, 4655, larsi
> From: npostavs@users.sourceforge.net
> Cc: 4655@debbugs.gnu.org, lekktu@gmail.com, monnier@iro.umontreal.ca, dgutov@yandex.ru, rost@math.uni-bielefeld.de, larsi@gnus.org
> Date: Wed, 13 Jul 2016 19:50:49 -0400
>
> Okay, here is my final version, I will push tomorrow.
>
> >From f0295dbfceb3264f93d583537ff184b63779adea Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Sun, 10 Jul 2016 21:52:23 -0400
> Subject: [PATCH v3] Document buffer-swap-text+save-excursion interaction
>
> * doc/lispref/buffers.texi (Swapping Text):
> * src/buffer.c (Fbuffer_swap_text): Add warning about interaction of
> `buffer-swap-text' and `save-excursion' (Bug #4655).
> ---
> doc/lispref/buffers.texi | 6 ++++++
> src/buffer.c | 4 +++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
> index 1f7f263..740d7cf 100644
> --- a/doc/lispref/buffers.texi
> +++ b/doc/lispref/buffers.texi
> @@ -1211,6 +1211,12 @@ Swapping Text
> overlays, the text properties, the undo list, the value of the
> @code{enable-multibyte-characters} flag (@pxref{Text Representations,
> enable-multibyte-characters}), etc.
> +
> +@strong{Warning:} If this function is called from within a
> +@code{save-excursion} form, the current buffer will be set to
> +@var{buffer} upon leaving the form, since the marker used by
> +@code{save-excursion} to save the position and buffer will be swapped
> +as well.
> @end defun
>
> If you use @code{buffer-swap-text} on a file-visiting buffer, you
> diff --git a/src/buffer.c b/src/buffer.c
> index e4269c0..89f4479 100644
> --- a/src/buffer.c
> +++ b/src/buffer.c
> @@ -2231,7 +2231,9 @@ advance_to_char_boundary (ptrdiff_t byte_pos)
>
> DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
> 1, 1, 0,
> - doc: /* Swap the text between current buffer and BUFFER. */)
> + doc: /* Swap the text between current buffer and BUFFER.
> +Using this function from `save-excursion' might produce surprising
> +results, see Info node `(elisp)Swapping Text'. */)
> (Lisp_Object buffer)
> {
> struct buffer *other_buffer;
> --
> 2.8.0
Thanks, looks good.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#4655: 23.1.50; buffer-swap-text oddity
2016-07-14 15:03 ` Eli Zaretskii
@ 2016-07-15 0:05 ` npostavs
0 siblings, 0 replies; 32+ messages in thread
From: npostavs @ 2016-07-15 0:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, monnier, dgutov, rost, 4655, larsi
close 4655
quit
>> From: npostavs@users.sourceforge.net
>> Cc: 4655@debbugs.gnu.org, lekktu@gmail.com, monnier@iro.umontreal.ca, dgutov@yandex.ru, rost@math.uni-bielefeld.de, larsi@gnus.org
>> Date: Wed, 13 Jul 2016 19:50:49 -0400
>>
>> Okay, here is my final version, I will push tomorrow.
pushed as 9ba51edf
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5273: marked as done (23.1; format-alist encode vs write-region-post-annotation-function)
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
2009-10-07 4:01 ` Juanma Barranquero
@ 2010-01-10 7:36 ` Emacs bug Tracking System
2010-01-13 0:45 ` bug#5256: marked as done (conjunct formation should follow input sequence when inserting text) Emacs bug Tracking System
` (7 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Emacs bug Tracking System @ 2010-01-10 7:36 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-bug-tracker
[-- Attachment #1: Type: text/plain, Size: 900 bytes --]
Your message dated Sun, 10 Jan 2010 01:31:00 -0500
with message-id <jwv3a2eiia3.fsf-monnier+emacs@gnu.org>
and subject line Re: bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function
has caused the Emacs bug report #5273,
regarding 23.1; format-alist encode vs write-region-post-annotation-function
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)
--
5273: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5273
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems
[-- Attachment #2: Type: message/rfc822, Size: 8352 bytes --]
From: Kevin Ryde <user42@zip.com.au>
To: bug-gnu-emacs@gnu.org
Cc:
Subject: bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function
Date: Sun, 27 Dec 2009 11:17:04 +1100
Message-ID: <87eimhi83j.fsf@blah.blah>
In a format-alist "TO-FN" encode function, the buffer provided to that
function to operate on has write-region-post-annotation-function set to
`kill-buffer'.
This is extremely dangerous, and almost certainly incompatible with past
emacs, as it means any write-region done by the encode function will
kill the buffer it's operating on, causing it to then mangle some other
buffer, quite possibly with no indication that this happened.
A write-region in an encode function is likely if the function works by
putting data through an external program.
I struck this in three of my file formats where I use make-temp-file.
(Two for an error files for call-process-region, one because the program
needed an actual file to write to, not a pipe etc.) Because
make-temp-file does its job by a writing an empty string to the new
file, it ran the kill-buffer from write-region-post-annotation-function.
I'm was unsure if make-temp-file ought to guard itself against this. My
inclination is not. There's an awful lot of read/write hooks and stuff,
and to set them so "write a string to a file" means "kill the current
buffer" is so unreasonable that there's no point anticipating it in one
particular place when so many things will be similarly affected.
I couldn't tell what that write-region-post-annotation-function is
trying to achieve. If it's to kill the temporary buffer after writing
then an unwind-protect would sound far better, or at least apply the
kill setting only after running the format-alist encode func.
In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
of 2009-09-14 on raven, modified by Debian
configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_AU
value of $XMODIFIERS: nil
locale-coding-system: iso-latin-1-unix
default-enable-multibyte-characters: t
[-- Attachment #3: Type: message/rfc822, Size: 2629 bytes --]
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kevin Ryde <user42@zip.com.au>
Subject: Re: bug#5273: 23.1; format-alist encode vs write-region-post-annotation-function
Date: Sun, 10 Jan 2010 01:31:00 -0500
Message-ID: <jwv3a2eiia3.fsf-monnier+emacs@gnu.org>
>>> Does the patch below help?
>> Yep.
> Thanks, installed.
I think this closes this bug,
Stefan
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5256: marked as done (conjunct formation should follow input sequence when inserting text)
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
2009-10-07 4:01 ` Juanma Barranquero
2010-01-10 7:36 ` bug#5273: marked as done (23.1; format-alist encode vs write-region-post-annotation-function) Emacs bug Tracking System
@ 2010-01-13 0:45 ` Emacs bug Tracking System
2010-01-13 0:49 ` bug#5265: marked as done (23.1.90; vc - can't reread redirected stdin for log message) Emacs bug Tracking System
` (6 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Emacs bug Tracking System @ 2010-01-13 0:45 UTC (permalink / raw)
To: Glenn Morris; +Cc: emacs-bug-tracker
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
Your message dated Tue, 12 Jan 2010 19:44:03 -0500
with message-id <i33a2aq1f0.fsf@fencepost.gnu.org>
and subject line Re: Bug#5256
has caused the Emacs bug report #5256,
regarding conjunct formation should follow input sequence when inserting text
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)
--
5256: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5256
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems
[-- Attachment #2: Type: message/rfc822, Size: 7796 bytes --]
From: Praveen A <pravi.a@gmail.com>
To: bug-gnu-emacs@gnu.org
Cc: psatpute@redhat.com, Parag Nemade <pnemade@redhat.com>, suresh <surumafonts@gmail.com>
Subject: bug#5256: conjunct formation should follow input sequence when inserting text
Date: Mon, 21 Dec 2009 20:53:41 +0530
Message-ID: <3f2beab60912210723x4f424fa9l2b842824aff1a546@mail.gmail.com>
Example to illustrate this bug is അപ്ലോഡ് (upload).
>>> a=u'ലോഡ്'
>>> b=u'അപ്'
>>> c=u'അപ്ലോഡ്'
>>> print repr(c)
u'\u0d05\u0d2a\u0d4d\u200c\u0d32\u0d4b\u0d21\u0d4d'
>>> d=u'അപ്ലോഡ്'
>>> print repr(d)
u'\u0d05\u0d2a\u0d4d\u0d32\u0d4b\u200c\u0d21\u0d4d'
>>>
Here ZWNJ is added to prevent formation of conjunct 'pla' (\u0d2a\u0d4d\u0d32).
Enter ലോഡ് (\u0d32\u0d4b\u0d21\u0d4d) first, move cursor to the
beginning of the word, now enter അപ് (\u0d05\u0d2a\u0d4d). Now ZWNJ
entered will not be after 0d4d, but after the conjunct 'plo'
(\u0d2a\u0d4d\u0d32\u0d4b). gedit/pango has the correct behavior,
wherein the ZWNJ is inserted after 0d4d breaking the conjunct 'pla'
(\u0d2a\u0d4d\u0d32) as expected.
GNU Emacs 23.1.90.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.18.3)
of 2009-12-18 on savannah
--
പ്രവീണ് അരിമ്പ്രത്തൊടിയില്
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
Join The DRM Elimination Crew Now!
http://fci.wikia.com/wiki/Anti-DRM-Campaign
[-- Attachment #3: Type: message/rfc822, Size: 2834 bytes --]
From: Glenn Morris <rgm@gnu.org>
To: 5256-done@debbugs.gnu.org
Subject: Re: Bug#5256
Date: Tue, 12 Jan 2010 19:44:03 -0500
Message-ID: <i33a2aq1f0.fsf@fencepost.gnu.org>
This bug was closed recently, but unfortunately the close message was
lost from the Emacs bug database. I am therefore resending the close
message. Sorry for the duplicate mail. The original close message was
http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-12/msg00684.html
From: Praveen A <pravi.a@gmail.com>
Subject: Re: bug#5256: conjunct formation should follow input sequence when inserting text
To: Kenichi Handa <handa@m17n.org>
Cc: 5256-done@debbugs.gnu.org
Date: Mon, 28 Dec 2009 15:08:20 +0530
X-Sent: 2 weeks, 1 day, 14 hours, 56 minutes, 55 seconds ago
2009/12/25 Kenichi Handa <handa@m17n.org>:
> I fixed it. Please try again with the lastest code.
Thanks. I tested it and it is working beautifully.
- Praveen
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5265: marked as done (23.1.90; vc - can't reread redirected stdin for log message)
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (2 preceding siblings ...)
2010-01-13 0:45 ` bug#5256: marked as done (conjunct formation should follow input sequence when inserting text) Emacs bug Tracking System
@ 2010-01-13 0:49 ` Emacs bug Tracking System
2010-01-14 1:22 ` bug#5276: marked as done (23.1; Doc string of bookmark-bmenu-execute-deletions) Emacs bug Tracking System
` (5 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Emacs bug Tracking System @ 2010-01-13 0:49 UTC (permalink / raw)
To: Glenn Morris; +Cc: emacs-bug-tracker
[-- Attachment #1: Type: text/plain, Size: 820 bytes --]
Your message dated Tue, 12 Jan 2010 19:48:08 -0500
with message-id <fey6k2omnr.fsf@fencepost.gnu.org>
and subject line Re: Bug#5265
has caused the Emacs bug report #5265,
regarding 23.1.90; vc - can't reread redirected stdin for log message
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)
--
5265: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5265
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems
[-- Attachment #2: Type: message/rfc822, Size: 5984 bytes --]
From: Leo <sdl.web@gmail.com>
To: emacs-pretest-bug@gnu.org
Cc:
Subject: bug#5265: 23.1.90; vc - can't reread redirected stdin for log message
Date: Thu, 24 Dec 2009 20:30:57 +0000
Message-ID: <m0fx70azcu.fsf@cam.ac.uk>
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug. If you can, give
a recipe starting from `emacs -Q':
1. emacs -q
2. Open a file
3. C-u C-x v i and then type in a version number, for example, 0.1
I get this error:
RCS/cleveref.el,v <-- cleveref.el
initial revision: 0.1
ci: RCS/cleveref.el,v: can't reread redirected stdin for log message; use -m<log message>
ci aborted
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Applications/Emacs.app/Contents/Resources/etc/DEBUG.
In GNU Emacs 23.1.90.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
of 2009-12-09 on victoria.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure '--with-ns''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
value of $XMODIFIERS: nil
locale-coding-system: nil
default enable-multibyte-characters: t
[-- Attachment #3: Type: message/rfc822, Size: 3118 bytes --]
From: Glenn Morris <rgm@gnu.org>
To: 5265-done@debbugs.gnu.org
Subject: Re: Bug#5265
Date: Tue, 12 Jan 2010 19:48:08 -0500
Message-ID: <fey6k2omnr.fsf@fencepost.gnu.org>
This bug was closed recently, but unfortunately the close message was
lost from the Emacs bug database. I am therefore resending the close
message. Sorry for the duplicate mail. The original close message was
http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-12/msg00688.html
From: Dan Nicolaescu <dann@ics.uci.edu>
Subject: Re: bug#5265: 23.1.90; vc - can't reread redirected stdin for log message
To: Leo <sdl.web@gmail.com>
Cc: 5265-done@debbugs.gnu.org
Date: Mon, 28 Dec 2009 11:25:40 -0800 (PST)
Leo <sdl.web@gmail.com> writes:
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug. If you can, give
> a recipe starting from `emacs -Q':
>
>
> 1. emacs -q
> 2. Open a file
> 3. C-u C-x v i and then type in a version number, for example, 0.1
>
> I get this error:
>
> RCS/cleveref.el,v <-- cleveref.el
> initial revision: 0.1
> ci: RCS/cleveref.el,v: can't reread redirected stdin for log message; use -m<log message>
> ci aborted
Fixed in BZR.
----------
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5276: marked as done (23.1; Doc string of bookmark-bmenu-execute-deletions)
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (3 preceding siblings ...)
2010-01-13 0:49 ` bug#5265: marked as done (23.1.90; vc - can't reread redirected stdin for log message) Emacs bug Tracking System
@ 2010-01-14 1:22 ` Emacs bug Tracking System
2010-01-16 20:05 ` bug#5267: 23.1; doc string of defstruct Chong Yidong
` (4 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Emacs bug Tracking System @ 2010-01-14 1:22 UTC (permalink / raw)
To: Karl Fogel; +Cc: emacs-bug-tracker
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
Your message dated Wed, 13 Jan 2010 20:21:03 -0500
with message-id <87r5ptmqgw.fsf@red-bean.com>
and subject line Re: Doc string of bookmark-bmenu-execute-deletions
has caused the Emacs bug report #5276,
regarding 23.1; Doc string of bookmark-bmenu-execute-deletions
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)
--
5276: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5276
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems
[-- Attachment #2: Type: message/rfc822, Size: 6976 bytes --]
From: "Drew Adams" <drew.adams@oracle.com>
To: <bug-gnu-emacs@gnu.org>
Cc:
Subject: bug#5276: 23.1; Doc string of bookmark-bmenu-execute-deletions
Date: Tue, 29 Dec 2009 11:18:13 -0800
Message-ID: <9E917B8411E14A8C86B65BF8C9D433D9@us.oracle.com>
The doc string (raw form):
"Delete bookmarks marked with \
\\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
Presumably, the map and command should be `bookmark-bmenu-mode-map'
and `bookmark-bmenu-delete'. Even if the result is the same for the
default bihndings, there is no reason to reference Buffer-menu stuff
here.
But an even better doc string is: "Delete bookmarks flagged `D'."
(In keeping with the terminology used elsewhere (e.g. Dired), a `D'
mark is called a "flag".)
In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
of 2009-07-29 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
[-- Attachment #3: Type: message/rfc822, Size: 2275 bytes --]
From: Karl Fogel <kfogel@red-bean.com>
To: 5276-done@debbugs.gnu.org
Subject: Re: Doc string of bookmark-bmenu-execute-deletions
Date: Wed, 13 Jan 2010 20:21:03 -0500
Message-ID: <87r5ptmqgw.fsf@red-bean.com>
Fixed as recommended:
revno: 99319
revision-id: karl.fogel@canonical.com-20100113232501-f854t29qop4l3fwd
parent: cyd@stupidchicken.com-20100113183536-tqy5bnj1g5wca5ly
committer: Karl Fogel <karl.fogel@canonical.com>
branch nick: trunk
timestamp: Wed 2010-01-13 18:25:01 -0500
message:
* lisp/bookmark.el (bookmark-bmenu-execute-deletions): Doc fix (Bug#5276).
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5267: 23.1; doc string of defstruct
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (4 preceding siblings ...)
2010-01-14 1:22 ` bug#5276: marked as done (23.1; Doc string of bookmark-bmenu-execute-deletions) Emacs bug Tracking System
@ 2010-01-16 20:05 ` Chong Yidong
2010-01-16 21:39 ` bug#5279: 23.1; VC: should set LC_MESSAGES to C (with patch) Chong Yidong
` (3 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Chong Yidong @ 2010-01-16 20:05 UTC (permalink / raw)
To: Drew Adams; +Cc: 5267
> Doc string says:
>
> "(defstruct (NAME OPTIONS...) (SLOT SLOT-OPTS...)...)"
>
> That's not correct (not complete):
> (NAME OPTIONS...) can also be just NAME.
> (SLOT SLOT-OPTS...) can also be just SLOT.
>
> Also, the rest of the doc string is not understandable:
I have tweaked the docstring to make it more understandable. Thanks.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5279: 23.1; VC: should set LC_MESSAGES to C (with patch)
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (5 preceding siblings ...)
2010-01-16 20:05 ` bug#5267: 23.1; doc string of defstruct Chong Yidong
@ 2010-01-16 21:39 ` Chong Yidong
2010-05-13 19:20 ` bug#5284: 23.1; gnus-summary-expire-thread does not work Glenn Morris
` (2 subsequent siblings)
9 siblings, 0 replies; 32+ messages in thread
From: Chong Yidong @ 2010-01-16 21:39 UTC (permalink / raw)
To: Frédéric Perrin; +Cc: 5279
> I'm using emacs with LANG=fr_FR.UTF-8. When using C-x v +
> (`vc-update') on a file versionned with SVN, emacs barfs saying it
> can't parse the output from "svn update". Indeed, SVN said "À la
> révision 123" whereas "At revision 123" was expected. The following
> patch adds "LC_MESSAGES=C" to process-environment before calling
> external tools; this solves the problem for my case.
Thanks, the patch looks good. I've checked it into the Emacs
repository.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5284: 23.1; gnus-summary-expire-thread does not work
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (6 preceding siblings ...)
2010-01-16 21:39 ` bug#5279: 23.1; VC: should set LC_MESSAGES to C (with patch) Chong Yidong
@ 2010-05-13 19:20 ` Glenn Morris
2010-05-24 19:53 ` bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer Thierry Volpiatto
2010-06-30 20:35 ` bug#5281: 23.1; xml-parse-region causes infinite loops if the region is not well-formed XML Chong Yidong
9 siblings, 0 replies; 32+ messages in thread
From: Glenn Morris @ 2010-05-13 19:20 UTC (permalink / raw)
To: 5284-done; +Cc: Andreas Seltenreich
Andreas Seltenreich wrote:
> I fixed this in the Gnus repository. I'll leave this bug open till it
> is merged into Emacs.
I suggest that in future you just close things when they are fixed in
Gnus. It is frequently merged to Emacs, and it seems more likely that
a bug will get left open by mistake.
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (7 preceding siblings ...)
2010-05-13 19:20 ` bug#5284: 23.1; gnus-summary-expire-thread does not work Glenn Morris
@ 2010-05-24 19:53 ` Thierry Volpiatto
2010-05-25 15:49 ` Juri Linkov
2010-06-30 20:35 ` bug#5281: 23.1; xml-parse-region causes infinite loops if the region is not well-formed XML Chong Yidong
9 siblings, 1 reply; 32+ messages in thread
From: Thierry Volpiatto @ 2010-05-24 19:53 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5270
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
> Each time you hit C-t t, it show or hide thumbs.
> Thierry, could you please send the latest version of your patch here
> to 5270@debbugs.gnu.org? It seems a good change to install to Emacs.
changeset: 108790:edb0d0e61eb8
tag: qtip
tag: patch-r108790
tag: tip
tag: qbase
user: Thierry Volpiatto <thierry.volpiatto@gmail.com>
date: Mon May 24 21:40:52 2010 +0200
summary: * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 108790.patch --]
[-- Type: text/x-patch, Size: 2957 bytes --]
# HG changeset patch
# User Thierry Volpiatto <thierry.volpiatto@gmail.com>
# Date 1274730052 -7200
# Node ID edb0d0e61eb8dcd4d0123a86da15019e21f20d27
# Parent bb924695adbf1ee08fc983ca83ff1ad3fb4c7c67
* lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -632,26 +632,31 @@
(call-process shell-file-name nil nil nil shell-command-switch command)))
;;;###autoload
-(defun image-dired-dired-insert-marked-thumbs ()
- "Insert thumbnails before file names of marked files in the dired buffer."
- (interactive)
+(defun image-dired-dired-insert-marked-thumbs (arg)
+ "Insert or hide thumbnails before file names of marked files in the dired buffer.
+With numeric prefix arg, insert or hide thumbnails on ARG next/prec files depending ARG\
+is positive or negative."
+ (interactive "p")
+ (when (eq arg 1) (setq arg nil)) ; No prefix arg.
(dired-map-over-marks
- (let* ((image-pos (dired-move-to-filename))
- (image-file (dired-get-filename))
- (thumb-file (image-dired-get-thumbnail-image image-file))
+ (let* ((image-pos (dired-move-to-filename))
+ (image-file (dired-get-filename 'no-dir t))
+ thumb-file
overlay)
- ;; If image is not already added, then add it.
- (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image))
- ;; Can't use (overlays-at (point)), BUG?
- (overlays-in (point) (1+ (point)))))
- (put-image thumb-file image-pos)
- (setq
- overlay
- (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o))
- (overlays-in (point) (1+ (point)))))))
- (overlay-put overlay 'image-file image-file)
- (overlay-put overlay 'thumb-file thumb-file)))
- nil)
+ (when (and image-file (string-match-p (image-file-name-regexp) image-file))
+ (setq thumb-file (image-dired-get-thumbnail-image image-file))
+ ;; If image is not already added, then add it.
+ (let ((cur-ov (overlays-in (point) (1+ (point)))))
+ (if cur-ov
+ (delete-overlay (car cur-ov))
+ (put-image thumb-file image-pos)
+ (setq overlay (loop for o in (overlays-in (point) (1+ (point)))
+ when (overlay-get o 'put-image) collect o into ov
+ finally return (car ov)))
+ (overlay-put overlay 'image-file image-file)
+ (overlay-put overlay 'thumb-file thumb-file)))))
+ arg ; Show or hide image on ARG next files.
+ 'show-progress) ; Update dired display after each image is updated.
(add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t))
(defun image-dired-dired-after-readin-hook ()
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
2010-05-24 19:53 ` bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer Thierry Volpiatto
@ 2010-05-25 15:49 ` Juri Linkov
2010-05-25 16:59 ` Thierry Volpiatto
0 siblings, 1 reply; 32+ messages in thread
From: Juri Linkov @ 2010-05-25 15:49 UTC (permalink / raw)
To: Thierry Volpiatto; +Cc: 5270
>> Thierry, could you please send the latest version of your patch here
>> to 5270@debbugs.gnu.org? It seems a good change to install to Emacs.
>
> changeset: 108790:edb0d0e61eb8
> tag: qtip
> tag: patch-r108790
> tag: tip
> tag: qbase
> user: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> date: Mon May 24 21:40:52 2010 +0200
> summary: * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs)
> Insert thumbnails before file names of marked files in the dired buffer.
Thanks. I think your patch should be committed now with two small changes:
1. To make it compatible with other Dired commands, use the interactive
spec (interactive "P") instead of (interactive "p").
And also remove the line `(when (eq arg 1) (setq arg nil))' because
`dired-map-over-marks' already takes care of the prefix argument.
2. Create a new function `image-dired-dired-toggle-marked-thumbs'
from your changes and re-bind it to "\C-t\C-t" in dired.el
because this is a better name for changed functionality.
The current function `image-dired-dired-insert-marked-thumbs'
could be obsoleted later.
I tried your patch with these small changes, and it is much better
than the current `image-dired-dired-insert-marked-thumbs'.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
2010-05-25 15:49 ` Juri Linkov
@ 2010-05-25 16:59 ` Thierry Volpiatto
2010-05-25 17:46 ` Juri Linkov
0 siblings, 1 reply; 32+ messages in thread
From: Thierry Volpiatto @ 2010-05-25 16:59 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5270
Juri Linkov <juri@jurta.org> writes:
>>> Thierry, could you please send the latest version of your patch here
>>> to 5270@debbugs.gnu.org? It seems a good change to install to Emacs.
>>
>> changeset: 108790:edb0d0e61eb8
>> tag: qtip
>> tag: patch-r108790
>> tag: tip
>> tag: qbase
>> user: Thierry Volpiatto <thierry.volpiatto@gmail.com>
>> date: Mon May 24 21:40:52 2010 +0200
>> summary: * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs)
>> Insert thumbnails before file names of marked files in the dired buffer.
>
> Thanks. I think your patch should be committed now with two small changes:
>
> 1. To make it compatible with other Dired commands, use the interactive
> spec (interactive "P") instead of (interactive "p").
> And also remove the line `(when (eq arg 1) (setq arg nil))' because
> `dired-map-over-marks' already takes care of the prefix argument.
Agree, that's better.
> 2. Create a new function `image-dired-dired-toggle-marked-thumbs'
> from your changes and re-bind it to "\C-t\C-t" in dired.el
> because this is a better name for changed functionality.
> The current function `image-dired-dired-insert-marked-thumbs'
> could be obsoleted later.
Yes we already talk about using "toggle" as name and i completely forget
that, so yes it is better to rename to
`image-dired-dired-toggle-marked-thumbs'.
I think also the old function can safely be removed.
> I tried your patch with these small changes, and it is much better
> than the current `image-dired-dired-insert-marked-thumbs'.
Thanks, feel free also to write docstring in better english if something
is incorrect.(E.g Explaining better how to use (+/-)prefix arg maybe).
--
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
2010-05-25 16:59 ` Thierry Volpiatto
@ 2010-05-25 17:46 ` Juri Linkov
0 siblings, 0 replies; 32+ messages in thread
From: Juri Linkov @ 2010-05-25 17:46 UTC (permalink / raw)
To: Thierry Volpiatto; +Cc: 5270-done
> Yes we already talk about using "toggle" as name and i completely forget
> that, so yes it is better to rename to
> `image-dired-dired-toggle-marked-thumbs'.
Thanks for the patch, it's now committed.
> feel free also to write docstring in better english if something
> is incorrect.(E.g Explaining better how to use (+/-)prefix arg maybe).
I copied part of the docstring from `dired-map-over-marks' :)
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 32+ messages in thread
* bug#5281: 23.1; xml-parse-region causes infinite loops if the region is not well-formed XML
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
` (8 preceding siblings ...)
2010-05-24 19:53 ` bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer Thierry Volpiatto
@ 2010-06-30 20:35 ` Chong Yidong
9 siblings, 0 replies; 32+ messages in thread
From: Chong Yidong @ 2010-06-30 20:35 UTC (permalink / raw)
To: Yuto Hayamizu; +Cc: 5281-done
> Following code causes infinite loop:
>
> (with-temp-buffer
> (insert "foo</bar>")
> (xml-parse-region (point-min) (point-max)))
Thanks, I've checked in a fix.
^ permalink raw reply [flat|nested] 32+ messages in thread