Skip to content

Instantly share code, notes, and snippets.

@tvraman
Created February 11, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvraman/011215e6cd63aa02ab03184d800de138 to your computer and use it in GitHub Desktop.
Save tvraman/011215e6cd63aa02ab03184d800de138 to your computer and use it in GitHub Desktop.
Wizard To Generate declare-function calls
(defun emacspeak-wizards-gen-fn-decl (f &optional ext)
"Generate declare-function call for function `f'.
Optional interactive prefix arg ext says this comes from an
external package."
(interactive "SFunction:")
(cl-assert (functionp f) t "Not a valid function")
(let ((file (symbol-file f 'defun))
(arglist (help-function-arglist f 'preserve)))
(cl-assert file t "Function definition not found")
(setq file (file-name-base file))
(insert
(format
"(declare-function %s \"%s\" %s)\n"
f
(if ext (format "ext:%s" file) file)
arglist ))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment