Emacs: file and Dired basics

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ม.ค. 2025

ความคิดเห็น • 65

  • @amanpadamsey1507
    @amanpadamsey1507 2 หลายเดือนก่อน +1

    Thank you!! Excellent presentation

    • @protesilaos
      @protesilaos  2 หลายเดือนก่อน

      You are welcome!

  • @nguyenquocminh2484
    @nguyenquocminh2484 4 หลายเดือนก่อน +1

    12:08 "File name shadow mode" - this is a great hidden feature I didn't know

  • @AndersJackson
    @AndersJackson ปีที่แล้ว +9

    One of the best and efficient video/instructions for find-file and dired.
    Thanks a lot!

    • @AndersJackson
      @AndersJackson ปีที่แล้ว

      I personally hate the use of octal numbers for rights, as that is so easy to make a mistake.
      And Never Use 7 Except in the first group. Because you should NEVER give OTHERS write access to files or directories. That is a security threats, and only experience users should use that right.

    • @protesilaos
      @protesilaos  ปีที่แล้ว +1

      You are welcome!

    • @protesilaos
      @protesilaos  ปีที่แล้ว +1

      Indeed, 7 for everybody is a bad idea.

  • @ciaranmulloy8341
    @ciaranmulloy8341 4 หลายเดือนก่อน

    Excellent presentation at showing many of the capabilities of dired that are really useful! Thank you Protesilaos!

    • @protesilaos
      @protesilaos  4 หลายเดือนก่อน

      You are welcome!

  • @chsdfsbwersdf2568
    @chsdfsbwersdf2568 ปีที่แล้ว +9

    Your videos are showing me just how much of a powerhouse Emacs really is. Thanks a lot!

  • @256k_
    @256k_ ปีที่แล้ว +2

    this video was filmed on my birthday. i remember exactly what i was doing while you were filming this video

  • @mcxds
    @mcxds ปีที่แล้ว +14

    Your videos are doing a great job at making the capabilites of Emacs acessible for users coming from a non-technical background. Thank you very much!
    0:00 Introduction
    1:00 The 'find-file' command; Navigating and opening directories and files
    10:17 Accessing and navigating history of prior searches
    12:10 Navigating by using an absolute file system path
    15:02 The 'vertico' and the 'marginalia' package
    17:28 Finding files and directories by typing just abbreviations
    19:14 Configure dired to hide details (dired-hide-details-mode)
    20:11 'dired-jump' (C-x C-j): command for jumping to parent directory
    21:29 'dired-directory-up (^)
    22:20 'dired-find-file-other-window' (o)
    24:07 Moving and renaming files
    25:38 How to delete a file (D)
    26:45 How to rename a file (R)
    29:13 Operating on multiple files at once
    32:22 Making dired buffer editable (C-x C-q), save changes with C-C C-c
    33:32 Recording a keyboard macro
    36:26 Using dired as a dual pane file manager
    39:00 Create an empty file by visiting a file that doesn't exist with C-x C-f
    39:58 Mark files that match a given regexp (% m)
    41:54 Remove marked items from the current listing without deleting (k)
    44:40 Remove everything except marked items from the current listing by toggling the mark (t) and (k)
    46:34 Introduction to file permissions
    48:17 How to modify file permissions
    51:11 A few more commands
    51:45 project-find-file
    53:32 Introducing the 'consult' package
    54:07 Searching with 'consult-find'
    56:25 Use dired to open files externally
    1:00:37 How to populate the minibuffer with the file at point in a buffer
    1:01:34 The 'dired' command for opening directories

  • @Dar1gaaz
    @Dar1gaaz ปีที่แล้ว +3

    Prot, happy to see you back on Emacs track and full of energy as it seems. Have a great Sunday, greetings from Germany

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      Thank you! Best regards from the mountains of Cyprus.

  • @martinnomine
    @martinnomine 3 หลายเดือนก่อน

    Cool und very usefull video, thank you very much!

    • @protesilaos
      @protesilaos  3 หลายเดือนก่อน

      You are welcome!

  • @srenad2182
    @srenad2182 4 หลายเดือนก่อน

    Thank you for the introduction. It's a little long, but skipping forward (and backward) I managed to find the "gold" for getting started with dired. It's an awesome product, will try to remove the system file manager and see how it goes 🙂

    • @protesilaos
      @protesilaos  4 หลายเดือนก่อน

      You are welcome and good luck!

  • @Dar1gaaz
    @Dar1gaaz ปีที่แล้ว +6

    what I find useful for quickly searching a dir full of files is to just use n and p to move point up and down in dired and then visit a file with letter v and exiting it with q. that is blazingly fast and as it does not require the kill buffer shortcut

  • @vinvivofikas9973
    @vinvivofikas9973 ปีที่แล้ว

    thank you for the detailed information.

  • @10cadr
    @10cadr ปีที่แล้ว +5

    Very nice. It is always good to see you mastering Emacs and being so understandable in showcasing everything. Also, I noticed along your life trajectory, you master (or have good knowledge) about a wide range of things. Emacs, linux in general (wms scripts), philosophy, politics, and just recently the construction area. ` How do you learn things? Learning is a wide area discussed in psychology, pedagogy, and philosophy. Although we have a variety of yt content on the subject, it is not quite rich in content and is just "show off quick methods" in order to "hack your brain". Just a curiosity and a way to compliment your intelligence. Thanks for taking the time to record this video. Much appreciated.

    • @protesilaos
      @protesilaos  ปีที่แล้ว +7

      Thank you! I will have to do a video about this topic in particular. Hints of how I approach it are provided in the talk about "Productivity, honesty, and accountability structures": protesilaos.com/books/2023-02-21-productivity-honesty-accountability-structures/

  • @CaribouDataScience
    @CaribouDataScience 9 หลายเดือนก่อน

    Thanks, the set header and auto align features are pretty spiffy!

    • @protesilaos
      @protesilaos  9 หลายเดือนก่อน

      You are welcome!

  • @gnu-lynx2501
    @gnu-lynx2501 ปีที่แล้ว +1

    excellent recap of the basics. Brothers of the true church make no proselytes! :)

  • @teddykayy
    @teddykayy 6 หลายเดือนก่อน

    These are beautiful

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      Thank you!

  • @gmmigge
    @gmmigge ปีที่แล้ว

    Just wow, I think I just stumbled on my favorite Emacs channel, very well done! I love the pace and you keep it interesting at all times, no meaningless chatting about irrelevant stuff.
    I have a kind of unrelated question which you may have a separate video about (sorry, haven't explored all your content yet): I couldn't help by noticing your very clean environment. I assume you're using a tiling window manager, and I see no panels or chrome around the windows. Could you share what setup you're using when it comes window management?
    Thanks again!

    • @protesilaos
      @protesilaos  ปีที่แล้ว +2

      Yes, it is a tiling window manager. I have all the configurations in my dotfiles: github.com/protesilaos/dotfiles

  • @vishnu3014
    @vishnu3014 11 หลายเดือนก่อน

    Could you please clarify how to get the icons next to the files and directories in the buffer ? I'm unable to see it in my dired installation of emacs.

  • @10cadr
    @10cadr ปีที่แล้ว

    Hi, Prot! I think in one of your videos you have a dired view that shows full file paths for each file, unlikely the normal view that is the heading for the folder the files are in then their names listed. Can you shed some light how I can have full file name lists instead of the default view? I know this sounds kinda dumb, but I want to have a dired buffer that lists all files under a directory and mark some files comparing to a another dired buffer containing symlinks. If I want to edit or delete or add these symlinks, I will make a macro so Emacs will mark them all, comparing the two buffers, so I can keep track and not mark all the musics again and eventually forget some. I am pretty sure I have some duplicates filenames, so path+filename is the safer way to do it. That's how I am planning to sync music across my phone and computer (local music gang + syncthing + emacs shenanigans).

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      I don't remember. There is an option to consolidate arbitrary file paths into a single Dired buffer, though I am not sure this is what you have in mind. Otherwise, you may be referring to Dired's ability to insert the contents of a subdirectory in the current buffer (I use that frequently). Please let me know and I am happy to help.

  • @cricocrak
    @cricocrak 5 หลายเดือนก่อน

    I love your videos, you are an excelent teacher! I have a question: How do you see the icons next to the names in dired? Mine only shows the name, not the pretty icons you have next.
    Thank you!

    • @protesilaos
      @protesilaos  5 หลายเดือนก่อน +1

      Thank you! You need to install and set up the 'nerd-icons-dired' package: github.com/rainstormstudio/nerd-icons-dired. This will pull in the 'nerd-icons' dependency. Once you have these, do 'M-x nerd-icons-install-fonts' and then restart Emacs. You should now see icons in Dired buffers.

    • @cricocrak
      @cricocrak 5 หลายเดือนก่อน

      @@protesilaos Thank you! It worked like a charm

  • @256k_
    @256k_ ปีที่แล้ว

    I love your theme! please tell me what theme this is! i've been looking for something bright and colorful that looks good

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      This is the ef-elea-light theme from my package ef-themes.

  • @omerkasapoglu501
    @omerkasapoglu501 ปีที่แล้ว +3

    ;; I can't do without those dired configurations
    ;; I find dired-jump very useful, jump to current directory of the current buffer
    (define-key global-map (kbd "C-x C-") 'dired-jump)
    ;; Makes the dired buffer uncluttered and more clear
    (add-hook 'dired-mode-hook 'dired-hide-details-mode) ; hide ls information, show only file names
    (add-hook 'dired-mode-hook 'hl-line-mode) ; highlight current line on dired buffers
    ;; using double paned midnight commander's like workflow
    (setq dired-dwim-target t)
    ;; Delete files by trashing, it is safer than just deleting
    (setq delete-by-moving-to-trash t)
    ;;; optional stuff
    (setq dired-recursive-copies 'always)
    (setq dired-recursive-deletes 'top)
    (setq dired-create-destination-dirs 'ask)

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      Nice! I also set most of these.

  • @whatevermait1
    @whatevermait1 ปีที่แล้ว

    no 1 best man

  • @GeorgeHadow-j8h
    @GeorgeHadow-j8h ปีที่แล้ว

    amazing as always Prot!
    Do you have any code handy so that 'RET' runs the default program suggested after calling '(dired-do-async-shell-command'?
    E.g hitting 'RET' on video opens it with mpv etc

    • @protesilaos
      @protesilaos  ปีที่แล้ว +3

      Here is the first idea that comes to mind:
      ;; NOTE 2023-06-27: This user option is quick-and-dirty. I prefer not
      ;; to have an option at all and simply do the right thing based on
      ;; `dired-guess-shell-alist-user'.
      (defcustom prot-dired-always-external-regexp
      "\\(mkv\\|mp4\\|mp4\\|ogg\\|m4a\\|webm\\)"
      "Regular expression of file extensions to open externally.
      The test is performed by `prot-dired-open-dwim', which then
      defers to the `dired-guess-shell-alist-user'."
      :group 'prot-dired
      :type 'string)
      ;; NOTE 2023-06-27: This is a proof-of-concept. See the previous
      ;; note.
      (defun prot-dired-open-dwim (files)
      "Open FILES using the appropriate program."
      (interactive (list (dired-get-marked-files)))
      (if-let* ((extension (file-name-extension (car files)))
      ((string-match-p extension prot-dired-always-external-regexp))
      (guess (dired-guess-default files))
      (program (if (listp guess) (car guess) guess)))
      (dired-do-async-shell-command program nil files)
      (find-file (car files))))

    • @GeorgeHadow-j8h
      @GeorgeHadow-j8h ปีที่แล้ว +1

      @@protesilaos It works! thanks very much!

    • @srenad2182
      @srenad2182 4 หลายเดือนก่อน

      Sorry, I'm really late to the party here, but, 'W' says browse URL, but, it actually leaves it up to the system to open the file in the system default viewer. It only works "async" from what I can see, but, probably that's what you want here.

  • @OneTwoFf
    @OneTwoFf ปีที่แล้ว

    Hi Prot,
    Do you know how to always use short version on a folder? Right now I have to press ( to toggle short mode.

    • @joseluis_io
      @joseluis_io ปีที่แล้ว

      (add-hook 'dired-mode-hook 'dired-hide-details-mode)

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      Exactly what @joseluis_io wrote.

    • @OneTwoFf
      @OneTwoFf ปีที่แล้ว

      Thanks a lot!

  • @jakeh.8754
    @jakeh.8754 ปีที่แล้ว

    I don't think its default behaviour for emacs to read as you type and update the displayed files. Maybe you have some setting enabled that I'm not aware of

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      The default minibuffer requires that you type TAB to update what it displays in the "Completions" buffer. Whereas Vertico displays the matches live.

    • @jakeh.8754
      @jakeh.8754 ปีที่แล้ว

      @@protesilaos I apologize for commenting before finishing the video and seeing the vertico section. May I ask now how you are getting icons in dired? Also, do you ever use dark themes?

    • @protesilaos
      @protesilaos  ปีที่แล้ว

      @jakeh.8754 The icons are done with the 'all-the-icons-dired' package. It depends on the 'all-the-icons' package. Install the latter, then do M-x all-the-icons-install-fonts. Once the fonts are installed, set up the activation of the aforementioned mode with: (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
      Yes, I do use light themes. Though only when the environmental light is low. I like all the dark themes in the packages 'modus-themes' and 'ef-themes' (developed by me).

  • @EdouardTavinor
    @EdouardTavinor ปีที่แล้ว

    1:01:25 oh, i didn't know that!

    • @protesilaos
      @protesilaos  ปีที่แล้ว +1

      That's basically the story of every Emacs user: always learning something new.

  • @josephs1732
    @josephs1732 ปีที่แล้ว +3

    The more I watch these videos the more it's harder for me to use other editors. Emacs ruined everything else for me

    • @protesilaos
      @protesilaos  ปีที่แล้ว +2

      I guess you have to use those other editors? If not, then using Emacs full time is the way to go.

    • @josephs1732
      @josephs1732 9 หลายเดือนก่อน +2

      Four months later, I ditched everything else and now use Emacs full-time. Your videos are amazing! I wouldn't have found the motivation if I hadn't come across them.

  • @auntiecarol
    @auntiecarol ปีที่แล้ว +1

    Your Emacs videos should come with a NSFT (Not Safe For Tinkerers) warning! I just know before even watching this, that I'm going to pick up some 'Oh, that's neat' trick, and want to `C-x b` my init.el
    This time I shall resist.

    • @protesilaos
      @protesilaos  ปีที่แล้ว +1

      Good point! I guess this warning should go with every Emacs-related publication. There is just so much to learn and experiment with!