comparison lisp/hyper-apropos.el @ 239:41f2f0e326e9 r20-5b18

Import from CVS: tag r20-5b18
author cvs
date Mon, 13 Aug 2007 10:15:48 +0200
parents 262b8bb4a523
children 677f6a0ee643
comparison
equal deleted inserted replaced
238:b5f2e56b938d 239:41f2f0e326e9
572 (while (re-search-forward 572 (while (re-search-forward
573 "`\\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)'" 573 "`\\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)'"
574 end 'limit) 574 end 'limit)
575 (let ((e (make-extent (match-beginning 1) (match-end 1)))) 575 (let ((e (make-extent (match-beginning 1) (match-end 1))))
576 (set-extent-face e 'hyper-apropos-hyperlink) 576 (set-extent-face e 'hyper-apropos-hyperlink)
577 (set-extent-property e 'mouse-face 'highlight)) 577 (set-extent-property e 'mouse-face 'highlight)))
578 (goto-char beg) 578 (goto-char beg)
579 (while (re-search-forward 579 (while (re-search-forward
580 "M-x \\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)" 580 "M-x \\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)"
581 end 'limit) 581 end 'limit)
582 (let ((e (make-extent (match-beginning 1) (match-end 1)))) 582 (let ((e (make-extent (match-beginning 1) (match-end 1))))
583 (set-extent-face e 'hyper-apropos-hyperlink) 583 (set-extent-face e 'hyper-apropos-hyperlink)
584 (set-extent-property e 'mouse-face 'highlight)))))) 584 (set-extent-property e 'mouse-face 'highlight)))))
585 585
586 (defun hyper-apropos-insert-keybinding (keys string) 586 (defun hyper-apropos-insert-keybinding (keys string)
587 (if keys 587 (if keys
588 (insert " (" string " bound to \"" 588 (insert " (" string " bound to \""
589 (mapconcat 'key-description 589 (mapconcat 'key-description
709 '((subr . "built-in ") 709 '((subr . "built-in ")
710 (bytecode . "compiled Lisp ") 710 (bytecode . "compiled Lisp ")
711 (autoload . "autoloaded Lisp ") 711 (autoload . "autoloaded Lisp ")
712 (lambda . "Lisp ")))) 712 (lambda . "Lisp "))))
713 desc 713 desc
714 (if (eq symtype 'autoload) 714 (case symtype
715 (format ", (autoloaded from \"%s\")" 715 ((autoload) (format ", (autoloaded from \"%s\")"
716 (nth 1 newsym)))) 716 (nth 1 newsym)))
717 ((bytecode) (format ", (loaded from \"%s\")"
718 (symbol-file symbol)))))
717 local (current-local-map) 719 local (current-local-map)
718 global (current-global-map) 720 global (current-global-map)
719 obsolete (get symbol 'byte-obsolete-info) 721 obsolete (get symbol 'byte-obsolete-info)
720 doc (or (documentation symbol) "function not documented")) 722 doc (or (documentation symbol) "function not documented"))
721 (save-excursion 723 (save-excursion
994 \\{hyper-apropos-help-map}" 996 \\{hyper-apropos-help-map}"
995 (setq buffer-read-only t 997 (setq buffer-read-only t
996 major-mode 'hyper-apropos-help-mode 998 major-mode 'hyper-apropos-help-mode
997 mode-name "Hyper-Help") 999 mode-name "Hyper-Help")
998 (set-syntax-table emacs-lisp-mode-syntax-table) 1000 (set-syntax-table emacs-lisp-mode-syntax-table)
999 (hyper-apropos-highlightify)
1000 (use-local-map hyper-apropos-help-map)) 1001 (use-local-map hyper-apropos-help-map))
1001
1002 ;; ---------------------------------------------------------------------- ;;
1003
1004 (defun hyper-apropos-highlightify ()
1005 (save-excursion
1006 (goto-char (point-min))
1007 (let ((st (point-min))
1008 sym)
1009 (while (not (eobp))
1010 (if (zerop (skip-syntax-forward "w_"))
1011 (forward-char 1)
1012 (and (> (- (point) st) 3)
1013 (setq sym (intern-soft (buffer-substring st (point))))
1014 (or (boundp sym)
1015 (fboundp sym))
1016 (set-extent-property (make-extent st (point))
1017 'mouse-face 'highlight)))
1018 (setq st (point))))))
1019 1002
1020 ;; ---------------------------------------------------------------------- ;; 1003 ;; ---------------------------------------------------------------------- ;;
1021 1004
1022 (defun hyper-apropos-scroll-up () 1005 (defun hyper-apropos-scroll-up ()
1023 "Scroll up the \"*Hyper Help*\" buffer if it's visible. 1006 "Scroll up the \"*Hyper Help*\" buffer if it's visible.