No video

Emacs: mark and register basics

  Рет қаралды 6,242

Protesilaos Stavrou

Protesilaos Stavrou

Күн бұрын

Overview of how to use the mark and registers in Emacs to select or edit text efficiently, as well as to quickly jump to points of interest across files/buffers. I also mention bookmarks, which are functionally the same as registers. The basic configurations I suggest are available below the embedded video on my website: protesilaos.co...
* * *
Find all my publications on my website: protesilaos.com

Пікірлер: 27
@TheGuilhermetamara
@TheGuilhermetamara Жыл бұрын
I love these emacs basics videos, I'm learning a lot
@protesilaos
@protesilaos Жыл бұрын
Good to know!
@fabioviolino
@fabioviolino Жыл бұрын
Ditto!
@goofansu
@goofansu 28 күн бұрын
Wow, never think mark and register seriously, can’t wait to use them!
@protesilaos
@protesilaos 28 күн бұрын
Good luck!
@544512
@544512 Жыл бұрын
thank you very much for such free lessons
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@vangelisevangelou
@vangelisevangelou Жыл бұрын
Thank you for a very comprehensive video. The transpose command is useful to know. Perhaps this falls outside the scope of the current video, but you haven't mentioned the global mark. A command I occasionally use is cua-toggle-global-mark bound to C-S-SPC: "Set or cancel the global marker. When the global marker is set, CUA cut and copy commands will automatically insert the inserted, deleted or copied text before the global marker, even when the global marker is in another buffer." This is useful if I want to insert various pieces of text from other buffers.
@protesilaos
@protesilaos Жыл бұрын
You are welcome! I have not used CUA. That sounds interesting! My concern with the global mark is that it compounds the problem of not having control over the mark.
@aehjr1
@aehjr1 Жыл бұрын
I have been hoping there was a way to persist registers over emacs sessions, but had never found it. Thank you so much for showing these configurations!
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@holgerschurig4430
@holgerschurig4430 Жыл бұрын
There is. Customize the variable `savehist-additional-variables` (assuming you have `savehist-mode` on, which you should). Just add `register-alist` to it. My version of that variable contains: `(projectile-project-command-history kill-ring register-alist mark-ring global-mark-ring search-ring regexp-search-ring)` Ideally, you will not use `setq` on this variable (as near the end of Prot's video), but instead `add-to-list`. The reason is if everyone does setq (e.g. you, but also some loadable emacs package), then the last one "wins" ... and override the previous setq. However, if you you add-to-list, then you'll just modify the existing list, keeping existing entries intact.
@aehjr1
@aehjr1 Жыл бұрын
@@holgerschurig4430 Thanks for the additional suggestions. I found when updating my config today that I already had projectile-project-command-history and evil-jumps-history in savehist-additional-variables, but just those two. Interestingly enough, I never set that up, so it must be native to projectile and evil. Good to know though. Great suggestions, thanks again.
@protesilaos
@protesilaos Жыл бұрын
@holgerschurig4430 About the 'add-to-list', I agree in general though I wonder if there is a package that changes the 'savehist-additional-variables'. I am asking because that is a user option which, by convention, should not be touched by packages. Put differently, a package must have a very good reason to override what the user chooses.
@holgerschurig4430
@holgerschurig4430 Жыл бұрын
​@@protesilaos This happens a lot. If I grep in my installed packages, I see that projectile, corfu-history and tablist append to savehist-additional-variables'. I have written a package for my own use, that keeps track of various compilation commands. That uses it, too. Also Doom presets many things and adds lots of entries. Any setq would overwrite that.
@sasinari
@sasinari Жыл бұрын
Around 25:11 it will be good to show how to invoke the keyboard macro on all the files. Which commands to invoke the keyboard macro or at least mention what action is being performed. I think for people learning to use emacs that will be a good complete set of demonstration. Thanks for the wonderful tutorials.
@protesilaos
@protesilaos Жыл бұрын
Unfortunately keycast does not seem to show the keyboard macro properly. I typed F4 to play back the recorded steps.
@giovannimoretti9751
@giovannimoretti9751 11 ай бұрын
Excellent video Prot. Yet again illustrates the slightly annoying point that you can use Emacs for decades and yet manage to not discover large sets of features. I'm sure I'll feel the same way after watching your Dired video which is up next.
@protesilaos
@protesilaos 11 ай бұрын
You are welcome! This is basically the story of every Emacs user. There is just so much to learn.
@martinmarshall9344
@martinmarshall9344 Жыл бұрын
Thank you for the tip about prefixing 'transpose-words' with C-0. I had no idea Emacs could transpose textual objects from different parts of the buffer (as opposed to being directly adjacent). It looks like the other transpose commands can do it too. This will be very handy to use with 'transpose-paragraphs' or 'transpose-sentences' when writing prose.
@protesilaos
@protesilaos Жыл бұрын
I use the various transpose commands frequently. They make editing more convenient.
@maxfriis
@maxfriis Жыл бұрын
Love that you at least mix it up with the _modus vivendi_ theme. Was it because of the region highlighting works better than in _operandi_? Personally I prefer a dark theme when watching a video and _modus vivendi_ is one of the best out there.
@protesilaos
@protesilaos Жыл бұрын
I switch themes depending on the environmental light. The reason many of my videos are with a light theme is because I record them during the day.
@user-jb5jz5yd4h
@user-jb5jz5yd4h Жыл бұрын
When you are about to jump to a register with C-x r j, it shows a preview that includes some of the text on that line -- but in my emacs, it just says something like "buffer position: buffer foo.txt, position 123". How do you get the surrounding text to also be shown in the Register Preview window?
@oantolin
@oantolin Жыл бұрын
That is the effect of (setq register-preview-function #'consult-register-format). To get the consult-register-format function, install the fabulous Consult package by Daniel Mendler.
@protesilaos
@protesilaos Жыл бұрын
It is exactly as @dag6hct pointed out. Consult is a wonderful package in general.
Emacs: file and Dired basics
1:02:38
Protesilaos Stavrou
Рет қаралды 13 М.
Emacs: control where buffers are displayed (the 'display-buffer-alist')
29:52
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 9 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 46 МЛН
Dad Makes Daughter Clean Up Spilled Chips #shorts
00:16
Fabiosa Stories
Рет қаралды 2,3 МЛН
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН
Emacs: customize fonts (generic method and 'fontaine' package)
27:16
Protesilaos Stavrou
Рет қаралды 4,6 М.
Emacs: modern minibuffer packages (Vertico, Consult, etc.)
44:01
Protesilaos Stavrou
Рет қаралды 14 М.
Emacs. But why?
51:20
(Bit-Mage)
Рет қаралды 1,2 М.
Emacs: ediff basics
15:49
Protesilaos Stavrou
Рет қаралды 6 М.
Emacs: introduction to bookmarks
24:21
Protesilaos Stavrou
Рет қаралды 7 М.
Emacs: Org mode basics
48:31
Protesilaos Stavrou
Рет қаралды 14 М.
Emacs: completion framework (Embark,Consult,Orderless,etc.)
46:58
Protesilaos Stavrou
Рет қаралды 15 М.
Emacs: introduction to Denote (simple note-taking)
39:04
Protesilaos Stavrou
Рет қаралды 20 М.
Emacs: advanced Org literate configuration
24:57
Protesilaos Stavrou
Рет қаралды 8 М.
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 9 МЛН