[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc
From: |
Thierry Volpiatto |
Subject: |
bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc. |
Date: |
Thu, 15 Jun 2017 05:26:05 +0200 |
User-agent: |
mu4e 0.9.19; emacs 24.5.1 |
npostavs@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
bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc., Dmitry Gutov, 2017/06/07
bug#27272: 25.2; [patch] Fix positional args among keyword args in eldoc., Johan Bockgård, 2017/06/10