You need to enable JavaScript to run this website.

emacs notes

emacs

For people familiar with lisp emacs has no competitors; but even before learning lisp it was a handy tool for me and I used it for c.a. 10 years. Here I collect my emacs tips/notes and pieces of code.

Bugs

Somehow emacs does not handle remote connections well: it may freeze up and become immortal (immune even to kill -9). So instead of C-x C-f /ssh:server.com:/path/to/file.txt I prefer mounting remote directory into /mnt/ and then access it with emacs as a local file.

TeX-lisp manual

I do not remember all Lisp functions, so it is helpful to quickly access extended articles from the TeX-lisp manual when updating a .lisp file.

dpans2texi is a useful software which transforms TeX manuals into texinfo format. The latter is understood by emacs, so, for example, when you write lisp code, you can get documentation (better than what slime provides) for lisp functions and symbols by pressing C-c C-d h.

Unfortunately it did not work for me out of the box, so I had to patch it.

My patch

  1. fixes dpi.texi encoding,
  2. does a couple of fixes in dp.texi,
  3. adds treatment of TeX macro it to dpans2texi.el,
  4. removes non-working redefinition of @code from dpi.texi.

This patch is a quick fix; it can be improved (sometimes I note strange symbols in the emacs info-buffer). Unfortunately, many packages available from quicklisp are not covered in the standard TeX-lisp manual; If/when I have time, I will slowly update the standard TeX-lisp manual with info on (my favorite) common-lisp packages.

Patching dpans2texi

The original dpans2texi project was erased on github, so now one can use its clone.

Install original dpans2texi and patch it:

shell
git clone https://github.com/ruricolist/dpans2texi
cd dpans2texi
wget chalaev.com/files/dpans2texi.patch
patch -p1 < dpans2texi.patch
make clean; rm *.tex
./configure --prefix=$HOME/local
make wget && make && make install

(See also dpans2texi manual).

Configuring emacs

After the following piece of code is evaluated, we can get help on lisp symbols using standard slime key combination (default C-c C-d h). In order to activate info-files produced by dpans2texi insert the following into your ~/.emacs file:

elisp
(require 'info-look)
(setq Info-additional-directory-list 
  (list(substitute-in-file-name "$HOME/local/share/info")))

(with-eval-after-load "slime"
  (info-lookup-add-help
   :mode 'lisp-mode
   :regexp "[^][()'" \t\n]+"
   :ignore-case t
   :doc-spec '(("(ansicl)Symbol Index" nil nil nil)))
    
  (info-lookup-add-help
   :mode 'slime-repl-mode
   :regexp "[^][()'" \t\n]+"
   :ignore-case t
   :doc-spec '(("(ansicl)Symbol Index" nil nil nil)))

  (defvar slime-old-documentation-lookup-function
    (if (boundp 'slime-documentation-lookup-function)
	slime-documentation-lookup-function))
  
  (defun slime-ansicl-lookup (symbol-name)
    (interactive (list (slime-read-symbol-name "Symbol: ")))
    (info-lookup-symbol symbol-name 'lisp-mode))
  
  (setq slime-documentation-lookup-function 'slime-ansicl-lookup)
  (setq slime-ansicl-lookup (symbol-function 'slime-ansicl-lookup)))