Fold lisp/bandali-utils.el back into init.el
[~bandali/configs] / lisp / bandali-dired.el
index 394715d..9ed1030 100644 (file)
 ;;; Code:
 
 (with-eval-after-load 'dired
 ;;; Code:
 
 (with-eval-after-load 'dired
-  (csetq dired-dwim-target t
-         dired-listing-switches "-alh"
-         ls-lisp-dirs-first t
-         ls-lisp-use-insert-directory-program nil)
+  (csetq
+   dired-dwim-target t
+   dired-listing-switches "-alh"
+   dired-recent-directories-file (b/var "dired-recent-directories.el")
+   ls-lisp-dirs-first t
+   ls-lisp-use-insert-directory-program nil)
 
   (declare-function dired-dwim-target-directory "dired-aux")
   ;; easily diff 2 marked files
 
   (declare-function dired-dwim-target-directory "dired-aux")
   ;; easily diff 2 marked files
                         (set-window-configuration wnd))))
         (error "no more than 2 files should be marked"))))
 
                         (set-window-configuration wnd))))
         (error "no more than 2 files should be marked"))))
 
+  (defun b/dired-start-process (program &optional args)
+    "Open current file with a PROGRAM."
+    ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS
+    ;; can be nil, so remove it).
+    (declare-function dired-get-file-for-visit "dired")
+    (apply #'b/start-process
+           program
+           (remove nil (list args (dired-get-file-for-visit)))))
+
   ;; local key bindings
   (define-key dired-mode-map (kbd "b") #'dired-up-directory)
   (define-key dired-mode-map (kbd "E") #'dired-ediff-files)
   ;; local key bindings
   (define-key dired-mode-map (kbd "b") #'dired-up-directory)
   (define-key dired-mode-map (kbd "E") #'dired-ediff-files)