Function: find-function-C-source
find-function-C-source is a byte-compiled function defined in
find-func.el.gz.
Signature
(find-function-C-source FUN-OR-VAR FILE TYPE)
Documentation
Find the source location where FUN-OR-VAR is defined in FILE.
TYPE should be nil to find a function, or defvar to find a variable.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/find-func.el.gz
(defun find-function-C-source (fun-or-var file type)
"Find the source location where FUN-OR-VAR is defined in FILE.
TYPE should be nil to find a function, or `defvar' to find a variable."
(let ((dir (or find-function-C-source-directory
(read-directory-name "Emacs C source dir: " nil nil t))))
(setq file (expand-file-name file dir))
(if (file-readable-p file)
(if (null find-function-C-source-directory)
(setq find-function-C-source-directory dir))
(error "The C source file %s is not available"
(file-name-nondirectory file))))
(unless type
;; Either or both an alias and its target might be advised.
(setq fun-or-var (find-function-advised-original
(indirect-function
(find-function-advised-original fun-or-var)))))
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(unless (re-search-forward
(if type
(concat "DEFVAR[A-Z_]*[ \t\n]*([ \t\n]*\""
(regexp-quote (symbol-name fun-or-var))
"\"")
(concat "DEFUN[ \t\n]*([ \t\n]*\""
(regexp-quote (subr-name (advice--cd*r fun-or-var)))
"\""))
nil t)
(error "Can't find source for %s" fun-or-var))
(cons (current-buffer) (match-beginning 0))))