[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix f5d7a2f 180/192: support Org Mode link :complete
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix f5d7a2f 180/192: support Org Mode link :complete property function |
Date: |
Sat, 19 Dec 2020 00:41:56 -0500 (EST) |
branch: externals/kiwix
commit f5d7a2f4871359d781ac709c767349c1da5a81b6
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
support Org Mode link :complete property function
---
kiwix.el | 39 ++++++++++++++++++++-------------------
org-kiwix.el | 12 ++++++++++--
2 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index 80292fe..9c9c145 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -243,25 +243,26 @@ Like in function `kiwix-ajax-search-hints'.")
(defun kiwix-ajax-search-hints (input &optional selected-library)
"Instantly AJAX request to get available Kiwix entry keywords
list and return a list result."
- (let* ((library (or selected-library
- (kiwix--get-library-name (or kiwix--selected-library
- kiwix-default-library))))
- (ajax-api (format "%s/suggest?content=%s&term="
- kiwix-server-url
- library))
- (ajax-url (concat ajax-api input))
- (data (request-response-data
- (let ((inhibit-message t))
- (request ajax-url
- :type "GET"
- :sync t
- :headers '(("Content-Type" . "application/json"))
- :parser #'json-read
- :success (function*
- (lambda (&key data &allow-other-keys)
- data)))))))
- (if (vectorp data)
- (mapcar 'cdar data))))
+ (when input
+ (let* ((library (or selected-library
+ (kiwix--get-library-name (or kiwix--selected-library
+ kiwix-default-library))))
+ (ajax-api (format "%s/suggest?content=%s&term="
+ kiwix-server-url
+ library))
+ (ajax-url (concat ajax-api input))
+ (data (request-response-data
+ (let ((inhibit-message t))
+ (request ajax-url
+ :type "GET"
+ :sync t
+ :headers '(("Content-Type" . "application/json"))
+ :parser #'json-read
+ :success (function*
+ (lambda (&key data &allow-other-keys)
+ data)))))))
+ (if (vectorp data)
+ (mapcar 'cdar data)))))
;;;###autoload
(defun kiwix-at-point (&optional interactively)
diff --git a/org-kiwix.el b/org-kiwix.el
index 0516c72..6ccc672 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-04-28 10:06:10 stardiviner>
+;;; Time-stamp: <2020-04-28 10:38:02 stardiviner>
;;; Commentary:
@@ -102,11 +102,19 @@
:description query)
link)))
+(defun org-wikipedia-complete-link (&optional arg)
+ "Use kiwix AJAX request to provide available completion keywords."
+ (let* ((input (or arg (read-from-minibuffer "Search keyword: ")))
+ (keywords (kiwix-ajax-search-hints input)))
+ (concat "wikipedia:"
+ (completing-read "Available keywords: " keywords))))
+
;;;###autoload
(org-link-set-parameters "wikipedia" ; NOTE: use `wikipedia' for future
backend changing.
:follow #'org-wikipedia-open-link
:store #'org-wikipedia-store-link
- :export #'org-wikipedia-export-link)
+ :export #'org-wikipedia-export-link
+ :complete #'org-wikipedia-complete-link)
;;;###autoload
(add-hook 'org-store-link-functions 'org-wikipedia-store-link t)
- [elpa] externals/kiwix 8cc16b1 161/192: no need to select library when use Docker container, (continued)
- [elpa] externals/kiwix 8cc16b1 161/192: no need to select library when use Docker container, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f11e8fb 167/192: support more web browsers, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix fbd00ab 170/192: select library every time you query because Docker container use libraries index, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix d5e5780 173/192: fix GitHub Org Mode inline image display format, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix e2933785 174/192: add autoload cookie for kiwix.el Org link functions, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 0155c9a 177/192: rename org-link functions, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 57d6f5c 178/192: migrate Org Mode link support to separate source code file, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 36b15f3c 179/192: add kiwix.el load in README, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 2011a9f 183/192: update package config in README, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix dd02284 185/192: fix free variable `kiwix-response', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f5d7a2f 180/192: support Org Mode link :complete property function,
Stefan Monnier <=
- [elpa] externals/kiwix 5f60388 181/192: update kiwix-server-url everytime used, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4bdf16b 188/192: smarter `kiwix-org-get-library' detect existing library in link, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6878b7d 182/192: add condition to detect kiwix server is available when get search hints, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix cb3e253 190/192: Merge pull request #2 from syohex/syohex/warnings, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 15fd8fa 191/192: use hook to auto setup org-kiwix link type, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix ddeecd1 186/192: fix void org link functions by autoload, Stefan Monnier, 2020/12/19