From 24ba62322ea826fac6fdb257369f67a5a54c1576 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Sun, 23 Jun 2024 20:30:10 +0200 Subject: [PATCH] Overhaul the "Dired: ..." section --- README.org | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/README.org b/README.org index 5c0266c..3a34e75 100644 --- a/README.org +++ b/README.org @@ -800,16 +800,12 @@ Mark this line without new-line as region 2 :CUSTOM_ID: sec:file-manager :END: -[[info:emacs#Dired][Dired (info)]] and the [[https://github.com/ranger/ranger#readme][ranger]] file manager offer similar capabilities for copying, -deleting, opening, renaming, and viewing files and directories, but the -integration of [[info:emacs#Dired][dired (info)]] in Emacs is obviously much better than the -integration of [[https://github.com/ranger/ranger#readme][ranger]] in Emacs. - -For instance, this setup allows to insert an =org-mode= link to a file -containing a specific image into an =org-mode= buffer by means of the facilities -of [[info:emacs#Dired][dired (info)]] as follows: -1. Type {{{kbd(C-x d)}}} to open the directory containing the file with the - specific image in a =dired-mode= buffer. +[[info:emacs#Dired][Dired (info)]] offer capabilities for copying, deleting, opening, renaming, and +viewing files and directories. For instance, this setup allows to insert an +=org-mode= link to a file containing a specific image into an =org-mode= buffer +by means of the facilities of [[info:emacs#Dired][dired (info)]] as follows: +1. Type {{{kbd(C-x d)}}} to open the directory containing the specific image + file in a =dired-mode= buffer. 2. Start searching for the specific image by navigating to the name of any image file. 3. Type {{{kbd(v)}}} to switch to view the file in an =image-mode= buffer. @@ -824,13 +820,13 @@ of [[info:emacs#Dired][dired (info)]] as follows: 6. Switch to the =org-mode= buffer and use {{{kbd(C-c C-l)}}} to insert the =org-link= into the buffer. -Listing [[lst:set-dired-options]] makes the directory editor sort entries -alphabetically after grouping the directories before grouping the files by -extension. +Listing [[lst:setup-dired]] makes the directory editor sort entries alphabetically +by extension after grouping the directories and adds a key binding to +=dired-mode-map= to open files with the [[https://en.wikipedia.org/wiki/Eww_(web_browser)][Emacs Web Wowser]]. -#+caption[Set =dired= options]: -#+caption: Set =dired= options. -#+name: lst:set-dired-options +#+caption[Setup =dired=]: +#+caption: Setup =dired=. +#+name: lst:setup-dired #+begin_src emacs-lisp -n :results silent (with-eval-after-load 'dired (setopt dired-dwim-target t @@ -843,20 +839,8 @@ extension. ;; | -1 | list one entry per line | dired-listing-switches "-alGX1 --group-directories-first" dired-recursive-copies 'always - dired-recursive-deletes 'always)) + dired-recursive-deletes 'always) -(with-eval-after-load 'wdired - (setopt wdired-allow-to-change-permissions t)) -#+end_src - -Listing [[lst:extra-dired-key-bindings]] adds a new key binding to =dired-mode-map= -to open files with the [[https://en.wikipedia.org/wiki/Eww_(web_browser)][Emacs Web Wowser]] inside Emacs. - -#+caption[Extra =dired= key bindings]: -#+caption: Extra =dired= key bindings. -#+name: lst:extra-dired-key-bindings -#+begin_src emacs-lisp -n :results silent -(with-eval-after-load 'dired (defun dired-eww-open-file () "In Dired, open the regular file named on this line with eww" (interactive) @@ -866,6 +850,9 @@ to open files with the [[https://en.wikipedia.org/wiki/Eww_(web_browser)][Emacs (error "Eww rejects `%s', since it is not a regular file" file)))) (keymap-set dired-mode-map "E" #'dired-eww-open-file)) + +(with-eval-after-load 'wdired + (setopt wdired-allow-to-change-permissions t)) #+end_src * [[info:emacs#Minibuffer][Minibuffer (info)]]