5 power user tips for emacs

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024
  • Emacs is a great system and worthwhile for any developer to spend some time learning and improving their skills. RUclips has plenty of introductions and tutorials to Emacs but very few tutorials aim at power users. Here are 5 tips for emacs users who would like to go to the next level or are already experienced with programming and the Unix system and want to work smarter.
    2ad.com/emacs-...

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

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 Год назад +4

    10:34 Regular expression searching is done with C-M-s. Tip: if you want to search for entire words, try putting “\b” at the start and end. For example, to search for the identifier “i” in a program, you can avoid matching “i” in the middles of other names with “\bi\b”.

    • @Argletrough
      @Argletrough Год назад +2

      Or isearch-forward-{word,symbol}
      See M-s C-h

  • @sahandbahari5074
    @sahandbahari5074 Год назад +15

    That was very informative. In addition to the five tips, I learned about repeat-complex-command (bound to C-x ESC ESC) from this video, which is very useful. Thanks.

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

      Ditto!

    • @256k_
      @256k_ 7 месяцев назад

      this was a great discovery for me as well.

    • @teddykayy
      @teddykayy 3 месяца назад

      Same!

  • @nezubn
    @nezubn Год назад +2

    Nice tips, keep making these videos.

  • @Argletrough
    @Argletrough Год назад +4

    S-expressions making your head spin? C-x * q can evaluate normal infix maths notation, and inserts its result into the buffer with a universal argument

    • @johnacairns
      @johnacairns  Год назад +2

      yeah its a good tip! Like I said in the video, learning lisp will ultimately let you fly further faster though!

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 Год назад +4

    7:24 “C-h a” and enter “sort” to bring up a summary description of all commands with “sort” in their name, instead of trying to guess just based on their names.

  • @stevenpe781
    @stevenpe781 Год назад +3

    Nice examples, thank you ! Especially love rgrep & the like...
    One other would be dabbrev-expand (and bind it to Tab) : ultra useful generalized completion (should be mandatory in Word imho !)

    • @johnacairns
      @johnacairns  Год назад +2

      One of the things I love most about this is learning from everyone here. dabbrev-expand is something I didn't use before and it seems very helpful! By default it is bound to M-/. Thanks for your feedback!

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 Год назад +4

    14:55 If you are testing out Elisp functions in a file, you can directly evaluate them by positioning the cursor just after the closing parenthesis, then typing “C-x C-e”.

    • @sofiaknyazeva
      @sofiaknyazeva 11 месяцев назад +1

      Or you can just use M-x eval-buffer

    • @shawnlevy2437
      @shawnlevy2437 10 месяцев назад +1

      @@sofiaknyazeva M-x eval buffer for the whole buffer | C-x C-e for a single lisp expressions.

  • @prism223
    @prism223 8 месяцев назад +1

    For an elisp REPL, there is also ielm built-in for a more convenient experience than the interactive-lisp-mode buffer(s), very useful for bottom up coding.

  • @toddkfisher
    @toddkfisher Год назад +1

    C-x ESC ESC
    Nice! Didn't know about that one.

  • @gmmigge
    @gmmigge Год назад +2

    Nice video, thanks for the tips! In your list of cities, I saw my small hometown Landskrona in Sweden 😊 made me curious what that data was for!

    • @johnacairns
      @johnacairns  Год назад +1

      That is the source code for an upcoming volume on The Crusades in Europe. That specific file is a list of cities for a regional map in the region of the Baltic Sea. Here is a link for reference: www.pen-and-sword.co.uk/Warfare-in-the-Age-of-Crusades-Hardback/p/24051

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

      @@johnacairns wow, how cool! 🙌 Thanks for sharing!

  • @almarn
    @almarn 8 месяцев назад

    The shortest one is mode-line-other-buffer..How to come back immediately to the previous buffer
    Example
    ibuffer..select a buffer...do anything you want....mode-line-other-buffer..go back immediately to ibuffer
    ;; Back to previous buffer
    (global-set-key (kbd "") 'mode-line-other-buffer)
    f12 again to go back to the buffer selected first.
    There is winner mode also for windows history.
    I am using ag in place of regrep.

  • @AllenMcPherson
    @AllenMcPherson Год назад +2

    I noticed a .devcontainer directory in your project. How are you using devcontainers with Emacs? Do you use the devcontainer CLI to start the container and use emacs outside of the container? Is your repo cloned to local disk or in the container? If in the container, how does Emacs get at it? I’m just starting to try and figure this out now. I like the idea of devcontainers, and they work well with VScode, but I’m a grey beard and prefer Emacs?

    • @johnacairns
      @johnacairns  Год назад +2

      The two best ways I have found are to edit the files locally and then provide a build script to build via docker locally (build.sh) or to launch your container in the cloud and then use ssh or tramp to connect to it. Both methods work fairly well and both have some drawbacks as compared to vscode, which is why I typically also run vscode simultaneously with emacs.
      A third option which requires a little more setup but also works pretty successfully in a modern environment is to launch a container in a remote cloud instance and then start emacs from within the container using an X11 (ssh -X) tunnel. This would let you use the full power of emacs including interactive debugging, compilation and code editing within the remote container instance.

  • @deleted-test
    @deleted-test 9 месяцев назад

    where are these boomers at 😭

  • @Argletrough
    @Argletrough Год назад +3

    graa M-< C-SPC M-> so inefficient
    mark-whole-buffer C-x h

    • @johnacairns
      @johnacairns  Год назад +2

      Yeah! Personally love this one and use it multiple times per editing session. You might even notice me using it in this video, but viewers of this video might also want to learn basic navigation < - > C-SPC before learning one more hot key. I think the *case against* emacs is hotkey soup. People want an understanding of how to build up control from basic chords.

    • @sus4793
      @sus4793 9 месяцев назад

      graa! good to know

  • @Argletrough
    @Argletrough Год назад +4

    Use external programs to filter the buffer contents inline with C-x h C-u M-|
    ...or :%! in Vim ;)

    • @johnacairns
      @johnacairns  Год назад +4

      Yes I regretted not mentioning this M-| (meta-pipe) is the hotkey for M-x shell-command-on-region or M-x s-c-o-r. Helpfully, my version of Emacs suggests this keystroke alternation if you actually go to the trouble of typing shell-command-on-region. On the other hand, someone who never encountered this sequence should learn the full command name!