emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/autoload.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/autoload.el,v
Date: Tue, 26 Jun 2007 19:07:16 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        07/06/26 19:07:15

Index: emacs-lisp/autoload.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/autoload.el,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- emacs-lisp/autoload.el      25 Jun 2007 16:19:05 -0000      1.124
+++ emacs-lisp/autoload.el      26 Jun 2007 19:07:14 -0000      1.125
@@ -68,6 +68,8 @@
 (defconst generate-autoload-section-continuation ";;;;;; "
   "String to add on each continuation of the section header form.")
 
+(defvar autoload-modified-buffers)      ;Dynamically scoped var.
+
 (defun make-autoload (form file)
   "Turn FORM into an autoload or defvar for source file FILE.
 Returns nil if FORM is not a special autoload form (i.e. a function definition
@@ -157,16 +159,6 @@
                     (expand-file-name "lisp"
                                       source-directory)))
 
-(defun autoload-trim-file-name (file)
-  ;; Returns a relative file path for FILE
-  ;; starting from the directory that loaddefs.el is in.
-  ;; That is normally a directory in load-path,
-  ;; which means Emacs will be able to find FILE when it looks.
-  ;; Any extra directory names here would prevent finding the file.
-  (setq file (expand-file-name file))
-  (file-relative-name file
-                     (file-name-directory generated-autoload-file)))
-
 (defun autoload-read-section-header ()
   "Read a section header form.
 Since continuation lines have been marked as comments,
@@ -260,9 +252,7 @@
   "Insert the section-header line,
 which lists the file name and which functions are in it, etc."
   (insert generate-autoload-section-header)
-  (prin1 (list 'autoloads autoloads load-name
-              (if (stringp file) (autoload-trim-file-name file) file)
-              time)
+  (prin1 (list 'autoloads autoloads load-name file time)
         outbuf)
   (terpri outbuf)
   ;; Break that line at spaces, to avoid very long lines.
@@ -318,10 +308,9 @@
 If FILE is being visited in a buffer, the contents of the buffer are used.
 OUTBUF is the buffer in which the autoload statements will be inserted.
 If OUTBUF is nil, it will be determined by `autoload-generated-file'.
-Return non-nil in the case where no autoloads were added to OUTBUF.
 
-Can throw `up-to-date' to mean that the entries were found already and are
-up-to-date.  Of course, this can only be the case if OUTBUF is not used."
+Return non-nil iff FILE adds no autoloads to OUTBUF."
+  (catch 'done
   (let ((autoloads-done '())
        (load-name (autoload-file-load-name file))
        (print-length nil)
@@ -350,7 +339,11 @@
                 ;; If not done yet, figure out where to insert this text.
                 (unless output-start
                   (unless outbuf
-                    (setq outbuf (autoload-find-destination absfile)))
+                      (setq outbuf (autoload-find-destination absfile))
+                      (unless outbuf
+                        ;; The file has autoload cookies, but they're
+                        ;; already up-to-date.
+                        (throw 'done t)))
                   (with-current-buffer outbuf
                     (setq relfile (file-relative-name absfile))
                     (setq output-start (point)))
@@ -406,9 +399,7 @@
       (or visited
           ;; We created this buffer, so we should kill it.
           (kill-buffer (current-buffer))))
-    (not output-start)))
-
-(defvar autoload-modified-buffers nil)
+      (not output-start))))
 
 (defun autoload-save-buffers ()
   (while autoload-modified-buffers
@@ -424,28 +415,24 @@
 
 Return FILE if there was no autoload cookie in it, else nil."
   (interactive "fUpdate autoloads for file: \np")
-  (let ((no-autoloads nil))
-    (if (catch 'up-to-date
-          (progn
-            (setq no-autoloads (autoload-generate-file-autoloads file))
-            t))
+  (let* ((autoload-modified-buffers nil)
+         (no-autoloads (autoload-generate-file-autoloads file)))
+    (if autoload-modified-buffers
         (if save-after (autoload-save-buffers))
       (if (interactive-p)
           (message "Autoload section for %s is up to date." file)))
-    ;; If we caught `up-to-date', it means there are autoload entries, since
-    ;; otherwise we wouldn't have detected their up-to-dateness.
     (if no-autoloads file)))
 
 (defun autoload-find-destination (file)
   "Find the destination point of the current buffer's autoloads.
 FILE is the file name of the current buffer.
 Returns a buffer whose point is placed at the requested location.
-Throws `up-to-date' if the file's autoloads are uptodate, otherwise
+Returns nil if the file's autoloads are uptodate, otherwise
 removes any prior now out-of-date autoload entries.
 The current buffer only matters if it is visiting a file or if it has a 
buffer-local
 value for some variables such as `generated-autoload-file', so it's OK
 to call it from a dummy buffer if FILE is not currently visited."
-  ;; (message "autoload-find-destination %S" file)
+  (catch 'up-to-date
   (let ((load-name (autoload-file-load-name file))
         (existing-buffer (if buffer-file-name (current-buffer)))
        (found nil))
@@ -495,7 +482,7 @@
             (search-backward "\f" nil t)))
       (unless (memq (current-buffer) autoload-modified-buffers)
         (push (current-buffer) autoload-modified-buffers))
-      (current-buffer))))
+        (current-buffer)))))
 
 (defun autoload-remove-section (begin)
   (goto-char begin)
@@ -533,8 +520,8 @@
       (save-excursion
 
        ;; Canonicalize file names and remove the autoload file itself.
-       (setq files (delete (autoload-trim-file-name buffer-file-name)
-                           (mapcar 'autoload-trim-file-name files)))
+       (setq files (delete (file-relative-name buffer-file-name)
+                           (mapcar 'file-relative-name files)))
 
        (goto-char (point-min))
        (while (search-forward generate-autoload-section-header nil t)




reply via email to

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