From: Stefan Monnier Date: Wed, 7 Sep 2011 01:06:09 +0000 (-0400) Subject: * lisp/emacs-lisp/find-func.el (find-function-C-source): Only set X-Git-Tag: emacs-pretest-24.0.90~104^2~149 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=77694924d89ca42fbf115391baf26be00fd074ca;p=emacs.git * lisp/emacs-lisp/find-func.el (find-function-C-source): Only set find-function-C-source-directory after checking that we found a source file there. Fixes: debbugs:9440 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d82391d691a..979708e2c91 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-09-07 Stefan Monnier + + * emacs-lisp/find-func.el (find-function-C-source): Only set + find-function-C-source-directory after checking that we found a source + file there (bug#9440). + 2011-09-06 Alan Mackenzie * isearch.el (isearch-other-meta-char): Wherever a key list is diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 2c7208db8a3..08e73b32a15 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -198,13 +198,14 @@ If FUNC is not the symbol of an advised function, just returns FUNC." (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." - (unless find-function-C-source-directory - (setq find-function-C-source-directory - (read-directory-name "Emacs C source dir: " nil nil t))) - (setq file (expand-file-name file find-function-C-source-directory)) - (unless (file-readable-p file) - (error "The C source file %s is not available" - (file-name-nondirectory file))) + (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