Remove gpolonkai/undo-buffer-kill and companion functions

This commit is contained in:
Gergely Polonkai 2023-10-20 15:27:03 +02:00
parent 0fdc67dffe
commit 23b8a3a2ac
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -649,35 +649,6 @@ line first. Then jump to the actual end of the line."
(message "File '%s' successfully removed" filename))))) (message "File '%s' successfully removed" filename)))))
#+END_SRC #+END_SRC
*** Allow reopening the previously closed file
#+BEGIN_SRC emacs-lisp
(defvar gpolonkai/last-killed-buffer-file-name
nil
"The last killed buffer.
Used by `gpolonkai/save-killed-buffer-filename' and `gpolonkai/undo-buffer-kill'.")
(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-buffer-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.
Esentially it visits the file again."
(interactive)
(if gpolonkai/last-killed-buffer-file-name
(progn
(find-file gpolonkai/last-killed-buffer-file-name)
(setq gpolonkai/last-killed-buffer-file-name nil))
(message "The buffer last killed didnt visit a file.")))
#+END_SRC
*** Open this file as another user *** Open this file as another user
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -3880,7 +3851,6 @@ directory. It is available from [[http://plantuml.com/download][here]].
("C-d" . delete-current-buffer-file) ("C-d" . delete-current-buffer-file)
("|" . toggle-window-split) ("|" . toggle-window-split)
("k" . kill-this-buffer) ("k" . kill-this-buffer)
("M-k" . gpolonkai/undo-buffer-kill)
("C-b" . bury-buffer) ("C-b" . bury-buffer)
("/" . repeat) ("/" . repeat)
:map isearch-mode-map :map isearch-mode-map