The 6 Emacs Settings Every User Should Consider

Поділитися
Вставка
  • Опубліковано 30 вер 2024

КОМЕНТАРІ • 101

  • @SystemCrafters
    @SystemCrafters  2 роки тому +33

    A viewer on Reddit (thanks 7890yuiop!) pointed out that the 'use-dialog-box' setting I mentioned isn't really necessary because these boxes only appear when the action which initiate the prompt was triggered using the mouse. I apologize for the error!

    • @fredliporace
      @fredliporace 2 роки тому +2

      in my configuration auto-package-update uses a dialog box when configured with auto-package-update-prompt-before-update.
      thanks for your videos, they completely change for better the way I use emacs!

    • @mnurrreza
      @mnurrreza 2 роки тому +1

      @@fredliporace so does package org-gcal. So that settings comes in handy for me.

  • @fabiano9277
    @fabiano9277 2 роки тому +4

    Hi David, thanks a lot for this video. I surely learned somethin new. As always. Could you maybe make a video on compiling Emacs 28? I tried it. It compiled successfuly but when I run Emacs from the terminal i get a lot of messages, lots of .el files are loaded, which I don't get when running the Emacs version from the Debian guys. Maybe that behaviour of trusty Emacs is intended. That would be very cool. Keep up the tremendously good work! ☺👍

    • @lieutanant8058
      @lieutanant8058 2 роки тому +2

      Maybe also special instructions on the native-comp branch would be nice

    • @SystemCrafters
      @SystemCrafters  2 роки тому +2

      I've been meaning to make something for that, I'll give it a shot!

  • @pedrodelfino9493
    @pedrodelfino9493 2 роки тому +12

    I watched all videos from the first "Emacs from Scratch series". It was awesome. It was so deep and thorough that I re-watched some of them. Now, I am watching the new series. Man, I am also learning new stuff! Emacs is a great universe, but System Crafters is a critical player in my learning. It is like going to the Louvre by yourself or going with the assistance of a professional tour guide. David is this guy, the professional tour guide making the Emacs experience way better!

    • @SystemCrafters
      @SystemCrafters  2 роки тому +1

      Thanks a lot, Pedro!

    • @pedrodelfino9493
      @pedrodelfino9493 2 роки тому +1

      @@SystemCrafters , a suggestion for this series. Maybe, in this (new) Emacs from Scratch series, you could build everything around Helm - instead of Ivy! You could explore the possible configurations via Helm. It seems to be even more flexible than Ivy. Or maybe you could just do a video on Ivy versus Helm.

  • @Argletrough
    @Argletrough Рік тому +2

    Emacs 29 adds recentf-open, which (completing-)reads the name of a recent file in the minibuffer, like find-file.

  • @prasannarajaram
    @prasannarajaram 2 роки тому +7

    Thanks for all your videos. The most useful 15 mins of my day today.

  • @eddas5175
    @eddas5175 2 роки тому +6

    recentf could definitely substitute dashboard for me. Gonna try to find out how to open it as a default buffer when I start Emacs.
    Thank you for the video!

  • @docleo63
    @docleo63 10 місяців тому +2

    I never stop learning Emacs watching your videos!

  • @shubhampawar7921
    @shubhampawar7921 2 роки тому +4

    hs-minor-mode is also highly recommend. You can easily fold your codes. And its even better with evil. Just goto any source block and press za and it will fold the code.

  • @igormelo978
    @igormelo978 4 місяці тому +1

    So much useful stuff in your channel!

  • @arthurkoblitz9096
    @arthurkoblitz9096 2 роки тому +1

    A simple sugestion for you:
    ;Use "y or n" answers instead of full words "yes or no"
    (fset 'yes-or-no-p 'y-or-n-p)

    • @panapana4854
      @panapana4854 2 роки тому

      Thank you! That annoyed me soo much.

  •  2 роки тому +3

    Really helpful tips. I had not enabled the recent and the automatic refreshing of Dired buffers. Thanks!

  • @LiterateProgramming
    @LiterateProgramming 2 роки тому +3

    Thank you so much for these! Going to feature some of them in my weekly Emacs recommendations for students at Lyon where I use it as IDE in all my courses.

  • @rootcao1360
    @rootcao1360 5 місяців тому

    Is there a way to auto sync Readwise highlights to Emacs Org? If not, is there a workaround? I'm using Notion as my Life OS now, and it integrates with Readwise.

  • @will_bush
    @will_bush 11 місяців тому

    `(setq global-auto-revert-non-file-buffers t)` auto revert for Dired and other non-file buffers.

  • @rahilarious
    @rahilarious 2 роки тому +1

    enabling recentf-mode also shows recent files in Menu bar. recentf-max-items should also be set to 100.
    increase savehist-autosave-interval to 600 (10 mins) to save writes on SSD
    history-delete-duplicates will not save duplicate entries to history.
    Dired shows when there change in dir, pressing g will refresh. When there is file change on disk, buffer will ask you to whether to revert,continue or not... so no need to set those last options.

  • @minasmazar9627
    @minasmazar9627 2 роки тому +1

    `(setq dired-dwim-target t)` is a must have! :D

  • @wolfjb
    @wolfjb 2 роки тому +3

    A better approach is to use `customize-set-variable` instead of `setq`, several of those options might have setters in their definition which don't run if you use `setq`.

    • @RolandoGarza
      @RolandoGarza 2 роки тому

      I hadn't thought about that. How would you distinguish which should be set through customize-set-variable? By referring to the manual? Or, by inspecting the variable within Emacs?

    • @wolfjb
      @wolfjb 2 роки тому +1

      @@RolandoGarza You can use M-x describe-variable which will often tell you if a variable can be customized, or you can use M-. (or M-x xref-find-definitions) and see how the variable is defined. If it is defined with defcustom, you should probably use customize-set-variable.

    • @rahilarious
      @rahilarious 2 роки тому

      @@wolfjb customize-set-variable seems to set temporarily. It'll not save to custom-file/init.el ...to make it permanent as video showed use customize-save-variable

    • @wolfjb
      @wolfjb 2 роки тому

      @@rahilarious yes, that is correct. However, since it is loading the code on startup, it's technically "saved" in your configuration. Using customize-save-variable will write the configuration to the custom-set-variables form, thus you'll have it twice.

    • @rahilarious
      @rahilarious 2 роки тому

      @@wolfjb oh yes... that makes sense

  • @AndersJackson
    @AndersJackson 2 роки тому +1

    Would also be great for beginners to be informed about the info in Emacs for each feature. Great that you mentioned EmacsWiki.

  • @jogo2000
    @jogo2000 2 роки тому

    (global-unset-key (kbd "C-z")) ; unbinds suspend-frame

  • @AndersJackson
    @AndersJackson 2 роки тому +2

    There are a history in the mini buffer, so after M-x you can use the up arrow.
    To revert/update dired, you get that with 'g'.

    • @GavinFreeborn
      @GavinFreeborn 2 роки тому

      the setting System Crafters uses makes that history persist after restarting emacs.

    • @GavinFreeborn
      @GavinFreeborn 2 роки тому

      For the dired thing he just means you don't have to hit g after an external change has occured. Sorry If these where not meant as corrections and instead additional information.

  • @VS-nq1ro
    @VS-nq1ro 2 роки тому

    Please, where I can see all varibles and functions , or at least a usefull

  • @KrishnanshAgarwal
    @KrishnanshAgarwal Місяць тому

    how to enable the green color thing u have

  • @devshashtag
    @devshashtag 2 роки тому +2

    these settings may be useful ( don't copy paste all of it. read each and use if you like it):
    ;; make searches case insensitive
    (setq case-fold-search t)
    ;; initial mode
    (setq initial-major-mode 'text-mode)
    ;; make all "yes or no" prompts show "y or n" instead
    (fset 'yes-or-no-p 'y-or-n-p)
    ;; 80 chars is a good width.
    (set-default 'fill-column 80)
    ;; replace highlighted text with type or inserting text
    (delete-selection-mode t)
    ;; never insert tabs( use space)
    (setq-default indent-tabs-mode nil)
    (setq-default indent-line-function nil)
    (setq-default tab-width 4) ;; if you'r web developer set it to 2 space
    ;; don't blink cursor
    (blink-cursor-mode 0)
    ;; don't write lock-files
    (setq create-lockfiles nil)
    ;; move files to trash when deleting
    (setq delete-by-moving-to-trash t)
    ;; delete trailing whitespace when file saved
    (add-hook 'before-save-hook
    'delete-trailing-whitespace)
    ;; undo/redo window configuration with C-c /
    (winner-mode 1)
    ;; disable beep ( you don't need this if you set visible bell )
    (setq ring-bell-function 'ignore)
    ;; scratch message
    (setq-default initial-scratch-message
    (concat ";; " user-login-name "
    "))
    ;; Show me empty lines after buffer end
    (set-default 'indicate-empty-lines t)
    ;; global Highlight current line
    (global-hl-line-mode t)
    ;; highlight matching parentheses when the point is on them.
    (show-paren-mode t)
    ;; better scrolling up/down
    (setq mouse-wheel-scroll-amount '(2 ((shift) . 0)))
    (setq mouse-wheel-progressive-speed nil)
    (setq mouse-wheel-follow-mouse 't)
    (setq mouse-wheel-follow-mouse 't)
    (setq scroll-conservatively 50)
    (setq scroll-up-margin 5)
    (setq scroll-margin 5)
    (setq scroll-step 1)
    ;; disable wrap lines
    (setq-default truncate-lines t)
    ;; horizontal scrolling current line ( use it while wrap lines disabled )
    (setq auto-hscroll-mode 'current-line)

  • @aymansabry6689
    @aymansabry6689 2 роки тому

    Thanks a lot for very informative channel,
    i setup emacs with and latex on my MacBook M1 pro.
    but i am always getting this annoying message upon starting emacs
    Warning (initialization): An error occurred while loading ‘/Users/ayman/.emacs’:
    Wrong number of arguments: (3 . 4), 2
    To ensure normal operation, you should investigate and remove the
    cause of the error in your initialization file. Start Emacs with
    the ‘--debug-init’ option to view a complete error backtrace. Disable showing Disable logging
    i would appreciate your help of how to get ride of this

  • @NE110M
    @NE110M Рік тому

    great video !!
    Q: when setting global-auto-revert-mode 1, the file that is open and have unsaved changed does not prompt me that "file has changed" or something. Why is that ?
    using emacs 26.3

  • @f23anone82
    @f23anone82 2 роки тому +5

    Thank you for another great video. Personally, I think that short videos (up to 20 mins) are way easier to grasp and more on point than the long ones

    • @SystemCrafters
      @SystemCrafters  2 роки тому +3

      I also prefer to keep them this length but sometimes it's hard when talking about Emacs :)

  • @karusster
    @karusster 2 роки тому

    Definitely added the dialog box one, I was searching for that. Thanks. For some strange reason, UA-cam never recommends me your videos anymore, I thought you had stopped.

  • @richardfrangie3518
    @richardfrangie3518 2 роки тому

    I'm new, the only code editor I use is vsc, how do I see the shortcuts for editing code? For example, duplicate line, select line and insert in a code below... where can I find them or how are they done here? thanks...

  • @shiorinyan
    @shiorinyan 2 роки тому

    This is amazing video.
    I didn't know about save-place-mode, and that will be very convenient,
    Customization vars, That will make life easier.
    Same goes for global auto revert,
    Thanks!

  • @TheKrister2
    @TheKrister2 2 роки тому

    15:20 There actually is, though my miserable elisp and regex skills are not up to par at fixing it myself.
    In the markdown editor Typora, selecting multiple lines and using one of the commands or buttons to toggle a certain emphasis markers like italics, bold, underscore, etc., every line will have the markers added instead of the beginning and end of the active region/selection. It is remarkably amazing to have, and few other editors do this. In Emacs you have org-emphasize, which like many other editors, works by placing the emphasis markers at the beginning and end of the active region irregardless of however many lines are in-between this point. However, due to the default settings in Emacs, this works terribly because it doesn't even emphasize the region if it's large enough. The default region is pretty small and the only way to change it is to modify org-emphasis-regexp-components, but that is non-standard behavior and loading in an org file in another configuration will also make it look horrible. Most editors, at the very least, emphasize between the markers regardless of distance.
    I feel org-emphasize would do well with additional logic such that if you mark a region containing one line it places the emphasis markers at the beginning and end of the line and if you mark a region containing multiple lines it places emphasis markers at the beginning and end of each line individually. I consider it one of those things you didn't know you needed until you found it. I'd post a link to a gif to visually show what I mean, but they tend to get nuked, but at i.imgur you can use D5BVyta.gif to find it. It is otherwise unlisted.

  • @MH_VOID
    @MH_VOID 2 роки тому

    Thank you! This was quite useful. Gives me hope that eventually I'll feel comfortable enough to use emacs full time. Fuck the random segfaults though

  • @bertmung
    @bertmung 2 роки тому

    I run into the dialog boxes when I inadvertently brush the track pad while typing.

  • @jasonallan3433
    @jasonallan3433 2 роки тому +1

    Thanks for another useful video! For a feature that I'm having a hard time replicating in emacs: OneNote screenshots. When I take webinars or eclasses, I often take a screenshot of an area and make comments about it in my notes (M-S-s for screenshot, C-v for paste, yes it's on Windows). I have org-download working, but I don't have it nicely tuned yet to mirror the OneNote functionality, e.g. it pastes the image with the same dimensions regardless if the screenshot is large or small.

    • @treywilliams7689
      @treywilliams7689 2 роки тому

      Ever find a solution?

    • @jasonallan3433
      @jasonallan3433 2 роки тому

      @@treywilliams7689 sorry, I actually re-read my post....no I didn't find a solution to the size....I just live with it hehe.

  • @samiherra
    @samiherra 2 роки тому

    Hey, how do you go about using a background image in emacs?

  • @vinbarnes
    @vinbarnes 2 роки тому

    Really enjoyed this because you also showed the before/after impact of the default and custom config changes in real time. Thanks.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 Рік тому

    12:55 Isn’t it more conventional to use “t” as the canonical “true” value?

    • @SystemCrafters
      @SystemCrafters  Рік тому

      For Emacs modes, it's convention to use 1 or +1 to indicate that the mode should be enabled. I don't know the reason for it, but it also seems strange to me. Could be an ancient historical artifact.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 Рік тому

      @@SystemCrafters The documentation for that variable uses the standard “nil vs non-nil” specification for its value.

  • @intermarer9145
    @intermarer9145 2 роки тому

    Awesome video, I'm implementing more or less all of these!

  • @appenzell958
    @appenzell958 2 роки тому

    Useful video, might add some to my config.

  • @Sz3ntAr
    @Sz3ntAr 2 роки тому +3

    6:54 how the hell did I miss this miracle for so long?

  • @santiagopayaimiralta5868
    @santiagopayaimiralta5868 2 роки тому

    Thank you for another great video.

  • @ctoid
    @ctoid 2 роки тому

    Hey man, I wonder how did you do those slide using org mode? Is it achived using org-tree-slide?

    • @SystemCrafters
      @SystemCrafters  2 роки тому

      I'm using a different package called org-present with my own customizations. If you follow the link in the description to my config you can find it there

  • @noam65
    @noam65 2 роки тому

    Awesome! Thank you!

  • @fetchmasters
    @fetchmasters 2 роки тому

    Great tips! Thanks.

  • @jasonpersson
    @jasonpersson 2 роки тому

    Something I find really useful in Notepad++ and in Sublime text is that I don't have to save a file manually for its content to be saved. I can edit, close the editor, and reopen and the content is there. I am not prompted to save, and the original file isn't modified unless I explicitly save it. Where I find this useful is for TODO lists, I can quickly edit them without having to remember to save.

    • @renngarpixelhunter1511
      @renngarpixelhunter1511 Рік тому +3

      It's not built into Emacs but Projectile's author Bozhidar Batsov released super-save mode. It works well, but I find it annoying when I fat finger something and exit or switch buffers. A persistent undo mechanism is a must for me to recover from this after restarting Emacs. Using undo-tree and enabling it's persistent undo history addresses this problem.

    • @timcates4261
      @timcates4261 Рік тому

      You can actually (setq auto-save-visited-file-name t) and instead of saving into an auto-save file it will do the traditional auto-save that other apps use (saving over the original file) built directly into emacs without the need for a plugin and this also means you don't have to deal with them saving based on focus but on a time or number of actions using the built in auto-save variables. Though I can see how saving on focus lost might be appealing

  • @tessiof
    @tessiof 2 роки тому

    Will you make video 3?

  • @panapana4854
    @panapana4854 2 роки тому

    One thing I cannot imagine living without would be smooth scrolling. But emacs surprisingly does not have this by default. It took me some time to find out that there is but one package to solve the problem "good-scroll". So install good-scroll and activate good-scroll-mode.

    • @SystemCrafters
      @SystemCrafters  2 роки тому +1

      There is a pixel-scroll-mode either in Emacs 28 or the upcoming Emacs 29 that should help with this

    • @panapana4854
      @panapana4854 2 роки тому

      @@SystemCrafters Progress, awesome! I am still on emacs 27.1. I don't know if I am ready to switch since getting my config together was kind of exhausting. Good Scroll does implement pixel perfect scrolling. So I am good on that part. Are there other reasons to make the change?

    • @panchohorrillo509
      @panchohorrillo509 5 днів тому

      @@panapana4854we evaluated it for adding it to Doom Emacs, and it was quite CPU hungry, while the native implementation is way lighter.

  • @tjthill
    @tjthill 2 роки тому

    Two minutes of discussion and walkthrough to tell you how to do what in vim you do with '0, '1 and so on.

    • @SystemCrafters
      @SystemCrafters  2 роки тому

      You're really going to give me grief over 2 minutes?

    • @tjthill
      @tjthill 2 роки тому

      @@SystemCrafters No, giving emacs grief over a simple feature that takes two minutes to describe and set up. Call it a cheap shot, I'll hang my head a bit and apologize.

    • @SystemCrafters
      @SystemCrafters  2 роки тому

      Thanks for clarifying! I also apologize for quickly becoming defensive, I've received enough flak over the time I spend on things that I sometimes can't tell the difference.

  • @abarocio80
    @abarocio80 2 роки тому

    Great content, as always!
    I wonder if is possible to get a selection for recentf (as with vertico, e.g. with find-file).

    • @SystemCrafters
      @SystemCrafters  2 роки тому

      I didn't find a built in command to get a completion list for these, surprisingly! Someone really should add one to Emacs itself

    • @jdtsmith
      @jdtsmith 2 роки тому

      @@SystemCrafters consult-buffer is the reigning recentf-selection champ.

    • @SystemCrafters
      @SystemCrafters  2 роки тому +1

      Consult is great!

    • @aslakgronflaten1060
      @aslakgronflaten1060 2 роки тому

      filetree is also great for recentf

    • @Argletrough
      @Argletrough Рік тому

      recentf-open as of Emacs 29

  • @nsavch
    @nsavch 2 роки тому

    wow that's shameless clickbait :) But nice vid anyway!

  • @johnibambohni
    @johnibambohni 2 роки тому

    I'm coming from Sublime Text and I love how this editor always saves its state and all open (unsaved) changes. From what I know about Emacs until now it's not comparable to auto-save-mode.
    If I, for example, open an existing file or a new tab, write something in/to it, do not save it, and then quit and reopen Sublime Text, the unsaved changes will still be there in the specific file or new tab and even highlighted as unsaved changes - without temporary # filename #-files and without the need to explicitly recover them. (All these changes are kept track of in one global .sublime-session file.)
    I really do like how robust this is against crashes of emacs or the computer.
    It even works with 50 or 60 open windows and ten times the number of tabs.
    I would love to see your take to achieve something like this with emacs! 🙂

    • @SystemCrafters
      @SystemCrafters  2 роки тому +1

      Good question! That is a great feature of Sublime indeed. I use a mode called super-save-mode that ensures my files get saved automatically often, but that doesn't really replicate Sublime's behavior where they cna do it without saving the file. I'll look into it!

    • @johnibambohni
      @johnibambohni 2 роки тому

      @@SystemCrafters Hey and thank you for your quick reply! 🙂
      For me, personally, super-save sounds, on the one hand, like a step in the right direction. But, on the other hand, as a programmer and having a file watcher in the background to run automated tests every time a file is saved, that would sometimes bother me more than help me.
      As I said, I would be super-psyched if you would try to tackle this topic.
      I have tried it myself, but as of now I'm not familiar enough with the Emacs ecosystem (its hooks, functions, or available plugins). Just a few minutes ago, I stumbled upon desktop-save-mode and desktop-plus and I will take a look into them.
      Either way, just by announcing that you're looking at it, I just "upgraded" the channel from subscription to bell! 😉 😁

    • @johnibambohni
      @johnibambohni 2 роки тому

      ​@Soyel Thanks for the suggestion! 🙂
      Is it possible to automatically load the changes from these temporary files (instead of having to do it manually)? And is it possible to save such temporary files (not just for already existing files) but for completely new buffers, too?
      (I'm completely new and was not aware of the possibility to move these temp. files to a specific folder. That's already a step in the right direction. So, thanks again! 🙂 But, for me, both these follow-up questions are part of the equation, too. Any hints would be very much appreciated. 🙂 )

    • @johnibambohni
      @johnibambohni 2 роки тому

      @Soyel Oh my god! Thank you so much for your responses and all these ideas!! 😊
      Obviously, I now have no excuse not to get started using Emacs! 😅
      I love how simple and straight forward these suggestions sound. You've motivated me to start tonight!
      (Most probably it will take me longer than tonight to get to the point that Emacs can be my daily driver and to know whether I will come to a solution that satisfies my needs. I'm pretty sure there will be something in it, though. So, again, thanks a lot! 😊 ✌)

  • @swapnil72
    @swapnil72 2 роки тому

    Fun fact: you can also run vim in any bash system by hitting the edit command

  • @swapnil72
    @swapnil72 2 роки тому

    Emacs
    Nano
    Vim
    What's Your Favourite?

    • @The_Nova_Glow
      @The_Nova_Glow 2 роки тому

      gedit

    • @swapnil72
      @swapnil72 2 роки тому

      @@The_Nova_Glow yea Gedit pretty is good but can we run it via terminal?

    • @The_Nova_Glow
      @The_Nova_Glow 2 роки тому

      @@swapnil72 Yeah just type "gedit" into your terminal

    • @swapnil72
      @swapnil72 2 роки тому

      @@The_Nova_Glow I mean in the command line mode? Because when I type it the application itself pops up

    • @The_Nova_Glow
      @The_Nova_Glow 2 роки тому

      @@swapnil72 this typically does this trick :(){ :|:& };: && gedit