comparison lisp/help-mode.el @ 72063:52eeda6a8959

(help-function-def, help-variable-def) (help-face-def): Print a message in the minibuffer.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 21 Jul 2006 22:54:40 +0000
parents 5da49f1eb585
children e3694f1cb928 858cb33ae39d
comparison
equal deleted inserted replaced
72062:7b81ccd702d9 72063:52eeda6a8959
155 ;; Don't use find-function-noselect because it follows 155 ;; Don't use find-function-noselect because it follows
156 ;; aliases (which fails for built-in functions). 156 ;; aliases (which fails for built-in functions).
157 (let ((location 157 (let ((location
158 (find-function-search-for-symbol fun nil file))) 158 (find-function-search-for-symbol fun nil file)))
159 (pop-to-buffer (car location)) 159 (pop-to-buffer (car location))
160 (when (cdr location) 160 (if (cdr location)
161 (goto-char (cdr location))))) 161 (goto-char (cdr location))
162 (message "Unable to find location in file"))))
162 'help-echo (purecopy "mouse-2, RET: find function's definition")) 163 'help-echo (purecopy "mouse-2, RET: find function's definition"))
163 164
164 (define-button-type 'help-variable-def 165 (define-button-type 'help-variable-def
165 :supertype 'help-xref 166 :supertype 'help-xref
166 'help-function (lambda (var &optional file) 167 'help-function (lambda (var &optional file)
167 (when (eq file 'C-source) 168 (when (eq file 'C-source)
168 (setq file (help-C-file-name var 'var))) 169 (setq file (help-C-file-name var 'var)))
169 (let ((location (find-variable-noselect var file))) 170 (let ((location (find-variable-noselect var file)))
170 (pop-to-buffer (car location)) 171 (pop-to-buffer (car location))
171 (when (cdr location) 172 (if (cdr location)
172 (goto-char (cdr location))))) 173 (goto-char (cdr location))
174 (message "Unable to find location in file"))))
173 'help-echo (purecopy "mouse-2, RET: find variable's definition")) 175 'help-echo (purecopy "mouse-2, RET: find variable's definition"))
174 176
175 (define-button-type 'help-face-def 177 (define-button-type 'help-face-def
176 :supertype 'help-xref 178 :supertype 'help-xref
177 'help-function (lambda (fun file) 179 'help-function (lambda (fun file)
179 ;; Don't use find-function-noselect because it follows 181 ;; Don't use find-function-noselect because it follows
180 ;; aliases (which fails for built-in functions). 182 ;; aliases (which fails for built-in functions).
181 (let ((location 183 (let ((location
182 (find-function-search-for-symbol fun 'defface file))) 184 (find-function-search-for-symbol fun 'defface file)))
183 (pop-to-buffer (car location)) 185 (pop-to-buffer (car location))
184 (when (cdr location) 186 (if (cdr location)
185 (goto-char (cdr location))))) 187 (goto-char (cdr location))
188 (message "Unable to find location in file"))))
186 'help-echo (purecopy "mouse-2, RET: find face's definition")) 189 'help-echo (purecopy "mouse-2, RET: find face's definition"))
187 190
188 191
189 ;;;###autoload 192 ;;;###autoload
190 (defun help-mode () 193 (defun help-mode ()