GNU bug report logs - #24238
25.1.50; error in capf in sh-script if imenu-index is empty

Previous Next

Package: emacs;

Reported by: Andreas Politz <politza <at> hochschule-trier.de>

Date: Mon, 15 Aug 2016 18:20:01 UTC

Severity: minor

Tags: patch

Found in version 25.1.50

Fixed in version 25.2

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24238 in the body.
You can then email your comments to 24238 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24238; Package emacs. (Mon, 15 Aug 2016 18:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Politz <politza <at> hochschule-trier.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 15 Aug 2016 18:20:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1.50; error in capf in sh-script if imenu-index is empty  
Date: Mon, 15 Aug 2016 20:19:16 +0200
[Message part 1 (text/plain, inline)]
The completion function sh--cmd-completion-table in sh-script.el may use
imenu--make-index-alist to create a list of candidates.  But this
function signals the error imenu-unavailable, if the index is empty.
This is a commonly the case, e.g. if the scripts is new.

Solution: Catch the error condition.

[sh-script.diff (text/x-diff, inline)]
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 7a9e6c7..5d362e4 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1744,7 +1744,10 @@ sh--vars-before-point
 (defun sh--cmd-completion-table (string pred action)
   (let ((cmds
          (append (when (fboundp 'imenu--make-index-alist)
-                   (mapcar #'car (imenu--make-index-alist)))
+                   (mapcar #'car
+                           (condition-case nil
+                               (imenu--make-index-alist)
+                             (imenu-unavailable nil))))
                  (mapcar (lambda (v) (concat v "="))
                          (sh--vars-before-point))
                  (locate-file-completion-table
[Message part 3 (text/plain, inline)]
-ap



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24238; Package emacs. (Sun, 16 Oct 2016 09:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 24238 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Andreas Politz <politza <at> hochschule-trier.de>, 24238 <at> debbugs.gnu.org
Subject: Re: bug#24238: 25.1.50; error in capf in sh-script if imenu-index is
 empty
Date: Sun, 16 Oct 2016 12:02:15 +0300
On 15.08.2016 21:19, Andreas Politz wrote:
>
> The completion function sh--cmd-completion-table in sh-script.el may use
> imenu--make-index-alist to create a list of candidates.  But this
> function signals the error imenu-unavailable, if the index is empty.
> This is a commonly the case, e.g. if the scripts is new.
>
> Solution: Catch the error condition.

Looks good to me. Do you have commit access?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24238; Package emacs. (Sun, 16 Oct 2016 11:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 24238 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 24238 <at> debbugs.gnu.org
Subject: Re: bug#24238: 25.1.50;
 error in capf in sh-script if imenu-index is empty
Date: Sun, 16 Oct 2016 13:29:41 +0200
No, I don't.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sun, 16 Oct 2016 13:58:01 GMT) Full text and rfc822 format available.

Notification sent to Andreas Politz <politza <at> hochschule-trier.de>:
bug acknowledged by developer. (Sun, 16 Oct 2016 13:58:01 GMT) Full text and rfc822 format available.

Message #16 received at 24238-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 24238-done <at> debbugs.gnu.org
Subject: Re: bug#24238: 25.1.50; error in capf in sh-script if imenu-index is
 empty
Date: Sun, 16 Oct 2016 16:57:11 +0300
Version: 25.2

On 16.10.2016 14:29, Andreas Politz wrote:
>
> No, I don't.

OK, I pushed it to emacs-25. Thanks for the patch.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 14 Nov 2016 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.