Emacs mode for man pages

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












6















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










share|improve this question



















  • 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 '12 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.

    – Emanuel Berg
    Aug 9 '12 at 10:05











  • Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

    – sr_
    Aug 9 '12 at 11:21






  • 1





    As for 1., (setq Man-switches "-Lsv")

    – Emanuel Berg
    Aug 9 '12 at 23:44
















6















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










share|improve this question



















  • 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 '12 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.

    – Emanuel Berg
    Aug 9 '12 at 10:05











  • Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

    – sr_
    Aug 9 '12 at 11:21






  • 1





    As for 1., (setq Man-switches "-Lsv")

    – Emanuel Berg
    Aug 9 '12 at 23:44














6












6








6


1






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










share|improve this question
















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







emacs man roff






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 7 at 10:10









Glorfindel

2411310




2411310










asked Aug 8 '12 at 21:35









Emanuel BergEmanuel Berg

3,67352952




3,67352952







  • 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 '12 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.

    – Emanuel Berg
    Aug 9 '12 at 10:05











  • Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

    – sr_
    Aug 9 '12 at 11:21






  • 1





    As for 1., (setq Man-switches "-Lsv")

    – Emanuel Berg
    Aug 9 '12 at 23:44













  • 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 '12 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.

    – Emanuel Berg
    Aug 9 '12 at 10:05











  • Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

    – sr_
    Aug 9 '12 at 11:21






  • 1





    As for 1., (setq Man-switches "-Lsv")

    – Emanuel Berg
    Aug 9 '12 at 23:44








4




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 '12 at 7:36





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 '12 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.

– Emanuel Berg
Aug 9 '12 at 10:05





@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.

– Emanuel Berg
Aug 9 '12 at 10:05













Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

– sr_
Aug 9 '12 at 11:21





Tables in man pages? I wasn't even aware of that possibility. Quite nice, thought.

– sr_
Aug 9 '12 at 11:21




1




1





As for 1., (setq Man-switches "-Lsv")

– Emanuel Berg
Aug 9 '12 at 23:44






As for 1., (setq Man-switches "-Lsv")

– Emanuel Berg
Aug 9 '12 at 23:44











1 Answer
1






active

oldest

votes


















2














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"
(interactive)
(find-file *curr-man*) )

(defun upman () ; edit: better version of this function below
"update the current work-in-progress man page"
(interactive)
(buffer-menu)
(revert-buffer)
(with-temp-buffer
(progn
(insert-buffer-substring "*Buffer List*")
(beginning-of-buffer)
(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*)
(edman)
(kill-buffer "*Buffer List*") )))


EDIT



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"
(interactive)
(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) ))





share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f45093%2femacs-mode-for-man-pages%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    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"
    (interactive)
    (find-file *curr-man*) )

    (defun upman () ; edit: better version of this function below
    "update the current work-in-progress man page"
    (interactive)
    (buffer-menu)
    (revert-buffer)
    (with-temp-buffer
    (progn
    (insert-buffer-substring "*Buffer List*")
    (beginning-of-buffer)
    (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*)
    (edman)
    (kill-buffer "*Buffer List*") )))


    EDIT



    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"
    (interactive)
    (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) ))





    share|improve this answer





























      2














      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"
      (interactive)
      (find-file *curr-man*) )

      (defun upman () ; edit: better version of this function below
      "update the current work-in-progress man page"
      (interactive)
      (buffer-menu)
      (revert-buffer)
      (with-temp-buffer
      (progn
      (insert-buffer-substring "*Buffer List*")
      (beginning-of-buffer)
      (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*)
      (edman)
      (kill-buffer "*Buffer List*") )))


      EDIT



      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"
      (interactive)
      (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) ))





      share|improve this answer



























        2












        2








        2







        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"
        (interactive)
        (find-file *curr-man*) )

        (defun upman () ; edit: better version of this function below
        "update the current work-in-progress man page"
        (interactive)
        (buffer-menu)
        (revert-buffer)
        (with-temp-buffer
        (progn
        (insert-buffer-substring "*Buffer List*")
        (beginning-of-buffer)
        (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*)
        (edman)
        (kill-buffer "*Buffer List*") )))


        EDIT



        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"
        (interactive)
        (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) ))





        share|improve this answer















        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"
        (interactive)
        (find-file *curr-man*) )

        (defun upman () ; edit: better version of this function below
        "update the current work-in-progress man page"
        (interactive)
        (buffer-menu)
        (revert-buffer)
        (with-temp-buffer
        (progn
        (insert-buffer-substring "*Buffer List*")
        (beginning-of-buffer)
        (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*)
        (edman)
        (kill-buffer "*Buffer List*") )))


        EDIT



        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"
        (interactive)
        (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) ))






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 11 '12 at 11:23

























        answered Aug 10 '12 at 12:49









        Emanuel BergEmanuel Berg

        3,67352952




        3,67352952



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f45093%2femacs-mode-for-man-pages%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay