[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 16:30:01 +0200 |
Dear Kevin,
On 21.05.2010, at 16:11, Kevin Rodgers wrote:
> Here's the fixed version:
>
> (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)
> (with-current-buffer 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 are almost there: Emacs now asks about unsaved data, fine!
And we use
(let ((default-major-mode 'org-mode))
(switch-to-new-untitled-buffer))
at the end of site-start.el.
However, if I start Emacs (the "untitled" buffer is in front, set to Org-mode,
everything as it should be), then do a M-x c-mode (or python-mode; probably any
major-mode will do), type something and then quit Emacs - Emacs does not ask
about saving data any longer, so that problem persists.
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, 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, 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, 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