Yaoddmuse

Comprehensive Emacs integration with Oddmuse wikis (like Emacswiki) which enables fast browsing, authoring and editing of wiki pages from within Emacs. All up/download commands are asynchronous for fast transfers.

Yaoddmuse stands for “Yet Another Oddmuse Mode” for Emacs. It is a rewrite of the oddmuse.el code with modularity and extensibility in mind.

Please send suggestions and bug reports to rubikitch, he’s the new maintainer. Thanks! – AndyStewart

Why yaoddmuse.el ?

  1. The goal of yaoddmuse mode is to help increase both the amount and quality of documentation and code on Emacswiki, by making it easy, quick and comfortable to contribute your ideas, edits, elisp fragments and libraries—all from within Emacs.
  2. As with oddmuse, yaoddmuse lets you use powerful features of Emacs (like dired file marking and quick load-edit-update cycles) to *make multiple edits easy.*
  3. Asynchronous processing. The default package for editing oddmuse pages, Lisp:oddmuse.el, is great for editing or posting Oddmuse wiki pages, but it handles wiki pages with synchronous processes. This means that the user has to wait for Emacs to finish loading or saving before he can do anything in emacs. ‘yaoddmuse.el’ is rewritten (using ‘url-retrieve’), which enables downloading and posting asynchronously, so you can do your work and handle wiki pages at the same time. This makes a difference when you are handling big pages or multiple pages.
  4. Advanced commands. yaoddmuse.el provides some advanced commands for fast posting of wiki pages.
  5. Better syntax highlighting. yaoddmuse.el enhances the syntax highlight features of Lisp:oddmuse.el.
  6. Compatible with Oddmuse. yaoddmuse.el has all the features of Lisp:oddmuse.el. You won’t miss your favorite features of oddmuse.el

Installation

    (require 'yaoddmuse)
You can add the following to your ~/.emacs. It updates the list of Wiki pages at start up:
     (yaoddmuse-update-pagename t)
This line is optional, since Yaoddmuse will automatically
update its list of Wiki page names when you call yaoddmuse for the first time.
The advantage of the above setup is that it avoids a delay when you first call the function.

Usage

    1. M-x yaoddmuse-edit-default RET, input page name you want edit.
    2. Yaoddmuse will download the current page content. Then edit page using Oddmuse Markup (See TextFormattingRules)
    3. Type “C-u C-c C-c” when your edits are complete.
    4. Write your summary for the modifications, typically something like “Update”.
That’s all. Yaoddmuse will view your edited page after a successful post.
    1. M-x yaoddmuse-browse-page-default RET
    2. Input page name that you want view.
If wiki page is image page, it will decode image and view it. (You can test image page: YaoddmuseExamplePicture)
Want to upload your packages to EmacsWiki fast? Do the following:
    1. C-u M-x yaoddmuse-post-library-default RET, ‘input library name’
    2. Type your summary for this post, typically something like “Created”.
Yaoddmuse will view the page after a successful library post.
Simple, no?
Upload picture or compress file directly in Emacs; you don’t need the browser anymore!
    1. C-u M-x yaoddmuse-post-file-default RET
    2. Input picture or compress file path
    3. Type page name for this post.
    4. Write your summary for the modifications.
Yaoddmuse will view page after a successful post.
Of course, yaoddmuse-post-file-default can post any type file.
Here have file type that EmacsWiki allowed upload.
It’s true, you can screenshot and then upload it. Do the following:
    1. C-u M-x yaoddmuse-post-screenshot-default RET
    2. Use mouse select region that you want screenshot
    3. Input upload page, typically something like “YaoddmuseExamplePicture”.
That’s all, Yaoddmuse will view picture page after post successful.
Cool? 😊

Command List

This is the complete command list which yaoddmuse provides:

Customize

All options below can customized by: M-x RET customize-group RET yaoddmuse RET

The local directory to store oddmuse pages. This is created if it does not exist.
Whether to associate files in “yaoddmuse-directory’ with `yaoddmuse-mode”.
You can set this value with ‘nil’ if you don’t want to associate these with `yaoddmuse-mode”.
Is alist mapping wiki names to URLs.
You can add Oddmuse wikis element in the format: (“WikiName” “WikiUrl” coding “Captcha”).
But don’t modified default element of ‘yaoddmuse-wikis’, change probably causes trouble!
The default wiki for the command “yaoddmuse-edit-default”.
User name for posting. Default is the value of “user-full-name”.
Password for posting, You only need this if you want to edit locked pages and you have an administrator password.
If non-nil, will transform image content and view it. Otherwise, don’t transform image content.
Whether display page after get.
Whether to close the edit buffer after posting a wiki page.
Whether confirmation is needed to post dired-marked files.
Some wikis, such as EmacsWiki, use a text ‘captcha’ to protect pages from being edited. This option enables a user to post to wiki pages without using the captcha. So if you edit a wiki (such as EmacsWiki), please make sure this option is “non-nil”.
When t, set all the minor mode bit to all editions.
You can customize your own advanced function for browsing wiki pages. The default is “browse-url”.
You can find my customized browse function in Lisp:yaoddmuse-extension.el
The default notify function for get/post message.
You can find my customize notify function in Lisp:yaoddmuse-extension.el
Whether to render ‘emacs-lisp-mode’ syntax highlighting when the current page is an elisp file.
If you don’t like this, change it to ‘nil’.
The default tool program for screenshot.
The default file for save screenshot.

Tips

Command ‘yaoddmuse-follow’ tries to get a valid page link around point. If it is found it loads the page for editing, otherwise it returns: “No link found at point.”
If you type “C-u” before you call this command, it will let you edit the page name before loading the page.
When you use command ‘yaoddmuse-edit’ or ‘yaoddmuse-edit-default’, it will prefer to switch edit page if already have one exist.
If you want to reload edit page forcibly, just hit “C-u” before executing the command.
Default, edit page buffer popup when current major-mode is not ‘yaoddmuse-mode’, or use switch edit page buffer when current major-mode is ‘yaoddmuse-mode’.
The command ‘yaoddmuse-revert’ reverts current edited page, without requiring wiki name or page name.
If you type “C-u” before call post command, yaoddmuse will present the page for browsing after a successful post.
The command ‘yaoddmuse-post-buffer’ posts a specified buffer to wiki. Alternately, you can use the command ‘yaoddmuse-post-current-buffer’ to post the current buffer to wiki.
The command ‘yaoddmuse-post-file’ posts a specified file to a wiki. It’s useful for fast posting when you don’t want open file.
The command ‘yaoddmuse-post-dired’ posts dired-marked files to a wiki, this command is useful when you want to update many files to the wiki.
Command ‘yaoddmuse-post-library’ and ‘yaoddmuse-post-library-default’ will post specified library to a wiki. It finds the local path automatically, if you’re feeling lazy.
By default, yaoddmuse remembers the last ‘summary’ string. If you want the same summary as the previous time, just hit RET.
You can use command ‘yaoddmuse-toggle-minor’ to toggle edit mode state, if you just do small changes, please switch to minor edits state.
By default, Yaoddmuse will notify current edit status at mode-line.
By default, when you use command ‘yaoddmuse-post-library’ and ‘yaoddmuse-post-library-default’, those commands can pick up file name around point, if it’s library name you want, just hit RET. ;)
When you use commands ‘yaoddmuse-browse-page’ or ‘yaoddmuse-browse-page-default’, it will try to pick-up page name around point.
If you post speical file, such as picture or compress file, it can encode file content before post it.
You can use command ‘yaoddmuse-redirect’ redirect page. Just input page name that you want redirect to. You need input redirect from page if current buffer not ‘yaoddmuse’ buffer.
You can use command ‘yaoddmuse-delete’ delete page. Just input page name that you want delete.
You can use command ‘yaoddmuse-insert-file-content’ insert file content. This command will try to encode special file content, such as, picture or compress file.
You can use command ‘yaoddmuse-save-as’ save special page, such as picture or compress format, and it will notify you correct suffix to save.
By default, when got image page, it will decode image and view it. You can use command ‘yaoddmuse-toggle-image-status’ to toggle image status for view different content.

Related

I recommand you integrate Yaoddmuse with Yasnippet, then you can fast insert Wiki template, see TextFormattingRules for Oddmuse Markup. :: Here have my yasnippet template code for Yaoddmuse mode.
Setup like below:
            (setq yaoddmuse-browse-function 'yaoddmuse-browse-page-in-w3m)
Setup like below:
            (setq yaoddmuse-notify-function
                  'yaoddmuse-notify-popup-window)
       (require 'todochiku)
       (setq yaoddmuse-notify-function 'yaoddmuse-todochiku)
Put Lisp:anything.el and Lisp:anything-config.el in your load-path, then add
        (require 'anything)
in your ~/.emacs
      1. You can use the command ‘anything-yaoddmuse-emacswiki-edit-or-view’ to edit or view an EmacsWiki page. If you don’t see anything, just wait for Yaoddmuse to update the list of page names (for autocomplete) and try again.
      2. You can use the command ‘anything-yaoddmuse-emacswiki-post-library’ to post a library on EmacsWiki.
      3. Or you can integrate this package with Anything, just setup like this:
            (setq anything-sources
                  (list
                   anything-c-source-yaoddmuse-emacswiki-edit-or-view
                   anything-c-source-yaoddmuse-emacswiki-post-library
                   ))
      1. When you use Anything interface, you can type “TAB” to switch second-level interface for more command for same candidate.

Screenshot

YaoddmuseShotPage
Anything_Yaoddmuse_Eidt_Or_View
Anything_Yaoddmuse_Post

Comments and discussions

I do not see why you did not send patches to OddMuse instead of “forking”. Some ideas could be contributed to OddMuse, that would be perfect.

If you see source code of oddmuse.el, you will find there have big different between oddmuse.el and yaoddmuse.el, because oddmuse.el use ‘url-retrieve-synchronous’ to handle wiki page, so it will hang emacs when it work, and fix this problem need ‘url-retrieve’ and use unique buffer to hande. And those chnage not just a patch to oddmuse.el, need rewrite all module for hande asynchronous process. And the patch’s size is bigger than size of oddmuse.el, and will make the code of oddmus.el became dirty, i need clear and module code to add new feature (like post command). So i rewrite new one. – AndyStewart

Any bug reports or advice are welcome! Please write your idea or bug below. I will add or fix it. Or mail to me. 😊 – AndyStewart


A little note on the ‘minor’ not appearing on my mode line: I am using 23.0.91. I start using ‘emacs --quick’, then I do:

(setq default-mode-line-format
      (append default-mode-line-format
	      (list "more text")))

like you do in yaoddmuse. This ain’t gonna work because default-mode-line-format ends with “-%-” which spans as far as it can. Maybe this wasn’t the case before 23 and nobody else tried yaoddmuse on 23?! Without investigating this any furthur I believe you should append to global-mode-string instead. It is part of default-mode-line-format, just before the “-%-”. You might have to make it buffer local, I do not know.

I use 23.0.91.1, i can display edit status on the mode-line, see screenshot YaoddmuseEditStatusScreenshot, i think mode-line-format is right place for update status on the mode-line, because it is buffer-local default. And have another guy send me mail for same problem, unfortunately, i haven’t find cause that those code can’t work. If someone find solution, please contact me. Thanks! – AndyStewart

A quick question: Shouldn’t ThingAtPoint be required by yaoddmuse? Without requiring thingatpt.el the function word-at-point on line 1636 results in a void-function error. Thanks! MattLundin

Yep, yaoddmuse.el need thingatpt.el for get word around current point. – AndyStewart

I am having problems trying to access a private wiki (as explained here). I get garbage for my list of possible page name completions:

Possible completions are: “-W3CDTD “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> /><link /><meta 1.0 <!DOCTYPE <html PUBLIC Required</h1><p><a Strict//EN” XHTML charset=UTF-8”/></head><body class=“error”><h1>Password

and even if I give it a valid page name I get this error: “Get page ‘HomePage’ form ‘MyWiki’ failed.” If I make the wiki public there are no problems, and if I make it private again in the same emacs session (after accessing it as a public wiki) I can still access it as normal.

Hi, I just started using yaoddmuse (again), so sorry if this is a stupid question. I just delete my old Homepage with yaoddmuse-delete. I kind of expected a way to enter a comment (like it is suggested), but there was no prompt. Probably, I had used yaoddmuse-toogle-minor previously. Is there any way to have yaoddmuse-delete always prompt me for a comment, regardless of the minor state? If there is one, is there a reason this is not default? I think no matter which wiki you edit, deleting a page demands for an explanation, no?

Is there any way to preview the on-going editing page in browser? – Kiwon Um

I’ve been thinking about that, too… and you finally made me actually do it! (-;

Try this: <http://github.com/stepnem/emacs-libraries/raw/priv/yaoddmuse.el>

It contains some other fixes, too; but I don’t use Yaoddmuse that often, and when I do, then it’s only a small part of its functionality, so it might need some testing. Comments welcome (best via e-mail or IRC).

Please, the code should contain a way for detect if the user is at a text console, like I usually do. --SuSo

Is there a way to tell Yaoddmuse to create a page upon follow if it doesn’t exist?

Some one should modify the default url of “EmacsWiki” in yaoddmuse.el , since the pages have been moved from “http://www.emacswiki.org/cgi-bin/emacs?action=browse;raw=1;id=SiteMap” to “http://www.emacswiki.org/emacs?action=browse;raw=1;id=SiteMap” – xiepan


CategoryHypermedia CategoryOddmuse