Don't use regex, use read

This commit is contained in:
Tom Willemse 2014-01-26 00:04:11 +01:00
parent d99ecc0b2c
commit 081ca68d03

View file

@ -93,21 +93,19 @@ etc."
(let (ls) (let (ls)
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward (condition-case nil
(rx (and bol ?\( (while t
(group (or "defun" "defgroup" "defcustom" "defvar" (let ((expr (read (current-buffer))))
"defclass" "defgeneric" "defconst" (when (member (car expr)
"define-minor-mode" "defface")) '(defun defgroup defcustom defvar
" " defclass defgeneric defconst
(group (1+ (not (any space ?\n ?\))))))) define-minor-mode defface))
nil :noerror) (let ((type (symbol-name (car expr)))
(let ((type (buffer-substring-no-properties (name (symbol-name (cadr expr))))
(match-beginning 1) (match-end 1)))
(name (buffer-substring-no-properties
(match-beginning 2) (match-end 2))))
(unless (string-match edocs-private-regexp name) (unless (string-match edocs-private-regexp name)
(setq ls (cons (cons type name) ls)))))) (push (cons type name) ls))))))
(reverse ls))) (end-of-file nil))
(reverse ls))))
(defun edocs--get-docs (type name) (defun edocs--get-docs (type name)
"Get docs of TYPE for symbol NAME." "Get docs of TYPE for symbol NAME."