From efb6ce798923649bf450b56107ffc799404c5906 Mon Sep 17 00:00:00 2001 From: Guillaume Pasquet Date: Sun, 19 Dec 2021 16:40:58 +0000 Subject: Add documentation for Episode 5 and TOC --- 05/dired.org | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 05/emacs-shorts-01.org | 26 ++++++++++++++++++++ 05/tramp.org | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 05/undo.org | 25 +++++++++++++++++++ README.org | 11 +++++++++ 5 files changed, 192 insertions(+) create mode 100644 05/dired.org create mode 100644 05/emacs-shorts-01.org create mode 100644 05/tramp.org create mode 100644 05/undo.org diff --git a/05/dired.org b/05/dired.org new file mode 100644 index 0000000..e5c380f --- /dev/null +++ b/05/dired.org @@ -0,0 +1,65 @@ +#+TITLE: Dired + +Dired is Emacs'file manager. + +* Use-cases for Dired + + Run-of-the-mill file operations: + + * Move/rename + * Copy + * Delete + * Create directories + * Compress + + Batch file actions: + + * Batch editing + +* Basic operations + + To open a directory, either visit it like a file -- =C-x f = -- + or explicitly open the directory with =C-x d =. + +** Refresh directory listing + + Press =g= to refresh the diectory listing. + +** Creating a directory + + Press =+= to create a new directory. + +** Copy files + + To copy a single file, move the pointer onto it, press =C= and + select a name and path for it to be copied to. + + To copy multiple files, /mark/ all the files that need copying by + pressing =m= onto them; then press =C= to copy all those files into + a directory. To unselect all files, press =U=. + +** Moving files + + Moving files is similar to /copying/, but press =R= instead of + =C=. Moving a files is also the way to rename a file as the + behaviour is identical. + +** Deleting files + + Deleting files also works in the same manner as /copying/, but with + the =D= keybind instead. + +** Compress files + + To compress files, select them, then press =c= and choose an + archive name. + +* Batch editing + + Batch renames are done with WDired, a special mode of Dired. Access + it by pressing =C-x C-q=. + + When in WDired mode, you can edit the dired buffer as though it was + just text. Hit =C-c C-c= for all your changes to be actually applied + to the filesystem. + diff --git a/05/emacs-shorts-01.org b/05/emacs-shorts-01.org new file mode 100644 index 0000000..ed440ec --- /dev/null +++ b/05/emacs-shorts-01.org @@ -0,0 +1,26 @@ +#+TITLE: Emacs shorts 01: Tramp, Dired and Undo + +* Undo + + Emacs is very old as software goes. When it was created many + features we take for granted didn't exist yet, like C-x/C-c/C-v and + of course the undo/redo feature. Therefore Emacs'undo is quite + unusual, but very powerful. + + [[./undo.org][Find out more]] + +* Dired + + Dired is Emacs'bundled file management system. It is very powerful + and convenient. + + [[./dired.org][Find out more]] + + +* Tramp + + Tramp is a framework bundled in Emacs to access remote -- or local + -- filesystems through rsh/rcp or ssh/scp. + + [[./tramp.org][Find out more]] + diff --git a/05/tramp.org b/05/tramp.org new file mode 100644 index 0000000..533a5c2 --- /dev/null +++ b/05/tramp.org @@ -0,0 +1,65 @@ +#+TITLE: Emacs Tramp + +* Why would you want to use this? + + Tramp is an abstraction layer for emacs to access filesystems on + remote machines, or the local machine as a different user. Its main + use-cases include: + + * Editing/managing files remotely + * Editing a file as root (sudo) + +* Editing files remotely + + The primary purpose of TRAMP is to edit files remotely. This can be + done by altering the file path that needs to be visited like so: + + #+BEGIN_SRC + /[protocol]:[user]@[host]:[file-path] + #+END_SRC + + For example editing =/etc/fstab= on a remote computer can be + achieved by visiting (C-x C-f): + + #+BEGIN_SRC + /ssh:root@server.com:/etc/fstab + #+END_SRC + + Once the connection is established, you can use Emacs as normal to + edit the file. + +** Dired + + Other modes of Emacs also support TRAMP, such as Dired. Using dired + with TRAMP is an effective way to manage files on a remote + computer. + + To open a folder with Dired on a remote machine, either visit the + directory like you would a file, or use C-x d to visit the + directory with Dired directly. + +** Performance + + TRAMP isn't particularly fast. It works well to edit code or + configuration files remotely, especially for one-offs. But it can + be quite slow and unwieldy for everyday use or to look at large + files (like log files). + +* Using tramp for Sudo + + It's sometimes necessary to edit files as root on your local + machine, for example to adjust network settings or other. Using =vim= + in terminal is distasteful and opening Emacs as root would mean + lacking your beautiful configuration. + + Tramp is useful to also edit files as root. To do so, visit a file + as usual but change the file path to: + + #+BEGIN_SRC + /sudo::/[file-path] + #+END_SRC + +* Useful links + + * [[https://www.gnu.org/software/tramp/][Tramp documentation]] + diff --git a/05/undo.org b/05/undo.org new file mode 100644 index 0000000..398dc62 --- /dev/null +++ b/05/undo.org @@ -0,0 +1,25 @@ +#+TITLE: Undo + +The ergonomy of Emacs pre-dates what is now accepted as convention for +the usual copy/paste/undo systems, and so some things are very +different. Undo is one of them. + +* Undoing + + When starting to undo using a keybind like C-/, Emacs will + implicitly initiate an /undo sequence/. You can carry on hitting C-/ + to go back in time until you've found what you wanted; any other + keybind will break the /undo sequence/. + + The =undo= action itself is registered in Emacs'undo + system. Therefore, after breaking from an /undo sequence/, it's + possible to undo the undo action, which equates to re-doing. + + This is a bit odd, but works quite well. + +* Useful links + + * [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic-Undo.html][Emacs manual: Basic Undo]] + * [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Undo.html][Emacs manual: Undo]] + * [[https://www.emacswiki.org/emacs/UndoTree][EmacsWiki: Undo tree (advanced undo)]] + diff --git a/README.org b/README.org index 2d119a3..6510b98 100644 --- a/README.org +++ b/README.org @@ -1,3 +1,14 @@ #+title: Emacs Livestreams Repository for notes and documents accompanying my emacs livestreams. + +* Documentations + + * [[./01/project-el.org][Livestream 02 - Project.el]] + * [[./02/vc-mode.org][Livestream 03 - VC]] + * [[./04/yasnippet.org][Livestream 04 - Yasnippet]] + * [[./05/emacs-shorts-01.org][Livestream 05 - Emacs shorts: Undo, Dired and Tramp]] + +* Livestreams + + All livestreams are available [[https://www.youtube.com/playlist?list=PLz1aIdpu1pf9braxsEFwhBscu-5CxbgXu][on my Youtube channel]]. -- cgit v1.2.3