Skip to content

Complete function keywords arguments #426

Open
@xuchunyang

Description

@xuchunyang

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions