7 ms·
Emacs 31: An unofficial guide to Markdown-ts-mode
- deleted 1mo ago[deleted]
- pjdesno 1mo 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 1mo agoThanks for adding this. I just made a comment expanding a bit of what users may find in the new mode.
- edgyquant 1mo 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 1mo agoWhich AI coding package? Agent-shell? Gptel-agent?
- edgyquant 1mo 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 1mo 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 1mo 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 1mo agoAgent Shell connected via ACP to local Claude Code. https://github.com/xenodium/agent-shell https://github.com/xenodium/agent-shell
- wilkystyle 1mo agoCan't say enough good things about agent-shell.el! Xenodium has done amazing work there.
- bryanlarsen 1mo 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 1mo 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 1mo agoWonderful to hear. Thank you sir!
- mplanchard 1mo agoSeconded, agent-shell is my favorite LLM interface bar none
- iLemming 1mo agoHave you tried https://eca.dev https://eca.dev ?
- mplanchard 1mo agoI haven’t! It seems akin to ACP, is that accurate? Do you recommend it?
- banjomonster 1mo 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 1mo 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 1mo 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_ 1mo 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 1mo agoDefinitely try ghostel, it's really solid.
- scoops_ 1mo 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_ 1mo 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 1mo agoI use cLaude cOde in my eMacs (through ghostel, which is unbelievably great!) to generate code :-) I then use mAgit to review it.
- taude 1mo 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.....
- kodoman 1mo 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.
- taude 1mo agoYeup, I would love to have some of the org/agenda operations/views on a regular markdown file. Especially so I could just copy it raw out, and paste into other markdown-centric tools, github md files, etc. for colaborating with others. Since markdown is becoming so prevalent. Even our product managers are becoming natively conversant with it, I'd just prefer to have as markdown first world. (don't get me started ranting about how Atlassian and Slack have migrated away from markdown and to proprietary formats....).
- kodoman 1mo agoYes must say I have found myself moving away from org and looking at it as an annoyance wrapping up many excellent features that could be wrapped up in simple elisp function and structures that could then just be encoded in what every way one likes, it seems to me that for example todo lists are actually better as nested lisp lists, And then you can simply render as what ever you like. Of course one might like to serialize back as well but I have often wondered about it. I definitely think markdown has won (at org was never going to 'win' of course given it's limited scope) and actually is probably what we should just all be using and accept.
- RahulMJ 1mo 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 1mo 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 1mo 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 1mo 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 1mo ago
- seamossfet 1mo agojust switched to doom emacs this month, absolutely loving it tbh
- cpach 1mo 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 1mo 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 1mo 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 1mo 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 1mo 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 1mo 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 1mo ago[deleted]
- ngai_aku 1mo 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 1mo 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 1mo 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