Emfy: Emacs for You – Quickly set up vanilla Emacs for editing
github.com
github.com
> (setq inhibit-startup-screen t)
> If you are a beginner to Emacs, you might find the startup screen helpful. It contains links to tutorial, manuals, common tasks, etc. If you want to retain the startup screen, comment this line out.
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
To replace the startup screen with a list of recent files, bookmarks, and Projectile projects you've recently visited.Remember, though, that just like this document describes, a big part of Emacs is not running it repeatedly, but rather starting it just once and keeping it alive basically forever; you're only rarely going to see the startup screen if you're doing orthodox Emacs.
I am still relatively new to gnu/linux and I understand that I can unpack package let's say debian package and install each lib. manually but it seems like a big headache, is there any easier way? I am looking for something like copy everything into one directory without a need to register each lib in the system?
But honestly? If you're new to using Linux then you should use the supported approach by your system. If you're running Debian, for example, "apt install emacs". If you're running CentOS "yum install emacs".
Trying to do things outside the confines of the package-manager seems like an odd-constraint. I can appreciate it might make some sense, but when there are so many dependencies installed - fetching/building/installing them all one at a time is going to be very fiddly and annoying, even for a somewhat-experienced user.
Thank you for your advice. The system doesn't have package manager and installing one doesn't seem like safe option at least until I'll be fluent with what exactly package manager does. On debian machine I did what you've suggested. This is not debian nor CentOS. It's embedded solution. In such case it seems like easier to install only emacs. I've already installed some custom application with libs and it was a headache. I wrote my own custom application for it and there I just link statically everything I need to have less trouble with installing.
Might be an easy way to do it without changing too much on your restricted linux box.
However, I also hate it when I want to do something and everyone just tells me not to do it. So the general way to do it would be to get the source code and build it yourself. You will run into issues with versions of libraries being wrong, and this will be hard to fix. Here is a stack exchange story on the topic: https://unix.stackexchange.com/questions/472989/how-to-build...
If you try this, you will learn to appreciate package managers more.
Thanks a lot for this.
I have an issue (on MacOS, not Linux) with trying to read pdf files from Firefox, as it only lets me set packed apps (.app) as commands to run for specific downloads. I have tried and tried and no solution is completely satisfactory (unlike linux, where I just set emacsclient and it works). Do you have any configuration for this on MacOS?
Just in case. Thanks again!
Modern Emacs configurations tend to revolve around use-package, which wraps up the package installer logic at the end of this configuration and makes it somewhat declarative. Just going by the standards of r/emacs or places like that, it'd be unusual to see a .emacs that didn't ultimately boil down to a bunch of use-package clauses configuring stuff like LSP, Magit, company, ivy, and yasnippet.
If I was going to add just one thing to this starter configuration, it'd be a single example of use-package, to make it clear how to add and configure a package the user just read about online --- it's just such a big part of how Emacs is used now.
(If I'm not mistaken, use-package almost made it into upstream Emacs, but they're blocked because one company won't give away the copyright for one contributor to use-package to enable it to be added to Emacs. For the larger Emacs community, I hope that happens soon!)
In elisp side, the generic seq.el/map.el and new string functions are now almost enough to not need reaching out to "missing stdlib" such as dash.el/s.el etc.
Also it is avalaible on GNU ELPA, so you don't need to configure MELPA before downloading it.
The how to configure part would be interesting. Because you literaly never know. Perhaps it's a setq? Or an add-hook? Or a function call? Or a major edit mode? Or a minor edit mode? Or perhaps setq-default? Or setting a variable to t, or perhaps to 1, or perhaps to some other value? Or...
https://twitter.com/theshawwn/status/1472371143000707075
https://github.com/zielmicha/emacspy/issues/1
Setup guide: https://gist.github.com/shawwn/64e17ac3f7b272ce0ce16eb6a593b...
Maybe this'll be the boost you lurkers need to get your butts into one of the coolest editors. "Not your dad's editor" -- new emacs slogan, probably. /s
Bonus screenshot of compiling emacs on a 96 core TPU: https://i.imgur.com/YtJ8jF7.png
It launches emacs, then uses the (relatively) new dynamic modules feature to start a Python runtime, which can then import a library that accesses emacs.
But to my surprise, Python can also import whatever you already have `pip3 install`'ed. I imported jax and did some high speed calculations in lisp. Just kidding, I really did import jax, but it'll take a bit more work to be able to pass numpy arrays to emacs. :) But it's "just" a matter of making some kind of RPC system so that (+ a b) ends up calling back into python to do the addition. Then the circle will be complete -- elisp from python (already done), and python from elisp ("exercise for the reader").
For real though, go throw that fella a star on his github repo. The most surprising thing was that this project has been quietly on github for like two years already. It was sitting at zero stars when it popped up in one of my random google searches.
You're right in this case. Apologies to susam.
The answer, though, is that I'm not going to bother making a repo and a website and packaging this up in a nice way, so it's always going to seem unrelated to whatever emacs thread I happen to post it on. Or I could just not talk about it, which has worked well for me in the past.
It seemed semi-related, because the goal of the OP and the goal of this is the same: to get new people into emacs. Old emacs veterans have no need for an ~/.emacs. But I really didn't intend to steal susam's thunder -- sorry -- it just wasn't marked as a Show HN.
/me slinks back to his cave of machine learning.
One thing I always like to note when it comes to the topic of emacs configurations: Mine has steadily gotten smaller and smaller the longer I used emacs.
I'm a relatively new user. I started with Spacemacs, switched to doom emacs, and more recently finally crafted my own config.
The evolution of my .emacs.d was a constant "Do I really need a plugin/preconfiguration for this?" and for me the answer was "no" most of the time once I researched it, so I removed it and either switched to the default, or emacs builtin functionality.
Nowadays my config is ~130 lines as well, which includes a few lines of documentation and notes since my config is an org file. If I had to trim it down further (or set up a config from scratch to get to work as fast as possible) I'd say that I could trim it down to only a few lines.
I use Spacemacs (and I like it). For people who switched over to Doom Emacs, I like asking them why did they switch over? What were your reasons?
I'm coming from Vim, so having evil-mode as a first-class integration is nice too.
When I saw Doom Emacs though I was kind of skeptical at first (this was about 5 years ago), it seemed to have a lot less batteries included, but I gave it chance anyway, longing after the understanding I got when I wrote my own config. I've been entirely happy daily driving it since. Doom Emacs just seems to have a different philosophy than Spacemacs, it's more like a really well designed configuration framework for emacs on which there are nice layers on top instead of the more monolithic Spacemacs approach. I can easily configure it to my needs, write my own custom modules, and hack on it. It really does a sane job updating and managing the packages, something I would waste too much time on with Spacemacs. So to me is that it seems lower level and better software, yet I still get the preconfigured functionality that allows me to quickly go take an emacs install from zero to hero in a matter of minutes. And did I mention? It's fast.
However, having experienced Evil, Magit, general.el etc. there was no way back. For a while I used my own Emacs configuration that emulated many parts of Spacemacs, but was far more stable.
However, maintaining my own configuration became a bit of a drag. Every time you need another package, you have to figure out how it works and how it can be integrated nicely with Evil/general.el, etc. So, one day I decided to try Doom and I haven't really looked back. It has many of the perks of Spacemacs (sane defaults, space-driven shortcuts), but has been very solid and stable.
And in 5 years I can't for the life of me configure this! No solution transparently sets this default for all time. Every new fucking file type I try to edit needs me to go around in circles fixing this stupid behavior.
Sigh. Back to Vim, I guess. I don't understand why this doesn't come up more often in all the blog posts about transitioning to/from Emacs.
Edit: Try this:
(defun indent-for-tab-command ()
(interactive)
(insert-char #x20 4))Because most people who use Emacs like this behaviour.
Also considering that this post promises a relatively vanilla editing experience, you shouldn't expect a solution to your particular problem.
> And in 5 years I can't for the life of me configure this!
It is not that hard to solve this. It is extremely easy to map any key in Emacs. You can just map Tab key to insert a tab if that is what you want. It will be like two lines of elisp.
Edit: The reason most Emacs users don't find the tab behaviour a problem is: a, Emacs indents correctly more often than not and b, you can insert a literal tab character when you want using 'C-q Tab'.
1. Bind the behavior you want in the global map. (global-set-key (kbd "<key-here>") #'the-action-you-want)
2. Any time you encounter a mode which overrides this key, press C-h k <key-here>. It will tell you the name of the map in which the key is bound (usually foo-mode-map). Then, add: (define-key foo-mode-map (kbd "<key-here>") nil). This will unmap the key from the mode's map, revealing the binding in the global map.
(require 'bind-key)
(bind-key* (kbd "tab") (lambda () (insert " ")))
And you should probably construct the number of spaces from the tab-width variable.There's also general-override-mode-map from the "general" package.
edit: Looking at the code I don't think bind-key* creates a minor-mode but it still does what you want (and is probably the recommended way).
* I installed Emacs 26.3 using `sudo apt install emacs`
* I installed Melpa by following https://github.com/melpa/melpa/blob/master/README.md#usage
* I installed use-package using `M-x package-install use-package`
Now I'm trying to make sense of your instructions while reading https://github.com/jwiegley/use-package#readme. I don't see a bind-key*, but I do see:
- bind-key
- bind-keymap
- bind-keymap*
Should I try one of those instead? They all seem to be in the context of a `(use-package ...)` declaration.
Edit: Never mind, I do see it now at https://github.com/jwiegley/use-package/blob/master/bind-key...
Edit 2: I just tried it and it didn't work. Turns out I've tried this approach in the past: https://lobste.rs/s/whaez0/emacs_everywhere#c_l6ez9w (edit 2 there, heh)
Wait, the suggestion at the top of that comment now works for me on a few different file extensions!
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil) ; to insert a tab anyway: C-q TAB
(define-key global-map [tab]
(lambda () (interactive) (insert-tab)))
Thank you!I'm not at a computer with an emacs installation so I can't try it out myself. I would try binding to a regular key (e.g. "q") while debugging to try to reduce the possible problems.
I think you'll find that remapping tab everywhere like that is going to break a lot of things though (navigating fields/links, expanding sections, etc). You might want to just remap the key by explicitly listing the modes you care about.
The #emacs channel on libera (previously freenode) used to be amazing but since IRC waned it's become less good but if you're lucky and during busy times you might still find someone there that can give you a better solution.
I think I can now give Emacs another try!
The other thing you might want to try is to remap the function indent-for-tab-command to insert-tab.
"If the value is t (the default), the command normally just indents the current line. If the value is nil, the command indents the current line only if point is at the left margin or in the line’s indentation; otherwise, it inserts a tab character." (https://www.gnu.org/software/emacs/manual/html_node/elisp/Mo...)
Unfortunately this doesn't immediately work as described (Mac OS, GNU Emacs 27.2). When the buffer x.c looks like this (^ showing point):
int main(void) {
aaa
^
Pressing Tab now does nothing. I wonder if I need to do something to add this to c-major-mode. I also don't yet understand `setq-default`.Also, does M-i (tab-to-tab-stop) do what you want?
(FYI, you can always get around the comment reply timer (I don't think it's a depth limit) by clicking on a comment's permalink (timestamp).)
There is one obvious conclusion to draw from that.
This is a very honest question.
EDIT: This question is more- what motivates you to be an Emacs-er? Why do you use it? I would love to hear your reasoning behind choosing and sticking with an editor.
Thanks to umanwizard for the answer. Someone else said that it is best to experience it yourself. But you have to understand that mastering a new editor is a non-trivial time commitment. I am willing to put the time and effort given it is worth it. That is what I am trying to find out.
Someone on HN said just some days ago- you cannot simply be a tourist in Emacs and hope to get everything that is good with it.
I guess I will learn both.
Edit: but emacs is a better IDE than vim.
Emacs is not really "an editor" in the sense that vim is; it is more like a platform for building custom IDEs. It's built from the ground up with customization and exploration in mind. Want to know how some function works? It's very easy to jump to the code where it's implemented and start reading. Have you ever thought "I wish my editor did this or that" ? In emacs you can just write the code to make it do whatever you want.
Other editors support plugins, but they're not nearly as seamlessly integrated into the core editor as they are in emacs. Emacs is mostly written in elisp (which is the same language that plugins are written in) so there's basically no difference between plugin code and emacs itself, they are all just running on the same elisp vm in the same namespace.
Sometimes that means trying new things to see what makes you happy!
Also trying all the fun and interesting things in the world would take thousands of lifetimes: choose wisely how you spend your time (which is the most limiting resource many of us have in this world).
For me the reason to prefer Emacs would be its extensibility and ability to modify pretty much any behaviour. I'm no fan of elisp, but it's much more reasonable than vimscript.
https://github.com/hlissner/doom-emacs
However, its a good idea to stop using emacs doom at some point and get your hands dirty with configuring emacs. This just makes the transition more gradual.
Personally I use JetBrains for work and for languages that I'm still learning (Ruby and RoR), vscode for almost anything web because their support for JS is unreal. I use vim for pretty much every config file and quick edits, and will find myself pulling up vim when I need to make some more complicated edits on a file since macros on vim are AWESOME.
And then I use emacs (with EVIL) for beancount files and it works phenomenally for that! I have used it for some Elixir and it just works!
Emacs is really less of an editor and more like a framework/platform/dare I say OS? It allows you to customize and build on top of it like no other software I've come across.
So I'd say, if you are up for exploring check out emacs (I would just start by installing EVIL instead of trying to learn all the "chords" that emacs uses by default) and enjoy the journey!
When I used to write Js, I used VS Code anyway, because its support for Js is really good. I still used vim for everything else.
I will keep both.
Thanks.
Vim is absolutely worth learning for the workflow alone, it's just a really good editor at heart. Emacs is worth learning for the fact that it can do almost anything, and can do them well (even emulate vim :)
These days I pay for gsuite, so my vim usage has declined. But I know it well enough to use whenever necessary. Emacs is just more "me".
It also made me interested in subjects I didn't know about like knowledge management and the history of Lisps, thanks to its community.
What motivates me? The lisp-based config is a big one, I can learn how to configure Emacs and the knowledge of lisp is transferrable outside of it. I enjoy hacking on Emacs that way because I also like lisp.
It's also been 10 years and I'm just used to some of the emacs conventions. I don't use vim keybindings, I have a minimal config that sets up language modes and syntax. It's comfortable for me.
So the simple explanation is that I find joy in working with emacs, and as much as I find joy in working with other tools too, I still come back to the joy that emacs offers me. It's a comfortable and familiar environment for the things that I spend the most time on, and I use other tools for everything else.
What got me to switch was developing in common lisp. I hear things have much improved, but at the time the best setup for vim was a really hacky tmux (or maybe gnu screen?) repl that was spawned and vaguely controllable from vim. I started by just using emacs as a lisp REPL on steroids, and then started to do more with it.
My fingers know more vim key combinations than my brain, and they refused to change for emacs. evil-mode didn't exist yet, so I settled on using viper (an older vi-like mode) and any time my muscle-memory did something that didn't work, I figured out how to add that particular key binding. It was super hacky, but Worked For Me to let me use emacs for lisp dev and vim for everything else.
From then on it was all downhill; there were so many things that you could do in vim, but were harder and the vim packages tended to be less polished than the emacs packages. Neovim seemed to recognize some of the issues with extending vim, but (at the time) was really a terminal-first editor. Now that I could switch between the two without my fingers complaining, when something was better on emacs, I added that to my "list of things I do with emacs."
Eventually most of what I do is in emacs rather than vim, and I reach for emacs first. I had to engrave some music for my son the other day; I've used lilypond (kind of LaTeX for music) in the past so I decided to try it with emacs. Turns out lilypond ships with an emacs mode that does all the basic things, plus registers a command for running lilypond on the current buffer. Tile my pdf viewer next to emacs and I can see the results with a single command.
I can (and have) set up a similar thing with vim, but the community around emacs seems to really take seriously that emacs is more of a gui toolkit with really good text support, while the parts of vim community is suspicious of any significant new functionality to vim that isn't specifically about editing text.
For me, it's just fun. I like writing lisp. I like how Emacs by default presents you with a *scratch* buffer meant to be used for trying out customizations and extensions to the editor. I like how I can modify almost any behavior of the editor to suit my own idiosyncrasies. I like the extremely high quality of the community[2][3][4]. I like how the LSP protocol means that I can benefit from considerably more advanced IDE style functionality than I could even a few years ago. I even like the archaic Emacs style key-binds. However, I do at a bare minimum remap capslock to control and I've been exploring other options like configuring space to input space on a tap and control when held down.
[1] Haha, only serious.
[2] https://protesilaos.com/emacs/dotemacs#h:7b39c38c-ae23-4385-... has a nice list.
[3] https://github.com/rougier#emacs-hacking
[4] And there are so many more. https://old.reddit.com/r/emacs/ is a good community too, despite its parent site's reputation.
To maintain your sanity, I recommend Doom Emacs.
My initial reason for using Emacs was Org Mode.
It’s hard to give a concise, objective reason as to why. My best attempt would be something like “vim is a great editor, but emacs is a great ecosystem”.
I always felt like vimscript got in my way. If I wanted to do something out-of-the-box if was overly difficult to even start. I know there are vimscript wizards out there but it never clicked with me.
Emacs, by contrast, feels like it has no limits. If I can imagine it, I can get emacs to do it. I wasn’t a fan of lisp at first but honestly I have come, over the years, to actually enjoy it.
The thing that really sucked me in though was org-mode. I haven’t found anything like it anywhere else. I use it to manage my team, my projects, my side-hobbies, and my extensive collection of notes. The agenda is amazing and capture templates pull it all together. In the beginning org-mode was what kept the learning curve from driving me away, and now I really can’t imagine using anything else anymore.
Oh, also, tramp is killer. I used to ssh into a sever and open vim there. Every time I was annoyed that my extensive vim config didn’t exist there, but it wasn’t practical to port that sucker over everywhere. Now I just connect from my local machine over tramp. I don’t have to deal with config mismatches, editing happens locally so I don’t have to deal with input lag, and it’s so seamless that I don’t actually miss out on anything. I can edit the file system, open a terminal, run shell commands, whatever.
I did a bunch of quality time with TECO on the PDP-10.
I started using emacs-like editors back in 1985 under Coherent or so when DGC wrote MicroEMACS, which is now MG on most systems. EDIT: this was a replacement for good old ed.
Later, under Dec Unix I used emacs . I have stuck with emacs ever since as it does what i need it to and is easy to add functionality and automation for many tasks.
This config is notably missing conservative-scroll, which I consider essential. A light theme option would be nice too (whiteboard is great). Other important configurable builtins are electric pairs, y-or-n-p, ispell and mouse-yank-at-point.
If you're using this, beware default redo is very unintuitive, and installing undo-tree is a probably a great idea. And it enables emacs server, you might prefer daemonizing instead.
Though with `use-package`, it has become incredibly easy to make even complex setups self-booting (assuming you have an internet connection available anyway). It adds all of 5 lines (or 8 if you need melpa) which is rather incredible for the value it provides.
(defalias 'sup 'straight-use-package)
(sup 'somepackage)
(require 'somepackage) ;; sometimes
(setq somepackage-config-thing)
(add-hook 'some-mode-hook #'some-package-hook)
I know with use-package you'd do all this in the macro with config and init, but especially when it comes to dependent packages I prefer having things flat as opposed to nesting them.My config is apparently 333 lines but a lot of that is whitespace and comments for grouping, plus the bootstrap code which I incidentally use for publishing my blog.
The reason I like `use-package` even for global concerns (I actually have a `(use-package emacs)` e even though that's pretty much entirely global setqs) is it provides some grouping structure and encourages keeping each item in the proper place.
`:ensure` is also pretty much essential as that's what does the bringing-up (ensuring the package being enabled and configured is actually installed locally).
(unless window-system (menu-bar-mode 0))
That way the menu is only disabled in the terminal. Beginners might find the menu useful when running a GUI on Windows or Linux—I certainly don't mind the menu on macOS as it is always there for Emacs.app (regardless of the value of menu-bar-mode).But note also that an Emacs instance can open frames on multiple displays. This is not necessarily that hard to get if, for instance, you start with some X frames and then invoke emacsclient in a terminal in a way that causes it to open a character-cell frame there. window-system is documented as a terminal-local variable for this reason, and similarly the display-foo-p functions take an optional selector argument.
Which means that if you care about that, querying any of those once from your init file will not necessarily do what you want, and you should consider attaching to something like after-make-frame-functions. The global menu-bar-mode explicitly states that it applies to all current and future frames, too; toggle-menu-bar-mode-from-frame seems to be the per-frame version.
But if it's just cosmetic and you don't care about some variance in that case, then whatever. :-)
I recall having my menu bar disappear on some other version of Emacs.app in the past, but I think it was from setting menu-bar-lines to 0 in the frame properties.
A general question would be what version of Emacs you are targeting. As even Debian stable distributes 27.1, you could make use of newer features such as fido-mode (instead of ido and ido-everywhere). Then the package configuration doesn't need the package-initalize either (On that topic adding NonGNU ELPA would also be nice). Also, what it the point of just displaying the current time for two seconds?
By the way, fido-mode is something I am going to add to this configuration in future, so thank you for the suggestion. I do use fido-mode myself in my personal Emacs configuration. However while publishing this project today, I could not make up my mind today whether I should still keep ido-mode around while suggesting fido-mode to beginners.
In my personal config, I have both ido-mode and fido-mode enabled in my configuration. For file searches, ido-mode seems to be superior. For example, ido-mode can search deeply nested subdirectories recursively for a match, something I have not been able to do with fido-mode yet.
$ cat /etc/debian_version
10.0
$ $SHELL --version | head -n 1
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
$ nohup emacs &
$ ps -ef | grep emacs | grep -v grep
susam 22210 22046 2 13:59 pts/0 00:00:00 emacs
$ ps -ef | grep 22046 | grep -v grep
susam 22046 22042 0 13:45 pts/0 00:00:00 bash
susam 22210 22046 0 13:59 pts/0 00:00:00 emacs
susam 22224 22046 0 14:00 pts/0 00:00:00 ps -ef
The parent of the emacs process is still bash, so when bash dies, Emacs dies too.However, invoking `nohup emacs &` from another shell script does work. The PPID of Emacs gets assigned to 1 and Emacs continues to keep running even after killing the shell. Example:
$ bash -c 'nohup emacs &'
$ ps -ef | grep emacs | grep -v grep
susam 22229 1 2 14:02 pts/0 00:00:00 emacs
$ dash -c 'nohup emacs &'
$ ps -ef | grep emacs | grep -v grep
susam 22229 1 0 14:02 pts/0 00:00:00 emacs
susam 22238 1 2 14:03 pts/0 00:00:00 emacs
$ ps -ef | head -n 2
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Dec29 ? 00:00:01 /sbin/init
In the second experiment, the parent of the emacs process is the init process, to it continues to run successfully even after the shell or terminal exits.To summarize, yes, we can use nohup in the startup script and make it POSIX compliant.
My vimrc is similar - just around 50 lines accumulated over the same time period since the 90s.
I went for the simplest thing I could set up: paredit, aggressive-indent, parens-mode, chez(inferior lisp)
So far so good, but one thing I noticed, I had forgotten paredit commands, and emacs isn't very pleasant if you don't have things in your muscle memory.
By and large emacs is best system you can use if you are writing lisp.
C-( and C-) have parentheses that look nice and round. They expand the current s-exp to consume other expressions. Nom nom nom!
C-{ and C-} don’t look nice and round. They have braces which look a bit wiggly. They shrink the current s-exp and barf expressions.
These mnemonics have served me and others I have shared this with very well.
Cool way to remember things.
Very frequently, I'll want to perform this kind of process:
1. I search for some frequently occurring string or regex in a file.
2. Get a series of cursors for every result of that search.
3. I'll know that it's possible to do a manipulation of all these lines, but frequently it's not immediately obvious how, so I experiment a bit at this point. Frequently I end up doing things like manipulating the cursor to delete sections of the line, and modify the shape and order of some elements. This requires I can select portions of text, cut them, and paste them in a different part of the line. So each cursor needs to have its own clipboard. I also tend to do things like add variables to the cursors. Sublime has a nice way to have incrementing integers so the first cursor inserts a 1, the second inserts a 2, etc. There are all sorts of little tricks like this. One appeal of something like emacs would be having a simple language to write stuff like this quickly myself.
4. After experimenting, I complete the manipulation. If I fail the first time, I undo, and do it again.
This kind of thing takes less than 15 seconds for me, but it saves a ridiculous amount of time.
It's really useful during this to actually be manipulating all lines at once, since it lets me see where assumptions I have about the data I'm manipulating is incorrect.
I've tried every multi cursor package I've seen in emacs, and I've tried to figure out how to get this kind of thing down through macros, but the live editing of multiple lines seems invaluable and keeps me in Sublime/VS Code. I'd love to know if I'm doing something wrong with macros, there's a solution to what I'm trying to do, or if realistically my best bet is to stick to what I know.
There's an incrementing counter for regexp-replace, a way to manually enter a part of each replacement, and other goodies.
Personally I only use capture groups, no counters or other stuff.
I do like using M-p to edit my previous failed replacement before trying again. Sometimes I use a simple replacement as a test, undo it, then edit it to add further modifications.
https://www.gnu.org/software/emacs/manual/html_node/emacs/Re...
Also curious on the benefits of single space for sentences. I confess I don't use abbreviations that need periods often; but I also don't use many commands that work on sentences. (And, I do still use two spaces for sentences.)
That said, played with this some today and I see that I can get my startup down to about 5 seconds on my old netbook. Not too bad, all told. (This computer is hilariously slow.)
I have a question about the server/client mode:
> Experienced Emacs users run a single instance of Emacs and do all their editing activities via this single instance.
What's the motivation for running it this way? I think the repo should explain why, especially since it's targeted at newbies. Also because it looks like a lot of effort was put into explaining how and discussing the em script that makes it more convenient.
For what it's worth, I'm an experienced Emacs user, and I don't run a single instance. Instead, I start lots of new instances. As best I can tell, the motivating factor for a single instance is startup speed. However, I'm satisfied with my startup speed and haven't felt the need to improve it with server/client mode.
There are a few uses, for me, of daemon mode that have kept me using it.
First, like tmux and mosh, emacs daemon is persistent. Should I accidentally close it but not really intend to close it, everything is still there. Useful if you use emacs for more than just editing (like an IRC client). In that instance, all my buffers are still present and anything that needs ongoing execution will continue to happen.
Second, I never got used to using emacs as my shell. So I drop back to the shell for most of my filesystem navigation and running various CLI tools. With the daemon running in the background, this means I can close the client, navigate or run programs, and reload the client with everything in place or while opening a new file.
Third, I often use multiple daemons, one for each project/language. I use the shell to go to the project root and launch a new (named) daemon. Then when navigating around the project in the shell, I can open a file for editing using the appropriate client incantation. This lets me keep a full emacs daemon running but with only the appropriate buffers and subprograms (useful when dealing with interactive languages like Lisp or Erlang, where I may also have a project-specific REPL running).
Fourth, I use magit and tmux. So I usually split my window into two panes with editing/navigation/CLI activities on the left and magit on the right. The magit instance gets to share the same kill ring and buffers as the editing instances on the left. I know I could do the same by splitting the frame left and right the same way, but this has become my preferred interaction. Plus, since I don't use emacs' shell mode I often further subdivide the panes anyways, like editor in the top left, magit on the right, and shell in the lower left with fswatch running tests continuously.
I suppose that if I just did everything in emacs (including the shell and file system navigation) then it would be less useful. But I don't, so it's very useful.
The multiple daemon approach is intriguing. I don't think I've run across anyone discussing that before, although a quick search turns up a few posts/threads that I've missed.
And yes, I have tried to replace left-ctrl with capslock, but it was annoying as well.
Besides that, can't remember if it was on Linux or Windows, but there was an input lag when using Capslock as Ctrl. I had to wait like 1s for it to register. Mostly unusable, and I used both systems a lot at the time.
I never used the built in keys for cursor movement (I use the arrow keys), buffer switching (I define my own more efficient key), etc.
For example, there wasn't a generic "run the code in this buffer" command for me to map. I'd have to map all the run-foo command for all languages.
I use the side of my palm for C, it doesn't take long to get used to and allows you to keep your fingers on the home row. Obviously this transfers to CUA or any other standard/config that utilizes C.
* for quickly opening and editing a file without using a bloated IDE, especially on remote Linux machines. * for magit (git tool inside emacs) which is honestly a super power for those who know it.
As I switch jobs and machines I keep looking for a “quick” config , and I find doom emacs suits very well.
As a new emacs convert after 20 years of vim I will try one day to start from scratch for learning purposes. But just like I would not use LFS for work I would not use vanila emacs either. I use debian distro for linux and doom for emacs.
You don't need to know any elisp for that. I've been using emacs for years and probably couldn't write a "hello world" in elisp. Configuring packages can be done in the configuration GUI, or else it is just setting some variables - I think I've only ever used 3 eslip functions - (setq), (add-to-list) and (add-hook).
Honestly the hardest part of emacs is finding which packages are quality and worth installing. This is where I find doom/spacemacs/prelude emacs useful. I browse their repos every now and then to see what packages are worth trying out - and install them with the built in `package-install` command.
apt and nix are just layers of complexity on top of a very simple concept – copy and edit some files.
Files and directories are just layers of complexity on top of a very simple concept – bytes arranged in blocks for persistent storage.
You get the idea. One needs choose where to draw their own personal abstraction layer line.
Just now I experienced: weird keymaps (C-? C-? to do things, including exit... do I have to Google keymaps, read docs about keymaps, remap keys to my own preferences, or just memorize existing keymaps?), signaling EOF (normally Ctrl-d) doesn't quit (gives a weird error "mark not set"), not knowing which buffer I'm looking at or how to list/switch buffers, no (initial) mouse support, no idea how to search and replace, no idea if spawning multiple cursors is possible.
All that in a span of ~5 minutes. I'm not trying to hate on emacs, just trying to list some pain points of the UX.
I'd be willing to give another emacs dotfile a shot, but I think it'd have to be even simpler than this one.
read this for a complete answer https://www.gnu.org/software/emacs/manual/html_node/emacs/In...