bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18687: mw 0.1: modular MediaWiki interface for Emacs


From: Ivan Shmakov
Subject: bug#18687: mw 0.1: modular MediaWiki interface for Emacs
Date: Sat, 11 Oct 2014 10:55:56 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Package:  emacs
Severity: wishlist
X-Debbugs-Cc: mediawiki-el@lists.everybody.org, tim@tim-landscheidt.de, 
mah@everybody.org

        [This is a follow-up to a recent discussion at the mediawiki-el@
        mailing list.  Cc: to the list and, just in case it fails, both
        to the original poster and to the mediawiki.el maintainer.]

        I hereby request that my MW modular MediaWiki interface for
        Emacs [1] be reviewed for inclusion into Emacs.

        The interface is inspired by the mediawiki.el [2] module by Mark
        A. Hershberger et al, but /should not/ contain any actual code
        from there, and is not intended to be compatible.  Still, I’ve
        worked with mediawiki.el for quite some time, and at the least
        vc-mw-buffer-checkin looks a bit similar to mediawiki-save-page.
        Thus, it makes sense to check the rest of the code for any
        (non-trivial) code that might accidently got written close
        enough to that of mediawiki.el to require a rewrite for
        copyright reasons.

[1] http://am-1.org/~ivan/packages-el/mw-0.1.tar
    http://am-1.org/~ivan/packages-el/mw-0.1.tar.sig
[2] https://launchpad.net/mediawiki-el


    Features

        The package already allows for the use of the usual vc.el
        C-x v v (IOW, “checkin”), C-x v l (vc-print-log), and
        M-x vc-ediff (which could then be used to check a revision out)
        commands on buffers (files) associated with MediaWiki pages.
        Contrary to mediawiki.el, however, this package provides /no/
        markup-specific “mode” of any kind.

        The buffer (file) to page associations will be preserved in the
        .emacs.desktop file (if one is used.)

        The M-x mw-auth-log-in command uses auth-source-search.
        (Although that code should be reviewed for correctness, as I’m
        not familiar with auth-source.el at all.)

        Assuming some effort on the part of the user, M-x mw-eww-preview
        will show a “preview” of the current buffer’s markup
        (as rendered via the MediaWiki API ‘parse’ call) using EWW.


    Composition

        The interface is comprised of the following individual modules
        (in the dependency order):

        • mw-api – basic API functions, including mw-api-call,
          mw-api-adjoin, (as of yet undocumented) mw-api-get, and
          mw-api-token;

        • mw-buffer.el

          – the mw-buffer-endpoint-uri, mw-buffer-page-id,
            mw-buffer-page-revision, and mw-buffer-page-title
            buffer-local variables, associating the buffer with a
            MediaWiki instance, and possibly a specific page there;

          – mw-buffer-associate-endpoint, mw-buffer-associate-page
            commands to establish such a relation;

          – the mw-buffer-page-query function to prepare an API query
            parameter to select that page (or to adjoin one to the set
            given);

        • mw-info.el – the mw-info-describe-user, mw-info-describe-page
          commands; and the (as of yet undocumented) mw-info-describe-1
          function, also used by mw-auth-log-in;

        • mw-auth.el – mw-auth-log-in, which authenticates the user on
          the given (via mw-buffer-endpoint-uri) MediaWiki instance;

        • vc-mw.el – (very incomplete) MediaWiki vc.el support; provides
          just enough internals for C-x v v, C-x v l, and M-x vc-ediff;

        • mw-eww.el – mw-eww-preview to preview the current buffer (as
          rendered via the MediaWiki API ‘parse’ call) in the associated
          EWW buffer; at the very least, it will require the patch from
          http://debbugs.gnu.org/16211; (I have only tested it with my
          own private version of EWW as of yet, however.)

        The package comes with a “Quick-start guide” for its README.
        The Russian version is also available from [3].  (The page also
        served as a test for this code.)

[3] https://ru.wikibooks.org/wiki/?curid=14719


    Bugs

        The known deficiencies are as follows (in no particular order.)

        • The interface does not provide any kind of ‘mediawiki-mode’.
          It may be possible to re-use mediawiki-mode from [2].
          (Personally, I just use fundamental-mode for now myself.)

        • The mw-buffer-endpoint-uri variable is /not/ declared “safe.”
          The use of vc.el facilities may result in unexpected API
          calls, so it makes sense to leave it to the user as to what
          specific MediaWiki API endpoint URIs to consider “trusted.”

          There may also be a customizable list of “trusted” URIs, also
          usable for the mw-buffer-associate-endpoint completion (should
          there be one.)

        • The mw-auth-log-in command currently writes the password to
          the *MediaWiki* buffer in the plain, which is intended mainly
          as a debugging aid.  The user should take care to kill the
          buffer when not needed.

        • The code which is intended to obtain edit tokens may be broken
          (it may be related to some recent MediaWiki changes.)  If the
          regular vc.el facilities fail to get a suitable edit token,
          try evaluating (M-:) the following form in the page’s buffer:

            (mw-api-call mw-buffer-endpoint-uri
                         "query" '(("meta" . "tokens") ("type" . "csrf")))

          (The README suggest another form, which, however, gets the
          token /as already seen/ in the MediaWiki responses.  It does
          not actually /request/ the token from MediaWiki.)

        • After a new MediaWiki page has been created via vc.el, it’s
          necessary to re-run M-x mw-buffer-associate-page to update the
          respective buffer-local variables.

        • There’s ought to be a function suitable for find-file-hook
          that will associate the buffer with the page title (or page
          identifier) derived from the filename.

        • See README; also check the code itself for the FIXME:
          comments.

-- 
FSF associate member #7257  np. Returning – Jami Sieber … 3013 B6A0 230E 334A





reply via email to

[Prev in Thread] Current Thread [Next in Thread]