Remove my personal kill-this-buffer and kill-this-buffer-delete-this-window functions
`(gpolonkai/kill-this-buffer)` just saved the filename of the killed buffer so it can be reopened with `(gpolonkai/undo-buffer-kill)`. `(gpolonkai/kill-this-buffer-delete-this-window)` is the same as the built-in `(kill-buffer-and-window)` command, with a convenient enough key binding.
This commit is contained in:
parent
78ba87b5a1
commit
d13f273a24
@ -470,13 +470,15 @@ Copied from http://whattheemacsd.com/file-defuns.el-02.html
|
|||||||
nil
|
nil
|
||||||
"The last killed buffer.
|
"The last killed buffer.
|
||||||
|
|
||||||
Used by `gpolonkai/kill-this-buffer' and `gpolonkai/undo-buffer-kill'.")
|
Used by `gpolonkai/save-killed-buffer-filename' and `gpolonkai/undo-buffer-kill'.")
|
||||||
|
|
||||||
(defun gpolonkai/kill-this-buffer ()
|
(defun gpolonkai/save-killed-buffer-filename ()
|
||||||
"Kill the current buffer, but save the buffer file name so it can be undone."
|
"Save the filename of the killed buffer in `gpolonkai/last-killed-buffer-file-name'."
|
||||||
(interactive)
|
(let ((filename (buffer-file-name)))
|
||||||
(setq gpolonkai/last-killed-buffer-file-name (buffer-file-name))
|
(unless filename
|
||||||
(kill-this-buffer))
|
(setq gpolonkai/last-killed-bufer-file-name (buffer-file-name)))))
|
||||||
|
|
||||||
|
(add-hook 'kill-buffer-hook 'gpolonkai/save-killed-buffer-filename)
|
||||||
|
|
||||||
(defun gpolonkai/undo-buffer-kill ()
|
(defun gpolonkai/undo-buffer-kill ()
|
||||||
"Undo killing the last buffer.
|
"Undo killing the last buffer.
|
||||||
@ -637,17 +639,6 @@ Copied from http://emacs-doctor.com/emacs-strip-tease.html
|
|||||||
(quit-window nil window))
|
(quit-window nil window))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Kill current buffer and delete its window
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(defun gpolonkai/kill-this-buffer-delete-this-window ()
|
|
||||||
"Kill the buffer in the current window, and then try to delete
|
|
||||||
the current window."
|
|
||||||
(interactive)
|
|
||||||
(kill-this-buffer)
|
|
||||||
(delete-window))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** ~c-mode~ related
|
** ~c-mode~ related
|
||||||
|
|
||||||
*** Copy the prototype of the current function
|
*** Copy the prototype of the current function
|
||||||
@ -2933,8 +2924,7 @@ directory. It is available from [[http://plantuml.com/download][here]].
|
|||||||
("C-r" . rename-current-buffer-file)
|
("C-r" . rename-current-buffer-file)
|
||||||
("C-d" . delete-current-buffer-file)
|
("C-d" . delete-current-buffer-file)
|
||||||
("|" . toggle-window-split)
|
("|" . toggle-window-split)
|
||||||
("k" . gpolonkai/kill-this-buffer)
|
("k" . kill-this-buffer)
|
||||||
("M-c" . gpolonkai/kill-this-buffer-delete-this-window)
|
|
||||||
("M-k" . gpolonkai/undo-buffer-kill)
|
("M-k" . gpolonkai/undo-buffer-kill)
|
||||||
("C-b" . bury-buffer)
|
("C-b" . bury-buffer)
|
||||||
("/" . repeat)
|
("/" . repeat)
|
||||||
|
Loading…
Reference in New Issue
Block a user