[elpa] elpa-admin 0b84023: * elpa-admin.el: Fix confusing uses of word "external"

2020-12-18 Thread Stefan Monnier
branch: elpa-admin
commit 0b8402335c316ac86c8ba429a342cfc78b4c9c69
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-admin.el: Fix confusing uses of word "external"

(elpaa--branch-prefix, elpaa--release-branch-prefix):
Use "elpa" instead of "external".
(elpaa--specs-file): Change name to "elpa-packages".
(elpaa--get-specs): Use `elpaa--specs-file`, as intended.
(elpaa--worktree-sync): Rename from `elpaa--external-package-sync`.
(elpaa-add/remove/update-worktrees): Rename from
`elpaa-add/remove/update-externals`.
(elpaa-batch-archive-update-worktrees): Use `:url` instead of `:external`.
(elpaa--branch): Don't hardcode "master".
(elpaa--urtb): Use our own name for the remote tracking branch instead
of using the name used in the upstream repository.  Use "main" for the
the main (development) branch.
(elpaa--fetch, elpaa--push): Same, and use "release" to track the
release branch.

* GNUmakefile (worktrees): New target name to replace "externals".

* README, README.org: Update old uses of "external".
---
 GNUmakefile   |  6 +++---
 README| 49 +++
 README.org|  8 
 elpa-admin.el | 61 +--
 4 files changed, 61 insertions(+), 63 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 04a4ea6..ca2f120 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -203,10 +203,10 @@ sync-all:
 
 ### Rules to prepare the externals 
 
-.PHONY:
-externals:
+.PHONY: externals worktrees
+externals worktrees:   # "externals" is the old name we used to use.
$(EMACS) -l admin/elpa-admin.el \
-   -f elpaa-add/remove/update-externals
+   -f elpaa-add/remove/update-worktrees
 
 
 ### Testing ###
diff --git a/README b/README
index 1118fab..cb295c5 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ This code expects to be used in a directory that has the 
following layout:
 
 - =admin/=  -- Directory containing a copy of the here files
 - =GNUmakefile= -- A copy of or symlink to =admin/GNUmakefile=
-- =externals-list=  -- The specifications of the packages
+- =elpa-packages=   -- The specifications of the packages
 - =copyright_exceptions= -- List of exceptions for the copyright-notices checks
 
 The =copyright_exceptions= file can be absent, in which case copyright notices
@@ -41,14 +41,16 @@ that should be part of the archive.  Each element has the 
form
 
 where NAME is the name of the ELisp package and PLIST is a property list
 giving additional info about that package.  It has to have either
-an =:external= or a =:core= property, all others are optional.
+a =:url= or a =:core= property, all others are optional.
 The properties are the following:
 
-** =:external URL=
+** =:url URL=
+This property has to come first.
 Gives the URL where the upstream Git repository for that package can be found.
 The URL can be =nil= if there is no upstream repository.
 
 ** =:core FILES=
+This property has to come first.
 Indicates that this is a special package which will be built by extracting
 files directly from Emacs's source code.  For this to work, the Emacs
 source code should be available in the =emacs= subdirectory.
@@ -139,15 +141,15 @@ instructions below, but the gist of it is that you:
 2. Push your package's code to its branch on elpa.git with:
 
#+begin_src shell
-   git push elpa :refs/heads/externals/
+   git push elpa :refs/heads/elpa/
#+end_src
 
where == will probably be =master= for most people.
 
-3. Edit the =externals-list= file to add an entry for ==.
-   It has to have an =:external= property specified but that
+3. Edit the =elpa-packages= file to add an entry for ==.
+   It has to have an =:url= property specified but that
property can be nil.
-4. =git add externals-list=, =git commit= and =git push=.
+4. =git add elpa-packages=, =git commit= and =git push=.
 
 If you don't have push access to the repository, someone will do steps
 2-4 for you.
@@ -198,9 +200,7 @@ For some examples, see 
[[https://www.gnu.org/software/emacs/manual/html_node/eli
 *** Add a multi-file package as a directory: =packages/=
 
 It needs to have a file named =packages//.el= which 
follows the
-same rules as above.  Note that if your package is large, we recommend you
-add it as an "external" into its own branch, see below discussion of
-[[External branches][external branches]].
+same rules as above.
 
 It additionally follows the same guidelines described in 
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Multi_002dfile-Packages.html][Multi-File
 Packages]]
 (web link) or in Emacs
@@ -282,16 +282,16 @@ upstream every once in a while.  This copy may include 
local changes,
 although these should be kept to a minimum.
 
 The copy of the code is not kept in =master= but in the
-=externals/= branch in th

[nongnu] main afcf174: * elpa-packages: Rename from `externals-list`.

2020-12-18 Thread Stefan Monnier
branch: main
commit afcf174a0706791bdbe7b3558f4a97e9c1faad73
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages: Rename from `externals-list`.

Also use :url instead of :external.

* elpa-config (specs-file): Adjust the accordingly.
---
 elpa-config|  5 +++--
 elpa-packages  | 27 +++
 externals-list | 50 --
 3 files changed, 30 insertions(+), 52 deletions(-)

diff --git a/elpa-config b/elpa-config
index 7c82055..e38d684 100644
--- a/elpa-config
+++ b/elpa-config
@@ -5,5 +5,6 @@
  (url  "https://elpa.nongnu.org/nongnu/";)
  (branch-prefix"externals/")
  (release-branch-prefix"externals-release/")
- (specs-file   "externals-list")
- (debugnil))
+ ;;(specs-file "elpa-packages")
+ ;;(debug  nil)
+ )
diff --git a/elpa-packages b/elpa-packages
new file mode 100644
index 000..2eeea97
--- /dev/null
+++ b/elpa-packages
@@ -0,0 +1,27 @@
+;; -*- lisp-data -*-
+
+;; List of packages.
+;; The list is made of elements of the form (NAME . PLIST)
+;; Every package needs a corresponding Git branch in the repository
+;; with name `externals/NAME`.
+;;
+;; See "Specifications" in the admin/README file for the properties
+;; that can be used in PLIST.
+
+(
+ ("caml"   :url "https://github.com/ocaml/caml-mode";
+  ;; The version 4.7.1 from Melpa-stable seems to correspond to
+  ;; revision a9134009.
+  :version-map ((nil "4.7.1" "a9134009bd037a39cbda21806867d0534d340bca")))
+ ("markdown-mode"  :url "https://github.com/jrblevin/markdown-mode";
+  :readme "README.md"
+  ;; Not needed any more:
+  ;; :dont-release "-dev\\'"
+  )
+ ("sly":url "https://github.com/joaotavora/sly";
+  :texinfo "doc/sly.texi"
+  ;; Not needed any more:
+  ;; :version-map (("1.0.0-beta-3" "1.0.0beta3"))
+  )
+ ("tuareg" :url "https://github.com/ocaml/tuareg.git";)
+ )
diff --git a/externals-list b/externals-list
deleted file mode 100644
index 969509c..000
--- a/externals-list
+++ /dev/null
@@ -1,50 +0,0 @@
-;; -*- lisp-data -*-
-
-;; List of packages.
-;; The list is made of elements of the form (NAME . PLIST)
-;; Every package needs a corresponding Git branch in the repository
-;; with name `externals/NAME`.
-;;
-;; PLIST uses the following properties
-;;
-;; :external URL
-;;   This specifies the location of the upstream code, usually a Git URL.
-;;
-;; :branch BRANCH
-;;   This specified the Git branch that we follow.
-;;   By default, we follow the `master' branch.
-;;
-;; :version-map MAP
-;;   A list of element of the form (ORIG-VERSION REMAPPED-VERSION REVISION)
-;;   This allows replacing the ORIG-VERSION from the .el file
-;;   with REMAPPED-VERSION (e.g. because the ORIG-VERSION is not a valid
-;;   version number, is missing, or because we want to create a new package
-;;   from the same code version).
-;;   It also makes it possible to specify that this ORIG-VERSION
-;;   (or REMAPPED-VERSION if non-nil) corresponds to REVISION to override
-;;   the default heuristic which looks at the commit that modified the
-;;   "Version:" header.
-;;
-;; :dont-release REGEXP
-;;   A regexp matching version numbers which should not be released.
-;;   This can be used for example to prevent releasing alpha/beta quality code
-;;   while still allowing this code to appear with proper version info
-;;   in the NonGNU-devel archive.
-
-(
- ("caml"   :external "https://github.com/ocaml/caml-mode";
-  ;; The version 4.7.1 from Melpa-stable seems to correspond to
-  ;; revision a9134009.
-  :version-map ((nil "4.7.1" "a9134009bd037a39cbda21806867d0534d340bca")))
- ("markdown-mode"  :external "https://github.com/jrblevin/markdown-mode";
-  :readme "README.md"
-  ;; Not needed any more:
-  ;; :dont-release "-dev\\'"
-  )
- ("sly":external "https://github.com/joaotavora/sly";
-  :texinfo "doc/sly.texi"
-  ;; Not needed any more:
-  ;; :version-map (("1.0.0-beta-3" "1.0.0beta3"))
-  )
- ("tuareg" :external "https://github.com/ocaml/tuareg.git";)
- )



[nongnu] branch elpa/markdown-mode created (now 4d7f525)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch elpa/markdown-mode.

at  4d7f525   Update Change log

No new revisions were added by this update.



[nongnu] branch elpa/sly created (now e927cda)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch elpa/sly.

at  e927cda   Release SLY 1.0.42

No new revisions were added by this update.



[nongnu] branch elpa/tuareg created (now ccde45b)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch elpa/tuareg.

at  ccde45b   Unbind backspace to fix electric-pair-mode

No new revisions were added by this update.



[nongnu] branch elpa/caml created (now 38ebde1)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch elpa/caml.

at  38ebde1   Generate a caml-mode-site-file

No new revisions were added by this update.



[nongnu] main ac7a7ed: * elpa-config (branch-prefix): Use the default "non-external" name

2020-12-18 Thread Stefan Monnier
branch: main
commit ac7a7ed712dd6d2859b4593d4df605a4c38043f3
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-config (branch-prefix): Use the default "non-external" name
---
 elpa-config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/elpa-config b/elpa-config
index e38d684..332263a 100644
--- a/elpa-config
+++ b/elpa-config
@@ -3,8 +3,8 @@
 ((name "NonGNU")
  (gitrepo  "emacs/nongnu.git")
  (url  "https://elpa.nongnu.org/nongnu/";)
- (branch-prefix"externals/")
- (release-branch-prefix"externals-release/")
+ ;;(branch-prefix  "elpa/")
+ ;;(release-branch-prefix  "elpa-release/")
  ;;(specs-file "elpa-packages")
  ;;(debug  nil)
  )



[nongnu] elpa/sly 613f597: Fix #394: Revert "Don't force mREPL to use channel thread for everything"

2020-12-18 Thread ELPA Syncer
branch: elpa/sly
commit 613f597ecf72eb5719d4e13a4bfdbeb91373bf09
Author: João Távora 
Commit: João Távora 

Fix #394: Revert "Don't force mREPL to use channel thread for everything"

This reverts commit ae4bbcaadc2b65d4f64c99b956c739372eeba1cc, which
was a total thinko.

Although what was written in that commit message is true for most
requests -- that :emacs-rex requests issued from the REPL can normally
be spawned in a new worker thread -- it (1) isn't true of some
slynk-mrepl SLYFUNs which check if the worker thread really is the
thread of the object representing the REPL, and (2) it most certainly
isn't true of the :emacs-interupt message.

The restriction of (1) is probably artificial, since these SLYFUNs
(which modify REPL history, for example) are "seeing" local REPL
bindings anyway via WITH-LISTENER-BINDINGS, and it probably wouldn't
hurt a ton to lift it.  But the restriction of (2) is imperative: the
purpose of that message is to interrupt a specific thread.

In the end, that commit was done to get a better experience in Clasp,
who seems to have a hard problem hanging on to thread IDs because of a
garbage collecting issue.  Let's rather have that fixed in Clasp.
---
 contrib/sly-mrepl.el | 1 +
 sly.el   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/sly-mrepl.el b/contrib/sly-mrepl.el
index 9c412bf..90c1397 100644
--- a/contrib/sly-mrepl.el
+++ b/contrib/sly-mrepl.el
@@ -1013,6 +1013,7 @@ handle to distinguish the new buffer from the existing."
 (with-current-buffer buffer
   (sly-mrepl--read-input-ring)
   (setq header-line-format nil)
+  (setq sly-current-thread thread-id)
   (set (make-local-variable 'sly-mrepl--remote-channel) remote)
   (unwind-protect
   (run-hooks 'sly-mrepl-hook 'sly-mrepl-runonce-hook)
diff --git a/sly.el b/sly.el
index 4135f36..1b96528 100644
--- a/sly.el
+++ b/sly.el
@@ -1,6 +1,6 @@
 ;;; sly.el --- Sylvester the Cat's Common Lisp IDE  -*- lexical-binding: t; -*-
 
-;; Version: 1.0.42
+;; Version: 1.0.43
 ;; URL: https://github.com/joaotavora/sly
 ;; Package-Requires: ((emacs "24.3"))
 ;; Keywords: languages, lisp, sly



[nongnu] branch externals/caml deleted (was 38ebde1)

2020-12-18 Thread ELPA Syncer
elpasync pushed a change to branch externals/caml.

   was  38ebde1   Generate a caml-mode-site-file

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[nongnu] branch externals/tuareg deleted (was ccde45b)

2020-12-18 Thread ELPA Syncer
elpasync pushed a change to branch externals/tuareg.

   was  ccde45b   Unbind backspace to fix electric-pair-mode

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[nongnu] branch externals/sly deleted (was e927cda)

2020-12-18 Thread ELPA Syncer
elpasync pushed a change to branch externals/sly.

   was  e927cda   Release SLY 1.0.42

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[nongnu] branch externals/markdown-mode deleted (was 4d7f525)

2020-12-18 Thread ELPA Syncer
elpasync pushed a change to branch externals/markdown-mode.

   was  4d7f525   Update Change log

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[elpa] elpa-admin d47f83f: * elpa-admin.el (elpaa--fetch): Use the default branch rather than "master"

2020-12-18 Thread Stefan Monnier
branch: elpa-admin
commit d47f83fc3a66ab03dc36b590622dea9b94c7cb2b
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-admin.el (elpaa--fetch): Use the default branch rather than "master"
---
 README| 8 
 elpa-admin.el | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index cb295c5..3bb95b9 100644
--- a/README
+++ b/README
@@ -59,7 +59,7 @@ It can be a single file name or a list of file names.
 
 ** =:branch BRANCH=
 Specifies the branch to follow in the upstream Git repository, in case
-it should be different from =master=.
+it should be different from the default branch.
 
 ** =:main-file FILE=
 Gives the name of the main file of the package, i.e. the file in which
@@ -277,11 +277,11 @@ The instructions below are for those maintainers who 
prefer to use a dedicated
 repository or branch for the package or for largish packages.
 
 In any case, a copy of the code is kept in the =elpa.git= repository
-(not in the =master= branch) and should be sync'd with the
+(not in the default branch) and should be sync'd with the
 upstream every once in a while.  This copy may include local changes,
 although these should be kept to a minimum.
 
-The copy of the code is not kept in =master= but in the
+The copy of the code is not kept in the default branch but in the
 =elpa/= branch in the =elpa.git= repository.
 
 To add a new external package, first add this =elpa.git= repository as a
@@ -309,7 +309,7 @@ Then edit the =elpa-packages= file as mentioned above, add 
the line
("realgud-ipdb" :url "https://github.com/realgud/realgud-ipdb";)
 #+end_src
 
-and push that change to the master branch of =elpa=.  After it's added to
+and push that change to the default branch of =elpa=.  After it's added to
 the =elpa-packages= file, the package can be maintained just by
 pushing changes to the =elpa/= branch.
 
diff --git a/elpa-admin.el b/elpa-admin.el
index db6c3d9..a88273c 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1460,8 +1460,8 @@ More at " (elpaa--default-url pkgname))
  (branch (elpaa--branch pkg-spec))
  (release-branch (elpaa--spec-get pkg-spec :release-branch))
  (urtb (elpaa--urtb pkg-spec))
- ;; FIXME: Don't hardcode "master" here.
- (refspec (format "+refs/heads/%s:%s" (or branch "master") urtb))
+ (refspec (if branch (format "+refs/heads/%s:%s" branch urtb)
+(format "+HEAD:%s" urtb)))
  (release-refspec (if release-branch
   (format "+refs/heads/%s:%s"
   release-branch



[elpa] main 352a662: * elpa-packages: Rename from `externals-list`. Use `:url`.

2020-12-18 Thread Stefan Monnier
branch: main
commit 352a662a6a89872a89f4e7d63f3ccb9ed0f9d2a5
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages: Rename from `externals-list`.  Use `:url`.

* elpa-config: Adjust accordingly.

* README (External branches): Remove obsolete references to the word
"external".
---
 README |  27 ++---
 elpa-config|   5 +-
 elpa-packages  | 336 +
 externals-list | 336 -
 4 files changed, 353 insertions(+), 351 deletions(-)

diff --git a/README b/README
index 7fb7fc7..1a40d81 100644
--- a/README
+++ b/README
@@ -60,11 +60,12 @@ instructions below, but the gist of it is that you:
#+end_src
 
where == will probably be =master= for most people.
+   [ Note: The name "externals/" is the result of an accident of history.  ]
 
-3. Edit the =externals-list= file to add an entry for ==.
-   It has to have an =:external= property specified but that
+3. Edit the =elpa-packages= file to add an entry for ==.
+   It has to have an =:url= property specified but that
property can be nil.
-4. =git add externals-list=, =git commit= and =git push=.
+4. =git add elpa-packages=, =git commit= and =git push=.
 
 If you don't have push access to the repository, someone will do steps
 2-4 for you.
@@ -189,6 +190,7 @@ although these should be kept to a minimum.
 
 The copy of the code is not kept in =master= but in the
 =externals/= branch in the =elpa.git= repository.
+[ Note: The name "externals/" is the result of an accident of history.  ]
 
 To add a new package, first add this =elpa.git= repository as a
 new remote in your existing repository.
@@ -209,29 +211,28 @@ checked out in =$HOME/github/realgud-ipdb=:
git push elpa master:refs/heads/externals/realgud-ipdb
 #+end_src
 
-Then edit the =externals-list= file as mentioned above, add the line
+Then edit the =elpa-packages= file as mentioned above, add the line
 
 #+begin_src elisp
-   ("realgud-ipdb" :external "https://github.com/realgud/realgud-ipdb";)
+   ("realgud-ipdb" :url "https://github.com/realgud/realgud-ipdb";)
 #+end_src
 
 and push that change to the master branch of =elpa=.  After it's added to
-the =externals-list= file, the package can be maintained just by
+the =elpa-packages= file, the package can be maintained just by
 pushing changes to the =externals/= branch.
 
-If you wish to check out all the external packages into the =packages=
+If you wish to check out all the packages into the =packages=
 directory, you can run the command:
 
 #+begin_src shell
-   make externals
+   make worktrees
 #+end_src
 
-You can check out a specific external == into the =packages=
+You can check out a specific package == into the =packages=
 directory with these commands:
 
-#+begin_src 
-   cd packages
-   git worktree add PACKAGE externals/
+#+begin_src
+   make packages/
 #+end_src
 
 If you already have a =packages/= directory with a previous
@@ -257,7 +258,7 @@ you have two choices:
 ** To install all the packages "in place":
 
 #+begin_src shell
-   make externals
+   make worktrees
make
 #+end_src
 
diff --git a/elpa-config b/elpa-config
index d6b5cdc..6f8ae4b 100644
--- a/elpa-config
+++ b/elpa-config
@@ -5,5 +5,6 @@
  (url  "https://elpa.gnu.org/packages/";)
  (branch-prefix"externals/")
  (release-branch-prefix"externals-release/")
- (specs-file   "externals-list")
- (debugnil))
+ ;;(specs-file "elpa-packages")
+ ;;(debug  nil)
+ )
diff --git a/elpa-packages b/elpa-packages
new file mode 100644
index 000..16dbe17
--- /dev/null
+++ b/elpa-packages
@@ -0,0 +1,336 @@
+;; -*- lisp-data -*-
+
+;; List of packages that are maintained externally.
+;; The list is made of elements of the form (NAME KIND URL OPTS...).
+;;
+;; Where NAME is the name of the package;
+;;
+;; KIND can be one of:
+;;  :url = kept in a separate `externals/' branch.
+;;  :core = part of GNU Emacs repository.
+;;
+
+;; For KIND :url URL is the URL of the remote git repository that we want
+;; to track, or `nil' if there is no upstream, i.e., if development of this
+;; package takes place directly on the `externals/' branch of the
+;; `elpa.git' repository.  For packages of KIND :core URL must be a list of:
+;;STRING = A file-name to copy from Emacs repo.
+;;(STRING STRING) = A file-name to copy renamed from Emacs repo.
+
+;; For packages consisting of a single file, a plain string is also allowed.
+;; All file-names must be relative to the Emacs repository root and the package
+;; directory.  When a file-name points to a directory all its files are copied
+;; recursively into the package root or specified destination.  A special
+;; :excludes key can be provided to specify files to exclude when copying
+;; directories, wildcards are supported, "*.elc" and "*~" are always excluded.
+;; Exclude matches must be against the f

[nongnu] branch master deleted (was a407525)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch master.

   was  a407525   * elpa-config: New file

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[nongnu] branch master created (now f1727b0)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch master.

at  f1727b0   New dummy branch to announce deletion

This branch includes the following new commits:

   new  f1727b0   New dummy branch to announce deletion




[nongnu] master f1727b0: New dummy branch to announce deletion

2020-12-18 Thread Stefan Monnier
branch: master
commit f1727b0c61b851c1f7f9092b83befee1d0eb76e5
Author: Stefan Monnier 
Commit: Stefan Monnier 

New dummy branch to announce deletion
---
 BRANCH DELETED| 0
 USE BRANCH `main` INSTEAD | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/BRANCH DELETED b/BRANCH DELETED
new file mode 100644
index 000..e69de29
diff --git a/USE BRANCH `main` INSTEAD b/USE BRANCH `main` INSTEAD
new file mode 100644
index 000..e69de29



[elpa] branch master deleted (was 6749a29)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch master.

   was  6749a29   * externals-list: Convert `auto-overlays` from subtree to 
external

This change permanently discards the following revisions:

  discards  6749a29   * externals-list: Convert `auto-overlays` from subtree to 
external
  discards  a7732cf   * externals-list: Convert `dict-tree` from subtree to 
external
  discards  166f285   * externals-list: Convert `heap` from subtree to external
  discards  25be509   * externals-list: Convert `tNFA` from subtree to external
  discards  99a126e   * externals-list: Convert `queue` from subtree to external
  discards  f0d0d6e   * externals-list: Convert `trie` from subtree to external
  discards  dcd14e7   * externals-list: Convert `trie` from subtree to external
  discards  9f15c4b   externals-list (ivy, counsel): Convert to :external
  discards  ea82929   * externals-list (validate): Add upstream URL
  discards  229b380   * externals-list (externals-list): New package `valign`
  discards  601960e   * externals-list: Convert osc to :external
  discards  30603ca   * externals-list: Convert almost all remaining :subtrees 
to :external
  discards  e0ff566   * externals-list: Convert adjust-parens to :external
  discards  bac7217   * externals-list: Convert adjust-parens all auto-correct 
caps-lock captain cl-generic cl-lib company-ebdb crisp cycle-quotes docbook 
ebdb-gnorb electric-spacing el-search epoch-view filladapt flylisp frame-tabs 
gnu-elpa-keyring-update greenbar iterators jumpc kmb landmark lex memory-usage 
minibuffer-line minimap nadvice oauth2 org-translate osc other-frame-window 
package-fixes path-iterator poker quarter-plane rainbow-mode rcirc-menu 
scroll-restore sed-mode seq sheli [...]
  discards  0d755a1   * externals-list: Convert dired-du to :external
  discards  f569c91   * externals-list: Convert gnus-mock to :external
  discards  195a4b8   * externals-list: Convert javaimp to :external
  discards  c9a7e60   * externals-list: Convert notes-mode to :external
  discards  01265da   * externals-list: Convert sml-mode to :external
  discards  1dd8c1b   * externals-list: Convert vcard to :external
  discards  a8174b7   * externals-list: Yet more conversion to :external
  discards  99fea42   * externals-list: Convert ada-mode to :external
  discards  85bec8d   * externals-list: Convert multishell, pcaed, and swiper 
to :external
  discards  f578390   * externals-list: Convert timerfunctions to :external
  discards  77e8efc   * externals-list: Convert advice-patch to :external
  discards  7f2c4d5   * externals-list: Convert ampc to :external
  discards  6c35c3b   * externals-list: Convert adaptive-wrap to :external
  discards  0e264ea   * externals-list: Convert ada-ref-man to :external
  discards  e2889e15a * externals-list: Convert arbitools to :external
  discards  731563f   * externals-list: Convert ascii-art-to-unicode to 
:external
  discards  3259b8f   * externals-list: Convert aumix-mode to :external
  discards  7aaeef2   * externals-list: Convert brief to :external
  discards  797a960   * externals-list: Convert csv-mode to :external
  discards  4af5033   * externals-list: Convert debbugs to :external
  discards  7c6bb18   * externals-list: Convert djvu to :external
  discards  3156091   * externals-list: Convert ebdb-i18n-chn to :external
  discards  a41eed6   * externals-list: Convert ediprolog to :external
  discards  536ef75   * externals-list: Convert excorporate to :external
  discards  6160089   * externals-list: Convert gnugo to :external
  discards  f98a4d2   * externals-list: Convert load-dir to :external
  discards  98af7cd   * externals-list: Convert fsm to :external
  discards  6d666f6   * externals-list: Convert sisu-mode to :external
  discards  d5cb737   * externals-list: Convert shen-mode to :external
  discards  c2ba732   * externals-list: Convert rcirc-color to :external
  discards  7cef7c1   * externals-list: Convert gited to :external
  discards  c4a55e3   * externals-list: Convert gle-mode to :external
  discards  84383de   * externals-list: Convert gle-mode.el to :external
  discards  18465e3   * externals-list: Convert html5-schema to :external
  discards  61f91e2   * externals-list: Convert json-mode to :external
  discards  128cb20   * externals-list: Convert midi-kbd to :external
  discards  f454133   * externals-list: Convert lmc to :external
  discards  f53856d   * externals-list: Convert metar to :external
  discards  be87268   * externals-list: Convert markchars to :external
  discards  c2cbe67   * externals-list: Convert myers to :external
  discards  27b472c   * externals-list: Convert jgraph-mode to :external
  discards  12cef5c   * externals-list: Convert num3-mode to :external
  discards  431fe78   * externals-list: Convert register-list to :external
  discards  0a369c8   * externals-list: Convert nlinum to :external
  discards  0d99f42   * externals-list: Convert nhexl-mode to :external
  discards  60de078   * externals-list: Convert rbit to :externa

[elpa] branch master created (now f1727b0)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch master.

at  f1727b0   New dummy branch to announce deletion

This branch includes the following new commits:

   new  f1727b0   New dummy branch to announce deletion




[elpa] master f1727b0: New dummy branch to announce deletion

2020-12-18 Thread Stefan Monnier
branch: master
commit f1727b0c61b851c1f7f9092b83befee1d0eb76e5
Author: Stefan Monnier 
Commit: Stefan Monnier 

New dummy branch to announce deletion
---
 BRANCH DELETED| 0
 USE BRANCH `main` INSTEAD | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/BRANCH DELETED b/BRANCH DELETED
new file mode 100644
index 000..e69de29
diff --git a/USE BRANCH `main` INSTEAD b/USE BRANCH `main` INSTEAD
new file mode 100644
index 000..e69de29



[elpa] branch externals/kiwix created (now 905a413)

2020-12-18 Thread Stefan Monnier
monnier pushed a change to branch externals/kiwix.

at  905a413   Fix #4 add GNU license info in package source code file

This branch includes the following new commits:

   new  4701ab9   Initial commit
   new  e49d830   temporary push a not working version.
   new  4dac833   use Org-mode format README
   new  e7edd5e   rename old kiwix.el to kiwix-http.el
   new  004193f   first working version
   new  516f512   update defcustom properties
   new  1521481   update functions
   new  53f2b72   add file kiwix-at-point.el
   new  06ad0af   remove duplicate function names
   new  6d7bc71   change default Kiwix library
   new  06c466e   fix Kiwix query need to capitalized
   new  c325402   fix add kiwix link abbrev to org-mode list
   new  5f60967   use browse-url to replace custom browser custom
   new  377f3fa   add package metadata
   new  126b172   update defgroup and defcustom
   new  e54e80a   update function variables
   new  d0da8cd   make package description clear
   new  bd0fe09   setq-local depend on cl-lib
   new  7413397   add options to whether add org-mode link support
   new  9c9d784   fix cl-lib dependent issue
   new  5d25121   fix alias function name
   new  5990cc7   improve query function to specify library
   new  aa4ac22   improve interactive function
   new  d684140   Quote path argument each time it's used
   new  511a11c   Merge pull request #1 from purcell/patch-1
   new  b585e25   move org-mode relative code to commentary
   new  06b5d36   Merge branch 'master' of github.com:stardiviner/kiwix.el
   new  f43e006   add Kiwix installation commentary
   new  1782487   re-enable org-mode wiki link support
   new  cfef75f   improve org-mode wiki: link support
   new  af10bd6   fix org link exporting encoding
   new  e527614   Merge branch 'release/v0.2.1'
   new  00c5a17   Merge tag 'v0.2.1' into develop
   new  164cf9c   disable Wikipedia_Local link abbrev
   new  76c0b5a   temporarily disable org-mode link store prompt issue
   new  e35ef5e   Merge branch 'release/v0.2.2'
   new  96e8d37   Merge tag 'v0.2.2' into develop
   new  c3e2d85   fix query is chinese string issue
   new  97822f1   convert between librarie full name and abbrev.
   new  9774c61   update elisp link matching regexp
   new  c09f7ad   optimize open link function
   new  c5df1ac   Merge branch 'release/v0.3.0'
   new  fb92b4f   Merge tag 'v0.3.0' into develop
   new  1c1   improve library fragment
   new  6e6959b   improve custom options
   new  90ac73a   update README declaration
   new  b84a5ff   Merge branch 'release/v0.4.0'
   new  f6a5f4c   Merge tag 'v0.4.0' into develop
   new  160b228   fix cl-lib version
   new  90658b7   support old format library name
   new  19bfe4f   add an option to let kiwix-at-point search interactively
   new  d4fbf7b   define function ahead
   new  5bfc5a2   support more flexible library name
   new  f1554ba   fix some default library abbr name.
   new  4968e3d   error when query is invalid.
   new  1b9f25b   add interactively called function.
   new  d5e1ad0   add config section comments.
   new  38986bb   Merge branch 'release/v0.4.3'
   new  2e2d64d   Merge tag 'v0.4.3' into develop
   new  8855ac4   delete deprecated source code files.
   new  634b5ae   enhance function kiwix-query to support space between 
strings.
   new  fb83985   Merge branch 'master' into develop
   new  ec62ab0   Merge branch 'release/v0.5.0'
   new  a11fcd4   remove org-mode link prefix setup
   new  74ce07a   fix query invalid when the query contains space
   new  6e85607   validate query is english or non-english.
   new  45cc8ef   add some links test.
   new  686bac6   fix query validating regexp
   new  47d968a   update add org-mode link functions to Org-mode 9.0
   new  f84b449   autoload Org-mode link adding
   new  3485131   Merge branch 'develop'
   new  2d33910   Merge tag 'v0.5.0' into develop
   new  21b5dfe   fix variable invalid for autoload kiwix
   new  d9bab20   Merge branch 'release/v0.5.1'
   new  f86cb0d   Merge tag 'v0.5.1' into develop
   new  33d6608   org-mode wiki: link store function solved.
   new  3dab002   only capitalize the first word of string.
   new  6fb8354   Merge branch 'release/v0.5.2'
   new  49fdf02   add custom option for specifying your native language 
library
   new  ea54acf   extract get org-mode link library to a single function
   new  5cba3b5   add a test for only capitalize the first word
   new  9d16244   Merge tag 'v0.5.2' into develop
   new  43e0547   Merge branch 'release/v0.6.0'
   new  72aadb4   Merge tag 'v0.6.0' into develop
   new  cc86dc7   load for `org-link-set-parameters'
   new  4102205   load 

[elpa] externals/kiwix e7edd5e 004/192: rename old kiwix.el to kiwix-http.el

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit e7edd5e82d00378dc08c18a5f535ede8b6450abb
Author: stardiviner 
Commit: stardiviner 

rename old kiwix.el to kiwix-http.el
---
 kiwix.el => kiwix-http.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix-http.el
similarity index 96%
rename from kiwix.el
rename to kiwix-http.el
index 25a2d7c..db57811 100644
--- a/kiwix.el
+++ b/kiwix-http.el
@@ -1,4 +1,4 @@
-;;; kiwix.el --- Emacs client to Kiwix.
+;;; kiwix-http.el
 ;;; -*- coding: utf-8 -*-
 
 ;;; Commentary:
@@ -72,6 +72,6 @@ Return a list of results."
 
 
 
-(provide 'kiwix)
+(provide 'kiwix-http)
 
-;;; kiwix.el ends here
+;;; kiwix-http.el ends here



[elpa] externals/kiwix 4dac833 003/192: use Org-mode format README

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 4dac83349ccaa08b9b586ad01647e111874d6edd
Author: stardiviner 
Commit: stardiviner 

use Org-mode format README
---
 README.md  |  2 --
 README.org | 61 +
 2 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
deleted file mode 100644
index 9afe273..000
--- a/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# kiwix.el
-Search kiwix with kiwix HTTP server.
diff --git a/README.org b/README.org
new file mode 100644
index 000..858fafa
--- /dev/null
+++ b/README.org
@@ -0,0 +1,61 @@
+* How does this extension work?
+
+** integrate with Emacs
+
+*** core
+
+I found Kiwix will return a URL like this:
+
+#+BEGIN_EXAMPLE
+http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
+  _  __  _
+
+< server address >< library >
+#+END_EXAMPLE
+
+*** steps
+
+1. auto start ~kiwix-serve~ HTTP server.
+2. query/search on kiwix server.
+   1. open kiwix server index page to input to search. (But this is slow, 
waste time)
+   2. use http language binding library to query on kiwix HTTP server.
+  1. select library in library list page.
+  2. after load a library, simulate type query string in the search input
+ box, the submit to search.
+  3. return the result page HTML or page URL.
+  4. view the result with page URL or page HTML with Emacs browser.
+
+*** auto start kiwix HTTP server
+
+Here is a simple script, you can put it in Linux "*auto-start*".
+
+#+BEGIN_SRC sh :tangle "~/scripts/kiwix-server.sh"
+#!/usr/bin/env sh
+
+/usr/lib/kiwix/bin/kiwix-serve --library --port=8000 --daemon 
~/.www.kiwix.org/kiwix/8ip89lik.default/data/library/library.xml
+#+END_SRC
+
+*** search
+
+1. kiwix-search command -> return a list of results.
+
+   #+BEGIN_SRC sh
+   /usr/lib/kiwix/bin/kiwix-search 
~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx
 linux
+   #+END_SRC
+
+2. use one element of list as part of the URL.
+
+   
http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
+
+   #+BEGIN_SRC emacs-lisp
+   (browse-url (concat "http://127.0.0.1:8000/"; "LIBRARY" "A" "RESULT"))
+   #+END_SRC
+
+
+*** more advanced?
+
+If you want more advanced functions, you can use communicate kiwix HTTP server
+with RESTful API.
+
+- I don't know what Emacs library to use.
+- Or you can use other language to do this, like Ruby or Python etc.



[elpa] externals/kiwix 4701ab9 001/192: Initial commit

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 4701ab97b3200c6d8694c762dacff8592737893c
Author: stardiviner 
Commit: stardiviner 

Initial commit
---
 .gitignore |   5 +
 LICENSE| 674 +
 README.md  |   2 +
 3 files changed, 681 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..9b4291b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+# Compiled
+*.elc
+
+# Packaging
+.cask
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..9cecc1d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+

[elpa] externals/kiwix e49d830 002/192: temporary push a not working version.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit e49d8306c5052484d0a64583f671c40a2393
Author: stardiviner 
Commit: stardiviner 

temporary push a not working version.

Hope someone can involve in to make it better.
---
 kiwix.el | 77 
 1 file changed, 77 insertions(+)

diff --git a/kiwix.el b/kiwix.el
new file mode 100644
index 000..25a2d7c
--- /dev/null
+++ b/kiwix.el
@@ -0,0 +1,77 @@
+;;; kiwix.el --- Emacs client to Kiwix.
+;;; -*- coding: utf-8 -*-
+
+;;; Commentary:
+
+
+
+;;; Code:
+
+
+(defcustom kiwix-search-command "/usr/lib/kiwix/bin/kiwix-search"
+  "The kiwix-search command path."
+  :group 'kiwix)
+(defcustom kiwix-data-profile-path "~/.www.kiwix.org/kiwix/8ip89lik.default/"
+  "The kiwix profile data directory."
+  :group 'kiwix)
+
+(defvar kiwix-data-index-path nil)
+
+(setq kiwix-data-index-path (concat kiwix-data-profile-path "data/index/"))
+
+(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";)
+  )
+
+(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.
+ (mapcar #'(lambda (file)
+ (let ((zim-file (string-match-p ".*\\.zim" file)))
+   zim-file))
+ (directory-files kiwix-data-index-path)
+ )))
+libraries))
+
+(defun kiwix-serve-search (library query)
+  "Execute shell command `kiwix-search' on `LIBRARY' with `QUERY'.
+Return a list of results."
+  (let ((search-results (shell-command
+ (concat kiwix-search-command " "
+ kiwix-data-profile-path kiwix-data-index-path
+ library " " query
+ " 2> /dev/null"
+search-results)
+  )
+
+(defun kiwix-serve-query (library)
+  "Query kiwix HTTP server in a specific `LIBRARY'."
+  (interactive ; FIXME: Don't know where is wrong yet.
+   (list (completing-read
+  "Kiwix Library: "
+  (let (libraries)
+(dolist (elt (kiwix-libraries))
+  (setq libraries (append libraries (list (car elt)
+libraries
+  
+  (let ((query (read-from-minibuffer "Kiwix Query: "))
+(results (kiwix-search library query))
+(result (interactive
+ (list (completing-read
+"select a result to visit: "
+results)
+(browse-url-conkeror
+ (concat "http://127.0.0.1:8000/"; library "/A/" result))
+)
+  )
+
+
+
+(provide 'kiwix)
+
+;;; kiwix.el ends here



[elpa] externals/kiwix 06ad0af 009/192: remove duplicate function names

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 06ad0afbe58b7951f8959fad18440a84690389c5
Author: stardiviner 
Commit: stardiviner 

remove duplicate function names
---
 kiwix-http.el | 18 --
 1 file changed, 18 deletions(-)

diff --git a/kiwix-http.el b/kiwix-http.el
index 09f720c..fae7b13 100644
--- a/kiwix-http.el
+++ b/kiwix-http.el
@@ -88,24 +88,6 @@ Return a list of results."
 )
   )
 
-;; 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] externals/kiwix 004193f 005/192: first working version

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 004193f419c1c37cb548db22a27b06e8e779ccf7
Author: stardiviner 
Commit: stardiviner 

first working version
---
 kiwix.el | 73 
 1 file changed, 73 insertions(+)

diff --git a/kiwix.el b/kiwix.el
new file mode 100644
index 000..ff1b37c
--- /dev/null
+++ b/kiwix.el
@@ -0,0 +1,73 @@
+;;; kiwix.el --- Kiwix interface and support for Emacs.
+;;; -*- coding: utf-8 -*-
+
+;;; Commentary:
+
+
+
+;;; Code:
+
+
+(defgroup kiwix nil
+  "kiwix group."
+  :group 'custom-group)
+
+(defcustom kiwix-browser "google-chrome-stable"
+  "Specify browser for Kiwix visiting."
+  :group 'kiwix)
+
+(defcustom kiwix-default-library "wikipedia_zh_all_2015-11"
+  "Specify the default Kiwix library you want to search."
+  :group 'kiwix)
+
+;; launch Kiwix server
+;;;###autoload
+(defun kiwix-launch-server ()
+  "Launch Kiwix server."
+  (interactive)
+  
+  (let ((kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve ")
+(kiwix-server-library-option "--library ")
+(kiwix-server-port "--port=8000 ")
+(kiwix-server-daemon "--daemon ")
+(kiwix-server-library-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/8ip89lik.default/data/library/library.xml"))
+)
+(async-shell-command
+ (concat kiwix-server-command kiwix-server-library-option 
kiwix-server-port kiwix-server-daemon kiwix-server-library-path
+
+
+(defun kiwix-query (query)
+  "Search `QUERY' with Kiwix."
+  (let* ((browser kiwix-browser)
+ (kiwix-server "http://127.0.0.1:8000/";)
+ (kiwix-library kiwix-default-library)
+ (url (concat kiwix-server kiwix-library "/A/" query ".html")))
+(shell-command (concat browser " " url
+
+;;;###autoload
+(defun kiwix-at-point (&optional input)
+  "Search for the symbol at point with `kiwix-query' with `INPUT'."
+  (interactive "P")
+  (let* ((query-string (if mark-active
+   (buffer-substring (region-beginning) (region-end))
+ (thing-at-point 'symbol
+(kiwix-query (if (or input (null query-string))
+ (read-string "Kiwix search: " query-string-input)
+   query-string
+
+;;; Support Org-mode
+;; [[wiki:]]
+;; for open wiki search query with local application database.
+(defalias 'org-wiki-link-open 'kiwix-search)
+
+(org-add-link-type "wiki" 'org-wiki-link-open)
+
+;; [[Wikipedia_Local:]]
+(add-to-list
+ org-link-abbrev-alist
+ '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";))
+
+
+(provide 'kiwix)
+
+;;; kiwix.el ends here



[elpa] externals/kiwix c325402 012/192: fix add kiwix link abbrev to org-mode list

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit c3254029b44e44fa59fd9e089e09db8ec599f958
Author: stardiviner 
Commit: stardiviner 

fix add kiwix link abbrev to org-mode list
---
 kiwix.el | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 061dc69..a6802f7 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -63,9 +63,14 @@
 (org-add-link-type "wiki" 'org-wiki-link-open)
 
 ;; [[Wikipedia_Local:]]
-(add-to-list
- org-link-abbrev-alist
- '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";))
+(if (and
+ (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
+ (assoc "Wikipedia_Local" org-link-abbrev-alist))
+
+(setq org-link-abbrev-alist
+  (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
+  )
+
 
 
 (provide 'kiwix)



[elpa] externals/kiwix 516f512 006/192: update defcustom properties

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 516f5126c5eca4252f8fa0bba15b9ff99b43c7b6
Author: stardiviner 
Commit: stardiviner 

update defcustom properties
---
 kiwix-http.el | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/kiwix-http.el b/kiwix-http.el
index db57811..71f0688 100644
--- a/kiwix-http.el
+++ b/kiwix-http.el
@@ -8,12 +8,28 @@
 ;;; Code:
 
 
+(require 'cl-lib)
+
+;; FIXME:
+;; should use a standard where function to find path.
+;; you may can define a function instead or a constant holding the relative 
path, then make use of it when needed.
 (defcustom kiwix-search-command "/usr/lib/kiwix/bin/kiwix-search"
   "The kiwix-search command path."
-  :group 'kiwix)
+  :type 'string
+  :group 'kiwix
+  :safe 'stringp)
 (defcustom kiwix-data-profile-path "~/.www.kiwix.org/kiwix/8ip89lik.default/"
   "The kiwix profile data directory."
-  :group 'kiwix)
+  :type 'string
+  :group 'kiwix
+  :safe 'stringp)
+
+;; TODO: replace `browse-url'
+(defcustom kiwix-browser-function 'browse-url-conkeror
+  "Specify browser function to open kiwix search result."
+  :type 'function
+  :group 'kiwix
+  :safe 'functionp)
 
 (defvar kiwix-data-index-path nil)
 



[elpa] externals/kiwix 06c466e 011/192: fix Kiwix query need to capitalized

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 06c466ed6410cddcb53df1aa567cf3e2741ccbee
Author: stardiviner 
Commit: stardiviner 

fix Kiwix query need to capitalized
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 610dc4a..061dc69 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -41,7 +41,7 @@
   (let* ((browser kiwix-browser)
  (kiwix-server "http://127.0.0.1:8000/";)
  (kiwix-library kiwix-default-library)
- (url (concat kiwix-server kiwix-library "/A/" query ".html")))
+ (url (concat kiwix-server kiwix-library "/A/" (capitalize query) 
".html")))
 (shell-command (concat browser " " url
 
 ;;;###autoload



[elpa] externals/kiwix 53f2b72 008/192: add file kiwix-at-point.el

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 53f2b72a58680a0db0377786cb33412639de9c75
Author: stardiviner 
Commit: stardiviner 

add file kiwix-at-point.el
---
 kiwix-at-point.el | 104 ++
 1 file changed, 104 insertions(+)

diff --git a/kiwix-at-point.el b/kiwix-at-point.el
new file mode 100644
index 000..d0cfbe5
--- /dev/null
+++ b/kiwix-at-point.el
@@ -0,0 +1,104 @@
+;;; kiwix-at-point.el --- Kiwix client for Emacs
+;;; -*- coding: utf-8 -*-
+
+;;; Commentary:
+
+
+
+;;; Code:
+
+(defgroup kiwix-at-point nil
+  "Search in Kiwix for text at point."
+  :group 'external)
+
+(defcustom kiwix-at-point-library-alist
+  ;; e.g. 
"~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx"
+  '((wikipedia . "")
+(wiktionary . "")
+(wikinews . "")
+(wikibooks . "")
+(wikiquote . "")
+(wikisource . "")
+(wikiversity . "")
+(wikimed . "") ; "WikiMed Medical Encyclopedia" "Wikispecies"
+)
+  "Alist which contains available kiwix libraries."
+  :type '(repeat 'string)
+  :group 'kiwix-at-point)
+
+(defvar kiwix-at-point-library nil
+  "Variable used to specify the library for the current search.")
+(make-variable-buffer-local 'kiwix-at-point-library)
+
+(defvar kiwix-at-point--library-history nil)
+
+(defun kiwix-at-point-get-library ()
+  "Guess which library suit to the current search."
+  (or kiwix-at-point-library
+  kiwix-at-point--library-history))
+
+(defun kiwix-at-point-maybe-specify-library (search-string)
+  "Prefix SEARCH-STRING with the guessed library, if any."
+  (let ((library (kiwix-at-point-get-library)))
+(concat (when library
+  (concat library ":"))
+search-string)))
+
+(defun kiwix-at-point-get-idx ()
+  "Get the idx file path."
+  ;; TODO:
+  )
+
+(defun kiwix-at-point-run-search (search)
+  (if (executable-find "kiwix")
+  ;; TODO:
+  (start-process "Kiwix" nil "kiwix-search" (kiwix-at-point-get-idx) 
search)
+(message "Kiwix wasn't found, install it first http://www.kiwix.org";)))
+
+;;;###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-at-point-maybe-specify-library thing)))
+(kiwix-at-point-run-search
+ (if (or edit-search (null thing))
+ (read-string "Kiwix search: " search)
+   search
+
+(defun kiwix-at-point--library-candidates ()
+  kiwix-at-point-library-alist)
+
+(defun kiwix-at-point--set-library-prompt ()
+  (let ((default-library (kiwix-at-point-get-library)))
+(format "Kiwix library%s: "
+(if default-library
+(format "[Default: %s]" default-library)
+  ""
+
+;;;###autoload
+(defun kiwix-at-point-set-library ()
+  "Set current search's library."
+  (interactive)
+  (let ((minibuffer-local-completion-map
+ (copy-keymap minibuffer-local-completion-map)))
+(define-key minibuffer-local-completion-map (kbd "SPC") nil)
+(setq-local kiwix-at-point-library
+(completing-read (kiwix-at-point--set-library-prompt)
+ (kiwix-at-point--library-candidates) nil nil 
nil
+ 'kiwix-at-point--library-history 
(kiwix-at-point-get-library)
+
+;;;###autoload
+(defun kiwix-at-point-search (&optional edit-search)
+  "Prompt and search in Kiwix."
+  (interactive "P")
+  (let ((search (kiwix-at-point-maybe-specify-library "")))
+(kiwix-at-point-run-search
+ (read-string "Kiwix search: " search
+
+
+(provide 'kiwix-at-point)
+
+;;; kiwix-at-point.el ends here



[elpa] externals/kiwix 1521481 007/192: update functions

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 15214814bba506910cc66e18f38d86ebe4a8de6f
Author: stardiviner 
Commit: stardiviner 

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] externals/kiwix 5990cc7 022/192: improve query function to specify library

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 5990cc71475477070b7d7f5dfad52a863453234b
Author: stardiviner 
Commit: stardiviner 

improve query function to specify library
---
 kiwix.el | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 5a9d144..e138aa6 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -24,6 +24,11 @@
 (defgroup kiwix nil
   "Kiwix customization options.")
 
+(defcustom kiwix-server-url "http://127.0.0.1:8000/";
+  "Specify Kiwix server URL."
+  :type 'string
+  :group 'kiwix)
+
 (defcustom kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve "
   "Specify kiwix server command."
   :type 'string
@@ -69,11 +74,12 @@
  (concat kiwix-server-command library port daemon library-path
 
 
-(defun kiwix-query (query)
-  "Search `QUERY' with Kiwix."
-  (let* ((kiwix-server "http://127.0.0.1:8000/";)
- (kiwix-library kiwix-default-library)
- (url (concat kiwix-server kiwix-library "/A/" (capitalize query) 
".html")))
+(defun kiwix-query (query &optional library)
+  "Search `QUERY' in `LIBRARY' with Kiwix."
+  (let* ((kiwix-library (if library
+library
+  kiwix-default-library))
+ (url (concat kiwix-server-url kiwix-library "/A/" (capitalize query) 
".html")))
 (browse-url url)))
 
 ;;;###autoload



[elpa] externals/kiwix 5d25121 021/192: fix alias function name

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 5d2512174f8bbd8bd461f970a1bd2d7b273c3066
Author: stardiviner 
Commit: stardiviner 

fix alias function name
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index e87a7bd..5a9d144 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -90,7 +90,7 @@
 ;;; Support Org-mode
 ;; [[wiki:]]
 ;; for open wiki search query with local application database.
-(defalias 'org-wiki-link-open 'kiwix-search)
+(defalias 'org-wiki-link-open 'kiwix-query)
 
 (if kiwix-support-org-mode-link-type
 (org-add-link-type "wiki" 'org-wiki-link-open))



[elpa] externals/kiwix 5f60967 013/192: use browse-url to replace custom browser custom

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 5f60967f4ac83eb1d6b7a63b6f6ec3668e4171dc
Author: stardiviner 
Commit: stardiviner 

use browse-url to replace custom browser custom
---
 kiwix.el | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index a6802f7..7fde947 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -12,10 +12,6 @@
   "kiwix group."
   :group 'custom-group)
 
-(defcustom kiwix-browser "google-chrome-stable"
-  "Specify browser for Kiwix visiting."
-  :group 'kiwix)
-
 (defcustom kiwix-default-library "wikipedia_en_all_2016-02"
   "Specify the default Kiwix library you want to search."
   :group 'kiwix)
@@ -38,11 +34,10 @@
 
 (defun kiwix-query (query)
   "Search `QUERY' with Kiwix."
-  (let* ((browser kiwix-browser)
- (kiwix-server "http://127.0.0.1:8000/";)
+  (let* ((kiwix-server "http://127.0.0.1:8000/";)
  (kiwix-library kiwix-default-library)
  (url (concat kiwix-server kiwix-library "/A/" (capitalize query) 
".html")))
-(shell-command (concat browser " " url
+(browse-url url)))
 
 ;;;###autoload
 (defun kiwix-at-point (&optional input)



[elpa] externals/kiwix 7413397 019/192: add options to whether add org-mode link support

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 74133973ef8867566b9fb8fec9e0e060ff04a8e7
Author: stardiviner 
Commit: stardiviner 

add options to whether add org-mode link support
---
 kiwix.el | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 9b79da4..1e892f4 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -44,6 +44,16 @@
   :type 'string
   :group 'kiwix)
 
+(defcustom kiwix-support-org-mode-link-type t
+  "Add support for Org-mode Kiwix link type."
+  :type 'boolean
+  :group 'kiwix)
+
+(defcustom kiwix-support-org-mode-link-abbrev t
+  "Add support for Org-mode Kiwix link abbrev."
+  :type 'boolean
+  :group 'kiwix)
+
 ;; launch Kiwix server
 ;;;###autoload
 (defun kiwix-launch-server ()
@@ -82,10 +92,12 @@
 ;; for open wiki search query with local application database.
 (defalias 'org-wiki-link-open 'kiwix-search)
 
-(org-add-link-type "wiki" 'org-wiki-link-open)
+(if kiwix-support-org-mode-link-type
+(org-add-link-type "wiki" 'org-wiki-link-open))
 
 ;; [[Wikipedia_Local:]]
 (if (and
+ kiwix-support-org-mode-link-abbrev
  (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
  (assoc "Wikipedia_Local" org-link-abbrev-alist))
 



[elpa] externals/kiwix 6d7bc71 010/192: change default Kiwix library

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 6d7bc71d2dc33e123c800b05b0bb98b0aea03ed1
Author: stardiviner 
Commit: stardiviner 

change default Kiwix library
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index ff1b37c..610dc4a 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -16,7 +16,7 @@
   "Specify browser for Kiwix visiting."
   :group 'kiwix)
 
-(defcustom kiwix-default-library "wikipedia_zh_all_2015-11"
+(defcustom kiwix-default-library "wikipedia_en_all_2016-02"
   "Specify the default Kiwix library you want to search."
   :group 'kiwix)
 



[elpa] externals/kiwix f43e006 028/192: add Kiwix installation commentary

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit f43e006ee45e747bc293fc77c0ac2a79962f864e
Author: stardiviner 
Commit: stardiviner 

add Kiwix installation commentary
---
 kiwix.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/kiwix.el b/kiwix.el
index 18b4883..b65c2d1 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -13,6 +13,10 @@
 
 ;;; This currently only works for Linux, not tested for Mac OS X and Windows.
 
+;;; Kiwix installation
+;;
+;; http://www.kiwix.org
+
 ;;; Usage:
 ;;
 ;; [M-x kiwix-launch-server] to launch Kiwix server.



[elpa] externals/kiwix 126b172 015/192: update defgroup and defcustom

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 126b172132b92814965d6378bcfda03c8ac3a472
Author: stardiviner 
Commit: stardiviner 

update defgroup and defcustom
---
 kiwix.el | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 8f173bc..7d4595e 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -22,11 +22,26 @@
 
 
 (defgroup kiwix nil
-  "kiwix group."
-  :group 'custom-group)
+  "Kiwix customization options.")
+
+(defcustom kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve "
+  "Specify kiwix server command."
+  :type 'string
+  :group 'kiwix)
+
+(defcustom kiwix-default-data-path "8ip89lik.default"
+  "Specify the default Kiwix data profile path."
+  :type 'string
+  :group 'kiwix)
 
 (defcustom kiwix-default-library "wikipedia_en_all_2016-02"
   "Specify the default Kiwix library you want to search."
+  :type 'string
+  :group 'kiwix)
+
+(defcustom kiwix-server-port "8000"
+  "Specify the default Kiwix server port."
+  :type 'string
   :group 'kiwix)
 
 ;; launch Kiwix server



[elpa] externals/kiwix d0da8cd 017/192: make package description clear

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit d0da8cd4048679e1cc7c17449fedc4df2acfa289
Author: stardiviner 
Commit: stardiviner 

make package description clear
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 845e067..9b79da4 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -1,4 +1,4 @@
-;;; kiwix.el --- Kiwix interface and support for Emacs.
+;;; kiwix.el --- Kiwix interface and support.
 ;;; -*- coding: utf-8 -*-
 
 ;; Author: stardiviner 



[elpa] externals/kiwix 9c9d784 020/192: fix cl-lib dependent issue

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 9c9d784dd1a9a293b5c5aee6b7ceefcb88a1b9fe
Author: stardiviner 
Commit: stardiviner 

fix cl-lib dependent issue
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 1e892f4..e87a7bd 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 0.1.0
-;; Package-Requires: ((emacs "24.3") (cl-lib "2"))
+;; Package-Requires: ((emacs "24.3"))
 
 ;;; Commentary:
 



[elpa] externals/kiwix b585e25 026/192: move org-mode relative code to commentary

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit b585e253f7ad25e85b876c8ab11c463fc6cdc49f
Author: stardiviner 
Commit: stardiviner 

move org-mode relative code to commentary
---
 kiwix.el | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 6167158..c1052b7 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -18,6 +18,25 @@
 ;; [M-x kiwix-launch-server] to launch Kiwix server.
 ;; [M-x kiwix-at-point] to search the word under point or the region selected 
string.
 
+
+;; ;;; Support Org-mode
+;; ;; [[wiki:]]
+;; ;; for open wiki search query with local application database.
+;; (defalias 'org-wiki-link-open 'kiwix-query)
+
+;; (if kiwix-support-org-mode-link-type
+;; (org-add-link-type "wiki" 'org-wiki-link-open))
+
+;; ;; [[Wikipedia_Local:]]
+;; (if (and
+;;  kiwix-support-org-mode-link-abbrev
+;;  (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
+;;  (assoc "Wikipedia_Local" org-link-abbrev-alist))
+
+;; (setq org-link-abbrev-alist
+;;   (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
+;;   )
+
 ;;; Code:
 
 
@@ -110,25 +129,6 @@ for query string and library interactively."
  kiwix-libraries)
 (kiwix-query query-string library)))
 
-;;; Support Org-mode
-;; [[wiki:]]
-;; for open wiki search query with local application database.
-(defalias 'org-wiki-link-open 'kiwix-query)
-
-(if kiwix-support-org-mode-link-type
-(org-add-link-type "wiki" 'org-wiki-link-open))
-
-;; [[Wikipedia_Local:]]
-(if (and
- kiwix-support-org-mode-link-abbrev
- (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
- (assoc "Wikipedia_Local" org-link-abbrev-alist))
-
-(setq org-link-abbrev-alist
-  (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
-  )
-
-
 
 (provide 'kiwix)
 



[elpa] externals/kiwix aa4ac22 023/192: improve interactive function

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit aa4ac221279c792c1ef98cb88a0e259522a7647d
Author: stardiviner 
Commit: stardiviner 

improve interactive function
---
 kiwix.el | 37 +++--
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index e138aa6..6167158 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -34,11 +34,16 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path "8ip89lik.default"
+(defcustom kiwix-default-data-profile-name "8ip89lik.default"
   "Specify the default Kiwix data profile path."
   :type 'string
   :group 'kiwix)
 
+(defcustom kiwix-default-data-path (shell-quote-argument (concat (getenv 
"HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
+  "Specify the default Kiwix data path."
+  :type 'string
+  :group 'kiwix)
+
 (defcustom kiwix-default-library "wikipedia_en_all_2016-02"
   "Specify the default Kiwix library you want to search."
   :type 'string
@@ -59,6 +64,9 @@
   :type 'boolean
   :group 'kiwix)
 
+(defvar kiwix-libraries (directory-files (concat kiwix-default-data-path 
"/data/content/") nil "\.zim")
+  "A list of Kiwix libraries.")
+
 ;; launch Kiwix server
 ;;;###autoload
 (defun kiwix-launch-server ()
@@ -68,7 +76,7 @@
   (let ((library "--library ")
 (port (concat "--port=" kiwix-server-port " "))
 (daemon "--daemon ")
-(library-path (shell-quote-argument (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-path "/data/library/library.xml")))
+(library-path (concat kiwix-default-data-path 
"/data/library/library.xml"))
 )
 (async-shell-command
  (concat kiwix-server-command library port daemon library-path
@@ -83,15 +91,24 @@
 (browse-url url)))
 
 ;;;###autoload
-(defun kiwix-at-point (&optional input)
-  "Search for the symbol at point with `kiwix-query' with `INPUT'."
+(defun kiwix-at-point (&optional interactively)
+  "Search for the symbol at point with `kiwix-query'.
+
+Or When prefix argument `INTERACTIVELY' specified, then prompt
+for query string and library interactively."
   (interactive "P")
-  (let* ((query-string (if mark-active
-   (buffer-substring (region-beginning) (region-end))
- (thing-at-point 'symbol
-(kiwix-query (if (or input (null query-string))
- (read-string "Kiwix search: " query-string-input)
-   query-string
+  (let* ((query-string (if interactively
+   (read-string "Kiwix Search: "
+(if mark-active
+(buffer-substring
+ (region-beginning) (region-end))
+  (thing-at-point 'symbol)
+ (library (when interactively
+(completing-read "Kiwix Library: "
+ (mapcar #'(lambda (var)
+ (replace-regexp-in-string 
"\.zim" "" var))
+ kiwix-libraries)
+(kiwix-query query-string library)))
 
 ;;; Support Org-mode
 ;; [[wiki:]]



[elpa] externals/kiwix 1782487 029/192: re-enable org-mode wiki link support

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 178248787c62a4cae1adccfa0179f935573734a2
Author: stardiviner 
Commit: stardiviner 

re-enable org-mode wiki link support
---
 kiwix.el | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index b65c2d1..2e1a380 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -22,25 +22,6 @@
 ;; [M-x kiwix-launch-server] to launch Kiwix server.
 ;; [M-x kiwix-at-point] to search the word under point or the region selected 
string.
 
-
-;; ;;; Support Org-mode
-;; ;; [[wiki:]]
-;; ;; for open wiki search query with local application database.
-;; (defalias 'org-wiki-link-open 'kiwix-query)
-
-;; (if kiwix-support-org-mode-link-type
-;; (org-add-link-type "wiki" 'org-wiki-link-open))
-
-;; ;; [[Wikipedia_Local:]]
-;; (if (and
-;;  kiwix-support-org-mode-link-abbrev
-;;  (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
-;;  (assoc "Wikipedia_Local" org-link-abbrev-alist))
-
-;; (setq org-link-abbrev-alist
-;;   (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
-;;   )
-
 ;;; Code:
 
 
@@ -133,6 +114,26 @@ for query string and library interactively."
  kiwix-libraries)
 (kiwix-query query-string library)))
 
+
+
+;;; Support Org-mode
+;; [[wiki:]]
+;; for open wiki search query with local application database.
+(defalias 'org-wiki-link-open 'kiwix-query)
+
+(if kiwix-support-org-mode-link-type
+(org-add-link-type "wiki" 'org-wiki-link-open))
+
+;; [[Wikipedia_Local:]]
+(if (and
+ kiwix-support-org-mode-link-abbrev
+ (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
+ (assoc "Wikipedia_Local" org-link-abbrev-alist))
+
+(setq org-link-abbrev-alist
+  (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
+  )
+
 
 (provide 'kiwix)
 



[elpa] externals/kiwix e54e80a 016/192: update function variables

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit e54e80a8bbef5dcab11d5ce473644cf0d7278f02
Author: stardiviner 
Commit: stardiviner 

update function variables
---
 kiwix.el | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 7d4595e..845e067 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -50,14 +50,13 @@
   "Launch Kiwix server."
   (interactive)
   
-  (let ((kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve ")
-(kiwix-server-library-option "--library ")
-(kiwix-server-port "--port=8000 ")
-(kiwix-server-daemon "--daemon ")
-(kiwix-server-library-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/8ip89lik.default/data/library/library.xml"))
+  (let ((library "--library ")
+(port (concat "--port=" kiwix-server-port " "))
+(daemon "--daemon ")
+(library-path (shell-quote-argument (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-path "/data/library/library.xml")))
 )
 (async-shell-command
- (concat kiwix-server-command kiwix-server-library-option 
kiwix-server-port kiwix-server-daemon kiwix-server-library-path
+ (concat kiwix-server-command library port daemon library-path
 
 
 (defun kiwix-query (query)



[elpa] externals/kiwix 06b5d36 027/192: Merge branch 'master' of github.com:stardiviner/kiwix.el

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 06b5d36281d343aa72e3968eaaeb94e9f0bfee7c
Merge: b585e25 511a11c
Author: stardiviner 
Commit: stardiviner 

Merge branch 'master' of github.com:stardiviner/kiwix.el
---
 kiwix.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index c1052b7..18b4883 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -58,7 +58,7 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path (shell-quote-argument (concat (getenv 
"HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
+(defcustom kiwix-default-data-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
   "Specify the default Kiwix data path."
   :type 'string
   :group 'kiwix)
@@ -98,7 +98,7 @@
 (library-path (concat kiwix-default-data-path 
"/data/library/library.xml"))
 )
 (async-shell-command
- (concat kiwix-server-command library port daemon library-path
+ (concat kiwix-server-command library port daemon (shell-quote-argument 
library-path)
 
 
 (defun kiwix-query (query &optional library)



[elpa] externals/kiwix d684140 024/192: Quote path argument each time it's used

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit d684140437a4b10ac1ca92912e3e59d1f9d2c22f
Author: Steve Purcell 
Commit: GitHub 

Quote path argument each time it's used
---
 kiwix.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 6167158..b9579e8 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -39,7 +39,7 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path (shell-quote-argument (concat (getenv 
"HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
+(defcustom kiwix-default-data-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
   "Specify the default Kiwix data path."
   :type 'string
   :group 'kiwix)
@@ -79,7 +79,7 @@
 (library-path (concat kiwix-default-data-path 
"/data/library/library.xml"))
 )
 (async-shell-command
- (concat kiwix-server-command library port daemon library-path
+ (concat kiwix-server-command library port daemon (shell-quote-argument 
library-path)
 
 
 (defun kiwix-query (query &optional library)



[elpa] externals/kiwix 377f3fa 014/192: add package metadata

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 377f3fae3fe6f4edf86afe5b9e53bfc5228587c0
Author: stardiviner 
Commit: stardiviner 

add package metadata
---
 kiwix.el | 13 +
 1 file changed, 13 insertions(+)

diff --git a/kiwix.el b/kiwix.el
index 7fde947..8f173bc 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -1,9 +1,22 @@
 ;;; kiwix.el --- Kiwix interface and support for Emacs.
 ;;; -*- coding: utf-8 -*-
 
+;; Author: stardiviner 
+;; Maintainer: stardiviner 
+;; Keywords: kiwix wikipedia
+;; URL: https://github.com/stardiviner/kiwix.el
+;; Created: 23th July 2016
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "24.3") (cl-lib "2"))
+
 ;;; Commentary:
 
+;;; This currently only works for Linux, not tested for Mac OS X and Windows.
 
+;;; Usage:
+;;
+;; [M-x kiwix-launch-server] to launch Kiwix server.
+;; [M-x kiwix-at-point] to search the word under point or the region selected 
string.
 
 ;;; Code:
 



[elpa] externals/kiwix 511a11c 025/192: Merge pull request #1 from purcell/patch-1

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 511a11cdd4e1244eb8c9758d63aaf8b36d3e38f7
Merge: aa4ac22 d684140
Author: stardiviner 
Commit: GitHub 

Merge pull request #1 from purcell/patch-1

Quote path argument each time it's used
---
 kiwix.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 6167158..b9579e8 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -39,7 +39,7 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path (shell-quote-argument (concat (getenv 
"HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
+(defcustom kiwix-default-data-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
   "Specify the default Kiwix data path."
   :type 'string
   :group 'kiwix)
@@ -79,7 +79,7 @@
 (library-path (concat kiwix-default-data-path 
"/data/library/library.xml"))
 )
 (async-shell-command
- (concat kiwix-server-command library port daemon library-path
+ (concat kiwix-server-command library port daemon (shell-quote-argument 
library-path)
 
 
 (defun kiwix-query (query &optional library)



[elpa] externals/kiwix e527614 032/192: Merge branch 'release/v0.2.1'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit e5276146cf90d5ffd2c3796f250d3944f6351492
Merge: cfef75f af10bd6
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.2.1'
---
 kiwix.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index d38e4f0..0124a18 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -156,13 +156,15 @@ for query string and library interactively."
  (match-string 1 link)))
  (library (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
 (match-string 2 link)))
- (query (or description
-(when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-  (match-string 3 link
- ;; "http://en.wikipedia.org/w/index.php?search=%s";
+ ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+ (query (url-encode-url
+ (or description
+ (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
+   (match-string 3 link)
+ ;; "http://en.wikipedia.org/wiki/Linux";
  ;; --
  ;;  ^- library: en, zh
- (path (concat "http://"; library ".wikipedia.org/w/index.php?search=" 
query))
+ (path (concat "http://"; library ".wikipedia.org/wiki/" query))
  (desc query))
 (when (stringp path)
   (cond



[elpa] externals/kiwix bd0fe09 018/192: setq-local depend on cl-lib

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit bd0fe091001146d76dd784a43f5dc79532ac0e3f
Author: stardiviner 
Commit: stardiviner 

setq-local depend on cl-lib
---
 kiwix-at-point.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kiwix-at-point.el b/kiwix-at-point.el
index d0cfbe5..5cedef1 100644
--- a/kiwix-at-point.el
+++ b/kiwix-at-point.el
@@ -7,6 +7,8 @@
 
 ;;; Code:
 
+(require 'cl-lib)
+
 (defgroup kiwix-at-point nil
   "Search in Kiwix for text at point."
   :group 'external)



[elpa] externals/kiwix 97822f1 039/192: convert between librarie full name and abbrev.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 97822f1ffc3d76f8bb7e2e0b1e648d018ed6ca08
Author: stardiviner 
Commit: stardiviner 

convert between librarie full name and abbrev.
---
 kiwix.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 8793e9e..f6135d3 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -140,7 +140,10 @@ for query string and library interactively."
   "Open LINK in external wiki program."
   (cond ((string-match "\\(.*\\):(\\(.*\\)):\\(.*\\)"  link)
  (let* ((type (match-string 1 link))
-(library (match-string 2 link))
+;; convert between libraries full name and abbrev.
+(library (cdr (assoc
+   (match-string 2 link)
+   kiwix-librarie-abbrev-list)))
 (query (match-string 3 link))
 (url (concat kiwix-server-url library "/A/" (url-encode-url 
(capitalize query)) ".html")))
(browse-url url)))



[elpa] externals/kiwix c09f7ad 041/192: optimize open link function

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit c09f7ad7157a76a1fb14dd5296b4734f54f0f86a
Author: stardiviner 
Commit: stardiviner 

optimize open link function
---
 kiwix.el | 44 +---
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 52b7235..c5c12be 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -73,8 +73,8 @@
(replace-regexp-in-string "\.zim" "" var))
kiwix-libraries)))
 
-(defvar kiwix-librarie-abbrev-list
-  '(("default" . "en")
+(defvar kiwix-librarie-abbrev-alist
+  '(("default" . "wikipedia_en_all_2016-02")
 ;; TODO:
 ;; (mapcar #'(lambda (var)
 ;; (string-match-p "en" var))
@@ -86,11 +86,11 @@
 (defun kiwix-select-library-abbrev ()
   "Select Wikipedia library name abbrev."
   (completing-read "Wikipedia library abbrev: "
-   (map-keys kiwix-librarie-abbrev-list)))
+   (map-keys kiwix-librarie-abbrev-alist)))
 
-(defun kiwix-select-library-fullname (abbr)
+(defun kiwix-get-library-fullname (abbr)
   "Get Kiwix library full name which is associated with `ABBR'."
-  (cdr (assoc abbr kiwix-librarie-abbrev-list)))
+  (cdr (assoc abbr kiwix-librarie-abbrev-alist)))
 
 ;; launch Kiwix server
 ;;;###autoload
@@ -152,31 +152,29 @@ for query string and library interactively."
 ;; - 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.
 
-;; TODO: deprecated
-;; (defalias 'org-wiki-link-open 'kiwix-query)
-
 (defun org-wiki-link-open (link)
   "Open LINK in external wiki program."
-  (cond ((string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; 
(library):query
- (let* (
-;; convert between libraries full name and abbrev.
-(library (kiwix-select-library-fullname (match-string 1 link)))
-(query (match-string 2 link))
-(url (concat kiwix-server-url library "/A/" (url-encode-url 
(capitalize query)) ".html")))
-   ;; (prin1 (format "library: %s, query: %s" library query))
-   (browse-url url)))
-((string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; query
- (let* ((query (match-string 2 link))
-(url (concat kiwix-server-url kiwix-default-library "/A/" 
(url-encode-url (capitalize query)) ".html")))
-   ;; (print1 (format "query: %s" query))
-   (browse-url url)
+  (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; 
(library):query
+(let* (
+   ;; convert between libraries full name and abbrev.
+   (library (kiwix-get-library-fullname (or (match-string 1 link)
+"default")))
+   (query (match-string 2 link))
+   (url (concat
+ kiwix-server-url
+ library "/A/"
+ ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+ (url-encode-url (capitalize query))
+ ".html")))
+  ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
+  (browse-url url))
+))
 
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)" link)
 (let* ((library (or (match-string 1 link)
-(kiwix-select-library-fullname "default")))
-   ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+(kiwix-get-library-fullname "default")))
(query (url-encode-url (or (match-string 2 link) description)))
;; "http://en.wikipedia.org/wiki/Linux";
;; --



[elpa] externals/kiwix 6e6959b 045/192: improve custom options

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 6e6959b148015ebee2b2436fc18a57aea19e21ea
Author: stardiviner 
Commit: stardiviner 

improve custom options

Make them smarter depend on different cases.
---
 kiwix.el | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index d481fba..d302aac 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -35,17 +35,32 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve "
+(defcustom kiwix-server-command
+  (cond
+   ((string-equal system-type "gnu/linux")
+"/usr/lib/kiwix/bin/kiwix-serve ")
+   ((string-equal system-type "darwin")
+(warn "You need to specify Mac OS X Kiwix path. And send a PR to my 
repo."))
+   ((string-equal system-type "windows-nt")
+(warn "You need to specify Windows Kiwix path. And send a PR to my 
repo.")))
   "Specify kiwix server command."
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-profile-name "8ip89lik.default"
+(defcustom kiwix-default-data-profile-name
+  (car (directory-files
+(concat
+ (getenv "HOME") "/.www.kiwix.org/kiwix")
+nil
+".*\\.default"
+))
   "Specify the default Kiwix data profile path."
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
+(defcustom kiwix-default-data-path
+  (concat
+   (getenv "HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
   "Specify the default Kiwix data path."
   :type 'string
   :group 'kiwix)



[elpa] externals/kiwix cfef75f 030/192: improve org-mode wiki: link support

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit cfef75f38a3c79ec37cb677819a8823799f8f5b6
Author: stardiviner 
Commit: stardiviner 

improve org-mode wiki: link support

- support library in link.
- support export to HTML, LaTeX format.
- limit down Kiwix libraries to only Wikipedia libraries.
- support interactively select library and library abbrev.
- support selecting library when storing wiki: link.
---
 kiwix.el | 114 ---
 1 file changed, 88 insertions(+), 26 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 2e1a380..d38e4f0 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -58,19 +58,34 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-support-org-mode-link-type t
-  "Add support for Org-mode Kiwix link type."
+(defcustom kiwix-support-org-mode-link t
+  "Add support for Org-mode Kiwix link."
   :type 'boolean
   :group 'kiwix)
 
-(defcustom kiwix-support-org-mode-link-abbrev t
-  "Add support for Org-mode Kiwix link abbrev."
-  :type 'boolean
-  :group 'kiwix)
-
-(defvar kiwix-libraries (directory-files (concat kiwix-default-data-path 
"/data/content/") nil "\.zim")
+(defvar kiwix-libraries (directory-files (concat kiwix-default-data-path 
"/data/content/") nil "wikipedia_.*_all_.*\.zim")
   "A list of Kiwix libraries.")
 
+(defun kiwix-select-library ()
+  "Select Wikipedia library full name."
+  (completing-read "Kiwix Library: "
+   (mapcar #'(lambda (var)
+   (replace-regexp-in-string "\.zim" "" var))
+   kiwix-libraries)))
+
+(defvar kiwix-librarie-abbrev-list
+  ;; TODO:
+  '(("en" . (mapcar #'(lambda (var)
+(string-match-p "en" var))
+kiwix-libraries))
+("zh" . ())
+))
+
+(defun kiwix-select-library-abbrev ()
+  "Select Wikipedia library name abbrev."
+  (completing-read "Wikipedia library abbrev: "
+   (map-keys kiwix-librarie-abbrev-list)))
+
 ;; launch Kiwix server
 ;;;###autoload
 (defun kiwix-launch-server ()
@@ -108,31 +123,78 @@ for query string and library interactively."
  (region-beginning) (region-end))
   (thing-at-point 'symbol)
  (library (when interactively
-(completing-read "Kiwix Library: "
- (mapcar #'(lambda (var)
- (replace-regexp-in-string 
"\.zim" "" var))
- kiwix-libraries)
+(kiwix-select-library
 (kiwix-query query-string library)))
 
 
 
 ;;; Support Org-mode
-;; [[wiki:]]
+;; [[wiki:(library):query]]
+;; elisp regexp: `\\(.*\\):(.*):.*'
 ;; for open wiki search query with local application database.
-(defalias 'org-wiki-link-open 'kiwix-query)
 
-(if kiwix-support-org-mode-link-type
-(org-add-link-type "wiki" 'org-wiki-link-open))
-
-;; [[Wikipedia_Local:]]
-(if (and
- kiwix-support-org-mode-link-abbrev
- (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
- (assoc "Wikipedia_Local" org-link-abbrev-alist))
-
-(setq org-link-abbrev-alist
-  (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
-  )
+;; TODO: deprecated
+;; (defalias 'org-wiki-link-open 'kiwix-query)
+
+(defun org-wiki-link-open (link)
+  "Open LINK in external wiki program."
+  (cond ((string-match "\\(.*\\):(\\(.*\\)):\\(.*\\)"  link)
+ (let* ((type (match-string 1 link))
+(library (match-string 2 link))
+(query (match-string 3 link))
+(url (concat kiwix-server-url library "/A/" (capitalize query) 
".html")))
+   (browse-url url)))
+((string-match "\\(.*\\):\\(.*\\)"  link)
+ (let* ((type (match-string 1 link))
+(query (match-string 2 link))
+(url (concat kiwix-server-url kiwix-default-library "/A/" 
(capitalize query) ".html")))
+   (browse-url url)
+
+(defun org-wiki-link-export (link description format)
+  "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
+  (let* ((type (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
+ (match-string 1 link)))
+ (library (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
+(match-string 2 link)))
+ (query (or description
+(when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
+  (match-string 3 link
+ ;; "http://en.wikipedia.org/w/index.php?search=%s";
+ ;; --
+ ;;  ^- library: en, zh
+ (path (concat "http://"; library ".wikipedia.org/w/index.php?search=" 
query))
+ (desc query))
+(when (stringp path)
+  (cond
+   ((eq for

[elpa] externals/kiwix af10bd6 031/192: fix org link exporting encoding

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit af10bd6d1932973897f2b533ea9b7772f3ae325d
Author: stardiviner 
Commit: stardiviner 

fix org link exporting encoding
---
 kiwix.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index d38e4f0..0124a18 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -156,13 +156,15 @@ for query string and library interactively."
  (match-string 1 link)))
  (library (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
 (match-string 2 link)))
- (query (or description
-(when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-  (match-string 3 link
- ;; "http://en.wikipedia.org/w/index.php?search=%s";
+ ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+ (query (url-encode-url
+ (or description
+ (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
+   (match-string 3 link)
+ ;; "http://en.wikipedia.org/wiki/Linux";
  ;; --
  ;;  ^- library: en, zh
- (path (concat "http://"; library ".wikipedia.org/w/index.php?search=" 
query))
+ (path (concat "http://"; library ".wikipedia.org/wiki/" query))
  (desc query))
 (when (stringp path)
   (cond



[elpa] externals/kiwix 76c0b5a 035/192: temporarily disable org-mode link store prompt issue

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 76c0b5a31884e1c570d33505e5492bd12993159b
Author: stardiviner 
Commit: stardiviner 

temporarily disable org-mode link store prompt issue
---
 kiwix.el | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index ce50a3f..49326f1 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -174,19 +174,23 @@ for query string and library interactively."
 
 (defun org-wiki-store-link ()
   "Store a link to a wiki link."
-  (let* ((query (read-string "Wiki Query: "))
- ;; TODO: test does this interactively select library abbrev works?
- (library (kiwix-select-library-abbrev))
- (link (concat "wiki:" "(" library "):" query)))
-(org-store-link-props
- :type "wiki"
- :link link
- :description query)))
+  ;; TODO: test does this interactively select library abbrev works?
+  ;; [C-c o C-l l] `org-store-link'
+  ;; remove those interactive functions. use normal function instead.
+  (when (eq major-mode 'wiki-mode)
+(let* ((query (read-string "Wiki Query: "))
+   (library (kiwix-select-library-abbrev))
+   (link (concat "wiki:" "(" library "):" query)))
+  (org-store-link-props
+   :type "wiki"
+   :link link
+   :description query
 
 (if kiwix-support-org-mode-link
 (progn
   (org-add-link-type "wiki" 'org-wiki-link-open 'org-wiki-link-export)
-  (add-hook 'org-store-link-functions 'org-wiki-store-link)
+  ;; TODO: after fix interactive store link issue. enable this adding.
+  ;; (add-hook 'org-store-link-functions 'org-wiki-store-link t)
 
   ;; [[Wikipedia_Local:]]
   ;; (if (and



[elpa] externals/kiwix fb92b4f 043/192: Merge tag 'v0.3.0' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit fb92b4f4f12cd94a4ade8aad54e4bb6738620766
Merge: 96e8d37 c5df1ac
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.3.0' into develop

improve functions a lot

- fix invalid link opening handler function.
---
 kiwix.el | 101 ---
 1 file changed, 58 insertions(+), 43 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 49326f1..c5c12be 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -73,18 +73,24 @@
(replace-regexp-in-string "\.zim" "" var))
kiwix-libraries)))
 
-(defvar kiwix-librarie-abbrev-list
-  ;; TODO:
-  '(("en" . (mapcar #'(lambda (var)
-(string-match-p "en" var))
-kiwix-libraries))
-("zh" . ())
+(defvar kiwix-librarie-abbrev-alist
+  '(("default" . "wikipedia_en_all_2016-02")
+;; TODO:
+;; (mapcar #'(lambda (var)
+;; (string-match-p "en" var))
+;; kiwix-libraries)
+("en" . "wikipedia_en_all_2016-02")
+("zh" . "wikipedia_zh_all_2015-11")
 ))
 
 (defun kiwix-select-library-abbrev ()
   "Select Wikipedia library name abbrev."
   (completing-read "Wikipedia library abbrev: "
-   (map-keys kiwix-librarie-abbrev-list)))
+   (map-keys kiwix-librarie-abbrev-alist)))
+
+(defun kiwix-get-library-fullname (abbr)
+  "Get Kiwix library full name which is associated with `ABBR'."
+  (cdr (assoc abbr kiwix-librarie-abbrev-alist)))
 
 ;; launch Kiwix server
 ;;;###autoload
@@ -106,7 +112,7 @@
   (let* ((kiwix-library (if library
 library
   kiwix-default-library))
- (url (concat kiwix-server-url kiwix-library "/A/" (capitalize query) 
".html")))
+ (url (concat kiwix-server-url kiwix-library "/A/" (url-encode-url 
(capitalize query)) ".html")))
 (browse-url url)))
 
 ;;;###autoload
@@ -129,48 +135,57 @@ for query string and library interactively."
 
 
 ;;; Support Org-mode
-;; [[wiki:(library):query]]
-;; elisp regexp: `\\(.*\\):(.*):.*'
+;;
+;; - [[wiki:(library):query]]
+;; - [[wiki:query]]
+;;
+;; links:
+;; - wiki:(zh):%E7%A6%85%E5%AE%97
+;; - wiki:(en):linux
+;; - wiki:linux
+;;
+;; - parameter `link' will be (en):linux" or linux".
+;;
+;; elisp regexp: "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"
+;; - non capturing group (\(?:...\)) for optional library
+;; - group 1: library (en or zh)
+;; - 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.
 
-;; TODO: deprecated
-;; (defalias 'org-wiki-link-open 'kiwix-query)
-
 (defun org-wiki-link-open (link)
   "Open LINK in external wiki program."
-  (cond ((string-match "\\(.*\\):(\\(.*\\)):\\(.*\\)"  link)
- (let* ((type (match-string 1 link))
-(library (match-string 2 link))
-(query (match-string 3 link))
-(url (concat kiwix-server-url library "/A/" (capitalize query) 
".html")))
-   (browse-url url)))
-((string-match "\\(.*\\):\\(.*\\)"  link)
- (let* ((type (match-string 1 link))
-(query (match-string 2 link))
-(url (concat kiwix-server-url kiwix-default-library "/A/" 
(capitalize query) ".html")))
-   (browse-url url)
+  (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; 
(library):query
+(let* (
+   ;; convert between libraries full name and abbrev.
+   (library (kiwix-get-library-fullname (or (match-string 1 link)
+"default")))
+   (query (match-string 2 link))
+   (url (concat
+ kiwix-server-url
+ library "/A/"
+ ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+ (url-encode-url (capitalize query))
+ ".html")))
+  ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
+  (browse-url url))
+))
 
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
-  (let* ((type (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
- (match-string 1 link)))
- (library (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-(match-string 2 link)))
- ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
- (query (url-encode-url
- (or description
- (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-   (match-string 3 link)
- ;; "http://en.wikipedia.org/wiki/Linux";
- ;; --
- ;;  ^- library: en, zh
- (path (concat "http://"; libra

[elpa] externals/kiwix 164cf9c 034/192: disable Wikipedia_Local link abbrev

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 164cf9cbf3742ff43b06e5ed9546db81af1bea93
Author: stardiviner 
Commit: stardiviner 

disable Wikipedia_Local link abbrev
---
 kiwix.el | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 0124a18..ce50a3f 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -189,13 +189,13 @@ for query string and library interactively."
   (add-hook 'org-store-link-functions 'org-wiki-store-link)
 
   ;; [[Wikipedia_Local:]]
-  (if (and
-   (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
-   (assoc "Wikipedia_Local" org-link-abbrev-alist))
-
-  (setq org-link-abbrev-alist
-(cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
-)
+  ;; (if (and
+  ;;  (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
+  ;;  (assoc "Wikipedia_Local" org-link-abbrev-alist))
+  ;;
+  ;; (setq org-link-abbrev-alist
+  ;;   (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
+  ;;   )
   ))
 
 



[elpa] externals/kiwix 160b228 049/192: fix cl-lib version

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 160b2284e374cd30ebf0cc6efd66cc40712be147
Author: stardiviner 
Commit: stardiviner 

fix cl-lib version
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index d302aac..57523cd 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 0.1.0
-;; Package-Requires: ((emacs "24.3") (cl-lib "2.0"))
+;; Package-Requires: ((emacs "24.3") (cl-lib "0.5"))
 
 ;;; Commentary:
 



[elpa] externals/kiwix f1554ba 054/192: fix some default library abbr name.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit f1554bad2e8037f77fc60575fe05ecf3e8c84679
Author: stardiviner 
Commit: stardiviner 

fix some default library abbr name.
---
 kiwix.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index f22f62d..d0b6fcf 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -113,7 +113,7 @@
   "Get Kiwix library full name which is associated with `ABBR'."
   (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
 
-(defcustom kiwix-default-library "wikipedia_en"
+(defcustom kiwix-default-library "wikipedia_en_all"
   "The default kiwix library when library fragment in link not specified.")
 
 ;; add default key-value pair to libraries alist.
@@ -121,7 +121,7 @@
 (cons (list
(cons "default" (kiwix-get-library-fullname kiwix-default-library))
(cons "en" (kiwix-get-library-fullname kiwix-default-library))
-   (cons "zh" (kiwix-get-library-fullname "wikipedia_zh"
+   (cons "zh" (kiwix-get-library-fullname "wikipedia_zh_all"
   
   (push cons kiwix-libraries-abbrev-alist)
   )



[elpa] externals/kiwix 00c5a17 033/192: Merge tag 'v0.2.1' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 00c5a176d77715067ad8bce778a3ee338cdd0570
Merge: af10bd6 e527614
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.2.1' into develop

fix exported org link encoding issue



[elpa] externals/kiwix e35ef5e 036/192: Merge branch 'release/v0.2.2'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit e35ef5ec3b33b72554e97c198cecb3bcf579a004
Merge: 76c0b5a 00c5a17
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.2.2'



[elpa] externals/kiwix 38986bb 058/192: Merge branch 'release/v0.4.3'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 38986bb58715b90976053bb431c16353b9c78a69
Merge: f1554ba d5e1ad0
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.4.3'
---
 kiwix.el | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index d0b6fcf..bac104a 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -17,6 +17,13 @@
 ;;
 ;; http://www.kiwix.org
 
+;;; Config:
+;;
+;; (define-key my-prog-help-document-map (kbd "w") 'kiwix-at-point)
+;; (define-key my-prog-help-document-map (kbd "W") 'kiwix-at-point-interactive)
+;; (define-key my-prog-help-document-map (kbd "C-w") 'kiwix-launch-server)
+
+
 ;;; Usage:
 ;;
 ;; [M-x kiwix-launch-server] to launch Kiwix server.
@@ -183,9 +190,19 @@ for query string and library interactively."
  (region-beginning) (region-end))
   (thing-at-point 'symbol))
 (message (format "library: %s, query: %s" library query))
-(kiwix-query query library)))
+(if (or (null library)
+(string-empty-p library)
+(null query)
+(string-empty-p query))
+(error "Your query is invalid")
+  (kiwix-query query library
 
 
+;;;###autoload
+(defun kiwix-at-point-interactive ()
+  (interactive)
+  (let ((current-prefix-arg t))
+(call-interactively 'kiwix-at-point)))
 
 ;;; Support Org-mode
 ;;



[elpa] externals/kiwix 96e8d37 037/192: Merge tag 'v0.2.2' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 96e8d37f1797b81e0805807782441ee525444986
Merge: 00c5a17 e35ef5e
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.2.2' into develop

disable org-mode store link prompt issue.
---
 kiwix.el | 36 
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 0124a18..49326f1 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -174,28 +174,32 @@ for query string and library interactively."
 
 (defun org-wiki-store-link ()
   "Store a link to a wiki link."
-  (let* ((query (read-string "Wiki Query: "))
- ;; TODO: test does this interactively select library abbrev works?
- (library (kiwix-select-library-abbrev))
- (link (concat "wiki:" "(" library "):" query)))
-(org-store-link-props
- :type "wiki"
- :link link
- :description query)))
+  ;; TODO: test does this interactively select library abbrev works?
+  ;; [C-c o C-l l] `org-store-link'
+  ;; remove those interactive functions. use normal function instead.
+  (when (eq major-mode 'wiki-mode)
+(let* ((query (read-string "Wiki Query: "))
+   (library (kiwix-select-library-abbrev))
+   (link (concat "wiki:" "(" library "):" query)))
+  (org-store-link-props
+   :type "wiki"
+   :link link
+   :description query
 
 (if kiwix-support-org-mode-link
 (progn
   (org-add-link-type "wiki" 'org-wiki-link-open 'org-wiki-link-export)
-  (add-hook 'org-store-link-functions 'org-wiki-store-link)
+  ;; TODO: after fix interactive store link issue. enable this adding.
+  ;; (add-hook 'org-store-link-functions 'org-wiki-store-link t)
 
   ;; [[Wikipedia_Local:]]
-  (if (and
-   (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
-   (assoc "Wikipedia_Local" org-link-abbrev-alist))
-
-  (setq org-link-abbrev-alist
-(cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
-)
+  ;; (if (and
+  ;;  (member '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist)
+  ;;  (assoc "Wikipedia_Local" org-link-abbrev-alist))
+  ;;
+  ;; (setq org-link-abbrev-alist
+  ;;   (cons '("Wikipedia_Local" . 
"http://127.0.0.1:8000/wikipedia_zh_all_2015-11/A/%s.html";) 
org-link-abbrev-alist))
+  ;;   )
   ))
 
 



[elpa] externals/kiwix 5bfc5a2 053/192: support more flexible library name

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 5bfc5a2ad86b84c32539f06068e530ee6b5db252
Author: stardiviner 
Commit: stardiviner 

support more flexible library name
---
 kiwix.el | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 1979861..f22f62d 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -83,16 +83,17 @@
   "A list of Kiwix libraries.")
 
 ;; - examples:
-;; - "wikipedia_en" - "wikipedia_en_all_2016-02"
-;; - "wikipedia_zh" - "wikipedia_zh_all_2015-17"
-;; - "wiktionary_en" - "wiktionary_en_all_2015-17"
-;; - "wiktionary_zh" - "wiktionary_zh_all_2015-17"
+;; - "wikipedia_en_all" - "wikipedia_en_all_2016-02"
+;; - "wikipedia_zh_all" - "wikipedia_zh_all_2015-17"
+;; - "wiktionary_en_all" - "wiktionary_en_all_2015-17"
+;; - "wiktionary_zh_all" - "wiktionary_zh_all_2015-17"
+;; - "wikipedia_en_medicine" - "wikipedia_en_medicine_2015-17"
 
 (defun kiwix-construct-libraries-abbrev-alist (alist)
   "Construct libraries abbrev alist from `ALIST'."
   (let* ((libraries-name
   (mapcar #'(lambda (library)
-  (string-match "\\(.*\\)_all_.*"  library)
+  (string-match "\\(.*\\)_[0-9]\\{4\\}-[0-9]\\{2\\}"  
library)
   (let* ((library-name (match-string 1 library)))
 library-name))
   alist))



[elpa] externals/kiwix f6a5f4c 048/192: Merge tag 'v0.4.0' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit f6a5f4c7b279e287a9d9cbd093cee83a01644415
Merge: 90ac73a b84a5ff
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.4.0' into develop

improve functions a lot!!!



[elpa] externals/kiwix fb83985 062/192: Merge branch 'master' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit fb83985cd982627535027ff73b4f281e3d6e0106
Merge: 2e2d64d 634b5ae
Author: stardiviner 
Commit: stardiviner 

Merge branch 'master' into develop
---
 kiwix-at-point.el | 106 --
 kiwix-http.el |  94 
 kiwix.el  |  15 +---
 3 files changed, 11 insertions(+), 204 deletions(-)

diff --git a/kiwix-at-point.el b/kiwix-at-point.el
deleted file mode 100644
index 5cedef1..000
--- a/kiwix-at-point.el
+++ /dev/null
@@ -1,106 +0,0 @@
-;;; kiwix-at-point.el --- Kiwix client for Emacs
-;;; -*- coding: utf-8 -*-
-
-;;; Commentary:
-
-
-
-;;; Code:
-
-(require 'cl-lib)
-
-(defgroup kiwix-at-point nil
-  "Search in Kiwix for text at point."
-  :group 'external)
-
-(defcustom kiwix-at-point-library-alist
-  ;; e.g. 
"~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx"
-  '((wikipedia . "")
-(wiktionary . "")
-(wikinews . "")
-(wikibooks . "")
-(wikiquote . "")
-(wikisource . "")
-(wikiversity . "")
-(wikimed . "") ; "WikiMed Medical Encyclopedia" "Wikispecies"
-)
-  "Alist which contains available kiwix libraries."
-  :type '(repeat 'string)
-  :group 'kiwix-at-point)
-
-(defvar kiwix-at-point-library nil
-  "Variable used to specify the library for the current search.")
-(make-variable-buffer-local 'kiwix-at-point-library)
-
-(defvar kiwix-at-point--library-history nil)
-
-(defun kiwix-at-point-get-library ()
-  "Guess which library suit to the current search."
-  (or kiwix-at-point-library
-  kiwix-at-point--library-history))
-
-(defun kiwix-at-point-maybe-specify-library (search-string)
-  "Prefix SEARCH-STRING with the guessed library, if any."
-  (let ((library (kiwix-at-point-get-library)))
-(concat (when library
-  (concat library ":"))
-search-string)))
-
-(defun kiwix-at-point-get-idx ()
-  "Get the idx file path."
-  ;; TODO:
-  )
-
-(defun kiwix-at-point-run-search (search)
-  (if (executable-find "kiwix")
-  ;; TODO:
-  (start-process "Kiwix" nil "kiwix-search" (kiwix-at-point-get-idx) 
search)
-(message "Kiwix wasn't found, install it first http://www.kiwix.org";)))
-
-;;;###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-at-point-maybe-specify-library thing)))
-(kiwix-at-point-run-search
- (if (or edit-search (null thing))
- (read-string "Kiwix search: " search)
-   search
-
-(defun kiwix-at-point--library-candidates ()
-  kiwix-at-point-library-alist)
-
-(defun kiwix-at-point--set-library-prompt ()
-  (let ((default-library (kiwix-at-point-get-library)))
-(format "Kiwix library%s: "
-(if default-library
-(format "[Default: %s]" default-library)
-  ""
-
-;;;###autoload
-(defun kiwix-at-point-set-library ()
-  "Set current search's library."
-  (interactive)
-  (let ((minibuffer-local-completion-map
- (copy-keymap minibuffer-local-completion-map)))
-(define-key minibuffer-local-completion-map (kbd "SPC") nil)
-(setq-local kiwix-at-point-library
-(completing-read (kiwix-at-point--set-library-prompt)
- (kiwix-at-point--library-candidates) nil nil 
nil
- 'kiwix-at-point--library-history 
(kiwix-at-point-get-library)
-
-;;;###autoload
-(defun kiwix-at-point-search (&optional edit-search)
-  "Prompt and search in Kiwix."
-  (interactive "P")
-  (let ((search (kiwix-at-point-maybe-specify-library "")))
-(kiwix-at-point-run-search
- (read-string "Kiwix search: " search
-
-
-(provide 'kiwix-at-point)
-
-;;; kiwix-at-point.el ends here
diff --git a/kiwix-http.el b/kiwix-http.el
deleted file mode 100644
index fae7b13..000
--- a/kiwix-http.el
+++ /dev/null
@@ -1,94 +0,0 @@
-;;; kiwix-http.el
-;;; -*- coding: utf-8 -*-
-
-;;; Commentary:
-
-
-
-;;; Code:
-
-
-(require 'cl-lib)
-
-;; FIXME:
-;; should use a standard where function to find path.
-;; you may can define a function instead or a constant holding the relative 
path, then make use of it when needed.
-(defcustom kiwix-search-command "/usr/lib/kiwix/bin/kiwix-search"
-  "The kiwix-search command path."
-  :type 'string
-  :group 'kiwix
-  :safe 'stringp)
-(defcustom kiwix-data-profile-path "~/.www.kiwix.org/kiwix/8ip89lik.default/"
-  "The kiwix profile data directory."
-  :type 'string
-  :group 'kiwix
-  :safe 'stringp)
-
-;; TODO: replace `browse-url'
-(defcustom kiwix-browser-function 'browse-url-conkeror
-  "Specify browser function to open kiwix search result."
-  :type 'function
-  :group 'kiwix
-  :safe 'functionp)
-
-(defvar kiwix-data-index-path nil)
-
-(setq kiwix-data

[elpa] externals/kiwix 4968e3d 055/192: error when query is invalid.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 4968e3dabf7729d9ad37a2367ad0dc7648d3012f
Author: stardiviner 
Commit: stardiviner 

error when query is invalid.
---
 kiwix.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index d0b6fcf..20c47cd 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -183,7 +183,12 @@ for query string and library interactively."
  (region-beginning) (region-end))
   (thing-at-point 'symbol))
 (message (format "library: %s, query: %s" library query))
-(kiwix-query query library)))
+(if (or (null library)
+(string-empty-p library)
+(null query)
+(string-empty-p query))
+(error "Your query is invalid")
+  (kiwix-query query library
 
 
 



[elpa] externals/kiwix c3e2d85 038/192: fix query is chinese string issue

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit c3e2d85b1712c66485e54a0707488c1501dad6fb
Author: stardiviner 
Commit: stardiviner 

fix query is chinese string issue
---
 kiwix.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 49326f1..8793e9e 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -106,7 +106,7 @@
   (let* ((kiwix-library (if library
 library
   kiwix-default-library))
- (url (concat kiwix-server-url kiwix-library "/A/" (capitalize query) 
".html")))
+ (url (concat kiwix-server-url kiwix-library "/A/" (url-encode-url 
(capitalize query)) ".html")))
 (browse-url url)))
 
 ;;;###autoload
@@ -142,12 +142,12 @@ for query string and library interactively."
  (let* ((type (match-string 1 link))
 (library (match-string 2 link))
 (query (match-string 3 link))
-(url (concat kiwix-server-url library "/A/" (capitalize query) 
".html")))
+(url (concat kiwix-server-url library "/A/" (url-encode-url 
(capitalize query)) ".html")))
(browse-url url)))
 ((string-match "\\(.*\\):\\(.*\\)"  link)
  (let* ((type (match-string 1 link))
 (query (match-string 2 link))
-(url (concat kiwix-server-url kiwix-default-library "/A/" 
(capitalize query) ".html")))
+(url (concat kiwix-server-url kiwix-default-library "/A/" 
(url-encode-url (capitalize query)) ".html")))
(browse-url url)
 
 (defun org-wiki-link-export (link description format)



[elpa] externals/kiwix b84a5ff 047/192: Merge branch 'release/v0.4.0'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit b84a5ff33efdf13dda22ed32ea37a09b15cd1690
Merge: c5df1ac 90ac73a
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.4.0'
---
 README.org |  21 ++-
 kiwix.el   | 122 -
 2 files changed, 101 insertions(+), 42 deletions(-)

diff --git a/README.org b/README.org
index 858fafa..68f20ae 100644
--- a/README.org
+++ b/README.org
@@ -48,7 +48,7 @@ Here is a simple script, you can put it in Linux 
"*auto-start*".

http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
 
#+BEGIN_SRC emacs-lisp
-   (browse-url (concat "http://127.0.0.1:8000/"; "LIBRARY" "A" "RESULT"))
+   (browse-url (concat "http://127.0.0.1:8000/"; "LIBRARY" "/A/" "RESULT"))
#+END_SRC
 
 
@@ -59,3 +59,22 @@ with RESTful API.
 
 - I don't know what Emacs library to use.
 - Or you can use other language to do this, like Ruby or Python etc.
+
+
+* Usage
+
+** Use in Emacs
+
+=[M-x kiwix-at-point]=
+
+** Org-mode integration
+
+=[C-c C-l]= to insert link.
+
+The link format is like this:
+
+#+BEGIN_EXAMPLE
+[[wiki:(library):search][description]]
+#+END_EXAMPLE
+
+The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en= etc.
diff --git a/kiwix.el b/kiwix.el
index c5c12be..d302aac 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 0.1.0
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "24.3") (cl-lib "2.0"))
 
 ;;; Commentary:
 
@@ -25,6 +25,8 @@
 ;;; Code:
 
 
+(require 'cl-lib)
+
 (defgroup kiwix nil
   "Kiwix customization options.")
 
@@ -33,26 +35,36 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-server-command "/usr/lib/kiwix/bin/kiwix-serve "
+(defcustom kiwix-server-command
+  (cond
+   ((string-equal system-type "gnu/linux")
+"/usr/lib/kiwix/bin/kiwix-serve ")
+   ((string-equal system-type "darwin")
+(warn "You need to specify Mac OS X Kiwix path. And send a PR to my 
repo."))
+   ((string-equal system-type "windows-nt")
+(warn "You need to specify Windows Kiwix path. And send a PR to my 
repo.")))
   "Specify kiwix server command."
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-profile-name "8ip89lik.default"
+(defcustom kiwix-default-data-profile-name
+  (car (directory-files
+(concat
+ (getenv "HOME") "/.www.kiwix.org/kiwix")
+nil
+".*\\.default"
+))
   "Specify the default Kiwix data profile path."
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-data-path (concat (getenv "HOME") 
"/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
+(defcustom kiwix-default-data-path
+  (concat
+   (getenv "HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
   "Specify the default Kiwix data path."
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-library "wikipedia_en_all_2016-02"
-  "Specify the default Kiwix library you want to search."
-  :type 'string
-  :group 'kiwix)
-
 (defcustom kiwix-server-port "8000"
   "Specify the default Kiwix server port."
   :type 'string
@@ -63,34 +75,55 @@
   :type 'boolean
   :group 'kiwix)
 
-(defvar kiwix-libraries (directory-files (concat kiwix-default-data-path 
"/data/content/") nil "wikipedia_.*_all_.*\.zim")
+(defvar kiwix-libraries
+  (mapcar #'(lambda (var)
+  (replace-regexp-in-string "\.zim" "" var))
+  (directory-files
+   (concat kiwix-default-data-path "/data/content/") nil ".*\.zim"))
   "A list of Kiwix libraries.")
 
-(defun kiwix-select-library ()
-  "Select Wikipedia library full name."
-  (completing-read "Kiwix Library: "
-   (mapcar #'(lambda (var)
-   (replace-regexp-in-string "\.zim" "" var))
-   kiwix-libraries)))
-
-(defvar kiwix-librarie-abbrev-alist
-  '(("default" . "wikipedia_en_all_2016-02")
-;; TODO:
-;; (mapcar #'(lambda (var)
-;; (string-match-p "en" var))
-;; kiwix-libraries)
-("en" . "wikipedia_en_all_2016-02")
-("zh" . "wikipedia_zh_all_2015-11")
-))
-
-(defun kiwix-select-library-abbrev ()
+;; - examples:
+;; - "wikipedia_en" - "wikipedia_en_all_2016-02"
+;; - "wikipedia_zh" - "wikipedia_zh_all_2015-17"
+;; - "wiktionary_en" - "wiktionary_en_all_2015-17"
+;; - "wiktionary_zh" - "wiktionary_zh_all_2015-17"
+
+(defun kiwix-construct-libraries-abbrev-alist (alist)
+  "Construct libraries abbrev alist from `ALIST'."
+  (let* ((libraries-name
+  (mapcar #'(lambda (library)
+  (string-match "\\(.*\\)_all_.*"  library)
+  (let* ((library-name (match-string 1 library)))
+library-name))
+  alist))
+ (libraries-full-name alist))
+(cl-pairlis libraries-name libraries-full-name)))
+
+(defvar kiwix-libraries-abbrev-alist
+  (kiwix-construct-libraries-abb

[elpa] externals/kiwix ec62ab0 063/192: Merge branch 'release/v0.5.0'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit ec62ab010ae0f2670b6598c112cc54119e2ed2f4
Merge: 634b5ae fb83985
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.5.0'



[elpa] externals/kiwix 45cc8ef 067/192: add some links test.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 45cc8ef37ad38fa9184e94b0b32aad0f07b24a9a
Author: stardiviner 
Commit: stardiviner 

add some links test.
---
 README.org | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/README.org b/README.org
index f76677b..a7824e5 100644
--- a/README.org
+++ b/README.org
@@ -78,3 +78,9 @@ The link format is like this:
 #+END_EXAMPLE
 
 The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en=, or 
=en=, =zh= etc.
+
+* Test
+
+- [[wiki:Operations%20Research][Operations Research]] :: query contains space.
+- [[wiki:Operations%20research][Operations research]] :: the second word is 
not capitalized.
+- [[wiki:%E4%B8%AD%E5%9B%BD][中国]] :: non-english query



[elpa] externals/kiwix 9774c61 040/192: update elisp link matching regexp

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 9774c6179a15973cc345ea99dfdf48679ae94ed2
Author: stardiviner 
Commit: stardiviner 

update elisp link matching regexp
---
 kiwix.el | 84 +---
 1 file changed, 49 insertions(+), 35 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index f6135d3..52b7235 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -74,11 +74,13 @@
kiwix-libraries)))
 
 (defvar kiwix-librarie-abbrev-list
-  ;; TODO:
-  '(("en" . (mapcar #'(lambda (var)
-(string-match-p "en" var))
-kiwix-libraries))
-("zh" . ())
+  '(("default" . "en")
+;; TODO:
+;; (mapcar #'(lambda (var)
+;; (string-match-p "en" var))
+;; kiwix-libraries)
+("en" . "wikipedia_en_all_2016-02")
+("zh" . "wikipedia_zh_all_2015-11")
 ))
 
 (defun kiwix-select-library-abbrev ()
@@ -86,6 +88,10 @@
   (completing-read "Wikipedia library abbrev: "
(map-keys kiwix-librarie-abbrev-list)))
 
+(defun kiwix-select-library-fullname (abbr)
+  "Get Kiwix library full name which is associated with `ABBR'."
+  (cdr (assoc abbr kiwix-librarie-abbrev-list)))
+
 ;; launch Kiwix server
 ;;;###autoload
 (defun kiwix-launch-server ()
@@ -129,8 +135,21 @@ for query string and library interactively."
 
 
 ;;; Support Org-mode
-;; [[wiki:(library):query]]
-;; elisp regexp: `\\(.*\\):(.*):.*'
+;;
+;; - [[wiki:(library):query]]
+;; - [[wiki:query]]
+;;
+;; links:
+;; - wiki:(zh):%E7%A6%85%E5%AE%97
+;; - wiki:(en):linux
+;; - wiki:linux
+;;
+;; - parameter `link' will be (en):linux" or linux".
+;;
+;; elisp regexp: "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"
+;; - non capturing group (\(?:...\)) for optional library
+;; - group 1: library (en or zh)
+;; - 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.
 
 ;; TODO: deprecated
@@ -138,42 +157,37 @@ for query string and library interactively."
 
 (defun org-wiki-link-open (link)
   "Open LINK in external wiki program."
-  (cond ((string-match "\\(.*\\):(\\(.*\\)):\\(.*\\)"  link)
- (let* ((type (match-string 1 link))
+  (cond ((string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; 
(library):query
+ (let* (
 ;; convert between libraries full name and abbrev.
-(library (cdr (assoc
-   (match-string 2 link)
-   kiwix-librarie-abbrev-list)))
-(query (match-string 3 link))
+(library (kiwix-select-library-fullname (match-string 1 link)))
+(query (match-string 2 link))
 (url (concat kiwix-server-url library "/A/" (url-encode-url 
(capitalize query)) ".html")))
+   ;; (prin1 (format "library: %s, query: %s" library query))
(browse-url url)))
-((string-match "\\(.*\\):\\(.*\\)"  link)
- (let* ((type (match-string 1 link))
-(query (match-string 2 link))
+((string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; query
+ (let* ((query (match-string 2 link))
 (url (concat kiwix-server-url kiwix-default-library "/A/" 
(url-encode-url (capitalize query)) ".html")))
+   ;; (print1 (format "query: %s" query))
(browse-url url)
 
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
-  (let* ((type (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
- (match-string 1 link)))
- (library (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-(match-string 2 link)))
- ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
- (query (url-encode-url
- (or description
- (when (string-match "\\(.+\\):(\\(.+\\)?):\\(.*\\)" link)
-   (match-string 3 link)
- ;; "http://en.wikipedia.org/wiki/Linux";
- ;; --
- ;;  ^- library: en, zh
- (path (concat "http://"; library ".wikipedia.org/wiki/" query))
- (desc query))
-(when (stringp path)
-  (cond
-   ((eq format 'html) (format "%s" path desc))
-   ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
-   (t path)
+  (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)" link)
+(let* ((library (or (match-string 1 link)
+(kiwix-select-library-fullname "default")))
+   ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+   (query (url-encode-url (or (match-string 2 link) description)))
+   ;; "http://en.wikipedia.org/wiki/Linux";
+   ;; --
+   ;;  ^- library:

[elpa] externals/kiwix d4fbf7b 052/192: define function ahead

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit d4fbf7b45ac1809e379f75a9d539cf2a3c2c0db4
Author: stardiviner 
Commit: stardiviner 

define function ahead
---
 kiwix.el | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index a177428..1979861 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -103,6 +103,15 @@
   (kiwix-construct-libraries-abbrev-alist kiwix-libraries)
   "Alist of Kiwix libraries with name and full name.")
 
+(defun kiwix-select-library-name ()
+  "Select Wikipedia library name abbrev."
+  (completing-read "Wikipedia library abbrev: "
+   (map-keys kiwix-libraries-abbrev-alist)))
+
+(defun kiwix-get-library-fullname (abbr)
+  "Get Kiwix library full name which is associated with `ABBR'."
+  (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
+
 (defcustom kiwix-default-library "wikipedia_en"
   "The default kiwix library when library fragment in link not specified.")
 
@@ -122,15 +131,6 @@
 ;; (kiwix-get-library-fullname "en")
 ;; (kiwix-get-library-fullname "zh")
 
-(defun kiwix-select-library-name ()
-  "Select Wikipedia library name abbrev."
-  (completing-read "Wikipedia library abbrev: "
-   (map-keys kiwix-libraries-abbrev-alist)))
-
-(defun kiwix-get-library-fullname (abbr)
-  "Get Kiwix library full name which is associated with `ABBR'."
-  (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
-
 (defcustom kiwix-search-interactively t
   "`kiwix-at-point' search interactively."
   :type 'boolean



[elpa] externals/kiwix 33d6608 076/192: org-mode wiki: link store function solved.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 33d6608a5a5bc07333e366abef74cbf60eef4de9
Author: stardiviner 
Commit: stardiviner 

org-mode wiki: link store function solved.
---
 kiwix.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 8bbfc4b..30f3905 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -273,11 +273,10 @@ for query string and library interactively."
 
 (defun org-wiki-store-link ()
   "Store a link to a wiki link."
-  ;; TODO: test does this interactively select library abbrev works?
   ;; [C-c o C-l l] `org-store-link'
   ;; remove those interactive functions. use normal function instead.
   (when (eq major-mode 'wiki-mode)
-(let* ((query (read-string "Wiki Query: "))
+(let* ((query (read-string "Wikipedia Query with Kiwix: "))
(library (kiwix-select-library-name))
(link (concat "wiki:" "(" library "):" query)))
   (org-store-link-props



[elpa] externals/kiwix c5df1ac 042/192: Merge branch 'release/v0.3.0'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit c5df1ac8b5726fa44cb9e038b705c36af1cb19df
Merge: c09f7ad 96e8d37
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.3.0'



[elpa] externals/kiwix f86cb0d 075/192: Merge tag 'v0.5.1' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit f86cb0deca8f1dcd2e90ada7ad45c98c9d38b1bb
Merge: 2d33910 d9bab20
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.5.1' into develop

hotfix for invalid variable.
---
 kiwix.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kiwix.el b/kiwix.el
index 4636c9b..8bbfc4b 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -77,6 +77,7 @@
   :type 'string
   :group 'kiwix)
 
+;;;###autoload
 (defcustom kiwix-support-org-mode-link t
   "Add support for Org-mode Kiwix link."
   :type 'boolean



[elpa] externals/kiwix d5e1ad0 057/192: add config section comments.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit d5e1ad00b3aee61f63b3099dfc42fc1fc959ea05
Author: stardiviner 
Commit: stardiviner 

add config section comments.
---
 kiwix.el | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/kiwix.el b/kiwix.el
index bd1aef0..bac104a 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -17,6 +17,13 @@
 ;;
 ;; http://www.kiwix.org
 
+;;; Config:
+;;
+;; (define-key my-prog-help-document-map (kbd "w") 'kiwix-at-point)
+;; (define-key my-prog-help-document-map (kbd "W") 'kiwix-at-point-interactive)
+;; (define-key my-prog-help-document-map (kbd "C-w") 'kiwix-launch-server)
+
+
 ;;; Usage:
 ;;
 ;; [M-x kiwix-launch-server] to launch Kiwix server.



[elpa] externals/kiwix 3dab002 077/192: only capitalize the first word of string.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 3dab002df874b4a9d64b05270827a8a903066133
Author: stardiviner 
Commit: stardiviner 

only capitalize the first word of string.
---
 kiwix.el | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 30f3905..3adc442 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -159,18 +159,29 @@
 (async-shell-command
  (concat kiwix-server-command library port daemon (shell-quote-argument 
library-path)
 
+(defun kiwix-capitalize-first (string)
+  "Only capitalize the first word of STRING."
+  (concat
+   (string (upcase (aref string 0)))
+   (substring string 1))
+  )
 
 (defun kiwix-query (query &optional library)
   "Search `QUERY' in `LIBRARY' with Kiwix."
   (let* ((kiwix-library (if library
 library
   (kiwix-get-library-fullname "default")))
- (url (concat kiwix-server-url kiwix-library "/A/"
-  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
-  (url-encode-url
-   ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
-   (replace-regexp-in-string " " "_" (capitalize query) 
nil nil))
-  ".html")))
+ (url (concat
+   kiwix-server-url kiwix-library "/A/"
+   ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+   (url-encode-url
+;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+(replace-regexp-in-string
+ " " "_"
+ ;; only capitalize the first word. like: "meta-circular 
interpreter" -> "Meta-circular interpreter"
+ (kiwix-capitalize-first query)
+ nil nil))
+   ".html")))
 (browse-url url)))
 
 ;;;###autoload
@@ -248,8 +259,11 @@ for query string and library interactively."
  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
  (url-encode-url
   ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
-  (replace-regexp-in-string " " "_"
-(capitalize query) nil nil))
+  (replace-regexp-in-string
+   " " "_"
+   ;; only capitalize the first word. like: "meta-circular 
interpreter" -> "Meta-circular interpreter"
+   (kiwix-capitalize-first query)
+   nil nil))
  ".html")))
   ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
   (browse-url url



[elpa] externals/kiwix 6fb8354 078/192: Merge branch 'release/v0.5.2'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 6fb8354e1770e752ae4eb3b79d5b873f65682904
Merge: d9bab20 3dab002
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.5.2'
---
 kiwix.el | 33 +++--
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 8bbfc4b..3adc442 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -159,18 +159,29 @@
 (async-shell-command
  (concat kiwix-server-command library port daemon (shell-quote-argument 
library-path)
 
+(defun kiwix-capitalize-first (string)
+  "Only capitalize the first word of STRING."
+  (concat
+   (string (upcase (aref string 0)))
+   (substring string 1))
+  )
 
 (defun kiwix-query (query &optional library)
   "Search `QUERY' in `LIBRARY' with Kiwix."
   (let* ((kiwix-library (if library
 library
   (kiwix-get-library-fullname "default")))
- (url (concat kiwix-server-url kiwix-library "/A/"
-  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
-  (url-encode-url
-   ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
-   (replace-regexp-in-string " " "_" (capitalize query) 
nil nil))
-  ".html")))
+ (url (concat
+   kiwix-server-url kiwix-library "/A/"
+   ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+   (url-encode-url
+;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+(replace-regexp-in-string
+ " " "_"
+ ;; only capitalize the first word. like: "meta-circular 
interpreter" -> "Meta-circular interpreter"
+ (kiwix-capitalize-first query)
+ nil nil))
+   ".html")))
 (browse-url url)))
 
 ;;;###autoload
@@ -248,8 +259,11 @@ for query string and library interactively."
  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
  (url-encode-url
   ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
-  (replace-regexp-in-string " " "_"
-(capitalize query) nil nil))
+  (replace-regexp-in-string
+   " " "_"
+   ;; only capitalize the first word. like: "meta-circular 
interpreter" -> "Meta-circular interpreter"
+   (kiwix-capitalize-first query)
+   nil nil))
  ".html")))
   ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
   (browse-url url
@@ -273,11 +287,10 @@ for query string and library interactively."
 
 (defun org-wiki-store-link ()
   "Store a link to a wiki link."
-  ;; TODO: test does this interactively select library abbrev works?
   ;; [C-c o C-l l] `org-store-link'
   ;; remove those interactive functions. use normal function instead.
   (when (eq major-mode 'wiki-mode)
-(let* ((query (read-string "Wiki Query: "))
+(let* ((query (read-string "Wikipedia Query with Kiwix: "))
(library (kiwix-select-library-name))
(link (concat "wiki:" "(" library "):" query)))
   (org-store-link-props



[elpa] externals/kiwix 2e2d64d 059/192: Merge tag 'v0.4.3' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 2e2d64d8b478908cc7cecfd12a2a6760b13afe29
Merge: d5e1ad0 38986bb
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.4.3' into develop

enhance kiwix-at-point.



[elpa] externals/kiwix 21b5dfe 073/192: fix variable invalid for autoload kiwix

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 21b5dfe5621eb2f2ae7b12b3820414e5c6d28d2d
Author: stardiviner 
Commit: stardiviner 

fix variable invalid for autoload kiwix
---
 kiwix.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kiwix.el b/kiwix.el
index 4636c9b..8bbfc4b 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -77,6 +77,7 @@
   :type 'string
   :group 'kiwix)
 
+;;;###autoload
 (defcustom kiwix-support-org-mode-link t
   "Add support for Org-mode Kiwix link."
   :type 'boolean



[elpa] externals/kiwix 49fdf02 079/192: add custom option for specifying your native language library

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 49fdf02999c75b77d560c2b44b58837f2bd74035
Author: stardiviner 
Commit: stardiviner 

add custom option for specifying your native language library
---
 kiwix.el | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 3adc442..f3936db 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -122,7 +122,9 @@
   (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
 
 (defcustom kiwix-default-library "wikipedia_en_all"
-  "The default kiwix library when library fragment in link not specified.")
+  "The default kiwix library when library fragment in link not specified."
+  :type 'string
+  :group 'kiwix)
 
 ;; add default key-value pair to libraries alist.
 (dolist
@@ -134,6 +136,11 @@
   (push cons kiwix-libraries-abbrev-alist)
   )
 
+(defcustom kiwix-your-language-library "zh"
+  "Specify the library for your navtive language."
+  :type 'string
+  :group 'kiwix)
+
 ;; test
 ;; (kiwix-get-library-fullname "wikipedia_en")
 ;; (kiwix-get-library-fullname "default")
@@ -250,7 +257,7 @@ for query string and library interactively."
 (kiwix-get-library-fullname (or (match-string 1 link)
 "default"))
   ;; validate query is non-English
-  (kiwix-get-library-fullname "zh")
+  (kiwix-get-library-fullname kiwix-your-language-library)
   ))
(query (match-string 2 link))
(url (concat



[elpa] externals/kiwix 90ac73a 046/192: update README declaration

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 90ac73af67e7941f5b2f76f0359e66d267121f86
Author: stardiviner 
Commit: stardiviner 

update README declaration
---
 README.org | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 858fafa..68f20ae 100644
--- a/README.org
+++ b/README.org
@@ -48,7 +48,7 @@ Here is a simple script, you can put it in Linux 
"*auto-start*".

http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
 
#+BEGIN_SRC emacs-lisp
-   (browse-url (concat "http://127.0.0.1:8000/"; "LIBRARY" "A" "RESULT"))
+   (browse-url (concat "http://127.0.0.1:8000/"; "LIBRARY" "/A/" "RESULT"))
#+END_SRC
 
 
@@ -59,3 +59,22 @@ with RESTful API.
 
 - I don't know what Emacs library to use.
 - Or you can use other language to do this, like Ruby or Python etc.
+
+
+* Usage
+
+** Use in Emacs
+
+=[M-x kiwix-at-point]=
+
+** Org-mode integration
+
+=[C-c C-l]= to insert link.
+
+The link format is like this:
+
+#+BEGIN_EXAMPLE
+[[wiki:(library):search][description]]
+#+END_EXAMPLE
+
+The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en= etc.



[elpa] externals/kiwix 8855ac4 060/192: delete deprecated source code files.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 8855ac45b4d2237f5da5c465080891877e06390e
Author: stardiviner 
Commit: stardiviner 

delete deprecated source code files.
---
 kiwix-at-point.el | 106 --
 kiwix-http.el |  94 
 2 files changed, 200 deletions(-)

diff --git a/kiwix-at-point.el b/kiwix-at-point.el
deleted file mode 100644
index 5cedef1..000
--- a/kiwix-at-point.el
+++ /dev/null
@@ -1,106 +0,0 @@
-;;; kiwix-at-point.el --- Kiwix client for Emacs
-;;; -*- coding: utf-8 -*-
-
-;;; Commentary:
-
-
-
-;;; Code:
-
-(require 'cl-lib)
-
-(defgroup kiwix-at-point nil
-  "Search in Kiwix for text at point."
-  :group 'external)
-
-(defcustom kiwix-at-point-library-alist
-  ;; e.g. 
"~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx"
-  '((wikipedia . "")
-(wiktionary . "")
-(wikinews . "")
-(wikibooks . "")
-(wikiquote . "")
-(wikisource . "")
-(wikiversity . "")
-(wikimed . "") ; "WikiMed Medical Encyclopedia" "Wikispecies"
-)
-  "Alist which contains available kiwix libraries."
-  :type '(repeat 'string)
-  :group 'kiwix-at-point)
-
-(defvar kiwix-at-point-library nil
-  "Variable used to specify the library for the current search.")
-(make-variable-buffer-local 'kiwix-at-point-library)
-
-(defvar kiwix-at-point--library-history nil)
-
-(defun kiwix-at-point-get-library ()
-  "Guess which library suit to the current search."
-  (or kiwix-at-point-library
-  kiwix-at-point--library-history))
-
-(defun kiwix-at-point-maybe-specify-library (search-string)
-  "Prefix SEARCH-STRING with the guessed library, if any."
-  (let ((library (kiwix-at-point-get-library)))
-(concat (when library
-  (concat library ":"))
-search-string)))
-
-(defun kiwix-at-point-get-idx ()
-  "Get the idx file path."
-  ;; TODO:
-  )
-
-(defun kiwix-at-point-run-search (search)
-  (if (executable-find "kiwix")
-  ;; TODO:
-  (start-process "Kiwix" nil "kiwix-search" (kiwix-at-point-get-idx) 
search)
-(message "Kiwix wasn't found, install it first http://www.kiwix.org";)))
-
-;;;###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-at-point-maybe-specify-library thing)))
-(kiwix-at-point-run-search
- (if (or edit-search (null thing))
- (read-string "Kiwix search: " search)
-   search
-
-(defun kiwix-at-point--library-candidates ()
-  kiwix-at-point-library-alist)
-
-(defun kiwix-at-point--set-library-prompt ()
-  (let ((default-library (kiwix-at-point-get-library)))
-(format "Kiwix library%s: "
-(if default-library
-(format "[Default: %s]" default-library)
-  ""
-
-;;;###autoload
-(defun kiwix-at-point-set-library ()
-  "Set current search's library."
-  (interactive)
-  (let ((minibuffer-local-completion-map
- (copy-keymap minibuffer-local-completion-map)))
-(define-key minibuffer-local-completion-map (kbd "SPC") nil)
-(setq-local kiwix-at-point-library
-(completing-read (kiwix-at-point--set-library-prompt)
- (kiwix-at-point--library-candidates) nil nil 
nil
- 'kiwix-at-point--library-history 
(kiwix-at-point-get-library)
-
-;;;###autoload
-(defun kiwix-at-point-search (&optional edit-search)
-  "Prompt and search in Kiwix."
-  (interactive "P")
-  (let ((search (kiwix-at-point-maybe-specify-library "")))
-(kiwix-at-point-run-search
- (read-string "Kiwix search: " search
-
-
-(provide 'kiwix-at-point)
-
-;;; kiwix-at-point.el ends here
diff --git a/kiwix-http.el b/kiwix-http.el
deleted file mode 100644
index fae7b13..000
--- a/kiwix-http.el
+++ /dev/null
@@ -1,94 +0,0 @@
-;;; kiwix-http.el
-;;; -*- coding: utf-8 -*-
-
-;;; Commentary:
-
-
-
-;;; Code:
-
-
-(require 'cl-lib)
-
-;; FIXME:
-;; should use a standard where function to find path.
-;; you may can define a function instead or a constant holding the relative 
path, then make use of it when needed.
-(defcustom kiwix-search-command "/usr/lib/kiwix/bin/kiwix-search"
-  "The kiwix-search command path."
-  :type 'string
-  :group 'kiwix
-  :safe 'stringp)
-(defcustom kiwix-data-profile-path "~/.www.kiwix.org/kiwix/8ip89lik.default/"
-  "The kiwix profile data directory."
-  :type 'string
-  :group 'kiwix
-  :safe 'stringp)
-
-;; TODO: replace `browse-url'
-(defcustom kiwix-browser-function 'browse-url-conkeror
-  "Specify browser function to open kiwix search result."
-  :type 'function
-  :group 'kiwix
-  :safe 'functionp)
-
-(defvar kiwix-data-index-path nil)
-
-(setq kiwix-data-index-path (concat kiwix-data-profile-path "data/index/"))
-
-(defun kiw

[elpa] externals/kiwix 1ddddc1 044/192: improve library fragment

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 1c1d6577fc4981bfdbfdcfc08ac49215d8db
Author: stardiviner 
Commit: stardiviner 

improve library fragment

- support all libraries
- smart interactive library selection
- support better default library
---
 kiwix.el | 101 +++
 1 file changed, 63 insertions(+), 38 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index c5c12be..d481fba 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 0.1.0
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "24.3") (cl-lib "2.0"))
 
 ;;; Commentary:
 
@@ -25,6 +25,8 @@
 ;;; Code:
 
 
+(require 'cl-lib)
+
 (defgroup kiwix nil
   "Kiwix customization options.")
 
@@ -48,11 +50,6 @@
   :type 'string
   :group 'kiwix)
 
-(defcustom kiwix-default-library "wikipedia_en_all_2016-02"
-  "Specify the default Kiwix library you want to search."
-  :type 'string
-  :group 'kiwix)
-
 (defcustom kiwix-server-port "8000"
   "Specify the default Kiwix server port."
   :type 'string
@@ -63,34 +60,55 @@
   :type 'boolean
   :group 'kiwix)
 
-(defvar kiwix-libraries (directory-files (concat kiwix-default-data-path 
"/data/content/") nil "wikipedia_.*_all_.*\.zim")
+(defvar kiwix-libraries
+  (mapcar #'(lambda (var)
+  (replace-regexp-in-string "\.zim" "" var))
+  (directory-files
+   (concat kiwix-default-data-path "/data/content/") nil ".*\.zim"))
   "A list of Kiwix libraries.")
 
-(defun kiwix-select-library ()
-  "Select Wikipedia library full name."
-  (completing-read "Kiwix Library: "
-   (mapcar #'(lambda (var)
-   (replace-regexp-in-string "\.zim" "" var))
-   kiwix-libraries)))
-
-(defvar kiwix-librarie-abbrev-alist
-  '(("default" . "wikipedia_en_all_2016-02")
-;; TODO:
-;; (mapcar #'(lambda (var)
-;; (string-match-p "en" var))
-;; kiwix-libraries)
-("en" . "wikipedia_en_all_2016-02")
-("zh" . "wikipedia_zh_all_2015-11")
-))
-
-(defun kiwix-select-library-abbrev ()
+;; - examples:
+;; - "wikipedia_en" - "wikipedia_en_all_2016-02"
+;; - "wikipedia_zh" - "wikipedia_zh_all_2015-17"
+;; - "wiktionary_en" - "wiktionary_en_all_2015-17"
+;; - "wiktionary_zh" - "wiktionary_zh_all_2015-17"
+
+(defun kiwix-construct-libraries-abbrev-alist (alist)
+  "Construct libraries abbrev alist from `ALIST'."
+  (let* ((libraries-name
+  (mapcar #'(lambda (library)
+  (string-match "\\(.*\\)_all_.*"  library)
+  (let* ((library-name (match-string 1 library)))
+library-name))
+  alist))
+ (libraries-full-name alist))
+(cl-pairlis libraries-name libraries-full-name)))
+
+(defvar kiwix-libraries-abbrev-alist
+  (kiwix-construct-libraries-abbrev-alist kiwix-libraries)
+  "Alist of Kiwix libraries with name and full name.")
+
+(defcustom kiwix-default-library "wikipedia_en"
+  "The default kiwix library when library fragment in link not specified.")
+
+;; add default key-value pair to libraries alist.
+(defvar kiwix-default-library-cons
+  (cons "default" (kiwix-get-library-fullname kiwix-default-library)))
+
+;; add `kiwix-default-library-cons' to alist.
+(push kiwix-default-library-cons kiwix-libraries-abbrev-alist)
+;; test
+;; (kiwix-get-library-fullname "wikipedia_en")
+;; (kiwix-get-library-fullname "default")
+
+(defun kiwix-select-library-name ()
   "Select Wikipedia library name abbrev."
   (completing-read "Wikipedia library abbrev: "
-   (map-keys kiwix-librarie-abbrev-alist)))
+   (map-keys kiwix-libraries-abbrev-alist)))
 
 (defun kiwix-get-library-fullname (abbr)
   "Get Kiwix library full name which is associated with `ABBR'."
-  (cdr (assoc abbr kiwix-librarie-abbrev-alist)))
+  (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
 
 ;; launch Kiwix server
 ;;;###autoload
@@ -111,7 +129,7 @@
   "Search `QUERY' in `LIBRARY' with Kiwix."
   (let* ((kiwix-library (if library
 library
-  kiwix-default-library))
+  (kiwix-get-library-fullname "default")))
  (url (concat kiwix-server-url kiwix-library "/A/" (url-encode-url 
(capitalize query)) ".html")))
 (browse-url url)))
 
@@ -122,15 +140,22 @@
 Or When prefix argument `INTERACTIVELY' specified, then prompt
 for query string and library interactively."
   (interactive "P")
-  (let* ((query-string (if interactively
-   (read-string "Kiwix Search: "
-(if mark-active
-(buffer-substring
- (region-beginning) (region-end))
-  (thing-at-point 'symbol)
- (library (when interactivel

[elpa] externals/kiwix 9d16244 082/192: Merge tag 'v0.5.2' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 9d16244ee4ee32df8b210e2ec726c2dc9255f878
Merge: 5cba3b5 6fb8354
Author: stardiviner 
Commit: stardiviner 

Merge tag 'v0.5.2' into develop



[elpa] externals/kiwix 90658b7 050/192: support old format library name

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 90658b742e09b0daae5aacb9e246a085ec224abd
Author: stardiviner 
Commit: stardiviner 

support old format library name

[[wiki:(en|zh):query][description]]
---
 README.org |  2 +-
 kiwix.el   | 14 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index 68f20ae..f76677b 100644
--- a/README.org
+++ b/README.org
@@ -77,4 +77,4 @@ The link format is like this:
 [[wiki:(library):search][description]]
 #+END_EXAMPLE
 
-The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en= etc.
+The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en=, or 
=en=, =zh= etc.
diff --git a/kiwix.el b/kiwix.el
index 57523cd..5f6a427 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -107,14 +107,20 @@
   "The default kiwix library when library fragment in link not specified.")
 
 ;; add default key-value pair to libraries alist.
-(defvar kiwix-default-library-cons
-  (cons "default" (kiwix-get-library-fullname kiwix-default-library)))
+(dolist
+(cons (list
+   (cons "default" (kiwix-get-library-fullname kiwix-default-library))
+   (cons "en" (kiwix-get-library-fullname kiwix-default-library))
+   (cons "zh" (kiwix-get-library-fullname "wikipedia_zh"
+  
+  (push cons kiwix-libraries-abbrev-alist)
+  )
 
-;; add `kiwix-default-library-cons' to alist.
-(push kiwix-default-library-cons kiwix-libraries-abbrev-alist)
 ;; test
 ;; (kiwix-get-library-fullname "wikipedia_en")
 ;; (kiwix-get-library-fullname "default")
+;; (kiwix-get-library-fullname "en")
+;; (kiwix-get-library-fullname "zh")
 
 (defun kiwix-select-library-name ()
   "Select Wikipedia library name abbrev."



[elpa] externals/kiwix a3ec3a9 090/192: fix void function `org-link-set-parameters` when Emacs loads.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit a3ec3a96d5a089408d72da0c984b273effd8ef93
Author: stardiviner 
Commit: stardiviner 

fix void function `org-link-set-parameters` when Emacs loads.
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 06e8b92..df863bd 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -35,7 +35,7 @@
 (require 'cl-lib)
 ;; load for `org-link-set-parameters'
 (require 'org)
-(autoload 'org-link-set-parameters "org")
+(declare-function 'org-link-set-parameters "org")
 
 (defgroup kiwix nil
   "Kiwix customization options."



[elpa] externals/kiwix 4102205 086/192: load for `org-link-set-parameters'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 410220523a1fbc3fe5b8ef6917dc2b73c172afeb
Author: stardiviner 
Commit: stardiviner 

load for `org-link-set-parameters'
---
 kiwix.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index cd47a28..9683109 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -33,7 +33,9 @@
 
 
 (require 'cl-lib)
-(require 'org) ; load for `org-link-set-parameters'
+;; load for `org-link-set-parameters'
+(require 'org)
+(autoload 'org-link-set-parameters "org")
 
 (defgroup kiwix nil
   "Kiwix customization options.")



[elpa] externals/kiwix 43e0547 083/192: Merge branch 'release/v0.6.0'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 43e05477ad4633bbc2582f7491071e186f3986cd
Merge: 6fb8354 9d16244
Author: stardiviner 
Commit: stardiviner 

Merge branch 'release/v0.6.0'
---
 README.org |  1 +
 kiwix.el   | 32 +---
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/README.org b/README.org
index a7824e5..f1e4799 100644
--- a/README.org
+++ b/README.org
@@ -84,3 +84,4 @@ The =(library)= can be =wikipedia_en=, =wikipedia_zh=, 
=wiktionary_en=, or =en=,
 - [[wiki:Operations%20Research][Operations Research]] :: query contains space.
 - [[wiki:Operations%20research][Operations research]] :: the second word is 
not capitalized.
 - [[wiki:%E4%B8%AD%E5%9B%BD][中国]] :: non-english query
+- [[wiki:meta-circular%20interpreter][meta-circular interpreter]] :: only 
capitalize the first word.
diff --git a/kiwix.el b/kiwix.el
index 3adc442..d5211b7 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -122,7 +122,9 @@
   (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
 
 (defcustom kiwix-default-library "wikipedia_en_all"
-  "The default kiwix library when library fragment in link not specified.")
+  "The default kiwix library when library fragment in link not specified."
+  :type 'string
+  :group 'kiwix)
 
 ;; add default key-value pair to libraries alist.
 (dolist
@@ -134,6 +136,11 @@
   (push cons kiwix-libraries-abbrev-alist)
   )
 
+(defcustom kiwix-your-language-library "zh"
+  "Specify the library for your navtive language."
+  :type 'string
+  :group 'kiwix)
+
 ;; test
 ;; (kiwix-get-library-fullname "wikipedia_en")
 ;; (kiwix-get-library-fullname "default")
@@ -239,19 +246,23 @@ for query string and library interactively."
 ;; - 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.
 
+(defun kiwix-org-get-library ()
+  "Get library from Org-mode link."
+  (if (string-match-p "[a-zA-Z\ ]+" (match-string 2 link)) ; validate query is 
English
+  ;; convert between libraries full name and abbrev.
+  (kiwix-get-library-fullname (or (match-string 1 link)
+  "default"))
+;; validate query is non-English
+(kiwix-get-library-fullname kiwix-your-language-library)
+)
+  )
+
 (defun org-wiki-link-open (link)
   "Open LINK in external wiki program."
   ;; The regexp: (library):query
   ;; - query : should not exclude space
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^]\n\t\r]*\\)"  link) ; 
(library):query
-(let* (
-   (library (if (string-match-p "[a-zA-Z\ ]+" (match-string 2 link)) ; 
validate query is English
-;; convert between libraries full name and abbrev.
-(kiwix-get-library-fullname (or (match-string 1 link)
-"default"))
-  ;; validate query is non-English
-  (kiwix-get-library-fullname "zh")
-  ))
+(let* ((library (kiwix-org-get-library))
(query (match-string 2 link))
(url (concat
  kiwix-server-url
@@ -271,8 +282,7 @@ for query string and library interactively."
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)" link)
-(let* ((library (or (match-string 1 link)
-(kiwix-get-library-fullname "default")))
+(let* ((library (kiwix-org-get-library))
(query (url-encode-url (or (match-string 2 link) description)))
;; "http://en.wikipedia.org/wiki/Linux";
;; --



[elpa] externals/kiwix 634b5ae 061/192: enhance function kiwix-query to support space between strings.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 634b5ae0d1c79d8b3f1c0a34a8737ad9dea1b4a5
Author: stardiviner 
Commit: stardiviner 

enhance function kiwix-query to support space between strings.
---
 kiwix.el | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index bac104a..3865f96 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -164,7 +164,12 @@
   (let* ((kiwix-library (if library
 library
   (kiwix-get-library-fullname "default")))
- (url (concat kiwix-server-url kiwix-library "/A/" (url-encode-url 
(capitalize query)) ".html")))
+ (url (concat kiwix-server-url kiwix-library "/A/"
+  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+  (url-encode-url
+   ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+   (replace-regexp-in-string " " "_" (capitalize query) 
nil nil))
+  ".html")))
 (browse-url url)))
 
 ;;;###autoload
@@ -234,11 +239,13 @@ for query string and library interactively."
  kiwix-server-url
  library "/A/"
  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
- (url-encode-url (capitalize query))
+ (url-encode-url
+  ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+  (replace-regexp-in-string " " "_"
+(capitalize query) nil nil))
  ".html")))
   ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
-  (browse-url url))
-))
+  (browse-url url
 
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."



[elpa] externals/kiwix 121d98a 093/192: fix void function org-link-set-parameters.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 121d98a3c16ae623dcaa5e4404d4f4ef7981e557
Author: stardiviner 
Commit: stardiviner 

fix void function org-link-set-parameters.
---
 kiwix.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kiwix.el b/kiwix.el
index df863bd..e699f76 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -312,6 +312,7 @@ for query string and library interactively."
:link link
:description query
 
+(autoload 'org-link-set-parameters "org")
 ;;;###autoload
 (if kiwix-support-org-mode-link
 (progn



[elpa] externals/kiwix 19bfe4f 051/192: add an option to let kiwix-at-point search interactively

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 19bfe4fbd086ed33390f6945dc9a3a814b8d7004
Author: stardiviner 
Commit: stardiviner 

add an option to let kiwix-at-point search interactively
---
 kiwix.el | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 5f6a427..a177428 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -131,6 +131,11 @@
   "Get Kiwix library full name which is associated with `ABBR'."
   (cdr (assoc abbr kiwix-libraries-abbrev-alist)))
 
+(defcustom kiwix-search-interactively t
+  "`kiwix-at-point' search interactively."
+  :type 'boolean
+  :group 'kiwix)
+
 ;; launch Kiwix server
 ;;;###autoload
 (defun kiwix-launch-server ()
@@ -161,7 +166,8 @@
 Or When prefix argument `INTERACTIVELY' specified, then prompt
 for query string and library interactively."
   (interactive "P")
-  (let* ((library (if interactively
+  (let* ((library (if (or kiwix-search-interactively
+  interactively)
   (kiwix-get-library-fullname (kiwix-select-library-name))
 (kiwix-get-library-fullname "default")))
  (query (if interactively



[elpa] externals/kiwix cc86dc7 085/192: load for `org-link-set-parameters'

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit cc86dc76789f91062b16fd03f883aa14630546eb
Author: stardiviner 
Commit: stardiviner 

load for `org-link-set-parameters'
---
 kiwix.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kiwix.el b/kiwix.el
index d5211b7..cd47a28 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -33,6 +33,7 @@
 
 
 (require 'cl-lib)
+(require 'org) ; load for `org-link-set-parameters'
 
 (defgroup kiwix nil
   "Kiwix customization options.")



[elpa] externals/kiwix 686bac6 068/192: fix query validating regexp

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 686bac60f942665ddf695e761a1a37900c30885f
Author: stardiviner 
Commit: stardiviner 

fix query validating regexp
---
 kiwix.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 7480bdb..908ab76 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -233,9 +233,7 @@ for query string and library interactively."
   ;; - query : should not exclude space
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^]\n\t\r]*\\)"  link) ; 
(library):query
 (let* (
-   (library (if (string-match-p "\\`[a-zA-Z\ ]+\\'"
-;; query
-(match-string 2 link)) ; validate 
query is English
+   (library (if (string-match-p "[a-zA-Z\ ]+" (match-string 2 link)) ; 
validate query is English
 ;; convert between libraries full name and abbrev.
 (kiwix-get-library-fullname (or (match-string 1 link)
 "default"))



[elpa] externals/kiwix 1b9f25b 056/192: add interactively called function.

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 1b9f25bacf851779b067c691971aaf4a642ef288
Author: stardiviner 
Commit: stardiviner 

add interactively called function.
---
 kiwix.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/kiwix.el b/kiwix.el
index 20c47cd..bd1aef0 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -191,6 +191,11 @@ for query string and library interactively."
   (kiwix-query query library
 
 
+;;;###autoload
+(defun kiwix-at-point-interactive ()
+  (interactive)
+  (let ((current-prefix-arg t))
+(call-interactively 'kiwix-at-point)))
 
 ;;; Support Org-mode
 ;;



[elpa] externals/kiwix 47d968a 069/192: update add org-mode link functions to Org-mode 9.0

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 47d968adbf71bc59d1adfbabfdd82ca2a94ea47e
Author: stardiviner 
Commit: stardiviner 

update add org-mode link functions to Org-mode 9.0
---
 kiwix.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 3865f96..15a747c 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -280,9 +280,11 @@ for query string and library interactively."
 
 (if kiwix-support-org-mode-link
 (progn
-  (org-add-link-type "wiki" 'org-wiki-link-open 'org-wiki-link-export)
-  ;; TODO: after fix interactive store link issue. enable this adding.
-  ;; (add-hook 'org-store-link-functions 'org-wiki-store-link t)
+  (org-link-set-parameters "wiki"
+   :follow #'org-wiki-link-open
+   :store #'org-wiki-store-link
+   :export #'org-wiki-link-export)
+  (add-hook 'org-store-link-functions 'org-wiki-store-link t)
 
   ;; [[Wikipedia_Local:]]
   ;; (if (and



[elpa] externals/kiwix 7b8a799 088/192: Merge tag 'void-function_org-link-set-parameters' into develop

2020-12-18 Thread Stefan Monnier
branch: externals/kiwix
commit 7b8a799fb2b2c9c1653cc46f04eb517ccc8a576d
Merge: cc86dc7 bf128fb
Author: stardiviner 
Commit: stardiviner 

Merge tag 'void-function_org-link-set-parameters' into develop

fix void function `org-link-set-parameters'.
---
 kiwix.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index cd47a28..9683109 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -33,7 +33,9 @@
 
 
 (require 'cl-lib)
-(require 'org) ; load for `org-link-set-parameters'
+;; load for `org-link-set-parameters'
+(require 'org)
+(autoload 'org-link-set-parameters "org")
 
 (defgroup kiwix nil
   "Kiwix customization options.")



  1   2   3   >