Saturday, August 16, 2025

Define Emacs as Editor in Altap Salamander

I’ve been a devotee of the Servant Salamander / Altap Salamander file manager1 for decades. I migrated from Norton Commander (NC)2 soon after I started to work on a multi-tasking OS, Windows NT.

Likewise, I’ve been a fan of the (extensible) text editor Emacs3 for decades, having given up on Brief4, eventually. While on WinNT, I stayed with Brief a long time. But I seem to recall that Brief didn’t respond well to having one of its open files changed by another application. (This rarely happened in environments that it was designed for.)

Norton’s F4 key invoked a built-in text editor to open the selected file. The Salamander F4 key is configured to use Notepad.exe to open the selected file. But it can be configured to use other editors based on the selected file’s extension. I configure F4 to use Emacs for all text-like files.

Once I open Emacs, I like to keep that instance open for as long as possible. That’s because I build up a history usage, including:

  • Regular expression searches
  • Kill ring contents
  • On-the-fly macros

Switching to a new Emacs instance is a major interruption to my workflow.

Enter Emacs server. Emacs includes a server that can open a file in a running instance when invoked from an external application, such as Norton, ...er, Salamander. This allows a user to edit new files while maintaining the previous Emacs instance.

To use this active server process feature, you’d invoke Emacs with this command5 (all entered on a single line): C:\Path_to_Emacs_bin\emacsclientw.exe -a C:\Path_to_Emacs_bin\bin\runemacs.exe

But I find that configuring Salamander’s F4 to call the Emacs server to be difficult sometimes. In fact I spent an embarrassingly long time yesterday trying to figure it out. But it’s not at all difficult if you really understand two things:

  1. Only the Emacs executable should appear in the Custom Editor Target box; any switches go into the Arguments box before the $(Name) parameter.
  2. Emacs doesn’t like file names that contain quote marks. So if there’s a space in the path to the executable, you should specify the 8.3 name and not the path seen in Explorer.6 Please see the figure below.

I’ve heard Emacs gurus advise against installing Emacs in a location other than the default. The default on Windows currently is C:\Program Files\Emacs\emacs-30.1\. And I followed that advice unfortunately. But it caused me a great deal of grief, because it forced me to surround the paths in quotes and was incompatible with the server process. On my previous computers I had been installing Emacs in C:\Users\Public\Programs, which all users have access to and conforms to the DOS 8.3 file name format. That’s why this error is new to me.

So here’s advice from a wannabe guru:

  • Follow the instructions above to configure Salamander’s F4 to invoke Emacs if you already have Emacs and Altap Salamander installed.
  • When you install Emacs, change the installation location to ensure that the path is made up of only alpha-numeric characters and that all users will have Read and Execute permisions.


1 https://www.altap.cz/
2 https://en.wikipedia.org/wiki/Norton_Commander
3 https://www.gnu.org/software/emacs/
4 https://en.wikipedia.org/wiki/Brief_(text_editor)
5 https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html
6 Eli Zaretskii, https://lists.gnu.org/archive/html/help-emacs-windows/2014-04/msg00013.html

No comments: