From unknown Tue Jun 24 07:00:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23447: 25.0.93; Todo mode bug involving archived items Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 May 2016 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23447 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 23447@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14623700547441 (code B ref -1); Wed, 04 May 2016 13:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 May 2016 13:54:14 +0000 Received: from localhost ([127.0.0.1]:36547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axxFm-0001vx-7m for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axxFk-0001vk-NC for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axxFV-0000iN-U6 for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:04 -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.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxFV-0000hM-Rt for submit@debbugs.gnu.org; Wed, 04 May 2016 09:53:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxFJ-00013y-RN for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axxF5-0000bG-ML for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:38 -0400 Received: from mout.gmx.net ([212.227.15.15]:55482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxF5-0000YV-DK for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:31 -0400 Received: from rosalinde ([89.245.97.70]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LxxKu-1blBkn16G4-015LBJ for ; Wed, 04 May 2016 15:53:17 +0200 From: Stephen Berman Date: Wed, 04 May 2016 15:53:16 +0200 Message-ID: <87k2ja6ib7.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:w3T9rzQIbXwZd5HxTdykTMYUP+XX0KcjXfpVQ7/8SsgR7XY3et6 p93s5dfyp04vT6oJCl8sGp8S2e45Fz4xAuaXWPYuHWrgPNARSfXTej3K/sZkIND00bC1lTG aQXLnVBu7Rn+/Zuu6LYITNGuiguLvgjznpvrYwx4TLIwoKh9ln8KtxROgEyxyv86A6BZ9OR oxvlDQAZpri3v1nWAAaTg== X-UI-Out-Filterresults: notjunk:1;V01:K0:evjUmn9bHZk=:2/1HCfienTe+VkmQUS3p8q 7V0KeYHosoIJFWTKVuiBLXho1lOahOplZrMD/Hi2qwI7erLsW+1Vm55u6mVciiNinN66ONOh0 k5ukpo9PKWRh+FmRGTemcmkKB0M0r5fTT4K+zeqAoSvRASldwJApwx5lgArGIth1EW1/UU+vN d1dl9ihS/flqvgVfKhAtxypA80LGnkodizb0bh3ajLPepdq+Ered2sjxhc+s1EtyDcqaFB7q5 c6NuJr6s0HqQQZCPksTnypabcQ91NtTfFoZGHgYovEM9O/V6VCnjpIg/Q5gMTeyYNBF/m6DA9 Cgs3PTWXDwsgUcn5d4pODn/5Xu0sHK5YlUl+FqnkqvjiZH3vzo5tagmnkeTH6lJaaIksYrWE9 T2GuA9AGw5YwY3TXBYTbIknXJ4wD1VTGwLg8uu1XtIHbq1Mcz7ikoPItbLsK20+s/GbJbk0U3 95e0XR255UL2ZkE0PMHguXJD5+Fhlt3VaeW7RdjgwzZOCtQE6LhsUYA9EOsaAj1XOafCwlSFy Upcqi0Frj0+tbjuSdndzE1VSgrPP4s6WvMFKlfHxM5Zn3O0z69VnXMw6N6Xtfr/GFGj63XmJ2 9m9jgcQtf1rgFPY3otfEwNkdQb9UMtxVO9tgrgDxtXLBsrNY1DW+bwMFSuWOwOFX6GSgtY9IU iCIs9OuThVkf0uVwrlZCQQCyiSPxYLkE/LBQGrHSZW4kh5jlGBoUWr7GwylakoQkXo6I2YXlj QSjSrMlDrWZAXTSeRMCyoFTkjYdYMSLgqxSzoYDilTOshbT23bNYDHBdli1Xa0bLs7+rjGJz4 PAVoDq6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -4.1 (----) With todo-mode.el, when a category has archived items and the user option todo-skip-archived-categories is non-nil, trying to visit the archived items from the todo file's table of categories buffer results in an error and a misbehavior. To reproduce from -Q: 0. Create a todo file and an archive for it, e.g. as follows (this assumes there isn't any todo file yet; if there is, then after calling todo-show, type `F a' to add a new file, follow the prompts to enter an item and proceed with steps b and c): a. M-x todo-show RET RET RET RET RET test RET (to create file "Todo" with category "Todo" containing item "test"). b. d (to mark the item as done and move it to the category's done items section). c. C-u A d y (to archive the done item and display the archive buffer; `y' is typed at the prompt). 1. Kill the Todo Archive mode buffer. 2. M-x customize-option RET todo-skip-archived-categories RET, toggle its value to "on", change the state to "SET for current session only". 3. Return to the (empty) Todo mode buffer (e.g. by invoking todo-show). 4. Type `F c' to display the todo file's table of categories, put point on the line beginning with "1" (e.g. by repeatedly typing TAB or `n') and type RET. This should display the category's archive in Todo Archive mode, but instead: => The window now displays an empty buffer in Fundamental mode whose mode line says "Todo category 1: nil" and the error message "Category nil is missing todo-category-done string" is displayed. 5. M-x todo-show should now redisplay the (empty) Todo mode buffer, but instead, after invoking that command: => The Todo Archive mode buffer is displayed. Subsequently calling todo-show from any non-Todo mode buffer (e.g. *scratch*) wrongly displays the Todo Archive mode buffer instead of the Todo mode buffer. These problems do not occur if step 1 is omitted. (If you already have a todo file and a corresponding archive file, the recipe can begin from -Q by invoking todo-show and then continuing with step 2; then there is no live Todo Archive mode buffer, so the bug gets triggered.) The patch below fixes these problems (and also removes some code added in commit d04d6b955b4caaa9817ec053eddb59e923a68cf8 that was made no-op by 58c7641d1b069be3ead47dbe4a44c8360ef8d1f2 and should have been removed then). In GNU Emacs 25.0.93.3 (x86_64-suse-linux-gnu, GTK+ Version 3.14.15) of 2016-05-04 built on rosalinde Repository revision: adc80b7e238e09b1b8c392ecf902d2b978d9016d Windowing system distributor 'The X.Org Foundation', version 11.0.11601000 System Description: openSUSE 13.2 (Harlequin) (x86_64) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 0529e97..8e75258 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -902,17 +902,19 @@ todo-jump-to-category (todo-show) (let* ((archive (eq where 'archive)) (cat (unless archive where)) + (goto-archive (and cat + todo-skip-archived-categories + (zerop (todo-get-count 'todo cat)) + (zerop (todo-get-count 'done cat)) + (not (zerop (todo-get-count 'archived cat))))) (file0 (when cat ; We're in Todo Categories mode. - ;; With non-nil `todo-skip-archived-categories' - ;; jump to archive file of a category with only - ;; archived items. - (if (and todo-skip-archived-categories - (zerop (todo-get-count 'todo cat)) - (zerop (todo-get-count 'done cat)) - (not (zerop (todo-get-count 'archived cat)))) + (if goto-archive + ;; If the category has only archived items and + ;; `todo-skip-archived-categories' is non-nil, jump to + ;; the archive category. (concat (file-name-sans-extension todo-current-todo-file) ".toda") - ;; Otherwise, jump to current todo file. + ;; Otherwise, jump to the category in the todo file. todo-current-todo-file))) (len (length todo-categories)) (cat+file (unless cat @@ -923,18 +925,15 @@ todo-jump-to-category (category (or cat (car cat+file)))) (unless cat (setq file0 (cdr cat+file))) (with-current-buffer (find-file-noselect file0 'nowarn) - (setq todo-current-todo-file file0) - ;; If called from Todo Categories mode, clean up before jumping. - (if (string= (buffer-name) todo-categories-buffer) - (kill-buffer)) - (set-window-buffer (selected-window) - (set-buffer (find-buffer-visiting file0))) - (unless todo-global-current-todo-file - (setq todo-global-current-todo-file todo-current-todo-file)) - (todo-category-number category) - (todo-category-select) - (goto-char (point-min)) - (when add-item (todo-insert-item--basic)))))) + (when goto-archive (todo-archive-mode)) + (set-window-buffer (selected-window) + (set-buffer (find-buffer-visiting file0))) + (unless todo-global-current-todo-file + (setq todo-global-current-todo-file todo-current-todo-file)) + (todo-category-number category) + (todo-category-select) + (goto-char (point-min)) + (when add-item (todo-insert-item--basic)))))) (defun todo-next-item (&optional count) "Move point down to the beginning of the next item. From unknown Tue Jun 24 07:00:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stephen Berman Subject: bug#23447: closed (Re: bug#23447: 25.0.93; Todo mode bug involving archived items) Message-ID: References: <8737px7atj.fsf@gmx.net> <87k2ja6ib7.fsf@gmx.net> X-Gnu-PR-Message: they-closed 23447 X-Gnu-PR-Package: emacs Reply-To: 23447@debbugs.gnu.org Date: Wed, 04 May 2016 21:50:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1462398602-1879-1" This is a multi-part message in MIME format... ------------=_1462398602-1879-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #23447: 25.0.93; Todo mode bug involving archived items 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 23447@debbugs.gnu.org. --=20 23447: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D23447 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1462398602-1879-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 23447-done) by debbugs.gnu.org; 4 May 2016 21:49:53 +0000 Received: from localhost ([127.0.0.1]:38407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay4g5-0000Tp-Kt for submit@debbugs.gnu.org; Wed, 04 May 2016 17:49:53 -0400 Received: from mout.gmx.net ([212.227.17.22]:58557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay4g4-0000Tc-42 for 23447-done@debbugs.gnu.org; Wed, 04 May 2016 17:49:52 -0400 Received: from rosalinde ([89.245.97.70]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LpPg1-1bdCNo3BQr-00f775 for <23447-done@debbugs.gnu.org>; Wed, 04 May 2016 23:49:45 +0200 From: Stephen Berman To: 23447-done@debbugs.gnu.org Subject: Re: bug#23447: 25.0.93; Todo mode bug involving archived items References: <87k2ja6ib7.fsf@gmx.net> Date: Wed, 04 May 2016 23:49:44 +0200 In-Reply-To: <87k2ja6ib7.fsf@gmx.net> (Stephen Berman's message of "Wed, 04 May 2016 15:53:16 +0200") Message-ID: <8737px7atj.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:LDvucueg/GaLs8mBOHS9crQDKjn8jQMfJlc8kz0DMz+hyDPPR1D VAqBOuTJweUDUsuqdvZOR1GI0QkQa+DUbXE/w8XTW7W6zMGiMHV/nebsFpnAgN91Rqw7PHp qky3nKJ5ulrDSOmLRYq9vS8gPLM1v0HEwIgzMkCwSvdjMEE9zYFJkv5CPO0HzgnE5OWnTZu D3txvQNmTNveYrD4xc0/A== X-UI-Out-Filterresults: notjunk:1;V01:K0:Lq/ZHjeTAJ8=:rcF+2wdeqprkvsXre6cCzX 5ohrvui1r0gnOhjaB47gqzZ1Eh9A9f7MxDdVY2NNOJ6zTUehbAYiXijxTdmuNMGYzNE9KHD+T B6iPodp9X83vJNbJ8Mg7GFYrmUgI+yLvyeNxyFsGGkR2fyJ6c83jRB+7m4AI86BkokSsjC0YT N7eOp17SomFGCHbKO7LbYmnbl+a6FKUr5CRd9cfZvYd5dCWsTHMigJ1IAWV4BFqUsQ6w3TL07 6Zkk+8FxcyebVFMrl7o+VwcQF80G/L+eGzdwG9U3xG896iy7RsNG4pZsBlzmPi7e2Zxm8bu9v hQR4nse09v8ij/SOLTZEPgDv0d7/K53weUyHyYLoCRqXd3/PoA6bRpbfwnlZibHl2cMn75jl/ fwdQN5aF7GDFBz3EMie/+gaXqkTse9XKAkw0N2b3wT3lwvYDpBAmgWm8tVHiSPE1LGbS+WHLa wtipgv9v1X6RwB/gCRyqaDmSXRL0srpEtwARo+guEoTm4EHJAqAieCNqezzCcErtNZXQFEOFw gpeLBMyOZYOsapEfWjeYuU/kZxD/rKIs6xRP+1LCSl6J8+Izzi712RwBYzfsE3SqIRXdsfmtX 5RhqmC+Pin1HkqvB5gS03OfMhaTe5p6JLWThKZGVkKbgFtYac5TAZNiv2y9qi4nWTWjDMnV81 XOt9sbiQTqSm2fSYErR1j228Qf5nfiCoX4Bn8tVQcO/DSn5jJnuM19dWtzGskc5Wf8+s/FSNf gSeKhiTHv857Okqgt7vclohEQ1UYvVNk0lREO2UHmbej9TwOcAQK3smTr6OOaqjwN0oODTVqo YS+U7jB X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 23447-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.8 (--) Fix committed as emacs-25 0932b94. ------------=_1462398602-1879-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 May 2016 13:54:14 +0000 Received: from localhost ([127.0.0.1]:36547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axxFm-0001vx-7m for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axxFk-0001vk-NC for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axxFV-0000iN-U6 for submit@debbugs.gnu.org; Wed, 04 May 2016 09:54:04 -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.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxFV-0000hM-Rt for submit@debbugs.gnu.org; Wed, 04 May 2016 09:53:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxFJ-00013y-RN for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axxF5-0000bG-ML for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:38 -0400 Received: from mout.gmx.net ([212.227.15.15]:55482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxF5-0000YV-DK for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 09:53:31 -0400 Received: from rosalinde ([89.245.97.70]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LxxKu-1blBkn16G4-015LBJ for ; Wed, 04 May 2016 15:53:17 +0200 From: Stephen Berman To: bug-gnu-emacs@gnu.org Subject: 25.0.93; Todo mode bug involving archived items Date: Wed, 04 May 2016 15:53:16 +0200 Message-ID: <87k2ja6ib7.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:w3T9rzQIbXwZd5HxTdykTMYUP+XX0KcjXfpVQ7/8SsgR7XY3et6 p93s5dfyp04vT6oJCl8sGp8S2e45Fz4xAuaXWPYuHWrgPNARSfXTej3K/sZkIND00bC1lTG aQXLnVBu7Rn+/Zuu6LYITNGuiguLvgjznpvrYwx4TLIwoKh9ln8KtxROgEyxyv86A6BZ9OR oxvlDQAZpri3v1nWAAaTg== X-UI-Out-Filterresults: notjunk:1;V01:K0:evjUmn9bHZk=:2/1HCfienTe+VkmQUS3p8q 7V0KeYHosoIJFWTKVuiBLXho1lOahOplZrMD/Hi2qwI7erLsW+1Vm55u6mVciiNinN66ONOh0 k5ukpo9PKWRh+FmRGTemcmkKB0M0r5fTT4K+zeqAoSvRASldwJApwx5lgArGIth1EW1/UU+vN d1dl9ihS/flqvgVfKhAtxypA80LGnkodizb0bh3ajLPepdq+Ered2sjxhc+s1EtyDcqaFB7q5 c6NuJr6s0HqQQZCPksTnypabcQ91NtTfFoZGHgYovEM9O/V6VCnjpIg/Q5gMTeyYNBF/m6DA9 Cgs3PTWXDwsgUcn5d4pODn/5Xu0sHK5YlUl+FqnkqvjiZH3vzo5tagmnkeTH6lJaaIksYrWE9 T2GuA9AGw5YwY3TXBYTbIknXJ4wD1VTGwLg8uu1XtIHbq1Mcz7ikoPItbLsK20+s/GbJbk0U3 95e0XR255UL2ZkE0PMHguXJD5+Fhlt3VaeW7RdjgwzZOCtQE6LhsUYA9EOsaAj1XOafCwlSFy Upcqi0Frj0+tbjuSdndzE1VSgrPP4s6WvMFKlfHxM5Zn3O0z69VnXMw6N6Xtfr/GFGj63XmJ2 9m9jgcQtf1rgFPY3otfEwNkdQb9UMtxVO9tgrgDxtXLBsrNY1DW+bwMFSuWOwOFX6GSgtY9IU iCIs9OuThVkf0uVwrlZCQQCyiSPxYLkE/LBQGrHSZW4kh5jlGBoUWr7GwylakoQkXo6I2YXlj QSjSrMlDrWZAXTSeRMCyoFTkjYdYMSLgqxSzoYDilTOshbT23bNYDHBdli1Xa0bLs7+rjGJz4 PAVoDq6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -4.1 (----) With todo-mode.el, when a category has archived items and the user option todo-skip-archived-categories is non-nil, trying to visit the archived items from the todo file's table of categories buffer results in an error and a misbehavior. To reproduce from -Q: 0. Create a todo file and an archive for it, e.g. as follows (this assumes there isn't any todo file yet; if there is, then after calling todo-show, type `F a' to add a new file, follow the prompts to enter an item and proceed with steps b and c): a. M-x todo-show RET RET RET RET RET test RET (to create file "Todo" with category "Todo" containing item "test"). b. d (to mark the item as done and move it to the category's done items section). c. C-u A d y (to archive the done item and display the archive buffer; `y' is typed at the prompt). 1. Kill the Todo Archive mode buffer. 2. M-x customize-option RET todo-skip-archived-categories RET, toggle its value to "on", change the state to "SET for current session only". 3. Return to the (empty) Todo mode buffer (e.g. by invoking todo-show). 4. Type `F c' to display the todo file's table of categories, put point on the line beginning with "1" (e.g. by repeatedly typing TAB or `n') and type RET. This should display the category's archive in Todo Archive mode, but instead: => The window now displays an empty buffer in Fundamental mode whose mode line says "Todo category 1: nil" and the error message "Category nil is missing todo-category-done string" is displayed. 5. M-x todo-show should now redisplay the (empty) Todo mode buffer, but instead, after invoking that command: => The Todo Archive mode buffer is displayed. Subsequently calling todo-show from any non-Todo mode buffer (e.g. *scratch*) wrongly displays the Todo Archive mode buffer instead of the Todo mode buffer. These problems do not occur if step 1 is omitted. (If you already have a todo file and a corresponding archive file, the recipe can begin from -Q by invoking todo-show and then continuing with step 2; then there is no live Todo Archive mode buffer, so the bug gets triggered.) The patch below fixes these problems (and also removes some code added in commit d04d6b955b4caaa9817ec053eddb59e923a68cf8 that was made no-op by 58c7641d1b069be3ead47dbe4a44c8360ef8d1f2 and should have been removed then). In GNU Emacs 25.0.93.3 (x86_64-suse-linux-gnu, GTK+ Version 3.14.15) of 2016-05-04 built on rosalinde Repository revision: adc80b7e238e09b1b8c392ecf902d2b978d9016d Windowing system distributor 'The X.Org Foundation', version 11.0.11601000 System Description: openSUSE 13.2 (Harlequin) (x86_64) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 0529e97..8e75258 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -902,17 +902,19 @@ todo-jump-to-category (todo-show) (let* ((archive (eq where 'archive)) (cat (unless archive where)) + (goto-archive (and cat + todo-skip-archived-categories + (zerop (todo-get-count 'todo cat)) + (zerop (todo-get-count 'done cat)) + (not (zerop (todo-get-count 'archived cat))))) (file0 (when cat ; We're in Todo Categories mode. - ;; With non-nil `todo-skip-archived-categories' - ;; jump to archive file of a category with only - ;; archived items. - (if (and todo-skip-archived-categories - (zerop (todo-get-count 'todo cat)) - (zerop (todo-get-count 'done cat)) - (not (zerop (todo-get-count 'archived cat)))) + (if goto-archive + ;; If the category has only archived items and + ;; `todo-skip-archived-categories' is non-nil, jump to + ;; the archive category. (concat (file-name-sans-extension todo-current-todo-file) ".toda") - ;; Otherwise, jump to current todo file. + ;; Otherwise, jump to the category in the todo file. todo-current-todo-file))) (len (length todo-categories)) (cat+file (unless cat @@ -923,18 +925,15 @@ todo-jump-to-category (category (or cat (car cat+file)))) (unless cat (setq file0 (cdr cat+file))) (with-current-buffer (find-file-noselect file0 'nowarn) - (setq todo-current-todo-file file0) - ;; If called from Todo Categories mode, clean up before jumping. - (if (string= (buffer-name) todo-categories-buffer) - (kill-buffer)) - (set-window-buffer (selected-window) - (set-buffer (find-buffer-visiting file0))) - (unless todo-global-current-todo-file - (setq todo-global-current-todo-file todo-current-todo-file)) - (todo-category-number category) - (todo-category-select) - (goto-char (point-min)) - (when add-item (todo-insert-item--basic)))))) + (when goto-archive (todo-archive-mode)) + (set-window-buffer (selected-window) + (set-buffer (find-buffer-visiting file0))) + (unless todo-global-current-todo-file + (setq todo-global-current-todo-file todo-current-todo-file)) + (todo-category-number category) + (todo-category-select) + (goto-char (point-min)) + (when add-item (todo-insert-item--basic)))))) (defun todo-next-item (&optional count) "Move point down to the beginning of the next item. ------------=_1462398602-1879-1--