comparison lisp/emacs-lisp/autoload.el @ 7477:a01cc9d6398d

(autoload-trim-file-name): Make it relative to the directory that loaddefs.el is in.
author Richard M. Stallman <rms@gnu.org>
date Thu, 12 May 1994 18:54:57 +0000
parents 48059292485b
children bc5dccc5375f
comparison
equal deleted inserted replaced
7476:d1cbb5dd3434 7477:a01cc9d6398d
94 (put 'defvar 'doc-string-elt 3) 94 (put 'defvar 'doc-string-elt 3)
95 (put 'defconst 'doc-string-elt 3) 95 (put 'defconst 'doc-string-elt 3)
96 (put 'defmacro 'doc-string-elt 3) 96 (put 'defmacro 'doc-string-elt 3)
97 97
98 (defun autoload-trim-file-name (file) 98 (defun autoload-trim-file-name (file)
99 ;; Returns a relative pathname of FILE including the last directory. 99 ;; Returns a relative pathname of FILE
100 ;; starting from the directory that loaddefs.el is in.
101 ;; That is normally a directory in load-path,
102 ;; which means Emacs will be able to find FILE when it looks.
103 ;; Any extra directory names here would prevent finding the file.
100 (setq file (expand-file-name file)) 104 (setq file (expand-file-name file))
101 (file-relative-name file 105 (file-relative-name file
102 (file-name-directory 106 (file-name-directory generated-autoload-file)))
103 (directory-file-name
104 (file-name-directory file)))))
105 107
106 (defun generate-file-autoloads (file) 108 (defun generate-file-autoloads (file)
107 "Insert at point a loaddefs autoload section for FILE. 109 "Insert at point a loaddefs autoload section for FILE.
108 autoloads are generated for defuns and defmacros in FILE 110 autoloads are generated for defuns and defmacros in FILE
109 marked by `generate-autoload-cookie' (which see). 111 marked by `generate-autoload-cookie' (which see).
331 (file (nth 3 form))) 333 (file (nth 3 form)))
332 (if (and (stringp file) 334 (if (and (stringp file)
333 (or (get-file-buffer file) 335 (or (get-file-buffer file)
334 (file-exists-p file))) 336 (file-exists-p file)))
335 () 337 ()
336 (message "Can't find library \"%s\" (load file \"%s\")" 338 (setq file (if (y-or-n-p (format "Can't find library `%s'; remove its autoloads? "
337 (nth 2 form) file) 339 (nth 2 form) file))
338 (sit-for 2)
339 (setq file (if (y-or-n-p (format "Remove autoloads for \"%s\"? "
340 (nth 2 form)))
341 t 340 t
342 (condition-case () 341 (condition-case ()
343 (read-file-name (format "Find \"%s\" load file: " 342 (read-file-name (format "Find `%s' load file: "
344 (nth 2 form)) 343 (nth 2 form))
345 nil nil t) 344 nil nil t)
346 (quit nil))))) 345 (quit nil)))))
347 (if file 346 (if file
348 (let ((begin (match-beginning 0))) 347 (let ((begin (match-beginning 0)))
367 (defun batch-update-autoloads () 366 (defun batch-update-autoloads ()
368 "Update the autoloads for the files or directories on the command line. 367 "Update the autoloads for the files or directories on the command line.
369 Runs \\[update-file-autoloads] on files and \\[update-directory-autoloads] 368 Runs \\[update-file-autoloads] on files and \\[update-directory-autoloads]
370 on directories. Must be used only with -batch, and kills Emacs on completion. 369 on directories. Must be used only with -batch, and kills Emacs on completion.
371 Each file will be processed even if an error occurred previously. 370 Each file will be processed even if an error occurred previously.
372 For example, invoke \"emacs -batch -f batch-update-autoloads *.el\"" 371 For example, invoke `emacs -batch -f batch-update-autoloads *.el'."
373 (if (not noninteractive) 372 (if (not noninteractive)
374 (error "batch-update-autoloads is to be used only with -batch")) 373 (error "batch-update-autoloads is to be used only with -batch"))
375 (let ((lost nil) 374 (let ((lost nil)
376 (args command-line-args-left) 375 (args command-line-args-left)
377 (enable-local-eval nil)) ;Don't query in batch mode. 376 (enable-local-eval nil)) ;Don't query in batch mode.