emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/kiwix d4d5ee0 149/192: Add an option for user to specif


From: Stefan Monnier
Subject: [elpa] externals/kiwix d4d5ee0 149/192: Add an option for user to specify default browse-url function.
Date: Sat, 19 Dec 2020 00:41:50 -0500 (EST)

branch: externals/kiwix
commit d4d5ee082f4dc0e3ac09da05b3924105ec136e2f
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    Add an option for user to specify default browse-url function.
    
    Using EWW is readable for some Emacs users.
---
 README.org | 12 ++++++++++++
 kiwix.el   |  9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index e74a660..b23526b 100644
--- a/README.org
+++ b/README.org
@@ -286,6 +286,18 @@ The link format is like this:
 
 The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en=, or 
=en=, =zh= etc.
 
+** EWW integration
+
+Set following option in your config to use EWW in Emacs as your default _for
+Kiwix only_.
+
+#+begin_src emacs-lisp
+(setq kiwix-default-browser-function 'eww-browse-url)
+#+end_src
+
+#+RESULTS[<2019-10-15 18:32:09> 3b9749599d792fb0ea5cd3566095ae16f1fc7f30]:
+: eww-browse-url
+
 ** Async search completion keywords candidates
 
 [[file:kiwix.el Ivy async completion.png]]
diff --git a/kiwix.el b/kiwix.el
index 7148925..bef8cd5 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -98,6 +98,12 @@
   :type 'string
   :group 'kiwix-mode)
 
+(defcustom kiwix-default-browser-function browse-url-generic-program
+  "Set default browser for open kiwix query result URL."
+  :type 'function
+  :safe #'symbolp
+  :group 'kiwix-mode)
+
 ;;;###autoload
 (defun kiwix--get-library-name (file)
   "Extract library name from library file."
@@ -179,7 +185,8 @@ Like in function `kiwix-ajax-search-hints'.")
                  ;; only capitalize the first word. like: "meta-circular 
interpreter" -> "Meta-circular interpreter"
                  (kiwix-capitalize-first query)
                  nil nil))
-               ".html")))
+               ".html"))
+         (browse-url-browser-function kiwix-default-browser-function))
     (browse-url url)))
 
 (defvar kiwix-server-available? nil



reply via email to

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