[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A wish, a plea

From: Davis Herring
Subject: Re: A wish, a plea
Date: Thu, 21 Jun 2007 12:12:31 -0700 (PDT)
User-agent: SquirrelMail/1.4.8-6.el3.2lanl

>> The simple answer here is M-x auto-save-mode.  You can of course put
>> (auto-save-mode 1) in .emacs, since *scratch* is current when it runs.
> It may work.

Does for me as the only line in .emacs, if you were doubting.

>> Actually getting rid of *scratch* is somewhat harder.
> Maybe an alternative is to make it read-only.
> Or maybe add a first-change-hook that requests a file name from the user?

That's a neat idea, the hook.  Perhaps:

(defun set-buffer-file-name (name)
  "Set the current buffer's file name, prompting interactively."
  (interactive "FNew file name: ")
  (setq buffer-file-name name))
(defun guarantee-buffer-file-name ()
  "Prompt the user for a file name for the current buffer.
Do nothing if that buffer has a file name already or is in a special mode."
  (unless (or buffer-file-name (eq (get major-mode 'mode-class) 'special))
    (call-interactively 'set-buffer-file-name)))
(add-hook 'first-change-hook 'guarantee-buffer-file-name)


This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during

reply via email to

[Prev in Thread] Current Thread [Next in Thread]