Tips

<< FAQ | Pages | URI transforms >>


Tips for working with pmwiki-mode and Emacs

This page is a compilation of tips for working with a PmWiki-site using pmwiki-mode for Emacs.

Manually open a browsed page in Emacs

Preparations:
  1. Map a keyboard shortcut in your browser that copies the URI of the current window, say M-t (take address)
  2. The command pmwiki-open (C-c C-o in pmwiki-mode) can take a URI as argument for what page to open.

Combine the above as follows

  1. First use M-t in the browser to copy the URI
  2. Then do C-c C-o in Emacs followed by C-y to paste the URI.
    Voila, a way to quickly open a browsed page in Emacs for editing.

Automatically open a browsed page in Emacs

This tip describes how you can set up your system so that a single keypress in the browser Opera opens the current webpage for editing in Emacs using pmwiki-mode.

Requirements:
  • Opera — though something similar might work for other browsers.
  • The Emacs package gnuserv
Preparations:
  • Install gnuserv.
    • Start Emacs
    • Set the Emacs to receive commands by executing: M-x gnuserv-start
      (This is not necessary if you made Emacs do this automatically when started)
    • Verify that gnuserv works, for instance by executing this command:
    gnuclient -batch -eval '(+ 1 2)'
    If everything works, then the prompt should now show: 3
  • Customize a keyboard shortcut (e.g. C-e if you don't use Opera's mail software) in Opera to do the following:
	Copy document address & Execute program, "wiki-open.sh --client", "%c"
Usage:
  • Start Emacs and execute M-x gnuserv-start (this prepares Emacs for receiving commands via gnuserv).
  • Go to Opera and browse to the page of your interest, then press C-e to open that page for editing in Emacs.

Mozilla and Firefox

Mozilla has no built-in way to pass the current URL to other applications. However, it can be enhanced by plugins which offer this functionality.

  • Install gnuserv as described above.
  • Create a batch script named emacs-pmwiki-helper.bat in the gnuserv folder with the following content:
        C:\home\.elisp\gnuserv\gnuclientw.exe -q -e (my-pmwiki-opener \"%*\")
  • Adjust the path to your configuration. The path must be absolute.
  • For Linux, a similar shell script is necessary.
  • Install Launchy.
  • Create a file named launchy.xml in the chrome sub-folder of your Mozilla profile directory with the following content:
        <?xml version="1.0" encoding="UTF-8"?>
        <configurations xmlns="http://launchy.mozdev.org/configurations">
          <application>
            <label>Emacs PmWiki Helper</label>
            <type>1</type>
            <command>C:\home\.elisp\gnuserv\emacs-pmwiki-helper.bat</command>
            <arguments></arguments>
          </application>
        </configurations>
  • Adjust the <command> tag to your configuration. The path must be absolute.
  • Start Emacs. Make sure gnuserv is running.
  • (Re)start Mozilla. Right-click on the page and choose from the Launchy menu Open in Emacs PmWiki Helper.