Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #207393
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: emacs save and kill buffer for (neo)mutt |
| Date | 2019-04-12 20:10 +0200 |
| Message-ID | <xM8MF-7rk-7@gated-at.bofh.it> (permalink) |
| References | <xM6Ux-6hs-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri 12 Apr 2019 at 18:04:45 (+0200), Pétùr wrote: > I use neomutt with emacs. > > I would like to quickly save and kill a buffer in emacs. This is to > avoid typing C-x C-s and, then, C-x C-c when sending an email. I want > one shortcut to save and kill the buffer and be back quickly in mutt to > send the email. > > I tried the following inside my .emacs (binded to C-q). It works but > kill also the window when inside a terminal. I am not going back to mutt > after writing inside emacs (-nw) and C-q. How can I fix that? I just put (global-set-key [?\C-q] "\C-x\C-s\C-x\C-c") into my ~/.emacs file and it works just as one would expect, both when emacs is running in a separate window (which disappears) or when emacs is running with -nw in an xterm (the xterm is unaffected). I will finish composing this email (in emacs -nw) by typing ^q and expect to be left in mutt, whereupon I shall press y to send it. Is that what you wnat? Here goes … > ;; Kill the current buffer immediatly, saving it if needed. > (defvar kill-save-buffer-delete-windows t > "*Delete windows when `kill-save-buffer' is used. > If this is non-nil, then `kill-save-buffer' will also delete the corresponding > windows. This is inverted by `kill-save-buffer' when called with a prefix.") > (defun kill-save-buffer (arg) > "Save the current buffer (if needed) and then kill it. > Also, delete its windows according to `kill-save-buffer-delete-windows'. > A prefix argument ARG reverses this behavior." > (interactive "P") > (let ((del kill-save-buffer-delete-windows)) > (when arg (setq del (not del))) > (when (and (buffer-file-name) (not (file-directory-p (buffer-file-name)))) > (save-buffer)) > (let ((buf (current-buffer))) > (when del (delete-windows-on buf)) > (kill-buffer buf)))) > > (global-set-key (kbd "C-q") 'kill-save-buffer) > Cheers, David.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
emacs save and kill buffer for (neo)mutt Pétùr <peturvilj@gmail.com> - 2019-04-12 18:10 +0200
Re: emacs save and kill buffer for (neo)mutt David Wright <deblis@lionunicorn.co.uk> - 2019-04-12 20:10 +0200
Re: emacs save and kill buffer for (neo)mutt Pétùr <peturvilj@gmail.com> - 2019-04-29 10:40 +0200
Re: emacs save and kill buffer for (neo)mutt David Wright <deblis@lionunicorn.co.uk> - 2019-04-29 17:50 +0200
Re: emacs save and kill buffer for (neo)mutt Pétùr <peturvilj@gmail.com> - 2019-05-07 06:20 +0200
Detour: notmuch advertisement (was: emacs save and kill buffer for (neo)mutt) Peter Wiersig <peter@friesenpeter.de> - 2019-04-13 01:50 +0200
Re: Detour: notmuch advertisement John Hasler <jhasler@newsguy.com> - 2019-04-13 02:10 +0200
Re: Detour: notmuch advertisement 황병희 <soyeomul@red-october.yw.doraji.xyz> - 2019-04-13 03:50 +0200
Re: Detour: notmuch advertisement (was: emacs save and kill buffer for (neo)mutt) Pétùr <peturvilj@gmail.com> - 2019-05-07 06:40 +0200
csiph-web