8 ms·
Emacs 31: An unofficial guide to Markdown-ts-mode
- deleted 20d ago[deleted]
- pjdesno 20d agoFor those of us who have just been using Emacs, rather than following its recent evolution, "ts-mode" refers to a mode which uses tree-sitter for parsing, highlighting etc.
- RahulMJ 20d agoThanks for adding this. I just made a comment expanding a bit of what users may find in the new mode.
- edgyquant 20d agoWhat are people’s workflows for using eMacs with generative coding? I’m trying to get a workflow where I can generate code and approve it like a PR (maybe leave comments for a next round of generation) but I’m new to eMacs and the ai coding package isn’t working with the latest eMacs
- kreyenborgi 20d agoWhich AI coding package? Agent-shell? Gptel-agent?
- edgyquant 20d agoIt’s just called ai-code I’m new to eMacs so this popped up but had a bunch of issues I was trying to debug https://github.com/tninja/ai-code-interface.el https://github.com/tninja/ai-code-interface.el
- internet_points 20d agoNever heard of that one. The most popular ways for agent stuff seems to be https://github.com/xenodium/agent-shell https://github.com/xenodium/agent-shell , or just opening a terminal in emacs and using claude code. If you want to run it through an emacs terminal, consider using https://github.com/dakra/ghostel#ghostel https://github.com/dakra/ghostel#ghostel (or vterm, or eat)
- mplanchard 20d agoThanks for posting the ghostel link, I hadn’t heard of it. Excited to try it out and see how it compares to vterm
- remedan 20d agoAgent Shell connected via ACP to local Claude Code. https://github.com/xenodium/agent-shell https://github.com/xenodium/agent-shell
- wilkystyle 20d agoCan't say enough good things about agent-shell.el! Xenodium has done amazing work there.
- bryanlarsen 20d agoI'll have to try it again. It definitely feels like the right way to do things, but when I tried it it had a couple of show-stopper limitations and a show-stopper bug, so I've been using claude-code-ide.el instead.
- aag 20d agoI'm a huge fan of agent-shell, too. It keeps getting better and better, and it's infinitely customizable, like any good Emacs package.
- xenodium 20d agoWonderful to hear. Thank you sir!
- mplanchard 20d agoSeconded, agent-shell is my favorite LLM interface bar none
- iLemming 19d agoHave you tried https://eca.dev https://eca.dev ?
- mplanchard 18d agoI haven’t! It seems akin to ACP, is that accurate? Do you recommend it?
- banjomonster 20d agoI’ve been using gptel, I’ll have it generate org babel blocks I can tangle (write to files) or have it use tools to write and edit files in the project I’m working in, and then review with magit.
- bryanlarsen 20d agoIMO, generative coding on Emacs works nicely because magit is awesome for code review. A good agent integration package is going to have a command you can use to send the current cursor line & file to the agent so you can reference and comment.
- sebastianavina 20d agoI use windows 11, wsl2, WezTerm. emacs -nw directly on the shell. its like working on a linux computer, but from windows. I run vterm inside emacs, and claude code inside vterm. I have special commands for extracting file routes, and flow between dired and magit. Everything runs like magic. I also have copilot-chat and copilot-mode installed. From time to time I use it to review what claude has done, or to chat a little bit.
- scoops_ 20d agoI’m trying to use a similar workflow, but when I attempt to use Claude code in vterm, I have issues. My use case is resuming a session and not being able to scroll back to the past history. Otherwise if I start a new session, it works fine. It’s probably related to me being on an old version of vterm, but I’m just wondering if you ever have come across this.
- suprfnk 20d agoDefinitely try ghostel, it's really solid.
- scoops_ 20d agoThanks, I would, and I’ve used it on my personal machines (it works great), but I’m trying to stick to the apt package repos on my $WORK machine. Ubuntu has a fair number of elpa packages in its repos, so I’m trying to make it work if possible. Not sure if I’m missing anything config wise within the confines of vterm
- scoops_ 20d agoI found my answer, I needed to be using page up and page down keys to “scroll” through the claude history - which is apparently required due to Claude capturing my C-v and M-v’s in its “text-box”.
- jwr 20d agoI use cLaude cOde in my eMacs (through ghostel, which is unbelievably great!) to generate code :-) I then use mAgit to review it.
- taude 20d agoOne of the biggest reason I've stopped using Emacs, and I was a pretty heavy user before was that org-mode files weren't fully native Markdown files, which caused annoying friction when collaborating with others. It would be interesting for me to have a new markdown-centric org-mode thing. I'd love to vibe lisp to customize my workflows, and I don't totally love Obsidian, which is what I've setup and configured now. I'd prefer to just have the config living in/around init.el/config.el (I used DoomEmacs most recently). I realize that org/agenda, etc does a ton more than markdown offers, but most of my flow is just around: raw notes to be consumed, check lists, due dates on items, and other "basics" of org-mode. Any recent Emacsers have similar workflows that are tgenible these days? I'd love to get Emacs back in use in my new antigenic Tmux-centric coding flows, and have it be a first class markdown editor, organizaer, and potentially collaboration.....
- mfld 20d agoNot tested this myself, but there are ways to improve markdown/org-mode interop, like in https://youtu.be/RJqRwlVvB3E https://youtu.be/RJqRwlVvB3E
- nathwolf 14d agoThis is very close to why I ended up doing Marktwin. Obsidian was not giving me what I wanted. It keeps Markdown in GitHub but gives people a nicer place to edit, discuss and review changes together. I never have access to your content. Is free and open source, and I have no intention of adding a paywall for what there is now. It’s a hobby project: https://marktwin.com https://marktwin.com If you have feedback, let me know. It gives me another reason to procrastinate and work on it. I am now working on the macos app (as I prefer to work out of the browser). I hope to make it flexible because everyone in my team has different workflows and we are using this as our internal documentation/collaboration tool.
- kodoman 20d agoWhat is wrong with markdown mode? Is it that you would rather do the org agenda or calendar via md rather then org? I do understand that if that is the case.
- RahulMJ 20d agoA bit of extra info: - `ts` stands for "tree-sitter", meaning this mode uses tree-sitter under the hood, which is, among other things, very performant. - There's support for the CommonMark spec and GFM, so things like `- [ ]` checkboxes and ~~strikethrough~~ work out of the box, along with many other small QoL features. - This mode is BUILT-IN, so no extra packages are needed. - This is currently in the experimental phase, so users need to "opt in" and load the mode to play with it, hence the first part of the guide.
- lurght 20d agoI think in 31 registering the file types isnt necessary any more, the mode opens automatically for me (and i did manually delete the old markdown-mode)
- setopt 19d agoAre you using the 31 release or prerelease? The mode was changed to experimental right before release. Just FYI, I think the comment you replied to is by the author of the mode and an upstream Emacs contributor, so I would assume their instructions are up to date for the 31 release.
- dleslie 20d agoTree sitter support is half baked in the same way official LSP support is, only kind of worse. Eglot won't help you get your system ready for LSP work, it will only avail itself if what's there. It doesn't even auto detect and configure that, either. There's no user prompting, so you'll have to read the docs to know that this even needs to be done. Similarly, tree sitter support doesn't include the grammars! And those aren't typically sitting in your package repository, so users have to find a grammar and compile it themselves. There's not even a good recommendation given by Emacs on where to get them, leaving users to hope that whatever repository showed up on a Google search is both in good working order and safe to use. It's really quite a failure on Emacs.
- femiagbabiaka 20d ago
- seamossfet 20d agojust switched to doom emacs this month, absolutely loving it tbh
- cpach 20d ago“You probably heard of this new markdown-ts-mode and decided to check it out.” Uhm, no, I haven’t. Why should I care if the Markdown mode uses Treesitter or not…? Does it affect the performance or UX somehow?
- mplanchard 20d agoOne option would be to read the section of the linked article talking about features: https://rahuljuliato.com/posts/markdown-ts-mode-emacs-31#a-quick-look-at-markdown-ts-mode-features https://rahuljuliato.com/posts/markdown-ts-mode-emacs-31#a-q...
- jlokier 20d agoIt's still reasonable to ask what's different about markdown-ts-mode compared with markdown-mode. I read that article, and I didn't notice anything that stands out as different from markdown-mode (the non Tree Sitter version). Regular markdown-mode also highlights everything, hides markup if you like, cycles section visibility if you like, fills paragraphs in bullets, etc. With poly-markdown-mode it also does language-specific syntax highlighting in code blocks, and even language-specific structural editing, automatic indentation, etc. With math-preview it displays TeX/LaTeX math as rendered formulae.
- skydhash 19d agoI think the appeal of tree sitter is to have a single query api for traversal of the nodes in the abstract tree of the language. So it become easier to adjust or adapt the parser.
- mplanchard 19d agoMostly same as with any treesitter mode: it’s easier to build structurally-aware features, and it automatically supports any minor mode that’s enabled by treesitter (examples from my own config include structural movement, folding, selection, indentation guides, etc.). So, rather than every language having to reinvent the wheel, and every user having to install six different language-specific packages to get feature parity, more stuff just works. You mention eg poly mode, which has always been extremely finicky for me. Syntax highlighting in treesitter modes is both more capable and more consistent.
- ggm 20d agoSo I can get bold at a cost of shift* to get the star. Or I can do ESC enable-this-mode-option and then press a single key. I'm struggling with this. If it's cheaper in keystrokes to type the codes inline why enable the mode? This isn't a vi vs emacs hate thing, It's a key count efficiency thing. I don't see the motivation even if translated to minimum prefix TAB complete terms. Its like 20x more presses.
- deleted 20d ago[deleted]
- ngai_aku 20d agoI don’t think TFA meant to suggest that everyone should upend their current practices for the emphasize function. But I can see someone who is less familiar with the myriad of ways to emphasize, or the markers which signify the emphasis, appreciating what it offers
- ggm 20d agoYes. I also believe this motivation but a counter argument was put to me by Mike Lesk in the mid 80s. Bell did serious experiments on library query systems and the casual helpful, verbose ones were only useful for a brief period in any library index users lifetime, they moved to the terse, harder to learn, efficient one as soon as they could. So, it's a universal feature of Emacs all things glue in like this but the strong likelihood is power users use terse brief commands more, more effectively. I use Emacs org mode a lot and the only M-x command I use frequently is the column deletion because I seem not to use it enough to learn the brief form, but do need to do columnar edit stuff.
- rjprins 20d agoI still use my markdown-modern, and obsidian-style renderer. I read more markdown than I write and for that it works well. https://github.com/rjprins/markdown-modern https://github.com/rjprins/markdown-modern