[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
smime.p7s
Description: S/MIME cryptographic signature
- RE: Emacs ignores modified state of "untitled" buffer, (continued)
- RE: Emacs ignores modified state of "untitled" buffer, Drew Adams, 2010/05/19
- Re: Emacs ignores modified state of "untitled" buffer, Stephen Berman, 2010/05/19
- Re: Emacs ignores modified state of "untitled" buffer, Kevin Rodgers, 2010/05/20
- Re: Emacs ignores modified state of "untitled" buffer, Kevin Rodgers, 2010/05/20
- Re: Emacs ignores modified state of "untitled" buffer, Stefan Vollmar, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Kevin Rodgers, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer,
Stefan Vollmar <=
- Re: Emacs ignores modified state of "untitled" buffer, Kevin Rodgers, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Stefan Vollmar, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Lennart Borgman, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Stefan Vollmar, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Lennart Borgman, 2010/05/21
- RE: Emacs ignores modified state of "untitled" buffer, Drew Adams, 2010/05/21
- Re: Emacs ignores modified state of "untitled" buffer, Kevin Rodgers, 2010/05/28
- RE: Emacs ignores modified state of "untitled" buffer, Drew Adams, 2010/05/28
- Re: Emacs ignores modified state of "untitled" buffer, Stefan Vollmar, 2010/05/28