443 |
;;;###autoload |
;;;###autoload |
444 |
(defun help-xref-on-pp (from to) |
(defun help-xref-on-pp (from to) |
445 |
"Add xrefs for symbols in `pp's output between FROM and TO." |
"Add xrefs for symbols in `pp's output between FROM and TO." |
446 |
(let ((ost (syntax-table))) |
(if (> (- to from) 5000) nil |
447 |
(unwind-protect |
(with-syntax-table emacs-lisp-mode-syntax-table |
448 |
(save-excursion |
(save-excursion |
449 |
(save-restriction |
(save-restriction |
450 |
(set-syntax-table emacs-lisp-mode-syntax-table) |
(narrow-to-region from to) |
451 |
(narrow-to-region from to) |
(goto-char (point-min)) |
452 |
(goto-char (point-min)) |
(condition-case nil |
453 |
(condition-case nil |
(while (not (eobp)) |
454 |
(while (not (eobp)) |
(cond |
455 |
(cond |
((looking-at "\"") (forward-sexp 1)) |
456 |
((looking-at "\"") (forward-sexp 1)) |
((looking-at "#<") (search-forward ">" nil 'move)) |
457 |
((looking-at "#<") (search-forward ">" nil 'move)) |
((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") |
458 |
((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") |
(let* ((sym (intern-soft (match-string 1))) |
459 |
(let* ((sym (intern-soft (match-string 1))) |
(type (cond ((fboundp sym) 'help-function) |
460 |
(type (cond ((fboundp sym) 'help-function) |
((or (memq sym '(t nil)) |
461 |
((or (memq sym '(t nil)) |
(keywordp sym)) |
462 |
(keywordp sym)) |
nil) |
463 |
nil) |
((and sym (boundp sym)) |
464 |
((and sym (boundp sym)) |
'help-variable)))) |
465 |
'help-variable)))) |
(when type (help-xref-button 1 type sym))) |
466 |
(when type (help-xref-button 1 type sym))) |
(goto-char (match-end 1))) |
467 |
(goto-char (match-end 1))) |
(t (forward-char 1)))) |
468 |
(t (forward-char 1)))) |
(error nil))))))) |
|
(error nil)))) |
|
|
(set-syntax-table ost)))) |
|
469 |
|
|
470 |
|
|
471 |
;; Additional functions for (re-)creating types of help buffers. |
;; Additional functions for (re-)creating types of help buffers. |