From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs,gmane.emacs.mediawiki Subject: bug#18687: mw 0.1: modular MediaWiki interface for Emacs Date: Sat, 11 Oct 2014 10:55:56 +0000 Message-ID: <87r3ye3mf7.fsf@violet.siamics.net> References: <87oatpkof7.fsf@passepartout.tim-landscheidt.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1413025046 10876 80.91.229.3 (11 Oct 2014 10:57:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Oct 2014 10:57:26 +0000 (UTC) Cc: mah@everybody.org, mediawiki-el@lists.everybody.org, tim@tim-landscheidt.de To: 18687@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 11 12:57:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XcuMS-0003QU-Dq for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Oct 2014 12:57:20 +0200 Original-Received: from localhost ([::1]:53700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcuMS-0004rf-20 for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Oct 2014 06:57:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcuMK-0004rN-S5 for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 06:57:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcuMH-0006XU-2G for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 06:57:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcuMD-0006XG-Qc for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 06:57:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XcuMA-00074h-GN; Sat, 11 Oct 2014 06:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: mediawiki-el@lists.everybody.org, tim@tim-landscheidt.de, mah@everybody.org, bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Oct 2014 10:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18687 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: submit@debbugs.gnu.org X-Debbugs-Original-Xcc: mediawiki-el@lists.everybody.org, tim@tim-landscheidt.de, mah@everybody.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141302497127080 (code B ref -1); Sat, 11 Oct 2014 10:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Oct 2014 10:56:11 +0000 Original-Received: from localhost ([127.0.0.1]:40777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XcuLK-00072h-0Z for submit@debbugs.gnu.org; Sat, 11 Oct 2014 06:56:10 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:35844) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XcuLH-00072U-Bj for submit@debbugs.gnu.org; Sat, 11 Oct 2014 06:56:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=KZAavV+28Z3ATehTeX5rrNEfC92hMeCnrmc1z5IKGiQ=; b=Qc4IaZsuyYXYwWh4aTUXi4PLXg3kUMePkKaZbtxZ8gKwAUJCL9t8SsnTZ75kAq7ryUm7eJQ6w8uhyPJyyrwFxqqC+f4w3IKiQ/d2JqeG+DjHW7/WPSxHP1smOq9a34NEHeGXiZBmtV6R4n7j7TySwRUa29SKb/QfH21GjP6YNM0=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XcuLF-0003tK-0D for submit@debbugs.gnu.org; Sat, 11 Oct 2014 10:56:05 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XcuL7-0000V8-BS for submit@debbugs.gnu.org; Sat, 11 Oct 2014 17:55:57 +0700 In-Reply-To: <87oatpkof7.fsf@passepartout.tim-landscheidt.de> (Tim Landscheidt's message of "Mon, 06 Oct 2014 19:07:08 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94407 gmane.emacs.mediawiki:13 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=E2=80=99ve 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, =E2=80=9Ccheckin=E2=80=9D), 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 =E2=80=9Cmode=E2=80=9D 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=E2=80=99m 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 =E2=80=9Cpreview=E2=80=9D of the current buffer=E2=80=99s mark= up (as rendered via the MediaWiki API =E2=80=98parse=E2=80=99 call) using EWW. Composition The interface is comprised of the following individual modules (in the dependency order): =E2=80=A2 mw-api =E2=80=93 basic API functions, including mw-api-call, mw-api-adjoin, (as of yet undocumented) mw-api-get, and mw-api-token; =E2=80=A2 mw-buffer.el =E2=80=93 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; =E2=80=93 mw-buffer-associate-endpoint, mw-buffer-associate-page commands to establish such a relation; =E2=80=93 the mw-buffer-page-query function to prepare an API query parameter to select that page (or to adjoin one to the set given); =E2=80=A2 mw-info.el =E2=80=93 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; =E2=80=A2 mw-auth.el =E2=80=93 mw-auth-log-in, which authenticates the use= r on the given (via mw-buffer-endpoint-uri) MediaWiki instance; =E2=80=A2 vc-mw.el =E2=80=93 (very incomplete) MediaWiki vc.el support; pr= ovides just enough internals for C-x v v, C-x v l, and M-x vc-ediff; =E2=80=A2 mw-eww.el =E2=80=93 mw-eww-preview to preview the current buffer= (as rendered via the MediaWiki API =E2=80=98parse=E2=80=99 call) in the asso= ciated 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 =E2=80=9CQuick-start guide=E2=80=9D for its READM= E. 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=3D14719 Bugs The known deficiencies are as follows (in no particular order.) =E2=80=A2 The interface does not provide any kind of =E2=80=98mediawiki-mo= de=E2=80=99. It may be possible to re-use mediawiki-mode from [2]. (Personally, I just use fundamental-mode for now myself.) =E2=80=A2 The mw-buffer-endpoint-uri variable is /not/ declared =E2=80=9Cs= afe.=E2=80=9D 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 =E2=80=9Ctrusted.=E2=80= =9D There may also be a customizable list of =E2=80=9Ctrusted=E2=80=9D URIs,= also usable for the mw-buffer-associate-endpoint completion (should there be one.) =E2=80=A2 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. =E2=80=A2 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=E2=80=99s 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.) =E2=80=A2 After a new MediaWiki page has been created via vc.el, it=E2=80= =99s necessary to re-run M-x mw-buffer-associate-page to update the respective buffer-local variables. =E2=80=A2 There=E2=80=99s ought to be a function suitable for find-file-ho= ok that will associate the buffer with the page title (or page identifier) derived from the filename. =E2=80=A2 See README; also check the code itself for the FIXME: comments. --=20 FSF associate member #7257 np. Returning =E2=80=93 Jami Sieber =E2=80=A6 3= 013 B6A0 230E 334A