8 ms·
Emacs for Professionals
- kristopolous 5y agoUsing emacs AND vim isn't some mutually exclusive impossible thing. There's lots of nice features in emacs. Look at it as a suite of tools (applications) that has an editor-like interface; debugging, email, even spreadsheet calculations - you can totally still edit files with vim and find emacs really useful. For instance, you want a really powerful calculator? https://www.gnu.org/software/emacs/manual/html_mono/calc.html https://www.gnu.org/software/emacs/manual/html_mono/calc.htm... try that out Try giving the "Grand Unified Debugger" a spin as well. The ease of Visual studio debugging is one of the only things I miss from Windows dev and GUD really comes close. I use vim as my daily editor but fire up GUD frequently for stepping through code. Don't view the tools as mutually exclusive.
- pmoriarty 5y agoI used vim for over 25 years before switching to Emacs, so I'm perfectly capable of using both, and do use both.. but for me Emacs does virtually every that vim does and more, while vim only does a couple of things that I need that Emacs can't, and I find myself needing vim pretty rarely.
- colordrops 5y agoDo you use some sort of extension or plugin to get Emacs to use modal editing and the home row like vim? Or did you switch over to the Emacs key bindings?
- pmoriarty 5y agoI use Evil to get modal editing, and have spent countless hours configuring Emacs to be as vim-like as possible. As a result I can easily switch between vim and Emacs and feel completely comfortable editing in both.
- colordrops 5y agoI'd love to switch, but have spent a significant portion of the last four months moving all my personal infra to NixOS. Will need to take a break and spend more time with the kids before diving into something like this again haha
- mplanchard 5y agoWhen and if you do, be sure to check out the emacs-overlay! It makes it super easy to build/install development versions of emacs, to compile with native-comp, and so on
- ducktective 5y agoProfessor Moriarty, a couple of questions: Is this switch because you've moved on to LISPs? Doesn't startup time and lag of emacs (compared to vim) bother you?
- pmoriarty 5y agoThe startup time of Emacs is not an issue because I only start the Emacs server once and keep it running for a long time, connecting the Emacs client to it as needed. Once the Emacs server is running then connecting to it is as fast or faster than starting vim from scratch. Even restarting Emacs from scratch can be effectively instant, if you don't have a giant config like I do. Vim startup time can be slow too, by the way, if you have a lot of plugins. So, effectively, vim and Emacs don't differ on startup time these days like they used to. As to your question about Lisp, it definitely was a huge draw to Emacs because I fell in love with Lisp and almost the entire ecosystem of Emacs is written in Lisp... and I'd certainly much rather program in Lisp than vimscript, or even Python (or any of the other more mainstream languages). I remember coming across various things I wanted to do in vim that were pretty awkward to do because of how clunky vim and vimscript were. Lisp and Emacs just made doing what I needed much easier overall (though some things were still easier in vim.. for example, vim has some powerful features in its regex engine that don't exist in Emacs, even when using Evil). This was before neovim, so maybe it's better there, though since both vim and neovim lack Emacs' Lisp ecosystem, I doubt they'll ever be able to match Emacs in this respect. There were a lot of other reasons for the switch to Emacs, like having deep web browser and shell integration, being able to read my email from within Emacs, and do a ton of other things from it.. org-mode was another draw.
- ducktective 5y agoWhile you were using vim, did you use tilling window managers? Did you use a dmenu-driven workflow that calls bash scripts and unix utilities? When people talk about "composability" and "integration" of EMACS, it strikes to me that, vim+i3+unix setup is essentially the same. Just instead of LISP, bash/python is the glue language.
- 5y ago
- elteto 5y agoProfessor, is it true that Holmes is a Notepad++ user?
- daniel-cussen 5y agoMore of a hardware user. Hard drugs, hard thought. It's funny Arthur Conan Doyle says Sherlock Holmes is based on I think two guys, but there's a third guy he's also based on Conan Doyle didn't talk about, and that was the guy who cracked cases the hardest, just never talked about because of he was the one the whole coke-injection trances was based on (which was legal at the time). Protected his privacy, you understand. Kind of like Paul Erdos.
- JNRowe 5y agoI'm one of those weird users who works in both, and I've also never really understood the need to pick a side. I initially used emacs for years, and now I've used both for years. I also don't pick a side in the tea and coffee debate, sometimes I want rooibos and others espresso. Admittedly, my emacs usage at this point is largely to treat it as a collection of distinct apps; fire up in nov-mode¹ mode to read books, fire up in magit-status² to mangle git repository, etc. It really feels like there are a collection of best of breed apps that just happen to built on emacs as a toolkit, most of which are fully functional without buying in to emacs for life(not that I'm saying there is anything wrong with that). The only time I really use emacs as an actual editing tool is when I'm working on documentation, and that is largely because I like being able to see inline screenshots in that instance. That could equally flip again should I see some feature I want. ¹ https://github.com/wasamasa/nov.el https://github.com/wasamasa/nov.el ² https://magit.vc/ https://magit.vc/
- deleted 5y ago[deleted]
- AndyMcConachie 5y agoI reget I have but one upvote to give you. I use different editors for different things and I could not agree with this sentiment more. I use Emacs almost exclusively for note taking and for writing software. But I use vim for editing config files, or for smallish files in /etc/. I really like Emacs for writing software, but I have used vim for this as well. Over the years I've used many different editors and I expect I will use many different editors in the future.
- taude 5y agoI use both, a lot, too. They both have their places. I'm using vi/vim whenever I shell onto a machine; I typically use ripgrep to search a huge codebase for the file I'm looking for and then typically open that single file in VIM. (I read more code than I write these days). I use Emacs (Doom) more for Org-Mode and note taking, and sometimes as client for accessing APIs (through verb package). I'd like to get my SQL for the various types of databases I connect to to go through emacs. But once the connection history is in my bash history, and how easy it is to press ctrl-x ctrl-e to edit the command (in VIM), it hasn't been painful enough to put the time in. And ironically, I use neither for my main code editor.
- aulin 5y agoI use vim for quick and fast terminal editing: little shell scripts, config files, commit messages. Emacs for anything serious.
- emptysongglass 5y agoAgreed, anyone who brings up the culture war between Emacs and Vim users is acting as an agent of discord. I love and appreciate Vim users and love and appreciate Emacs users. I "use" both thanks to evil, an Emacs package that brings vim emulation to Emacs.
- deleted 5y ago[deleted]
- lazyier 5y agoEvil Emacs is a better Vi them Vim IMO. Although NeoVim is pretty special.
- ilrwbwrkhv 5y agoI crack open Emacs for Steel Bank Common Lisp. But Neovim for everything else. They are pushing the boundaries of Vim like no other with Treesitter, LSP etc.
- nonrandomstring 5y agoSaw this posted on emacs-news [1] asking for some feedback. A thought I had about using dired as front-end to everything is that once you get more than 20 buffers open its unwieldy to find things. Working on several projects at once using the standard C-x b navigation or even Helm bindings seems to take too long. That's why I still use a window manager that has workspaces with their own key (rebound alt-gr) and several copies of emacs and term emulators open. Does anybody have positive things to say about something like "buffer groups" for emacs? Projectile or iBuffer. They're mentioned here [2] but alas I never had much joy with them. [1] https://sachachua.com/ https://sachachua.com/ [2] https://stackoverflow.com/questions/9972523/emacs-buffer-groups-tabs https://stackoverflow.com/questions/9972523/emacs-buffer-gro...
- Kaze404 5y agoI use Projectile extensively, to the point where it serves as the entire foundation for my workflow. I really enjoy having a set project I'm working on when I open Emacs, and when I need to multi-task I use persp-mode.
- nonrandomstring 5y agoThanks Kaze, I'll take a closer look at it again.
- hsbauauvhabzb 5y agoI have the buffer listing mapped to a key, and next/previous buffer to alt tab/alt+shift+tab, I’m happy with this setup personally, and I regularly have multiple projects open.
- trey-jones 5y agoAnother point for projectile - 3 main features: 1. Open project. Projectile uses source control files eg. .git to establish the project root, and remembers it. It's very smart about it, in my experience. No configuration required. 2. Open file in project. With the project root established, open any file that's part of the project. Notably this excludes files that are eg. ignored by .gitignore. Again, very smart behavior. If you know generally what you are looking for, you should be able to find it in a few keystrokes. 3. Grep in project. If I'm working in something that doesn't play too nice with looking up references, or generally just can't find it, this is the next best thing. It's just grep, but within the scope of your project, and a nice interactive list of files to be searched or perused at your leisure. I also use ibuffer, but I guess you would probably have the same issues with it as with dired. Both are just emacs buffers and can be searched, etc. just as any other buffer. Mostly I use iBuffer to make sure buffers are saved and close them en masse.
- continuational 5y agoI think Emacs is built upon a golden idea: The programmable text buffer as the user interface for the OS. A lot of data manipulation can be expressed as text manipulation, especially if it only has to be correct in a single instance. However, Emacs is really starting to show its age. The keybindings are arcane and pre-standardization. There is no built-in support for multi-cursors, which are often much more direct than macro recording. Configurations are time consuming and perpetually broken. I think it's time for a replacement.
- planede 5y agoAm I the only one who doesn't get the multi-cursor hype? Having said that I never used it, so maybe I'm missing out.
- kreetx 5y agoYou are not. Perhaps people who use it can elaborate, but it seems to be an interactive search-and-replace with highlighting. Is it anything more?
- CraigJPerry 5y agoIn vscode if my cursor is in a word, i Ctrl+D to select that, then Ctrl+D to select further matches, then begin typing over them. There's other modes too where you can just add more cursors to a line below/above but i find less use for that. But in vim it's not much slower to do: /<search term> cgn " change this this i just matched . " find next occurance AND execute the change here too, i don't have to say "n ." because i used cgn above instead of something like cw But i still end up relying on qq " stick a macro in q register <complex edit sequence> @q / @@ For more gnarly stuff
- ckolkey 5y agopresuming you did a `/<search>` for the results you want, you can follow it up with: :%s//<replacement>/gc
- pmoriarty 5y ago"I eventually made a decision to learn Emacs because I knew that it follows the principles of functional programming better than ordinary shell scripting. In functional programming you have two key ingredients: functions, and a means to compose functions together to build larger functions that solve a particular problem. Without using Emacs, your functions are the Linux CLI tools, and you can compose these tools with shell pipes to solve problems. But Emacs provides better ways of composing CLI tools because it is programmed in Lisp, which is a functional programming language." Lisp is a multi-paradigm language, which lets you program in a functional style, but doesn't force you to do so.
- gpderetta 5y agoand the elisp code you see around does not particularly follow a functional style either. Arguably shell pipelines feel more functional.
- zelphirkalt 5y agoI think one of Emacs' design decisions was deliberately not going fully functional, but having global state and different scoping (Was it "dynamically scoped"? I always forget, which one is which.), because threading everything through all the functions would be quite complicated. However, it may be possible to interact with Emacs using Elisp in a quite functional way.
- dan-robertson 5y agoMany early lisps had dynamic scoping only. It meant that this code would return 5 (defvar x 1) ; new global var (defun foo () x) ; function returns x (+ (let ((x 4)) (foo)) (foo)) ; => 5 It also meant that anonymous functions weren’t closures. Later on, scheme used lexical scoping and Common Lisp used lexical scoping normally with dynamic scoping for special (typically global) variables like standard-input. At the time, implementers were worried that they wouldn’t be able to do lexical scoping efficiently. Emacs lisp only had dynamic scoping for a long time. Furthermore it had buffer-local-variables where the editor has a notion of the current buffer, buffers can have definitions of variables, and the value you get for a variable depends on what it is bound to within that buffer as well as dynamically. Over time elisp got true closures/lexical scope, first via a library and later as a language feature (if a certain buffer-local variable is set when you compile/evaluate a file, you get lexical scoping; the easy way to set it is by writing a specially formatted line in the file which allows emacs to set ‘safe’ buffer local variables on opening the file.
- rs_rs_rs_rs_rs 5y agoWould love to use emacs but for my use case everytime I open a relatively big json file it takes couple of sends until emacs is usable while lsp and other plugins run on it. I keep hitting these annoying lags when I can't use the tool for 1-2 seconds while something runs. Is this something I could avoid or it's unavoidable since Emacs is single threaded? Using Doom Emacs at the moment.
- pjm331 5y agoHave you tried the eglot package for LSP instead of lsp-mode? Can toggle it on with +eglot flag for lsp module in your doom config I was having the same issues and that solved it for me
- TacticalCoder 5y agoWhat is your hardware? How fast is your Emacs? Ryzen 3700K here: time emacs -nw -Q -eval '(kill-emacs)' <- no GUI, no config file at all 0.086s in my case (86 milliseconds) and I think that's relatively slow compare to machines others have here (5900X / 12th gen Intel / M1 macs etc.). Then: time emacs -eval '(kill-emacs)' 1.4s (loading a very big custom Emacs setup). Are you using the native-comp branch of Emacs? Are you using a native JSON parsing lib? (not sure if it helps to open JSON files themselves but it speeds up LSP greatly, for LSP uses JSON files). > Is this something I could avoid or it's unavoidable since Emacs is single threaded? I don't know about gigantic JSON files but that's very weird to me: I can start working on my Clojure files while LSP is starting. And LSP is definitely starting in another process that is not blocking the Emacs thread. Emacs may use a single kernel thread but there are lots of things that are done by external processes. I'm not saying there aren't things that can block Emacs but, in my case, although LSP is still slow to start up, it's definitely not blocking my Emacs (top, for example, shows clojure-lsp running as its own process). I'm using Emacs since decades and it has never felt faster than nowadays: newer hardware, NVMe SSD, native-compilation branch, integration of ripgrep and fzf (two amazing helper tools that are insanely fast) through ivy/counsel (counsel-rg / counsel-fzf)... Cherry on top: I now get the LSP servers and although it's not IntelliJ yet, it's much better than any "Emacs" I used in the past.
- 5y ago
- silasdb 5y agoAfter years using vim and variations (vis), I decided to give Emacs another try, this time using Spacemacs. I'm a bit surprised nobody mentioned Spacemacs (https://www.spacemacs.org https://www.spacemacs.org) as a very good alternative for vim users that want to learn Emacs. I'm very satisfied with it, although it is slow to start, but I'm going to try Emacs server/client that I just heard about in this discussion. Have anybody tried Spacemacs?
- joeman1000 5y agoI think the tide has turned in favour of doom emacs, which was heavily inspired by spacemacs.
- NoThisIsMe 5y agoI think that's basically true, but there are still many of us using and contributing to Spacemacs. It comes with a bit more out of the box than does Doom.
- higanbana 5y agoI tried it, but Doom Emacs is the better alternative. Spacemacs ways too bloat and configuring it is a big pain. I think it still does everything Spacemacs capable of
- gaws 5y ago> Spacemacs ways too bloat and configuring it is a big pain. Doom is just as bloated and a pain to config.
- kevincox 5y agoI tried Spacemacs and was fairly happy other than the performance. Scrolling and even auto-indent were visibility slowing down my typing. It depended on the language but Rust, which is probably my most common language, was distinctly bad.
- 5y ago
- deleted 5y ago[deleted]
- cutler 5y agoDired is an abomination filling up your buffer list as you traverse directories.
- arc-in-space 5y agoI use tabbar and confine dired buffers to their own group, which makes it actually useful that they stick around.
- yaantc 5y agoFrom Emacs 28 onward, set 'dired-kill-when-opening-new-dired-buffer' to 't'. It will kill the previous buffer when opening a new directory.
- trey-jones 5y agoAbomination is not the word I would use. I also find it to be indispensable, whatever it does to my buffer list.
- alex_smart 5y agohttps://github.com/emacs-mirror/emacs/commit/5afe27624f7 https://github.com/emacs-mirror/emacs/commit/5afe27624f7 This is the patch that added the feature you wanted to dired. 30 lines of diff, 20 of which is documentation. Calling a piece of exceptional software an "abomination" because of one specific behavior that you find annoying is the wrong attitude to have, especially for an emacs user. It is emacs. You can make it do whatever you want within a few lines of lisp.
- cutler 5y agoOk, perhaps "abomination" was excessive but, seriously, why is opening a new buffer each time you traverse a directory a sane default?
- alex_smart 5y agoYour assumption is that the state of a dired buffer is trivial to recreate so should be thrown away. While that is the case in the simplest use case of using dired as a replacement of a bog-standard file browser, it is possible for the state of the dired buffer to be more complicated. For example, the buffer could contain marks and flags for some batch operation the user was working on before they decided to visit a subdirectory. The dired buffer may not even correspond to just one directory but may be a result of a complex find operation or may contain some arbitrary set of directories the user manually curated. It would certainly not be nice to the user to lose all this state accidentally. This is why emacs takes the conservative approach and chooses not to throw away dired buffers by default and gives the users the option of choosing to do discard the current buffer consciously by using the "find-find-alternate" command (bound to "a" by default in dired-mode-map).
- cassepipe 5y agoAnyone knows the state of GuileEmacs ? I am learning Guile and thought it would be fun to switch from Vim to an editor uses Guile under the hood but I am not sure of how usable it is
- vindarel 5y agowell there's a working Emacs-like in Common Lisp! https://github.com/lem-project/lem/ https://github.com/lem-project/lem/
- User23 5y agoI believe the Nyxt project[1] is also interested in adding editing at some point[2]. If they do it will almost certainly converge to another flavor of emacs. [1] https://nyxt.atlas.engineer/ https://nyxt.atlas.engineer/ [2] https://nyxt.atlas.engineer/article/why-building-nyxt-instead-of-an-emacs-package.org https://nyxt.atlas.engineer/article/why-building-nyxt-instea...
- vivab0rg 5y agoAny good suggetions for resources to learn Guile besides the manual?
- pjdesno 5y agoA bit off-topic, but probably interesting to folks reading these threads: A quarter-century ago I worked at a little company that made networking ASICs. The guy who did "floorplanning" and layout had his own tool flow based on a set of scripts he had written over the years. Those scripts were written in Emacs Lisp. I don't know why he picked this approach, although I suspect that he started out with a manual process on much smaller chips and then started automating it. Anyway, I had to compile a 64-bit version of Emacs to run on his 64-bit SPARC machine (back when its 6GB was enormous) so that it would work with our designs. (back then Emacs only used MSBs for its tagged pointers, so 32-bit Emacs could only address half a GB) I've seen Emacs used for some pretty weird things, but so far this one takes the prize.
- gosukiwi 5y agoHaha Emacs is truly an OS, lacking only a decent text editor /jk
- outworlder 5y agoIt has viper-mode
- thingification 5y agoevil replaced viper many years ago
- ellyagg 5y agoThese days a lot of us essentially use vi in emacs so this is just not true anymore.
- acomjean 5y agoI used "Dired" to view text files and move around directories all the time in emacs. Replaced "mc" (midnight commander) for me. Partly because were I'm at MC takes about 30 seconds to start. you can M-x shell and get a shell in emacs, but that's overkill... but it would be searchable.... emacs even has games.. M-x tetris. I'm starting to think you might be right about it being an OS.
- swah 5y agoI always felt much more aligned with the Emacs philosophy, but it was a wrist destroyer for me (although I adopted the Caps-as-Ctrl very early too). Nowadays I mostly stick with VSCode, with a few of packages that even remind me of Emacs for selecting and transforming text. And for the rare case of text refactoring that doesn't fit the multicursor model, there is even a fast "Open in Vim" extension/command. (If I still wanted to use Emacs I'd probably have spent a full-month salary on a Kinesis)
- ianmcgowan 5y agoWhat vscode packages are those? Always interested in being more efficient in transforming text.
- swah 5y agoSure, some I use all the time, they mostly work on multiple cursors so I end up doing Vim/Emacs level stuff in (my opinion) simpler/faster ways: - https://marketplace.visualstudio.com/items?itemName=chunsen.bracket-select https://marketplace.visualstudio.com/items?itemName=chunsen.... (I bind to M-k M-a) (This one enables me select, cut and type the new text - this is much faster than backspacing/selecting for me. I feel like this is a "vim pattern" that I'm reusing here) I also have Alfred (MacOS) installed, and it saves your clipboard history. This ends up giving me sort of an Emacs-like kill ring, system wide. - https://marketplace.visualstudio.com/items?itemName=rsbondi.highlight-words https://marketplace.visualstudio.com/items?itemName=rsbondi.... (I bind to M-k M-k) - https://marketplace.visualstudio.com/items?itemName=janjoerke.align-by-regex https://marketplace.visualstudio.com/items?itemName=janjoerk... - https://marketplace.visualstudio.com/items?itemName=Asuka.insertnumbers https://marketplace.visualstudio.com/items?itemName=Asuka.in... - https://marketplace.visualstudio.com/items?itemName=earshinov.filter-lines https://marketplace.visualstudio.com/items?itemName=earshino... - https://marketplace.visualstudio.com/items?itemName=jonsmithers.open-in-vim https://marketplace.visualstudio.com/items?itemName=jonsmith... There is also https://marketplace.visualstudio.com/items?itemName=hajdaini.select-until-pattern https://marketplace.visualstudio.com/items?itemName=hajdaini... and https://marketplace.visualstudio.com/items?itemName=rduvql.vscode-jumper https://marketplace.visualstudio.com/items?itemName=rduvql.v... that I have installed but never got to use. I would love to record a video showing the kinds of text changes I do all the time, but the really useful happens on real life situations that one cannot record publicly.
- jdeaton 5y ago> since all the information you need to know is in a single place, it is much easier to use than a web search engine like Google. So step #1 is learn how to use the manual page browser and search engine. Concerning the author doesn't see the irony asserting a tool is easier to use than google search immediately before listing a dozen keyboard shortcuts to know to use it.