help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

get all functions (was: Re: How to quote a list of functions?)


From: Emanuel Berg
Subject: get all functions (was: Re: How to quote a list of functions?)
Date: Thu, 20 Aug 2015 00:15:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

> You should consider more closely my examples with
> cl-flet. Compare:
>
>     (cl-flet ((w3m () (interactive) (message "doh!")))
> (call-interactively #'w3m))
>
> with:
>
>     (cl-flet ((w3m () (interactive) (message "doh!")))
> (call-interactively 'w3m))

Yes, so #'w3m is correct.

Anyway, I have written something that will catch
quoted functions in source. That way they can be
considered very fast (because from the hit list, RET
will take you to that line in that file) - only one
problem, and that is the obarray doesn't seem to hold
all functions - one example is `w3m', but confusingly
many other w3m- functions are included!

If that detail can be sorted out (getting all
functions) this can be done very quickly for a large
amount of files and code lines!

;; This file:
;;   http://user.it.uu.se/~embe8573/conf/emacs-init/list-quoted-functions.el
;;
;; Required:
;;   http://user.it.uu.se/~embe8573/conf/emacs-init/search-regexp-in-files.el

;; Test on this very file:
;;
;; catch me:
;; (put 'custom-comment-hide 'disabled nil)
;;
;; don't catch me:
;; (custom-comment-hide oh-oh-oh)

(require 'search-regexp-in-files)
(require 'cl)

(defun list-quoted-functions ()
  (interactive)
  (let*((funs (mapcar
               (lambda (f) (format "%s\\|" f))
               (cl-remove-if-not 'fboundp obarray)))
        (funs-str (apply `(concatenate string ,@funs)))
        (funs-regexp
         (concatenate 'string
            "'\\(" (substring funs-str 0 (- (length funs-str) 2))  "\\)" )))
    (search-regexp-in-files
     "~/.emacs.d/emacs-init/**/*.el"
     funs-regexp) ))

;; (list-quoted-functions)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]