changeset 4540:7e01763ea656

Correct a misunderstanding of the semantics of #'return in #'symbol-file. 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * loadhist.el (symbol-file): Use #'defun*, not #'defun, to allow the checks for autoloaded functions and variables to call #'return-from correctly. Use #'return-from instead of #'return throughout the function.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Dec 2008 16:02:25 +0000
parents 061e030e3270
children 0c410b5b387a
files lisp/ChangeLog lisp/loadhist.el
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Dec 27 14:05:50 2008 +0000
+++ b/lisp/ChangeLog	Sat Dec 27 16:02:25 2008 +0000
@@ -1,3 +1,10 @@
+2008-12-27  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* loadhist.el (symbol-file): 
+	Use #'defun*, not #'defun, to allow the checks for autoloaded
+	functions and variables to call #'return-from correctly. Use
+	#'return-from instead of #'return throughout the function. 
+
 2008-12-27  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* loadup.el (load-history): 
--- a/lisp/loadhist.el	Sat Dec 27 14:05:50 2008 +0000
+++ b/lisp/loadhist.el	Sat Dec 27 16:02:25 2008 +0000
@@ -41,7 +41,7 @@
 
 ;; XEmacs; this function is in subr.el in GNU, and does not deal with
 ;; built-in symbols.
-(defun symbol-file (sym &optional type)
+(defun* symbol-file (sym &optional type)
   "Return the input source from which SYM was loaded.
 This is a file name, or nil if the source was a buffer with no associated file.
 
@@ -63,26 +63,26 @@
                          (eq (fifth autoload-cons) 'keymap))
                     (and (or (null type) (eq 'defun type))
                          (memq (fifth autoload-cons) '(nil macro)))))
-           (return (locate-library (second autoload-cons))))
+           (return-from symbol-file (locate-library (second autoload-cons))))
           ((eq 'defvar type)
            ;; Load history entries corresponding to variables are just
            ;; symbols.
            (dolist (entry load-history)
              (when (memq sym (cdr entry))
-               (return (car entry)))))
+               (return-from symbol-file (car entry)))))
            ((not (null type))
             ;; Non-variables have the type stored as the car of the entry. 
             (dolist (entry load-history)
               (when (and (setq symbol-details (rassq sym (cdr entry)))
                          (eq type (car symbol-details)))
-                (return (car entry)))))
+                (return-from symbol-file (car entry)))))
           (t
            ;; If TYPE hasn't been specified, we need to check both for
            ;; variables and other symbols.
            (dolist (entry load-history)
              (when (or (memq sym (cdr entry))
                        (rassq sym (cdr entry)))
-               (return (car entry))))))
+               (return-from symbol-file (car entry))))))
     (when (setq built-in-file (built-in-symbol-file sym type))
       (if (equal built-in-file (file-truename built-in-file))
           ;; Probably a full path name: