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:
Gergely Polonkai 2018-09-19 09:42:24 +02:00
parent 78ba87b5a1
commit d13f273a24
1 changed files with 9 additions and 19 deletions

View File

@ -470,13 +470,15 @@ Copied from http://whattheemacsd.com/file-defuns.el-02.html
nil
"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 ()
"Kill the current buffer, but save the buffer file name so it can be undone."
(interactive)
(setq gpolonkai/last-killed-buffer-file-name (buffer-file-name))
(kill-this-buffer))
(defun gpolonkai/save-killed-buffer-filename ()
"Save the filename of the killed buffer in `gpolonkai/last-killed-buffer-file-name'."
(let ((filename (buffer-file-name)))
(unless filename
(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 ()
"Undo killing the last buffer.
@ -637,17 +639,6 @@ Copied from http://emacs-doctor.com/emacs-strip-tease.html
(quit-window nil window))
#+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
*** 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-d" . delete-current-buffer-file)
("|" . toggle-window-split)
("k" . gpolonkai/kill-this-buffer)
("M-c" . gpolonkai/kill-this-buffer-delete-this-window)
("k" . kill-this-buffer)
("M-k" . gpolonkai/undo-buffer-kill)
("C-b" . bury-buffer)
("/" . repeat)