Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete function keywords arguments #426

Open
xuchunyang opened this issue Feb 18, 2020 · 1 comment
Open

Complete function keywords arguments #426

xuchunyang opened this issue Feb 18, 2020 · 1 comment

Comments

@xuchunyang
Copy link
Contributor

I learnt procedure-keywords can extract a function's keywords, e.g.,

(procedure-keywords open-output-file)
;; =>
'()
'(#:exists #:mode)

(require plot)
(procedure-keywords plot)
;; =>
'()
'(#:bgcolor
  #:fgcolor
  #:height
  #:legend-anchor
  #:lncolor
  #:out-file
  #:out-kind
  #:title
  #:width
  #:x-label
  #:x-max
  #:x-min
  #:y-label
  #:y-max
  #:y-min)

For example, when I type (plot func #:), the point is after #:, I can complete the all keywords of plot.

I wrote a function to get possible function's name, in the above example, it returns "plot".

(defun racket-current-function-name ()
  "Return the function name of current funcall or nil."
  (let ((beg (condition-case nil
                 (scan-lists (point) -1 1)
               (scan-error nil))))
    (when beg
      (save-excursion
        (goto-char (1+ beg))
        (current-word)))))
@xuchunyang
Copy link
Contributor Author

I just notice the check-syntax branch has this feature. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant