Cleanup my extra key bindings for dired code

This commit is contained in:
Gerard Vermeulen 2022-05-03 09:34:20 +02:00
parent 95fd1a23ea
commit f3b9f4a4fa

View File

@ -447,17 +447,16 @@ by experienced Emacs users.
#+name: lst:extra-dired-key-bindings
#+begin_src emacs-lisp
(with-eval-after-load 'dired
(define-key
dired-mode-map (kbd "E")
(defun my-dired-eww-find-file ()
"Visit dired file with eww."
(defun dired-eww-open-file ()
"In Dired, open the regular file named on this line with eww"
(interactive)
(eww-open-file (dired-get-file-for-visit))))
(let ((file (dired-get-file-for-visit)))
(if (file-regular-p file)
(eww-open-file file)
(error "Eww rejects `%s', since it is not a regular file" file))))
;; https://truongtx.me/tmtxt-dired-async.html
(define-key
dired-mode-map (kbd "Y")
(defun my-dired-rsync (target)
(defun dired-rsync (target)
"Copy marked files with `rsync' to TARGET directory."
(interactive
(list (expand-file-name
@ -482,7 +481,10 @@ by experienced Emacs users.
;; Run the async shell command.
(async-shell-command rsync-command)
;; Finally, switch to that window.
(other-window 1)))))
(other-window 1)))
(define-key dired-mode-map (kbd "E") #'dired-eww-open-file)
(define-key dired-mode-map (kbd "Y") #'dired-rsync))
#+end_src
** [[info:elisp#Processes][Processes (info)]]