<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Emacs on The Lone C++ Coder's Blog</title><link>https://www.lonecpluspluscoder.com/categories/emacs/</link><description>Recent content in Emacs on The Lone C++ Coder's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sun, 05 Nov 2023 11:03:00 -0500</lastBuildDate><atom:link href="https://www.lonecpluspluscoder.com/categories/emacs/index.xml" rel="self" type="application/rss+xml"/><item><title>Don't forget to set the home directory for Emacs on Windows</title><link>https://www.lonecpluspluscoder.com/2023/11/05/install-set-emacs-homedir-windows/</link><pubDate>Sun, 05 Nov 2023 11:03:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2023/11/05/install-set-emacs-homedir-windows/</guid><description>&lt;p>I&amp;rsquo;m currently rebuilding my main Windows machine after it had become close to unusable. Given that I upgraded it multiple times from Windows 7 all the way to Windows 11 without ever reinstalling the OS, this shouldn&amp;rsquo;t have come as a major surprise. Either way, this is the reason for the sudden outburst of Windows related posts so I can go and refer to my blog as my Internet Notes repository.&lt;/p></description></item><item><title>How to build/upgrade emacs-mac using homebrew</title><link>https://www.lonecpluspluscoder.com/2022/10/22/homebrew-emacs-mac-cask-from-source/</link><pubDate>Sat, 22 Oct 2022 15:10:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2022/10/22/homebrew-emacs-mac-cask-from-source/</guid><description>&lt;p>In the time honored tradition of using one&amp;rsquo;s blog as an Internet-enabled notepad, here&amp;rsquo;s a quick not on how I build GNU Emacs on macOS using homebrew and the emacs-mac port cask:&lt;/p>
&lt;p>&lt;code>brew upgrade -s railwaycat/emacsmacport/emacs-mac --with-mac-metal --with-imagemagick --with-native-comp --with-modern-icon --with-natural-title-bar&lt;/code>&lt;/p>
&lt;p>This - amongst other features - turns on some experimental macOS-relevant features and most importantly, the optional native compilation of Elisp code.&lt;/p></description></item><item><title>How can I pin dependent packages when using use-package?</title><link>https://www.lonecpluspluscoder.com/2022/02/20/can-i-pin-dependent-packages-use-package/</link><pubDate>Sun, 20 Feb 2022 21:15:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2022/02/20/can-i-pin-dependent-packages-use-package/</guid><description>&lt;p>I&amp;rsquo;ve been trying to up my &lt;code>use-package&lt;/code> game recently and converted my hand rolled package check and installer to &lt;code>use-package&lt;/code>. I usually prefer to use packages from &lt;code>melpa-stable&lt;/code> so I pin the default package source used by &lt;code>use-package&lt;/code> to &lt;code>melpa-stable&lt;/code> and override it where necessary That&amp;rsquo;s working well in general and looks something like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#366">setq&lt;/span> &lt;span style="color:#033">use-package-always-pin&lt;/span> &lt;span style="color:#c30">&amp;#34;melpa-stable&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#366">use-package&lt;/span> &lt;span style="color:#033">js2-mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#366">:ensure&lt;/span> &lt;span style="color:#360">t&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#366">:defer&lt;/span> &lt;span style="color:#360">t&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#366">:custom&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#366">progn&lt;/span> (&lt;span style="color:#033">js-indent-level&lt;/span> &lt;span style="color:#f60">2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#033">js2-include-node-externs&lt;/span> &lt;span style="color:#360">t&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#366">use-package&lt;/span> &lt;span style="color:#033">kotlin-mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#366">:ensure&lt;/span> &lt;span style="color:#360">t&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#366">:pin&lt;/span> &lt;span style="color:#033">melpa&lt;/span>)&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>So in other words, if I&amp;rsquo;m on a machine that doesn&amp;rsquo;t have &lt;code>js2-mode&lt;/code> and &lt;code>kotlin-mode&lt;/code> installed, &lt;code>use-package&lt;/code> will install &lt;code>js2-mode&lt;/code> from &lt;code>melpa-stable&lt;/code> and &lt;code>kotlin-mode&lt;/code> from &lt;code>melpa&lt;/code>. So far, so good.&lt;/p></description></item><item><title>Automatically enabling multiple Emacs minor modes via a major mode hook</title><link>https://www.lonecpluspluscoder.com/2021/09/07/emacs-enable-multiple-minor-modes-from-major-mode/</link><pubDate>Tue, 07 Sep 2021 19:15:00 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2021/09/07/emacs-enable-multiple-minor-modes-from-major-mode/</guid><description>&lt;p>In Emacs, I usually end up enabling the same set of minor modes when I use one of my &amp;ldquo;writing modes&amp;rdquo;, namely modes like markdown-mode and org-mode. Enabling a single minor mode automatically is generally pretty easy via the appropriate mode hook, but enabling more than one minor mode requires one more level of indirection. Of course it does, because everything in computer science requires one more level of indirection :).&lt;/p></description></item><item><title>TIL that org-mode has an exporter for ODT</title><link>https://www.lonecpluspluscoder.com/2021/08/25/til-org-mode-odt-exporter/</link><pubDate>Wed, 25 Aug 2021 21:00:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2021/08/25/til-org-mode-odt-exporter/</guid><description>&lt;p>I&amp;rsquo;m by no means an Emacs &lt;a href="https://orgmode.org">org-mode&lt;/a> power user - in fact, anything but - but I do use org-mode a lot for note taking and also when I need an outliner to try and arrange ideas in a suitable manner. It excels at both, and usually does what I need including exporting to HTML. Exporting to HTML covers about 90% of my use cases. As much as I&amp;rsquo;d like to, LaTeX does not feature in my needs, but I needed to export an org-mode file for use with Microsoft Word. While there is no exporter directing into docx format, Microsoft Word can read ODT (OpenDocument Text) and guess what, org-mode does include an exporter for ODT. Problem solved, and I hope this information helps if you&amp;rsquo;re running into the same problem.&lt;/p></description></item><item><title>Setting up enchant for use with flyspell-mode on macOS</title><link>https://www.lonecpluspluscoder.com/2021/02/01/setting-up-enchant-for-use-with-flyspell-mode-on-macos/</link><pubDate>Mon, 01 Feb 2021 22:00:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2021/02/01/setting-up-enchant-for-use-with-flyspell-mode-on-macos/</guid><description>&lt;p>I have a few more loose ends to tidy up before switching to the static version of the blog. One of the important tasks was to make sure I had a spell checker available. Back in the dim and distant past I had set up &lt;code>flyspell-mode&lt;/code> with &lt;a href="https://www.lonecpluspluscoder.com/2015/03/03/setting-up-emacs-spell-checking-on-os-x/">hunspell&lt;/a>, but I wanted to check if there was something better available these days. Enter &lt;a href="https://abiword.github.io/enchant/">enchant&lt;/a>, which acts as a front end to multiple, different spell checkers. I like that Emacs has included support for enchant since version 26, plus one of the backends enchant supports is AppleSpell. In other words, when running on macOS, flyspell can make use of the OS&amp;rsquo;s built in spell checker and dictionaries.&lt;/p>
&lt;p>Instructions on how to actually set up enchant on macOS are a bit thin on the ground, so I decided that I&amp;rsquo;ll put together a quick write up.&lt;/p></description></item><item><title>Moving this blog to a static site - this time I'm serious</title><link>https://www.lonecpluspluscoder.com/2021/01/11/moving-this-blog-to-a-static-site-this-time-im-serious-because-org-mode/</link><pubDate>Mon, 11 Jan 2021 22:00:00 -0500</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2021/01/11/moving-this-blog-to-a-static-site-this-time-im-serious-because-org-mode/</guid><description>&lt;p>
I have been toying with the idea of migrating this blog to a static site to simplify its maintenance for some time. While &lt;a href="https://wordpress.org">WordPress&lt;/a> is a great tool, this blog is a side project and any time I have to spend maintaining WordPress gets deducted from the time I have to write for the blog. Keep in mind that I&amp;#39;m self-hosting this blog and it&amp;#39;s actually running on a Linux VM that only handles the blog. This is yet another server that I need to administer, and it&amp;#39;s the odd one out, too, as all of the others are FreeBSD or OpenBSD servers.&lt;/p></description></item><item><title>[HOWTO] Installing Emacs 26.3 on Ubuntu or XUbuntu 19.04</title><link>https://www.lonecpluspluscoder.com/2019/10/13/howto-installing-emacs-26-3-on-ubuntu-or-xubuntu-19-04/</link><pubDate>Sun, 13 Oct 2019 12:19:03 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2019/10/13/howto-installing-emacs-26-3-on-ubuntu-or-xubuntu-19-04/</guid><description>&lt;p>My &lt;a href="https://www.lonecpluspluscoder.com/2017/07/30/building-emacs-25-2-on-xubuntu-17-04/">previous instructions&lt;/a> for installing a newer Emacs version on Ubuntu still work. Ubuntu (and in my case, XUbuntu) 19.04 ships with Emacs 26.1 out of the box. As usual I want to run the latest version - &lt;a href="https://lists.gnu.org/archive/html/emacs-devel/2019-08/msg00577.html">Emacs 26.3&lt;/a> - as I run that on my other Linux, FreeBSD and macOS machines.&lt;/p>
&lt;p>I only had to make one small change compared to the older instructions. Instead of running the versioned &lt;code>sudo apt-get build-dep emacs25&lt;/code> I ran &lt;code>sudo apt-get build-dep emacs&lt;/code>. Once the dependencies are installed, you&amp;rsquo;re a configure/make/make install away from having a working Emacs 26.3:&lt;/p></description></item><item><title>Wrapping up the Emacs on Mac OS X saga</title><link>https://www.lonecpluspluscoder.com/2019/04/14/wrapping-up-the-emacs-on-mac-os-x-saga/</link><pubDate>Sun, 14 Apr 2019 10:15:00 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2019/04/14/wrapping-up-the-emacs-on-mac-os-x-saga/</guid><description>&lt;p>In a previous &lt;a href="https://www.lonecpluspluscoder.com/2019/04/08/unwelcome-surprise-homebrew-emacs-has-no-gui-after-os-x-mojave-update/">post&lt;/a> I mentioned that I upgraded my homebrew install of Emacs after Emacs 26.2 was released, and noticed that I had lost its GUI functionality. That&amp;rsquo;s a pretty serious restriction for me as I usually end up with multiple frames across my desktop. I did end up installing the homebrew &lt;a href="https://github.com/railwaycat/homebrew-emacsmacport">Emacs for Mac tap&lt;/a> which restored the GUI functionality. It had have one niggling problem for me, though. My muscle memory says that I use Shift-Meta-7 (aka Meta-/ ) for keyword expansion as I use a German keyboard layout most of the time. Unfortunately, with Meta mapped to the Apple Command key, Shift-Meta-7 is a menu shortcut. Instead of expanding keywords, I kept opening menus. That clearly wouldn&amp;rsquo;t do.&lt;/p></description></item><item><title>Emacs 26.2 on WSL with working X-Windows UI</title><link>https://www.lonecpluspluscoder.com/2019/04/12/emacs-26-2-on-wsl-with-working-x-windows-ui/</link><pubDate>Fri, 12 Apr 2019 23:00:00 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2019/04/12/emacs-26-2-on-wsl-with-working-x-windows-ui/</guid><description>&lt;p>I&amp;rsquo;ve blogged about building &lt;a href="https://www.lonecpluspluscoder.com/2018/04/19/emacs-26-1-rc1-on-windows-subsystem-for-linux/">Emacs 26 on WSL before&lt;/a>. The text mode version of my WSL build always worked for me out of the box, but the last time I tried running an X-Windows version, I ran into rendering issues. Those rendering issues unfortunately made the GUI version of Emacs unusable on WSL. Nothing like missing the bottom third of your buffer to cramp your style. Or your editing.&lt;/p>
&lt;h2 id="going-all-in-with-emacs-262-with-cairo">Going all in with Emacs 26.2 with Cairo&lt;/h2>
&lt;p>I&amp;rsquo;ve just built the newly &lt;a href="https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00503.html">released Emacs 26.2&lt;/a> on my Ubuntu WSL with the options &lt;code>–with-cairo –with-x-toolkit=gtk&lt;/code> and it looks like the rendering has improved massively. I&amp;rsquo;ve also recently upgraded VcXsrv to version 1.20.1.1, so it&amp;rsquo;s not quite clear to me if this is due to improved compatibility of WSL itself, changes between Emacs 26.1 and 26.2, or the fact that I turned on Cairo or VcXSrv upgrade.&lt;/p></description></item><item><title>And now, an Emacs with a working org2blog installation again</title><link>https://www.lonecpluspluscoder.com/2019/04/08/and-now-an-emacs-with-a-working-org2blog-installation-again/</link><pubDate>Mon, 08 Apr 2019 22:30:00 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2019/04/08/and-now-an-emacs-with-a-working-org2blog-installation-again/</guid><description>&lt;p>I mentioned in my &lt;a href="https://www.lonecpluspluscoder.com/2019/04/08/unwelcome-surprise-homebrew-emacs-has-no-gui-after-os-x-mojave-update/">previous post&lt;/a> that I somehow had ended up with a non-working org2blog installation. My suspicion is that this was triggered by my pinning of the htmlize package to the &amp;ldquo;wrong&amp;rdquo; repo. I had it pinned to marmalade rather than melpa-stable, and marmalade had an old version of htmlize (1.39, from memory). The fact that marmalade is erroring out with an expired certificate is most likely a sign that I need to stop using it. Anyway, re-pinning htmlize to melpa-stable unclogged that particular problem and the updated org2blog flowed onto my machine.&lt;/p></description></item><item><title>Unwelcome surprise - homebrew Emacs has no GUI after OS X Mojave update</title><link>https://www.lonecpluspluscoder.com/2019/04/08/unwelcome-surprise-homebrew-emacs-has-no-gui-after-os-x-mojave-update/</link><pubDate>Mon, 08 Apr 2019 21:17:20 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2019/04/08/unwelcome-surprise-homebrew-emacs-has-no-gui-after-os-x-mojave-update/</guid><description>&lt;p>I finally got around to upgrading my OS X installation from Mojave to High Sierra - my OS update schedule is usually based on the old pilot wisdom of &amp;ldquo;don&amp;rsquo;t fly the A model of anything&amp;rdquo;. As part of the upgrade, I ended up reinstalling all homebrew packages including Emacs to make sure I was all up to date. That proved to be a big mistake as I suddenly had a GUI-less Emacs. Of course I found the post on &lt;a href="https://irreal.org/blog/?p=7506">Irreal&lt;/a> about the Emacs homebrew package being broken on Mojave after, well, I noticed that my Emacs GUI wasn&amp;rsquo;t working. Oops.&lt;/p></description></item><item><title>Someone installed a Scheme development environment on their phone</title><link>https://www.lonecpluspluscoder.com/2018/11/05/someone-installed-a-scheme-development-environment-on-their-phone/</link><pubDate>Mon, 05 Nov 2018 04:00:04 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2018/11/05/someone-installed-a-scheme-development-environment-on-their-phone/</guid><description>&lt;p>Ben Simon has a post up on his blog describing how &lt;a href="http://www.blogbyben.com/2018/04/a-little-scheme-setup-and-development.html">he set up a scheme development environment on his Galaxy S9 Android phone&lt;/a>. It was also an especially timely post as I had been eyeing a Mac Quadra with a Symbolics Lisp Machine extension card on eBay. As if we needed another reminder just how powerful current phones have become!&lt;/p>
&lt;p>And no, I didn&amp;rsquo;t put a bid on that Quadra - not quite feeling this flush at the moment.&lt;/p></description></item><item><title>Emacs 26.1 has been released (and it's already on Homebrew)</title><link>https://www.lonecpluspluscoder.com/2018/05/28/emacs-26-1-has-been-released-and-its-already-on-homebrew/</link><pubDate>Mon, 28 May 2018 10:32:42 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2018/05/28/emacs-26-1-has-been-released-and-its-already-on-homebrew/</guid><description>&lt;p>Saw the &lt;a href="https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00765.html">announcement&lt;/a> on on the GNU Emacs mailing list this morning. Much to my surprise, it&amp;rsquo;s also already available on &lt;a href="https://brew.sh/">homebrew&lt;/a>. So my Mac is now sporting a new fetching version of Emacs as well :). I&amp;rsquo;ve been running the release candidate on several Linux machines already and was very happy with it, so upgrading my OS X install was pretty much a no brainer.&lt;/p>
&lt;p>Here we go: &lt;figure>&lt;img src="https://www.lonecpluspluscoder.com/2018/05/28/emacs-26-1-has-been-released-and-its-already-on-homebrew/emacs-26.1-on-os-x.png"
alt="Screenshot of Emacs 26.1 running on OS X">
&lt;/figure>
&lt;/p></description></item><item><title>Another way to use Emacs to convert DOS/Unix line endings</title><link>https://www.lonecpluspluscoder.com/2018/04/24/another-way-to-use-emacs-to-convert-dos-unix-line-endings/</link><pubDate>Tue, 24 Apr 2018 06:04:00 +0000</pubDate><author>Timo Geusch</author><guid>https://www.lonecpluspluscoder.com/2018/04/24/another-way-to-use-emacs-to-convert-dos-unix-line-endings/</guid><description>&lt;p>I&amp;rsquo;ve &lt;a href="https://www.lonecpluspluscoder.com/2016/12/13/converting-files-from-dos-to-unix-file-formats-using-emacs/">previously blogged&lt;/a> about using Emacs to convert line endings and use it as an alternative to the dos2unix/unix2dos tools. Using &lt;em>set-buffer-file-coding-system&lt;/em> works well and has been my go-to conversion method.&lt;/p>
&lt;p>That said, there is another way to do the same conversion by using &lt;a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Coding.html#index-C_002dx-RET-f-1722">M-x recode-region&lt;/a>. As the name implies, &lt;em>recode-region&lt;/em> works on a region. As a result, it offers better control over where the line ending conversion is applied. This is extremely useful if you&amp;rsquo;re dealing with a file with mixed line endings.&lt;/p></description></item></channel></rss>