Every time I rely on something on a new computer and take it on the road, said computer/system throws a pain-in-the-ass problem at me. And the difficulty of said problem is inversely proportional to the availability of either time or internet access.
Case in point: I do a lot of my writing on my home computer, which is a Macbook, but which I did not want to bring on my current trip because of size, and mostly because it’s my main computer, thus is not as easily replaceable in case of theft or damage. Instead, I transferred over my current book project and installed a copy of XEmacs onto my netbook, which runs Windows XP and doesn’t include such niceties as a functional emacs, or pretty much anything else.
I get to my destination, and suddenly find a neat problem: the M-q command, which fills the current paragraph, does not work. “Filling” a paragraph, to you non-emacs types, takes a paragraph that has a bunch of uneven lines, like say a first line with two words, a second line with 100 words, and so on, and rejustifies it so it more or less fits in a standard page width, which is I think 72 characters by default. But when I would do this in a paragraph that began with a tab, it would indent the entire paragraph one tab.
There is no clear documentation on how to fix this, or even how to explain why it happens. I remember that ten or twelve years ago, this inexplicably started in GNU Emacs, and after a lot of head-versus-wall bashing action, I found some magic elisp to fix it. But that was ten or twelve years ago, and more importantly, the same code did not fix XEmacs. Was this a Win32 issue?
I don’t know, but I found another oddity: XEmacs insisted on creating a
~/.xemacs/init.el file when I picked the Options > Edit Init File menu option. And it could not create that directory. And if you’re in file explorer in Windows, you can’t create a file that starts with a dot.
Tip #1 and the long way around: go to where you installed XEmacs (probably
c:\Program Files\XEmacs), go into
site-packages\lisp, and add your code to site-start.el
Tip #2 which didn’t dawn on me until days later: go to a dos prompt (sorry, “command shell”) and simply do a
mkdir .xemacs, and it works.
Back to the initial problem. I can’t entirely explain why this worked and why the thousand other things I tried did not work, but here’s my solution. Add this to whatever
.el file you can get to start up with XEmacs:
(setq auto-mode-alist (append '(("\\.txt$" . paragraph-indent-text-mode)
("\\.html$" . html-mode)) auto-mode-alist))
(setq text-mode-hook '(lambda ()
(setq adaptive-fill-mode nil)
(local-set-key " " 'tab-to-tab-stop)
The space between the two quotes in the second-to-last line is an actual tab character and not five spaces.
Worked for me after that. Next lesson, if I ever figure it out, is either how to get ispell to work right on Windows machines, or how to install a hacked copy of OSX on my netbook and forget all of this nonsense.