unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
@ 2016-08-15 18:19 Andreas Politz
  2016-10-16  9:02 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Politz @ 2016-08-15 18:19 UTC (permalink / raw)
  To: 24238

[-- 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
  2016-08-15 18:19 bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty Andreas Politz
@ 2016-10-16  9:02 ` Dmitry Gutov
  2016-10-16 11:29   ` Andreas Politz
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2016-10-16  9:02 UTC (permalink / raw)
  To: Andreas Politz, 24238

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?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
  2016-10-16  9:02 ` Dmitry Gutov
@ 2016-10-16 11:29   ` Andreas Politz
  2016-10-16 13:57     ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Politz @ 2016-10-16 11:29 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24238


No, I don't.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty
  2016-10-16 11:29   ` Andreas Politz
@ 2016-10-16 13:57     ` Dmitry Gutov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2016-10-16 13:57 UTC (permalink / raw)
  To: Andreas Politz; +Cc: 24238-done

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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-16 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15 18:19 bug#24238: 25.1.50; error in capf in sh-script if imenu-index is empty Andreas Politz
2016-10-16  9:02 ` Dmitry Gutov
2016-10-16 11:29   ` Andreas Politz
2016-10-16 13:57     ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).