aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Lord2016-04-12 18:00:50 +0100
committerPhillip Lord2016-04-12 18:00:50 +0100
commit50455754b558d1689bbbb596e05631f2789b1350 (patch)
tree577d909e979597cacd6719cbf5a074f44bf1644f
parentca509810014726cf6bee9f7e8f69bdeaf62dc146 (diff)
downloademacs-50455754b558d1689bbbb596e05631f2789b1350.tar.gz
emacs-50455754b558d1689bbbb596e05631f2789b1350.zip
Revert "Prevent bootstrap autoload backup files"
This reverts commit c23c965bb9d0a4bcc1b6158833ff99aa20fd53e9.
-rw-r--r--lisp/emacs-lisp/autoload.el42
1 files changed, 14 insertions, 28 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 592d69d2eb9..e688d6be725 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -234,22 +234,9 @@ If a buffer is visiting the desired autoload file, return it."
234 (enable-local-eval nil)) 234 (enable-local-eval nil))
235 ;; We used to use `raw-text' to read this file, but this causes 235 ;; We used to use `raw-text' to read this file, but this causes
236 ;; problems when the file contains non-ASCII characters. 236 ;; problems when the file contains non-ASCII characters.
237 (let* ((delay-mode-hooks t) 237 (let ((delay-mode-hooks t))
238 (file (autoload-generated-file)) 238 (find-file-noselect
239 (file-missing (not (file-exists-p file)))) 239 (autoload-ensure-default-file (autoload-generated-file))))))
240 (when file-missing
241 (autoload-ensure-default-file file))
242 (with-current-buffer
243 (find-file-noselect
244 (autoload-ensure-file-writeable
245 file))
246 ;; block backups when the file has just been created, since
247 ;; the backups will just be the auto-generated headers.
248 ;; bug#23203
249 (when file-missing
250 (setq buffer-backed-up t)
251 (save-buffer))
252 (current-buffer)))))
253 240
254(defun autoload-generated-file () 241(defun autoload-generated-file ()
255 (expand-file-name generated-autoload-file 242 (expand-file-name generated-autoload-file
@@ -370,22 +357,21 @@ not be relied upon."
370;;;###autoload 357;;;###autoload
371(put 'autoload-ensure-writable 'risky-local-variable t) 358(put 'autoload-ensure-writable 'risky-local-variable t)
372 359
373(defun autoload-ensure-file-writeable (file)
374 ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile,
375 ;; which was designed to handle CVSREAD=1 and equivalent.
376 (and autoload-ensure-writable
377 (let ((modes (file-modes file)))
378 (if (zerop (logand modes #o0200))
379 ;; Ignore any errors here, and let subsequent attempts
380 ;; to write the file raise any real error.
381 (ignore-errors (set-file-modes file (logior modes #o0200))))))
382 file)
383
384(defun autoload-ensure-default-file (file) 360(defun autoload-ensure-default-file (file)
385 "Make sure that the autoload file FILE exists, creating it if needed. 361 "Make sure that the autoload file FILE exists, creating it if needed.
386If the file already exists and `autoload-ensure-writable' is non-nil, 362If the file already exists and `autoload-ensure-writable' is non-nil,
387make it writable." 363make it writable."
388 (write-region (autoload-rubric file) nil file)) 364 (if (file-exists-p file)
365 ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile,
366 ;; which was designed to handle CVSREAD=1 and equivalent.
367 (and autoload-ensure-writable
368 (let ((modes (file-modes file)))
369 (if (zerop (logand modes #o0200))
370 ;; Ignore any errors here, and let subsequent attempts
371 ;; to write the file raise any real error.
372 (ignore-errors (set-file-modes file (logior modes #o0200))))))
373 (write-region (autoload-rubric file) nil file))
374 file)
389 375
390(defun autoload-insert-section-header (outbuf autoloads load-name file time) 376(defun autoload-insert-section-header (outbuf autoloads load-name file time)
391 "Insert the section-header line, 377 "Insert the section-header line,