From 081ca68d0355cc2433d6780b1c2f7d3c1f090156 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 26 Jan 2014 00:04:11 +0100 Subject: [PATCH] Don't use regex, use read --- edocs.el | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/edocs.el b/edocs.el index 54982af..0aa55de 100644 --- a/edocs.el +++ b/edocs.el @@ -93,21 +93,19 @@ etc." (let (ls) (save-excursion (goto-char (point-min)) - (while (re-search-forward - (rx (and bol ?\( - (group (or "defun" "defgroup" "defcustom" "defvar" - "defclass" "defgeneric" "defconst" - "define-minor-mode" "defface")) - " " - (group (1+ (not (any space ?\n ?\))))))) - nil :noerror) - (let ((type (buffer-substring-no-properties - (match-beginning 1) (match-end 1))) - (name (buffer-substring-no-properties - (match-beginning 2) (match-end 2)))) - (unless (string-match edocs-private-regexp name) - (setq ls (cons (cons type name) ls)))))) - (reverse ls))) + (condition-case nil + (while t + (let ((expr (read (current-buffer)))) + (when (member (car expr) + '(defun defgroup defcustom defvar + defclass defgeneric defconst + define-minor-mode defface)) + (let ((type (symbol-name (car expr))) + (name (symbol-name (cadr expr)))) + (unless (string-match edocs-private-regexp name) + (push (cons type name) ls)))))) + (end-of-file nil)) + (reverse ls)))) (defun edocs--get-docs (type name) "Get docs of TYPE for symbol NAME."