Created
February 11, 2018 20:49
-
-
Save tvraman/011215e6cd63aa02ab03184d800de138 to your computer and use it in GitHub Desktop.
Wizard To Generate declare-function calls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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