[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 1521481 007/192: update functions
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 1521481 007/192: update functions |
Date: |
Sat, 19 Dec 2020 00:41:22 -0500 (EST) |
branch: externals/kiwix
commit 15214814bba506910cc66e18f38d86ebe4a8de6f
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
update functions
---
kiwix-http.el | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/kiwix-http.el b/kiwix-http.el
index 71f0688..09f720c 100644
--- a/kiwix-http.el
+++ b/kiwix-http.el
@@ -38,17 +38,16 @@
(defun kiwix-serve-index ()
"Open kiwix HTTP server index page."
(interactive)
- ;; (browse-url "http://127.0.0.1:8000")
- (browse-url-conkeror "http://127.0.0.1:8000")
+ (browse-url "http://127.0.0.1:8000")
)
(defun kiwix-libraries ()
"Get a list of dirs under a specific dir."
;; ~/.www.kiwix.org/kiwix/8ip89lik.default/data/content/*.zim
(let ((libraries
- ;; TODO: filter out ZIM files as libraries.
+ ;; TODO: use a filter function from cl-lib or dash to replace
`mapcar'.
(mapcar #'(lambda (file)
- (let ((zim-file (string-match-p ".*\\.zim" file)))
+ (let ((zim-file (string-match-p ".*\\.zim\\'" file)))
zim-file))
(directory-files kiwix-data-index-path)
)))
@@ -57,6 +56,9 @@
(defun kiwix-serve-search (library query)
"Execute shell command `kiwix-search' on `LIBRARY' with `QUERY'.
Return a list of results."
+
+ ;; TODO: don't use shell-command.
+ ;; use execute a process sync/async. check out in Elisp info.
(let ((search-results (shell-command
(concat kiwix-search-command " "
kiwix-data-profile-path kiwix-data-index-path
@@ -81,11 +83,28 @@ Return a list of results."
(list (completing-read
"select a result to visit: "
results)))))
- (browse-url-conkeror
+ (browse-url
(concat "http://127.0.0.1:8000/" library "/A/" result))
)
)
+;; TODO: finnally, write a function to reterive the values from the last
command.
+
+;; final function
+;;;###autoload
+(defun kiwix-at-point (&optional edit-search)
+ "Search for the word at point in Kiwix."
+ (interactive "P")
+ (let* ((thing (if mark-active
+ (buffer-substring (region-beginning) (region-end))
+ (thing-at-point 'symbol)))
+ (search (kiwix-maybe-specify-library thing)))
+ (kiwix-run-search
+ (if (or edit-search (null thing))
+ (read-string "Kiwix search: " search)
+ search))))
+
+;; TODO: add org-mode protocol support: `wiki_offline:'
(provide 'kiwix-http)
- [elpa] branch externals/kiwix created (now 905a413), Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4dac833 003/192: use Org-mode format README, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 004193f 005/192: first working version, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 516f512 006/192: update defcustom properties, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 1521481 007/192: update functions,
Stefan Monnier <=
- [elpa] externals/kiwix 4701ab9 001/192: Initial commit, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix e49d830 002/192: temporary push a not working version., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix e7edd5e 004/192: rename old kiwix.el to kiwix-http.el, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 06c466e 011/192: fix Kiwix query need to capitalized, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix e54e80a 016/192: update function variables, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 06b5d36 027/192: Merge branch 'master' of github.com:stardiviner/kiwix.el, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 377f3fa 014/192: add package metadata, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix d0da8cd 017/192: make package description clear, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix bd0fe09 018/192: setq-local depend on cl-lib, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5990cc7 022/192: improve query function to specify library, Stefan Monnier, 2020/12/19