mirror of
https://github.com/larstvei/dot-emacs.git
synced 2025-08-01 04:30:12 +00:00
kill-this-buffer
-> kill-current-buffer
This commit is contained in:
parent
81f2886ec9
commit
6b76ac22be
8
init.org
8
init.org
@ -1291,19 +1291,19 @@
|
|||||||
I sometimes regret killing the =*scratch*=-buffer, and have realized I never
|
I sometimes regret killing the =*scratch*=-buffer, and have realized I never
|
||||||
want to actually kill it. I just want to get it out of the way, and clean it
|
want to actually kill it. I just want to get it out of the way, and clean it
|
||||||
up. The function below does just this for the =*scratch*=-buffer, and works
|
up. The function below does just this for the =*scratch*=-buffer, and works
|
||||||
like =kill-this-buffer= for any other buffer. It removes all buffer content
|
like =kill-current-buffer= for any other buffer. It removes all buffer content
|
||||||
and buries the buffer (this means making it the least likely candidate for
|
and buries the buffer (this means making it the least likely candidate for
|
||||||
=other-buffer=).
|
=other-buffer=).
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(defun kill-this-buffer-unless-scratch ()
|
(defun kill-current-buffer-unless-scratch ()
|
||||||
"Works like `kill-this-buffer' unless the current buffer is the
|
"Works like `kill-this-buffer' unless the current buffer is the
|
||||||
,*scratch* buffer. In witch case the buffer content is deleted and
|
,*scratch* buffer. In witch case the buffer content is deleted and
|
||||||
the buffer is buried."
|
the buffer is buried."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (not (string= (buffer-name) "*scratch*"))
|
(if (not (string= (buffer-name) "*scratch*"))
|
||||||
(kill-this-buffer)
|
(kill-current-buffer)
|
||||||
(delete-region (point-min) (point-max))
|
(delete-region (point-min) (point-max))
|
||||||
(switch-to-buffer (other-buffer))
|
(switch-to-buffer (other-buffer))
|
||||||
(bury-buffer "*scratch*")))
|
(bury-buffer "*scratch*")))
|
||||||
@ -2017,7 +2017,7 @@
|
|||||||
:map custom-bindings-map
|
:map custom-bindings-map
|
||||||
("M-," . jump-to-previous-like-this)
|
("M-," . jump-to-previous-like-this)
|
||||||
("M-." . jump-to-next-like-this)
|
("M-." . jump-to-next-like-this)
|
||||||
("C-x k" . kill-this-buffer-unless-scratch)
|
("C-x k" . kill-current-buffer-unless-scratch)
|
||||||
("C-c C-0" . global-scale-default)
|
("C-c C-0" . global-scale-default)
|
||||||
("C-c C-=" . global-scale-up)
|
("C-c C-=" . global-scale-up)
|
||||||
("C-c C-+" . global-scale-up)
|
("C-c C-+" . global-scale-up)
|
||||||
|
Loading…
Reference in New Issue
Block a user