]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/find-func.el (find-function-C-source): Only set
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 7 Sep 2011 01:06:09 +0000 (21:06 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 7 Sep 2011 01:06:09 +0000 (21:06 -0400)
find-function-C-source-directory after checking that we found a source
file there.

Fixes: debbugs:9440
lisp/ChangeLog
lisp/emacs-lisp/find-func.el

index d82391d691a6d03f5c2f0305e1f0b4698d705520..979708e2c919c77c264207dbbdb4a4f2bc75af46 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * 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  <acm@muc.de>
 
        * isearch.el (isearch-other-meta-char): Wherever a key list is
index 2c7208db8a30fa857dbbec76fdd354cd8e42d62a..08e73b32a151c602c892784c44ed13c610ea3b3e 100644 (file)
@@ -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