Editing wiki pages

2018-03-30: Much of the prior information on this page was wrong or out-of-date. As of today, editing this wiki and wikipedia using the basic emacs-w3m package was straightforward and required no special settings, functions, or additional packages. It just worked™.

Other packages for editing wikis


As of 2013, package WikiRemote is abandonware, in favor of SimpleWikiEditMode.

The final version of WikiRemote includes the function ‘wiki-remote-get-w3m’. Call it to edit the wiki page you are currently visiting. Here’s an example which allows you to hit ‘e’ to edit the page you are currently browsing.

 (autoload 'wiki-remote-get-w3m "wiki-remote"
   "Edit wiki pages currently visited using w3m." t)
 (add-hook 'w3m-mode-hook
	   (lambda ()
	     (define-key w3m-mode-map "e" 
	       (lambda ()
		 (condition-case nil
		   (error (w3m-edit-current-url)))))))

Be sure to look at the customizations of WThreeM for the w3m-form-input-textarea-mode-hook.

Oddmuse mode

See the OddmuseMode page.

Generic jumping to Wiki-like Pages

The following defun can be used to quickly go to specific pages of a Wiki.

 (defvar dka-w3m-wikis
  '(("lathi" "http://www.lathi.net/twiki-bin/view/Main/" "WebHome")
    ("emacs"  "http://www.emacswiki.org/cgi-bin/wiki.pl?" "RecentChanges")
    ("google" "http://www.google.com/search?q=" "")
    ("debian" "http://wiki.debian.net/" "")))

 (defun dka-w3m-goto-wiki ()
  (let ((wiki-topic (read-input "Wiki:Topic? "))
        topic wiki wiki-list)
    (message wiki-topic)
    (if (string-match "\\(.*\\):\\(.*\\)" wiki-topic)
        (setq wiki (match-string 1 wiki-topic) 
              topic (match-string 2 wiki-topic)
              wiki-list (assoc wiki dka-w3m-wikis))
      (error "Must specify a wiki name and topic (Wiki:TopicName)"))
    (unless wiki-list
      (error (format "\"%s\" is not a defined wiki" wiki)))
    (unless topic
      (setq topic (nth 2 wiki-list)))
    (w3m-goto-url (concat (nth 1 wiki-list) topic))))

Information re: specific wikis

This wiki (emacswiki)

Here’s how I performed this edit:

1. Ensure variable w3m-use-cookies is non-nil. This is the default setting.

2. Navigate to and click on the “Edit this page” link at the bottom of the page.

3. Navigate to the form and press ENTER for emacs-w3m to create an edit window with the form text.

4. When you have completed your edit, press C-c C-c to exit the edit window.

5. Navigate to the other form fields in order to enter an edit summary, answer the security question, optionally enter your user-name.

6. Click on the link to either preview your edit or submit it.

Searching emacswiki

Any web site search can be added to emacs-w3m by adding an entry to the variable 'w3m-search-engine-alist. Here’s an example for this wiki:

   (add-to-list 'w3m-search-engine-alist
		'("emacs-wiki" "http://www.emacswiki.org/cgi-bin/wiki.pl?search=%s"))


CGI::Kwiki (http://kwiki.org/) pages can be edited simply with WThreeM’s form support and some help from LongLines mode and RefillMode. A few customizations are in order:

    (setq w3m-form-input-textarea-buffer-lines 50
            (lambda () (save-excursion
                         (goto-char (point-min))
                         (while (search-forward (string 13) nil t)
                           (replace-match "" nil t))))
          w3m-form-input-textarea-set-hook '(longlines-mode))

CategoryHypermedia WThreeM