Emacs: embark kill buffer no prompt and fix find-file-other-window

This commit is contained in:
Joseph Ferano 2024-02-14 13:12:21 +08:00
parent cee5d08902
commit cc318d1600

View File

@ -1592,35 +1592,20 @@ Stuff to immediately switch to Jetbrains for debugging
*** Embark *** Embark
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'embark) (require 'embark)
#+end_src
;; TODO Try using embark to kill this buffer These two lines allow you to kill buffers without a confirmation and without
(defun prot-simple-kill-buffer-current (&optional arg) closing the mini-buffer so you can quickly kill multiple buffers if needed. The
"Kill current buffer. odd looking ~'(t .t)~ is for specifying a default for all other actions.
With optional prefix ARG (\\[universal-argument]) delete the
buffer's window as well."
(interactive "P")
(let ((kill-buffer-query-functions nil))
(if (and arg (not (one-window-p)))
(kill-buffer-and-window)
(kill-buffer))))
(defun prot-simple-kill-buffer (buffer) #+begin_src emacs-lisp
"Kill current BUFFER. (setq embark-quit-after-action '((t . t)
When called interactively, prompt for BUFFER." (kill-buffer . nil)))
(interactive (list (read-buffer "Select buffer: ")))
(let ((kill-buffer-query-functions nil))
(kill-buffer (or buffer (current-buffer)))))
(setq embark-quit-after-action '((kill-buffer . nil))) (setf (alist-get 'kill-buffer embark-pre-action-hooks) nil)
#+end_src
;; TODO Add this to display-buffer-alist #+begin_src emacs-lisp
;; ("\\*Embark Actions\\*"
;; (display-buffer-reuse-mode-window display-buffer-at-bottom)
;; (window-height . fit-window-to-buffer)
;; (window-parameters . ((no-other-window . t)
;; (mode-line-format . none))))
;; TODO Remove the which-key stuff because it seems to be breaking things
(defun embark-which-key-indicator () (defun embark-which-key-indicator ()
"An embark indicator that displays keymaps using which-key. "An embark indicator that displays keymaps using which-key.
The which-key help message will show the type and value of the The which-key help message will show the type and value of the