Mercurial > emacs
comparison lisp/help-mode.el @ 54748:8143853620d8
(help-function-def, help-variable-def): Handle hyperrefs
to C source files specially.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 07 Apr 2004 19:35:05 +0000 |
parents | a0b481c8f7d5 |
children | bdfa0aa8c425 |
comparison
equal
deleted
inserted
replaced
54747:bdc00a83ecd1 | 54748:8143853620d8 |
---|---|
1 ;;; help-mode.el --- `help-mode' used by *Help* buffers | 1 ;;; help-mode.el --- `help-mode' used by *Help* buffers |
2 | 2 |
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002 | 3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Maintainer: FSF | 6 ;; Maintainer: FSF |
7 ;; Keywords: help, internal | 7 ;; Keywords: help, internal |
8 | 8 |
148 'help-function (lambda (fun file) | 148 'help-function (lambda (fun file) |
149 (require 'find-func) | 149 (require 'find-func) |
150 ;; Don't use find-function-noselect because it follows | 150 ;; Don't use find-function-noselect because it follows |
151 ;; aliases (which fails for built-in functions). | 151 ;; aliases (which fails for built-in functions). |
152 (let ((location | 152 (let ((location |
153 (if (bufferp file) (cons file fun) | 153 (cond |
154 (find-function-search-for-symbol fun nil file)))) | 154 ((bufferp file) (cons file fun)) |
155 ((string-match "\\`src/\\(.*\\.c\\)" file) | |
156 (help-find-C-source fun (match-string 1 file) 'fun)) | |
157 (t (find-function-search-for-symbol fun nil file))))) | |
155 (pop-to-buffer (car location)) | 158 (pop-to-buffer (car location)) |
156 (goto-char (cdr location)))) | 159 (goto-char (cdr location)))) |
157 'help-echo (purecopy "mouse-2, RET: find function's definition")) | 160 'help-echo (purecopy "mouse-2, RET: find function's definition")) |
158 | 161 |
159 (define-button-type 'help-variable-def | 162 (define-button-type 'help-variable-def |
160 :supertype 'help-xref | 163 :supertype 'help-xref |
161 'help-function (lambda (var &optional file) | 164 'help-function (lambda (var &optional file) |
162 (let ((location | 165 (let ((location |
163 (find-variable-noselect var file))) | 166 (cond |
167 ((string-match "\\`src/\\(.*\\.c\\)" file) | |
168 (help-find-C-source var (match-string 1 file) 'var)) | |
169 (t (find-variable-noselect var file))))) | |
164 (pop-to-buffer (car location)) | 170 (pop-to-buffer (car location)) |
165 (goto-char (cdr location)))) | 171 (goto-char (cdr location)))) |
166 'help-echo (purecopy"mouse-2, RET: find variable's definition")) | 172 'help-echo (purecopy"mouse-2, RET: find variable's definition")) |
167 | 173 |
168 | 174 |