Filter interactive function declared in file
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <fKkzTThkRH9fSNUJZd52gHhLWZZq1m-4yg-Z-GhmjtZxMwrG3xfpG42wPaFWJuIXepjXCjBZjSbsMyN2qcj5wU7i5pgm4h5sKMFyDwNCbgo=@protonmail.com> |
How can I pass a pattern. Without checking a pattern I get an enormous
long list of matching function names.
(defun mazonas-smbptn (smb pattern file)
"Filter symbol SYM defined in a specific file that are currently loaded."
(when (and (fboundp smb)
(string= (symbol-file smb) file)
(commandp smb)
(string-match-p pattern (symbol-name smb)))
smb))
(defun mazonas-agfun (file pattern)
"List all interactive functions defined in FILE."
(interactive
(list
(read-file-name "File: ")
(read-regexp "Symbol Pattern (RET for all): ")))
(let (smbs)
(when (find-file-noselect file)
(mapatoms (lambda (smb)
(when (mazonas-smbptn smb pattern file)
(push smb smbs))))
(message "Interactive functions: %s"
(seq-filter #'commandp smbs))
(seq-filter #'commandp smbs))))