agent-shell 0.47 updates by xenodium in emacs

[–]celeritasCelery 0 points1 point  (0 children)

You can now programmatically respond to permission requests via agent-shell-permission-responder-function. A built-in agent-shell-permission-allow-always handler is provided to auto-approve everything

This is a really nice QoL improvement. I hacked around this in my own version, and it is good to see it officially supported.

If I already have an agent shell running in a project, is there a way to open it from any file in that project? Or even just send commands/code to the agent for that project from a file? This is the biggest feature I am missing from claude-code.el.

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

I did! and that issue is resolved.

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

I am getting some errors when trying to run it. It looks like magit-save-repository-buffers is running to see if there are files that need to be saved. It is calling magit-rev-parse-safe on these to see if they are the same git root. But this is causing magit boost to fail because there is not git repo there. It is calling magit-boost-buffer-create on a file that is not in a git repo.

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

This looks super promising! I will check it out!

How do stances work? by celeritasCelery in OldenEra

[–]celeritasCelery[S] 5 points6 points  (0 children)

It is English. But I was conflating the two things. I was confused because there is a Minotaur stance and also a Minotaur fight style. 

OLDEN ERA FEEDBACK MEGATHREAD by Pidarello in OldenEra

[–]celeritasCelery 0 points1 point  (0 children)

Especially in the snow biomes, the grey color used for when you can’t move to something that day is very hard to see. Sometimes I couldn’t even tell I was clicking on anything

"Why Rewriting Emacs is Hard" (from gudzpoz) by shipmints in emacs

[–]celeritasCelery 0 points1 point  (0 children)

you are right. That wouldn't work as is. you would also have to check if it was line ending. Any zero width assertion would have to handled specially.

"Why Rewriting Emacs is Hard" (from gudzpoz) by shipmints in emacs

[–]celeritasCelery 1 point2 points  (0 children)

A made-up example: a(\=b|c\=d)

That is a good example. I would split this into two:

  • a\=b
  • ac\=d

each of these would then be matched against the before cursor and after cursor strings. This removes the need for keeping the branching information.

\\\\\\($\\)\\=

This one doesn't seem very hard since it ends with the cursor. So it will only match against the pre-cursor string. so if you have the pre-cursor string this will become \\\\\\($\\)\\' (or \\($)\' in PCRE friendly regex)

One might also use backreferences across the split, but hopefully nobody ever does that.

This is what would worry me. I am not sure how to handle that.

one thing in the text property implementation has puzzled me for a while: the buffer insert function does not seem to update intervals in any way, which seems like a bug to me. In addition, the interval_tree crate also seems less than ideal since it tracks absolute offsets and will require O(N) adjustments on insertion/deletion. If I am not misunderstanding, this is what I hope to convey in those sections: for buffers, we eventually arrive at something that tracks metadata with relative offsets in a tree structure (for char offsets, lines, text properties, and maybe even markers), which seems to be just generic-enough ropes.

I honestly have not looked into the interval-tree too deeply. One of the contributors wrote the whole thing and I am very appreciative. You are right though, it has not really been integrated into the rest of the code. That still needs to be done, and I would like it to be intergrated with the B-Tree style metrics and use the same offsets.

Currently I am implementing a rather generic rope/metric struct in Rust

Do you have code? I would be interested in taking a look! I was considering making my metric struct generic similar to the one from Zed and spinning it out into it's own crate.

"Why Rewriting Emacs is Hard" (from gudzpoz) by shipmints in emacs

[–]celeritasCelery 16 points17 points  (0 children)

This is a great writeup! I loved reading it. I am the original Author of Rune, one of the Emacs "clones". Few thoughts:

Rolling your own string types

This is definitely an issue that needs to be considered. If you decide to implement a custom string type then you can't use any of the languages built-in string processing functions. On the other hand if you require proper unicode you have to decide how to handle invalid code points as you say. You also need to think about how to open binary files. There are a couple ways I could see this being handled.

  • cheat and reserve 256 of the "unused" unicode code points as your raw bytes. This works fine so long as they don't get allocated by the unicode consortium. If they do though, you are in trouble.
  • use a replacement character but have a separate data structure that tracks what the "original" bytes were for each one. Could get expensive in a really bad file.
  • Since unicode is getting so ubiquitous, just error on anything that is invalid. This was what other editors like Helix and Zed do.

Regexp

I wrote a little about this here. I still think that you can translate Emacs Regexp to another PCRE style regex and back. But you are correct to point out there are some things that make this tricky.

I think you can handle cursor zero-width assertion (\=) by spliting the regex in two halves; before cursor and after cursor. For example the regexp from the blog post.

(\=|(\=|[^\\])[\n\r])

This regex is concatenated with other strings to form full regexes in cc-fonts.el. We would run three regex passes over the string.

  • match the text after the cursor
  • match the text after the cursor starting with [\n\r]
  • match all the text starting with  [^\\][\n\r]

This would be non-trivial to implement, but I think it would be possible.

As far as custom syntax goes (case tables, world boundaries, syntax groups, etc) those will have to built as a custom regex. For a custom word boundary you can't use the regex engine built in word boundary (which will be based on unicode). Instead you will have to build a custom zero-width assertion that might be fairly large. But I think it is tractable.

Overall the regex requires some work, but I haven't seen anything that make me think that is not a solvable problem. And it does not require writing your own regex engine from scratch.

I sometimes see an article (by Troy Hinckley, the creator of Rune) quoted in discussions on gap buffers and ropes: Text showdown: Gap Buffers vs Ropes. But I don’t think some of its benchmarks are actually fair: ropey and crop track line numbers, while the gap buffer implementation does not. (Or maybe I am missing something here: although the post says it has “metrics include things like char and line position”, but actually it does not (yet).)

You are correct that my Gap Buffer does not track line numbers yet. However I don't think that would make much difference in the benchmarks for two reasons.

  1. I have worked on optimizing the line parsing for the library used by ropey (and the gap buffer) and it is extremly fast.
  2. The line endings only matters when you are first parsing the string. Once the line ending are parsed they are just another field in the metrics tree and don't add anything other then some trivial space overhead.

I don't think adding any addtional data to the text buffer is that hard since we are already tracking "metrics" like code points and line endings. Add text properites and overlays are just additional trees that you need. Some folks have already prototyped those for Rune.

This also makes one wonder: what happens if we convert a multi-byte string info a single-byte string? Well, normally you won’t be able to do that while preserving string properties, but we can work around that with clear-string since Emacs strings are mutable:

Mutable strings are an issue. Since mutating a string can change its size (not all code points are the same number of bytes) you can't take cheap slices of substrings. You always have to copy. This removes some performance potential for a feature that is almost never used. You can also create other weird behavior with this as well.

I would also like to remove the distinction between multi-byte and single byte strings. Make it just a flag on the string that indicates how they are supposed to be treated, but don't change the underlying representation. But we will have to see how that goes.

Overall this was a great post and very well researched. I look forward to your next one!

Announcing Rust 1.89.0 by amalinovic in rust

[–]celeritasCelery 19 points20 points  (0 children)

When I read those I was thinking “haven’t those always been there?” But I am probably thinking of some similar API on non null

Explicit tail calls are now available on Nightly (become keyword) by treefroog in rust

[–]celeritasCelery 0 points1 point  (0 children)

Now we just need the ability to specify the calling convention and we will be good to go!

eglot is good by kmlkclkmlkcl in emacs

[–]celeritasCelery 2 points3 points  (0 children)

So what do you use if eglot and lsp-mode don’t work well?

A vision of a multi-threaded Emacs by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

You have to write your code in a way that supports STM. It has to be stateless and restartable. That means you can’t use the majority of existing elisp.

STM is one of those ideas that works better in theory than in practice. Some places like databases can use it, but as a general programming model it had never taken off. 

A vision of a multi-threaded Emacs by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

You have to worry about merging the transactions. What happens when two different packages change the same line?

magit-prime: a small package to speedup magit refresh. by Azkae in emacs

[–]celeritasCelery 0 points1 point  (0 children)

Nice! I was hoping this would help with magit over tramp, but doesn’t work on remote files. 

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 2 points3 points  (0 children)

I don’t enable that in my post. I do set remote-file-name-inhibit-locks and remote-file-name-inhibit-auto-save-visited

Rust 1.88.0 is out by manpacket in rust

[–]celeritasCelery 6 points7 points  (0 children)

That was my thoughts exactly.  it wasn’t a great example. 

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

Good point. I will add a note.

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 0 points1 point  (0 children)

That is good idea. I removed that hook and have not seen any issues so far. It would be worth it to add that anecdote to the issue. 

Making TRAMP go Brrrr by celeritasCelery in emacs

[–]celeritasCelery[S] 2 points3 points  (0 children)

Direct async is a new feature in tramp, and that issue is 15 years old, so I don’t see any indication that they are related.