help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Emacs ignores modified state of "untitled" buffer


From: Stefan Vollmar
Subject: Re: Emacs ignores modified state of "untitled" buffer
Date: Fri, 21 May 2010 15:59:40 +0200

Dear Kevin,

On 21.05.2010, at 15:17, Kevin Rodgers wrote:

> I was going to suggest:
> 
> (let ((default-major-mode 'org-mode))
>  (switch-to-new-untitled-buffer))
> 
> But when I tested it, I found out it didn't work as intended.  For that,
> the following version of switch-to-new-buffer is needed (I will post a
> new version of switch-to-new-buffer.el to gnu.emacs.sources and the
> EmacsWiki later):
> 
> (defun switch-to-new-buffer ()
>  "Switch to a new buffer.
> The buffer name is the value of `switch-to-new-buffer-name', or \"*scratch*\"
> if that is nil.
> See `set-buffer-major-mode'."
>  (interactive)
>  (let ((new-buffer (generate-new-buffer (or switch-to-new-buffer-name
>                                            "*scratch*"))))
>    (set-buffer-major-mode new-buffer)
>    ;; Protect against kill-emacs:
>    (setq buffer-offer-save t)
>    ;; Protect against kill-buffer:
>    (add-hook 'kill-buffer-query-functions
>             'switch-to-new-buffer-kill-buffer-query-function
>             nil
>             t)
>    ;; Finally, select:
>    (switch-to-buffer new-buffer)))


we now use

(require 'switch-to-new-buffer)
(let ((default-major-mode 'org-mode))
 (switch-to-new-untitled-buffer))

in site-start.el and also have replaced switch-to-new-buffer() with your new 
routine. Emacs starts with an "untitled" buffer in Org-mode, but does not ask 
when closing the buffer with unsaved data. If this did work (it does not), what 
would happen to the "untitled" buffer if the user switches "manually" to 
another major mode?

Many thanks in advance.
Warm regards,
 Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de






Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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