• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/emacs-lisp/

Lines Matching +defs:find +defs:face

0 ;;; find-func.el --- find the definition of the Emacs Lisp function near point
32 ;; ;;; find-func
33 ;; (find-function-setup-keys)
37 ;; (load "find-func")
44 ;; ("help.el") and `fff-find-loaded-emacs-lisp-function' (Noah Friedman's
53 (defgroup find-function nil
55 ;; :prefix "find-function"
58 (defconst find-function-space-re "\\(?:\\s-\\|\n\\|;.*\n\\)+")
60 (defcustom find-function-regexp
69 find-function-space-re
71 "The regexp used by `find-function' to search for a function definition.
78 :group 'find-function
81 (defcustom find-variable-regexp
85 find-function-space-re
87 "The regexp used by `find-variable' to search for a variable definition.
94 :group 'find-function
97 (defcustom find-face-regexp
98 (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
99 "The regexp used by `find-face' to search for a face definition.
101 should insert the face name.
105 :group 'find-function
108 (defvar find-function-regexp-alist
109 '((nil . find-function-regexp)
110 (defvar . find-variable-regexp)
111 (defface . find-face-regexp))
115 (put 'find-function-regexp-alist 'risky-local-variable t)
117 (defcustom find-function-source-path nil
118 "The default list of directories where `find-function' searches.
120 If this variable is nil then `find-function' searches `load-path' by
123 :group 'find-function)
125 (defcustom find-function-recenter-line 1
128 See `find-function' and `find-variable'."
131 :group 'find-function
134 (defcustom find-function-after-hook nil
137 See the functions `find-function' and `find-variable'."
138 :group 'find-function
143 (defun find-library-suffixes ()
148 (defun find-library-name (library)
150 ;; If the library is byte-compiled, try to find a source library by
155 (or find-function-source-path load-path)
156 (append (find-library-suffixes) load-file-rep-suffixes))
157 (error "Can't find library %s" library)))
159 (defvar find-function-C-source-directory
164 If nil, do not try to find the source code of functions and variables
167 (defun find-function-C-source (fun-or-var file type)
169 TYPE should be nil to find a function, or `defvar' to find a variable."
170 (unless find-function-C-source-directory
171 (setq find-function-C-source-directory
173 (setq file (expand-file-name file find-function-C-source-directory))
179 (with-current-buffer (find-file-noselect file)
190 (error "Can't find source for %s" fun-or-var))
194 (defun find-library (library)
200 (cons (or find-function-source-path load-path)
201 (find-library-suffixes)))))
202 (let ((buf (find-file-noselect (find-library-name library))))
206 (defun find-function-search-for-symbol (symbol type library)
213 and it is interpreted via `find-function-regexp-alist'.
222 (find-function-C-source symbol (match-string 1 library) type)
225 (let* ((filename (find-library-name library))
226 (regexp-symbol (cdr (assq type find-function-regexp-alist))))
227 (with-current-buffer (find-file-noselect filename)
242 ;; if `regexp' can't find the definition, we look for
248 (concat "^([^ ]+" find-function-space-re "['(]?"
258 (defun find-function-noselect (function)
267 searched for in `find-function-source-path' if non-nil, otherwise
291 (find-function-search-for-symbol function nil library))))
293 (defun find-function-read (&optional type)
308 (defface . "face")))))
324 (defun find-function-do-it (symbol type switch-fn)
329 The variable `find-function-recenter-line' controls how
332 See also `find-function-after-hook'.
339 (find-definition-noselect symbol type)))
347 (recenter find-function-recenter-line)
348 (run-hooks 'find-function-after-hook))))
351 (defun find-function (function)
360 `find-function-source-path', if non-nil, otherwise in `load-path'.
361 See also `find-function-recenter-line' and `find-function-after-hook'."
362 (interactive (find-function-read))
363 (find-function-do-it function nil 'switch-to-buffer))
366 (defun find-function-other-window (function)
369 See `find-function' for more details."
370 (interactive (find-function-read))
371 (find-function-do-it function nil 'switch-to-buffer-other-window))
374 (defun find-function-other-frame (function)
377 See `find-function' for more details."
378 (interactive (find-function-read))
379 (find-function-do-it function nil 'switch-to-buffer-other-frame))
382 (defun find-variable-noselect (variable &optional file)
390 `find-function-source-path', if non-nil, otherwise in `load-path'."
396 (find-function-search-for-symbol variable 'defvar library))))
399 (defun find-variable (variable)
409 `find-function-source-path', if non-nil, otherwise in `load-path'.
410 See also `find-function-recenter-line' and `find-function-after-hook'."
411 (interactive (find-function-read 'defvar))
412 (find-function-do-it variable 'defvar 'switch-to-buffer))
415 (defun find-variable-other-window (variable)
418 See `find-variable' for more details."
419 (interactive (find-function-read 'defvar))
420 (find-function-do-it variable 'defvar 'switch-to-buffer-other-window))
423 (defun find-variable-other-frame (variable)
426 See `find-variable' for more details."
427 (interactive (find-function-read 'defvar))
428 (find-function-do-it variable 'defvar 'switch-to-buffer-other-frame))
431 (defun find-definition-noselect (symbol type &optional file)
435 variable, `defface' for a face. This function does not switch to the
439 `find-function-source-path', if non-nil, otherwise in `load-path'."
444 (find-function-noselect symbol))
446 (find-variable-noselect symbol file))
449 (find-function-search-for-symbol symbol type library)))))
451 ;; For symmetry, this should be called find-face; but some programs
454 (defun find-face-definition (face)
457 Finds the Emacs Lisp library containing the definition of the face
464 `find-function-source-path', if non-nil, otherwise in `load-path'.
465 See also `find-function-recenter-line' and `find-function-after-hook'."
466 (interactive (find-function-read 'defface))
467 (find-function-do-it face 'defface 'switch-to-buffer))
470 (defun find-function-on-key (key)
494 (find-function-other-window defn))))))
497 (defun find-function-at-point ()
502 (find-function-other-window symb))))
505 (defun find-variable-at-point ()
510 (find-variable-other-window symb))))
513 (defun find-function-setup-keys ()
514 "Define some key bindings for the find-function family of functions."
515 (define-key ctl-x-map "F" 'find-function)
516 (define-key ctl-x-4-map "F" 'find-function-other-window)
517 (define-key ctl-x-5-map "F" 'find-function-other-frame)
518 (define-key ctl-x-map "K" 'find-function-on-key)
519 (define-key ctl-x-map "V" 'find-variable)
520 (define-key ctl-x-4-map "V" 'find-variable-other-window)
521 (define-key ctl-x-5-map "V" 'find-variable-other-frame))
523 (provide 'find-func)
526 ;;; find-func.el ends here