[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] emacs-25 c23c965: Prevent bootstrap autoload backup fi
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] emacs-25 c23c965: Prevent bootstrap autoload backup files |
Date: |
Tue, 12 Apr 2016 09:30:49 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
>>>>> "Phillip" == Phillip Lord <address@hidden> writes:
> Stefan Monnier <address@hidden> writes:
>>> - (let ((delay-mode-hooks t))
>>> - (find-file-noselect
>>> - (autoload-ensure-default-file (autoload-generated-file))))))
>>> + (let* ((delay-mode-hooks t)
>>> + (file (autoload-generated-file))
>>> + (file-missing (not (file-exists-p file))))
>>> + (when file-missing
>>> + (autoload-ensure-default-file file))
>>> + (with-current-buffer
>>> + (find-file-noselect
>>> + (autoload-ensure-file-writeable
>>> + file))
>>> + ;; block backups when the file has just been created, since
>>> + ;; the backups will just be the auto-generated headers.
>>> + ;; bug#23203
>>> + (when file-missing
>>> + (setq buffer-backed-up t)
>>> + (save-buffer))
>>> + (current-buffer)))))
>>
>> That looks quite complicated just to suppress backups.
>> Could you explain why we couldn't just do something like:
>>
>> (let ((delay-mode-hooks t)
>> (make-backup-files))
>> (find-file-noselect
>> (autoload-ensure-default-file (autoload-generated-file))))))
>> or
>> (let ((delay-mode-hooks t))
>> (with-current-buffer
>> (find-file-noselect
>> (autoload-ensure-default-file (autoload-generated-file)))
>> (setq-local backup-inhibited t)))))
> It has different semantics. My patch preserves backup files except when
> the autoload file is created for the first time. This only happens
> because we create the header and footer in one place, then reopen with
> find-file-noselect.
I see. Yuck!
And thanks for the explanation.
Stefan