diff --git a/configuration.org b/configuration.org index e45c214..04acd6a 100644 --- a/configuration.org +++ b/configuration.org @@ -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)