mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
There was recently a great tidy-up commit in the Emacs master branch (commit 1f29ee2d21b57e81a28550a1b31bc8a39406d17b), which removed a lot legacy stuff. Dired's dired-pop-to-buffer function was among them. However dired+ plus seems to heavily depend on it, so for now, I've simply copied the source of the function from the legacy cleanup commit.
55 lines
1.8 KiB
EmacsLisp
55 lines
1.8 KiB
EmacsLisp
;;; siren-dired+.el --- jimeh's Emacs Siren: dired+ configuration.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Basic configuration for dired+.
|
|
|
|
;;; Code:
|
|
|
|
(use-package dired+
|
|
:defer t
|
|
:general
|
|
(:keymaps 'dired-mode-map
|
|
"C-l" 'diredp-up-directory-reuse-dir-buffer)
|
|
|
|
:hook
|
|
(dired-mode . siren-diredp-mode-setup)
|
|
|
|
:preface
|
|
(defun siren-diredp-mode-setup ()
|
|
(toggle-diredp-find-file-reuse-dir 1))
|
|
|
|
:config
|
|
(unbind-key "M-b" dired-mode-map)
|
|
(unbind-key "M-i" dired-mode-map)
|
|
(unbind-key "M-l" dired-mode-map)
|
|
|
|
(when (not (fboundp 'dired-pop-to-buffer))
|
|
;; Emacs 29.x has removed the legacy dired-pop-to-buffer function from dired
|
|
;; in commit 1f29ee2d21b57e81a28550a1b31bc8a39406d17b.
|
|
;;
|
|
;; Dired+ depends heavily on dired-pop-to-buffer, so here we re-define the
|
|
;; version that was removed from Emacs.
|
|
(defun dired-pop-to-buffer (buf)
|
|
"Pop up buffer BUF in a way suitable for Dired."
|
|
(declare (obsolete pop-to-buffer "24.3"))
|
|
(let ((split-window-preferred-function
|
|
(lambda (window)
|
|
(or (and (let ((split-height-threshold 0))
|
|
(window-splittable-p (selected-window)))
|
|
;; Try to split the selected window vertically if
|
|
;; that's possible. (Bug#1806)
|
|
(split-window-below))
|
|
;; Otherwise, try to split WINDOW sensibly.
|
|
(split-window-sensibly window))))
|
|
pop-up-frames)
|
|
(pop-to-buffer (get-buffer-create buf)))
|
|
;; See Bug#12281.
|
|
(set-window-start nil (point-min))
|
|
;; Try to not delete window when we want to display less than
|
|
;; `window-min-height' lines.
|
|
(fit-window-to-buffer (get-buffer-window buf) nil 1 nil nil t))))
|
|
|
|
(provide 'siren-dired+)
|
|
;;; siren-dired+.el ends here
|