[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The new *scratch* autosaving is really annoying
From: |
Ye Wenbin |
Subject: |
Re: The new *scratch* autosaving is really annoying |
Date: |
Mon, 16 Jul 2007 18:18:10 +0800 |
User-agent: |
Opera Mail/9.21 (Linux) |
The emacs-start-hook is run after turn on auto-save in *scratch*. Here is
my solution,
add these to site-start.el:
(defvar inhibit-scratch-auto-save t
"How to auto save \"*scratch*\" when startup.
If the value is kill, the buffer will kill when startup.
Or you can site it to an existing directory, the auto-save file will
save to that directory.
Otherwise the value is non-nil, just turn off the auto-save-mode in
\"*scratch*\".
")
(cond ((eq inhibit-scratch-auto-save 'kill)
(kill-buffer "*scratch*"))
((and (stringp inhibit-scratch-auto-save)
(file-directory-p inhibit-scratch-auto-save))
(add-to-list 'file-name-handler-alist
(cons (regexp-quote "#*scratch*#")
'my-scratch-auto-save-file-name))
(defun my-scratch-auto-save-file-name (operation &rest args)
(if (and (eq operation 'expand-file-name)
(string= (car args) "#*scratch*#"))
(expand-file-name (concat (file-name-as-directory
inhibit-scratch-auto-save) (car args)))
(let ((inhibit-file-name-handlers
(cons 'my-scratch-auto-save-file-name
(and (eq inhibit-file-name-operation operation)
inhibit-file-name-handlers)))
(inhibit-file-name-operation operation))
(apply operation args)))))
(inhibit-scratch-auto-save
(add-hook 'emacs-startup-hook
(lambda ()
(when (get-buffer "*scratch*")
(with-current-buffer "*scratch*"
(auto-save-mode -1)
(setq buffer-offer-save nil)))))))
On Mon, 16 Jul 2007 04:07:29 +0800, Henrik Enberg
<address@hidden> wrote:
Can we please have an option to turn off the *scratch* autosaving thing?
I use it for its original purpose, and the questions are driving me
batty.
It is even set up after the after-init-hook is run, so you can't turn it
off there either.
_______________________________________________
emacs-pretest-bug mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug