all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@hochschule-trier.de>
To: 24238@debbugs.gnu.org
Subject: bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
Date: Mon, 15 Aug 2016 20:19:16 +0200	[thread overview]
Message-ID: <87k2fhuc7v.fsf@hochschule-trier.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sh-script.diff --]
[-- Type: text/x-diff, Size: 754 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 7 bytes --]


-ap



             reply	other threads:[~2016-08-15 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 18:19 Andreas Politz [this message]
2016-10-16  9:02 ` bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty Dmitry Gutov
2016-10-16 11:29   ` Andreas Politz
2016-10-16 13:57     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k2fhuc7v.fsf@hochschule-trier.de \
    --to=politza@hochschule-trier.de \
    --cc=24238@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.