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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#24238: closed (25.1.50; error in capf in sh-script if
 imenu-index is empty  )
Date: Sun, 16 Oct 2016 13:58:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 16 Oct 2016 16:57:11 +0300
with message-id <b3d2b3e0-6a17-629c-a4ef-c8ae5bf7f219 <at> yandex.ru>
and subject line Re: bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
has caused the debbugs.gnu.org bug report #24238,
regarding 25.1.50; error in capf in sh-script if imenu-index is empty  
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
24238: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24238
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 3 (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 5 (text/plain, inline)]
-ap


[Message part 6 (message/rfc822, inline)]
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.



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

Previous Next


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