diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-02-10 21:52:30 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-02-10 21:52:30 +0000 |
commit | 22f5d492084be45add196d8ecc3a1280b43260cd (patch) | |
tree | 6aaff106bf3e3d781e7a81dcb0a45570cea541a8 /lisp/help-mode.el | |
parent | 389fe8885e51e6e294b7f87e4ebea4a2f74f3a43 (diff) | |
download | emacs-22f5d492084be45add196d8ecc3a1280b43260cd.tar.gz |
(help-xref-on-pp): Only add xref if the text is less than 5K.
Diffstat (limited to 'lisp/help-mode.el')
-rw-r--r-- | lisp/help-mode.el | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 904d08f7519..03a711115db 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -443,31 +443,29 @@ See `help-make-xrefs'." ;;;###autoload (defun help-xref-on-pp (from to) "Add xrefs for symbols in `pp's output between FROM and TO." - (let ((ost (syntax-table))) - (unwind-protect - (save-excursion - (save-restriction - (set-syntax-table emacs-lisp-mode-syntax-table) - (narrow-to-region from to) - (goto-char (point-min)) - (condition-case nil - (while (not (eobp)) - (cond - ((looking-at "\"") (forward-sexp 1)) - ((looking-at "#<") (search-forward ">" nil 'move)) - ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") - (let* ((sym (intern-soft (match-string 1))) - (type (cond ((fboundp sym) 'help-function) - ((or (memq sym '(t nil)) - (keywordp sym)) - nil) - ((and sym (boundp sym)) - 'help-variable)))) - (when type (help-xref-button 1 type sym))) - (goto-char (match-end 1))) - (t (forward-char 1)))) - (error nil)))) - (set-syntax-table ost)))) + (if (> (- to from) 5000) nil + (with-syntax-table emacs-lisp-mode-syntax-table + (save-excursion + (save-restriction + (narrow-to-region from to) + (goto-char (point-min)) + (condition-case nil + (while (not (eobp)) + (cond + ((looking-at "\"") (forward-sexp 1)) + ((looking-at "#<") (search-forward ">" nil 'move)) + ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") + (let* ((sym (intern-soft (match-string 1))) + (type (cond ((fboundp sym) 'help-function) + ((or (memq sym '(t nil)) + (keywordp sym)) + nil) + ((and sym (boundp sym)) + 'help-variable)))) + (when type (help-xref-button 1 type sym))) + (goto-char (match-end 1))) + (t (forward-char 1)))) + (error nil))))))) ;; Additional functions for (re-)creating types of help buffers. |