News for hackers. Stuff that matters.
Re:Mastering Emacs by lbj on Wednesday August 23, 2023 @02:49AM (#37232613)
It's crazy that here in 2023, Emacs is still the absolute beast when it comes to developer productivity. I had a colleague review one of my workflows the other week and after a minute or so he said "Whoa, I would have been in 5 different tools by now".

If you're not into Emacs, I suggest you give it a whirl. For most development, nothing else will get you close to the joy and productivity that a well configured Emacs can.

Re:Mastering Emacs by danieldk on Wednesday August 23, 2023 @03:12AM (#37232753)
And with opinionated configurations, you can be up and running with a good configuration in minutes:

https://github.com/doomemacs/doomemacs

Re:Mastering Emacs by kalupa on Wednesday August 23, 2023 @02:13PM (#37239996)
I second this recommendation, but I also was coming from a vim background, not a modeless editor like textmate or vscode ...
Re:Mastering Emacs by w0m on Wednesday August 23, 2023 @03:13PM (#37240817)
a few years ago (~2018?) I got excited about trying Org, and installed Doom Emacs on my (~18mo) old rMBP and it was slow-to-unusable. After ~30m of unproductive debug, i went back to vimwiki. The onboarding even with a distribution can be problematic.
Re:Mastering Emacs by yawpitch on Wednesday August 23, 2023 @02:57AM (#37232677)
^ with the caveat that a well-configured emacs requires a well-configured emacs, often leading to an infinite loop.
Re:Mastering Emacs by ianleeclark on Wednesday August 23, 2023 @03:40AM (#37232918)
I installed spacemacs 5ish years ago and have added maybe 20 lines to my configuration since then. None in the past 4 years. It's really overstated the amount of maintenance that Emacs requires.
Re:Mastering Emacs by globular-toast on Wednesday August 23, 2023 @03:41AM (#37232930)
I recently made some big changes to my Emacs config to incorporate new tooling like LSP into my workflow. It turned into quite an extensive change as I re-evaluated many extensions and replaced some with newer alternatives. Took a few evenings.

But I hadn't touched my config for three years before that! I've been using Emacs for 15 years and you definitely get to a point where you don't need to tweak it every day. 3 years is the kind of time some people would switch to a completely new editor. I have, in a way, except it still supports all the workflows that have become familiar over the years.

Re:Mastering Emacs by goku12 on Wednesday August 23, 2023 @03:21AM (#37232817)
How is that true at all? I started with plain Emacs and gradually updated the configuration to the level of polish I wanted. Even if you're impatient and want something modern up front, the advise given is to start with a starter pack like Doom Emacs.
Re:Mastering Emacs by kdtsh on Wednesday August 23, 2023 @04:14AM (#37233176)
These days though you can offload that to a configuration distribution like Spacemacs, Prelude, or Doom Emacs.
Re:Mastering Emacs by chungy on Wednesday August 23, 2023 @03:13AM (#37232768)
Amen, brother.
Re:Mastering Emacs by ak_111 on Wednesday August 23, 2023 @02:58AM (#37232682)
can you give an example of such workflow?
Re:Mastering Emacs by llm_thr on Wednesday August 23, 2023 @03:07AM (#37232727)
Magit is probably the easiest one for casual devs to appreciate.

"M-x magit" get a nice list of the status of the files in the current branch.

After you mark which ones you want to keep by moving up and down pressing s(tage) u(nstage) you just press "c c" and write your commit message. Then you press P and your git repo is up to date.

At a previous job the head engineer flagged the number of commits I was making as an issue since I must be wasting a lot of time pushing incremental changes. When I showed him that it took me about as long to push changes to my branch as it did to save the file he was flabbergasted that one could use git without pain.

Re:Mastering Emacs by geokon on Wednesday August 23, 2023 @03:49AM (#37232983)
> "M-x magit" get a nice list of the status of the files in the current branch.

Except it will randomly split your frame and show up in a seemingly arbitrary location - often obscuring what you're working on. I find the whole layout system in Emacs completely chaotic. I guess it comes with the flexibility (VS a fixed system like most Ides) nor do I have any particular solution in mind

I'm curious if anyone has tamed the weird inconsistencies of how new frames (or is it windows? Can never keep the terms straight) pop up. For instance a CIDER error buffer shows up using some completely different black magic than magit

Re:Mastering Emacs by unhammer on Wednesday August 23, 2023 @04:19AM (#37233213)
For magit, I like having it display full screen (deleting other windows), and then on quitting restore to the windows/splits I had before:

     (setq magit-display-buffer-function 'magit-display-buffer-fullframe-status-topleft-v1)
     (setq magit-bury-buffer-function 'magit-restore-window-configuration)

For more general display-buffer tweaks, OP has a whole article on it https://www.masteringemacs.org/article/demystifying-emacs-wi... (though for display-buffer I just stick to the defaults myself, never tried CIDER)
Re:Mastering Emacs by yaantc on Wednesday August 23, 2023 @04:13AM (#37233170)
This thread is on the "Mastering Emacs" book and from its author, on the topic of mastering Emacs window managements you can read this:

https://www.masteringemacs.org/article/demystifying-emacs-wi...

To be honest I've never played with this part of Emacs. The way I use it I'm fine with the default. But if not it's possible to take control of Emacs internal windows management.

Re:Mastering Emacs by pluijzer on Wednesday August 23, 2023 @04:12AM (#37233161)
I have my Emacs setup to never split anything and just use the whole frame (window). That also goes for things like helm. Instead of splitting I prefer to open multiple frames and let my window manager, manage them. This really improved my workflow.
Re:Mastering Emacs by bjoli on Wednesday August 23, 2023 @06:29AM (#37233928)
Same here, but I let most things replace the current buffer. Magit always fills the frame though.
Re:Mastering Emacs by geokon on Wednesday August 23, 2023 @08:52AM (#37235051)
How do I go about doing this ?

Seems potentially workable. Youd just jump back to the last buffer a lot of time, but that's quick and intuitivr.

Re:Mastering Emacs by pluijzer on Wednesday August 23, 2023 @05:40PM (#37242212)
(setq display-buffer-base-action '(display-buffer-same-window))
Re:Mastering Emacs by geokon on Wednesday August 23, 2023 @11:14PM (#37244600)
thank you !
Re:Mastering Emacs by zelphirkalt on Wednesday August 23, 2023 @03:54AM (#37233031)
There is definitely a system to it. Something like "split at the longest side of the current window" or so. I have developed a feeling for where my magit buffer will show up. 95% of the time I am right and my eyeballs already move where it will appear. Anyway, if you want to get rid of some window/undo a split: C-x 0.
Re:Mastering Emacs by chewxy on Wednesday August 23, 2023 @08:53AM (#37235079)
Add something like this?

    (add-to-list 'display-buffer-alist
          '("\\*Magit*\\*"
            (display-buffer-reuse-window display-buffer-in-direction
            (direction . bottom)
            (window . root)
            (inhibit-same-window . t)))*
Re:Mastering Emacs by zelphirkalt on Wednesday August 23, 2023 @03:50AM (#37233000)
I would say magit as an example. Single key presses for most actions. I often have that situation, when I share my screen and perform some commits and then people ask me whether I already commited X. I then think something like: "Uh, but I just did that, in front of your eyes." but then I remember the other workflow involving the normal command line or some clicky-gui kind of tool, that is just slower and is what others are used to.

Then maybe keyboard macros. Define anything you can input in a "tiling" way on your keyboard as a macro to let the editor perform it repeatedly. Approximate quote from coworker: "Sometimes you do things inconveniently, but what you do in Emacs was highly efficient."

Then running vterm inside emacs and searching and copying from the vterm buffers to use text elsewhere.

Of course org-mode as an extremely neat way of managing information and to do. I use it every day, a lot. I use it for notes, for to-do, for time tracking, for literate programming, for devops, for creative writing, and probably more.

Then the pain I get, when I see people closing their vscode, just to reopen it in another directory ...

Then the pain I see others have, when juggling a high number of editor tabs in intellij or vscode, instead of buffers that exist and can be switched to using keyboard shortcuts. I lost faith in tabs for code editors.

Re:Mastering Emacs by Otek on Wednesday August 23, 2023 @10:10AM (#37236183)
> Then the pain I get, when I see people closing their vscode, just to reopen it in another directory > Then the pain I see others have, when juggling a high number of editor tabs in intellij or vscode, instead of buffers that exist and can be switched to using keyboard shortcuts. I lost faith in tabs for code editors.

That my biggest beef with VScode and IntelliJ. Why on earth I can’t have multiple projects open and switch between them as fast as in Emacs / Vim with Tmux Other than that I could somewhat live with modern editor, but I’m switching constantly between 5 different projects and VSCode solution to have single workspace makes navigation an awful experience

Re:Mastering Emacs by worthless-trash on Wednesday August 23, 2023 @04:23AM (#37233244)
- Open a jira request backport in https://github.com/ahungry/org-jira

- Check to see that there isnt an MR outstanding bysomeone else ( using https://github.com/isamert/lab.el )

- (Optional) Cherry pick the commit from another stream where it may be fixed (magit-cherry-pick)

- Often massage the code (emacs cedet)

- Commit the code (magit)

- Submit a build (local built in code, elisp calling a local binary)

- Tag the build as the correct type (magit)

- Update the jira status (org-jira again)

- Wait for testing to complete, watch (eww)

- Email the requester on test results (wanderlust)

I also use:

- Some slack client for emacs (i dont remember the name)

- slime connected to nyxt brower so that I can automate some of the garbage that requires javascript.

Re:Mastering Emacs by zelphirkalt on Thursday August 24, 2023 @06:13AM (#37247083)
Can you share details of your experience with org-jira? My question would be: Is it feature complete? Does it allow one to do everything one can do in browser Jira? Set custom fields, handle multiple boards and so on?
Re:Mastering Emacs by worthless-trash on Sunday August 27, 2023 @12:56AM (#37279534)
> Is it feature complete?

Its enough for me to complete my day to day work.

>Does it allow one to do everything one can do in browser Jira?

I dont think it can do the dashboards and reporting metrics, but for the 'issue' work yes.

> Set custom fields

Yes. Although i had to maintain a map of custom field names to what they actually were, or you'd see cf_023042432 as the name.

> handle multiple boards

I don't use jira this way to know what it means, is that the same as multiple project prefixes (if so yes, i dont know what boards are).

Re:Mastering Emacs by globular-toast on Wednesday August 23, 2023 @04:42AM (#37233345)
In addition things other people have mentioned, like magit, I would add org-capture as a good example. Let's say I'm busy at work in a buffer and a thought comes to mind: "I could refactor that other module using this code". Instead of doing it immediately and breaking my flow, I press C-c c, select "todo", type "refactor that other module", perhaps add a tag, a category etc. then C-c C-c and it's filed away.

What's really important about all of this is, it's all Emacs. Every magit buffer, every org-capture buffer, it's all just Emacs buffers and they're all configured the way you like. If you need to do a regexp find and replace while you're capturing a note, you can. If you make a typo in a note, in a commit message, in an email or anything else, it's spell checked and you can correct it with the same key you always do. This integration is the real magic.

Re:Mastering Emacs by lbj on Thursday August 24, 2023 @05:56AM (#37246965)
In this particular example, I was documenting my investigation into a defect. I was jotting down notes in Org-mode (1. note-taker). Those notes included SQL scripts which evaluate directly in the note-file (2. ejc-sql / replacing dbbeaver), letting the next user see which result I got from the queries and the ability to re-run the queries (C-c C-c). Some of the results returned large jsonb blobs, which were made readable with M-x json-prettify (3. replacing some online json prettifier). The git stuff (branching, making a pull request, updating it) was handled using Magit/forge (replacing git/lazygit). And ofc the code-editing replaces (5) whatever IDE you could otherwise use.
Re:Mastering Emacs by PurpleRamen on Wednesday August 23, 2023 @04:59AM (#37233456)
> "Whoa, I would have been in 5 different tools by now".

And those 5 tools would likely beat Emacs in their individual area.

At the end it's all a tradeoff between low fringe with somewhat good enough performance, or high fringe for stellar performance. Sometimes you need it, sometimes not.

Re:Mastering Emacs by mnemonicsloth on Wednesday August 23, 2023 @05:41AM (#37233686)
Examples please?
Re:Mastering Emacs by harrygeez on Wednesday August 23, 2023 @06:15AM (#37233861)
a huge part of it I will say is antithesis to current state of programming. Emacs is literally a live elisp interpreter with everything in global scope. You literally replace parts of the application in runtime.
Re:Mastering Emacs by onehair on Wednesday August 23, 2023 @07:07AM (#37234130)
> that a well configured Emacs can

Well, that's the real issue for me. I spent a month an a half working on "configuring" NeoVim. I got it to a somewhat ready to use state for my usual workflows. But I still had a big pile of tasks in my backlog to actually get it finally 100% mine.

Then I discovered Helix, which doesn't need any configuration, no plugins to play around with. Builtin LSP, Builtin Fuzzy Finding of files, TreeSitter and the list goes on.

Even though it's still not fully checking all the boxes I need to have a 1 to 1 mapping of my previous workflows to what Helix offers. I find not having to build my own editor out of the Lego pieces and always needing to improve what it can offer me, makes the editor actually enjoyable.

IMO, VIM, NeoVIM and Emacs should start looking into implementing a bit more than just the barebones, some of these new features that people are accustomed to in 2023, and more and more will flock to these good editors.

Re:Mastering Emacs by daedalus_j on Wednesday August 23, 2023 @09:53AM (#37235888)
I'll admit I didn't look into it, but Helix sounds like something like LunarVim (https://www.lunarvim.org/)

Personally I much prefer that the editor NOT ship with something like that by default, especially when it's so easy to set up. I have several different vim config I use, including a pretty bare-bones one for headless systems, and I much prefer the ability to customize something very specifically.

Build tools that can compose together, rather than a single do-it-all tool. That is the power of the low level editors vs IDE's.

Re:Mastering Emacs by Exuma on Wednesday August 23, 2023 @05:34PM (#37242139)
Yes I think we are saying the same thing. I don’t think vim should ship with more than what it does either
Re:Mastering Emacs by onehair on Thursday August 24, 2023 @01:37AM (#37245391)
Helix with its builtin tools is faster than Neovim, with or without plugins
Re:Mastering Emacs by onehair on Thursday August 24, 2023 @02:42AM (#37245760)
You can still leverage the power of low level editors, just like helix does, and still have access to important things that so not require pages upon pages of configuration and plugin stitching to just get up and running in most projects you want vim or emacs like editing capabilities.

Helix is different from Lunar in the sense that the features it comes with are part of the core editor and the editor still feeling like an editor

Re:Mastering Emacs by zelphirkalt on Thursday August 24, 2023 @04:25AM (#37246347)
I counted the number of config lines it takes in Emacs to get LSP fo Python:

Maybe 2 lines, if you otherwise would not use company-mode.

1 line requiring lsp-mode.

1 line setting lsp diagnostics provider.

1 line adding lsp mode to python-mode-hook.

2 lines enabling the linter (if you want that) (I use flake8).

2 lines for setting an additional shortcut.

23 completely optional lines for marking some variables from .dir-locals as accepted/safe.

1 optional line for changing the color of the breadcrumbs header line.

Approximately 2/3 of a page, including all optional config I have.

Re:Mastering Emacs by Exuma on Wednesday August 23, 2023 @04:43PM (#37241648)
That would be very unideal. That’s why distributions exist like lazy and kickstart etc
Re:Mastering Emacs by overlyambitious on Friday August 25, 2023 @02:15AM (#37258658)
That's what Doom Emacs is for.
Re:Mastering Emacs by anonuser123456 on Wednesday August 23, 2023 @05:26PM (#37242056)
As a long time emacs user, I can’t describe enough how much I love VS Code over emacs. And yes, I was a power user with all the fancy modes. And yes, I work entirely with Linux.
Re:Mastering Emacs by nhlx2 on Thursday August 24, 2023 @12:43AM (#37245090)
Emacs fancy modes?