Jump to content

Wikipedia talk:Wikipedia-mode.el

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Math/TeX handling

[edit]

It would be useful to have some sort of processing of math environment. I see some of form of that is on your todo list. --CSTAR 01:54, 19 Sep 2004 (UTC)

Wrong place for wikipedia-mode.el

[edit]

Why on earth is the text about Wikipedia-mode.el in the namespace "Image"? I tried to move this from Image:Wikipedia-mode.el to Wikipedia:Wikipedia-mode.el but the system does not let me. --Oleg Alexandrov 23:23, 7 Jan 2005 (UTC)

XEmacs compatibility

[edit]

I'm using XEmacs version 21.5.22 of February 2005 (+CVS-20050913). Wikipedia mode seems to mostly work, except that whenever it is loaded, I get the following error:

(1) (file-mode-spec/warning) Error in File mode specification: Symbol's value as variable is void: menu-bar-mode

Backtrace follows:

  (if menu-bar-mode (progn (set (make-local-variable (quote imenu-generic-expression)) wikipedia-imenu-generic-expression) (imenu-add-to-menubar "Contents")))
  (when menu-bar-mode (set (make-local-variable (quote imenu-generic-expression)) wikipedia-imenu-generic-expression) (imenu-add-to-menubar "Contents"))
  # bind (delay-mode-hooks)
  (let ((delay-mode-hooks t)) (text-mode) (setq major-mode (quote wikipedia-mode)) (setq mode-name "Wikipedia") (progn (if (get (quote text-mode) (quote mode-class)) (put (quote wikipedia-mode) (quote mode-class) (get (quote text-mode) (quote mode-class)))) (unless (keymap-parent wikipedia-mode-map) (set-keymap-parents wikipedia-mode-map (list (current-local-map)))) (derived-mode-merge-syntax-tables (syntax-table) wikipedia-mode-syntax-table)) (use-local-map wikipedia-mode-map) (set-syntax-table wikipedia-mode-syntax-table) (setq local-abbrev-table wikipedia-mode-abbrev-table) (set (make-local-variable (quote adaptive-fill-regexp)) "[ ]*") (set (make-local-variable (quote comment-start-skip)) "\\(?:<!\\)?-- *") (set (make-local-variable (quote comment-end-skip)) " *--\\([ \n]*>\\)?") (set (make-local-variable (quote comment-start)) "<!-- ") (set (make-local-variable (quote comment-end)) " -->") (set (make-local-variable (quote paragraph-start)) "\\*\\| \\|#\\|;\\|:\\||\\|!\\|$") (set (make-local-variable (quote sentence-end-double-space)) nil) (set (make-local-variable (quote font-lock-multiline)) t) (set (make-local-variable (quote font-lock-defaults)) (quote (wikipedia-font-lock-keywords t nil nil nil))) (set (make-local-variable (quote fill-nobreak-predicate)) (quote wikipedia-link-fill-nobreak-p)) (set (make-local-variable (quote auto-fill-inhibit-regexp)) "^[ *#:|;]") (set (make-local-variable (quote outline-regexp)) "==+") (set (make-local-variable (quote outline-minor-mode-prefix)) "�") (when menu-bar-mode (set (make-local-variable (quote imenu-generic-expression)) wikipedia-imenu-generic-expression) (imenu-add-to-menubar "Contents")) (modify-syntax-entry ?< "(>" wikipedia-mode-syntax-table) (modify-syntax-entry ?> ")<" wikipedia-mode-syntax-table) (define-key wikipedia-mode-map "î" (quote wikipedia-next-header)) (define-key wikipedia-mode-map "ð" (quote wikipedia-prev-header)) (define-key wikipedia-mode-map [M-down] (quote wikipedia-next-header)) (define-key wikipedia-mode-map [M-up] (quote wikipedia-prev-header)) (define-key wikipedia-mode-map "\n" (quote wikipedia-terminate-paragraph)) (define-key wikipedia-mode-map [(control return)] (quote wikipedia-terminate-paragraph)) (let ((map (make-sparse-keymap "Wikipedia"))) (define-key wikipedia-mode-map [menu-bar wikipedia] (cons "Wikipedia" map)) (define-key map [unfill-article] (quote ("Unfill article" . wikipedia-unfill-article))) (define-key map [fill-article] (quote ("Fill article" . wikipedia-fill-article))) (define-key map [separator-fill] (quote ("--"))) (define-key map [next-header] (quote ("Next header" . wikipedia-next-header))) (define-key map [prev-header] (quote ("Previous header" . wikipedia-prev-header))) (define-key map [separator-header] (quote ("--"))) (define-key map [outline] (quote ("Toggle Outline Mode..." . outline-minor-mode)))) (define-key wikipedia-mode-map "��" (quote wikipedia-unfill-article)) (define-key wikipedia-mode-map "�ñ" (quote wikipedia-fill-article)) (make-local-variable (quote change-major-mode-hook)))
  (progn (make-local-variable (quote delay-mode-hooks)) (let ((delay-mode-hooks t)) (text-mode) (setq major-mode (quote wikipedia-mode)) (setq mode-name "Wikipedia") (progn (if (get (quote text-mode) (quote mode-class)) (put (quote wikipedia-mode) (quote mode-class) (get (quote text-mode) (quote mode-class)))) (unless (keymap-parent wikipedia-mode-map) (set-keymap-parents wikipedia-mode-map (list (current-local-map)))) (derived-mode-merge-syntax-tables (syntax-table) wikipedia-mode-syntax-table)) (use-local-map wikipedia-mode-map) (set-syntax-table wikipedia-mode-syntax-table) (setq local-abbrev-table wikipedia-mode-abbrev-table) (set (make-local-variable (quote adaptive-fill-regexp)) "[ ]*") (set (make-local-variable (quote comment-start-skip)) "\\(?:<!\\)?-- *") (set (make-local-variable (quote comment-end-skip)) " *--\\([ \n]*>\\)?") (set (make-local-variable (quote comment-start)) "<!-- ") (set (make-local-variable (quote comment-end)) " -->") (set (make-local-variable (quote paragraph-start)) "\\*\\| \\|#\\|;\\|:\\||\\|!\\|$") (set (make-local-variable (quote sentence-end-double-space)) nil) (set (make-local-variable (quote font-lock-multiline)) t) (set (make-local-variable (quote font-lock-defaults)) (quote (wikipedia-font-lock-keywords t nil nil nil))) (set (make-local-variable (quote fill-nobreak-predicate)) (quote wikipedia-link-fill-nobreak-p)) (set (make-local-variable (quote auto-fill-inhibit-regexp)) "^[ *#:|;]") (set (make-local-variable (quote outline-regexp)) "==+") (set (make-local-variable (quote outline-minor-mode-prefix)) "�") (when menu-bar-mode (set (make-local-variable (quote imenu-generic-expression)) wikipedia-imenu-generic-expression) (imenu-add-to-menubar "Contents")) (modify-syntax-entry ?< "(>" wikipedia-mode-syntax-table) (modify-syntax-entry ?> ")<" wikipedia-mode-syntax-table) (define-key wikipedia-mode-map "î" (quote wikipedia-next-header)) (define-key wikipedia-mode-map "ð" (quote wikipedia-prev-header)) (define-key wikipedia-mode-map [M-down] (quote wikipedia-next-header)) (define-key wikipedia-mode-map [M-up] (quote wikipedia-prev-header)) (define-key wikipedia-mode-map "\n" (quote wikipedia-terminate-paragraph)) (define-key wikipedia-mode-map [(control return)] (quote wikipedia-terminate-paragraph)) (let ((map (make-sparse-keymap "Wikipedia"))) (define-key wikipedia-mode-map [menu-bar wikipedia] (cons "Wikipedia" map)) (define-key map [unfill-article] (quote ("Unfill article" . wikipedia-unfill-article))) (define-key map [fill-article] (quote ("Fill article" . wikipedia-fill-article))) (define-key map [separator-fill] (quote ("--"))) (define-key map [next-header] (quote ("Next header" . wikipedia-next-header))) (define-key map [prev-header] (quote ("Previous header" . wikipedia-prev-header))) (define-key map [separator-header] (quote ("--"))) (define-key map [outline] (quote ("Toggle Outline Mode..." . outline-minor-mode)))) (define-key wikipedia-mode-map "��" (quote wikipedia-unfill-article)) (define-key wikipedia-mode-map "�ñ" (quote wikipedia-fill-article)) (make-local-variable (quote change-major-mode-hook))))
  (delay-mode-hooks (text-mode) (setq major-mode (quote wikipedia-mode)) (setq mode-name "Wikipedia") (progn (if (get (quote text-mode) (quote mode-class)) (put (quote wikipedia-mode) (quote mode-class) (get (quote text-mode) (quote mode-class)))) (unless (keymap-parent wikipedia-mode-map) (set-keymap-parents wikipedia-mode-map (list (current-local-map)))) (derived-mode-merge-syntax-tables (syntax-table) wikipedia-mode-syntax-table)) (use-local-map wikipedia-mode-map) (set-syntax-table wikipedia-mode-syntax-table) (setq local-abbrev-table wikipedia-mode-abbrev-table) (set (make-local-variable (quote adaptive-fill-regexp)) "[ ]*") (set (make-local-variable (quote comment-start-skip)) "\\(?:<!\\)?-- *") (set (make-local-variable (quote comment-end-skip)) " *--\\([ \n]*>\\)?") (set (make-local-variable (quote comment-start)) "<!-- ") (set (make-local-variable (quote comment-end)) " -->") (set (make-local-variable (quote paragraph-start)) "\\*\\| \\|#\\|;\\|:\\||\\|!\\|$") (set (make-local-variable (quote sentence-end-double-space)) nil) (set (make-local-variable (quote font-lock-multiline)) t) (set (make-local-variable (quote font-lock-defaults)) (quote (wikipedia-font-lock-keywords t nil nil nil))) (set (make-local-variable (quote fill-nobreak-predicate)) (quote wikipedia-link-fill-nobreak-p)) (set (make-local-variable (quote auto-fill-inhibit-regexp)) "^[ *#:|;]") (set (make-local-variable (quote outline-regexp)) "==+") (set (make-local-variable (quote outline-minor-mode-prefix)) "�") (when menu-bar-mode (set (make-local-variable (quote imenu-generic-expression)) wikipedia-imenu-generic-expression) (imenu-add-to-menubar "Contents")) (modify-syntax-entry ?< "(>" wikipedia-mode-syntax-table) (modify-syntax-entry ?> ")<" wikipedia-mode-syntax-table) (define-key wikipedia-mode-map "î" (quote wikipedia-next-header)) (define-key wikipedia-mode-map "ð" (quote wikipedia-prev-header)) (define-key wikipedia-mode-map [M-down] (quote wikipedia-next-header)) (define-key wikipedia-mode-map [M-up] (quote wikipedia-prev-header)) (define-key wikipedia-mode-map "\n" (quote wikipedia-terminate-paragraph)) (define-key wikipedia-mode-map [(control return)] (quote wikipedia-terminate-paragraph)) (let ((map (make-sparse-keymap "Wikipedia"))) (define-key wikipedia-mode-map [menu-bar wikipedia] (cons "Wikipedia" map)) (define-key map [unfill-article] (quote ("Unfill article" . wikipedia-unfill-article))) (define-key map [fill-article] (quote ("Fill article" . wikipedia-fill-article))) (define-key map [separator-fill] (quote ("--"))) (define-key map [next-header] (quote ("Next header" . wikipedia-next-header))) (define-key map [prev-header] (quote ("Previous header" . wikipedia-prev-header))) (define-key map [separator-header] (quote ("--"))) (define-key map [outline] (quote ("Toggle Outline Mode..." . outline-minor-mode)))) (define-key wikipedia-mode-map "��" (quote wikipedia-unfill-article)) (define-key wikipedia-mode-map "�ñ" (quote wikipedia-fill-article)) (make-local-variable (quote change-major-mode-hook)))
  wikipedia-mode()
  # bind (alist mode name keep-going)
  # (unwind-protect ...)
  # bind (just-from-file-name)
  set-auto-mode()
  #<compiled-function nil "...(5)" [set-auto-mode t] 1>()
  # (unwind-protect ...)
  call-with-condition-handler(#<compiled-function (__call_trapping_errors_arg__) "...(17)" [__call_trapping_errors_arg__ errstr error-message-string lwarn file-mode-spec warning "Error in %s: %s\n\nBacktrace follows:\n\n%s" "File mode specification" backtrace-in-condition-handler-eliminating-handler] 8> #<compiled-function nil "...(5)" [set-auto-mode t] 1>)
  # (condition-case ... . ((error)))
  # bind (find-file)
  normal-mode(t)
  # bind (nomodes after-find-file-from-revert-buffer noauto warn error)
  after-find-file(nil t)
  # (unwind-protect ...)
  # bind (inhibit-read-only error number truename rawfile nowarn filename buf)
  find-file-noselect-1(#<buffer "mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt"> "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt" nil nil "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt" (293465 771))
  byte-code("..." [number truename rawfile nowarn filename buf set-buffer-major-mode find-file-noselect-1] 7)
  # (condition-case ... . ((t (byte-code "Â�!ˆÃ	@	A\"‡" [buf data kill-buffer signal] 3))))
  # bind (number truename buf wildcards rawfile nowarn filename)
  find-file-noselect("/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt" nil nil nil)
  # bind (wildcards codesys filename)
  find-file("/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt")
  (progn (raise-frame) (find-file "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt"))
  (progn (progn (raise-frame) (find-file "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt")))
  eval((progn (progn (raise-frame) (find-file "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt"))))
  # bind (form)
  gnuserv-eval-quickly((progn (progn (raise-frame) (find-file "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt"))))
  eval((gnuserv-eval-quickly (quote (progn (progn (raise-frame) (find-file "/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt"))))))
  byte-code("..." [header gnuserv-string eval read-from-string] 4)
  # (condition-case ... . ((error (byte-code "Ã�\n«…Ä\n	\"ˆÅ�Æ	@	A\"‡" [gnuserv-string oops gnuserv-current-client "" gnuserv-write-to-client nil signal] 3)) (quit (byte-code "Ã�\n«…Ä\n�\"ˆÅ�ÆÇÅ\"‡" [oops gnuserv-string gnuserv-current-client "" gnuserv-write-to-client nil signal quit] 3))))
  # bind (header string proc)
  gnuserv-process-filter(#<process "gnuserv" pid 31680 state:run> "5 (gnuserv-eval-quickly '(progn (progn (raise-frame) (find-file \"/tmp/mozex.textarea.f91fdc0e92e74accb55f53036b9cf0ac.txt\"))))�")
  # (condition-case ... . error)
  # (catch top-level ...)

Does anyone know how to fix this? Are there any plans on making wikipedia-mode XEmacs-compatible? —Psychonaut 13:43, 26 November 2005 (UTC)[reply]

Well, I guess you have to comment out "menubar-mode" which is causing the trouble. Wikipedia-mode was made to work for Emacs, so this is to be expected. Luckily, it is a small lisp code, and at least for myself, I managed to hack it into compliance.
Please note though that XEmacs does not support Unicode (beyond accented Latin), and it will make a mess of Unicode-containing articles. Oleg Alexandrov (talk) 23:39, 26 November 2005 (UTC)[reply]
This is news to me, as I've been successfully using XEmacs with Unicode for some time now. Unicode support is provided by MULE. —Psychonaut 23:30, 11 December 2005 (UTC)[reply]
Good to know. I will investigate. However, it seems that Mule is already well-integrated in Emacs, but not in XEmacs (so one may need to get it separately or something.) Oleg Alexandrov (talk) 00:31, 12 December 2005 (UTC)[reply]

Page name

[edit]

Would it not be better called wikimedia-mode.el? —Preceding unsigned comment added by 62.255.64.5 (talkcontribs)

Even better would be mediawiki-mode.el because it's not necessarily limited to MediaWiki installations owned by Wikimedia Foundation. --Damian Yerrick () 08:00, 5 February 2006 (UTC)[reply]
Well, ask the creator of this software to rename it, then we may also rename the page. Oleg Alexandrov (talk) 16:18, 5 February 2006 (UTC)[reply]

w3 / w3m

[edit]

Emacs also has an internal w3 browser... --Jidanni 2006-04-15

How do you mean? There is an old and generally obsolete and slow browser implemented in Lisp for Emacs, and the w3m-el interface to w3m, but there are no internal browsers for Emacs that I know of, nor can I find it in my emacs. --maru (talk) contribs 18:12, 15 April 2006 (UTC)[reply]

OK, now using w3m in emacs. In my ~/.emacs-w3m

(autoload 'wikipedia-mode "wikipedia-mode.el")
(add-hook 'w3m-form-input-textarea-mode-hook
 (lambda nil
   (wikipedia-mode ... Jidanni (talk) 26 November 2008

Add to official emacs

[edit]

This ought to be part of the official emacs distribution, or at least included in some Debian side package. Jidanni (talk) 18:45, 26 November 2008 (UTC)[reply]

Disabling longlines mode

[edit]

I found the use of longlines mode a bother, so I created this patch to wikipedia-mode.el so that users can disable it with

M-x customize-variable wikipedia-use-longlines-p

The patch is based on version 0.5.

*** wikipedia-mode.el.orig	Fri Nov 21 08:16:03 2008
--- wikipedia-mode.el	Wed Dec 24 11:05:31 2008
***************
*** 362,367 ****
--- 362,368 ----
  ;; wikipedia-english-or-german
  ;; wikipedia-draft-reply-register ?M
  ;; wikipedia-mode-version
+ ;; wikipedia-use-longlines-p
  
  ;;}}}
  
***************
*** 946,952 ****
  
  (defun wikipedia-turn-on-longlines ()	;Version:1.58
    "Turn on longlines-mode if it is defined."
!   (if (functionp 'longlines-mode)
        (longlines-mode 1)))
  (add-hook 'wikipedia-mode-hook 'wikipedia-turn-on-longlines)
  (set (make-local-variable 'auto-fill-inhibit-regexp) "^[ *#:|;]")
--- 947,953 ----
  
  (defun wikipedia-turn-on-longlines ()	;Version:1.58
    "Turn on longlines-mode if it is defined."
!   (if (and wikipedia-use-longlines-p (functionp 'longlines-mode))
        (longlines-mode 1)))
  (add-hook 'wikipedia-mode-hook 'wikipedia-turn-on-longlines)
  (set (make-local-variable 'auto-fill-inhibit-regexp) "^[ *#:|;]")
***************
*** 1425,1430 ****
--- 1426,1436 ----
    :type 'string
    :group 'wikipedia-draft)
  
+ (defcustom wikipedia-use-longlines-p t
+   "*If on, wikipedia mode will use longlines mode"
+   :type 'boolean
+   :group 'wikipedia-draft)
+ 
  
  ;;; Internal Variables:

--DavidBiesack (talk) 16:07, 24 December 2008 (UTC)[reply]

Duplicate Code

[edit]

There are commands to set auto-mode-alist in both the Installing wikippedia-mode and the Usage sections. Shouldn't we merge them into just the Usage section?

Pheaver (talk) 21:22, 4 September 2009 (UTC)[reply]

text-mode-hook

[edit]

The code to add to the text-mode-hook should be this:

 (add-hook 'text-mode-hook '#[nil "\300\301!\207" [flyspell-mode 1] 2])
 (add-hook 'text-mode-hook 'flyspell-buffer)
 (add-hook 'text-mode-hook 'text-mode-hook-identify)

Not this:

 (setq text-mode-hook (quote (#[nil "\300\301!\207" [flyspell-mode 1] 2] flyspell-buffer text-mode-hook-identify))) 

Using setq will erase any functions that are already in that hook.

Pheaver (talk) 21:22, 4 September 2009 (UTC)[reply]