emacs-devel
[Top][All Lists]
Advanced

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

todo-mode: saving widens buffer (again)


From: Stephen Berman
Subject: todo-mode: saving widens buffer (again)
Date: Mon, 22 Jul 2002 13:38:34 +0200
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i686-pc-linux-gnu)

A change in the development version of todo-mode.el seems to have
reintroduced a bug that Daniel Ortmann reported in gnu.emacs.bug on 27
Oct 2001:

> Pressing "s" for save in "todo-mode" mistakenly widens the buffer.  It
> should not widen.

On 12 Nov 2001 I offered the following fix:

cut==========================================================
--- todo-mode-1.34.el   Thu Jun 14 23:20:01 2001
+++ todo-mode-1.34-srb0.el      Sat Nov 10 21:05:50 2001
@@ -708,9 +708,11 @@
 
 (defun todo-save () "Save the TODO list."
   (interactive)
-  (save-buffer)
-  (if todo-save-top-priorities-too (todo-save-top-priorities))
-  )
+  (save-excursion
+    (save-restriction
+      (save-buffer)
+      (if todo-save-top-priorities-too (todo-save-top-priorities))
+      )))
 (defalias 'todo-cmd-save 'todo-save)
 
 (defun todo-quit () "Done with TODO list for now."
cut==========================================================

(My patch was against the version of todo-mode I was using at the
time, but it was also valid for the version included in Emacs 21.1.1,
for which the bug had been reported.)

This fix was incorporated into Emacs 21.2.1 (todo-mode.el,v 1.47.4.1)
but in the current development version (todo-mode.el,v 1.50), it has
been changed as follows:

(defun todo-save ()
  "Save the TODO list."
  (interactive)
  (save-excursion
    (save-restriction
      (save-buffer)))
  (if todo-save-top-priorities-too (todo-save-top-priorities)))

I used this version of todo-save for some time with no problems, also
in conjunction with extensive changes I have made to todo-mode
(submitted to bug-gnu-emacs on 29 May 2002), but recently, I have
repeatedly experienced that invoking it widens the buffer again.  This
behavior has been inconsistent and I am not certain what is causing it
-- it may be related to my other changes, although these did not
include further changes to todo-save, nor any changes to
todo-save-top-priorities; but I don't have time for more extensive
testing at present.  I don't know why the placement of the `if' form
in todo-save was changed in the development tree, but it appears that
putting the `if' form back inside save-restriction reliably prevents
this widening, and I haven't noticed any unwelcome effects of doing
so.  Therefore, I suggest reverting to v1.47.4.1 to avoid this
problem.  When I have a chance, I'll try to investigate this further;
in the mean time, if anyone can -- or fails to -- corroborate my
experience by using v1.50, with or without my extensions to todo-mode,
I'd appreciate hearing about it.

(If anyone responds to this and wants a more or less quick response
from me, please CC: my email address, as I am not able to regularly
follow the list.)

--Steve Berman



reply via email to

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