hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.2K
active users

#eMacs

168 posts146 participants38 posts today
Adam Sjøgren's blog <p><strong>Saving and restoring an Emacs macro</strong></p> <p>From time to time I add domains to a configuration file, <code>header_checks</code>, for my mail server, <a href="https://www.postfix.org/" rel="nofollow noopener noreferrer" target="_blank">Postfix</a>, to block them as spam.</p> <p>To do this, I copy the email-address from a spam email, paste it into the configuration file, and modify it to escape the <code>.</code> and remove up until the <code>@</code>.</p> <p>Doing that for a lot of spam is of course tedious, and so I usually create a macro in Emacs to do the pasting and massaging.</p> <p>However, creating that macro is a bit tedious and that makes me not do it for the first couple of spams. Until I get too annoyed. So it keeps me from updating the checks. Not great.</p> <p>Emacs is capable of generating the lisp code corresponding to a macro, so I thought "Hah, I will save the macro in a comment in the file, then I can evaluate it when I'm updating the file, and I don't have to record the macro every time!"</p> <p>Alas, the command <code>M-x insert-kdb-macro RET</code> inserted some code that gave an error when evaluated - how odd?!</p> <p>At first I assumed I was doing something wrong - the documentation only mentions saving a named macro and I was saving the last, unnamed one - but after looking at <a href="https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/macros.el#n69" rel="nofollow noopener noreferrer" target="_blank">the lisp code of the function</a> <code>insert-kbd-macro</code> (Emacs makes this easy), it was clear to me that it was supposed to work: it contains specific code to handle the last macro case.</p> <p>I also tried an earlier version of Emacs (I usually run a development version), the one in Debian stable - version 28.2, and there the code generated was different, and, even more interestingly, worked!</p> <p>So, I created a bug report for Emacs (<a href="https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77317" rel="nofollow noopener noreferrer" target="_blank">#77317</a>) and was swiftly told by one of the current Emacs maintainers that the documentation only says it works for named macros.</p> <p>I argued that the function specifically has a branch for the last (and unnamed) keyboard macro, and that the functionality was broken in 2022, and Cc'ed the previous Emacs maintainer who made the breaking change (which was an improvement to the other branch of the function).</p> <p>He asked for an explanation of my use case, and after I supplied that, he made a change to fix the problem, which I tested swiftly; it worked, and <a href="https://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/macros.el?id=10eb57169da01f3f96a5954aa42673d10086824f" rel="nofollow noopener noreferrer" target="_blank">pushed it to</a> <a href="https://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/macros.el?id=513a05dd8761aebc14ffe4ee0a8a6e96feb10531" rel="nofollow noopener noreferrer" target="_blank">the development version of Emacs</a> a couple of days later.</p> <p>Nice!</p> <p>So, now I could easily generate the code to restore the macro and put it in a comment in the file.</p> <p>Shortly after it hit me: Emacs can evaluate code from a file when loading it, I could have it restore the macro automatically on opening the file!</p> <p>A quick 3 lines at the bottom of the file later:</p> <pre><code># Local Variables: # eval: (setq last-kbd-macro (kmacro--keys (kmacro "| C-y M-&lt;left&gt; &lt;left&gt; [ &lt;right&gt; ] C-r @ &lt;right&gt; M-&lt;backspace&gt; C-s ) &lt;left&gt;"))) # End: </code></pre><p>and now, more than ever, Bob is indeed my uncle!</p>
Philip Kaludercic<p>Neat and related: When writing HTML with some math, I don't really want to write MathML by hand (let alone depend on MathJax or something like that). LaTeXML turns out to be helpful again, specifically via the <a href="https://metacpan.org/dist/LaTeXML/view/bin/latexmlmath" rel="nofollow noopener noreferrer" target="_blank">latexmlmath</a> (which btw. can be used above as well, and <em>is</em> faster). Either way, I have quickly hacked together a function that uses <code>latexmlmath</code> to convert TeX-math in a comment into MathML:</p><pre><code>(defun mathml-from-tex () "Convert TeX in a comment to MathML in a buffer. The TeX has to be written in a single-line comment prefixed with a \"MathML:\" string. For example: &lt;!-- MathML: \frac{-b \\pm \\sqrt{b^2 -4ac}}{2a} --&gt; Everything until the end of the comment (or line) is passed to \"latexmlmath\" (part of the LaTeXML suite) and injected into the next line of the buffer. A comment indicating the end of the math block is also added, so that multiple invocations of the command can replace the old output." (interactive) (save-excursion (goto-char (line-beginning-position)) (unless (search-forward-regexp (rx (literal comment-start) (* space) "MathML: " (group (* nonl)) (literal comment-end)) (line-end-position) t) (user-error "No instruction found")) (if (eobp) (insert "\n") (forward-line 1)) (let ((end "EndOfMathML") ;TODO: use &lt;/math&gt; (math (match-string 1)) (start (point))) (when (search-forward-regexp (rx (literal end)) nil t) (delete-region start (line-end-position))) (save-excursion (insert end) (save-excursion (insert (if (eolp) "" "\n"))) (comment-line 1)) (call-process-region math nil "latexmlmath" nil t t "-")))) </code></pre><p>I also attach a quick demo, see below.</p><p><a href="https://commenting.onthe.incoherenceofthe.net/tags/emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>emacs</span></a> <a href="https://commenting.onthe.incoherenceofthe.net/tags/latex" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>latex</span></a> <a href="https://commenting.onthe.incoherenceofthe.net/tags/mathml" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mathml</span></a></p>
pavodive<p><strong>Spiral: a trainer package to learn elisp</strong></p> <p><a href="https://lemmy.ml/post/28768444" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">lemmy.ml/post/28768444</span><span class="invisible"></span></a></p>
Stewart V. Wright<p><span class="h-card" translate="no"><a href="https://mastodon.social/@ringtailringo" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>ringtailringo</span></a></span></p><p>This is how I keep my <a href="https://fosstodon.org/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> and <a href="https://fosstodon.org/tags/OrgzlyRevived" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OrgzlyRevived</span></a> on Android consistent for <a href="https://fosstodon.org/tags/GTD" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GTD</span></a> (and other things)</p>
takeonrules<p>“Automating Adding Books to My Org-Mode Document”</p><p>This post describes an <a href="https://dice.camp/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> workflow I designed and developed around scanning books into my book-tracking <a href="https://dice.camp/tags/OrgMode" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OrgMode</span></a> document. It has, what I consider, a not-often-detailed use of `org-capture`.</p><p><a href="https://takeonrules.com/2025/04/17/automating-adding-books-to-my-org-mode-document/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">takeonrules.com/2025/04/17/aut</span><span class="invisible">omating-adding-books-to-my-org-mode-document/</span></a></p>
Craig Brozefsky<p>Spent the last couple days learning <a href="https://infosec.exchange/tags/HelixEditor" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HelixEditor</span></a> as a contrast to my <a href="https://infosec.exchange/tags/emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>emacs</span></a> maximalist tendencies.</p><p>I managed to crash it once so far, with an out of bound Rope slice, but otherwise I am impressed with how much I can do with it even without plug-ins or a scripting language.</p><p>I especially like the match mode and the tree-sitter based movement.</p>
Omar Antolín<p><span class="h-card" translate="no"><a href="https://mastodon.social/@amszmidt" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>amszmidt</span></a></span> Really? You think the claim that the vast majority of Mastodon posts with the hastag <a href="https://mathstodon.xyz/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> are about GNU Emacs is "absolute nonsense"? You and I must not be seeing the same posts! :D That's exciting to me because I am curious to read more about non-Gnu Emacsen.</p>
Alfred M. Szmidt<p><span class="h-card" translate="no"><a href="https://mathstodon.xyz/@oantolin" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>oantolin</span></a></span> Is GNUS part of Emacs (the text editor) or part of <a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a>? Magit? Eww? Calc? </p><p>None of these are part of Emacs. They are separate programs, useful but separate.</p>
Alfred M. Szmidt<p><span class="h-card" translate="no"><a href="https://mathstodon.xyz/@oantolin" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>oantolin</span></a></span> <a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> implements Emacs, but also implements more (and less). Sometimes it goes against the idea of Emacs,</p>
Omar Antolín<p><span class="h-card" translate="no"><a href="https://mastodon.social/@amszmidt" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>amszmidt</span></a></span> Also you should probably take into account that empirically speaking the hastag <a href="https://mathstodon.xyz/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> on Mastodon means GNU Emacs specifically (at least the vast, vast majority of the time).</p>
Alfred M. Szmidt<p><span class="h-card" translate="no"><a href="https://mathstodon.xyz/@oantolin" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>oantolin</span></a></span> Not all Emacs behaved that way, specifically TECO Emacs and LispM Emacs (ZWEI). Emacs is an extensible text editor, not a Lisp environment. This is not to be confused with <a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a>, which is more.</p>
Alfred M. Szmidt<p><span class="h-card" translate="no"><a href="https://mathstodon.xyz/@oantolin" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>oantolin</span></a></span> Emacs predates Lisp Machines. Emacs is an editor, nothing more or less. It is not a Lisp environment, or a Lisp implementation. </p><p>And yes, it is about Lisp, an extensible language. Emacs is special, but it is for other reasons. </p><p><a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> is a far shot from <a href="https://mastodon.social/tags/LispM" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LispM</span></a> <a href="https://mastodon.social/tags/LispMachine" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LispMachine</span></a>, and ZWEI is a far shot from <a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a>.</p>
Alfred M. Szmidt<p><a href="https://mastodon.social/tags/GNU" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GNU</span></a> <a href="https://mastodon.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> is not a <a href="https://mastodon.social/tags/LispMachine" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LispMachine</span></a> <a href="https://mastodon.social/tags/LispM" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LispM</span></a>. If you think that .. you're lost your editor.</p>
Charles Choi 최 민수<p>TIL you can compose a mail message in Emacs and have your external mail program send it .</p><p>(setopt send-mail-function 'mailclient-send-it)</p><p><a href="https://sfba.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a></p>
Ringtail Ringo<p>I *want* to love and use <a href="https://mastodon.social/tags/emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>emacs</span></a> <a href="https://mastodon.social/tags/Orgmode" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Orgmode</span></a> for GTD and I have a working setup and workflow, but sync is still problematic. Most likely iCloud’s fault - it syncs based on moon phase - but if I do not check I may end up with wiped project/tasks because sync on mac1 never happened, changes on mac2 with later timestamp were backsynced to mac1. Every time I face it, I switch back to Omnifocus, because who needs this stress. :/ Sync is hard, I don’t think it can be solved without some kind of DB.</p>
James Endres Howell<p><span class="h-card" translate="no"><a href="https://mathstodon.xyz/@oantolin" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>oantolin</span></a></span> There's tools and then there's tools. Before I got confident in <a href="https://fosstodon.org/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a> <a href="https://fosstodon.org/tags/Lisp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Lisp</span></a> I used to use (may god forgive me) Excel to do stuff like this.</p><p>Which was, I hope we can agree, unambiguously better than not being able to automate those processes. But not ideal.</p><p>We have lost so much in thirty or forty years, worst of all the autonomy to automate.</p><p>"But it feels like something from the seventies!" Yes, correct, that is exactly how it feels. Like something I can understand, control, and USE</p>
Charles Choi 최 민수<p>My hot take on `use-package`: I stopped giving guidance on using it to setup Casual because it was too difficult for me to know what the “right” solution should be. Every competing opinion on how to use it was functional.</p><p><a href="https://sfba.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a></p>
Jack Baty<p>I like doing as much as I reasonably can within <a href="https://social.lol/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a>, but I don't buy the argument that this reduces "context switching" in any meaningful way. If I'm going to go from writing code to reading email, it's context switching whether I'm in the same app or not.</p>
Alex<p>This is for the <a href="https://hachyderm.io/tags/Emacs" class="mention hashtag" rel="tag">#<span>Emacs</span></a> experts:</p><p>I have `use-package-always-ensure` set to t.</p><p>Today I added a new (use-package).<br />The new package is not installed though.</p><p>Any ideas why it is not? <br />I was under the impression that adding the use-package would be enough. What am I misunderstanding?</p><p>\(^-^)/</p>
Charles Choi 최 민수<p>Second call out for folks to beta test my app Scrim (pre-release). If you use Emacs on macOS and want a way to share web links and clippings to it, please consider trying this out. More details at the link attached. <a href="http://yummymelon.com/devnull/making-an-app-looking-for-beta-testers.html" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">http://</span><span class="ellipsis">yummymelon.com/devnull/making-</span><span class="invisible">an-app-looking-for-beta-testers.html</span></a></p><p><a href="https://sfba.social/tags/Emacs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Emacs</span></a></p>