Giter Site home page Giter Site logo

mediawiki-el's Introduction

Table of Contents

mediawiki.el -- Edit mediawiki sites from emacs

This version of mediawiki.el represents a merging of wikipedia-mode.el (maintained by Uwe Brauer) from EmacsWiki for its font-lock code, menu, draft mode, replying and convenience functions to produce mediawiki.el 2.0.

Installation

If you use MELPA, you can install via the M-x package-list-packages interface. This is preferrable as you will have access to updates automatically.

Otherwise, just make sure this file is in your load-path (usually ~/.emacs.d is included) and put (require 'mediawiki.el) in your ~/.emacs or ~/.emacs.d/init.el file.

Configuration and use

 M-x customize-group RET mediawiki RET
 *dink* *dink*
 M-x mediawiki-site RET Wikipedia RET

Open a wiki file: M-x mediawiki-open Save a wiki buffer: C-x C-s Save a wiki buffer with a different name: C-x C-w

About Security

Although there is a place to put your password when you customize this package, there is no need to store your password in plain text.

If mediawiki sees that the password is empty, then it will use the auth-source library to retrieve the password. This will allow you to use encryption to store your passwords.

TODO

  • Change customization to explicitly tell mediawiki.el to use the auth-source library.
  • Optionally use org-mode formatting for editing and translate that to mw
  • Move url-* methods to url-http
  • Use the MW API to support searching, etc.
  • Clean up and thoroughly test imported wikimedia.el code
  • Improve language support. Currently there is a toggle for English or German. This should probably just be replaced with the ability to use MediaWiki's i18n files in json format.

mediawiki-el's People

Contributors

hexmode avatar tobiaszawada avatar tdanckaert avatar cybershadow avatar

Stargazers

Ravioli avatar Dany Haddad avatar Siddhartha_Sarkar avatar  avatar  avatar  avatar Ashley P. avatar Jan-Peter Dhallé avatar  avatar Torbjörn Norinder avatar Claudine Chionh avatar Daniel Perez Alvarez avatar Thermosflasche avatar Daphne Preston-Kendal avatar Julien M. avatar DMz avatar  avatar Maxim Rebguns avatar Steve Simms avatar  avatar Qingshui Zheng avatar Michael McMahon avatar Sokraes avatar Guillaume Coré avatar Yukihiro Oda avatar Joseph Nuthalapati avatar Eric Gallager avatar Lionel D. Hummel avatar a13ph avatar Kazuki Yoshida avatar Spencer Baugh avatar Mario Román avatar Bill D. Strong avatar Gerd Heber avatar  avatar Christian Anders Schwarzgruber avatar Juri Grabowski avatar Chris avatar Patrick Motard avatar Spiros Boosalis avatar Sergij Boremchuk avatar Érico Nogueira Rolim avatar  avatar Bill avatar Isaac Lewis avatar  avatar Mirzhan Irkegulov avatar Amory Meltzer avatar  avatar  avatar Isaac David avatar Novak Boškov avatar Pierre Neidhardt avatar Oleg Pykhalov avatar  avatar David Faverman avatar salotz avatar Alon Tzarafi avatar Joshua Wheeler avatar David Hedlund avatar Michael Eliachevitch avatar Alad Wenter avatar Jorge Araya Navarro avatar Josef Assad avatar Meng Lu avatar  avatar

Watchers

 avatar  avatar Steve Simms avatar Meng Lu avatar James Cloos avatar Juri Grabowski avatar Alon Tzarafi avatar  avatar  avatar

mediawiki-el's Issues

Cannot save pages on MW 1.32

It seems that intoken on query is not implemented any longer, you'd need to use the token endpoint. Opening any page in a 1.32 mediawiki says I cannot edit it (even if my user definitely can).

[Minor] Suggestion to tell user when a page is successfully saved

I'd like to suggest that mediawiki give the user a message indicating that a page has been successfully saved back to the wik - if it is possible for the save function to know this with some reasonable certainty.

Background: I've had some problems saving the data back to wiki at my work, and the current text in the buffer Messages (see below) doesn't make it so clear that the save was successful. Some of the problem seem related to the WLAN, not providing proper DNS resolution on one of the networks. Another problem seem to be that 'mediawiki.el' after a little while "forgets" the password, or that the token is lost/out of date. I will report the latter problem separately when I have more data to go on.

If you could give me a hint of where to modify the code, I could do it locally and see if it makes things more clear.

Regards,
Christian

PS.
The messages today in Messages when saving (and it seems to have worked), the real URL has been elided:

Posting to: https://xxx.yyy.com/wiki/api.php
Contacting host: xxx.yyy.com:443
`'`

Error message "Bad token" received when trying to save a little while later

I'm using 'mediawiki' in Emacs to edit a wiki page on an internal wiki at work.
I am able to open the wiki page in Emacs, edit it, save it. Then I can continue to work on the page, saving it now and then. After a while, I am no longer able to save the page and instead get the following error message (from buffer Messages with debug on):

Posting to: https://xxx.yyy.com/wiki/api.php
Contacting host: xxx.yyy.com:443
Examine the ' *http xxx.yyy.com:443*-954102' buffer called from 'url-http-response-post-process:3'.
mediawiki-api-call: The server encountered an error: (badtoken) Invalid token

And below is the text from a buffer like * http xxx.yyy.com:443.

HTTP/1.1 200 OK
Date: Mon, 11 Jan 2016 17:09:35 GMT
Server: Apache
X-Content-Type-Options: nosniff
MediaWiki-API-Error: badtoken
X-Frame-Options: DENY
Cache-Control: private
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PleskLin
Content-Length: 91
Connection: close
Content-Type: text/xml; charset=utf-8

<?xml version="1.0"?><api><error code="badtoken" info="Invalid token" /></api>

Not sure what's going on, but perhaps there's a time limit on the token that allows Emacs to upload changes to a wiki page? Is there a way I can trigger 'mediawiki.el' to obtain a fresh token?

Regards,
Christian

Initial login gives deprecation warning

Got the following:

<?xml version="1.0"?><api><warnings><login xml:space="preserve">Fetching a token via
&quot;action=login&quot; is deprecated. Use &quot;action=query&amp;meta=tokens&amp;
type=login&quot; instead.</login></warnings><login result="NeedToken"
token="62d0c49ed60e69c8e475025f9b99508558794464+\" /></api>

Symbol’s function definition is void: string-trim

I use Emacs 25.1 on Windows 10.

After installing mediawiki.el from MELPA and requireing the extension, I can't do anything:

M-x mediawiki-site RET Wikipedia RET
> url-compat-retrieve: Symbol’s function definition is void: string-trim

Why?

Extra ")" on #1027

mediawiki.el won't compile because of the extra ")" on line 1027, but when its removed it can be compiled and emacs will load properly. And then I can go back to editing my mediawiki files.

Apart from that very small problem, it all works togethor very well. Thank you :)

wrong type argument stringp

Just typed "M-x mediawiki-site Wikipedia"
And I get the following debugger trace

Debugger entered--Lisp error: (wrong-type-argument stringp default)
string-match("[ \n]+\\'" default)

string-trim(default)

(concat (string-trim (if (functionp url-user-agent) (funcall url-user-agent) url-user-agent)) " mediawiki.el " mediawiki-version " \n")

(let ((url-user-agent (concat (string-trim (if (functionp url-user-agent) (funcall url-user-agent) url-user-agent)) " mediawiki.el " mediawiki-version " \n"))) (cond ((boundp (quote url-be-asynchronous)) (if callback (setq url-be-asynchronous t) (setq url-be-asynchronous nil)) (url-retrieve url t) (if (not url-be-asynchronous) (progn (let ((result ...)) result)))) (t (if callback (url-retrieve url post-process (list buffer callback cbargs)) (save-current-buffer (set-buffer (url-retrieve-synchronously url)) (funcall post-process buffer))))))

url-compat-retrieve("https://en.wikipedia.org/w/api.php" url-http-response-post-process nil nil nil) (let* ((url-request-extra-headers (if headers headers (if url-request-extra-headers (progn url-request-extra-headers)))) (boundary (int-to-string (random))) (cs (quote utf-8)) (content-type (if multipart (concat "multipart/form-data, boundary=" boundary) (format "application/x-www-form-urlencoded; charset=%s" cs))) (url-request-method "POST") (url-request-coding-system cs) (url-request-data (if multipart (mm-url-encode-multipart-form-data parameters boundary) (mm-url-encode-www-form-urlencoded (delq nil parameters))))) (mapc (function (lambda (pair) (let ((key (car pair)) (val (cdr pair))) (if (assoc key url-request-extra-headers) (setcdr (assoc key url-request-extra-headers) val) (add-to-list (quote url-request-extra-headers) (cons key val)))))) (list (cons "Connection" "close") (cons "Content-Type" content-type))) (url-compat-retrieve url url-http-post-post-process buffer callback cbargs))

url-http-post("https://en.wikipedia.org/w/api.php" (("meta" . "tokens") ("type" . "login") ("format" . "xml") ("action" . "query")))

(let* ((raw (url-http-post (mediawiki-make-api-url sitename) (append args (list (cons "format" "xml") (cons "action" action))))) (result (assoc (quote api) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...))))))) (if result nil (error "There was an error parsing the result of the API call")) (mediawiki-raise result (quote warnings) (function (lambda (label info) (message "Warning (%s) %s" label info)))) (mediawiki-raise result (quote info) (function (lambda (label info) (message "(%s) %s" label info)))) (mediawiki-raise result (quote error) (function (lambda (label info) (error "(%s) %s" label info)))) (if (cdr (cdr result)) (let ((action-res (assq (intern action) (cdr (cdr result))))) (if action-res nil (error "Didn't see action name in the result list")) action-res) t))

mediawiki-api-call("Wikipedia" "query" (("meta" . "tokens") ("type" . "login"))) (cdr (mediawiki-api-call sitename "query" (list (cons "meta" "tokens") (cons "type" type)))) (cdr (cdr (mediawiki-api-call sitename "query" (list (cons "meta" "tokens") (cons "type" type))))) (car (cdr (cdr (mediawiki-api-call sitename "query" (list (cons "meta" "tokens") (cons "type" type)))))) (cdr (car (cdr (cdr (mediawiki-api-call sitename "query" (list (cons "meta" "tokens") (cons "type" type))))))) (car (cdr (car (cdr (cdr (mediawiki-api-call sitename "query" (list (cons "meta" "tokens") (cons "type" type)))))))) (car (car (cdr (car (cdr (cdr (mediawiki-api-call sitename "query" (list ... ...)))))))) (cdr (car (car (cdr (car (cdr (cdr (mediawiki-api-call sitename "query" ...))))))))

mediawiki-site-get-token("Wikipedia" "login") (let ((--cl-token-- (mediawiki-site-get-token (symbol-value (quote --cl-sitename--)) "login"))) (progn (defvar --cl-args--) (let ((--cl-args-- (list (cons "lgname" (symbol-value ...)) (cons "lgpassword" (symbol-value ...)) (if (symbol-value ...) (progn ...)) (if (symbol-value ...) (progn ...))))) (progn (defvar --cl-result--) (let ((--cl-result-- (car ...))) (progn (if (string= ... "NeedToken") (progn ...)) (if (string= "Success" ...) (progn ...)))))))) (progn (defvar --cl-token--) (let ((--cl-token-- (mediawiki-site-get-token (symbol-value (quote --cl-sitename--)) "login"))) (progn (defvar --cl-args--) (let ((--cl-args-- (list (cons "lgname" ...) (cons "lgpassword" ...) (if ... ...) (if ... ...)))) (progn (defvar --cl-result--) (let ((--cl-result-- ...)) (progn (if ... ...) (if ... ...)))))))) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let ((--cl-token-- (mediawiki-site-get-token (symbol-value (quote --cl-sitename--)) "login"))) (progn (defvar --cl-args--) (let ((--cl-args-- (list ... ... ... ...))) (progn (defvar --cl-result--) (let (...) (progn ... ...)))))))) (progn (defvar --cl-sitename--) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let ((--cl-token-- (mediawiki-site-get-token (symbol-value ...) "login"))) (progn (defvar --cl-args--) (let ((--cl-args-- ...)) (progn (defvar --cl-result--) (let ... ...)))))))) (let ((--cl-dom-- (if (symbol-value (quote --cl-dom-loaded--)) (progn (if (string= "" (symbol-value ...)) (read-string "LDAP Domain: ") (symbol-value (quote --cl-dom-loaded--))))))) (progn (defvar --cl-sitename--) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let ((--cl-token-- (mediawiki-site-get-token ... "login"))) (progn (defvar --cl-args--) (let (...) (progn ... ...)))))))) (progn (defvar --cl-dom--) (let ((--cl-dom-- (if (symbol-value (quote --cl-dom-loaded--)) (progn (if (string= "" ...) (read-string "LDAP Domain: ") (symbol-value ...)))))) (progn (defvar --cl-sitename--) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let ((--cl-token-- ...)) (progn (defvar --cl-args--) (let ... ...)))))))) (let ((--cl-dom-loaded-- (mediawiki-site-domain sitename))) (progn (defvar --cl-dom--) (let ((--cl-dom-- (if (symbol-value (quote --cl-dom-loaded--)) (progn (if ... ... ...))))) (progn (defvar --cl-sitename--) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let (...) (progn ... ...)))))))) (progn (defvar --cl-dom-loaded--) (let ((--cl-dom-loaded-- (mediawiki-site-domain sitename))) (progn (defvar --cl-dom--) (let ((--cl-dom-- (if (symbol-value ...) (progn ...)))) (progn (defvar --cl-sitename--) (let ((--cl-sitename-- sitename)) (progn (defvar --cl-token--) (let ... ...))))))))
(let ((--cl-pass-- (or (mediawiki-site-password sitename) password (read-passwd "Password: ")))) (progn (defvar --cl-dom-loaded--) (let ((--cl-dom-loaded-- (mediawiki-site-domain sitename))) (progn (defvar --cl-dom--) (let ((--cl-dom-- (if ... ...))) (progn (defvar --cl-sitename--) (let (...) (progn ... ...)))))))) (progn (defvar --cl-pass--) (let ((--cl-pass-- (or (mediawiki-site-password sitename) password (read-passwd "Password: ")))) (progn (defvar --cl-dom-loaded--) (let ((--cl-dom-loaded-- (mediawiki-site-domain sitename))) (progn (defvar --cl-dom--) (let ((--cl-dom-- ...)) (progn (defvar --cl-sitename--) (let ... ...))))))))
(let ((--cl-user-- (or (mediawiki-site-username sitename) username (read-string "Username: ")))) (progn (defvar --cl-pass--) (let ((--cl-pass-- (or (mediawiki-site-password sitename) password (read-passwd "Password: ")))) (progn (defvar --cl-dom-loaded--) (let ((--cl-dom-loaded-- (mediawiki-site-domain sitename))) (progn (defvar --cl-dom--) (let (...) (progn ... ...)))))))) (progn (defvar --cl-user--) (let ((--cl-user-- (or (mediawiki-site-username sitename) username (read-string "Username: ")))) (progn (defvar --cl-pass--) (let ((--cl-pass-- (or (mediawiki-site-password sitename) password (read-passwd "Password: ")))) (progn (defvar --cl-dom-loaded--) (let ((--cl-dom-loaded-- ...)) (progn (defvar --cl-dom--) (let ... ...))))))))

mediawiki-do-login("Wikipedia") (setq mediawiki-site (mediawiki-do-login site)) (progn (setq mediawiki-site (mediawiki-do-login site))) (if (or (eq nil mediawiki-site) (not (string-equal site mediawiki-site))) (progn (setq mediawiki-site (mediawiki-do-login site))))

mediawiki-site() funcall-interactively(mediawiki-site) call-interactively(mediawiki-site record nil)

command-execute(mediawiki-site record)
execute-extended-command(nil "mediawiki-site" "mediawiki-si") funcall-interactively(execute-extended-command nil "mediawiki-site" "mediawiki-si") call-interactively(execute-extended-command nil nil)

command-execute(execute-extended-command)

mediawiki-site not found

1: I installed ELPA package successfully with

M-x package-install RET mediawiki RET

2: Configured .emacs (with my proper username and password that I use on ArchWiki):

(setq mediawiki-site-alist
(append '(("ArchWiki" "https://wiki.archlinux.org/" "username" "password" "Main page"))
mediawiki-site-alist))

3: Restarted Emacs

4: M-x mediawiki TAB doesn't list mediawiki-site described on mediawiki-el, only:

mediawiki-draft
mediawiki-draft-buffer
mediawiki-draft-page

What am I doing wrong?

Warn when closing modified buffers

Normally emacs will ask for confirmation if one tries to close a buffer that hasn't been saved. I imagine that this feature is dependent on major mode, because Mediawiki buffers don't do that.

What would it take to implement this? mediawiki-reload could also benefit from it, since it currently overrides everything, including undo history.

Also, is there a way to make a buffer's content persist in my desktop session? It doesn't have to reestablish sessions automatically, just the text.

(readapidenied) error with all accounts

Hello!

I have an Ubuntu 20.04 server with wikimedia 1.31.7. All installed via repositories with default options and configuration files.
I configured LDAP authentication on this server with the PluggableAuth, LDAPPROVIDER, LDAPAuthentication2, LDAPGroups and LDAPAuthorization plugins.
Everything is working correctly, if I test the API access through the CLI with the curl command and my LDAP credentials I get the correct answer.
But if I try to use emacs on my computer with mediawiki-mode I get the error "(readapidenied) You need to read permission to use this module."

The setup on my computer is:

  • Ubuntu 20.04;
  • Emacs 26.3 (Ubuntu repo);
  • mediawiki 2.3.1 (elpa repo);

".emacs" fragment:

'(mediawiki-site-alist
(quote
(("wiki-example" "https://wiki.addresexample.com" "user.example" "" nil ""))))

auth not working with .authinfo or .authinfo.gpg

mediawiki.el not using .authinfo and .authinfo.gpg to authenticate for empty passwords.

From the README:

If mediawiki sees that the password is empty, then it will use the auth-source library to retrieve the password. This will allow you to use encryption to store your passwords.

#~/.emacs
'(mediawiki-site-alist
   (quote(("mywiki" "https://mywiki.fqdn/" "myuser" "" "local" "Main Page")))
   )

#~/.authinfo.gpg
machine mywiki.fqdn login myuser password "mypassword"

Is this a properly formatted example for mediawiki.el to accept it? I've also tried adding https (443) to '(auth-source-protocols)

Tested with both .authinfo.gpg and .authinfo with emacs properly configured (e.g. authinfo.gpg works for tramp, etc.). I also have the following in my .emacs file:

#~/.emacs
(require 'auth-source)
(require 'mediawiki)

Using version 20160902.827 (melpa). Anyway, thanks for the excellent mode. Glad to be editing wikipedia pages in emacs.

Errors while saving should be shown to the user (e.g. "Need an edit token", "Action 'edit' is not allowed for the current user")

Hi,
I'm trying to get mediawiki-el working in Emacs with my company's internal wiki. I've been able to open/edit/save a page using the mediawiki mode at e.g. the site wikemacs.org. However, when I try it on our company wiki, saving a modified wiki page fails with the following failure message (as seen from buffer messages)

  mediawiki-save-page: Need an edit token!

Notes:

  • The company wiki connects through an HTTPS-address.
  • After entering my password I am able to open a wiki page from Emacs and see the source of the wiki page.
  • The error occurs when I try to use e.g. 'C-x C-s', i.e. 'M-x mediawiki-save'
  • Unsure if it matters, but the wiki server doesn't have a proper certificate, so TLS connection tries a few different approaches before it works. See messages below.
  • We have set the following to configuration variables to true:
    • $wgEnableAPI
    • $wgEnableWriteAPI

Any help is appreciated, and please let me know if I should be using a different forum.
/Christian

Further down is an excerpt from the buffer messages when doing 'M-x mediawiki-site'. I've replaced the real URL with 'xxx.yyy.com' and e.g. the URL for the main wiki page is as follows:

    https://xxx.yyy.com/wiki/index.php?title=Main_Page

Here is the excerpt from messages:

Posting to: https://xxx.yyy.com/wiki/api.php
Contacting host: xxx.yyy.com:443
Opening TLS connection to `xxx.yyy.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 xxx.yyy.com'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 xxx.yyy.com --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect xxx.yyy.com:443 -no_ssl2 -ign_eof'...done
Opening TLS connection to `xxx.yyy.com'...done

url-http: Could not create connection to labs.profoto.com:443

Hi Mark,

I am able to access the internal wiki of my office from my Mac as well as from Ubuntu.
From Windows 7 I am only able to open and edit e.g. the page 'Scratch Buffer' on http://wikemacs.org, so 'mediawiki' is at least basically installed. However, when I try to open a page from my work wiki, whose URL I'll denote: https://xxx.yyy.com/wiki/, emacs/mediawiki fails to create a connection.

Specifically, when doing 'M-x mediawiki-site xxx', I get the following from the buffer Messages:

Posting to: https://xxx.yyy.com/wiki/api.php
Contacting host: xxx.yyy.com:443
gnutls.c: [1] (Emacs) GnuTLS library not found
Opening TLS connection to `xxx.yyy.com'...
Opening TLS connection with `gnutls-cli --insecure -p 443 xxx.yyy.com'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 xxx.yyy.com --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect xxx.yyy.com:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `xxx.yyy.com'...failed
url-http: Could not create connection to xxx.yyy.com:443

I then tried the same after enabling debug messages, i.e. doing M-x customize-variable mediawiki-debug and setting the variable to non-nil. Then I re-ran 'M-x mediawiki ...' and expected to get some buffers called e.g. ' *htttp ....', but they're not created. I assume it's because the HTTPS connection isn't working properly.

Perhaps I don't easily have SSL support when on Windows 7? (I do have PuTTy and Git bash installed, maybe I can make Emacs use their libs somehow).

Best regards,
Christian

PS. It's not necessary for me to get 'mediawiki' working from Windows, but I thought why not see if I can get it working from all three platforms.

save-metadata error

I'm getting an error trying to connect to any wikipedia article. The debugger says:

Posting to: http://en.wikipedia.org/w/api.php
Contacting host: en.wikipedia.org:80
Examine the ' http en.wikipedia.org:80-614858' buffer called from 'url-http-response-post-process:3'.
mediawiki-save-metadata: Wrong type argument: listp, 0

This happens no matter how I configure the Mediawiki Site alist.

Get empty buffer when trying to edit wikipedia page

When I try to edit a wikipedia page using mediawiki-open I am presented with an empty buffer.
I am using version 20200718.1529 from melpa, and I followed the instructions in the mediawiki.el file documentation. I have checked that my username and password are correct.

(readapidenied) error while running as non-admin account

I have private instance of Mediawiki running as docker container and have list of users authenticated by LDAP. While in configuration have credentials for embedden admin account I can authenticate and use mode to edit pages, but when I change credentials on my user which is also in same permission groups as admin and I try connect to my wiki I receive an error: (readapidenied) You need read permission to use this module.
How can I fix this? Is that global configurations of my wiki in LocalSettings.php?

Command 'mediawiki-reload' (M-g) fails with 'readapidenied' after error "Bad token" (#7) occurs.

This is issue was noted while trying to use a proposed workaround for issue #7.

Situation:

  • As from #7: Editing a wiki page in Emacs, saving fails after a while ("Bad token")
  • Attempting the workaround 'mediawiki-reload' (M-g) to reload the buffer

The problem is that the reload fails with the error 'readapidenied'. I've attached the content of the debug buffer at the end, here's the relevant part from buffer Messages:

Posting to: https://xxx.yyy.com/wiki/api.php
Contacting host: xxx.yyy.com:443
Examine the ' *http xxx.yyy.com:443*-986828' buffer called from 'url-http-response-post-process:3'.
mediawiki-api-call: The server encountered an error: (readapidenied) You need read permission to use this module

If I at this point try to use 'mediawiki-site' to connect to my wiki, it fails with 'readapidenied'.
However, if I connect to a different wiki, e.g. wikipedia, and then again connects to my wiki it works.

Any suggestion on how to troubleshoot this further?

Regards,
Christian

Below the content of the debug buffer:

HTTP/1.1 200 OK
Date: Mon, 18 Jan 2016 10:08:01 GMT
Server: Apache
X-Content-Type-Options: nosniff
MediaWiki-API-Error: readapidenied
X-Frame-Options: DENY
Cache-Control: private
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PleskLin
Content-Length: 114
Connection: close
Content-Type: text/xml; charset=utf-8

<?xml version="1.0"?><api><error code="readapidenied" info="You need read permission to use this module" /></api>

First page setup doesn't work

TLDR: mediawiki-site always lead to Main Page even when there is different config (which in my case is empty page because I use wiki in different language)

I tried change it via customize-group and use-package.
My current config:

(use-package mediawiki
  :config
  (setq mediawiki-site-alist
        '(("IT Wiki" "https://my.local.wiki/" "ao" "VerySecurePwd" nil "Random"))))

nodename nor servname provided, or not known

Sorry, this should be easy, but somehow I'm not figuring it out.
My media wiki site is at elliott.io, and it keeps trying to contact elliott.ioapi.php instead of elliott.io/api.php (I'm assuming this would be the correct URL).

I've tried using quotes in the easy-configure page, and also trying two trailing '/' with no success.

Basic usage

I am looking to write a single basic Wiki page, let's say called Some Topic.

I want to use mediawiki-mode to give me the appropriate formatting shortcuts, and the ability to save a draft buffer to some directory on my computer (say ~/drafts/some_topic.wiki). I am not a power-wiki user, so don't have much interest right now in the deeper functionality of this mode just yet.

How would I go about creating this draft file, and then probably just copy-pasting the contents of the buffer into the wiki's web-based editor?

Stomps all over the local keymap if outline-minor-mode is enabled (or disabled)

(add-hook 'outline-minor-mode-hook 'mediawiki-outline-magic-keys) is really bad.

mediawiki-outline-magic-keys calls local-set-key for a bunch of key sequences. That's usually the major mode keymap, which is shared amongst all buffers in that mode whether or not outline-minor-mode (let alone mediawiki-mode) is enabled in any given buffer, and which persists for future buffers using that major mode as well.

And because the global outline-minor-mode-hook was used, this clobbering happens again in future, even if you'd re-bound the keys manually, until you figure out what was causing it.

And this all happens from simply loading mediawiki.el.

I suggest creating a new buffer-local minor mode for the desired key bindings, and then only enabling that mode in the specific buffers where you want it.

Failures should be prominently presented

Got the following:

<?xml version="1.0"?>
<api><login result="Failed" reason="The supplied credentials could not be authenticated." /></api>

And didn't know till edits didn't work.

HTTPS breaking mediawiki.el?

Haven't been able to connect with mediawiki.el since July. Behind the proxy at work I get:

  Error: 403, Insecure Request Forbidden - use HTTPS - https://lists.wikimedia.org/pipermail/mediawiki-api-announce/2016-May/000110.html

Which tells us:

TL;DR:

  • All access to Wikimedia production sites/APIs should use https://
    URLs, not http:// -- your bot/tool will break in the near future if it
    does not!
  • 2016-06-12 - insecure access is unsupported; starting on this date
    we plan to break (deny with 403) 10% of all insecure requests randomly
    as a wake-up call.
  • 2016-07-12 - we plan to break all insecure requests.

I tried changing all http manually to https in the source, but then I get:

 The plain HTTP request was sent to HTTPS port

When I try to connect at home (with no proxy) it just hangs, whether I use http (Contacting host: en.wikipedia.org:80 ...) or https (Contacting host: en.wikipedia.org:443 ...)

Use newer API with rvslots

Messages are sent from mw.o:

Because "rvslots" was not specified, a legacy format has been used for the output.
This format is deprecated, and in the future the new format will always be used.

Can't open wiki at url with specified port

Trying to open a wiki with an url that contains a port specification fails:

Example:

(setq mediawiki-site-alist '(
   ("demo" "http://demo:8080" "user" "password" "Main Page")))
(mediawiki-site "demo")

Fails with the following messages:

Posting to: http://demo:8080api.php
Contacting host: demo%3a8080api.php:80
open-network-stream: demo%3a8080api.php/80 Name or service not known
Mark set 

It's apparent that the URI escaping is taking place on the wrong level in the code.

Emacs 27: Symbol's value as variable is void: url-http-referer

Problem

I'm getting this error when loading mediawiki-el with (require 'mediawiki):

Warning (initialization): An error occurred while loading ‘/home/tastytea/.emacs.d/init.el’:

Symbol's value as variable is void: url-http-referer

I'm not getting the error with Emacs 26.3.

Environment info

  • Emacs 27.0.50 from 2019-12-23 (Gentoo package) / Emacs 27.0.90.
  • mediawiki.el installed with MELPA (vcs-version).

Minimal init.el

Assuming mediawiki.el is installed with MELPA.

(package-initialize)
(require 'mediawiki)

Debug output

Acquired with emacs --debug-init.

Debugger entered--Lisp error: (void-variable url-http-referer)
  url-http-create-request()
  byte-code("\306\307!\210\306\310!\210\306\311!\210\306\312!\210\306\313!\210\314\315!\204\37\0\316\315\317\"\210\314\320!\204*\0\316\320\321\"\210\314\322!\2045\0\316\322..." [url-mime-charset-string url-http-proxy url-http-extra-headers url-extensions-header url-http-attempt-keepalives url-http-method require url-http mml mm-url ring subr-x fboundp url-bit-for-url defalias #f(compiled-function (method lookfor url) #<bytecode 0x1593d4cbb4ad>) url-user-for-url #f(compiled-function (url) #<bytecode 0x1593d4cbb4e9>) url-password-for-url #f(compiled-function (url) #<bytecode 0x1593d4cbb525>) url-http-create-request url-generic-parse-url "http://example.com/" "test" "1.0" nil "GET / HTTP/1.0\15\nMIME-Version: 1.0\15\nConnection: clo..." #f(compiled-function (&optional ref-url) #<bytecode 0x1593d4cbb601>) mm-url-encode-multipart-form-data #f(compiled-function (pairs &optional boundary) #<bytecode 0x1593d4cbb651>) assoc-string #f(compiled-function (key list &optional case-fold) #<bytecode 0x1593d4cbb669>) url-http-version url-http-data url-http-target-url] 9)
  #<subr require>(mediawiki)
  apply(#<subr require> mediawiki)
  require(mediawiki)
  eval-buffer(#<buffer  *load*-377820> nil "/home/tastytea/.emacs.d/init.d/text/misc.el" nil t)  ; Reading at buffer position 1150
  load-with-code-conversion("/home/tastytea/.emacs.d/init.d/text/misc.el" "/home/tastytea/.emacs.d/init.d/text/misc.el" nil t)
  #<subr require>(text/misc)
  apply(#<subr require> text/misc)
  require(text/misc)
  eval-buffer(#<buffer  *load*> nil "/home/tastytea/.emacs.d/init.el" nil t)  ; Reading at buffer position 1024
  load-with-code-conversion("/home/tastytea/.emacs.d/init.el" "/home/tastytea/.emacs.d/init.el" t t)
  load("/home/tastytea/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1593d400c4bd>) #f(compiled-function () #<bytecode 0x1593d400c4d1>) t)
  command-line()
  normal-top-level()

Mediawiki mode stopped working after upgrading to the latest 20150403 from Melpa

In Emacs 24.3.1 or the newest 24.5, I upgraded Mediawiki package to the latest version, 20150403... from Melpa, using the package manager. After restarting, I found that I can't access remote Mediawiki sites any more, after inputting user name and password as usual, I got a

Wrong type argument: listp, 0
error in the mini buffer.

See http://emacs.stackexchange.com/questions/12639/mediawiki-mode-stopped-working-after-upgrading-to-the-latest-20150403 for details.

Dashes

Whenever a page title contains dashes, e.g., Hindu-Arabic numeral system, where the "-" is supposed to be an en dash, I can't get mediawiki-open to work. I suppose it is some character encoding problem.
Using Gnu Emacs 24.5 on Windows PC. Version of mediawiki is 2.2.3. -- Kautilya3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.