emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#9440: closed (24.0.50; bad error handling in find-


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#9440: closed (24.0.50; bad error handling in find-function-C-source-directory)
Date: Wed, 07 Sep 2011 01:11:02 +0000

Your message dated Tue, 06 Sep 2011 21:06:47 -0400
with message-id <address@hidden>
and subject line Re: bug#9440: 24.0.50; bad error handling in 
find-function-C-source-directory
has caused the GNU bug report #9440,
regarding 24.0.50; bad error handling in find-function-C-source-directory
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
9440: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9440
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.0.50; bad error handling in find-function-C-source-directory Date: Mon, 5 Sep 2011 15:27:10 +0300
How to reproduce:

Make sure that source-directory used to build Emacs does not currently
exist. Run Emacs and try to find implementation of, for example, `eq':

 C-h f eq RET
 C-x o
 TAB
 RET

Now, suppose, you do not know what exactly `Emacs C source dir' means
and thus you enter say, `~/emacs/trunk'. Now you get

 find-function-C-source: The C source file data.c is not available

and guess that the directory should actually be `~/emacs/trunk/src'.
You try to correct the mistake by repeating the process (pressing RET
on `C source code'), but now you are not asked about the directory and
simply get the same error message again.


To avoid the problem, Emacs should check that the directory indeed
contains Emacs C sources. It is also a good idea to try to silently
fix user's mistake by appending "src" to the directory he entered. The
following patch fixes the problem:

=== modified file 'lisp/emacs-lisp/find-func.el'
--- lisp/emacs-lisp/find-func.el        2011-08-21 17:43:31 +0000
+++ lisp/emacs-lisp/find-func.el        2011-09-05 11:59:04 +0000
@@ -181,7 +181,7 @@
     (when (and (file-directory-p dir) (file-readable-p dir))
       dir))
   "Directory where the C source files of Emacs can be found.
-If nil, do not try to find the source code of functions and variables
+If nil, ask user when he tries to find the source code of functions and 
variables
 defined in C.")

 (declare-function ad-get-advice-info "advice" (function))
@@ -200,7 +200,14 @@
 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)))
+          (let ((dir (read-directory-name "Emacs C source dir: " nil nil t)))
+            (if (file-readable-p (expand-file-name "emacs.c" dir))
+                dir
+              ;; otherwise try to add "src"
+              (let ((dir-src (expand-file-name "src" dir)))
+                (if (file-readable-p (expand-file-name "emacs.c" dir-src))
+                    dir-src
+                  (error "%s does not contain Emacs C sources" dir)))))))
   (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"

-- 
Regards,
ASK



--- End Message ---
--- Begin Message --- Subject: Re: bug#9440: 24.0.50; bad error handling in find-function-C-source-directory Date: Tue, 06 Sep 2011 21:06:47 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
> and guess that the directory should actually be `~/emacs/trunk/src'.
> You try to correct the mistake by repeating the process (pressing RET
> on `C source code'), but now you are not asked about the directory and
> simply get the same error message again.

Thanks.  I've installed a similar change,


        Stefan


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]