reddit / emacs

Chosing an Emacs Distro on M1 OS X

drax19 · 2022-12-04 14:23
I wanted to ask experienced emacs users on macos what their distro of choice is in late 2022. As a vimmer interested in emacs due to the vast customization capabilities and especially org-mode, I looked into trying it out for myself. It seemed as though the easiest way to get an idea of the potential of emacs was to install doom. I used the official guides on the repo and tried out both emacs-mac and emacs-plus with native comp. On my M1 macbook pro I experienced major cursor lag (when navigating through text files using vim bindings), they were so severe especially after coming from vim that i ended up removing doom entirely. Vanilla emacs didnt feel a 100% smooth either. Whats even weirder is that weeks after uninstalling emacs itself my computer still had a process running called emacs with 99% cpu useage and high gpu useage. After doing some digging, it seems that there are rendering issues on retina displays specifically that really mess up the responsiveness of the app. I read about different things to try such as using fira code as the font, changing the line highlighting behavior etc. ​ Anyways, Before trying to fix something that seemed broken I want to try to install another build again, and I'd also be comfortable with vanilla emacs and configuring it on my own if it means stable performance. So what I want to know specifically is the following: In your opinion what are reliable distros and build options out of the following distros for M1 on a retina display in terms of responsiveness and light cpu/gpu useage? \- emacs-mac \- emacs-plus \- emacsformacosx and would you ppl suggest with native comp or without?
0e6b0df6-baaf-c99e · 2022-12-04 14:33
Did you try emacs-nox (not sure if it’s called that any longer) installed via homebrew and just running it in terminal?
takeonrules · 2022-12-04 15:35
I use `brew tap d12frosted/emacs-plus` on my M1. Here's the runbook I have for my machine: https://github.com/jeremyf/dotzshrc/blob/main/RUNBOOK.org#emacs
andyjda · 2022-12-04 15:39
Were these display issues with emacs-plus or emacs-mac? I have the same laptop, I installed with: brew install emacs-plus@29 --with-xwidgets --with-native-comp --with-imagemagick and never experienced any major issues. I'm including all the options here but I don't think they'd affect this. If you experience some lag, my first advice would be to install the [GCMH package](https://github.com/emacsmirror/gcmh). It basically changes the garbage-collection rules to ensure that most garbage collection will happen in small bouts while Emacs is idle. After installing it I've never had my Emacs lag on me. This wouldn't address the retina-display issues you mentioned, but I've never experienced those with emacs-plus. About native-comp, I don't think there's any drawback from using it. I personally didn't notice that much of a speed improvement when I switched to it, but I'd still recommend it unless you have some major problems setting it up.
drax19 · 2022-12-04 15:46
thx for the tip! I also thought of that before, iirc nowadays it is achieved by running emacs -nw. I‘m hesitant to settle for the terminal version because I already have a configured terminal based text editor and I could see myself making use of the gui‘s features in the future
drax19 · 2022-12-04 15:49
thx for the runbook, I could definitely make use of a thing or two in there. especially raycast as an alfred alternative caught my attention. very nooby question but I see a lot of people recommending —with-xwidgets. what exactly is the benefit of that?
drax19 · 2022-12-04 15:55
Thx, GCHM looks interesting! One thing I immediately noticed about native comp that could be considered a drawback was the amount of dependencies that come with it. I can afford the diskspace tho so I‘ll probably keep it. I experienced the lag with Doom Emacs on both emacs-mac and emacs-plus. For a first time user do you think it makes sense to install emacs 29 or rather 28?
andyjda · 2022-12-04 16:16
sounds like it could be a Doom-specific issue then. In which case I can't be of much help since I use vanilla Emacs. Vanilla Emacs can be a bit daunting to start with (and a bit ugly at first), but if you're prepared to modify the UI to your liking, and have a bunch of `use-package` blocks in your init file, you can get it to be the way you like it in no time. Feel free to ask here if you'd like help with that. Emacs 29 has pixel-scroll-precision mode and is generally a much smoother experience, I think. I haven't experienced any major bugs in months
mclearc · 2022-12-04 16:42
I use both emacs 28 and 29 on an M1 MacBook Pro and don’t experience the problems you seem to be having. If I were you I’d build emacs 28 for now, while 29 is still working out some bugs. Besides the other builds you’ve tried you might look at my macOS emacs build script and set things according to your preferences. https://github.com/mclear-tools/build-emacs-macos For some ideas about setup of emacs you might take a look at my config framework lambda-emacs. Happy to answer questions you might have here or via discord, etc. https://github.com/Lambda-Emacs/lambda-emacs I’d also take a look at crafted-emacs, which allows for a lightweight setup. https://github.com/SystemCrafters/crafted-emacs
andyjda · 2022-12-04 18:04
xwidgets is [a cool feature](https://www.emacswiki.org/emacs/EmacsXWidgets) that lets you embed other applications inside Emacs. Right now the only supported widget is webkit, which allows you to run a fully functional Safari-like browser within Emacs (Emacs also has built-in [eww](https://www.gnu.org/software/emacs/manual/html_node/eww/Basics.html), which is great for manipulating text but lacks JavaScript support). There are some issues with the feature on MacOS: see [the discussion I started over at emacs-plus](https://github.com/d12frosted/homebrew-emacs-plus/issues/519) for a more detailed look. TL;DR: the main functionalities are there but it's somewhat buggy and it leaks memory (a very small amount of memory: it's unlikely to crash your Emacs; most people don't even notice it). I've been planning on fixing the issues but haven't gotten round to make much progress yet. So building with xwidget support gives you access to a cool but buggy feature. It doesn't really have an impact on anything else. If you want to play around with Emacs and dive into all its capabilities, I'd suggest checking it out. If you just want a text editor with core features that work well, then there's no need for it.
ambirdsall · 2022-12-04 18:07
Don't use emacsformacosx, it's less up-to-date and configured than the other two. Whatever you use, make sure to enable native comp. Doom's author puts a fair amount of effort into performance, so if you find a build that works smoothly for vanilla emacs but doom is still laggy, you might try posting a question about those lag issues in the #doom-users-help channel of the doom emacs discord to see if there's a specific module or setting that can be {en,dis}abled to fix things: the community can be pretty friendly and helpful.
MrMelankoli · 2022-12-04 18:25
emacsformacosx does have nightly builds which are at version 30.0.50
colemaker360 · 2022-12-04 18:30
You might benefit from tangling those brew commands in your run-book to a Brewfile. Then you can just `brew bundle` and it’ll install everything for you on a new system. https://github.com/Homebrew/homebrew-bundle
pedzsanReddit · 2022-12-04 19:16
I'm on the 14-inch 2021 Apple M1 Max MPB running Ventura 13.0.1 Being a crotchety old man, I prefer to make my own disasters so I build emacs from the git repository. It is actually pretty simple to do but I've been fighting with getting `--with-native-compilation` working. I think I have it finally working. I tried the `brew install emacs-plus@29` and it basically does just want the git repository does with a few tweaks. I didn't like how it did the INFO directory for example. Your performance issue I'v seen on my laptop occasionally with emacs-28 not using native compilation when I have lsp-mode using tailwindcss running. But I don't think any other build will avoid that particular thing. It seems like lsp-mode with tailwindcss just gets confused at times -- i.e. it appears to be a tailwindcss issue. The reason I don't like depending upon others is because eventually they either go away or they start adding in things I don't like or something to that effect. I have used EmacsForMacOS for a few years but went back to building my own in the last year or so. If you have `Homebrew`, you can install the things you need like `gcc`, etc and then it is simply: ``` git clone https://git.savannah.gnu.org/git/emacs.git cd emacs git checkout emacs-29 gmake gmake install mv nextstep/Emacs.app /Applications ``` You can add options to the `make` or you can break the make into ``` ./autogen.sh ./configure .... gmake ``` etc. Adding or not adding complexity as you have time and need. But, at this point, the macOS build is super nice and easy. On a completely different topic, you might check out [YouTube System Crafters: Emacs from Scratch](https://www.youtube.com/playlist?list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ). I've been using Emacs since 1985 and I still got a few things out of it here and there.
ir210 · 2022-12-04 19:21
Is it possible that the lagging you were experiencing was because of the native compilation running in the background?
jsadusk · 2022-12-04 20:47
Since you built with nativecomp, the lag you were experiencing might be from it native compiling lisp in the background. Give it an hour or so after first start and it should speed up if that's what's happening.
drax19 · 2022-12-04 23:19
iirc the lags were also noticeable without native comp, even tho what you mentioned is probably a good explanation for what was going on with my emacs process taking up 99% cpu. maybe I'll try waiting it out.
drax19 · 2022-12-04 23:20
thank you very much, I'll probably go with 28!
drax19 · 2022-12-04 23:21
the discord seems quite active, I'll check it out!
drax19 · 2022-12-04 23:23
thx for the words of encouragement! I usually like to keep my configs rather minimal, so vanilla emacs seems like a good decision also.
drax19 · 2022-12-04 23:25
Wow I really appreciate the in-depth answer! I have the System Crafters youtube playlist bookmarked now.
uita23 · 2022-12-05 04:26
M-x list-processes might be interesting.
krikaya · 2022-12-05 07:20
I wish I could know this earlier! I also experienced the lag and I thought the issue is caused by native comp, so I reinstalled emacs without it. Didn’t know that I need to wait for the background process to be completed.
aimebertrand · 2022-12-05 10:06
Hello there, Shameless plus but probably helpful to answer your question here: https://macowners.club/posts/using-xwidgets-on-macos/
ieoa · 2022-12-05 11:58
I have another suggestions! https://github.com/jimeh/emacs-builds I've been using this one for a few months on my M1 14" without any CPU/memory issues: `emacs-app for the latest stable release of Emacs (includes native-comp since v28.1):`. Update: I just noticed `macOS 11.x (Big Sur) or later (uses Rosetta2 on Apple Silicon machines).`. I wonder if it's possible for a non-Rosetta build?