From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.bugs Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. Date: Thu, 18 Jun 2015 13:52:21 +0200 Message-ID: <5582B0F5.30303@members.fsf.org> References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1434640832 18071 80.91.229.3 (18 Jun 2015 15:20:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Jun 2015 15:20:32 +0000 (UTC) Cc: 20832@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 18 17:20:25 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z5bc3-0006Or-Ci for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Jun 2015 17:20:19 +0200 Original-Received: from localhost ([::1]:53276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5bc2-0003ui-Nd for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Jun 2015 11:20:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5bbv-0003ua-I7 for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2015 11:20:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5bbo-0006uA-LU for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2015 11:20:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5bbo-0006tk-Ie for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2015 11:20:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z5bbn-0004jy-SI for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2015 11:20:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jun 2015 15:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20832 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.143464074818135 (code B ref 20832); Thu, 18 Jun 2015 15:20:03 +0000 Original-Received: (at 20832) by debbugs.gnu.org; 18 Jun 2015 15:19:08 +0000 Original-Received: from localhost ([127.0.0.1]:50938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5bas-0004iO-JI for submit@debbugs.gnu.org; Thu, 18 Jun 2015 11:19:07 -0400 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:29264) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5YMv-0007bq-AV for 20832@debbugs.gnu.org; Thu, 18 Jun 2015 07:52:30 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUBAMOvglWkD4Xx/2dsb2JhbAANT4RDxVoCggEBAQEBAQGFLQEBAQMBMgFGBQsLGAklDwJGBg0BBQIBAYgjrhSXNAEBAQEBAQQBAQEBAQEBG4tFhBpsB4QrAQSGeIYvhkmMfoZljDCDW4IxHIFUbYEDBIFBAQEB Original-Received: from mathsrv4.ulb.ac.be (HELO [172.19.79.241]) ([164.15.133.241]) by smtp.ulb.ac.be with ESMTP; 18 Jun 2015 13:52:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <87fv5pcogr.fsf@gmx.net> X-TagToolbar-Keys: D20150618135221391 X-Mailman-Approved-At: Thu, 18 Jun 2015 11:19:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104092 Archived-At: Le 18/06/2015 12:15, Stephen Berman a écrit : > On Wed, 17 Jun 2015 07:39:59 +0200 Nicolas Richard wrote: > >> 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. > > Thanks for the report. I can reproduce something that seems like what > you describe; here's the recipe: I'm very impressed you managed to find a recipe ! > 0. emacs -Q > M-x global-set-key RET C-c t RET todo-show RET > 1. Type `M-x' to enter the minibuffer. ISTR I was indeed in a M-x prompt when it happened. > 2. If I now try to call todo-show by again typing `M-x', it fails with > the error "Command attempted to use minibuffer while in > minibuffer". I have enable-recursive-minibuffers set to t, so I did not get this error. > However, todo-show does not require minibuffer input, so when I type > `C-c t' it succeeds and displays the current todo category in the > minibuffer. > 3. Now I cannot exit the minibuffer by typing `C-g', no matter how many > times. However, `ESC ESC ESC' (keyboard-escape-quit) does exit the > minibuffer (by calling abort-recursive-edit), I don't remember having to hit ESC ESC ESC, but my fingers know how to hit C-] (abort-recursive-edit) so perhaps I did that. No idea. Oh, but I now realize that I also have modified the binding of C-g to call abort-recursive-edit in some conditions : (defun yf/keyboard-exit () "Throw an `exit' symbol" ;; modified from keyboard-quit (interactive) (cond ((region-active-p) (let (select-active-regions) (setq saved-region-selection nil) ; Avoid adding the region ; to the window ; selection. (deactivate-mark))) (defining-kbd-macro (kmacro-keyboard-quit) (setq defining-kbd-macro nil) (message "Macro cancelled")) (t (let ((debug-on-quit nil)) (if (> (recursion-depth) 0) (abort-recursive-edit) (user-error "Nothing to cancel.")))))) > Can you remember if this is what happened to you? Well, it certainly looks like it. > Note that even after > the todo file is overwritten or deleted in step 5, you can still recover > the deleted buffer contents as explained in step 4. I tend to kill buffers blindly when I know I did not modify them on purpose, so that's probably what caused the content loss. I had a backup though, and didn't lose much data. > But if there are other > triggers, then your patch may be needed. However, since I haven't found > any other way to make the problem you encountered occur, I'm inclined to > install just the patch below; that way, if there is some other way to > get an empty but modified todo-mode buffer, we may find it and be able > to fix the underlying cause. Throwing an error seemed like a good way to find such problems, to me, better so than silently deleting the file. > What do you think? > > Incidentally, if `q' (todo-quit) is typed between steps 2 and 3 above, > then the minibuffer becomes occupied by whatever other-buffer returns, > and then typing `ESC ESC ESC' will result in that buffer being erased. This is bad :'( It seems one should not change the buffer in a minibuffer window. Perhaps it would be good if this was documented in the docstring of set-window-buffer. > So this is another reason to make sure todo-mode stays out of the > minibuffer. Yup. > The following patch makes todo-show display the todo file in the > previous window when invoked in the minibuffer. An alternative would be > to simply error out when invoking todo-show in the minibuffer. But I > think it could be useful to display the todo file while in the > minibuffer. Do you see a problem with this? I don't see a need for (with-selected-window), but it looks ok ! Many thanks for digging into this. Nicolas.