From stephen.berman@gmx.net Wed Oct 28 05:20:19 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 28 Oct 2009 12:20:20 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.8 required=4.0 tests=AWL,FOURLA,MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9SCKHNR007426 for ; Wed, 28 Oct 2009 05:20:19 -0700 Received: from mx10.gnu.org ([199.232.76.166]:34206) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1N37Vh-0002iE-7I for emacs-pretest-bug@gnu.org; Wed, 28 Oct 2009 08:20:17 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1N37Ve-0003IB-3D for emacs-pretest-bug@gnu.org; Wed, 28 Oct 2009 08:20:16 -0400 Received: from mail.gmx.net ([213.165.64.20]:46780) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N37Vd-0003Gf-CW for emacs-pretest-bug@gnu.org; Wed, 28 Oct 2009 08:20:13 -0400 Received: (qmail invoked by alias); 28 Oct 2009 12:20:08 -0000 Received: from i59F56217.versanet.de (EHLO escher.local.home) [89.245.98.23] by mail.gmx.net (mp021) with SMTP; 28 Oct 2009 13:20:08 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+pbPwWNyWp/CFCZepax6LR9n+sLA1FCabGapXUsj cke6Q/+MV0Bk2R Received: by escher.local.home (Postfix, from userid 1000) id DBADE1D184F; Wed, 28 Oct 2009 13:20:07 +0100 (CET) From: Stephen Berman To: emacs-pretest-bug@gnu.org Subject: 23.1.50; [PATCH] todo-mode.el Sender: steve@escher.local.home Date: Wed, 28 Oct 2009 13:20:07 +0100 Message-ID: <874opjd820.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Y-GMX-Trusted: 0 X-FuHaFi: 0.54 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) --=-=-= Here are two bugs in todo-mode.el; a patch is attached. 1. emacs -Q with no existing file as the value of todo-file-do 2. M-x todo-show 3. Type `e' (todo-edit-item) => Args out of range: 60, 61 This is because there is no todo item, so when todo-edit-item calls todo-item-string, todo-item-start returns (point-min), which is 61, and todo-item-end returns (1- (line-beginning-position)), i.e. 60, which raises the args-out-of-range error on buffer-substring in todo-item-string. The attached fix to todo-edit-item checks whether there is a todo item to edit and throws an error if not. This is consistent with other Todo mode commands, e.g. todo-{raise, lower, delete, file}-item. 1. emacs -Q 2. M-x todo-show 3. Type `i' and at the prompt a todo item, e.g "test", then RET to display the item in the TODO buffer in the category "Todo"; note that narrowing is in effect, as required by Todo mode. 4. Type `t' to display the Todo top priorities list in a window below the window displaying the TODO buffer. 5. In the TODO buffer type `E' on the item to put it in Todo Edit mode in the buffer *TODO Edit*. 6. Type C-x k to kill *TODO Edit* and return to the TODO buffer, which remains unchanged. 7. In the TODO buffer type `t' again. => Now narrowing is no longer in effect in the TODO buffer. This is because todo-top-priorities, although it calls widen within save-restriction, subsequently calls set-buffer, with the result, after the call to make-indirect-buffer in todo-edit-multiline (step 5 above), that narrowing is not restored. The causal chain here is not quite clear to me: in (elisp)Current Buffer there is a warning to use set-buffer within save-current-buffer or save-excursion to guarantee restoration, and in fact in todo-top-priorities set-buffer is within save-excursion, but that is outside of the save-restriction. If the order of save-excursion and save-restriction is switched, then narrowing is correctly restored after step 7 above; however, this order is discouraged in (elisp)Narrowing. But putting save-current-buffer between save-restriction and set-buffer also restores narrowing, so this is what the attached patch does. (I don't know why the failure to restore narrowing is conditioned by make-indirect-buffer; I asked about this on emacs-devel but have not yet gotten any response.) In addition, the use of save-excursion appears to be gratuitous here: point is already moved by the preceding call to todo-show, and subsequent code concerns the temporary top priorities buffer. But moving todo-show inside save-excursion does prevent point from being relocated, so I made this change as well in the patch. 2009-10-28 Stephen Berman * calendar/todo-mode.el (todo-edit-item): Signal an error if there is no item to edit. (Bug#XXXX) (todo-top-priorities): Restore point and restore narrowing in Todo buffer. (Bug#XXXX) --=-=-= Content-Disposition: attachment Content-Description: todo-mode.el patch *** emacs/lisp/calendar/todo-mode.el.~1.76.~ 2009-10-28 11:07:53.000000000 +0100 --- emacs/lisp/calendar/todo-mode.el 2009-10-28 12:55:58.000000000 +0100 *************** *** 505,518 **** (defun todo-edit-item () "Edit current TODO list entry." (interactive) ! (let ((item (todo-item-string))) ! (if (todo-string-multiline-p item) ! (todo-edit-multiline) ! (let ((new (read-from-minibuffer "Edit: " item))) ! (todo-remove-item) ! (insert new "\n") ! (todo-backward-item) ! (message ""))))) (defalias 'todo-cmd-edit 'todo-edit-item) (defun todo-edit-multiline () --- 505,520 ---- (defun todo-edit-item () "Edit current TODO list entry." (interactive) ! (if (< (point-min) (point-max)) ! (let ((item (todo-item-string))) ! (if (todo-string-multiline-p item) ! (todo-edit-multiline) ! (let ((new (read-from-minibuffer "Edit: " item))) ! (todo-remove-item) ! (insert new "\n") ! (todo-backward-item) ! (message "")))) ! (error "No TODO list entry to edit"))) (defalias 'todo-cmd-edit 'todo-edit-item) (defun todo-edit-multiline () *************** *** 745,778 **** (regexp-quote todo-prefix) " " todo-category-sep "\n") (concat todo-category-end "\n")))) beg end) - (todo-show) (save-excursion (save-restriction ! (widen) ! (copy-to-buffer todo-print-buffer-name (point-min) (point-max)) ! (set-buffer todo-print-buffer-name) ! (goto-char (point-min)) ! (when (re-search-forward (regexp-quote todo-header) nil t) ! (beginning-of-line 1) ! (delete-region (point) (line-end-position))) ! (while (re-search-forward ;Find category start ! (regexp-quote (concat todo-prefix todo-category-beg)) ! nil t) ! (setq beg (+ (line-end-position) 1)) ;Start of first entry. ! (re-search-forward cat-end nil t) ! (setq end (match-beginning 0)) ! (replace-match todo-category-break) ! (narrow-to-region beg end) ;In case we have too few entries. ! (goto-char (point-min)) ! (if (zerop nof-priorities) ;Traverse entries. ! (goto-char end) ;All entries ! (todo-forward-item nof-priorities)) ! (setq beg (point)) ! (delete-region beg end) ! (widen)) ! (and (looking-at " ") (replace-match "")) ;Remove trailing form-feed. ! (goto-char (point-min)) ;Due to display buffer ! )) ;; Could have used switch-to-buffer as it has a norecord argument, ;; which is nice when we are called from e.g. todo-print. ;; Else we could have used pop-to-buffer. --- 747,781 ---- (regexp-quote todo-prefix) " " todo-category-sep "\n") (concat todo-category-end "\n")))) beg end) (save-excursion + (todo-show) (save-restriction ! (save-current-buffer ! (widen) ! (copy-to-buffer todo-print-buffer-name (point-min) (point-max)) ! (set-buffer todo-print-buffer-name) ! (goto-char (point-min)) ! (when (re-search-forward (regexp-quote todo-header) nil t) ! (beginning-of-line 1) ! (delete-region (point) (line-end-position))) ! (while (re-search-forward ;Find category start ! (regexp-quote (concat todo-prefix todo-category-beg)) ! nil t) ! (setq beg (+ (line-end-position) 1)) ;Start of first entry. ! (re-search-forward cat-end nil t) ! (setq end (match-beginning 0)) ! (replace-match todo-category-break) ! (narrow-to-region beg end) ;In case we have too few entries. ! (goto-char (point-min)) ! (if (zerop nof-priorities) ;Traverse entries. ! (goto-char end) ;All entries ! (todo-forward-item nof-priorities)) ! (setq beg (point)) ! (delete-region beg end) ! (widen)) ! (and (looking-at " ") (replace-match "")) ;Remove trailing form-feed. ! (goto-char (point-min)) ;Due to display buffer ! ))) ;; Could have used switch-to-buffer as it has a norecord argument, ;; which is nice when we are called from e.g. todo-print. ;; Else we could have used pop-to-buffer. --=-=-=-- From rgm@gnu.org Fri Oct 30 19:23:33 2009 Received: (at 4820-done) by emacsbugs.donarmstrong.com; 31 Oct 2009 02:23:33 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-7.3 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9V2NVOi030969 for <4820-done@emacsbugs.donarmstrong.com>; Fri, 30 Oct 2009 19:23:32 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1N43cn-0001FU-Rr; Fri, 30 Oct 2009 22:23:29 -0400 From: Glenn Morris To: 4820-done@debbugs.gnu.org Subject: Re: bug#4820: 23.1.50; [PATCH] todo-mode.el References: <874opjd820.fsf@escher.local.home> X-Spook: import Etacs Compsec kibo Arnett John Kerry Elvis Craig X-Ran: b[JuGdXN<;8e^IT!HI6_`Q{__CvtCTz126x& (Stephen Berman's message of "Wed, 28 Oct 2009 13:20:07 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Thanks; applied. From monnier@IRO.UMontreal.CA Tue Nov 3 14:26:35 2009 Received: (at 4820) by emacsbugs.donarmstrong.com; 3 Nov 2009 22:26:35 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.9 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nA3MQXog002808 for <4820@emacsbugs.donarmstrong.com>; Tue, 3 Nov 2009 14:26:35 -0800 Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nA3MQWiH016021; Tue, 3 Nov 2009 17:26:33 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id CFD8F3A036; Tue, 3 Nov 2009 17:26:32 -0500 (EST) From: Stefan Monnier To: Stephen Berman Cc: 4820@debbugs.gnu.org Subject: Re: bug#4820: 23.1.50; [PATCH] todo-mode.el Message-ID: References: <874opjd820.fsf@escher.local.home> Date: Tue, 03 Nov 2009 17:26:32 -0500 In-Reply-To: <874opjd820.fsf@escher.local.home> (Stephen Berman's message of "Wed, 28 Oct 2009 13:20:07 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3398=0 > 1. emacs -Q with no existing file as the value of todo-file-do > 2. M-x todo-show > 3. Type `e' (todo-edit-item) > => Args out of range: 60, 61 I've installed a different fix, which may not result in a clean error message, but was needed for other reasons anyway. > 1. emacs -Q > 2. M-x todo-show > 3. Type `i' and at the prompt a todo item, e.g "test", then RET to > display the item in the TODO buffer in the category "Todo"; note that > narrowing is in effect, as required by Todo mode. > 4. Type `t' to display the Todo top priorities list in a window below > the window displaying the TODO buffer. > 5. In the TODO buffer type `E' on the item to put it in Todo Edit mode > in the buffer *TODO Edit*. > 6. Type C-x k to kill *TODO Edit* and return to the TODO buffer, which > remains unchanged. > 7. In the TODO buffer type `t' again. > => Now narrowing is no longer in effect in the TODO buffer. Thank you. I believe the fix to save-restriction I just installed should make this workaround unnecessary. Stefan From unknown Sat Jun 21 10:39:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 02 Dec 2009 15:24:13 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator