- nil)))
- ;; write-file-functions is normally used for things like ftp-find-file
- ;; that visit things that are not local files as if they were files.
- ;; Changing to visit an ordinary local file instead should flush the hook.
- (kill-local-variable 'write-file-functions)
- (kill-local-variable 'local-write-file-hooks)
- (kill-local-variable 'revert-buffer-function)
- (kill-local-variable 'backup-inhibited)
- ;; If buffer was read-only because of version control,
- ;; that reason is gone now, so make it writable.
- (if vc-mode
- (setq buffer-read-only nil))
- (kill-local-variable 'vc-mode)
- ;; Turn off backup files for certain file names.
- ;; Since this is a permanent local, the major mode won't eliminate it.
- (and buffer-file-name
- backup-enable-predicate
- (not (funcall backup-enable-predicate buffer-file-name))
- (progn
- (make-local-variable 'backup-inhibited)
- (setq backup-inhibited t)))
- (let ((oauto buffer-auto-save-file-name))
- ;; If auto-save was not already on, turn it on if appropriate.
- (if (not buffer-auto-save-file-name)
- (and buffer-file-name auto-save-default
- (auto-save-mode t))
- ;; If auto save is on, start using a new name.
- ;; We deliberately don't rename or delete the old auto save
- ;; for the old visited file name. This is because perhaps
- ;; the user wants to save the new state and then compare with the
- ;; previous state from the auto save file.
- (setq buffer-auto-save-file-name
- (make-auto-save-file-name)))
- ;; Rename the old auto save file if any.
- (and oauto buffer-auto-save-file-name
- (file-exists-p oauto)
- (rename-file oauto buffer-auto-save-file-name t)))
- (and buffer-file-name
- (not along-with-file)
- (set-buffer-modified-p t))
- ;; Update the major mode, if the file name determines it.
- (condition-case nil
- ;; Don't change the mode if it is special.
- (or (not change-major-mode-with-file-name)
- (get major-mode 'mode-class)
- ;; Don't change the mode if the local variable list specifies it.
- (hack-local-variables t)
- (set-auto-mode t))
- (error nil)))
+ nil))
+ ;; write-file-functions is normally used for things like ftp-find-file
+ ;; that visit things that are not local files as if they were files.
+ ;; Changing to visit an ordinary local file instead should flush the hook.
+ (kill-local-variable 'write-file-functions)
+ (kill-local-variable 'local-write-file-hooks)
+ (kill-local-variable 'revert-buffer-function)
+ (kill-local-variable 'backup-inhibited)
+ ;; If buffer was read-only because of version control,
+ ;; that reason is gone now, so make it writable.
+ (if vc-mode
+ (setq buffer-read-only nil))
+ (kill-local-variable 'vc-mode)
+ ;; Turn off backup files for certain file names.
+ ;; Since this is a permanent local, the major mode won't eliminate it.
+ (and buffer-file-name
+ backup-enable-predicate
+ (not (funcall backup-enable-predicate buffer-file-name))
+ (progn
+ (make-local-variable 'backup-inhibited)
+ (setq backup-inhibited t)))
+ (let ((oauto buffer-auto-save-file-name))
+ ;; If auto-save was not already on, turn it on if appropriate.
+ (if (not buffer-auto-save-file-name)
+ (and buffer-file-name auto-save-default
+ (auto-save-mode t))
+ ;; If auto save is on, start using a new name.
+ ;; We deliberately don't rename or delete the old auto save
+ ;; for the old visited file name. This is because perhaps
+ ;; the user wants to save the new state and then compare with the
+ ;; previous state from the auto save file.
+ (setq buffer-auto-save-file-name
+ (make-auto-save-file-name)))
+ ;; Rename the old auto save file if any.
+ (and oauto buffer-auto-save-file-name
+ (file-exists-p oauto)
+ (rename-file oauto buffer-auto-save-file-name t)))
+ (and buffer-file-name
+ (not along-with-file)
+ (set-buffer-modified-p t))
+ ;; Update the major mode, if the file name determines it.
+ (condition-case nil
+ ;; Don't change the mode if it is special.
+ (or (not change-major-mode-with-file-name)
+ (get major-mode 'mode-class)
+ ;; Don't change the mode if the local variable list specifies it.
+ ;; The file name can influence whether the local variables apply.
+ (and old-try-locals
+ ;; h-l-v also checks it, but might as well be explicit.
+ (not (inhibit-local-variables-p))
+ (hack-local-variables t))
+ ;; TODO consider making normal-mode handle this case.
+ (let ((old major-mode))
+ (set-auto-mode t)
+ (or (eq old major-mode)
+ (hack-local-variables))))
+ (error nil))))