mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
elisp--highlight-function-argument: Use temporary buffer
* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument): Insert 'args' into temporary buffer to prepare for better handling of usage arguments (bug#8432). Move point after the first opening parenthesis of the arguments string. In the loop, let `origin' track the point. No functional change.
This commit is contained in:
parent
858cebd6c5
commit
7d2303aef8
1 changed files with 30 additions and 26 deletions
|
|
@ -2443,32 +2443,36 @@ ARGS is the argument list of function SYM."
|
|||
start (match-beginning 0)
|
||||
end (match-end 0)))))))
|
||||
;; Handle now positional arguments.
|
||||
(while (and index (>= index 1))
|
||||
(if (string-match "[^ ()]+" args end)
|
||||
(progn
|
||||
(setq start (match-beginning 0)
|
||||
end (match-end 0))
|
||||
(let ((argument (match-string 0 args)))
|
||||
(cond ((string= argument "&rest")
|
||||
;; All the rest arguments are the same.
|
||||
(setq index 1))
|
||||
((string= argument "&optional")) ; Skip.
|
||||
((string= argument "&allow-other-keys")) ; Skip.
|
||||
;; Back to index 0 in ARG1 ARG2 ARG2 ARG3 etc...
|
||||
;; like in `setq'.
|
||||
((or (and (string-match-p "\\.\\.\\.\\'" argument)
|
||||
(string= argument (car (last args-lst))))
|
||||
(and (string-match-p "\\.\\.\\.\\'"
|
||||
(substring args 1 (1- (length args))))
|
||||
(= (length (remove "..." args-lst)) 2)
|
||||
(> index 1) (oddp index)))
|
||||
(setq index 0))
|
||||
(t
|
||||
(setq index (1- index))))))
|
||||
(setq end (length args)
|
||||
start (1- end)
|
||||
argument-face 'font-lock-warning-face
|
||||
index 0)))
|
||||
(with-temp-buffer
|
||||
(insert args)
|
||||
(goto-char (1+ (point-min)))
|
||||
(while (and index (>= index 1))
|
||||
(let ((origin (point)))
|
||||
(if (string-match "[^ ()]+" args end)
|
||||
(progn
|
||||
(setq start (match-beginning 0)
|
||||
end (match-end 0))
|
||||
(let ((argument (match-string 0 args)))
|
||||
(cond ((string= argument "&rest")
|
||||
;; All the rest arguments are the same.
|
||||
(setq index 1))
|
||||
((string= argument "&optional")) ; Skip.
|
||||
((string= argument "&allow-other-keys")) ; Skip.
|
||||
;; Back to index 0 in ARG1 ARG2 ARG2 ARG3 etc...
|
||||
;; like in `setq'.
|
||||
((or (and (string-match-p "\\.\\.\\.\\'" argument)
|
||||
(string= argument (car (last args-lst))))
|
||||
(and (string-match-p "\\.\\.\\.\\'"
|
||||
(substring args 1 (1- (length args))))
|
||||
(= (length (remove "..." args-lst)) 2)
|
||||
(> index 1) (oddp index)))
|
||||
(setq index 0))
|
||||
(t
|
||||
(setq index (1- index))))))
|
||||
(setq end (length args)
|
||||
start (1- end)
|
||||
argument-face 'font-lock-warning-face
|
||||
index 0)))))
|
||||
(let ((doc args))
|
||||
(when start
|
||||
(setq doc (copy-sequence args))
|
||||
|
|
|
|||
Loading…
Reference in a new issue