dired-sidebar
dired-sidebar copied to clipboard
multiple frames reusing same dired-sidebar buffer
Multiple frames may use the same sidebar buffer. This isn't that big of a deal other than that editing one of those buffers will edit the other one too.
Maybe we want this, maybe not.
It's somewhat easy to fix (just change the buffer name by prepending frame window id or something) but would cause other issues with desktop-save-mode and multiple frames.
Sample code to avoid this...
(defun dired-sidebar-sidebar-buffer-name (dir)
"Return name of `dired-sidebar' buffer given DIR."
(let ((b (cond
((string-suffix-p ".." dir)
;; ~/.emacs.d/elpa/.. -> ~/.emacs.d/
(file-name-directory (substring dir 0 (- (length dir) 3))))
((not (string-suffix-p "/" dir))
(concat dir "/"))
(:default
dir))))
(let ((frame-window-id (frame-parameter (selected-frame) 'window-id))
(abbreviated-name (abbreviate-file-name b)))
(if (string-equal frame-window-id "1")
(concat frame-window-id ":" abbreviated-name)
(concat frame-window-id ":" abbreviated-name)))))