changeset 49690:e2f33e589249

(help-xref-on-pp): Only add xref if the text is less than 5K.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 10 Feb 2003 21:52:30 +0000
parents 278d7d142185
children 0eed24634607
files lisp/help-mode.el
diffstat 1 files changed, 23 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help-mode.el	Mon Feb 10 21:50:00 2003 +0000
+++ b/lisp/help-mode.el	Mon Feb 10 21:52:30 2003 +0000
@@ -443,31 +443,29 @@
 ;;;###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.