Tuesday, June 30, 2026

Create Date Books, Planners and Calendars with Emacs

Diary was my pick for this month's Emacs Carnival. But in fact it's part of a larger set of functions under the calendar group. Another set of functions allows you to create pocket date books, desk planners and wall calendars if you have access to a printer. The function names begin with cal-tex-cursor and cal-html-cursor, and they can be found in cal-tex.el and cal-html.el, respectively.

The "tex" and "html" in the function names describe the output formats, LaTeX and, well, HTML; "cursor" describes one way of defining their inputs (from the position of the cursor in the calendar buffer). They're further subdivided into layouts such as day, week, month and year. My favorite is cal-tex-cursor-week-iso.

Open the calendar (M-x calendar). Observe that the cursor is at today. Now invoke cal-html-cursor-month and accept the default at the prompt. The function will create a file named YYYY-MM.html. The variable cal-html-directory provides the cal-html functions with the path name. The HTML file is placed in a subdirectory named YYYY. In my case, cal-html-directory is set to "~/public_html." As I invoke it today, the subdirectory / filename is 2026/2026-06.html.

The calendar can pull information from your diary file(s), the holidays defined in holidays.el and in the holiday-other-holidays variable. If you have %%(diary-sunrise-sunset) and %%(diary-lunar-phases) you'll get the times of sunrise and sunset at your coordinates, and the dates and times of the four lunar phases, assuming that cal-tex-diary is non-nil. (I also have cal-tex-24 non-nil.)

I suggested cal-html-cursor-month because its output is easily viewed (rendered) with a web browser. But I prefer the weekly calendar produced by cal-tex-cursor-week-iso, which outputs in LaTeX.

I've invoked cal-tex-cursor-week-iso with the cursor on June 16. The output is shown in Figure 1 after rendering to PDF with pdflatex. (Note that the screenshot is closely cropped.) There's a lot included here.

The Rendered LaTeX for Week 25 of 2026

First, note that our Third Tuesday of the Month Club meeting (used as an example in a previous post) is shown. This comes from a diary entry; unfortunately org file events are ignored. (The agenda for this week is shown in Figure 2; note the event in red does not appear in the weekly calendar. This is another reason I favor recording appointments in the diary.)

Two other diary entries also are included: a record of when the kitchen cabinets were painted, plus a breakfast meeting with Howard.

Then you'll find two holidays, Islamic New Year and Father's Day. And because I have diary-lunar-phases in my diary, a moon phase also shows up. (I commented out the diary-sunrise-sunset statement because it adds the information to every day of the week, which makes the weekly planner look too cluttered.) Last but not least the Summer Solstice is included as a Sunday holiday along with the time it occurs.

The first line of each day block also shows (right justified) the day number (of the year) and the number of days remaining in the year. The Sunday block is quite crowded; the first line is wrapped, so the day number / days remaining field appears on the next line.

Sadly, any links in the diary that worked in Org Agenda do not work in the LaTeX output. You'll see instead the full syntax of the link, [URL][description] ].

I created an improved version of cal-tex-cursor-week-iso. Here are some of the changes:

  • inhibit sunrise/sunset data for all but the first day
  • switch to sans-serif font
  • color birthdays and anniversaries in blue
  • replace the non-ASCII characters (used for Bahai holidays)
  • offset left or right to allow for the binding of a year's worth of pages
  • more?

I uploaded it to Codeberg, but I need to clean it up a bit before I feel comfortable promoting it.

If you position the cursor on the last day of the year and invoke cal-tex-cursor-week-iso with a prefix argument of 53, you can create the pages for a personalized weekly planner for next year! Try it out!

Sunday, June 28, 2026

Emacs disabled Commands

It's possible to configure Emacs to prompt the user before calling a function, thereby "disabling" a function. The function isn't totally inaccessible -- Emacs will let you run it if you want it to. I chose to do this with scroll-left, scroll-right, scroll-up-command and scroll-down-command as explained in the previous post.

Most keypresses call self-insert-command, which is itself a function. So what would happen if self-insert-command were disabled?

It turns out to be not as debilitating as you'd think -- only the alpha-numeric and punctuation keys are affected. When a modifier is used with a key (M-x, for example), there is no interruption. Likewise, the TAB key is allowed to pass, which makes completion easier.

When Emacs inhibits self-insert-command, it prevents the keypress from having its intended effect. It will say that the command is disabled because many users find it confusing. Then you'll have the options of:

  • (n) Not running the command
  • (y) Run the command and don't ask again
  • SPC Run the command just one time to try it
  • (!) Enable the command and all other disabled commands

The n, y, SPC and ! keys are not inhibited at this point, so the user doesn't get trapped in a set of recursive prompts.

So to invoke org-agenda, I'd press M-x o. Then I'd press SPC to enable the self-insert-command for "o." Then I'd press r followed by SPC, and so on. My keypresses are M-x o r g - a g TAB ENTER.

Thus, adding (put 'self-insert-command 'disabled t) to a cube-mate's init file is a harmless prank, something to try on April Fool's Day.

Saturday, June 27, 2026

Preventing Errant Navigation

I often press C-<end> or C-<next> accidentally. It's annoying and disorientating because I lose my place in the document as well as my train of thought. I think of them (a bit dramatically) as "Deadly Navigation Keys." But I discovered two valuable Emacs features to make it easy to recover from them (or prevent them) as a result.

The first valuable feature is that C-<end> (which is bound to end-of-buffer) sets the mark at the cursor location prior to setting point to the end of the buffer. (I only just realized this after seeing the message "Mark set" in the minibuffer about fifty times.)

There's an almost-applicable saying, "What goes up, must come down," except in this case I'd say, "What gets pushed, may be popped." A simple invocation of C-h a pop.+mark revealed the pop-to-mark-command. And then, happily, M-x pop-to-mark-command returned me to exactly where I left off. It was the undo feature that Emacs had been missing -- a sort of undo-cursor-motion.

Recovering from beginning-of-buffer is just as easy. It, too, pushes mark.

There are, however, other Deadly Navigation Keys that do not push mark. In fact, they don't even change the position of the cursor. Instead, they scroll the buffer. I'm referring to scroll-left and scroll-right . These are disabled by default. However, I figured that only babies needed to shielded from such commands, so I enabled them.

Holy cow was that a mistake! On my laptop keyboard, the page down and right arrow keys are crammed very close together. I often press C-<right> to advance one word, but that's only 1 cm away from C-<next>, which is bound to scroll-left. And scroll-left alters the view of the buffer such that all the content I been work on shifts off screen. The first time it happened, I freaked, of course, and then I checked the status bar to see if the buffer had been modified. (It hadn't.) So I closed Emacs entirely and restarted it. Then I re-disabled scroll-left and scroll-right.

But then it occurred to me to disable end-of-buffer and beginning-of-buffer, too, because I rarely use those functions, and if I really need to call them, all I'd have to do is press the spacebar after each C-<end>. Disabling a command is a convenient way of seeking confirmation without making the user type "yes" (or "y").

What commands do you have disabled? And why?

Wednesday, June 24, 2026

Add Web Search to LibreOffice Writer

Introduction

In Vivaldi1 I can right click on a word or selected phrase and search for it. But in LibreOffice Writer, I'd have to copy the selection to my clipboard, switch to the browser, paste it into the search bar and then press Enter. I longed to have a generic search capability for Writer. So I created it.

Well, first I searched for it, and I found a macro that was designed to do something similar2. It provided the Basic code I needed to read the selected text.3 It had to be modified somewhat to work on my computer, but it was a tremendous help.

Then I built on it. The collection of macros that I wrote allows a user to perform the search using several search engines. And it's amenable to configuration in the Context Menu.

Workflow Summary -- Search the Internet for selected text
  • Select some text.
  • Right click on it.
  • Search the Internet for it.
  • Use any one of these these preconfigured search engines:
    • DuckDuckGo
    • Google
    • LinkedIn
    • Wikipedia
    • Open Library
    • The Free Dictionary
    • And you can add your own!

Detail

Web Search is a LibreOffice Basic module that contains the macros needed to perform an Internet search of selected text.

Program Flow

A unique macro is dedicated to each search engine. The user selects text and then invokes the macro that corresponds to the desired search engine.

The invoked macro sets an index that points to the search engine URL in an array. Then it invokes the Main subroutine.

Main calls an Initialize routine, which loads the path to the web browser executable and all the Search Engine URLs.

Main performs two checks. First it verifies that the search engine index is within the bounds of the array of search engine URLs. The out-of-the-box state is that the index should be in the range 0 to 5.

The second check is that Main verifies that text has been selected in the Writer document.

If and only if the previous two checks are successful, then Main calls the InvokeSearch routine; the search engine URL and the search terms are its arguments. If either check fails, Main and the invoked macro terminate; no action is performed.

InvokeSearch replaces a token in the search engine URL with the search terms. Then it calls the system shell, which opens the web browser with the conditioned search engine URL as an argument. The shell process is asynchronous.

The web browser takes focus and displays search results.

Finally, the three procedures (two subroutines and a function) are removed from the call stack, and the global variables are cleared.

Context Menu Setup

The LibreOffice Context Menu can be configured to provide easy access to each Search Engine macro. The user can right click on selected text, choose "Search on Web...," and then choose the submenu item that corresponds to the desired search engine. In Figure 1 below, the DuckDuckGo search engine is selected. Thus each Web Search submenu item is assigned a unique macro.

Figure 1: The SearchWeb Context Menu


Configure the context menu as shown in Figure 2, below. Access this dialog window by selecting Tools | Customize on the menu and then click the Context Menu tab.

Figure 2: Customizing the Context Menu


The corresponding XML content is contained in the text.xml file, which is located here in the user's profile:

AppData\Roaming\LibreOffice\4\user\config\soffice.cfg\modules\swriter\popupmenu\

The first 20 lines of text.xml are provided in the listing below. Note that the menu items for Open Library and The Free Dictionary are wrapped.

It may be easier to edit this file than to use the Customize form that's shown above.

Contents of text.xml

<?xml version="1.0" encoding="UTF-8"?>
-
<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
  -
  <menu:menu menu:label="Search on Web..." menu:id="Search on Web...">
    -
    <menu:menupopup>
	<menu:menuitem menu:label="D DuckDuckGo" menu:id="vnd.sun.star.script:Standard.SearchWeb.SEDuckDuckGo?language=Basic&location=application"/>
	<menu:menuitem menu:label="G Google" menu:id="vnd.sun.star.script:Standard.SearchWeb.SEGoogle?language=Basic&location=application"/>
	<menu:menuitem menu:label="L LinkedIn" menu:id="vnd.sun.star.script:Standard.SearchWeb.SELinkedIn?language=Basic&location=application"/>
	<menu:menuitem menu:label="O Open Library" menu:id="vnd.sun.star.script:Standard.SearchWeb.SEOpenLibrary?language=Basic&location=application"/>
	<menu:menuitem menu:label="F The Free Dictionary" menu:id="vnd.sun.star.script:Standard.SearchWeb.SETheFreeDictionary?language=Basic&location=application"/>
	<menu:menuitem menu:label="W Wikipedia" menu:id="vnd.sun.star.script:Standard.SearchWeb.SEWikipedia?language=Basic&location=application"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuitem menu:id=".uno:NoBreak"/>
  <menu:menuseparator/>
  <menu:menuitem menu:id=".uno:Cut"/>
  <menu:menuitem menu:id=".uno:Copy"/>
  <menu:menuitem menu:id=".uno:Paste"/>


1 Vivaldi, https://vivaldi.com/desktop/
2 Ratslinger's post in this thread on the LibreOffice help forum provided a solution way back in September 2018 https://ask.libreoffice.org/t/link-to-browser-in-writer/35943/6
3 Here's a function that returns the selected text; words in a phrase are separated+with+plus+signs+instead+of+spaces:
    Private Function GetSelection() As String
      ' Returns Selected Text
      ' 2025-12-22 Created
      Dim oSelections, oFirstSelection As Object
      oSelections = ThisComponent.CurrentSelection
      oFirstSelection = oSelections.getByIndex(0)
      strTemp = oFirstSelection.String
      If strTemp <> "" Then
        GetSelection = Replace(strTemp, " ", "+")
      End If
    End Function

Tuesday, June 23, 2026

Link diary Event to Org Heading

Suppose you want to schedule a recurring meeting in the diary, yet you want to access an org heading for note-taking and clocking time. You can add a link to that org heading in the description of the diary event.

Here's how I'd do it:

  • Place point on the desired Org heading
  • Invoke org-store-link, which might be bound to C-c l
  • In the diary file...
    • Add the date expression for the corresponding event. In this example, we'll schedule an event that occurs from 7pm to 8pm on the third Tuesday of every month.
      • %%(diary-float t 2 3) 19:00-20:00
    • Add a space and then the link as the event description with M-x org-insert-link
      • Note that C-c C-l might not bound to org-insert-link in diary-mode
  • That's it!

Monday, June 22, 2026

Emacs Carnival: diary, Part 2

As I wrote earlier, I consider diary to be an underappreciated Emacs built-in.

I got interested in it again when I wanted to schedule a recurring meeting in Org for the third Tuesday of every month. I saw on Reddit that some folks use diary-float in place of the usual active timestamp to achieve this. So I added this after the meeting header to make it work:

  * Third Tuesday of the Month Club
  SCHEDULED: <(%%diary-float t 2 3) 19:00-20:00>

I have five meetings that use this method of automatic scheduling. I like this approach because of its simplicity and elegance. Unfortunately, it doesn't behave the same way as a recurring task.

When I mark a recurring task as complete, Org reschedules it for the next date on which it should occur. And it changes DONE to TODO to ensure the event shows up on the agenda for the next occurrence.

This doesn't happen for a task that's scheduled with diary-float. When marked complete, the headline remains at DONE; the next event won't show up on the agenda.

And so Fengyuan Chen wrote next-day-spec1 to solve this issue. Unfortunately it doesn't work with the latest versions of Emacs.

One of the many recognized cognitive biases is called the Sunk Cost Fallacy2, which impels an individual to favor an inferior (or incorrect) solution because a significant amount time, money, and/or effort has been invested in the solution. Well, I've invested time and effort in both diary-float and next-day-spec, so I've continued to endorse it as a solution.

But even if rescheduling did work, I think it's better to have each meeting scheduled as a subheading of the overall meeting topic, like this:

  * Third Tuesday of the Month Club
  ** DONE May 2026: <2026-05-19 Tue>
    :LOGBOOK:
    CLOCK: [2026-05-19 Tue 18:54]--[2026-05-19 Tue 20:12] =>  1:18
    :END:
    - Note taken on [2026-05-19 Tue 21:20] \\
    We ate pizza.  Again.
    ** TODO June 2026: <2026-06-23 Tue>
      ** TODO July 2026: <2026-07-21 Tue>

The advantage to this is that clocked time and notes are organized neatly within each individual subtopic, not aggregated into one logbook and a series of notes. If the aggregated time is desired, one could insert the log report. I'll review this in another post.

But it's fun to schedule events that occur on irregular dates, such as National Engineers Week (US), which is the week in which George Washington's birth anniversary occurs3. Here's how you can add it to an Org file:

  * TODO Celebrate Engineers Week!
  SCHEDULED: <%%(equal (calendar-gregorian-from-absolute (calendar-dayname-on-or-before 0 (calendar-absolute-from-gregorian (list 2 22 (calendar-extract-year date))))) date)>

Do you have a favorite use for dairy?

1 https://github.com/chenfengyuan/elisp/blob/master/next-spec-day.el
2 Sunk cost - Wikipedia
3 https://www.holidayscalendar.com/event/national-engineers-week/

Saturday, June 20, 2026

Celebration of Mind (CoM) Virtual Events

While playing Not Pron1 a couple of months ago, I became distracted by the "little dragon statue" on Level 12. It has nothing to do with solving that level, so you'll not see a spoiler here. But the dragon is a nice Easter egg in a way, and it lead me on a fun little journey.

Eventually I discovered a wonderful community that "...stimulates curiosity and the playful exchange of ideas and critical thinking in recreational math, magic, science, literature, and puzzles..." The community's focal point isThe Gathering 4 Gardner (G4G) Foundation.2

I'll let you explore the website on your own. But I wanted to draw attention to their Celebration of Mind (CoM) Virtual Events,3 which take place on the 21st of every month. The next one is expected to start in about thirteen hours (from the time this is published). The topic is "The Jaunty Squares Theorem." All you need to do is Zoom in to the meeting!

Check it out!


1https://notpron.com
2https://www.gathering4gardner.org
3https://www.gathering4gardner.org/category/com-virtual-events/

Thursday, June 18, 2026

Add QR Code To Calendar Event Description

It can be convenient to include a QR code in the description of a calendar event. However, the three online calendar apps that I use1 do not provide a way to add images to the event descriptions. Here's a workaround that works with Google Calendar (so far), but it requires a QR code generator that outputs text (extended ASCII) as opposed to PNG, JPG or SVG.2

I invoke the generator from the CLI, entering qr.exe https://www.fsf.org --ascii (where https://www.fsf.org is the content to be encoded). It outputs directly to the CLI, as shown in Figure 1. Why not redirect the output to a text file, such as QRCode.txt? I tried, but the resulting file is in PNG format, not text.

Figure 1 -- Screenshot of the CLI that
  shows the command and its output

Since text output cannot be redirected to a file (at this time), I must do this manually by selecting and copying the text from the CLI to the clipboard. And I paste it into an HTML file, actually, and enclose it in a pre tag to ensure that it's rendered in a monospace font family, as shown in the listing below.

  <pre style="font-family: monospace, monospace; font-size: small;">
    █▀▀▀▀▀█ ▄▀ ▀▀█  ▄ █▀▀▀▀▀█    
    █ ███ █ █▄  █▄ ▄█ █ ███ █    
    █ ▀▀▀ █  ▄▀  ▄▄ ▀ █ ▀▀▀ █    
    ▀▀▀▀▀▀▀ █ ▀▄█ █▄█ ▀▀▀▀▀▀▀    
    █ ▄  ▄▀ █▄▀  ▄▄▄▄█▀▄▄███     
    ▄▀ ▄▀ ▀▄ █ █▀█▀█▄█▀█▀█ ▀█    
    ███▀ ▀▀  ▀  ▀▀ ██▄▀▄   ▄▀    
    █ █▀▀ ▀▀▀ ▄█▀  ███▀█▀█▄▀█    
    ▀ ▀▀▀ ▀ █ ▄▀▄▄▄██▀▀▀█ ▀      
    █▀▀▀▀▀█  ▀▀▀▄▄ ▄█ ▀ █  ▄▀    
    █ ███ █  ▄▀ ▀ █▀▀▀█▀▀ ▀▄█    
    █ ▀▀▀ █  ▀▄█▀ ▄ ▄▄ ▄▄▀▀ █    
    ▀▀▀▀▀▀▀ ▀▀▀  ▀▀ ▀▀   ▀  ▀    
  </pre>

I open qrcode.html in my web browser, as shown in Figure 2.

Figure 2 -- qrcode.html rendered in a Vivaldi browser window

I select the rendered HTML and copy it to the clipboard. Then I paste it into the event description, as shown in Figure 3.

Figure 3 -- Screenshot of
  the Google calendar event description

In real life I'd encode an access code that allows me to enter the meeting venue. The FSF URL is used here as an example.

How is this related to Emacs? I never claimed that this blog is devoted entirely to Emacs. But if it helps, I wrote the HTML for this post with Emacs, as well as the qrcode.html file.

I'm just curious if anyone else finds this useful or if you have other workarounds to go beyond the limitations of pedestrian apps.


1The calendar apps are from Google, Yahoo, Proton.
2QRCode is a Python module that provides an executable, qr.exe. It can be obtained from PyPi: https://pypi.org/project/qrcode/8.2/.

Monday, June 15, 2026

Emacs Carnival: diary, Part 1

When I adopted Emacs in July of 2000, I hunkered down to learn the keybindings. But after I learned the basics1 I started to RTFM (C-h r), and I was instantly drawn to the Calendar/Diary2 node, which I consider to be an underappreciated Emacs built-in, and, therefore, the topic of Emacs Carnival for June 2026.

Back then I mistook "diary" to mean a blank-page-confidant into which we write our thoughts, fears, ambitions or even just what we had for dinner last night. At that time I'd been writing in a journal for about 24 years (yes, since 1976, on and off), so my head swelled with ideas of using Emacs for a revamped computerized version. I imagined being able to forward-search-regexp in order to find, for example, that weird dream I wrote about in which I caught a toad that was hopping around the kitchen and then turned into a hot coal sizzling in my hand...

I used diary-block functions to date my entries and organize the content. I ended up making four such entries from 2003 to 2004. But each day following the entry, M-x diary would display a nearly blank buffer, showing only the day's date at the top followed by a line of equal signs and perhaps a holiday. Where did yesterday's entry go?! It was disconcerting that those words "vanished" into thin air magnetic film or silicon.

Today, however, I appreciate the simplicity of that approach -- a clean slate sans distractions. But back then I was accustomed to seeing a vast amount of my writing, which fed my ego.

But that's not all there is to appreciate. There are several functions that can be used for "an entry" in addition to diary-block, such as diary-anniversary, diary-cyclic, diary-float or even just a simple line that begins with a date and a brief note. This is not an all-inclusive list.

Every fancy diary buffer can show local time of sunrise and sunset; to do this, include diary-sunrise-sunset in the diary file. Include diary-lunar-phases to show one of the four phases of the moon when one is active on that day; the local time of that moon phase will be included.

What follows is an abbreviated and edited listing of my diary files. Note how I've structured diary into a hierarchy using include statements.

2026-06-17 02:25 GMT Important updates: First, you'll need to modify two hook variables in order for the include statements to work. Please see the help for Fancy Diary Display. I also "use the normal hook diary-list-entries-hook to sort each day's diary entries by their time of day," which is described at the top of that page. Second, specify the full path to the included files. I've modified the two include statements to add the "~/" path. This is needed only if you want to press TAB on the item in the Agenda in order to focus the diary entry.

The beauty of this is that these events will show up in Org Agenda at the appropriate times when org-agenda-include-diary is non-nil.

Four examples are shown below. Here are some things to note:

  • The content that's derived from the diary file has "Diary" for value of CATEGORY.
  • The Sunrise / Sunset lines are supposed to show the time of each occurance. However, the time for Sunrise isn't displayed; rather, it's indicated by its position on the time grid. The times for both the New Moon and the Solar Eclipse are indicated by the time grid, as well, and are expected to peak at 13:38 in my area. That's something to look faroward to!
  • Sometimes I include links in my headings. In this case I can follow a link to the credit card website to pay the Visa card.
  • Even a link in the dairy file will be rendered in the Agenda properly, as shown in the reference for Richard Stallman's birthday.
file listing: diary
#    -*- mode: diary -*-
#include "~/diary-anniversaries-property" #include "~/diary-birthdays-friends" %%(diary-sunrise-sunset) %%(diary-lunar-phases) %%(diary-remind '(diary-anniversary 3 16 1953) 14) [[https://html.duckduckgo.com/html/?q=Richard+Stallman+birthday][Richard Stallman's birthday]] in 14 days %%(diary-block 6 21 2004 6 21 2004) The summer solstice. I always take time to observe the position of the sun on this day, especially in the morning and evening. Sunrise was at 5:16am and sunset will be at 8:29pm. From today onward, the days will be getting shorter. At first it will be imperceptible, but in September, it'll be quite noticeable.
file listing: diary-anniversaries-property
#    -*- mode: diary -*-
# Recurring Property events or records
%%(diary-remind '(diary-date 7 3 '(2023 2026 2029)) 30) Car Registration is due
%%(diary-anniversary 8 12 2022) Kitchen Cabinets Painted %d Years Ago
file listing: diary-birthdays-friends
#    -*- mode: diary -*-
# Birthdays of friends
%%(diary-anniversary 8 13) Bucky Thorndike Miller's Birthday (Does Dave still have his guitar amp?)
%%(diary-anniversary 2 13 1966) Ben's %d%s Birthday
Day-agenda (W11):
Tuesday    16 March 2027
  Diary:       7:03 ┄┄┄┄┄ Sunrise (EDT), sunset 18:58 (EDT) at Home (11:54 hrs daylight)
               8:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  BILLS:       9:00 ┄┄┄┄┄ Deadline:   TODO Visa Card LINK            :Bills::Credit:
              10:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              12:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              14:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              16:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              18:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              20:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  Diary:      Richard Stallman's birthday in 14 days

Day-agenda (W23):
Wednesday   3 June 2026
  Diary:       5:19 ┄┄┄┄┄ Sunrise (EDT), sunset 20:20 (EDT) at Home (15:00 hrs daylight)
               8:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              10:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              12:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              14:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              16:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              18:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              20:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  Diary:      Reminder: Only 30 days until Car Registration is due

Day-agenda (W33):
Wednesday  12 August 2026
  Diary:       5:58 ┄┄┄┄┄ Sunrise (EDT), sunset 19:54 (EDT) at Home (13:56 hrs daylight)
               8:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
               9:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              10:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              12:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  Diary:      13:38 ┄┄┄┄┄ New Moon (EDT) ** Solar Eclipse **
              14:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              16:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              18:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              20:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  Diary:      Kitchen Cabinets Painted 4 Years Ago

Day-agenda (W32):
Saturday   13 August 2022
  Diary:       5:59 ┄┄┄┄┄ Sunrise (EDT), sunset 19:53 (EDT) at Home (13:53 hrs daylight)
               8:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              10:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              12:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              14:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              16:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              18:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
              20:00 ┄┄┄┄┄ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
  Diary:      Bucky Thorndike Miller's Birthday (Does Dave still have his guitar amp?)

1My requirements (the basics) for a text editor were:
  • column editing
  • keystroke recording and playback
  • regular expression search and replace
  • undo
  • support multiple files in multiple windows
2Calendar/Diary in the GNU Emacs Manual

Thursday, June 11, 2026

Creating a Reference to a Webpage in Org

I was asked recently, "Do you use Org Mode protocol ... for browser to Emacs interaction? If so, were there any complications to set it up on Windows? Is there like bookmarklets for capturing or doing things?"1

At the time I wasn't doing anything too fancy to incorporate Web Content into Org. I'd copy the URL from Vivaldi's address bar to the clipboard and (if applicable) the Web Content I'm interested in.2 Then in Org, I'd yank the Web Content (if applicable), mark it and then do org-insert-link (C-c C-l) to turn it into a hyperlink. The marked text becomes what you see in the document. But I usually just specify the link Description simply as "LINK." In fact I created a macro (bound to the Insert key) to do this.

But I've started to use eww as my web browser for this. If I write something that I need to verify, I'll mark it and invoke eww-search-words (M-s M-w), which brings me to a DuckDuckGo page of search results. If I follow a search result that I like, I'll mark a small section and invoke org-store-link (C-c l) and create the link with org-insert-link, with the marked content as the Description. Thus org-store-link captures both the location and the context in one magical swoop. Here's an animated GIF that illustrates the process. Note that the video shows me capturing and referring to part of Sacha Chua's website that shows some neat solutions to launching a web browser from Emacs.3


1 Sacha Chua's Emacs Chat with Raymond Zeitler transcript. Please scroll to 35:50

2 I use a clipboard manager so that I can copy content to the clipboard multiple times without clobbering all but the most recent item.

3 https://sachachua.com/blog/2025/07/emacs-open-urls-or-search-the-web-plus-browse-url-handlers/

Monday, June 8, 2026

Emacs and the Numeric Keypad

If you have a numeric keypad1, try this in the *scratch* buffer: enable numlock and press the zero on the numeric keyboard (Num-0). Then press the zero located between the alpha keys and the function keys (0). Okay, you see 00, no big deal.

Why do I bring this up? Emacs interprets Num-0 keypress as <kp-0> while it interprets 0 as 0. This means that you could bind Num-0 to a function without affecting the other 0. You could configure Num-0 to insert "zero" by entering and evaluating this in the *scratch* buffer:

(keymap-local-set "<kp-0>" #'(lambda () (interactive) (insert "zero")))

That's a trivial example, of course. But it implies that you can have ten more keys to play with. Similarly, the arithmetic operator keys on the numeric keyboard differ from the "regular ones" that are grouped with the alpha keys. They can be bound to functions, referenced as <kp-add>, <kp-subtract>, <kp-multiply>, <kp-divide>. But these also accept the standard C- M- S- modifier keys, which gives you twelve more possibilities. This is true also for the Insert key <kp-insert> and the Delete key <kp-delete> that double as Num-0 and Num-., respectively.

I have a "Calc" key above the numeric keypad. Unfortunately I can't seem to use it for anything in Emacs -- it opens the OS's calc.exe program regardless of what modifiers I use with it. This is a shame because it would be the ideal mapping for M-x calc. Perhaps this can be altered in BIOS.

But I do use my Win key as a modifier (sometimes). And I've heard that the Caps Lock key can be repurposed. These are topics for other posts.


https://en.wikipedia.org/wiki/Numeric_keypad

Saturday, June 6, 2026

Follow-on to exeln

Sebastián Monía1 offered some alternatives to the exeln function that I posted on June 4.2

First, he pointed out that there's no need to bind asynch with the let function. Instead he suggested that I use (when arg "&") to append the ampersand when there's a prefix argument. Thus, shell-command can be called this way:

(shell-command (concat
                (buffer-substring
                 (line-beginning-position) (line-end-position))
                (when arg "&")))

Second, call async-shell-command rather than shell-command with the "&" as suggested in shell-command's doc string, which says, "You can also use async-shell-command that automatically adds '&'."3

Third, use thing-at-point from the built-in thingatpt.el library to return the line at point rather than calling buffer-substring.

(defun exeln (arg)
  "Execute current line as a shell command.
With prefix ARG, run asynchronously."
  (interactive "P")
  (funcall (if arg
               #'async-shell-command
             #'shell-command)
           (thing-at-point 'line t)))

And although he didn't mention it explicitly, he reworded the doc string -- it blends in seamlessly with the native functions' doc strings.

I set out to contribute to the Emacs community, but I'm getting so much more out of it than I expected! Thank you again, Sebastián Monía!


1 https://site.sebasmonia.com/
2 exeln-execute-line.html
3 GNU Emacs online shell-command help

Thursday, June 4, 2026

exeln: EXEcute LiNe

The following exeln function passes the current line to the system shell, which executes it, thus EXEcuting LiNe.

On Windows x86, my GNU Emacs has shell-file-name set to cmdproxy.exe, which is provided by x86_64-w64-mingw32, with which Emacs was compiled.

shell is invoked synchronously by default; a prefix argument can change this to asynchronous.

In the video below, point is on a line of text that would print the contents of hello_whirled.txt when entered at the Windows command prompt (or DOS prompt). I press C-c x, which is bound to exeln. The command is executed and the output is shown in *Shell Command Output*, the default buffer used for synchronous output from shell-command.

(defun exeln (arg)
    "Execute the current line as a shell command.
With prefix arg, operate asynchronously, same as calling
(shell-command COMMAND) where COMMAND ends in '&'.
Otherwise, execute synchronously."
  (interactive "P")
  (let (asynch)
    (if arg
        (setq asynch "&"))
    (shell-command (concat
                    (buffer-substring
                     (line-beginning-position) (line-end-position))
                    asynch))))

2026-06-04 Add demo video

Tuesday, June 2, 2026

Change Emacs Cursor to Indicate Overwrite Mode

The text editor I'd used for 20 years on an MS-DOS platform would change the shape of the cursor to distinguish between insert mode and overwrite mode. A filled rectangle (or box, in Emacs terms) indicated overwrite mode; an underscore (hbar), insert mode. It's a nice way to make overwrite mode obvious.

The video starts out with Emacs in Insert Mode. Then Overwrite Mode is activated, which changes cursor-type from hbar to box. The word "Overwrite" replaces "Insert" to demonstrate the effect.

Incidentally, you might enjoy listening to some sound while playing back the video. One of my favorites is "Forest Voice" from https://mynoise.net, by Dr. Stéphane Pigeon.

Anyway, here's a function to implement that behavior in Emacs:

(defun zeit-change-cursor-shape ()
  "Set cursor shape depending on overwrite mode.
When overwrite-mode is nil (off), set cursor-type to hbar.
Otherwise, set it to box."
  (interactive)
  (if (not overwrite-mode)
      (setq cursor-type 'hbar)
    (setq cursor-type 'box)))

(add-hook 'overwrite-mode-hook 'zeit-change-cursor-shape)

2026-06-02 Add add-hook  as suggested by @Howitzer105mm@pdx.social

2026-06-02 Move hook outside function