I'm translating man pages, and have run in to a few problems with Emacs.

  1. How do you specify language? (With man, it looks like this man -Lsv shutdown for the Swedish "sv" subdirectory, if available.)

  2. In the Emacs man mode, you can use N or P to jump forward or backward according to headers (in roff, they look like this: .SH). But, this doesn't work if the header includes one (or more) of the three special Swedish characters: Å, Ä, and Ö. It doesn't matter if I escape them (like this \(:A). (But they are correctly displayed.)

  3. To view a work in project, I use for example M-x man RET ./ls.1 (that is, the absolute path). This is great, because it is the same man mode as for viewing "real" manpages (those in /usr/share/man). Only, when I do some changes in the document, how do I refresh the manpage? revert-buffer says the buffer is not associated with a file (not true, but OK, I get it); M-x load-file RET seems to have lost track of the file; ... Ideas?

By the way, translating is a lot of fun!

EDIT: (see the first comment) Table

  • 4
    Woman Mode could be worth a try (M-x woman for ls, M-x woman-find-file for ls.1s absolute path); it has a woman-locale variable that might help with 1.. (As far as I could find out it fails to solve 2. and 3.; has some more features, though.)
    – sr_
    Aug 9, 2012 at 7:36
  • @sr_: Oh, didn't even know there was a second way! Certainly worth exploring. But, take a look at the dump above, Woman doesn't seem to draw tables. I think the easiest way to solve 3. is to write a small Elisp function that is specific for the man page you currently work on. That's not pretty but it is OK since it takes some time translating even a short man page. Aug 9, 2012 at 10:05
  • Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.
    – sr_
    Aug 9, 2012 at 11:21
  • 1
    As for 1., (setq Man-switches "-Lsv") Aug 9, 2012 at 23:44

1 Answer 1


How to update the man page in man page mode while editing the roff source:

;;;; MAN / man
(defvar *curr-man* "~/mansv/ls.1")

(defun edman ()
  "edit the current work-in-progress man page"
  (find-file *curr-man*) )

(defun upman () ; edit: better version of this function below
  "update the current work-in-progress man page"
      (insert-buffer-substring "*Buffer List*")
        (let ((man-buffer (format "*Man %s*" *curr-man*)))
          (if (word-search-forward man-buffer (point-max) t) ; t = nil on fail
            (kill-buffer man-buffer) ))
      (man *curr-man*)
      (kill-buffer "*Buffer List*") )))


This version of upman is hopefully more stable. Note the introducton of a new global.

(defun upman ()
  "update the current work-in-progress man page"
  (if (get-buffer *curr-man-file*) (save-buffer))
  (let ((man-buffer (format "*Man %s*" *curr-man*)))
    (if (get-buffer man-buffer) (kill-buffer man-buffer))
    (man *curr-man*)
    (edman) ))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.