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

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

Re: Return list of variables name symbols (or strings) in Emacs Lisp (pr


From: Emanuel Berg
Subject: Re: Return list of variables name symbols (or strings) in Emacs Lisp (programmatically)
Date: Tue, 22 Sep 2015 04:42:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Alexander Shukaev <haroogan@gmail.com> writes:

> When doing C-h v magit*section-map TAB, the
> corresponding completion list is shown. Is there an
> equivalent function which would accept such a wild
> card and return the same list? E.g.
>
> (var-symbols "magit*section-map")

(defun get-regexp-vars (regexp)
  (let ((vars '()))
    (mapatoms (lambda (a) (when (and (boundp a)
                                     (string-match regexp (symbol-name a)) )
                            (push a vars) )))
    vars))

;; some testing
(length (get-regexp-vars "gnus-.*")) ; 1109
(length (get-regexp-vars "w3m-.*"))  ; 445

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




reply via email to

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