aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-05-29 02:11:27 +0000
committerStefan Monnier2006-05-29 02:11:27 +0000
commit69135525601292d74ceb4dd80759e71a4a553d3a (patch)
tree328241a6428e25e3911e34bf638f6201bd30ce62
parent411fe8f336fd8c18de0e739706c8438cab926bde (diff)
downloademacs-69135525601292d74ceb4dd80759e71a4a553d3a.tar.gz
emacs-69135525601292d74ceb4dd80759e71a4a553d3a.zip
(autoload-find-file): New fun. This one calls hack-local-variables.
(generate-file-autoloads, update-file-autoloads): Use it.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/autoload.el63
2 files changed, 34 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f1698732a04..f75a7b7ae99 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12006-05-28 Stefan Monnier <monnier@iro.umontreal.ca> 12006-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/autoload.el (autoload-find-file): New fun.
4 This one calls hack-local-variables.
5 (generate-file-autoloads, update-file-autoloads): Use it.
6
3 * textmodes/bibtex.el (bibtex-autokey-name-case-convert-function) 7 * textmodes/bibtex.el (bibtex-autokey-name-case-convert-function)
4 (bibtex-sort-entry-class): Add safe-local-variable predicate. 8 (bibtex-sort-entry-class): Add safe-local-variable predicate.
5 (bibtex-sort-entry-class-alist): Don't set the global value. 9 (bibtex-sort-entry-class-alist): Don't set the global value.
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index ee2d74c5646..57e767db873 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -273,6 +273,20 @@ which lists the file name and which functions are in it, etc."
273 (or (eolp) 273 (or (eolp)
274 (insert "\n" generate-autoload-section-continuation)))))) 274 (insert "\n" generate-autoload-section-continuation))))))
275 275
276(defun autoload-find-file (file)
277 "Fetch file and put it in a temp buffer. Return the buffer."
278 ;; It is faster to avoid visiting the file.
279 (with-current-buffer (get-buffer-create " *autoload-file*")
280 (kill-all-local-variables)
281 (erase-buffer)
282 (setq buffer-undo-list t
283 buffer-read-only nil)
284 (emacs-lisp-mode)
285 (insert-file-contents file nil)
286 (let ((enable-local-variables :safe))
287 (hack-local-variables))
288 (current-buffer)))
289
276(defun generate-file-autoloads (file) 290(defun generate-file-autoloads (file)
277 "Insert at point a loaddefs autoload section for FILE. 291 "Insert at point a loaddefs autoload section for FILE.
278autoloads are generated for defuns and defmacros in FILE 292autoloads are generated for defuns and defmacros in FILE
@@ -313,16 +327,9 @@ are used."
313 (save-excursion 327 (save-excursion
314 (unwind-protect 328 (unwind-protect
315 (progn 329 (progn
316 (if visited 330 (set-buffer (or visited
317 (set-buffer visited) 331 ;; It is faster to avoid visiting the file.
318 ;; It is faster to avoid visiting the file. 332 (autoload-find-file file)))
319 (set-buffer (get-buffer-create " *generate-autoload-file*"))
320 (kill-all-local-variables)
321 (erase-buffer)
322 (setq buffer-undo-list t
323 buffer-read-only nil)
324 (emacs-lisp-mode)
325 (insert-file-contents file nil))
326 (save-excursion 333 (save-excursion
327 (save-restriction 334 (save-restriction
328 (widen) 335 (widen)
@@ -340,8 +347,7 @@ are used."
340 (or (bolp) (forward-line 1)))) 347 (or (bolp) (forward-line 1))))
341 (autoload (make-autoload form load-name))) 348 (autoload (make-autoload form load-name)))
342 (if autoload 349 (if autoload
343 (setq autoloads-done (cons (nth 1 form) 350 (push (nth 1 form) autoloads-done)
344 autoloads-done))
345 (setq autoload form)) 351 (setq autoload form))
346 (let ((autoload-print-form-outbuf outbuf)) 352 (let ((autoload-print-form-outbuf outbuf))
347 (autoload-print-form autoload))) 353 (autoload-print-form autoload)))
@@ -460,31 +466,22 @@ Autoload section for %s is up to date."
460 (and (eq found 'new) 466 (and (eq found 'new)
461 ;; Check that FILE has any cookies before generating a 467 ;; Check that FILE has any cookies before generating a
462 ;; new section for it. 468 ;; new section for it.
463 (save-excursion 469 (with-current-buffer
464 (if existing-buffer 470 (or existing-buffer
465 (set-buffer existing-buffer) 471 ;; It is faster to avoid visiting the file.
466 ;; It is faster to avoid visiting the file. 472 (autoload-find-file file))
467 (set-buffer (get-buffer-create " *autoload-file*")) 473 (save-excursion
468 (kill-all-local-variables)
469 (erase-buffer)
470 (setq buffer-undo-list t
471 buffer-read-only nil)
472 (emacs-lisp-mode)
473 (insert-file-contents file nil))
474 (save-excursion
475 (save-restriction 474 (save-restriction
476 (widen) 475 (widen)
477 (goto-char (point-min)) 476 (goto-char (point-min))
478 (prog1 477 (prog1
479 (if (re-search-forward 478 (setq no-autoloads
480 (concat "^" (regexp-quote 479 (not (re-search-forward
481 generate-autoload-cookie)) 480 (concat "^" (regexp-quote
482 nil t) 481 generate-autoload-cookie))
483 nil 482 nil t)))
484 (if (interactive-p) 483 (if (and no-autoloads (interactive-p))
485 (message "%s has no autoloads" file)) 484 (message "%s has no autoloads" file))
486 (setq no-autoloads t)
487 t)
488 (or existing-buffer 485 (or existing-buffer
489 (kill-buffer (current-buffer)))))))) 486 (kill-buffer (current-buffer))))))))
490 (generate-file-autoloads file)))) 487 (generate-file-autoloads file))))