Fork me on GitHub
#emacs
<
2023-11-03
>
borkdude13:11:05

I upgraded to emacs 29.1 (from 28.something) and my cursor is moving a lot slower through a clojure-mode buffer. I got rid of lsp from my config but that wasn't it. Any clues? Other modes seem to work fine (JS for example)

vemv13:11:34

check the *nrepl-messages* log in case something went horribly wrong (wouldn't expect so, but still)

borkdude13:11:50

I'm not even using nREPL

馃憖 1
borkdude13:11:10

I mean, I normally use nREPL, but this happens even when I don't use a REPL yet

ericdallo13:11:12

I'm bumping my emacs to latest right now, I can say if I face the same, but since I use linux there is a chance to behave differently

vemv13:11:18

clojure-mode absolute latest?

borkdude13:11:54

clojure-mode-20231018.922

ericdallo13:11:57

ah BTW I was already using 29.1 and no slowdows here

vemv13:11:42

yup that's latest you might want to try with a few emacsen for good measure

borkdude13:11:27

trying 28.4 now

borkdude13:11:47

I guess I'll have to re-compile my elpa stuff since I'm getting messages about defvar-1 is missing

oyakushev13:11:26

1. Native compilation might be in progress (if you have it enabled). But I guess you already waited long enough for it to complete. 2. Try M-x profiler-start, move your cursor a bit and then do M-x profiler-report . Might discover something.

borkdude13:11:06

I can definitely notice the difference between 28.4 and 29.1

borkdude13:11:54

I'll try the profiler

borkdude13:11:05

The profile in 28.4 looks pretty similar

oyakushev13:11:30

Just kidding. Yeah, smex in the profiler output often means that doing M-x dominated the profile.

oyakushev13:11:05

What is your gc-cons-threshold?

oyakushev13:11:38

Also, is the cursor also slow if you put that buffer into fundamental-mode?

borkdude13:11:04

I had the gc threshold at gc-cons-threshold (* 100 1024 1024) but I deleted that and restarted, same problem

oyakushev13:11:23

I also have it at 100MB

borkdude13:11:09

This is kind of crazy, when I half the screen with c-x 2, the cursor becomes fast again

borkdude13:11:35

in fundamental-mode cursor is normal

borkdude13:11:53

I guess I'll stick to 28.4 then damnit

borkdude13:11:09

is the new clojure-mode using optional features from 29.1 maybe?

oyakushev13:11:38

No idea but sounds unlikely to me.

vemv13:11:48

clojure-mode treesitter support has not seen the light of day yet

oyakushev13:11:32

There are sometimes some weird performance issues that happen when upgrading Emacs. I would recommend wiping all elc files (which I think you already did) and try out native compilation if you haven't yet. Maybe it solves the issue

borkdude13:11:49

I have wiped them several times

vemv13:11:16

are those emacsen https://emacsformacosx.com/ builds? Those are a vanilla as they can get afaict. Sometimes brew builds add more flags (disclosure: I happily use Emacs 27 so any 28/29 intricacies are mostly out of my knowledge area)

borkdude13:11:27

yes, emacsformacosx

馃憤 1
borkdude13:11:49

I'll stick to 28.4 then, I was trying to get around issue with lsp-mode by upgrading, but rabbit hole

oyakushev13:11:20

I use brew install emacs-mac --with-native-compilation, haven't faced slowdowns so far

馃憤 1
vemv13:11:29

The last measure I'd try would be to go back a few clojure-mode releases (hard with melpa but easy w/ git)

borkdude13:11:49

yeah I have every elpa project in my local git ;)

borkdude14:11:18

but just copy pasting from github releases also works :)

馃挕 1
borkdude14:11:48

neh, wasn't it. I copy pasted 5.16 from github releases, removed .elc and restarted, same problem

borkdude14:11:22

I'll try alex's native compilation from brew suggestion and else I'll just stick to 28.4

borkdude14:11:43

oh that's the railway version, I already tried that

vemv14:11:13

Curious, how slow is slow? as in 'could be better' or 'is annoying'?

borkdude14:11:29

definitely "is annoying"

馃槥 1
borkdude14:11:44

I can make some screen capture

borkdude14:11:31

this is the slow one:

borkdude14:11:11

and this is the normal one:

vemv14:11:44

hard to tell with the forthcoming treesitter support https://github.com/clojure-emacs/cider/pull/3461 I wouldn't be too concerned (we don't advise trying it yet, even without cider)

borkdude14:11:47

due to the screen capture rate you might not see the cursor on every line in the fast one, it's too fast

borkdude14:11:57

somehow that brew compiled emacs doesn't start for me...

馃様 1
borkdude14:11:12

the non-GUI version does work

borkdude14:11:51

@U06PNK4HG how do you start it?

borkdude14:11:09

I tried:

open /opt/homebrew/Cellar/emacs-mac/emacs-29.1-mac-10.0/Emacs.app

oyakushev14:11:51

That's the way how I started too

oyakushev14:11:56

Do you get any errors?

borkdude14:11:15

no, just nothing

borkdude14:11:24

it just quits

oyakushev14:11:55

Actually, I do this

open -na /opt/homebrew/opt/emacs-mac/Emacs.app

borkdude14:11:56

with exit code 0

borkdude14:11:21

that did nothing, except it quit my terminal ;)

oyakushev14:11:35

Sorry, that was probably the exec part, removed it now

Roma14:11:39

Is native compilation enabled? maybe it's running in the background? You can check buffer *Async-native-compile-log*

borkdude14:11:03

if I don't have a buffer, I can't see it?

oyakushev14:11:04

Ah, could be related to osx guardrails and all that. Try navigating to the brew directory in Finder and running Emacs by right-click->Open

oyakushev14:11:16

That's just for the first time

borkdude14:11:20

I also tried opening it from Finder

borkdude14:11:26

but I will recompile and try it again

oyakushev14:11:12

It's weird that it doesn't say anything. I occsaionally get Emacs crashes, and even at startup, but it at least produces OSX error/warning dialog

borkdude14:11:07

Should I try to install as a cask?

Warning: Treating emacs-mac as a formula. For the cask, use railwaycat/emacsmacport/emacs-mac

borkdude14:11:26

recompiled, opened from Finder, it took a while but a window is opening

borkdude14:11:03

and guess what, the cursor is slow and flaky again

Roma14:11:14

Try (setq auto-window-vscroll nil)

borkdude14:11:29

I'll wait for the async compilation to finish though

borkdude14:11:37

ok I'll try that next Roma, thanks

Roma14:11:06

Also I'd check the value of post-command-hook

borkdude14:11:56

after native compilation things look smooth

Roma14:11:35

(setopt bidi-inhibit-bpa t)
(setopt bidi-paragraph-direction 'left-to-right)
another micro-optimization 馃檪

borkdude14:11:16

great this works... now the one problem I have with this railway is that it changed the default font to Monaco...

borkdude14:11:40

ah got that fixed too, thanks google

borkdude14:11:50

alright, if this remains stable, I'll stay on railway cat

馃憤 1
borkdude14:11:55

thanks everyone!

馃帀 2
Roma14:11:21

I use emacs-plus without any issues

Roma14:11:38

brew install emacs-plus@29 --head --with-mailutils --with-xwidgets --with-no-frame-refocus --with-native-comp

oyakushev14:11:00

That build of emacs also swaps some buttons, you may want to look at this form to restore it https://github.com/alexander-yakushev/.emacs.d/blob/master/init.el#L1

oyakushev14:11:42

Or is it all macos emacsen that do that? I don't remember. Anyway, i have that in my init.el

Roma14:11:56

I have it too, just in case 馃檪

馃憤 1
borkdude14:11:37

surprisingly just moving http://Emacs.app to /Applications worked ;)

oyakushev14:11:36

Maybe you have some corporate (anti)virus installed, like Casper or Carbon Black

borkdude14:11:14

No, I don't, but what I meant, moving the http://Emacs.app file didn't complain about being moved to a different location, I expected it to reference some brew installed files perhaps

borkdude14:11:33

It worked before I did that, this just helps me launching Emacs from spotlight etc

馃憤 1
oyakushev14:11:27

I launch emacs from the terminal with 'open' because I want it to inherit my bash profile env

borkdude14:11:06

clever, I had some other stuff for that but indeed, it can be painful

Benjamin14:11:55

Open the prev and next line calls. Smex shows up because it is reading from mini buff

ag19:11:43

Has anyone gone full treesitter mode? What are the main selling points for Clojurists? Does it improve the performance with large clojure maps? Sometimes when I open a big edn file and start collapsing sections with evil-fold, things get very sluggish. I wonder if treesitter improves that.

vemv19:11:59

@UDVJE9RE3 (https://github.com/clojure-emacs/clojure-ts-mode) would know best I'd assume that eventually there would be a big advantage yes, just like for any other major mode which parsing had been traditionally been defined with bare regexes

vemv19:11:04

btw, you may be well aware of this, but something like the cider Inspector is a powerful and focused way of dealing with big chunks of data. What if we had a new command, cider-inspect-buffer? It would make sense, most of all, for .edn buffers. If its contents were slurped with a nice reader (tools.reader probably), each element would have line/col metadata so it would be easy to go back and edit stuff. Probably 馃槃

respatialized20:11:39

The inspector is nice, but I've never found it to be as fast for weakly structured searching (with surrounding context) of a big EDN file as consult or other text-based editor search features The inspector works best when I "know what I'm looking for", but frequently I don't! And that's where an ordinary emacs buffer with fast line search shines

vemv20:11:59

I recently added cider-inspector-previous-sibling/ cider-inspector-next-sibling (https://docs.cider.mx/cider/debugging/inspector.html#usage) solving part of that problem. But yeah something like a true free-form search is not available (although it's reasonably doable)

15:11:39

I am very new to Clojure and programming in general, Jackson from the clojure-ts-mode project put together a Emacs configuration for me that uses it and it works well for the most part

lispers-anonymous22:11:58

I use the tree-sitter mode full time at work. I've recently shifted focus from a clojure application to a javascript application (booooo) but I've found clojure-ts-mode works well for me. For cider I've been using a fork.

22:11:36

Is your config public by any chance?

lispers-anonymous22:11:47

Yeah config is public, I can post

lispers-anonymous22:11:04

> What are the main selling points for Clojurists? Does it improve the performance with large clojure maps? For this question: I don't work with large clojure files anymore thankfully. Most files are less than 1k lines of code. I have heard reports from users that they switched over to clojure-ts-mode because it performs better than clojure-mode on large files, particularly with regard to font-locking

lispers-anonymous22:11:08

One advantage that treesit based modes in emacs have is the ability to set treesit-font-lock-level and control how detailed the syntax highlighting is. If a file is too big you can lower the number and hopefully improve performance.

lispers-anonymous22:11:59

Otherwise, clojure-ts-mode tries to be mostly like clojure-mode in the features it implements.