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

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

[elpa] externals/kiwix 15fd8fa 191/192: use hook to auto setup org-kiwix


From: Stefan Monnier
Subject: [elpa] externals/kiwix 15fd8fa 191/192: use hook to auto setup org-kiwix link type
Date: Sat, 19 Dec 2020 00:41:58 -0500 (EST)

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

    use hook to auto setup org-kiwix link type
---
 README.org   | 15 ++++++---------
 org-kiwix.el | 11 +++++++++--
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/README.org b/README.org
index 7a38bfc..ccf1369 100644
--- a/README.org
+++ b/README.org
@@ -78,18 +78,15 @@ 
https://chrome.google.com/webstore/detail/kiwix/donaljnlmapmngakoipdmehbfcioahhk
 
 ** MELPA
 
-#+begin_src org
-,#+begin_src emacs-lisp :eval no
+#+begin_src emacs-lisp :eval no
 (use-package kiwix
-  ;; :ensure t
-  :load-path "~/Code/Emacs/kiwix.el/"
+  :ensure t
   :after org
   :commands (kiwix-launch-server kiwix-at-point-interactive)
-  :bind (:map document-prefix ("w" . kiwix-at-point-interactive))
-  :init (setq kiwix-server-use-docker t
-              kiwix-server-port 8080
-              kiwix-default-library "wikipedia_zh_all_2015-11.zim"))
-,#+end_src
+  :custom ((kiwix-server-use-docker t)
+           (kiwix-server-port 8089)
+           (kiwix-default-library "wikipedia_en_all_2016-02.zim"))
+  :hook (org-load . org-kiwix-setup-link))
 #+end_src
 
 * Setup
diff --git a/org-kiwix.el b/org-kiwix.el
index 34bf511..f824a05 100644
--- a/org-kiwix.el
+++ b/org-kiwix.el
@@ -1,6 +1,6 @@
 ;;; org-kiwix.el --- Org Mode link support -*- lexical-binding: t; -*-
 
-;;; Time-stamp: <2020-07-11 17:39:13 stardiviner>
+;;; Time-stamp: <2020-08-20 11:55:13 stardiviner>
 
 ;;; Commentary:
 
@@ -22,6 +22,10 @@
 ;; - group 2: link? (match everything but ], space, tab, carriage return, 
linefeed by using [^] \n\t\r]*)
 ;; for open wiki search query with local application database.
 
+;; Usage:
+;;
+;; (add-hook 'org-load-hook #'org-kiwix-setup-link)
+
 ;;; Code:
 
 (require 'kiwix)
@@ -35,6 +39,7 @@
       t
     nil))
 
+;;;###autoload
 (defun kiwix-org-get-library (link)
   "Get library from Org-mode `LINK'."
   (let ((library (catch 'args-out-of-range
@@ -109,6 +114,7 @@
                             :description query)
       link)))
 
+;;;###autoload
 (defun org-wikipedia-complete-link (&optional arg)
   "Use kiwix AJAX request to provide available completion keywords."
   (let* ((query (or arg (read-from-minibuffer "Search keyword: ")))
@@ -119,7 +125,8 @@
             (completing-read "Available keywords: " keywords))))
 
 ;;;###autoload
-(with-eval-after-load 'org
+(defun org-kiwix-setup-link ()
+  "Setup Org link for org-kiwix."
   (org-link-set-parameters "wikipedia" ; NOTE: use `wikipedia' for future 
backend changing.
                            :follow #'org-wikipedia-open-link
                            :store #'org-wikipedia-store-link



reply via email to

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