Categories: geek » emacs

View topic page - RSS - Atom - Subscribe via email
Recommended links:

#YayEmacs 10: Emacs coaching with Prot: Emacs workflows and streaming

| emacs, yay-emacs

I realized that one of the mistakes I often make with Emacs is not asking other people for help, so I experimented with a coaching session with Prot. With his permission, here's a recording of our conversation.

View in the Internet Archive, watch/comment on YouTube, download the captions, or e-mail me your thoughts.

Chapters

  • 00:00 Intro
  • 00:50 Organizing my config into multiple modules and org-babel-post-tangle-hook
  • 04:45 Changing namespace, renaming functions
  • 07:11 Defining aliases for old functions
  • 08:30 Improving my streaming setup
  • 12:09 Keeping things from accidentally airing
  • 14:50 Livestreaming and recording
  • 15:09 Keeping track of interesting moments
  • 18:19 Editing
  • 20:26 Writing
  • 22:34 Packaging
  • 25:40 Responding to email
  • 29:21 Development workflow
  • 29:59 Testing
  • 33:46 Learning and reminders
  • 35:31 Encapsulating workflows into functions
  • 37:05 Popping up notes
  • 38:21 Rediscovering things in my config
  • 40:31 Catching up on Emacs developments
  • 41:29 diffs
  • 43:08 Thinking about the community
  • 44:00 org-link-preview
  • 45:31 Prioritizing things to work on
  • 46:39 Modelines
  • 48:50 Themes would be nice to have per-frame
  • 49:27 Livestreaming conversations with Prot
  • 50:11 Getting together
  • 54:44 Namespaces
  • 55:46 Verbose function names
  • 56:45 Naming conventions for ERT tests
  • 57:14 shorthands
  • 58:27 Bisecting config in multiple files
  • 58:46 "I don't write bugs."

Rough notes to clean up over the next little while

  • Meta: learning things
    • Don't try to remember too many things
    • Build a command that does those for you
    • Ex: preparing for videos, prot-streaming-mode
      • line numbers
      • disable spacious padding
    • long names: more chances to match it
    • new frame and then making it disappear: org-capture, timer; I can use that for notes
    • Tip: prefix keys are also helpful; for example, replace C-z, no one needs to suspend Emacs anyway defvar-keymap :prefix defines how it should be called as a command, which is good for handling updates to keymaps as well
  • Emacs Lisp development workflow
    • diff-buffer-with-file buffer-file-name - diff current buffer
    • Renaming a symbol
      • single file
        • substitute
          • also noting function aliases, obsolete
      • multiple files? -wgrep
        • keyboard macros from dired and substitute
    • Bisecting config in modules?
      • "I don't write bugs… Of course I'm kidding."
      • Ah, I can probably use bug-hunter with a setup file
    • Testing
      • I think I just need to get the hang of:
        • ERT, modus-themes-test–modus-themes-load-theme
        • nameless -> shorthands
        • Tip: Docstring as a declaration of intent; the docstring is the source of truth, not the code. If you write more than the minimum, then you are helping future you.
        • setting things up at the beginning (Makefiles, continuously running batch mode tests, etc.)
        • navigating to where I want to write the tests
        • mocking functions
  • Making more of my config reusable
    • "I implement the package that I want."
  • Workflows for writing, making videos, livestreaming
    • wide monitor is awesome
    • different font configuration with fontaine
    • private stuff:
      • private vertico
      • turning off preview for consult
      • keeping files organized
    • marking chapters and highlights: using his memory for this
    • just capture a timestamp and possibly a note
    • could also just do the offsets manually by saving the time
    • display line numbers to help people orient themselves and so they can mention it in the chat
    • writing: splitting it into modules helps
    • Ooh, idea, theme for streaming
  • Other stuff I forgot to mention
    • TODO: link preview - update my code for svgs
    • Emacs modeline? Smaller lighters, buffer name, view narrowed, read-only, keyboard macro;
      • streaming, microphone

Transcript

Transcript
  • 0:01: Intro: Sacha: Fantastic, this is great, I finally get to talk to you. I appreciate that you blogged so quickly about some of the things that I mentioned, and we can certainly dive right into that, or you have a lot more experience with how these conversations go, so I can let you take the lead.

    Prot: Since you put in the effort to write, we already have a very good structure. The idea is, let's have your screen, so you can share your screen with Jitsi.

    Sacha: Yeah. I will share my screen.

    Prot: And we can go right into it. Let's see. So if you hover over… Okay, yeah, you have it.

    Sacha: yeah oh you know if if at some point I should be really like fancy… Future session, we should get crdt working because that's fun.

    Prot: Ah, yes. Oh, that would be nice. Yes.

    Sacha: Yeah, that would be nice. All right.

  • 0:50: Organizing my config into multiple modules and org-babel-post-tangle-hook: Sacha: So I've been making good progress in splitting up my config into multiple modules. I just have to iron out a couple of things like do I actually have to load the autoloads from the user list directory or does it automatically take care of that? Because sometimes it doesn't seem like it's doing the thing. Anyway. It's making good progress. And in fact, I came across something that I'm not sure you know about yet, or maybe you know about it and you decided not to do it. I found out that, so, okay, so here's the context. You know, when you do your literate config, you have your modules and they're actually just one big file, like one big source block with a commentary and everything in it. Yeah, yeah. So I found out that you can use a hook if you want to, to add stuff to the tangled files afterwards. So the way I set it up with my config is I still want all the different functions scattered all over the place because I'm not yet as organized as you in terms of the modules. So the org-babel-post-tangle-hook here, post. Yeah, yeah, yeah, post

    Prot: So what did you do with that? Let's see.

    Sacha: and boilerplate… has that boilerplate here we go so what it's what this does is when it tangles it it then goes back into the file and it inserts all that extra text and the footer into the tangled files so I still have my links to

    Prot: Nice.

    Sacha: the different source files where it comes from. So this is the section where it comes from but I also have all the extra lovely commentary and stuff so I'm like…

    Prot: Ah, that's smart. That's good. That's good. Yes.

    Sacha: That way, you don't have to keep repeating things. Although I guess if you really wanted to repeat things you could you could theoretically have the license just as a no web reference and then have it go in there automatically. anyway so I thought that was really cool so I'm making progress on the things that I had mentioned in the in the blog post about organizing my config into multiple modules and other yeah…

    Prot: And how far are you in that project? How far are you?

    Sacha: Let me see. I can look at the sacha.el here and I can do an occur on the files that have the lines that have the defun. I only have 482 defuns to get rid of. This is already a lot less than what I started with because like you, I have a very large… Almost 40,000 lines in this sacha.org.

    Prot: Yeah, yeah, that's massive. Yeah.

    Sacha: It's fun and it's interesting. It is a little reassuring to know that people still rely on your published modules instead of actually, like, do people take your config? I know you've got stuff in the config that makes it possible for people to just load it and add their customizations on top, but do you hear from a lot of people who do that?

    Prot: From a few of them, yes. And this is why I actually created those customizations. But I must say, I have been trying to

    Sacha: Yeah, yeah.

    Prot: make it more difficult for them. So I used to have a use package, but now I disabled it on purpose and I have my own macros, so that somebody doesn't just copy-paste. And I don't do this to be mean, but I do it because this way somebody will have to think about, like, okay, what is this? What am I doing here?

    Sacha: yeah I figure making making them still do that okay what am I doing here while still being able to automatically load all the function definitions will probably get them over that you know like make it a little bit easier for them so at least that way like right now it is difficult to copy things from my config like like you're so like okay maybe this is a feature but you know, maybe changing it will be nice.

  • 4:45: Changing namespace, renaming functions: Sacha: The other big thing that I need to do with my config is I'm thinking about shifting everything to the sacha- namespace instead of the my- namespace, which is going to be a lot of renaming, which is actually, it was actually the question that I had about renaming things, not necessarily coming up with clever names that have good acronyms like you do. And I love that the humor that you have in there, but like, like just mechanically, are we talking wgrep is like, is there a more modern, emacs 31 way to rename things? Am I just using erefactor or like replace-regexp? What do you do when you need to rename a symbol in possibly multiple files?

    Prot: If it's in multiple files, I do the grep approach. So it's not that sophisticated, but it works. Because the thing with the multiple files is, and it goes also to what you were telling me in that article, is first you organize, and then you refactor. It's that idea. The multiple files will not have a lot of extraneous information. You will not be matching, at least in theory, you will not be matching too many false positives.

    Sacha: Yeah, and if you're doing a single file,

    Prot: So you won't have to sort it.

    Sacha: what do you like to do?

    Prot: I have a package called substitute. One of the ways I do it is just substitute the symbol at point. But of course, this is just a minor convenience. You can do that with a query-replace. I'm not saying that you really need the package. But the idea is that you do it and you know that it works. Like, for me… I know that it works in the file. So for me, that's very reliable. But the other thing I should mention is keyboard macros from dired combined with substitute. So you start from a dired buffer, and you go file by file. That's the general idea. And in each file, you will perform, for example, a search to the symbol. Once you are on the symbol, you do the substitute-replace command, and then you move to the next file. So that is the workflow. And I do that a lot, for example, with my themes, because they have a lot of repetitive code, like each theme.

  • 7:11: Defining aliases for old functions: Sacha: Okay, the other thing that I was thinking of as a workflow improvement here, because I'm sure that I'm going to keep calling them by their old names, especially interactively, like have a lot of commands that go off the meta x, my do this and this and this is I might also need to think about adding a function alias automatically. And one way I was thinking of doing that was just, you know, iterating over our array and bulk defining aliases so that all the sacha- stuff is now named my- stuff but I was wondering if that was a or actually also manually inserting the like well not of course manually but but creating forms for like defining the aliases somewhere but I was wondering if this was something that you already did as part of your workflow like do you when you rename things okay

    Prot: No, I haven't. When I rename things for my packages, I do use aliases. But for my own code, if I rename it, basically, it's

    Sacha: yeah yeah

    Prot: just the latest name. So I don't try to keep aliases around. Because I eventually use a similar name, it won't be very different.

    Sacha: huh all right yeah yeah I mean like it's it's there you

    Prot: But what you said about the obarray makes perfect sense.

    Sacha: might as well do do it automatically right okay all right that's me oh okay okay I can

  • 8:30: Improving my streaming setup: Sacha: I can do my jitsi thing so I can see everyone and the screen at the same time the screen is very small okay so so that's I do have a dual monitor setup, which

    Prot: Yeah, you need that dual monitor setup,

    Sacha: is why I was like, OK, maybe I can start looking at your B-frame things. And in fact, in the minutes before I called, I figured out how to use MasterChat CLI to get the YouTube live chat into a command line program, which means that it can be run from call-process or make-process or other such wonderful things. So now it's an Emacs buffer. And then I was thinking, okay, maybe I'll make a pause frame or like a B-framed like dedicated frame for it so that I can have the chat of a live stream displayed within Emacs because you know, it's Emacs. We should do that. Yeah, yeah, yeah.

    Prot: Nice. Yes, of course. And you can have it in a side window dedicated buffer.

    Sacha: Although I might actually have to write my own like Node.js program so that I can also send text from it, from Emacs. I think the masterchat CLI, it only displays, but the library that it uses, if you pass it your browser cookie, you can use it to send messages back to chat as well. The reason I had liked Twitch before was because Twitch had some kind of IRC type thing that you could connect to. And then that meant, of course, that you can use ERC from within Emacs in order to send stuff to it. Anyway, live streaming and chatting, I've also been getting into that lately. And I was going to pick your brain about this whole like workflow for making videos or live streaming them. And more importantly, going back afterwards and remembering to post them or edit it, in case you forgot something or whatever. So if you happen to have any tips or the things that you like about your setup, I would love to hear about that.

    Prot: Though in my case, the setup is really simple, and I admit that I could improve it. But it's really simple right now, where I have a wide monitor. So it's one display, I don't have two, but it's like 2500 pixels instead of 920. So I have a little sidebar on the side, and there on the sidebar I put OBS, for example, and I put everything I need there on the sidebar. And then I have enough space to have whatever it is I am displaying and maybe another widget on the side. So that is in terms of the physical layout of the monitor here. And then in terms of the Emacs side, I don't have a lot going on. I have one package to load the different font configuration. So when I do streaming or videos, I will load basically the presentation setup.

    Sacha: It is a spontaneous.

    Prot: That's Fontaine, exactly. But again, it's not a matter of the package. You could have a function that just changes the default phase, the height attribute.

    Sacha: I have this monitor and then laptop, so this is my workaround for not having enough space in this desk for a super wide monitor. My husband has a super wide monitor which I like to borrow during EmacsConf. Hello child who is wonderful and likes to make cameos during my EmacsConf. Okay, I'm going to hug you.

    Prot: Hello!

    Sacha: Yes. So okay, so live streaming and then you just basically hop on the stream and talk about stuff.

  • 12:09: Keeping things from accidentally airing: Sacha: I know you've mentioned things like just starting Emacs with your Scratch buffer, but yeah, how about the interesting workflows for not accidentally spilling secret stuff online?

    Prot: Part of that is… so I use Vertico normally for my completions. I have some configurations for private Vertico, where by default, it doesn't display what Vertico normally displays. It's just a blank minibuffer, the way it is with the default Emacs minibuffer UI, right? But what happens is as soon as you do TAB or as soon as you move up and down, then it displays Vertico. So that, that is one way for me to make sure that I'm not showing anything I didn't want to show. The other thing is when I do videos, I don't use consult actually, even though I like it, because of the preview functionality. I don't want to be switching between files and then consult shows us something which is private. Right. So. So the private VertiCo, it's a small extension that I have with a few functions for Vertico.

    Sacha: I've been thinking about modifying the console preview states so that I can elide more, I can skip over things that might be private. And things like, I already have a filter function for marginalia so that it doesn't show me the values of variables that might be private. But yeah, just turning off all these things makes it a little bit easier to say, okay, I'm just going to jump on the live stream and do this thing. Some of the other fun stuff that I've been doing along the

    Prot: So there is that. And for private, of course, the other thing with privacy is that you want to have a generally good sense of where you put your files. So for example, in my pictures folder, I know that I don't have anything private there. But there are some sub folders which are like personal. So I know not to go there. So it might happen, I need to show a picture, okay, I just go to the pictures folder, and I show it, no problem.

    Sacha: lines of keeping things organized is if I have a stream tag on a task, I know that's safe to show on screen. And then I modified my Org jump stuff. There's a hook that you can use to narrow things to just that subtree. So at least I can jump to it and not have to worry about the rest of the context in my inbox. Trying to slowly slowly get the hang of this

  • 14:50: Livestreaming and recording: Sacha: Okay. So it's live stream. Do you like to live stream and record at the same time locally or just live stream and then go into the YouTube thing afterwards to download?

    Prot: I just do the latter.

    Sacha: It takes a little bit of a while,

    Prot: I just download it from Youtube afterwards

    Sacha: so I'm like… I could get started on the transcription.

  • 15:09: Keeping track of interesting moments: Sacha: Do you have anything to keep track of interesting moments that you want to revisit, or do you just, I don't know, skip around in the video, look at the transcript, whatever?

    Prot: I remember, I know this sounds bad, but I remember.

    Sacha: People with good memories, boo!

    Prot: And generally I try to also sharpen my memory. So whenever I can practice something, I will do it like that. But otherwise, if you really need to take a note of something, you can always have a small function that just records the timestamp. Like, what is the current time? And then you know when you started, so you will know where you are in the video. Like, it would be a very simple function that simply prints the current time, you know, format-time-string,

    Sacha: Yeah. I just have to write something that gets the time

    Prot: in a buffer at the bottom of a buffer. And that buffer is like your interesting moments kind of thing. And if you really want, you can make that prompt you for some text, like here is the timestamp and here is like, you know Prot said a joke or whatever, you know, like…

    Sacha: started from YouTube and then calculates the offset automatically, so that I can say okay, here are my chapters roughly.

    Prot: Yeah, that's even more fancy. Or you could do the other thing, which is all local, which is the moment the stream starts, you hit this command, like you invoke it, so it resets the time and then it performs the calculation locally. So you can do calculations with time in Emacs. So you can perform that as well.

    Sacha: Yeah, that's really straightforward. Okay, so that's definitely something that I'm going to want to think about, because video is great for enthusiasm and showing cool stuff that you might otherwise forget to mention, but it's just so slow to review afterwards.

    Prot: Yeah, of course, of course, of course. Just to say another thing with video, what I have found that is really helpful is to display line numbers.

    Sacha: Oh yeah? Huh.

    Prot: Me personally, I don't use line numbers, but I have found that when I am displaying something that others need to follow, line numbers help them. Because for example, earlier you were jumping around trying to find that hook, you were…

    Sacha: Oh yeah, yeah, yeah. Okay. Display now.

    Prot: And of course, me, I have experience, so I kind of know what you are doing, but somebody who is not really into it will be like, what is happening? Why are things moving up and down so quickly, right?

    Sacha: Okay. And they can mention it, too, in the comments,

    Prot: And they cannot track where you are.

    Sacha: which is nice.

    Prot: Yes, yes, of course. And also, when you are displaying something, you can say, look, on line 100, what I am doing, for example.

    Sacha: I have to steal your config for the highlight line

    Prot: And it's easy for everybody. Yeah.

    Sacha: priority because I've been using the highlight line for that. But sometimes it overwrites things. I'm like, OK. Today it is well-behaved, so I'm glad for that.

  • 18:19: Editing: Sacha: Making videos, all right. Just go ahead and make the videos, you just do it pretty straight, you don't do a lot of editing afterwards, I'm hearing, following the same kind of philosophy that you use for your blog posts?

    Prot: That's the idea.

    Sacha: All right, I should just go do things and not worry about whether the live stream demo that I just made of how I can highlight the PDF of your literate config and extract the stuff into whatever has a bug in it. And I'm like, oh, I just demonstrated that. It's okay, I can update it in the show notes. Oh, that's true, especially since

    Prot: Or even better, you do a second video afterwards, a follow up.

    Sacha: now I figured out that you can use org-pdfview view to link to pages in the PDF. So now my index.org has the highlights from your config, and it takes me back to the page that it was on. Very very cool stuff.

    Prot: That's nice.

    Sacha: Okay, so I just gotta do it.

    Prot: I think Org-noter also is another package you could use for that.

    Sacha: Yeah, probably. and then I just need to get… I think I've got PDF tools or PDF view set up. And then reader of course looks very interesting also. So I've got to tweak my config a little bit more to get it running because it has an external dependency. Anyway, so just got to do the live streaming. I was delighted. People have actually been dropping by and commenting or chatting during the live streams, which is great because I get to remember, oh yeah, I should explain that part, taking it for granted.

    Prot: The thing with a live stream,

    Sacha: So all of that is good stuff.

    Prot: because it's something you also wrote, like getting used to talking to yourself, right? So, of course, that takes some practice, but I think, yeah, you have the hang of it already.

    Sacha: Something is ringing. Hang on, sorry. I forgot. That was just my reminder that the kiddo is back to school. Virtual school is fine. Anyways, OK, so so just got to do it.

  • 20:26: Writing: Sacha: Thank you for the tips. This is very helpful for

    Prot: You're welcome.

    Sacha: writing. I'm getting better at actually remembering to include more bits and pieces from my config, and I'm sure that now that I have them in different files, it'll be easier for me to then write the post that links to, oh yeah, here's the five other functions you need in order to make this little snippet work. But do you happen to, knowing the kinds of stuff that we like to write about, do you have any other tips from your workflow?

    Prot: When it comes to sharing code like that, I already noticed while you were moving around that you have many things like my-consult, my-org, etc. What helps there is to just make those their own module right away. And from there, you know that, okay, this is either self-contained or it has an explicit require, so I can already know where I need to search for dependencies. So it's really that. It's because, for example, if you take just a my-consult function, right, of course, you know by the name that it depends on consult, but you don't know if it depends on my- common functions, for example. Right. Whereas if you have it in its own file, there will be a require at the top. So, you know, OK, require my-common-functions. And that way you can tell, okay, there is a dependency here. So then when you are to share this function, you can search for, okay, my-common-functions, is it mentioned here? Yes or no. And then you know what the dependency is.

    Sacha: And I think this process of moving things into those separate files will make it easier for then, for people to say, okay, yes, I do want to try that thing. Let me check out the repository required, just load-file that particular file and then be off to the races. So we'll see how it works. I don't know if people actually… Sometimes people mention borrowing stuff from my blog. So maybe people are actually reading the non-Emacs News posts. We'll get to see that.

  • 22:34: Packaging: Sacha: Sometimes I feel like a lot of my tweaks are very idiosyncratic, right?

    Prot: Yes, what I found that has helped me is I implement the

    Sacha: They're very suited to the particular need that I have. And then it's difficult to say, OK, if I were going to generalize this for other people, what kind of defcustoms will I need? What kind of options? And there's always that trade-off between, yeah, but I just want to implement the next little thing that I want to make for myself versus, well, if I put in the polishing effort, then possibly other people could use it, and learn from it, and then contribute their own ideas, and then everything gets better without me having to do the work myself. So it's a bit of a balance.

    Prot: package that I want. So for example with denote, but this applies to everything, denote version 0.1 is the package that I wanted. So basically, it works for me. Ever since, I have been adding other things that people want, which are, of course, good things to have. They improve the package, but I have already been using the package that I want since the beginning. So ever since, it's just adding stuff and learning about how people use it and refining the code, which everybody benefits from. So whenever you have an idea that you are like, okay, this may be too idiosyncratic, don't worry about it. Make it into a package, and then what other people need will become apparent, and then over time it will change, but the core package is still what you want.

    Sacha: Although it is interesting to see, for example, with the university calendar, institution-calendar thing, it's like, okay, you can get it to work for a small number of institutions, ELPA wants… they want it to work for everyone, everywhere, all the time. Okay, that might be too general. You might need to actually have lots of other people saying what they need in order to make that happen in the first place, right?

    Prot: Which at that point, of course, what you want is to write the documentation. So for example, with the institution calendar, I wrote a couple of examples. Okay, how do you extend this? And yeah, I think that helps. But then of course, you cannot cover every use case like people have to also make contributions if they really care about.

    Sacha: Yeah, so I think at the moment, I've been writing for n equals one, the audience is really just me. And occasionally I hear from people who are like, oh, that's an interesting idea, let me adapt it. Sometimes if I'm really lucky, they will go and write their own package on top of the stuff that I shared, which is the ideal situation, because then I can just like, oh, yeah, I'm going to borrow that and use it. It'll have more features and they're in charge of dealing with that. But I suppose at some point it behooves me to practice. OK, I'm just going to write it as a package, pretending that this is something, as you said, this is something that I want to be able to install and use myself. Then if other people find it useful, it's a lot easier for them to experiment with and then add on to.

  • 25:40: Responding to email: Sacha: Which goes to my second thing. Doing this and making things open to other people probably means being more responsive to email. And this is, for me, this is a bit of a challenge. I'm starting to feel less time-starved, which is good. I'm starting to actually be able to schedule things. One of these days, we should probably see if we can schedule a Prot Asks thing. I don't know if I can do two hours, but maybe I can do one hour or whatever. Anyway, the rest of it involves actually doing

    Prot: For sure.

    Sacha: the responsible thing and responding to issues and emails and whatever. It's always a bit of a trade-off, like, oh, do I implement this other crazy idea I have, or do I answer my email?

    Prot: For that, of course, it's a challenge. I must say that a lot of the maintenance work I do is via email. Or email or Signal or Telegram. People will ask me, hey, Prat, what is this? And many of the issues are not with my package. I had an issue earlier with the modus themes, no, the ef-themes, and eventually it was something to do with the user's configuration of some function of center tabs. But I had to go into it and check. So, of course, there will be that. But I must say, it's not too bad. It's not a big issue. You can always have in your email, like, hey, please don't use this for issues. And it's not a replacement for that. Just use the issue tracker.

    Sacha: I know I just have to… I think I just have to like reframe my perspective. This is a gift. Other people are taking their time and effort to do this. It's wonderful that they're trying things out and putting their… actually doing things themselves and then reaching out in case… 'cause it would be nice to get things working on more people's computers. I think that the stuff that I've been building around learning languages and doing voice input into Emacs probably… There are a lot of these things already, but they tend to also be very individual workflows and individual setups. So it'll be interesting to get to the point where we can start to even have a conversation with shared code.

    Prot: About the individual workflow, again, it's not a problem because what is individual now will eventually become kind of a standard workflow. Think about org, the beginning of org. You have Carsten Dominik, who is like, you know what, this outline mode isn't enough. I need more stuff on top. And eventually we have Org. In the beginning, I imagine org was basically Carsten's org, and it became this uh this package that everybody can use however they feel like.

    Sacha: I used to maintain Planner Mode before Org Mode got super popular and I remember feeling very embarrassed when someone very, very kindly said "I appreciate the work that you do; incidentally, the latest update kind of deleted a lot of my notes." So this is like, when you make something that other people use, sometimes your mistakes will affect more people than just you. But I'm hoping now that now that the disks are in the spaces of terabytes instead of whatever, people are just backing up everything and version controlling everything and everything will be fine.

    Prot: Yeah, of course, of course. Writing packages, of course, is a responsibility. The upside, though, is that because you know that it is a responsibility, you try to write cleaner code at the outset. Whereas if it's just for your own configuration, you're like, okay, this will work and I will fix it later.

  • 29:21: Development workflow: Sacha: Yeah, and that actually brings me back to this Emacs Lisp development workflow thing. So I think one of the things that I just need to do is I just need to set up the Makefiles and the snippets and the shortcuts to say that if I'm starting a new proto-package, the thing to run the tests is there, and whatever it is that maybe even continuously runs the test when I make a change, and lets me mock up functions so that I can test some of the things that might be more interactive or might require deleting files or whatever. It's just changing my buffer configuration and whatever.
  • 29:59: Testing: Sacha: So I occasionally write ERT tests when I feel diligent. Sometimes I'm starting to write the test first and then write the code that makes a thing, but if you happen to have any parts of your workflow that you particularly like when it comes to testing things, I would love to hear about them because I haven't gotten to that part of your config yet

    Prot: Yeah, so I don't have a lot going on for that. So it's simply ERT. But what I do with the tests is really basic. So ERT, M-x ert, and then I pick the test that I want. And I must say that when it comes to tests, I can be better myself. So there are some packages I write where they have good tests, but there are others that have zero tests. So I want to reach a point where everything has tests, but it takes a lot of work.

    Sacha: Yeah. I mean, like every so often I feel like very, very diligent and I'm like, okay, let's do code coverage. So I can see things with undercover. Let's write a function and make sure there's a test associated with it. And let's write a keyboard shortcut that lets me jump from the thing to the test that's associated with it or to run it. And in fact, I still need to get embark to do all these things for me so I can be looking at a function and say just rerun the test for this, please.

    Prot: Just to say one low-tech feature that has helped me a lot, low-tech, Is i use the docstring as a declaration of intent. So in the docstring, I say what is the function or the variable meant to do, like what is it meant to provide. And then if I look at the code and I'm like, ah, this doesn't work, I know that the doc string is what I wanted. It's never the code. So there is this idea that the code is a source of truth. For me, it's the opposite. It's like the doc. It's the specification. And then the code is… I was wrong. I was sloppy. I wasn't paying attention. I missed something or whatever. And the reason for that is the following. It's because with the code, you may have used the symbol wrongly, or you may be calling something that you don't mean to call, or there is another function. Or, for example, you use mapc instead of mapcar, so you don't get the return value you expect, that sort of thing. So something, basically you don't deal with sloppy problems. So you don't have confusion there. You know that, okay, the source of truth is the docstring. This is my intention.

    Sacha: I should do that more often. Now that I've changed my yasnippet for inserting functions to automatically have the docstring, I feel a little guiltier when I delete the docstring, so I am compelled to instead fill it out. But if I specify it in more detail, as you do with it becoming the statement of intent, then I can be like, OK, let's try that. It's a good practice. And then I can write the test.

    Prot: And the thing with docstrings is that, of course, you are

    Sacha: Yeah? This is me.

    Prot: motivated to just write the minimum necessary so that you don't get the warnings, right, from checkdoc. But if you write more, then you are rewarded yourself. It's something that helps you, future you, and of course other users, because you always have to consider yourself as basically a user. I don't remember why I wrote this six months ago, so of course having the docstring there, actually spell it out, helps me.

  • 33:46: Learning and reminders: Sacha: I definitely have problems with working memory and long-term attention. Which actually touches on this other thing that I mentioned in my post, which is, in your experience coaching other people and also in your personal practice, what are you finding as good ways to keep reminding yourself, okay, these are the keyboard shortcuts I want to internalize, or this is the the workflow tweak that I wanted to try naturally. I was thinking, maybe I make an Org file or maybe I make a quick help thing or whatever. But it's always interesting to hear about other people's workflows.

    Prot: What I find most useful is to not try to memorize too many things, but whenever you are in the flow of, oh, this is a process that I want to be doing, to actually implement it as a command or whatever, as a package or whatever, like basically don't try to memorize the steps and of course the key bindings. Try to build a function that does those for you. A command basically that does those for you. So for example, to be concrete, I mentioned earlier that for video purposes, I will enable line numbers. And I will also enable the line highlight. And I have another thing where I disable spacious padding. So the package I have. And all this, of course, I know the key binding. So it's F7 and F8 and F6 or whatever, right? But I'm like, I cannot remember all that. I will just write a function, and it will be prot-streaming-mode. And I enable prot-streaming-mode, and it does what I want it to do, and then I disable prot-streaming-mode, and I'm back to where I need to be.

  • 35:31: Encapsulating workflows into functions: Sacha: Yeah, I have a prepare-for-screencast that does something similar, changes font size, etc, etc. Tt's so wonderful that in Emacs, you can

    Prot: Exactly.

    Sacha: just keep collapsing things into functions that do the thing that you wanted, and it has access to pretty much everything. I just need to remember to actually call the thing and remember what the thing was actually called. Aliases are very helpful, so it's orderless, but it's like…

    Prot: Another thing that might help is long names. Because with long names, you have more chances to match it. For example, in this case, it could be called prot-streaming-mode, but you could also call it prot-streaming-and-video-demonstrations-mode. And of course it sounds ridiculous, but if you think about it, I might search for, I do M-x and I search stream. I find it. I search video. I find it, right. I search demo. I find it. So, if you care about something, you can name it that way, and then you find it more easily. Or, of course, with aliases, you do the same, right? prot-streaming-mode, alias, prot-video-mode, alias, you know how it is. But, yeah, either of those would work. Basically, benefit from the fact that you have completion, and I imagine you also have orderless.

    Sacha: So definitely that. And then

    Prot: So, yeah.

    Sacha: for the free form notes thing, it just occurred to me.

  • 37:05: Popping up notes: Sacha: So in addition to your posframe stuff in your config for quickly popping up an Emacs posframe for some commands, like, do you have some things? I suppose I could just use that directly for my notes and for the chat. Do you have any other of those "quickly pop up something so that you can do something with it and then make it disappear?"

    Prot: No, I haven't built a lot on that. So I have some functions I do

    Sacha: That's your main thing.

    Prot: with that. Specifically, I have it for the timers. For me, that's very useful. And for org-capture, but I haven't elaborated on it. Of course, I could do that more. Another that I… By the way, it's not a poframe. Technically, what I have is just a new frame. But the idea is the same, right? It pops up and it disappears. And I can share the code for that. It's in the prot-window package, actually.

    Sacha: I have it highlighted here in my…

    Prot: So it's a small macro there.

    Sacha: So this is the thing that I was telling you about earlier where it just extracts all the things that I've highlighted. It's very, very cool. It's in one of these, I'll grab it eventually. Which is good because I have to go over my config at some point.

  • 38:21: Rediscovering things in my config: Sacha: There's so much in there that I've completely forgotten writing about. And so I'm like reading this now as I'm splitting it into different modules and saying, oh yeah, I automated that. I'm doing it manually again.

    Prot: The other thing that might help is a prefix key. So I have done that with C-z. So it's a prefix key, and then either with which-key or with Embark, you know, the Embark… When Embark replaces C-h. I forget how it's called now. You can always see, OK, what do I have? Like, what are the groups? And then you can cluster things there. And it's very easy. Ever since defvar-keymap, ever since that became a thing, it's very easy to write prefix keymaps, because it has a keyword called prefix, and then with that prefix you define how the keymap should be called as a command.

    Sacha: That's interesting. I should definitely look into that. Finds how it should be called. That's a command. So you can just add it to other key maps as needed. That sounds cool.

    Prot: So consider this difference, like right now, you can take a defvar, which is a keymap, right? And you can bind it to a key, the keymap itself, without the quote, you can bind it to a key. So you will do define key in the global map, like whatever you want, and then bind it. What happens though with that is that you're binding the value of the keymap to the key, which means if you make changes to the keymap, your key doesn't know about them.

    Sacha: I've been running into that. I get annoyed and I have to keep re-evaluating my definitions. So yeah, okay, that's what I do.

    Prot: Whereas if you have the prefix, which is now a command, you have created an indirection. So now you define key to the symbol that you have specified. And that, of course, is that indirection, which now gets the up-to-date value of the keymap.

  • 40:31: Catching up on Emacs developments: Sacha: So this is Emacs stuff that I have been missing out on, because for the past 10 years I've just been squeezing things into whatever moments I can have before somebody comes and says hello and says mom mom mom mom, and now that I have a little bit more focus time, I'm looking forward to finding out about all the cool stuff that has gone into Emacs and that I'm not currently taking advantage of. So things like, for example, I only scratch the surface of using Lispy, and I want to do other things as expressions because it's all magical. And if you have similar, like, oh yeah, this is a new thing in Emacs 30 or 31 that is super helpful and not everyone knows about it, I'd love to know about it. I mean, I know it's on Emacs News, but sometimes I'm like, whoosh, it goes past my radar and I don't have the time to dig in.

    Prot: Yeah, right now I cannot think of something. But yeah, I will.

  • 41:29: diffs: Prot: Oh, a very small thing that helps me a lot when I make any kind of edit. You know, there is this function diff buffer with file. So that's good. For me, what I always want is

    Sacha: that sounds like a little tweak

    Prot: diff-buffer with a current file. I don't want to diff a buffer with some random file. So what I have is a very small extension, a very small function, which is diff-buffer-buffer-file-name. So buffer-file-name is the variable for the current buffer's file. And then I do the buffer file name. And for me, that's very useful. Whenever I make an edit or I'm not sure what happened, I do that and I already see the diff. I use that a lot.

    Sacha: that I would love to to pick up as well. There's all sorts of interesting workflow things that I am looking forward to discovering as I figure out the better way to watch videos and then also make videos, because one of the things I find is whenever you demonstrate something, sometimes, if you're really lucky, someone will say, oh yeah do you know about this thing that does the whole thing, which is great. One of my favorite reasons for sharing things is learning from other people. All right. You write this really long blog

    Prot: Same. Like you put it out there and somebody will be like, hey, you could do it this way instead.

    Sacha: post about this clever thing that you just figured out and then five minutes later, oh yeah, that's been built into Org since, you know, version 9.7.

    Prot: Exactly, exactly.

  • 43:08: Thinking about the community: Sacha: Which actually leads me to: what can we do? We've got about 20, 15 minutes left in this hour. Taking advantage of your very large context window for all things Emacs community, you know, those kinds of stuff that we are interested in, what are some of the things that we could do to make things even better? This is a very open question, of course, but yeah.

    Prot: Even better, you mean Emacs in general or Org in particular? Because Org got a very nice feature lately, Org 9.8, which is the ability to preview images for any link type. So that's very useful. Before it was like the file type. Now it's any link type. And of course, if you ever want to do something with a custom link type, there you have it.

  • 44:00: org-link-preview: Sacha: Which is good because I, in fact, have an override for a custom link type where I had done it before. So I just basically copied and pasted the image preview link so that I could have my SVGs either included in it as a whole or just preview. Anyway, so yes, I'm going to switch over to the new one. Link preview, update my code for SVGs.

    Prot: Yeah, for example, now imagine this. Imagine you have a custom link type, which is called image or something, and you just give the image a name, nothing else. And internally, this link type knows to go in a specific directory and get the image from there, maybe even have copies of the image, so it can give you a copy that matches some parameter or whatever, like some user option maybe. You could have fancy things like this. I have been thinking about it, but I haven't written anything yet.

    Sacha: I would probably like… Things like my audio waveforms could go in there very easily and things like that. I'm very curious about this idea of mixing more things into other places in Emacs. And one of the things that I've been meaning to dig into is how LECDraw does SVG interaction, because it uses mouse events to be able to drag things around and whatever. Because I think if we can get richer interactivity and more graphical elements, that could be really fun.

  • 45:31: Prioritizing things to work on: Sacha: Anyway, but yes, so I've got basically three months of focus time before the kid goes on summer vacation and wants my attention at probably the majority of the day at an irregular interval. So it'll be a lot harder for me to schedule things then. I can set aside maybe 10 hours a week to work on Emacs-y things, including possibly working on infrastructure for the upcoming EmacsConf, or tweaking Emacs News or hosting meetups or whatever. Taking advantage of you as an external perspective, are there things that would be a good idea for me to particularly focus on? Things that you've been wishing you could say, Sacha, hey, just do this thing and it'll be awesome.

    Prot: I think you already have a very good setup, actually. So I don't think there is much to be done in terms of adding things. Maybe the work here is to be removing things, and that's the more difficult part.

    Sacha: No! Delegating things. Passing things to other people, maybe. Making it possible for other people to help.

  • 46:39: Modelines: Prot: There is a very small thing which maybe is useful, maybe it isn't. I don't know how much you use the mode line, how much you rely on that, but the newer version of Emacs makes it possible to shrink the lighters for the minor modes.
  • 46:52: Modelines: Sacha: Yeah, I don't use the mode-line as much. I ended up moving keycast to the header line because it's a little bit more visible in videos. Sometimes when closed captioning is on, it obscures the mode line. So I don't tend to look at the mode line for much, and I'm wondering what I'm missing out on. And I'll probably also want to add: am I streaming?

    Prot: Yeah, not much. Not much is the answer, but maybe you could declutter it in that regard so that then it is useful. For me, where it really is useful is to know some things such as, of course, what is the buffer name? Is the view narrowed? That's, for me, really important. Maybe is it a read-only file? And am I running a keyboard macro?

    Sacha: Is my microphone on?

    Prot: Yes. Good, good. You see, there are all sorts of good ideas. And you can think of those as just one character, right? And you can have that one character with a face, which has, for example, a background. So is my microphone on? That's a green background. Am I streaming? That's a red background or whatever. And you just see the colors there and you know everything is all right.

    Sacha: Although, actually, now that we're talking about it, I'm thinking maybe I should just revive websockets. So I made an obs-websocket.el thing before, and someone has… The benefits of making a package: someone has actually updated it to work with the new WebSocket protocols. I just have to get the whole thing set up again so I can communicate with OBS. I can use a different theme, most likely another Modus theme, when I'm streaming, so that it's a little bit more in my face: okay I'm looking at the correct colors, I am public.

    Prot: That's the other thing. Yeah, that's good. That's good.

  • 48:50: Themes would be nice to have per-frame: Prot: With themes, unfortunately, that's actually something I would like to have. We cannot have them per frame, which is strange because if you do set-face-attribute, you can specify a frame argument. But if you do something like custom-set-faces, you cannot.

    Sacha: I'm sure that once you start messing around with Emacs internals, you might be able to figure out the way to do that.

    Prot: Yeah, now that I say it, it shouldn't be too difficult. Yeah. Famous last words.

    Sacha: Yeah, yeah, yeah. That's really fun. Okay, so that gives me stuff to work on.

  • 49:27: Livestreaming conversations with Prot: Sacha: I brought up briefly the idea of possibly setting up some kind of streaming things because I think, for example, this conversation that we have… I have so far managed to not share anything that is too private, except for, of course, the time when the kid is like, hello, mom, I need your attention and I want to be on stream. She likes to make cameos. So we could share this, and we could potentially think about having these kinds of conversations as something that other people could join in on, because it causes more questions, it's more interesting, and it also gets stuff out there without me having to type the lessons learned. So is that maybe something we can consider doing, I don't know, once a month for the next three months?
  • 50:11: Getting together: Prot: For me, yes. Even more frequently than once a month. Whatever works for you. For me, it works. That's the point. And also not in the context of coaching or whatever, but generally as a collaboration, I'm totally okay with that. Basically, more events for the community. I'm all for it.

    Sacha: Yeah, because it is different. I very much had missed doing Emacs chats, and I'm so delighted that you've got Prot Asks. I'm looking forward to watching the one that you just released, because it's a community event, right? You get to know about interesting things about people. And there are a lot of things that come up through conversations that don't come up when you're just writing by yourself.

    Prot: Yes, yes, yes. It's really that. It's really that. And for me, it's also another thing, which is it's more inviting. Like, it's like you are telling people, hey, show up like you can participate. Actually, we are friendly. Like, here we are. You see us. I think that kind of encouragement helps.

    Sacha: So if you want to do, like, Emacs office hours on a regular basis, either something that you schedule in yours… Is it a YouTube thing where we can both schedule a live and then both have it, or not? I think they've got a collab thing now. I don't know.

    Prot: I haven't explored it. So on the technical side, I really don't know. But in terms of intention, I'm all for it. So we can of course figure out the technicality.

    Sacha: You have the bigger channel.

    Prot: But I really don't know. We can do it twice a month, or even if you want, if you are really

    Sacha: If you want to set it up, then Thursdays are probably good. Or if you want me to set it up, then I can do that. And then we can figure out the platform details and the non-YouTube way for people to join… probably IRC. We've got all this lovely infrastructure for EmacsConf, which I dust off every month for meetups. So that's certainly something we can slide right in there too. Okay, so if we do it once a month, that just gives me three sessions of practice, but if we do it like twice a month or more, I am also okay with that. I think we can squeeze that in and make that happen.

    Prot: into it, once a week, a live stream once a week. And yeah, people can join, and we can always have a topic and talk about it and take it from there. We could also do it. Now, I don't know whatever makes more sense, but we could do it on my channel. And then, of course, with a prominent link to your channel, or we can do it one on your channel, one on my channel or always on your channel. Me, I don't mind at all. Like me, I'm in for the fun.

    Sacha: We'll figure out the technical details and whatever off-stream. It could be interesting because then that gives people a friendly place to drop by and chat. And also because I know you're there and I'm there, it gets away from the talking to myself. When it's just me talking and then it's just like chat is silent, it just feels like I have this unfairly privileged position. So yeah, that's definitely something we're going to look into. We can structure that as one of these coaching thingies if I'm looking for excuses to use the Google Open Source Peer Bonus. I still haven't really made a justifiably good plan for it. So yes. Okay. Oh, this has been very helpful. I've got like all these tips. If you're okay with it, I am totally fine with posting this recording online. If you want, you can also post it. I think there's some kind of collab thing.

    Prot: Me, I don't have a recording. So you can do whatever you want. So it's really up to you. Me, I don't mind. The reason I don't have recordings of my meetings is because I really have this policy of, you know, it's private. Your name is never known. Nobody has seen this. That's the idea. Of course, in your case, you're making it public. So, of course, that's fine.

    Sacha: Yeah, my stance is always, well, I'm going to learn stuff, but A, I'm very forgetful, so I need to be able to search it and find it again. And B, other people can pick up stuff too. I might as well expand the learning and do the learning out loud. So all that is good. And then for next time, which will probably be in two weeks, or maybe earlier if I manage to get my act together,

  • 54:44: Namespaces: Sacha: I'd like to see if I can get my stuff properly split up into different modules that have the different namespace. I really think I'm going to end up shifting to the sacha- namespace instead of all the my- stuff. I used to use the my- namespace prefix so that people could copy and paste things more easily into their code. But now I'm like, well, if I put it in sacha-, then I'm not polluting their namespace if they're loading the whole library.

    Prot: Yes, yes, exactly. Exactly, exactly. That's a good thing.

    Sacha: So that's on my to-do list.

    Prot: And with naming things, of course, I also hinted that in the article I wrote in response to your blog post. It really helps to think about the names. Also, with what we said earlier about finding things like so don't try to be too terse, too economical with the names like make the most of it.

    Sacha: I'm using nameless anyway to hide the prefixes. Got to get the hang of using the keyboard shortcuts to insert things.

  • 55:46: Verbose function names: Sacha: Yeah, so I do like having very verbose function names and just practically full sentences in the thing. All that is very good. So that's my main thing. Aand then of course, getting into more ERT… I have this function that now that lets me try to jump to the test or the file that's related to this thing. So we'll see how it goes, especially as I move things into these different functions.

    Prot: Okay, okay I'm not sure how you are doing that, but if I were to implement something like that myself, what I do with the ERT tests, it's always the prefix of the ERT file and then the name of the original function, double dash and then the name of the original function. So, for example, let's say, modus-themes-tests, right? So then it's modus-themes-tests–modus-themes-load-theme, for example.

  • 56:45: Naming conventions for ERT tests: Sacha: Okay, so that's your naming convention.

    Prot: That's a convention. That's a convention, yes.

    Sacha: I should try that. I've just been basically naming things as function-name. And then I was, like, maybe I should be calling them function-name-test. Or in this case, you know, package.

    Prot: Just to add something to this, because you also named this, so the nameless user. So there is built into Emacs this thing called shorthands.

  • 57:14: shorthands: Sacha: Yeah, I read about that, but you did mention that some people have been going back and forth about whether it's worth using it or whether it confuses things more. I think just leaving the names as is and then just displaying it differently seems to be like an in-between step.

    Prot: So that's what shorthand does. The name is, for example, modus-themes-test. And shorthand, effectively, is a buffer local variable which takes the small prefix and maps it to the larger prefix. So modus-themes-test can be mtt, for example.

    Sacha: Okay. All right. So basically it's a more powerful nameless, more configurable, and it's built in. So I should check that out also.

    Prot: Yeah, you can check it. It's not configurable, like it doesn't give you too many options. But the point is that for this simple case, at least for the tests, I find it useful because I don't want to have like a railroad of a function name, right? So I just want to be looking at something that I can understand. And basically, the prefix of the test is just there for it to have a prefix. And then I know what the function I am testing is.

  • 58:27: Bisecting config in multiple files: Sacha: I had a quick question about the config. So you have, in addition to your modules, you also have… Your Emacs's configuration is also split up into multiple files. How do you bisect these things when you're tracking down the bug?
  • 58:46: "I don't write bugs.": Prot: I don't write bugs. No, no, no, of course, I'm kidding.

    Sacha: That's going to go in the quotes. Okay, I don't write bugs. I write a lot of bugs. That's going to go to the blog post. It's going to be very large. So you never have to use bug-hunter because you just don't write bugs in the first place. Bravo. Good for you.

    Prot: Why didn't people think about that? Now, of course, I'm kidding. So the way it works is that they are actually standalone packages. So there is a distinction, actually, in my configuration. So there are the modules, which is the configuration blocks, what would be done with. And then there are the libraries, which are actually packages, like I could just publish them right now. For example, for the mode line, there is prot-mode-line. That could be a package tomorrow, no problem. So if there is a bug there, I will go and deal with it the way I would deal with any package, like edebug, toggle-debug-on-error, whatever it is that I am doing. So there never is a scenario where the code is in all sorts of places, scattered across the file, and then, of course, it's very difficult to track it.

    Sacha: But for your config, if it's in multiple files and you need to bisect it… Bisecting can get you to this load-file over here, this require over here is where things break down, but then you have to… okay, I want to load everything above that point and then bisect into the thing, which is slightly more annoying.

    Prot: In practice, it's not difficult, because the way I

    Sacha: I don't know. How does that work?

    Prot: load my packages, so in the modules themselves. So I have this macro, which has a condition case in it. Of course, usePackage has the same, but with usePackage, you have to have everything as a package, whereas what I have here is even if it's not a package. So condition case, and basically if there is an error, it tells me where the error is, and then I can find it very easily. I have never had a scenario (of course I was joking, but actually I'm serious)… I've never had a scenario where I was confused as to what was happening. It was always very easy to find the error. If it's a bug… Yeah.

    Sacha: Errors are fairly straightforward because it complains about it, but when it runs but it just produces the wrong behavior eventually, then that's the annoying part that I've been using bug hunter for.

    Prot: The only scenario I think now that I had an issue like that was with the mode line, actually. Because with the mode line, if you give it like a wrong face or something, I don't remember, it will print like several messages for everything that changes on the mode line. So you will get like, well, invalid face, and there will be like, in square brackets, 100 times of this message. So That's the sort of thing that indeed is more tricky, but that was not because of my code. It was because of one small tweak that affects the mode line, and then it was about figuring out what the error is there, what's the bug there. But if you have the configuration split up in ways that are logical or thematic, if you want, whatever bug is always in one spot. It won't cut between files. So for example i have a module which is theme in the wider set but the theme also includes fonts. because fonts are, in Emacs terms, part of faces, themes deal with faces, that sort of thing. So whenever it's something related to appearance, I know that it's in the theme. It cannot be somewhere else because of how I have written it. Of course, depending on how you split things up, you will end up in a scenario where you have bugs that go across files. For example, a common one is where people will have, for example, evil mode, right? And then they will load everything, and then they will have a separate configuration module, which is for key bindings. And basically, that's a disaster, because whenever there is some problem, you don't know which key binding relates to which package, and you are always in a state that it's hard to predict. And basically, you have to do every key binding with eval after load, this package, this key binding kind of thing.

    Sacha: Oh, that's going to be fun. I do have a bunch of key bindings in my file, so I'll just have to see how that all gets organized.

    Prot: If you have them, organize them by package. Define them close to the context. Okay.

    Sacha: That's actually mostly what I've been doing, mostly because I think of it, I think of the key binding when I'm adding the package to my config, so it's right there. I just realized I could probably just copy the top of my config file with requires or whatever to a setup file, which bug-hunter can then load. So I can still probably use

    Prot: Okay, good.

    Sacha: bug-hunter with that. Anyway, thank you so much.

    Prot: Yeah, sure. I just wanted to ask the last thing. What is the kind of bug that you have encountered? What kind of bugs are we talking about here?

    Sacha: Recently, in my shifting of everything to the new system, I also happened to realize that I had updated my Emacs and then stuff wasn't highlighting in the mini buffer. I eventually found out that it was because I needed to upgrade certain packages. But in the meantime, I was like, what do you mean? Okay, emacs -Q, sometimes it's working, sometimes it's not working. Okay, let's start narrowing it down. And that was fun. The other thing that I recently had to bisect was: I was exporting my really large config after having split things up into different modules. One of the lines was causing it to go into like a debugging thing, but it would not tell me what it actually debugged. You know, the backtrace would just not happen. So then I actually had to narrow to region and then export the specific sections of my file until I narrowed it down to, okay, my defvar custom link needs fixing. So I do this kind of bisection a lot. Ideally, whenever I can, I like to be able to just write an assertion so that Emacs can do the work of narrowing down when this happens but sometimes it's just, you know, you gotta pick your range and then execute the thing and see what happens. So I'm always looking for tools because I write a lot of bugs. I'm sure by the time I see you again, it may be either next week or next next week, I will have more bugs to share and more things to learn from. But this is very helpful and I am looking forward to updating you once I get all of the stuff checked off my to-do list.

    Prot: Very good. Let me know how it goes.

    Sacha: Yeah, yeah, awesome. Thank you so much.

    Prot: And for the live streams, we see how it goes. Yeah. You will tell me. Yeah.

    Sacha: And it's okay to post this recording if you want to?

    Prot: Whatever you want. Whatever you want.

    Sacha: Awesome, all right, see you around.

    Prot: Take care, Sacha. Bye bye.

Ideas for next steps

Oh, do I ever have a lot of ideas to follow up on. =) But I'm making myself get used to writing them down so that I can post these notes instead of trying to squeeze in just one more tweak… Anyway, plenty to explore!

  • Add chapters to video
  • Edit transcript - rough
  • combine multiple captions
  • Post the video
  • Post notes
  • Schedule next session and open it up
  • Try Internet Archive
  • Combine transcripts and use speaker tags; style the output
  • [-] Redact part of the video
    • Write about compile-media updates
    • Get my GPU working for ffmpeg
    • Get my GPU working for whisperx
    • Select the coordinates from Emacs
  • Streaming and video
    • Write about two-speaker workflow
    • Make sure vtime link type works with this player
    • Figure out a workflow for adding intros or wrap-ups
    • Display YouTube chat in Emacs
    • Find a command-line way to send text to the YouTube chat
    • Extract part of a video as a clip
    • Make a global minor mode for doing things publicly
      • Change theme
      • Turn on line numbers
      • Turn on keycast
      • Change agenda files and inbox
      • Save narration
      • Consider consult previews, marginalia
    • Make a todo link type that creates the TODO item and publishes a link to it when finished
    • Make public-ish Org files
    • Send a URL to the stream as QR and text chat
    • Send text to the stream
    • Calculate timestamp offsets into a recording
    • Quickly log times and notes to current task and stream log
    • Make a nicer combined transcript PDF for review
  • Reorganize my configuration
    • Finish extracting the rest of my functions
    • Rename my- to sacha-
    • Write about my org-babel-post-tangle-hook
    • Try out substitute, especially with the replace-regexp-as-diff idea
    • Define function aliases
    • Try shorthands
    • Try defvar-keymap :prefix
    • Practise using docstrings to declare intent
    • Convert my custom link preview code
    • Replace C-z
  • Testing
    • Set up a Makefile snippet for tests
    • Settle into a naming convention for tests
    • Practise mocking up functions in order to test things that are more interactive
    • Make code coverage more habitual
  • Finish reading Prot's config and process my notes
  • Set up crdt just in case
  • Play with the idea of XP (experience points) as a reward for postponing a task and then picking it up again
  • Write about deleting windows vertically; consider beframe and shortcuts to arrange frames
  • Pop up and dismiss my notes
    • Make my notes contextual

Want to join us on Thu April 16 10:30 AM America/Toronto, 5:30 PM Europe/Athens? Check out the livestream we've penciled in for April 16 - come join us!

View Org source for this post

Extract PDF highlights into an Org file with Python

| org

I've been trying to find a good workflow for highlighting interesting parts of PDFs, and then getting that into my notes as images and text in Emacs. I think I've finally figured out something that works well for me that feels natural (marking things.

I wanted to read through Prot's Emacs configuration while the kiddo played with her friends at the playground. I saved the web page as a PDF and exported it to Noteful. The PDF has 481 pages. Lots to explore! It was a bit chilly, so I had my gloves on. I used a capacitative stylus in my left hand to scroll the document and an Apple Pencil in my right hand to highlight the parts I wanted to add to my config or explore further.

Back at my computer, I used pip install pymupdf to install the PyMuPDF library. I poked around the PDF in the Python shell to see what it had, and I noticed that the highlights were drawings with fill 0.5. So I wrote this Python script to extract the images and text near that rectangle:

import fitz
import pathlib
import sys
import os

BUFFER = 5

def extract_highlights(filename, output_dir):
    doc = fitz.open(filename)
    s = "* Excerpts\n"
    for page_num, page in enumerate(doc):
        page_width = page.rect.width
        page_text = ""
        for draw_num, d in enumerate(page.get_drawings()):
            if d['fill_opacity'] == 0.5:
               rect = d['rect']
               clip_rect = fitz.Rect(0, rect.y0 - BUFFER, page_width, rect.y1 + BUFFER)
               img = page.get_pixmap(clip=clip_rect)
               img_filename = "page-%03d-%d.png" % (page_num + 1, draw_num + 1)
               img.save(os.path.join(output_dir, img_filename))
               text = page.get_text(clip=clip_rect)
               page_text = (page_text
                            + "[[file:%s]]\n#+begin_quote\n[[pdf:%s::%d][p%d]]: %s\n#+end_quote\n\n"
                            % (img_filename,
                               os.path.join("..", filename),
                               page_num + 1,
                               page_num + 1, text))
        if page_text != "":
            s += "** Page %d\n%s" % (page_num + 1, page_text)
    pathlib.Path(os.path.join(output_dir, "index.org")).write_bytes(s.encode())

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print("Usage: list-highlights.py pdf-filename output-dir")
    else:
        extract_highlights(sys.argv[1], sys.argv[2])

After I opened the resulting index.org file, I used C-u C-u C-c C-x C-v (org-link-preview) to make the images appear inline throughout the whole buffer. There's a little extra text from the PDF extraction, but it's a great starting point for cleaning up or copying. The org-pdftools package lets me link to specific pages in PDFs, neat!

2026-04-02-08-14-23.png
Figure 1: Screenshot of Org Mode file with link previews

To set up org-pdftools, I used:

(use-package org-pdftools
  :hook (org-mode . org-pdftools-setup-link))

Here's my quick livestream about the script with a slightly older version that had an off-by-one bug in the page numbers and didn't have the fancy PDF links. =)

View Org source for this post

Thinking about Emacs coaching goals with Prot

| emacs, community

: Hooray for learning out loud! Prot has already posted his responses.

Following up on Emacs Carnival March 2026: Mistakes and learning to reach out: I want to get better at learning with other people's help, so I'm going to experiment with engaging Prot as an Emacs coach. Our first session is this week. Time to lay the groundwork!

If I meet with Prot twice a month for three months, that's a budget of €60 (~CAD 100), which is a reasonable size for an experiment especially since I still have the budget set aside from the Google Open Source Peer Bonus and lovely folks already donated to cover the costs for EmacsConf. When I schedule something with someone, the accountability makes it easier to get stuff done and out the door. For this, a real person is much better than AI because:

  • I get to take advantage of Prot's very large context window, and he knows stuff about the Emacs, the community, and me that I might not remember to mention
  • He can ask real questions and prod at things that are unclear or contradictory, unlike the confirmation bias of LLMs
  • He might point out things that wouldn't occur to me to ask about
  • It triggers my "I promised someone I'd do this" thing
  • I get to support an individual worth supporting rather than contributing to the concentration of wealth and information in for-profit entities

My motivations:

  • I want to make better use of my focused time during the rest of the schoolyear. For the next three months, my schedule will be fairly predictable and I'll have regular chunks of focused time. Over the past two months, I've averaged around 10 hours of Emacs-related stuff per week (including 1.5 hours or so for Emacs News). I'm currently thinking about language learning and speech input. EmacsConf is on the horizon and will probably ramp up after September, but I can also think ahead of workflow improvements or ways to collaborate with other people. I might put together an Emacs News Highlights presentation. Also, I'm always looking out for ways to build the community.

    Summer break during July and August will shake things up again, but I might be able to find some focused time early morning or evening. I'd like to be in a good position to make the most of those time fragments.

  • I want to improve my Emacs Lisp development workflow and learn more about libraries and techniques that might be useful. I'm beginning to have more time to sharpen the saw and I'm curious about all the cool stuff that I missed or skimmed over the past ten years. What are some useful setups for completion, debugging, navigation, etc.?
    • Current: I sporadically use the extra awesomeness in seq, pcase, lispy, erefactor, ert, buttercup, and undercover, but not consistently. I'd like to reduce the friction and make these habitual.
    • Areas of friction / improvement:
      • writing tests, especially for things that are more interactive
      • navigating code that might be scattered in literate config files or in Emacs Lisp files
      • forgetting to restart or to make sure all code is saved; running tests via Emacs batch mode will help, as will package-isolate and restart-emacs
  • I want to improve my workflows for writing, making videos, and streaming. If I get better at sharing what I'm working on, I might be able to connect with more people and bounce ideas around. Also, accountability might help me nudge this over the threshold. I probably still need to work in stops and starts, so I want to reduce the friction. I'm curious about other people's workflows for sharing. I like joining meetups, but I tend to share stuff only if no one else has anything planned, because I have my blog and my YouTube channel in case I want to share anything with a wider group of people. I just have to actually post things.
    • Current: ~1.5 Emacs posts a week aside from Emacs News, attending meetups, sporadically adding short video demos to posts

      Average number of Emacs-related posts that aren't Emacs News
      (let* ((start "2026-02-01")
             (end "2026-03-31")
             (posts (my-blog-posts
                     start end
                     (lambda (o)
                       (and (member "emacs" (alist-get 'categories o))
                            (not (member "emacs-news" (alist-get 'categories o)))))))
             (count (length posts)))
        (my-weekly-average count start end))
      
    • Goal: 2-3 non-News posts a week, one video a month, one stream or meetup a month; maybe also beyond looking at the numbers, it might be interesting to build more momentum around a topic, set up trails/navigation, cultivate more of a digital garden
    • Areas of friction / improvement:
      • Resisting "one more tweak"
      • Streaming: Still need to get the hang of talking to myself or having half-conversations with chat: can be worked around by scheduling a session with Prot and opening it to the public
      • Hiding private information or setting up a separate Emacs for demonstration
      • Harvesting videos/clips/notes afterwards
  • I want to move more of my configuration into files and libraries that other people can reuse, like sachac/learn-lang and sachac/speech-input. I can also separate the function definitions from the configuration in my code so that people can reuse the functions if they want.
    • Areas of friction / improvement
      • renaming things when I want to move them to a library
      • duplicating small functions (ex: simplify string)
      • figuring out how to make it possible for someone else to start using my stuff

Starting questions for Prot:

  • Meta: what are people finding useful for coaching and behaviour change, like learning new keyboard shortcuts or workflows?
  • Your literate config exports to individual .el files. I could probably do something similar to separate my functions from my personal config in order to make it easier for people to reuse parts of my config. Is it worth doing so? Do people tell you that they use those private Emacs Lisp files by loading them, or do they mostly rely on your published packages?
  • Does the division into multiple .el files work fine if you need to bisect your configuration?
  • Do you have some tweaks to make it easier to jump to function definitions considering a literate configuration?
  • What's your general process for migrating things from your config to a repository or package?

Could be fun. Let's experiment!

View Org source for this post

2026-03-30 Emacs news

| emacs, emacs-news

It's not too late to write about mistakes and misconceptions as part of the Emacs Carnival for March and not too early to think about the theme of "Newbies/Starter Kits" which Cena will be hosting for April. Who knows, maybe those ideas can become part of the newcomers presets. It could be fun to explore something like notes for Emacs beginners and see where you end up.

Also, I'm looking forward to seeing if these tips for reloading Emacs Lisp code can help me avoid little bugs from leftover code.

Enjoy!

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, Mastodon #emacs, Bluesky #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View Org source for this post

Emacs Carnival March 2026: Mistakes and learning to reach out

| community, emacs

Mostly-similar versions follow: I started with French, translated it to English, and then tweaked some details. Thanks to Philip Kaludercic for hosting this month's carnival!

In English

The theme for this month's Emacs Carnival is Mistakes and Misconceptions. It’s difficult to pinpoint one thing that is clearly a mistake, but there are certainly things I could do more effectively.

My configuration is very large because I assume my little modifications are only useful to me. They feel too specific, too idiosyncratic. I think people who create libraries or even packages used by lots of other people are awesome. I don't know if I could quite do that myself, though! Even submitting patches upstream and participating in the ensuing discussions sometimes requires more persistence than I have.

The advantage of keeping my changes in my config is that even if I'm unsure, I can try something out, develop a rough prototype, and change my mind if necessary. When I publish them in a library or a package, I feel like I have to polish my ideas. It's hard to stick to just one idea long enough to refine it.

My favorite situation is when I write about my attempt in a post, and it inspires someone else to implement their own version (or even a new library or package). On the other hand, if I learn to share my code, I can help more people, and I can also learn from more people and more conversations.

Many of my modifications are short and easy to copy from my posts, but there are a few collections that depend on other functions, making them difficult to copy. These functions are scattered across several posts on my blog. For example, my functions for learning a language (I'm learning French at the moment) and for controlling Emacs by voice are becoming quite complex. The functions are also exported to my configuration, but the Emacs Lisp file is difficult to navigate if someone wants to copy them. I can extract the code into a file now that Org Mode can tangle to multiple files, but if I spend a little time replacing the "my-" prefix with a library prefix and move them to a repository, people could clone it and download updates. Even if no one uses it, the act of polishing and documenting it will probably be useful to me one day.

So, it's possible that this is a mistake I often make in Emacs: thinking my functions are too idiosyncratic and too rough, so I leave them in my config. If I dedicate time to extracting the code into a library, I might benefit in the long run. I know lots of people are interested in using Emacs for language learning or by voice. There have been so many other libraries and workflows over the years, so I'm sure people are out there. I want to practice learning more with others. To start, I can make sure interested people can follow my progress through RSS feeds or Mastodon, I can respond when people send me messages, and I can collect contact info and send them a message when I post about the subject.

I can write more if I reread the changes in my configuration each week, or if I reread my complete configuration for sections which I haven't yet written about. If I participate in virtual meetups or even livestream, I can find out what interests other people. If I submit patches and create tasks in my Org Mode inbox to track the discussions, I can practice refining my work.

Prot has lowered his coaching prices to €10 /hour. He's quite prolific when it comes to package development, so he can probably help me figure out how to get stuff out of my config and into a form that other people might be able to use. I've been enjoying learning with my French tutor. It might be worth experimenting with spending some money and time to improve my Emacs skills as well. Sure, it's totally just for fun, but I think it's valuable to practice learning with the help of others instead of stumbling around on my own.

There's always more to learn, which is wonderful. So this is not really a mistake, just something that could be good to work on. Onward and upward!

Check out Emacs Carnival March 2026: Mistakes and Misconceptions to see other people's takes on the topic.

En français

Le thème du Carnaval d'Emacs ce mois-ci est « les erreurs et les idées reçues ». C'est difficile d'identifier une chose qui soit clairement une erreur, mais il y a certainement des choses que je ne fais pas efficacement.

Ma configuration est très volumineuse car je pense que mes petites modifications ne sont utiles que pour moi. Elles sont trop spécifiques, trop particulières. J'apprécie ceux qui créent des bibliothèques ou même des paquets que beaucoup d'autres utilisent, mais de mon côté, je ne me sens pas capable de le faire pour l'instant. Même soumettre des correctifs en amont et participer à la discussion qui s'ensuit parfois demande plus de persévérance que je n'en ai.

L'avantage de garder mes modifications dans ma configuration est que, même si je ne suis pas sûre, je peux essayer quelque chose, développer un prototype préliminaire, et changer d'avis si nécessaire. Quand je les publie dans une bibliothèque ou un paquet, j'ai l'impression que je dois peaufiner mes idées. C'est difficile de s'en tenir à une seule idée assez longtemps.

Ma situation préférée est quand je partage mes essais sur mon blog, et qu'ils inspirent une autre personne qui implémentera sa propre version, voire une nouvelle bibliothèque ou un nouveau paquet.

En revanche, si j'apprends à partager mon code, je peux aider plus de personnes, et je peux aussi apprendre de plus de personnes et de plus de conversations.

Beaucoup de mes modifications sont brèves et faciles à copier de mes articles, mais il y a quelques collections qui dépendent d'autres fonctions, ce qui les rend difficiles à copier. Les fonctions sont dispersées dans plusieurs articles sur mon blog. Par exemple, mes fonctions pour apprendre une langue (particulièrement le français) et pour contrôler Emacs par commande vocale deviennent plutôt complexes. Elles sont aussi exportées vers ma configuration, mais le fichier Emacs Lisp est difficile à parcourir si on veut les copier. Je peux extraire le code dans un fichier maintenant que Org Mode peut le tangler vers plusieurs fichiers, mais si je consacre un peu de temps à remplacer le préfixe « my- » par celui de la bibliothèque et à le pousser sur le dépôt, les gens pourraient le cloner et récupérer les mises à jour. Même si personne ne l'utilise, le fait de les peaufiner et de le documenter me sera utile un jour.

Donc il est possible que ce soit une erreur que je commets souvent dans Emacs : je pense que mes fonctions sont trop idiosyncratiques et trop brutes, je les laisse donc dans ma configuration. Mais si je consacre du temps à extraire le code vers une bibliothèque, j'en bénéficierai peut-être à long terme. Je sais que beaucoup de gens sont intéressés par l'utilisation d'Emacs pour apprendre une langue ou pour la commande vocale. Il y a eu de nombreuses autres bibliothèques et flux de travail au fil des ans, donc je suis sûre qu'il y a du monde. Je veux m'entraîner à apprendre auprès de plus de personnes. Pour commencer, je peux m'assurer que les gens intéressés peuvent suivre mon progrès via les flux RSS ou sur Mastodon, je peux répondre quand on m'envoie des messages, et je peux recueillir les coordonnées et leur envoyer un message lorsque je publie un article à ce sujet.

Je peux écrire davantage si je relis les modifications dans ma configuration chaque semaine, ou si je relis ma configuration entière pour les sections dont je n'ai pas encore parlé. Si je participe à des réunions virtuelles ou même si je diffuse en direct, je vais voir ce qui intéresse les autres. Si je soumets des correctifs et crée des tâches dans ma boîte de réception Org Mode pour suivre les discussions, je m'entraîne à affiner mon travail.

Prot a baissé ses tarifs de coaching à 10 euros de l'heure. Il est très prolifique en matière de développement de paquets. J'apprends bien avec mon tuteur en français, donc cela vaut peut-être la peine de consacrer de l'argent et du temps à améliorer mes compétences sur Emacs. Certes, c'est juste pour le plaisir, mais c'est aussi important pour moi de m'entraîner à apprendre avec l'aide des autres au lieu de trébucher toute seule.

J'ai toujours plus de choses à apprendre, ce qui est merveilleux. Ce n'est pas vraiment une erreur, mais plutôt un point à améliorer. En avant !

Consultez Emacs Carnival March 2026: Mistakes and Misconceptions pour d'autres perspectives sur le sujet.

View Org source for this post

Categorizing Emacs News items by voice in Org Mode

| speech, speech-recognition, emacs, org

I'm having fun exploring which things might actually be easier to do by voice than by typing. For example, after I wrote some code to expand yasnippets by voice, I realized that it was easier to:

  1. press my shortcut,
  2. say "okay, define interactive function",
  3. and then press my shortcut again,

than to:

  1. mentally say it,
  2. get the first initials,
  3. type in "dfi",
  4. and press Tab to expand.

Another area where I do this kind of mental translation for keyboard shortcuts is when I categorize dozens of Emacs-related links each week for Emacs News. I used to do this by hand. Then I wrote a function to try to guess the category based on regular expressions (my-emacs-news-guess-category in emacs-news/index.org, which is large). Then I set up a menu that lets me press numbers corresponding to the most frequent categories and use tab completion for the rest. 1 is Emacs Lisp, 2 is Emacs development, 3 is Emacs configuration, 4 is appearance, 5 is navigation, and so on. It's not very efficient, but some of it has at least gotten into muscle memory, which is also part of why it's hard to change the mapping. I don't come across that many links for Emacs development or Spacemacs, and I could probably change them to something else, but… Anyway.

2026-03-23_20-38-33.png
Figure 1: Screenshot of my menu for categorizing links

I wanted to see if I could categorize links by voice instead. I might not always be able to count on being able to type a lot, and it's always fun to experiment with other modes of input. Here's a demonstration showing how Emacs can automatically open the URLs, wait for voice input, and categorize the links using a reasonably close match. The *Messages* buffer displays the recognized output to help with debugging.

Screencast with audio: categorizing links by voice

This is how it works:

  1. It starts an ffmpeg recording process.
  2. It starts Silero voice activity detection.
  3. When it detects that speech has ended, it use curl to send the WAV to an OpenAI-compatible server (in my case, Speaches with the Systran/faster-whisper-base.en model) for transcription, along with a prompt to try to influence the recognition.
  4. It compares the result with the candidates using string-distance for an approximate match. It calls the code to move the current item to the right category, creating the category if needed.

Since this doesn't always result in the right match, I added an Undo command. I also have a Delete command for removing the current item, Scroll Up and Scroll Down, and a way to quit.

Initial thoughts

I used it to categorize lots of links in this week's Emacs News, and I think it's promising. I loved the way my hands didn't have to hover over the number keys or move between those and the characters. Using voice activity detection meant that I could just keep dictating categories instead of pressing keyboard shortcuts or using the foot pedal I recently dusted off. There's a slight delay, of course, but I think it's worth it. If this settles down and becomes a solid part of my workflow, I might even be able to knit or hand-sew while doing this step, or simply do some stretching exercises.

What about using streaming speech recognition? I've written some code to use streaming speech recognition, but the performance wasn't good enough when I tried it on my laptop (Lenovo P52 released in 2018, no configured GPU under Linux). The streaming server dropped audio segments in order to try to catch up. I'd rather have everything transcribed at the level of the model I want, even if I have to wait a little while. I also tried using the Web Speech API in Google Chrome for real-time speech transcription, but it's a little finicky. I'm happy with the performance I get from either manually queueing speech segments or using VAD and then using batch speech recognition with a model that's kept in memory (which is why I use a local server instead of a command-line tool). Come to think of it, I should try this with a higher-quality model like medium or large, just in case the latency turns out to be not that much more for this use case.

What about external voice control systems like Talon Voice or Cursorless? They seem like neat ideas and lots of people use them. I think hacking something into Emacs with full access to its internals could be lots of fun too.

A lot of people have experimented with voice input for Emacs over the years. It could be fun to pick up ideas for commands and grammars. Some examples:

What about automating myself out of this loop? I've considered training a classifier or sending the list to a large language model to categorize links in order to set more reasonable defaults, but I think I'd still want manual control, since the fun is in getting a sense of all the cool things that people are tinkering around with in the Emacs community. I found that with voice control, it was easier for me to say the category than to look for the category it suggested and then say "Okay" to accept the default. If I display the suggested category in a buffer with very large text (and possibly category-specific background colours), then I can quickly glance at it or use my peripheral vision. But yeah, it's probably easier to look at a page and say "Org Mode" than to look at the page, look at the default text, see if it matches Org Mode, and then say okay if it is.

Ideas for next steps

I wonder how to line up several categories. I could probably rattle off a few without waiting for the next one to load, and just pause when I'm not sure. Maybe while there's a reasonably good match within the first 1-3 words, I'll take candidates from the front of the queue. Or I could delimit it with another easily-recognized word, like "next".

I want to make a more synchronous version of this idea so that I can have a speech-enabled drop-in replacement that I can use as my y-or-n-p while still being able to type y or n. This probably involves using sit-for and polling to see if it's done. And then I can use that to play Twenty Questions, but also to do more serious stuff. It would also be nice to have replacements for read-string and completing-read, since those block Emacs until the user enters something.

I might take a side-trip into a conversational interface for M-x doctor and M-x dunnet, because why not. Naturally, it also makes sense to voice-enable agent-shell and gptel interactions.

I'd like to figure out a number- or word-based completion mechanism so that I can control Reddit link replacement as well, since I want to select from a list of links from the page. Maybe something similar to the way voicemacs adds numbers to helm and company or how flexi-choose.el works.

I'm also thinking about how I can shift seamlessly between typing and speaking, like when I want to edit a link title. Maybe I can check if I'm in the minibuffer and what kind of minibuffer I'm in, perhaps like the way Embark does.

It would be really cool to define speech commands by reusing the keymap structure that menus also use. This is how to define a menu in Emacs Lisp:

(easy-menu-define words-menu global-map
  "Menu for word navigation commands."
  '("Words"
     ["Forward word" forward-word]
     ["Backward word" backward-word]))

and this is how to set just one binding:

(keymap-set-after my-menu "<drink>"
  '("Drink" . drink-command) 'eat)

That makes sense to reuse for speech commands. I'd also like to be able to specify aliases while hiding them or collapsing them for a "What can I say" help view… Also, if keymaps work, then maybe minor modes or transient maps could work? This sort of feels like it should be the voice equivalent of a transient map.

The code so far

(defun my-emacs-news-categorize-with-voice (&optional skip-browse)
  (interactive (list current-prefix-arg))
  (unless skip-browse
    (my-spookfox-browse))
  (speech-input-cancel-recording)
  (let ((default (if (fboundp 'my-emacs-news-guess-category) (my-emacs-news-guess-category))))
    (speech-input-from-list
     (if default
         (format "Category (%s): " default)
       "Category: ")
     '(("Org Mode" "Org" "Org Mode")
       "Other"
       "Emacs Lisp"
       "Coding"
       ("Emacs configuration" "Config" "Configuration")
       ("Appearance" "Appearance")
       ("Default" "Okay" "Default")
       "Community"
       "AI"
       "Writing"
       ("Reddit" "Read it" "Reddit")
       "Shells"
       "Navigation"
       "Fun"
       ("Dired" "Directory" "Dir ed")
       ("Mail, news, and chat" "News" "Mail" "Chat")
       "Multimedia"
       "Scroll down"
       "Scroll up"
       "Web"
       "Delete"
       "Skip"
       "Undo"
       ("Quit" "Quit" "Cancel" "All done"))
     (lambda (result text)
       (message "Recognized %s original %s" result text)
       (pcase result
         ("Undo"
          (undo)
          (my-emacs-news-categorize-with-voice t))
         ("Skip"
          (forward-line)
          (my-emacs-news-categorize-with-voice))
         ("Quit"
          (message "All done.")
          (speech-input-cancel-recording))
         ("Reddit"
          (my-emacs-news-replace-reddit-link)
          (my-emacs-news-categorize-with-voice t))
         ("Scroll down"
          (my-spookfox-scroll-down)
          (my-emacs-news-categorize-with-voice t))
         ("Scroll up"
          (my-spookfox-scroll-up)
          (my-emacs-news-categorize-with-voice t))
         ("Delete"
          (delete-line)
          (undo-boundary)
          (my-emacs-news-categorize-with-voice))
         ("Default"
          (my-org-move-current-item-to-category
           (concat default ":"))
          (undo-boundary)
          (my-emacs-news-categorize-with-voice))
         (_
          (my-org-move-current-item-to-category
           (concat result ":"))
          (undo-boundary)
          (my-emacs-news-categorize-with-voice))))
     t)))

It uses Spookfox to control Firefox from Emacs:

(defun my-spookfox-scroll-down ()
  (interactive)
  (spookfox-js-injection-eval-in-active-tab "window.scrollBy(0, document.documentElement.clientHeight);" t))

(defun my-spookfox-scroll-up ()
  (interactive)
  (spookfox-js-injection-eval-in-active-tab "window.scrollBy(0, -document.documentElement.clientHeight);"))

(defun my-spookfox-background-tab (url &rest args)
  "Open URL as a background tab."
  (if spookfox--connected-clients
      (spookfox-tabs--request (cl-first spookfox--connected-clients) "OPEN_TAB" `(:url ,url))
    (browse-url url)))

It also uses these functions for categorizing Org Mode items:

(defun my-org-move-current-item-to-category (category)
    "Move current list item under CATEGORY earlier in the list.
  CATEGORY can be a string or a list of the form (text indent regexp).
  Point should be on the next line to process, even if a new category
  has been inserted."
    (interactive (list (completing-read "Category: " (my-org-get-list-categories))))
    (when category
      (let* ((col (current-column))
             (item (point-at-bol))
             (struct (org-list-struct))
             (category-text (if (stringp category) category (elt category 0)))
             (category-indent (if (stringp category) 2 (+ 2 (elt category 1))))
             (category-regexp (if (stringp category) category (elt category 2)))
             (end (elt (car (last struct)) 6))
             (pos (point))
             s)
        (setq s (org-remove-indentation (buffer-substring-no-properties item (org-list-get-item-end item struct))))
        (save-excursion
          (if (string= category-text "x")
              (org-list-send-item item 'delete struct)
            (goto-char (caar struct))
            (if (re-search-forward (concat "^ *- +" category-regexp) end t)
                (progn
                  ;; needs a patch to ol.el to check if stringp
                  (org-list-send-item item (point-at-bol) struct)
                  (org-move-item-down)
                  (org-indent-item))
              (goto-char end)
              (org-list-insert-item
               (point-at-bol)
               struct (org-list-prevs-alist struct))
              (let ((old-struct (copy-tree struct)))
                (org-list-set-ind (point-at-bol) struct 0)
                (org-list-struct-fix-bul struct (org-list-prevs-alist struct))
                (org-list-struct-apply-struct struct old-struct))
              (goto-char (point-at-eol))
              (insert category-text)
              (org-list-send-item item 'end struct)
              (org-indent-item)
              (org-indent-item))
            (recenter))))))

(defun my-org-guess-list-category (&optional categories)
  (interactive)
  (require 'cl-lib)
  (unless categories
    (setq categories
          (my-helm-org-list-categories-init-candidates)))
  (let* ((beg (line-beginning-position))
         (end (line-end-position))
         (string (buffer-substring-no-properties beg end))
         (found
          (cl-member string
                     categories
                     :test
                     (lambda (string cat-entry)
                       (unless (string= (car cat-entry) "x")
                         (string-match (regexp-quote (downcase (car cat-entry)))
                                       string))))))
    (when (car found)
      (my-org-move-current-item-to-category
       (cdr (car found)))
      t)))

For the speech-input functions, experimental code is at https://codeberg.org/sachac/speech-input .

View Org source for this post

2026-03-23 Emacs news

| emacs, emacs-news

: Removed elecxzy comment-dwim, whoops.

Might be a good opportunity to set up better auto-saves, with buffer-guardian.el inspiring an update to super-save 0.5. Also, there were a couple of interesting experiments embedding Chromium (Reddit) or native macOS views in Emacs (Reddit), and one about embedding Emacs in a webpage (Reddit).

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, Mastodon #emacs, Bluesky #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View Org source for this post