From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: stephen.berman@gmx.net, bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jun 2015 05:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20832 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20832@debbugs.gnu.org Cc: Stephen Berman X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stephen Berman Received: via spool by submit@debbugs.gnu.org id=B.14345196175645 (code B ref -1); Wed, 17 Jun 2015 05:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jun 2015 05:40:17 +0000 Received: from localhost ([127.0.0.1]:56655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z565A-0001Sy-8a for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53071) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5657-0001Sk-D7 for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5651-0001KH-3C for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5651-0001Jx-0J for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5650-0006xl-1i for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z564w-000175-Kz for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:05 -0400 Received: from mailrelay117.isp.belgacom.be ([195.238.20.144]:2541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z564w-00014a-FF for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:02 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=i+EX5EtM4g4P/CrLY+sx2nOWHsqv9AlVwqc0uudqMuE= c=1 sm=2 a=a4K5GIyuExAA:10 a=lgNhd9etYEQfkcBSdT4A:9 a=vra_jNDFDNMA:10 a=86V_V5k7l9AA:10 a=inoG4m36AAAA:8 a=fqMwCoEW1dn31Z51eFwA:9 a=Hx9jo1uvoVcoaHvx:21 a=F9uH7bqjTOm-o-HH:21 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AwEgBZB4FV/3mR9lFbgxCBM6wJBQEBAQEBAQUBBX+YboFPPRABAQEBAQEBgQpBBYNcAQJaOxQDAQIKNAEEJRYhiDMBp0amVIYaih8uhBcFk1+jXSaDezwxgkcBAQE Received: from 121.145-246-81.adsl-dyn.isp.belgacom.be (HELO Aurora) ([81.246.145.121]) by relay.skynet.be with ESMTP; 17 Jun 2015 07:39:59 +0200 From: Nicolas Richard Date: Wed, 17 Jun 2015 07:39:59 +0200 Message-ID: <86h9q67v0w.fsf@members.fsf.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-todo-show-Throw-an-error-if-buffer-is-empty-but-was-.patch >From 9088fc5037f587eab00c083d703b0a8cbf3eaf31 Mon Sep 17 00:00:00 2001 From: Nicolas Richard 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 --=-=-=-- From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. In-Reply-To: <86h9q67v0w.fsf@members.fsf.org> Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jun 2015 10:16:02 +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: To: Nicolas Richard Cc: 20832@debbugs.gnu.org Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.143462251613649 (code B ref 20832); Thu, 18 Jun 2015 10:16:02 +0000 Received: (at 20832) by debbugs.gnu.org; 18 Jun 2015 10:15:16 +0000 Received: from localhost ([127.0.0.1]:50396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5Wqn-0003Y2-G4 for submit@debbugs.gnu.org; Thu, 18 Jun 2015 06:15:15 -0400 Received: from mout.gmx.net ([212.227.17.21]:57922) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5Wqj-0003XU-KK for 20832@debbugs.gnu.org; Thu, 18 Jun 2015 06:15:11 -0400 Received: from rosalinde ([89.245.118.5]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LbA4j-1YhUlD2UgL-00kht2; Thu, 18 Jun 2015 12:15:02 +0200 From: Stephen Berman References: <86h9q67v0w.fsf@members.fsf.org> Date: Thu, 18 Jun 2015 12:15:00 +0200 Message-ID: <87fv5pcogr.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:TD8rnvXxLJllW6+HiBFWhP+0a8YrQNj4L2KzRKSpXkznRPv3cOX wq+1v2JCaMIOkPfA9TIqHGQW2f5MUUYIRJpk6yjDMLM2HJ5lyex/rZdUXtrx8LpYWvfOhrG 3Ciy0rSucr212h67+gZcIIszfdH8fxE7TZMa7MlAEUrM0JPnxJgRVjFxbUinpde1WV27+7h xV/wn+1ZJP+0aMAnh3S0w== X-UI-Out-Filterresults: notjunk:1;V01:K0:l+YSnj4DnQ0=:F1llxCixvuwQfYnYt4r4vL ZptWvsqFer5ldQhyQ8v/+UpY+e+Zqb3iZN9ekXeHb9gZckyiPSIyDPxtXofteNVxWesCS6EkM BPNsSQvEJdMlStMwrZ8rHfyJUOLj06ktDzbiWsSY7mfPi7DfL+xP1MxeiQBdVsPLvjrBnmivB OByGwpHVa3vJ310mUolmA3QeFv/f7PQWjWXNSYV78gpO+5eops3vMboLQbQva1oQm0xbKEfd4 9/6D/Zjg57cV3GUzayDGrTp+m6LFYlo/oN9os38fE5Nyd2zxzEzH5cXeidziP8nVSZ1iQW+G8 rHKyZt0SvrGshebcLOdKtvksQAuK38LGNsWC1lL2WGo8AVUBabRssXtGJ72cqpDbsl49alDeg EzDnbYOw8rsUfXkxQ3blb8lr9/0YnfvCJ7Wl2/SFRt+Y+RfpisEz8FIV4kAxdk6rE+6IxYKCZ Gi+euGWjD11fTtSZF/56XeMDsoLhP4VQdUQhpt4R+3JSoSkBBNU3DYSR1DPw9DmGRhb3MCg9H J7V+sbAroJa0hzLSWw4NZp22/OKXSR6iwLSfi0z3FhRiAsoGve5tJAiFxLNJtq+qiHIjKx0pE mU+Vhup6GUybmq/Qa1JcYwJKMhyf/iScYrRBEqtGXw3P5MVLskn3IyHKrfwNDi8vWdwI8Ozc7 SK/TXZmRefHw6MvR5H2L6Mq2f1gqRYJdGO4iXUwUenH6kQwt+00+uq4KMeBLBdcO18YY= X-Spam-Score: -0.6 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) 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: 0. emacs -Q M-x global-set-key RET C-c t RET todo-show RET 1. Type `M-x' to enter the minibuffer. 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". 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), and switching to the buffer that was visiting the todo file, it is indeed modified and empty (it just displays the overlays of the item numbers) and no longer in todo-mode but instead minibuffer-inactive-mode. (I think this is due to read_minibuf_unwind in minibuf.c, which "is called on exiting minibuffer, whether normally or not" and deliberately erases the minibuffer (but I could not find a call-chain from Fabort_recursive_edit to read_minibuf_unwind).) 4. Although the former todo-mode buffer is empty, the todo file is not, so killing the buffer leaves the file unchanged. In addition, by typing `C-x C-q' to make the buffer writeable, you can undo the deletion and restore the buffer contents. 5. However, invoking todo-show in the empty former todo-mode buffer is fatal: it prompts for a Todo category, and supplying one overwrites the todo file, while canceling with `C-g' deletes the file (needed when invoking todo-add-file and canceling before adding the first category, in order to avoid having a todo file with an illegitimate format). Can you remember if this is what happened to you? 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. > In any case, I suspect that todo-mode.el itself deleted it, so I suggest > the following patch as a safety measure. This seems reasonable as a safeguard, but I wonder whether there are other circumstances where it is needed. If the above recipe is the only trigger, then I think it should be avoided by prohibiting entering todo-mode in the minibuffer (patch below), which would make the safeguard superfluous for the above recipe. 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. 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. So this is another reason to make sure todo-mode stays out of the minibuffer. 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? Steve Berman diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index dcc960f..3b8d8ab 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -732,42 +732,44 @@ corresponding todo file, displaying the corresponding category." (when (or (member file todo-visited) (eq todo-show-first 'first)) (unless (todo-check-file file) (throw 'end nil)) - (set-window-buffer (selected-window) - (set-buffer (find-file-noselect file 'nowarn))) - (if (equal (file-name-extension (buffer-file-name)) "toda") - (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode)) - (unless (derived-mode-p 'todo-mode) (todo-mode))) - ;; When quitting an archive file, show the corresponding - ;; category in the corresponding todo file, if it exists. - (when (assoc cat todo-categories) - (setq todo-category-number (todo-category-number cat))) - ;; If this is a new todo file, add its first category. - (when (zerop (buffer-size)) - (let (cat-added) - (unwind-protect - (setq todo-category-number - (todo-add-category todo-current-todo-file "") - add-item todo-add-item-if-new-category - cat-added t) - (if cat-added - ;; If the category was added, save the file now, so we - ;; don't risk having an empty todo file, which would - ;; signal an error if we tried to visit it later, - ;; since doing that looks for category boundaries. - (save-buffer 0) - ;; If user cancels before adding the category, clean up - ;; and exit, so we have a fresh slate the next time. - (delete-file file) - ;; (setq todo-files (funcall todo-files-function)) - (setq todo-files (delete file todo-files)) - (when first-file - (setq todo-default-todo-file nil - todo-current-todo-file nil) - (todo-reevaluate-default-file-defcustom)) - (kill-buffer) - (keyboard-quit))))) - (save-excursion (todo-category-select)) - (when add-item (todo-insert-item--basic))) + (with-selected-window (if (minibufferp) (previous-window) + (selected-window)) + (set-window-buffer (selected-window) + (set-buffer (find-file-noselect file 'nowarn))) + (if (equal (file-name-extension (buffer-file-name)) "toda") + (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode)) + (unless (derived-mode-p 'todo-mode) (todo-mode))) + ;; When quitting an archive file, show the corresponding + ;; category in the corresponding todo file, if it exists. + (when (assoc cat todo-categories) + (setq todo-category-number (todo-category-number cat))) + ;; If this is a new todo file, add its first category. + (when (zerop (buffer-size)) + (let (cat-added) + (unwind-protect + (setq todo-category-number + (todo-add-category todo-current-todo-file "") + add-item todo-add-item-if-new-category + cat-added t) + (if cat-added + ;; If the category was added, save the file now, so we + ;; don't risk having an empty todo file, which would + ;; signal an error if we tried to visit it later, + ;; since doing that looks for category boundaries. + (save-buffer 0) + ;; If user cancels before adding the category, clean up + ;; and exit, so we have a fresh slate the next time. + (delete-file file) + ;; (setq todo-files (funcall todo-files-function)) + (setq todo-files (delete file todo-files)) + (when first-file + (setq todo-default-todo-file nil + todo-current-todo-file nil) + (todo-reevaluate-default-file-defcustom)) + (kill-buffer) + (keyboard-quit))))) + (save-excursion (todo-category-select)) + (when add-item (todo-insert-item--basic)))) (setq todo-show-first show-first) (add-to-list 'todo-visited file))))) From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. 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: To: Stephen Berman Cc: 20832@debbugs.gnu.org Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.143464074818135 (code B ref 20832); Thu, 18 Jun 2015 15:20:03 +0000 Received: (at 20832) by debbugs.gnu.org; 18 Jun 2015 15:19:08 +0000 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 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 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 Message-ID: <5582B0F5.30303@members.fsf.org> Date: Thu, 18 Jun 2015 13:52:21 +0200 From: Nicolas Richard User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> In-Reply-To: <87fv5pcogr.fsf@gmx.net> X-TagToolbar-Keys: D20150618135221391 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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. From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jun 2015 06:45:04 +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: To: Nicolas Richard , Stephen Berman Cc: 20832@debbugs.gnu.org Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.14346962558479 (code B ref 20832); Fri, 19 Jun 2015 06:45:04 +0000 Received: (at 20832) by debbugs.gnu.org; 19 Jun 2015 06:44:15 +0000 Received: from localhost ([127.0.0.1]:51564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5q2A-0002Ch-Vg for submit@debbugs.gnu.org; Fri, 19 Jun 2015 02:44:15 -0400 Received: from mout.gmx.net ([212.227.15.19]:61237) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5q1y-0002Bg-6M for 20832@debbugs.gnu.org; Fri, 19 Jun 2015 02:44:11 -0400 Received: from [93.82.78.60] ([93.82.78.60]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0MVNDK-1ZdOfi1gvG-00Yg3n; Fri, 19 Jun 2015 08:43:56 +0200 Message-ID: <5583BA26.10709@gmx.at> Date: Fri, 19 Jun 2015 08:43:50 +0200 From: martin rudalics MIME-Version: 1.0 References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> <5582B0F5.30303@members.fsf.org> In-Reply-To: <5582B0F5.30303@members.fsf.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:9HqXuuDDbOAJsaL4sRJSBExChTMxuqufMeMEkgRski2WJRGG8nf ujvfP3xYNMl2Tg38D+yldE6vG4bYajbfB+SJDlsW90irUgadTLSsOuZuBXXH2a7alZXYNSb p1ceyvx0rlmfisjS0vAOwUEOIq3dA1pLq7mTFsN8PGN+4gE6DOa+offBnM5qOxv/8qhGwUL nBM5G1bQJAsOvR0RjtQmg== X-UI-Out-Filterresults: notjunk:1;V01:K0:uOyd2GqaaZo=:Lg7U3vz/IZ6rA09nxZQs38 DLL2kHfwaLqVHIQnWtlEbuToh/nMlpEfc5FGJ9dMlHqwD7x5UuGgWDk5QsICfKvG754eb9Wkm FJLQjVxMt6BsNKECBE2mv66Ml9yYQ7id9n5cFCwKP1KNedHgqNKBkKwFWSl55DxV8N6LIeTmA qgPbKjr77wPQ+JAYqIOLBONJN9UhNJAnb3VQW0uJ3v/2gQ2i8pRH2eBGeHFzTSMSuX/an78G5 h3gp6+cJDMm7SnMHtQz3E1+saDPYbwTchDCYmLzoqjBpbb+xrunHLVu9BuM2UefuTeR12RP3F lGqerDyQQ29NPeQorFOqn5BDCampBzRAXrpXes9NlMpkYFYuD1ZQb7diaydFnwPC0MrQ3xxyy au7LXXZ3HukuOWhoakZnbzzw2pl9CbFkkQ4EsCs9lJVTCQeGVPXpwkhRGcMGXBQ9v1PNtbFo/ zztmdGk3vx7zG33p846AIU2Co7PcxRB0TxJm7fN5tHnrbuRMi79mGNuTLPfjJ2pfbovt+I7Te MWTR+R0/18f0xjcAdNYqrM/T3V1wXP2mm2d34S9Qql2vw4MSA2sWVJr9bn+eaDikAYLDtulM6 H8NDiG3TJjQF3CBi3LX5hx08TNVxvYBRS2qVLvkjtPdDzYHJdP3uOmooOdM3FkZ6N+PXgs9aq MBtOZUAMQ+SQ2VRphdHmfvo627fQLRmprb8zR6IsXDzDzds0ciRXyhhi7jaVI53JRcE4= X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > This is bad :'( It seems one should not change the buffer in a minibuf= fer > window. Perhaps it would be good if this was documented in > the docstring of set-window-buffer. You should use =91set-window-buffer=92 in application programs only if yo= u know what you're doing. From the Elisp manual: When writing an application, you should normally use the higher-level functions described in *Note Switching Buffers::, instead of calling `set-window-buffer' directly. While the minibuffer window is selected, =91minibuffer-selected-window=92= can be used to get the previously selected window. martin From unknown Thu Aug 21 12:11:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Nicolas Richard Subject: bug#20832: closed (Re: bug#20832: 25.0.50; todo-show accidentally deleted my todo file.) Message-ID: References: <87fv5nivc8.fsf@gmx.net> <86h9q67v0w.fsf@members.fsf.org> X-Gnu-PR-Message: they-closed 20832 X-Gnu-PR-Package: emacs Reply-To: 20832@debbugs.gnu.org Date: Fri, 19 Jun 2015 15:15:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1434726903-29264-1" This is a multi-part message in MIME format... ------------=_1434726903-29264-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20832: 25.0.50; todo-show accidentally deleted my todo file. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20832@debbugs.gnu.org. --=20 20832: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20832 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1434726903-29264-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20832-done) by debbugs.gnu.org; 19 Jun 2015 15:14:48 +0000 Received: from localhost ([127.0.0.1]:52090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5y0F-0007bP-PC for submit@debbugs.gnu.org; Fri, 19 Jun 2015 11:14:48 -0400 Received: from mout.gmx.net ([212.227.17.20]:59330) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5y0D-0007bB-Ge for 20832-done@debbugs.gnu.org; Fri, 19 Jun 2015 11:14:46 -0400 Received: from rosalinde ([89.245.121.189]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MMkgl-1ZCHv52aZb-008Xv9; Fri, 19 Jun 2015 17:14:32 +0200 From: Stephen Berman To: Nicolas Richard Subject: Re: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> <5582B0F5.30303@members.fsf.org> Date: Fri, 19 Jun 2015 17:14:31 +0200 Message-ID: <87fv5nivc8.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:uGhzWVvBc/SraRRDoUjKwAMzDUjYWrVJX8mIOGgZtgMt5rdbMRq yP1WF6rwda/M/RA3cWcgVeK3zF2NoF2ooYKg9QnueZlUzY+p6PQPKHYXqKGe8yiDlaklpQs KxhaZ+M1r2uFIV3zly47rnWCUuIbQF2YYQj/bGpZLXGlln51kziD3yMZSGsbjNEK8YdOX4m hZcgEZMlWcpGU4PzL7EGw== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 20832-done Cc: 20832-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) On Thu, 18 Jun 2015 13:52:21 +0200 Nicolas Richard wrote: > Le 18/06/2015 12:15, Stephen Berman a =C3=A9crit : >> 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. That's true, I guess it's better to be safe than sorry. >> 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) You're right, it's unnecessary; thanks for noticing. (I had first tried to fix it without that macro and on testing it changed the selected window from the minibuffer to the todo-mode buffer, so that's why I thought I needed with-selected-window, but I must have used different functions, I can't remember anymore.) I installed both patches in separate commits to keep the author credits clear (with a slightly tweaked error message in your patch) and am closing this bug. Thanks again. Steve Berman ------------=_1434726903-29264-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 Jun 2015 05:40:17 +0000 Received: from localhost ([127.0.0.1]:56655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z565A-0001Sy-8a for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53071) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5657-0001Sk-D7 for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5651-0001KH-3C for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5651-0001Jx-0J for submit@debbugs.gnu.org; Wed, 17 Jun 2015 01:40:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5650-0006xl-1i for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z564w-000175-Kz for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:05 -0400 Received: from mailrelay117.isp.belgacom.be ([195.238.20.144]:2541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z564w-00014a-FF for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 01:40:02 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=i+EX5EtM4g4P/CrLY+sx2nOWHsqv9AlVwqc0uudqMuE= c=1 sm=2 a=a4K5GIyuExAA:10 a=lgNhd9etYEQfkcBSdT4A:9 a=vra_jNDFDNMA:10 a=86V_V5k7l9AA:10 a=inoG4m36AAAA:8 a=fqMwCoEW1dn31Z51eFwA:9 a=Hx9jo1uvoVcoaHvx:21 a=F9uH7bqjTOm-o-HH:21 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AwEgBZB4FV/3mR9lFbgxCBM6wJBQEBAQEBAQUBBX+YboFPPRABAQEBAQEBgQpBBYNcAQJaOxQDAQIKNAEEJRYhiDMBp0amVIYaih8uhBcFk1+jXSaDezwxgkcBAQE Received: from 121.145-246-81.adsl-dyn.isp.belgacom.be (HELO Aurora) ([81.246.145.121]) by relay.skynet.be with ESMTP; 17 Jun 2015 07:39:59 +0200 From: Nicolas Richard To: bug-gnu-emacs@gnu.org Subject: 25.0.50; todo-show accidentally deleted my todo file. X-Debbugs-CC: Stephen Berman Date: Wed, 17 Jun 2015 07:39:59 +0200 Message-ID: <86h9q67v0w.fsf@members.fsf.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-todo-show-Throw-an-error-if-buffer-is-empty-but-was-.patch >From 9088fc5037f587eab00c083d703b0a8cbf3eaf31 Mon Sep 17 00:00:00 2001 From: Nicolas Richard 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 --=-=-=-- ------------=_1434726903-29264-1-- From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jun 2015 15:16:02 +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: To: martin rudalics Cc: Nicolas Richard , 20832@debbugs.gnu.org Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.143472694629379 (code B ref 20832); Fri, 19 Jun 2015 15:16:02 +0000 Received: (at 20832) by debbugs.gnu.org; 19 Jun 2015 15:15:46 +0000 Received: from localhost ([127.0.0.1]:52100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5y1B-0007dl-Ly for submit@debbugs.gnu.org; Fri, 19 Jun 2015 11:15:46 -0400 Received: from mout.gmx.net ([212.227.17.22]:62046) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5y1A-0007dX-0S for 20832@debbugs.gnu.org; Fri, 19 Jun 2015 11:15:44 -0400 Received: from rosalinde ([89.245.121.189]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LiY3U-1YY1J73HtE-00cliU; Fri, 19 Jun 2015 17:15:37 +0200 From: Stephen Berman References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> <5582B0F5.30303@members.fsf.org> <5583BA26.10709@gmx.at> Date: Fri, 19 Jun 2015 17:15:36 +0200 In-Reply-To: <5583BA26.10709@gmx.at> (martin rudalics's message of "Fri, 19 Jun 2015 08:43:50 +0200") Message-ID: <87egl7ivaf.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:PAUAzTmnSX8L7sRKMSZK4jMc+qwJQJuhXuNHQR5Tz2E4ste4wht GxxHrF8LSoWm7dioeStooeWCNZWlLJZtrU2yzRXkD06On/wPqiIQ1CoYTdrQtQJo6yS3wN+ qxm9NqBon7w72cMph9odS1HiWVOGDVVE/Z0ijna6ALD3flkjUmew3hCq3ZM8M4pNDEergVf npNtsudTlmGiApMl4kGIg== X-UI-Out-Filterresults: notjunk:1;V01:K0:V9eZ6DgF88E=:wOmrOpBTrF6Es8xOGVjy1o K2w1krarEQ2KRXk4J9tSwPElRyBg4MphIit6GF0GRIp2ra86YLpSSb48/wnMrS3hu3Mk+zEtj bI1kNuQs33kLPZxnIZqAWGxo3xL1d+0mGI+IOpe2AcEBfmpPuFi6hk790POZG5kTJhgPfkTnZ CFs1y3JgbSXt8Khx/m6qqN65Avi28FpmNxMQjXOWdwFV3Ac4fPLD82jqBePA5weCcw0FpB/AW 3BrUS3nHnQlrtFBveaQ0+sOCisLxdC44XpMBe6Hk2xloYhT2/cjVQoJvDAu2arI1VpLBmQ+2Z rbYKCaGWChqUvs+w+0a3vi1AD9+j04wJWCvXHAKcDe6MSpygjjN8S/3OoFU5IRL0QvqcGKTOe mH4WYLorM73z9X1wNEdRqh8+95mMyQzin/xp+3aLywGzeXsWcbrdVPO+qVn9Nn0jQRudfZw20 aBHGwpaT3bu6/KPRHDJ7MQc/UyVEEp45DNo6+eJ6LNuFqXJ1smmObUs4njEcIiedXgt3UFNL0 ytfVNdRoNvROYvkNDavoustJk+0hKyWlyTUrSmn9aJTW78nE5zC2OMBXZ4WKymvZEz8cPa8d0 jKnTDgZeVkT1roONPo7Ren3QHpyBJ8JRCkeVS1I+FaG/EirfXQ8dNVhoV8vSyp9wXOEcambBF ARSjCE0vi8ME+0p/TKWgVocsLCPpt1OQqhvfUFbmmBg1sqCjwtwBeis9J/hJnMdJF8y4= X-Spam-Score: -0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) On Fri, 19 Jun 2015 08:43:50 +0200 martin rudalics wrote: >> 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. > > You should use =E2=80=98set-window-buffer=E2=80=99 in application program= s only if you > know what you're doing. From the Elisp manual: > > When writing an application, you should normally use the > higher-level functions described in *Note Switching Buffers::, > instead of calling `set-window-buffer' directly. Is this a change from previous policy? In earlier versions of todo-mode.el I had several instances of switch-to-buffer, but some time ago replaced them with set-window-buffer and I'm pretty sure I did that because I was given to understand that programmatic use of switch-to-buffer was discouraged. If this is no longer the case (or if I was mistaken back then), I'll have check (when I have time) all of the uses of set-window-buffer in todo-mode.el for unanticipated side effects. > While the minibuffer window is selected, =E2=80=98minibuffer-selected-win= dow=E2=80=99 > can be used to get the previously selected window. Thanks. Steve Berman From unknown Thu Aug 21 12:11:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20832: 25.0.50; todo-show accidentally deleted my todo file. Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jun 2015 15:41: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: To: Stephen Berman Cc: Nicolas Richard , 20832@debbugs.gnu.org Received: via spool by 20832-submit@debbugs.gnu.org id=B20832.143472841231535 (code B ref 20832); Fri, 19 Jun 2015 15:41:03 +0000 Received: (at 20832) by debbugs.gnu.org; 19 Jun 2015 15:40:12 +0000 Received: from localhost ([127.0.0.1]:52116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5yOp-0008CY-Br for submit@debbugs.gnu.org; Fri, 19 Jun 2015 11:40:12 -0400 Received: from mout.gmx.net ([212.227.17.22]:62306) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5yOk-0008Bv-DW for 20832@debbugs.gnu.org; Fri, 19 Jun 2015 11:40:08 -0400 Received: from [178.191.142.104] ([178.191.142.104]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0Lz3JU-1Z1jAK1wKu-014GHO; Fri, 19 Jun 2015 17:39:56 +0200 Message-ID: <558437C5.7060207@gmx.at> Date: Fri, 19 Jun 2015 17:39:49 +0200 From: martin rudalics MIME-Version: 1.0 References: <86h9q67v0w.fsf@members.fsf.org> <87fv5pcogr.fsf@gmx.net> <5582B0F5.30303@members.fsf.org> <5583BA26.10709@gmx.at> <87egl7ivaf.fsf@gmx.net> In-Reply-To: <87egl7ivaf.fsf@gmx.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:jRPU7FDQ29zTrmZPpRI+jYwR7of5GfsasElXmy82VHuh40s6MwO zUXQ8scoHTW7fmC1QwQi3RUICa2+TBhv+wcC7okWMuX4J6xNz7Yr4XcqwatH7S9rIfgI8jS j7XwQT/eTMO77a7o/y9nP0HIrlMG7GFN9vzCeF8I/6V3evhagVbROoZoJMFW1few1JhB07z gh6ogKIVD2js+RN86s8tA== X-UI-Out-Filterresults: notjunk:1;V01:K0:mvj2HnCemy0=:4vWyNUIKupra73TfZc/jtX SQCPJ/Kh27+wDOQ4+Bhh4qL3D/uL/ZIZygbe4cjBFCowHelxoIqm7rYIbaloQ1UAL9Vo24eZs Kk5kKuJuLzdNbUkbcNCR5fUd/lBUcFfiCh4egCmQBKkBFPbQDCIwbUge8Zqzcg8afl8Mcgi+t ien9QUpQif2KsU/DqFcIn9nPfo5ZxMU1Rg35VRE4EYWTvnLBw3NbuKC4bmXAcXZzrkMWk9CNW ywwya+gX3JMYlJ9dkoTNyJEYKdQd1ARI/1dv92bm6jtKQEumxk5CUF1xo38g1C033mzCOuuRn DFKgLyZKleTB8wuif0htEEBV8SYrXDiuoNCj1RBhqeTqGETP+WdwKIZgkbj6rfWkm6TVEN2rg O+v68bcuJjSbnLkd4YCgxxADIfHevFF6xAcZNKX/dea+QCD0q4bmuwHhfXE5O555RDRCU6A0R 5RHCCwpGaRybWzjS4Vg8CnSjlrsplNm05IdjJ9LU6cbe16Pp6g6PjaYl/oLaDdB7tQSehg8wz H5ad5rxWhw3t1k3Xp+kj7+dKIuAFYQsNvf5977r5dAnaOEulAW564A8i38/n9VUXXtAK+kPh2 IjWCwfEBbfhokhP+JyFAuYQ0zXLRY63QDdXU4vJgZkdC6vgvNwhGL+428lLOOJrun39JMkyeg cxG5s6hKtjCMty1fDpmr5/UlSoLH5+F8Egz3qDwibFf3lM0Ey+UxG5Jaa76Dh1p4G4sM= X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) >> When writing an application, you should normally use the >> higher-level functions described in *Note Switching Buffers::, >> instead of calling `set-window-buffer' directly. > > Is this a change from previous policy? In earlier versions of > todo-mode.el I had several instances of switch-to-buffer, but some tim= e > ago replaced them with set-window-buffer and I'm pretty sure I did tha= t > because I was given to understand that programmatic use of > switch-to-buffer was discouraged. If this is no longer the case (or i= f > I was mistaken back then), I'll have check (when I have time) all of t= he > uses of set-window-buffer in todo-mode.el for unanticipated side > effects. Nothing has changed. The term "normally" stands more or less for "when you use =E2=80=98set-window-buffer=E2=80=99 you are supposed to know what= you do". This is a low level function and should be allowed to set the buffer of any window (like the minibuffer or a tooltip window) just as =E2=80=98window-= buffer=E2=80=99 returns the buffer shown in any live window. OTOH I don't recall any restrictions on using =E2=80=98switch-to-buffer=E2= =80=99 programmatically. Just that you should _not_ expect it to always use the selected window. martin