Emacs: basics of regular expressions (regexp)

Поделиться
HTML-код
  • Опубликовано: 29 янв 2025

Комментарии • 30

  • @protesilaos
    @protesilaos  5 лет назад +6

    I forgot to mention that you can toggle case sensitivity in `isearch' with `M-c'.

  • @burakbey21
    @burakbey21 2 года назад

    Being able to use elisp in the replacement is a gem! Thank you Prot

  • @D1egoaz
    @D1egoaz 3 года назад

    TIL about running elisp functions on groups, it is mind blowing 😲 thank you for sharing

    • @protesilaos
      @protesilaos  3 года назад

      You are welcome! It is a very powerful feature.

  • @arthurcgusmao
    @arthurcgusmao 5 лет назад +2

    Awesome, this one came in quite on time since I am writing a few new Emacs customizations. Cheers!

    • @protesilaos
      @protesilaos  5 лет назад +1

      You are welcome! The built-in `regexp-builder' is a good choice for testing regular expressions using Emacs-style double backslashes. Those are the ones that are needed in elisp functions/variables.
      By the way, I remember checking your dotemacs a few months ago. Will need to do so again!

    • @arthurcgusmao
      @arthurcgusmao 5 лет назад

      @@protesilaos Indeed. The `visual-regexp` package you mention in the video is quite helpful as well. Thank you!
      Regarding my dotemacs, if you do so you'll see it has been greatly influenced by your videos ;)
      There are some needed refactoring and organization to be done in it though, I hope I can get it done before you or other ppl see it :)

    • @protesilaos
      @protesilaos  5 лет назад

      @@arthurcgusmao Nice! I will take a look as soon as I can. You are, of course, free to copy whatever you want (GPL).

  • @richardfrangie3518
    @richardfrangie3518 Год назад

    Thanks bro, I was reading your website and I see that you give Emacs or Linux lessons, at this moment I don't need them but I save your website in case I need them later.

  • @hackerzol
    @hackerzol 5 лет назад +1

    Prot, very nice, I really enjoyed this one. Now if I can just train myself to think in regular expressions in my real projects that would be amazing! Thanks for the video!

    • @protesilaos
      @protesilaos  5 лет назад +5

      You are welcome! Your previous comment inspired me to do this video.
      The intuition comes from training. The same with any new language (code or natural): nothing is intelligible at first. Start small. You don't really need to change your editing habits. Just expand on the margins.
      For example (assuming you have a completion framework like Ivy that supports regexp notation):
      C-x b
      ^2020
      The above will give you a list of buffers whose name starts with "2020". Try:
      .org$
      For names that end in ".org".
      Now say you are reviewing some plain text you have and you are searching for a line that contains "WordA" and "WordB" in this order:
      M-x occur
      WordA.*WordB
      These fairly small additions can offer a lot of value.

  • @EDVRTS
    @EDVRTS 5 лет назад +2

    Prot, your beatiful hair... On a serious note, as a non-programmer, that uses emacs to write org notes, song lyrics, poetry, and my phd, I appreciate your content!

    • @protesilaos
      @protesilaos  5 лет назад +1

      Thanks! I also am not a programmer (beside the basics).
      The hair will grow back again. Just decided to change things a bit.

    • @GreenSkid
      @GreenSkid 4 года назад

      @@protesilaos wow! If you are not a programmer, do you mind telling what you profession is, please?

    • @protesilaos
      @protesilaos  4 года назад +3

      @@GreenSkid I am a farmer now (with the occasional part-time job on the side). Used to be a policy analyst.

  • @karloguidonimartins7252
    @karloguidonimartins7252 3 года назад

    Prot, you are very didactic! Congratulations and thanks for making this video available.

    • @protesilaos
      @protesilaos  3 года назад

      Thank you! I am happy to be of help.

  • @thepinback
    @thepinback 3 года назад

    Great lesson!

  • @alexei3366
    @alexei3366 3 года назад

    Running elisp function in regexp ... it's very cool

  • @walid7885
    @walid7885 5 лет назад +1

    Great video Prot, what is the package you use for presentations? A lot of people use reveal and the presentation is done on a web browser. But I like your setup better. It's more polished.

    • @protesilaos
      @protesilaos  5 лет назад +2

      Thanks! The presentation is indeed in plain text (same with that "switching to Emacs" video). It is a combination of packages that simply prettify the org buffer. I keep them `:disabled' by default, but here is the entire code (note the font function, which you need to adapt or find in my dotemacs and copy it):
      (use-package darkroom
      :ensure t
      :disabled
      :config
      (setq darkroom-text-scale-increase 0))
      (use-package org-bullets
      :ensure t
      :disabled
      :after org)
      (use-package org-tree-slide
      :ensure t
      :disabled
      :after (org darkroom)
      :config
      (setq org-tree-slide-breadcrumbs nil)
      (setq org-tree-slide-header nil)
      (setq org-tree-slide-slide-in-effect nil)
      (setq org-tree-slide-heading-emphasis nil)
      (setq org-tree-slide-cursor-init t)
      (setq org-tree-slide-modeline-display nil)
      (setq org-tree-slide-skip-done nil)
      (setq org-tree-slide-skip-comments t)
      (setq org-tree-slide-fold-subtrees-skipped t)
      (setq org-tree-slide-skip-outline-level 8)
      (setq org-tree-slide-never-touch-face t)
      (defun prot/org-presentation ()
      "Specifies conditions that should apply locally upon
      activation of `org-tree-slide-mode'."
      (if (eq darkroom-tentative-mode nil)
      (progn
      (darkroom-tentative-mode 1)
      (org-bullets-mode 1)
      (org-indent-mode 1)
      (set-frame-font (concat
      prot/fixed-pitch-font "-" (number-to-string 14)
      prot/fixed-pitch-params)
      t t)
      (setq cursor-type '(bar . 1)))
      (darkroom-tentative-mode -1)
      (org-bullets-mode -1)
      (org-indent-mode -1)
      (prot/fonts-per-monitor)
      (setq cursor-type 'box)))
      :bind (("" . org-tree-slide-mode)
      :map org-tree-slide-mode-map
      ("" . org-tree-slide-move-next-tree)
      ("" . org-tree-slide-move-previous-tree))
      :hook (org-tree-slide-mode . prot/org-presentation))
      For the whole thing, check protesilaos.com/dotemacs

  • @hashbrunz
    @hashbrunz 5 лет назад

    nice! ty for the intro :)

  • @menuhin
    @menuhin 5 лет назад +3

    The content of your channel is of high quality: among those about Emacs that I pay attention to.
    Can you please make the font much bigger? Even the heading font is slightly too small for me to follow easily.
    I watch it on my iPad or on my laptop.
    If the font size is like 5x bigger then it is perfect.

    • @protesilaos
      @protesilaos  5 лет назад +2

      Thanks for the feedback! Yes, I will make sure to increase the font size in the next video.

  • @Dus3826
    @Dus3826 4 года назад

    Because you said it multiple times, I am not a native English speaker, but I think instead of "This is false" you should say "This is wrong". If I am false/wrong, please anybody correct me :)

    • @protesilaos
      @protesilaos  4 года назад +1

      You are right. I notice such errors after producing the video. My main challenge is that I only ever speak English while recording. I do not have the chance to do so in my day-to-day life. It is hard to build up the requisite muscle memory without sufficient practice.