unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nicolas Richard <youngfrog@members.fsf.org>
To: 20832@debbugs.gnu.org
Cc: Stephen Berman <stephen.berman@gmx.net>
Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file.
Date: Wed, 17 Jun 2015 07:39:59 +0200	[thread overview]
Message-ID: <86h9q67v0w.fsf@members.fsf.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

I managed to lose my todo-mode.el todo file. I don't really know how
this happened, I guess it was a combination of showing the todo file
while in the minibuffer and hitting C-g, but I noticed it too late, and
then could not reproduce.

In any case, I suspect that todo-mode.el itself deleted it, so I suggest
the following patch as a safety measure.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-todo-show-Throw-an-error-if-buffer-is-empty-but-was-.patch --]
[-- Type: text/x-diff, Size: 1008 bytes --]

From 9088fc5037f587eab00c083d703b0a8cbf3eaf31 Mon Sep 17 00:00:00 2001
From: Nicolas Richard <youngfrog@members.fsf.org>
Date: Thu, 28 May 2015 08:57:45 +0200
Subject: [PATCH] (todo-show): Throw an error if buffer is empty but was
 modified.

* lisp/calendar/todo-mode.el (todo-show): Throw an error if buffer
is empty but was modified.
---
 lisp/calendar/todo-mode.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 7369ec2..85d4a80 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -743,6 +743,8 @@ corresponding todo file, displaying the corresponding category."
 	    (setq todo-category-number (todo-category-number cat)))
 	  ;; If this is a new todo file, add its first category.
 	  (when (zerop (buffer-size))
+            (when (buffer-modified-p)
+              (error "Buffer is empty but modified. Aborting."))
 	    (let (cat-added)
 	      (unwind-protect
 		  (setq todo-category-number
-- 
1.9.1


             reply	other threads:[~2015-06-17  5:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17  5:39 Nicolas Richard [this message]
2015-06-18 10:15 ` bug#20832: 25.0.50; todo-show accidentally deleted my todo file Stephen Berman
2015-06-18 11:52   ` Nicolas Richard
2015-06-19  6:43     ` martin rudalics
2015-06-19 15:15       ` Stephen Berman
2015-06-19 15:39         ` martin rudalics
2015-06-19 15:14     ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h9q67v0w.fsf@members.fsf.org \
    --to=youngfrog@members.fsf.org \
    --cc=20832@debbugs.gnu.org \
    --cc=stephen.berman@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).