GNU bug report logs -
#27272
25.2; [patch] Fix positional args among keyword args in eldoc.
Previous Next
Reported by: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Date: Wed, 7 Jun 2017 09:32:01 UTC
Severity: normal
Tags: fixed, patch
Found in version 25.2
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #35 received at 27272 <at> debbugs.gnu.org (full text, mbox):
npostavs <at> users.sourceforge.net writes:
> Do you mean you have an updated patch that fixes this as well (which you
> seem to have forgotten to post)?
It is here.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index b3f452ca5b9..b2b3015581d 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1400,7 +1400,8 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
(args-lst (mapcar (lambda (x)
(replace-regexp-in-string
"\\`[(]\\|[)]\\'" "" x))
- (split-string args))))
+ (split-string args)))
+ (start-key-pos (cl-position "&key" args-lst :test 'equal)))
;; Find the current argument in the argument string. We need to
;; handle `&rest' and informal `...' properly.
;;
@@ -1412,11 +1413,12 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
;; When `&key' is used finding position based on `index'
;; would be wrong, so find the arg at point and determine
;; position in ARGS based on this current arg.
- (when (string-match "&key" args)
+ (when (and (string-match "&key" args)
+ (> index start-key-pos))
(let* (case-fold-search
key-have-value
(sym-name (symbol-name sym))
- (cur-w (current-word))
+ (cur-w (current-word t))
(args-lst-ak (cdr (member "&key" args-lst)))
(limit (save-excursion
(when (re-search-backward sym-name nil t)
@@ -1425,7 +1427,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
(substring cur-w 1)
(save-excursion
(let (split)
- (when (re-search-backward ":\\([^()\n]*\\)" limit t)
+ (when (re-search-backward ":\\([^ ()\n]*\\)" limit t)
(setq split (split-string (match-string 1) " " t))
(prog1 (car split)
(when (cdr split)
@@ -1437,7 +1439,7 @@ In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
args-lst-ak
(not (member (upcase cur-a) args-lst-ak))
(upcase (car (last args-lst-ak))))))
- (unless (string= cur-w sym-name)
+ (unless (or (null cur-w) (string= cur-w sym-name))
;; The last keyword have already a value
;; i.e :foo a b and cursor is at b.
;; If signature have also `&rest'
--
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8 5FC2 28D1 7F53 59F2 9997
This bug report was last modified 8 years and 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.