[elpa] externals/consult 384156f: Reduce docstring duplication

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit 384156f08fdd5a266141e70e57c2635d1258678a
Author: Daniel Mendler 
Commit: Daniel Mendler 

Reduce docstring duplication
---
 consult.el | 25 +
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/consult.el b/consult.el
index a794c6f..c29bc09 100644
--- a/consult.el
+++ b/consult.el
@@ -221,10 +221,7 @@ See `consult--multi' for a description of the source 
values."
   "git --no-pager grep --null --color=always --extended-regexp\
--line-number -I -e ARG OPTS"
   "Command line string for git-grep, see `consult-git-grep'.
-
-The command string must have a specific format, including ARG and OPTS
-substrings. ARG is replaced by the filter string and OPTS by the auxillary
-command options."
+See `consult-grep-command' for more information."
   :type 'string)
 
 (defcustom consult-grep-command
@@ -245,37 +242,25 @@ command options."
   "rg --null --line-buffered --color=ansi --max-columns=1000\
--smart-case --no-heading --line-number . -e ARG OPTS"
   "Command line string for ripgrep, see `consult-ripgrep'.
-
-The command string must have a specific format, including ARG and OPTS
-substrings. ARG is replaced by the filter string and OPTS by the auxillary
-command options."
+See `consult-grep-command' for more information."
   :type 'string)
 
 (defcustom consult-find-command
   "find . -not ( -wholename */.* -prune ) -ipath *ARG* OPTS"
   "Command line string for find, see `consult-find'.
-
-The command string must have a specific format, including ARG and OPTS
-substrings. ARG is replaced by the filter string and OPTS by the auxillary
-command options. By default the ARG is wrapped in wildcards."
+See `consult-grep-command' for more information."
   :type 'string)
 
 (defcustom consult-locate-command
   "locate --ignore-case --existing --regexp ARG OPTS"
   "Command line string for locate, see `consult-locate'.
-
-The command string must have a specific format, including ARG and OPTS
-substrings. ARG is replaced by the filter string and OPTS by the auxillary
-command options."
+See `consult-grep-command' for more information."
   :type 'string)
 
 (defcustom consult-man-command
   "man -k ARG OPTS"
   "Command line string for man, see `consult-man'.
-
-The command string must have a specific format, including ARG and OPTS
-substrings. ARG is replaced by the filter string and OPTS by the auxillary
-command options."
+See `consult-grep-command' for more information."
   :type 'string)
 
 (defcustom consult-preview-key 'any



[elpa] externals/shell-command+ 1081933 1/6: Fix checkdoc complaints in shell-command+-tests.el

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 1081933aee068eaabedc936f9c2c254b32b4b32b
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Fix checkdoc complaints in shell-command+-tests.el
---
 shell-command+-tests.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/shell-command+-tests.el b/shell-command+-tests.el
index dc59c0f..d7c53a5 100644
--- a/shell-command+-tests.el
+++ b/shell-command+-tests.el
@@ -17,6 +17,10 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
+;;; Commentary:
+
+;; Tests for the `shell-command+' parsers.
+
 ;;; Code:
 
 (require 'ert)
@@ -142,7 +146,7 @@
 (should (string= rest (concat "command \\%")
 
 (ert-deftest sc+-expand ()
-  "Test that `shell-command+-expand-path' works as expected"
+  "Test that `shell-command+-expand-path' works as expected."
   (let ((default-directory "/some/path/to/dir"))
 (pcase-dolist (`(,path . ,expand)
'(("."   . "/some/path/to/dir")
@@ -155,7 +159,7 @@
expand)
 
 (ert-deftest sc+-tokenize ()
-  "Test that `shell-command+-tokenize' works as expected"
+  "Test that `shell-command+-tokenize' works as expected."
   (pcase-dolist (`(,args ,expand ,list)
  '(("a b c" nil ("a" "b" "c"))
("a \"b c\" d" nil ("a" "b c" "d"))



[elpa] externals/shell-command+ 3a4546c 4/6: Explicitly require diff and info

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 3a4546c2b312cd1b47cb633702920fff906f74b8
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Explicitly require diff and info
---
 shell-command+.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shell-command+.el b/shell-command+.el
index 1e12461..0dd6b5d 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -61,6 +61,8 @@
 
 (eval-when-compile (require 'rx))
 (eval-when-compile (require 'pcase))
+(require 'diff)
+(require 'info)
 
 ;;; Code:
 



[elpa] externals/shell-command+ 2f16957 5/6: Fix checkdoc complaint in shell-command+ group definition

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 2f1695757e830d3a353427a5d166e371b1b16d1a
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Fix checkdoc complaint in shell-command+ group definition
---
 shell-command+.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell-command+.el b/shell-command+.el
index 0dd6b5d..26a5ff4 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -67,7 +67,7 @@
 ;;; Code:
 
 (defgroup shell-command+ nil
-  "An extended `shell-command'"
+  "An extended `shell-command'."
   :group 'external
   :prefix "shell-command+-")
 



[elpa] externals/phps-mode updated (9d2a9d3 -> c08ba09)

2021-08-04 Thread Christian Johansson
cjohansson pushed a change to branch externals/phps-mode.

  from  9d2a9d3   Updated version
   new  f20bbd9   Added failing bookkeeping tests for typed class properties
   new  1017054   Bookkeeping for typed class properties now working
   new  c08ba09   Updated version and date


Summary of changes:
 phps-mode-lex-analyzer.el   | 19 +++
 phps-mode.el|  4 ++--
 test/phps-mode-test-lex-analyzer.el |  8 
 3 files changed, 25 insertions(+), 6 deletions(-)



[elpa] externals/phps-mode f20bbd9 1/3: Added failing bookkeeping tests for typed class properties

2021-08-04 Thread Christian Johansson
branch: externals/phps-mode
commit f20bbd95ca70ed7dbfa3c255578171cf13fb82bd
Author: Christian Johansson 
Commit: Christian Johansson 

Added failing bookkeeping tests for typed class properties
---
 test/phps-mode-test-lex-analyzer.el | 8 
 1 file changed, 8 insertions(+)

diff --git a/test/phps-mode-test-lex-analyzer.el 
b/test/phps-mode-test-lex-analyzer.el
index 370dc08..33d7e70 100644
--- a/test/phps-mode-test-lex-analyzer.el
+++ b/test/phps-mode-test-lex-analyzer.el
@@ -1593,6 +1593,14 @@
 (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-bookkeeping) t)
 '((" namespace Here function here id $a" 1) ((66 68) 1) ((82 84) 
1) (" namespace Here class There function Near id $this" 1) (" namespace Here 
class There function Near id $a" 1)  ((177 179) 1) ((197 199) 1) (" id $a" 1) 
((245 247) 1) ((257 259) 1)
 
+  (phps-mode-test--with-buffer
+   "variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self::$varia [...]
+   "Bookkeeping of typed class variables"
+   (should
+(equal
+ (phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-bookkeeping) t)
+ '((" class There id $variable" 1) ((33 42) 1) (" class There id 
$variable2" 1) ((67 77) 1) (" class There id $variable3" 1) ((98 108) 1) (" 
class There static id $variable4" 1) ((129 139) 1) (" class There static id 
$variable5" 1) ((171 181) 1) (" class There static id $variable6" 1) ((209 219) 
1) (" class There function here id $this" 1) ((259 264) 1) ((266 274) 1) ((291 
296) 1) ((298 307) 1) ((324 329) 1) ((331 340) 1) ((357 362) 1) ((364 373) 0) 
((396 406) 1) ((429 439) 1) ((462  [...]
+
   )
 
 (defun phps-mode-test-lex-analyzer ()



[elpa] externals/shell-command+ 3b51514 3/6: Use full name as author

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 3b515145b43d9dbed0368b46f988739ffd80ad0d
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Use full name as author
---
 shell-command+.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell-command+.el b/shell-command+.el
index 9fa25a2..1e12461 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2020  Free Software Foundation, Inc.
 
-;; Author: Philip K. 
+;; Author: Philip Kaludercic 
 ;; Version: 2.2.0
 ;; Keywords: unix, processes, convenience
 ;; Package-Requires: ((emacs "24.1"))



[elpa] externals/shell-command+ updated (50cec1e -> 6ec5ed6)

2021-08-04 Thread ELPA Syncer
elpasync pushed a change to branch externals/shell-command+.

  from  50cec1e   Update URL header
   new  1081933   Fix checkdoc complaints in shell-command+-tests.el
   new  07e86dc   Improve token parsing in shell-command+-tokenize
   new  3b51514   Use full name as author
   new  3a4546c   Explicitly require diff and info
   new  2f16957   Fix checkdoc complaint in shell-command+ group definition
   new  6ec5ed6   Add more testcases to sc+-tokenize


Summary of changes:
 shell-command+-tests.el | 22 +++---
 shell-command+.el   | 34 +-
 2 files changed, 44 insertions(+), 12 deletions(-)



[elpa] externals/phps-mode 1017054 2/3: Bookkeeping for typed class properties now working

2021-08-04 Thread Christian Johansson
branch: externals/phps-mode
commit 101705457dc3b69671661350ba2dd261566551f0
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping for typed class properties now working
---
 phps-mode-lex-analyzer.el | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 490afc5..d121f00 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -1356,7 +1356,10 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
   (unless bookkeeping-named
 (when (and
imenu-in-class-name
-   (equal previous-token 'T_STATIC)
+   (or
+(equal previous-token 'T_STATIC)
+(equal previous2-token 'T_STATIC))
+   (equal token 'T_VARIABLE)
(not imenu-in-function-declaration)
(not imenu-in-function-name))
   (setq
@@ -1448,8 +1451,11 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
 (setq bookkeeping-in-assignment t))
 
   ;; In static variable declaration
-  (when (and (equal previous-token 'T_STATIC)
- (equal token 'T_VARIABLE))
+  (when (and
+ (or
+  (equal previous-token 'T_STATIC)
+  (equal previous2-token 'T_STATIC))
+ (equal token 'T_VARIABLE))
 (setq bookkeeping-in-assignment t))
 
   ;; In [$abc, $def] = .. or array($abc, $def) = ...
@@ -1473,7 +1479,12 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
   (equal previous-token 'T_PRIVATE)
   (equal previous-token 'T_PROTECTED)
   (equal previous-token 'T_PUBLIC)
-  (equal previous-token 'T_VAR)))
+  (equal previous-token 'T_VAR)
+  (equal previous2-token 'T_STATIC)
+  (equal previous2-token 'T_PRIVATE)
+  (equal previous2-token 'T_PROTECTED)
+  (equal previous2-token 'T_PUBLIC)
+  (equal previous2-token 'T_VAR)))
 (setq bookkeeping-in-assignment t))
 
   ;; Do we have a assignment?



[elpa] externals/shell-command+ 07e86dc 2/6: Improve token parsing in shell-command+-tokenize

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 07e86dc220243f7fb18ddde043eb0614e7157fc6
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Improve token parsing in shell-command+-tokenize
---
 shell-command+.el | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/shell-command+.el b/shell-command+.el
index 3c875ea..9fa25a2 100644
--- a/shell-command+.el
+++ b/shell-command+.el
@@ -138,21 +138,35 @@ the command string"
 
 
 
+(defconst shell-command+-token-regexp
+  (rx bos (* space)
+  (or (: ?\"
+ (group-n 1 (* (or (: ?\\ anychar) (not (any ?\\ ?\")
+ ?\")
+  (: ?\'
+ (group-n 1 (* (or (: ?\\ anychar) (not (any ?\\ ?\')
+ ?\')
+  (group (+ (not (any space ?\\ ?\" ?\')))
+ (* ?\\ anychar (* (not (any space ?\\ ?\" ?\')))
+  "Regular expression for tokenizing shell commands.")
+
 (defun shell-command+-tokenize (command &optional expand)
   "Return list of tokens of COMMAND.
 If EXPAND is non-nil, expand wildcards."
   (let ((pos 0) tokens)
-(while (string-match
-(rx bos (* space)
-(or (: ?\" (group (* (not ?\"))) ?\")
-(: (group (+ (not (any ?\" space)))
-(substring command pos))
+(while (string-match shell-command+-token-regexp (substring command pos))
   (push (let ((tok (match-string 2 (substring command pos
   (if (and expand tok)
   (or (file-expand-wildcards tok) (list tok))
-(list (or (match-string 2 (substring command pos))
-  (match-string 1 (substring command pos))
+(list (replace-regexp-in-string
+   (rx (* ?\\ ?\\) (group ?\\ (group anychar)))
+   "\\2"
+   (or (match-string 2 (substring command pos))
+   (match-string 1 (substring command pos)))
+   nil nil 1
 tokens)
+  (when (= (match-end 0) 0)
+(error "Zero-width token parsed"))
   (setq pos (+ pos (match-end 0
 (unless (= pos (length command))
   (error "Tokenization error at %s" (substring command pos)))



[elpa] externals/shell-command+ 6ec5ed6 6/6: Add more testcases to sc+-tokenize

2021-08-04 Thread ELPA Syncer
branch: externals/shell-command+
commit 6ec5ed67310ba026c79761d377f90d7a3d3fa84e
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Add more testcases to sc+-tokenize
---
 shell-command+-tests.el | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/shell-command+-tests.el b/shell-command+-tests.el
index d7c53a5..4823bf9 100644
--- a/shell-command+-tests.el
+++ b/shell-command+-tests.el
@@ -175,7 +175,19 @@
   "shell-command+-tests.el"
   "shell-command+.el"))
("a \"*.el\" d" nil ("a" "*.el" "d"))
-   ("a \"*.el\" d" t ("a" "*.el" "d"
+   ("a \"*.el\" d" t ("a" "*.el" "d"))
+   ("a \"b\\ c\" d" nil ("a" "b c" "d"))
+   ("a \"b\\\" c\" d" nil ("a" "b\" c" "d"))
+   ("a \"b\\\" \\\"c\" d" nil ("a" "b\" \"c" "d"))
+   ("a b \\c d" nil ("a" "b" "c" "d"))
+   ("a b \\cd" nil ("a" "b" "cd"))
+   ("a b\\ c d" nil ("a" "b c" "d"))
+   ("a b\\c d" nil ("a" "bc" "d"))
+   ("a b\\ c d" nil ("a" "b c" "d"))
+   ("a bc d" nil ("a" "b\\c" "d"))
+   ("a b c d" nil ("a" "b\\" "c" "d"))
+   ("a b\\ c d" nil ("a" "b c" "d"))
+   ("abcd\\ ef gh" nil ("abcd ef" "gh"
 (should (equal (shell-command+-tokenize args expand)
list
 



[elpa] externals/phps-mode c08ba09 3/3: Updated version and date

2021-08-04 Thread Christian Johansson
branch: externals/phps-mode
commit c08ba096879387cb9d595080037f32a843a5c8d0
Author: Christian Johansson 
Commit: Christian Johansson 

Updated version and date
---
 phps-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/phps-mode.el b/phps-mode.el
index 986aa25..32c2a2b 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -5,8 +5,8 @@
 ;; Author: Christian Johansson 
 ;; Maintainer: Christian Johansson 
 ;; Created: 3 Mar 2018
-;; Modified: 3 Aug 2021
-;; Version: 0.4.5
+;; Modified: 4 Aug 2021
+;; Version: 0.4.6
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 



[elpa] externals/consult updated (384156f -> 85e0322)

2021-08-04 Thread ELPA Syncer
elpasync pushed a change to branch externals/consult.

  from  384156f   Reduce docstring duplication
   new  2514c17   README: Delete outdated values column
   new  88c1e64   Async: Refresh more often
   new  ecd36de   consult--async-process: Do not consume input
   new  16d1e75   Reorder defcustoms
   new  85e0322   README: Add missing configuration variable


Summary of changes:
 README.org | 77 +++---
 consult.el | 27 +++---
 2 files changed, 53 insertions(+), 51 deletions(-)



[elpa] externals/consult 88c1e64 2/5: Async: Refresh more often

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit 88c1e64969f947fdf60e93ba0fde83e3f073
Author: Daniel Mendler 
Commit: Daniel Mendler 

Async: Refresh more often
---
 consult.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/consult.el b/consult.el
index c29bc09..ca6ec7c 100644
--- a/consult.el
+++ b/consult.el
@@ -84,7 +84,7 @@ This is the key representation accepted by `define-key'."
 The root directory is used by `consult-buffer' and `consult-grep'."
   :type '(choice function (const nil)))
 
-(defcustom consult-async-refresh-delay 0.4
+(defcustom consult-async-refresh-delay 0.2
   "Refreshing delay of the completion ui for asynchronous commands.
 
 The completion ui is only updated every `consult-async-refresh-delay'
@@ -92,7 +92,7 @@ seconds. This applies to asynchronous commands like for 
example
 `consult-grep'."
   :type 'float)
 
-(defcustom consult-async-input-throttle 0.5
+(defcustom consult-async-input-throttle 0.4
   "Input throttle for asynchronous commands.
 
 The asynchronous process is started only every



[elpa] externals/consult 85e0322 5/5: README: Add missing configuration variable

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit 85e03223eef7a70d35c5bc025eba5074f2b07077
Author: Daniel Mendler 
Commit: Daniel Mendler 

README: Add missing configuration variable
---
 README.org | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.org b/README.org
index 3a5cf65..6b7f3a2 100644
--- a/README.org
+++ b/README.org
@@ -926,6 +926,7 @@ configuration examples.
  | consult-line-point-placement | Placement of the point used by 
=consult-line=   |
  | consult-line-start-from-top  | Start the =consult-line= search from the 
top|
  | consult-locate-command   | Command line arguments for locate
 |
+ | consult-man-command  | Command line arguments for man   
 |
  | consult-mode-command-filter  | Filter for =consult-mode-command=
   |
  | consult-mode-histories   | Mode-specific history variables  
 |
  | consult-narrow-key   | Narrowing prefix key during completion   
 |



[elpa] externals/consult 16d1e75 4/5: Reorder defcustoms

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit 16d1e75199b3d9828126ee62dc5805dc446b821b
Author: Daniel Mendler 
Commit: Daniel Mendler 

Reorder defcustoms
---
 consult.el | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/consult.el b/consult.el
index a5e5735..8ccce82 100644
--- a/consult.el
+++ b/consult.el
@@ -217,12 +217,9 @@ See `consult--multi' for a description of the source 
values."
   "Filter commands for `consult-mode-command'."
   :type '(repeat (choice symbol regexp)))
 
-(defcustom consult-git-grep-command
-  "git --no-pager grep --null --color=always --extended-regexp\
-   --line-number -I -e ARG OPTS"
-  "Command line string for git-grep, see `consult-git-grep'.
-See `consult-grep-command' for more information."
-  :type 'string)
+(defcustom consult-grep-max-columns 300
+  "Maximal number of columns of grep output."
+  :type 'integer)
 
 (defcustom consult-grep-command
   "grep --null --line-buffered --color=always --extended-regexp\
@@ -234,9 +231,12 @@ substrings. ARG is replaced by the filter string and OPTS 
by the auxillary
 command options."
   :type 'string)
 
-(defcustom consult-grep-max-columns 300
-  "Maximal number of columns of grep output."
-  :type 'integer)
+(defcustom consult-git-grep-command
+  "git --no-pager grep --null --color=always --extended-regexp\
+   --line-number -I -e ARG OPTS"
+  "Command line string for git-grep, see `consult-git-grep'.
+See `consult-grep-command' for more information."
+  :type 'string)
 
 (defcustom consult-ripgrep-command
   "rg --null --line-buffered --color=ansi --max-columns=1000\



[elpa] externals/consult ecd36de 3/5: consult--async-process: Do not consume input

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit ecd36de4d1cb2c10e564c79fdf9b3587d68219d5
Author: Daniel Mendler 
Commit: Daniel Mendler 

consult--async-process: Do not consume input

The refresher should ignore the input.
---
 consult.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/consult.el b/consult.el
index ca6ec7c..a5e5735 100644
--- a/consult.el
+++ b/consult.el
@@ -1430,6 +1430,7 @@ PROPS are optional properties passed to `make-process'."
(setq proc nil))
  (setq last-args nil))
 ((pred stringp)
+ (funcall async action)
  (let* ((args (funcall cmd action))
 (stderr-buffer (generate-new-buffer " *consult-async-stderr*"))
 (flush t)
@@ -1539,7 +1540,7 @@ The DEBOUNCE delay defaults to 
`consult-async-input-debounce'."
 The refresh happens immediately when candidates are pushed."
   (lambda (action)
 (pcase action
-  ((or (pred consp) (pred stringp) 'flush)
+  ((or (pred consp) 'flush)
(prog1 (funcall async action)
  (funcall async 'refresh)))
   (_ (funcall async action)
@@ -1552,7 +1553,7 @@ The refresh happens after a DELAY, defaulting to 
`consult-async-refresh-delay'."
 (lambda (action)
   (prog1 (funcall async action)
 (pcase action
-  ((or (pred consp) (pred stringp) 'flush)
+  ((or (pred consp) 'flush)
(setq refresh t)
(unless timer
  (setq timer (run-at-time



[elpa] externals/consult 2514c17 1/5: README: Delete outdated values column

2021-08-04 Thread ELPA Syncer
branch: externals/consult
commit 2514c17b27f30c01e47958602b9f8c1f62b36874
Author: Daniel Mendler 
Commit: Daniel Mendler 

README: Delete outdated values column

It is better to use Marginalia or the Customize interface to explore these
values.
---
 README.org | 76 +++---
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/README.org b/README.org
index 078b8ad..3a5cf65 100644
--- a/README.org
+++ b/README.org
@@ -901,44 +901,44 @@ configuration examples.
  values and abbreviated description. Alternatively, type =C-h a ^consult= to 
get
  an overview of all Consult variables and functions with their descriptions.
 
- | Variable | Default  | Description   
|
- 
|--+--+---|
- | consult-after-jump-hook  | '(recenter)  | Functions to call 
after jumping to a location |
- | consult-async-input-debounce | 0.25 | Input debounce for 
asynchronous commands  |
- | consult-async-input-throttle | 0.5  | Input throttle for 
asynchronous commands  |
- | consult-async-min-input  | 3| Minimum numbers of 
letters needed for async process   |
- | consult-async-refresh-delay  | 0.25 | Refresh delay for 
asynchronous commands   |
- | consult-async-split-style| 'perl| Splitting style used 
for async commands   |
- | consult-async-split-styles-alist | ...  | Available splitting 
styles used for async commands|
- | consult-bookmark-narrow  | ...  | Narrowing 
configuration for =consult-bookmark=  |
- | consult-buffer-filter| ...  | Filter for 
=consult-buffer= |
- | consult-buffer-sources   | ...  | List of virtual 
buffer sources|
- | consult-crm-prefix   | ("  " . "✓ ")| Prefix string for CRM 
candidates  |
- | consult-find-command | "find ..."   | Command line 
arguments for find   |
- | consult-fontify-max-size | 1048576  | Buffers larger than 
this limit are not fontified  |
- | consult-fontify-preserve | t| Preserve 
fontification for line-based commands.   |
- | consult-git-grep-command | '(...)   | Command line 
arguments for git-grep   |
- | consult-goto-line-numbers| t| Show line numbers for 
=consult-goto-line=   |
- | consult-grep-max-columns | 250  | Maximal number of 
columns of the matching lines   |
- | consult-grep-command | "grep ..."   | Command line 
arguments for grep   |
- | consult-imenu-config | ...  | Mode-specific 
configuration for =consult-imenu= |
- | consult-line-numbers-widen   | t| Show absolute line 
numbers when narrowing is active.  |
- | consult-line-point-placement | 'match-beginning | Placement of the 
point used by =consult-line=   |
- | consult-line-start-from-top  | nil  | Start the 
=consult-line= search from the top|
- | consult-locate-command   | "locate ..." | Command line 
arguments for locate |
- | consult-mode-command-filter  | ...  | Filter for 
=consult-mode-command=   |
- | consult-mode-histories   | ...  | Mode-specific history 
variables   |
- | consult-narrow-key   | nil  | Narrowing prefix key 
during completion|
- | consult-preview-key  | 'any | Keys which triggers 
preview   |
- | consult-preview-excluded-hooks   | ...  | List of =find-file= 
hooks to avoid during preview   |
- | consult-preview-max-count| 10   | Maximum number of 
files to keep open during preview   |
- | consult-preview-max-size | 10485760 | Files larger than 
this size are not previewed |
- | consult-preview-raw-size | 102400   | Files larger than 
this size are previewed in raw form |
- | consult-project-root-function| nil  | Function which 
returns current project root   |
- | consult-register-narrow  | ...  | Narrowing 
configuration for =consult-register=  |
- | consult-ripgrep-command  | "rg ..." | Command line 
arguments for ripgrep|
- | consult-themes   | nil  | List of themes to be 
presented for selection  |
- | consult-widen-k

[elpa] externals/kiwix ca03a65 01/18: use Docker server by default

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit ca03a65f3c107ea6010aec1cd08efba3c26af069
Author: stardiviner 
Commit: stardiviner 

use Docker server by default
---
 kiwix.el | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index c290cae..6b07ad6 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -67,7 +67,7 @@
   "Kiwix customization options."
   :group 'kiwix)
 
-(defcustom kiwix-server-use-docker nil
+(defcustom kiwix-server-use-docker t
   "Using Docker container for kiwix-serve or not?"
   :type 'boolean
   :safe #'booleanp)
@@ -82,13 +82,14 @@
   :type 'string)
 
 (defcustom kiwix-server-command
-  (cond
-   ((file-executable-p "/usr/bin/kiwix-serve") "/usr/bin/kiwix-serve")
-   ((eq system-type 'gnu/linux) "/usr/lib/kiwix/bin/kiwix-serve")
-   ((eq system-type 'darwin)
-(warn "You need to specify Mac OS X Kiwix path. And send a PR to my 
repo."))
-   ((eq system-type 'windows-nt)
-(warn "You need to specify Windows Kiwix path. And send a PR to my 
repo.")))
+  (when (null kiwix-server-use-docker)
+(cond
+ ((file-executable-p "/usr/bin/kiwix-serve") "/usr/bin/kiwix-serve")
+ ((eq system-type 'gnu/linux) "/usr/lib/kiwix/bin/kiwix-serve")
+ ((eq system-type 'darwin)
+  (warn "You need to specify Mac OS X Kiwix path. And send a PR to my 
repo."))
+ ((eq 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)
 



[elpa] externals/kiwix updated (0c5e161 -> 71e770c)

2021-08-04 Thread monnier--- via
monnier pushed a change to branch externals/kiwix.

  from  0c5e161   Fix #5 Switch from selectrum-read to consult--read API
   new  ca03a65   use Docker server by default
   new  12e13c8   support remote Docker service
   new  0ec84f3   use dynamic ZIM library path
   new  7e0b82c   refresh ZIM libraries list once-time per package loading
   new  423f607   Concentrate all kiwix library dir variables into only one
   new  c273429   refactor and remove the variable `kiwix--selected-library'
   new  c871bef   refactor function kiwix-at-point to separate into smaller 
functional functions
   new  3330d7e   Add extra library "elquery" for parsing HTTP query HTML 
result
   new  e191c31   improve function kiwix-get-libraries to support remote 
Docker server
   new  d1e8fa2   Fix void variable kiwix-zim-dir
   new  f49557d   Fix format three fields
   new  716f3c4   Add condition to detect kiwix library path exist to fix 
GitHub Actions
   new  f9cae99   Improve kiwix-server-type docstring
   new  c0c597d   Improve package config examples on README
   new  9521d3b   Change default kiwix-server-type to docker-local
   new  a33c4a2   Fix kiwix-libraries variable not initialized by function 
kiwix-get-libraries
   new  0f85022   Add autoload cookies and improve docstring
   new  71e770c   Update config example in source code document section


Summary of changes:
 README.org |  43 +++-
 kiwix.el   | 344 +
 2 files changed, 226 insertions(+), 161 deletions(-)



[elpa] externals/kiwix c871bef 07/18: refactor function kiwix-at-point to separate into smaller functional functions

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit c871befcd37a37f182c36dcf94b9b93e2870e89e
Author: stardiviner 
Commit: stardiviner 

refactor function kiwix-at-point to separate into smaller functional 
functions
---
 kiwix.el | 133 ++-
 1 file changed, 72 insertions(+), 61 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 5c0dffe..9279cee 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -192,7 +192,7 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
 (defun kiwix-query (query &optional selected-library)
   "Search `QUERY' in `LIBRARY' with Kiwix."
   (let* ((library (or selected-library (kiwix--get-library-name 
selected-library)))
- (url (concat (format "%s:%s" kiwix-server-url (number-to-string 
kiwix-server-port))
+ (url (concat (format "%s:%s" kiwix-server-url kiwix-server-port)
   "/search?content=" library "&pattern=" 
(url-hexify-string query)))
  (browse-url-browser-function kiwix-default-browser-function))
 (browse-url url)))
@@ -237,7 +237,7 @@ list and return a list result."
 (let* ((library (or selected-library
 (kiwix--get-library-name selected-library)))
(ajax-api (format "%s:%s/suggest?content=%s&term="
- kiwix-server-url (number-to-string 
kiwix-server-port)
+ kiwix-server-url kiwix-server-port
  library))
(ajax-url (concat ajax-api input))
(data (request-response-data
@@ -259,71 +259,82 @@ list and return a list result."
(region-beginning) (region-end))
 (thing-at-point 'symbol)))
 
+(defun kiwix--ajax-select-available-hints (zim-library)
+  "AJAX search hints on the selected library and select one term from 
available hints."
+  (pcase kiwix-default-completing-read
+('selectrum
+ (require 'selectrum)
+ (require 'consult)
+ (consult--read
+  (lambda (input)
+(apply #'kiwix--ajax-search-hints
+   input `(,zim-library)))
+  :prompt "Kiwix related entries: "
+  :require-match nil))
+('ivy
+ (require 'ivy)
+ (ivy-read
+  "Kiwix related entries: "
+  (lambda (input)
+(apply #'kiwix--ajax-search-hints
+   input `(,zim-library)))
+  :predicate nil
+  :require-match nil
+  :initial-input (kiwix--get-thing-at-point)
+  :preselect nil
+  :def nil
+  :history nil
+  :keymap nil
+  :update-fn 'auto
+  :sort t
+  :dynamic-collection t
+  :caller 'ivy-done))
+('helm
+ (require 'helm)
+ (helm
+  :source (helm-build-async-source "kiwix-helm-search-hints"
+:candidates-process
+(lambda (input)
+  (apply #'kiwix--ajax-search-hints
+ input `(,zim-library
+  :input (kiwix--get-thing-at-point)
+  :buffer "*helm kiwix completion candidates*"))
+(_
+ (completing-read
+  "Kiwix related entries: "
+  ;; FIXME: This needs work!
+  (completion-table-dynamic
+   (lambda (input)
+ (apply #'kiwix--ajax-search-hints
+input `(,zim-library
+  nil nil
+  (kiwix--get-thing-at-point)
+
+(defun kiwix-search-at-library (zim-library query)
+  (interactive (let ((zim-library (kiwix-select-library)))
+ (list zim-library (kiwix--ajax-select-available-hints 
zim-library
+  (message (format "library: %s, query: %s" zim-library query))
+  (if (or (null zim-library)
+  (string-empty-p zim-library)
+  (null query)
+  (string-empty-p query))
+  (error "Your query is invalid")
+(kiwix-query query zim-library)))
+
+(defun kiwix-search-full-context (query)
+  "Full context search QUERY in all kiwix ZIM libraries."
+  (interactive
+   (list (read-string "kiwix full context search in all libraries: ")))
+  (browse-url (format "%s:%s/search?pattern=" kiwix-server-url 
kiwix-server-port query)))
+
 ;;;###autoload
 (defun kiwix-at-point ()
-  "Search for the symbol at point with `kiwix-query'."
+  "Search for the symbol at point with `kiwix-search-at-library'."
   (interactive)
   (unless (kiwix-ping-server)
 (kiwix-launch-server))
   (if kiwix-server-available?
-  (progn
-(setq kiwix--selected-library (kiwix-select-library))
-(let* ((library kiwix--selected-library)
-   (query (pcase kiwix-default-completing-read
-('selectrum
- (require 'selectrum)
- (require 'consult)
- (consult--read
-  (lambda (input)
-(apply #'kiwix-ajax-search-hints
-   input `(,kiwix--selected-library)))
-  :prompt "Kiwix related entries: "
-  :require-match nil))
-('ivy
- 

[elpa] externals/kiwix c273429 06/18: refactor and remove the variable `kiwix--selected-library'

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit c27342992ea68f958a327bd5355deabd8062f260
Author: stardiviner 
Commit: stardiviner 

refactor and remove the variable `kiwix--selected-library'
---
 kiwix.el | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index dc111d4..5c0dffe 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -149,19 +149,10 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
   "A helper function to refresh available Kiwx libraries."
   (setq kiwix-libraries (kiwix-get-libraries)))
 
-(defvar kiwix--selected-library nil
-  "Global variable of currently select library used in anonymous function.
-Like in function `kiwix-ajax-search-hints'.")
-
 (defun kiwix-select-library (&optional filter)
   "Select Kiwix library name."
   (completing-read "Kiwix library: " kiwix-libraries nil t filter))
 
-(defcustom kiwix-default-library "wikipedia_en_all.zim"
-  "The default kiwix library when library fragment in link not specified."
-  :type 'string
-  :safe #'stringp)
-
 (defcustom kiwix-mode-prefix nil
   "Specify kiwix-mode keybinding prefix before loading."
   :type 'kbd)
@@ -200,7 +191,7 @@ Like in function `kiwix-ajax-search-hints'.")
 
 (defun kiwix-query (query &optional selected-library)
   "Search `QUERY' in `LIBRARY' with Kiwix."
-  (let* ((library (or selected-library (kiwix--get-library-name 
kiwix-default-library)))
+  (let* ((library (or selected-library (kiwix--get-library-name 
selected-library)))
  (url (concat (format "%s:%s" kiwix-server-url (number-to-string 
kiwix-server-port))
   "/search?content=" library "&pattern=" 
(url-hexify-string query)))
  (browse-url-browser-function kiwix-default-browser-function))
@@ -223,7 +214,7 @@ Like in function `kiwix-ajax-search-hints'.")
(or (kiwix-docker-check)
(async-shell-command "docker pull kiwix/kiwix-serve")))
   (let ((inhibit-message t))
-(request (format "%s:%s" kiwix-server-url (number-to-string 
kiwix-server-port))
+(request (format "%s:%s" kiwix-server-url kiwix-server-port)
   :type "GET"
   :sync t
   :parser (lambda () (libxml-parse-html-region (point-min) (point-max)))
@@ -238,14 +229,13 @@ Like in function `kiwix-ajax-search-hints'.")
   :status-code '((404 . (lambda (&rest _) (message (format "Endpoint %s 
does not exist." url
  (500 . (lambda (&rest _) (message (format "Error from  
%s." url
 
-(defun kiwix-ajax-search-hints (input &optional selected-library)
+(defun kiwix--ajax-search-hints (input &optional selected-library)
   "Instantly AJAX request to get available Kiwix entry keywords
 list and return a list result."
   (kiwix-ping-server)
   (when (and input kiwix-server-available?)
 (let* ((library (or selected-library
-(kiwix--get-library-name (or kiwix--selected-library
- kiwix-default-library
+(kiwix--get-library-name selected-library)))
(ajax-api (format "%s:%s/suggest?content=%s&term="
  kiwix-server-url (number-to-string 
kiwix-server-port)
  library))



[elpa] externals/kiwix 12e13c8 02/18: support remote Docker service

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 12e13c8e44e5d2f965b184fadcb6639c19f4c2d1
Author: stardiviner 
Commit: stardiviner 

support remote Docker service
---
 kiwix.el | 70 ++--
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 6b07ad6..2e1bcae 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -40,7 +40,7 @@
 ;;   :ensure t
 ;;   :after org
 ;;   :bind (:map document-prefix ("w" . kiwix-at-point))
-;;   :init (setq kiwix-server-use-docker t
+;;   :init (setq kiwix-server-type 'docker-local
 ;;   kiwix-server-port 8080
 ;;   kiwix-default-library "wikipedia_zh_all_2015-11.zim"))
 
@@ -67,22 +67,33 @@
   "Kiwix customization options."
   :group 'kiwix)
 
-(defcustom kiwix-server-use-docker t
-  "Using Docker container for kiwix-serve or not?"
-  :type 'boolean
-  :safe #'booleanp)
+(defcustom kiwix-zim-dir "~/.www.kiwix.org/kiwix"
+  "The kiwix ZIM files directory."
+  :type 'string
+  :safe #'stringp)
+
+(defcustom kiwix-server-type 'docker-remote
+  "Specify the kiwix-serve type.
+- remote docker service
+- local docker service
+- local kiwix-serve service"
+  :type '(choice
+  (const :tag "Remote Docker Service" docker-remote)
+  (const :tag "Local Docker Service" docker-local)
+  (const :tag "Local kiwix-serve Service" kiwix-serve-local)))
+
+(defcustom kiwix-server-url "http://127.0.0.1";
+  "Specify Kiwix server URL."
+  :type 'string
+  :safe #'stringp)
 
 (defcustom kiwix-server-port 8000
   "Specify default kiwix-serve server port."
   :type 'number
   :safe #'numberp)
 
-(defcustom kiwix-server-url "http://127.0.0.1";
-  "Specify Kiwix server URL."
-  :type 'string)
-
 (defcustom kiwix-server-command
-  (when (null kiwix-server-use-docker)
+  (when (eq kiwix-server-type 'kiwix-serve-local)
 (cond
  ((file-executable-p "/usr/bin/kiwix-serve") "/usr/bin/kiwix-serve")
  ((eq system-type 'gnu/linux) "/usr/lib/kiwix/bin/kiwix-serve")
@@ -192,23 +203,26 @@ Like in function `kiwix-ajax-search-hints'.")
   "Launch Kiwix server."
   (interactive)
   (let ((library-path kiwix-default-library-dir))
-(if kiwix-server-use-docker
-(start-process
- "kiwix-server"
- " *kiwix server*"
- "docker"
- "container" "run" "-d"
- "--name" "kiwix-serve"
- "-v" (concat (file-name-directory library-path) ":" "/data")
- "kiwix/kiwix-serve"
- "--library" "library.xml")
-  (start-process
-   "kiwix-server"
-   " *kiwix server*"
-   kiwix-server-command
-   "--port" (number-to-string kiwix-server-port)
-   "--daemon"
-   "--library" (concat library-path "library.xml")
+(cl-case kiwix-server-type
+  ('docker-remote
+   (message "kiwix-serve service is started by user manually at other 
place."))
+  ('docker-local (start-process
+  "kiwix-server"
+  " *kiwix server*"
+  "docker"
+  "container" "run" "-d"
+  "--name" "kiwix-serve"
+  "-v" (concat (file-name-directory library-path) ":" 
"/data")
+  "-p" (format "%s:80" kiwix-server-port)
+  "kiwix/kiwix-serve"
+  "--library" "library.xml"))
+  ('kiwix-serve-local (start-process
+   "kiwix-server"
+   " *kiwix server*"
+   kiwix-server-command
+   "--port" (number-to-string kiwix-server-port)
+   "--daemon"
+   "--library" (concat library-path "library.xml"))
 
 (defun kiwix-capitalize-first (string)
   "Only capitalize the first word of STRING."
@@ -235,7 +249,7 @@ Like in function `kiwix-ajax-search-hints'.")
 
 (defun kiwix-ping-server ()
   "Ping Kiwix server to set `kiwix-server-available?' global state variable."
-  (and kiwix-server-use-docker
+  (and (eq kiwix-server-type 'docker-local)
(or (kiwix-docker-check)
(async-shell-command "docker pull kiwix/kiwix-serve")))
   (let ((inhibit-message t))



[elpa] externals/kiwix 0ec84f3 03/18: use dynamic ZIM library path

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 0ec84f35f7cb10327924260cafdc16c4a6d02c96
Author: stardiviner 
Commit: stardiviner 

use dynamic ZIM library path
---
 kiwix.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 2e1bcae..18c610e 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -106,21 +106,21 @@
 
 (defun kiwix-dir-detect ()
   "Detect Kiwix profile directory exist."
-  (let ((kiwix-dir "~/.www.kiwix.org/kiwix"))
+  (let ((kiwix-dir kiwix-zim-dir))
 (if (and (file-directory-p kiwix-dir) (file-readable-p kiwix-dir))
 kiwix-dir
-  (warn "ERROR: Kiwix profile directory \"~/.www.kiwix.org/kiwix\" is not 
accessible.")
+  (warn (format "ERROR: Kiwix profile directory %s is not accessible." 
kiwix-zim-dir))
   nil)))
 
 (defcustom kiwix-default-data-profile-name
   (when (kiwix-dir-detect)
-(car (directory-files "~/.www.kiwix.org/kiwix" nil ".*\\.default\\'")))
+(car (directory-files kiwix-zim-dir nil ".*\\.default\\'")))
   "Specify the default Kiwix data profile path."
   :type 'string)
 
 (defcustom kiwix-default-data-dir
   (when (kiwix-dir-detect)
-(concat "~/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
+(concat kiwix-zim-dir kiwix-default-data-profile-name))
   "Specify the default Kiwix data directory."
   :type 'string
   :safe #'stringp)



[elpa] externals/kiwix 423f607 05/18: Concentrate all kiwix library dir variables into only one

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 423f60705b0922437984387d89d8153c74bf204a
Author: stardiviner 
Commit: stardiviner 

Concentrate all kiwix library dir variables into only one
---
 kiwix.el | 38 --
 1 file changed, 8 insertions(+), 30 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 2ab9843..dc111d4 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -67,7 +67,12 @@
   "Kiwix customization options."
   :group 'kiwix)
 
-(defcustom kiwix-zim-dir "~/.www.kiwix.org/kiwix"
+(defcustom kiwix-zim-dir
+  (file-name-directory
+   (concat
+"~/.www.kiwix.org/kiwix"
+(car (directory-files kiwix-zim-dir nil ".*\\.default\\'")) ; profile 
folder name
+"/data/library/*.zim"))
   "The kiwix ZIM files directory."
   :type 'string
   :safe #'stringp)
@@ -104,33 +109,6 @@
   "Specify kiwix server command."
   :type 'string)
 
-(defun kiwix-dir-detect ()
-  "Detect Kiwix profile directory exist."
-  (let ((kiwix-dir kiwix-zim-dir))
-(if (and (file-directory-p kiwix-dir) (file-readable-p kiwix-dir))
-kiwix-dir
-  (warn (format "ERROR: Kiwix profile directory %s is not accessible." 
kiwix-zim-dir))
-  nil)))
-
-(defcustom kiwix-default-data-profile-name
-  (when (kiwix-dir-detect)
-(car (directory-files kiwix-zim-dir nil ".*\\.default\\'")))
-  "Specify the default Kiwix data profile path."
-  :type 'string)
-
-(defcustom kiwix-default-data-dir
-  (when (kiwix-dir-detect)
-(concat kiwix-zim-dir kiwix-default-data-profile-name))
-  "Specify the default Kiwix data directory."
-  :type 'string
-  :safe #'stringp)
-
-(defcustom kiwix-default-library-dir
-  (file-name-directory (concat kiwix-default-data-dir 
"/data/library/library.xml"))
-  "Kiwix libraries path."
-  :type 'string
-  :safe #'stringp)
-
 (defcustom kiwix-default-completing-read (cond
   ((fboundp 'consult--read) 'selectrum)
   ((fboundp 'ivy-read) 'ivy)
@@ -160,9 +138,9 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
 
 (defun kiwix-get-libraries ()
   "Check out all available Kiwix libraries."
-  (when (kiwix-dir-detect)
+  (when kiwix-zim-dir
 (mapcar #'kiwix--get-library-name
-(directory-files kiwix-default-library-dir nil ".*\\.zim\\'"
+(directory-files kiwix-zim-dir nil ".*\\.zim\\'"
 
 (defvar kiwix-libraries (kiwix-get-libraries)
   "A list of Kiwix libraries.")



[elpa] externals/kiwix 7e0b82c 04/18: refresh ZIM libraries list once-time per package loading

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 7e0b82c2776dd56130a46e11b78f9a659e70f50f
Author: stardiviner 
Commit: stardiviner 

refresh ZIM libraries list once-time per package loading
---
 kiwix.el | 8 
 1 file changed, 8 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 18c610e..2ab9843 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -175,16 +175,8 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
   "Global variable of currently select library used in anonymous function.
 Like in function `kiwix-ajax-search-hints'.")
 
-;; - examples:
-;; - "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-select-library (&optional filter)
   "Select Kiwix library name."
-  (kiwix-libraries-refresh)
   (completing-read "Kiwix library: " kiwix-libraries nil t filter))
 
 (defcustom kiwix-default-library "wikipedia_en_all.zim"



[elpa] externals/kiwix e191c31 09/18: improve function kiwix-get-libraries to support remote Docker server

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit e191c312e5c9343fd9601c45a8ccd017479ee475
Author: stardiviner 
Commit: stardiviner 

improve function kiwix-get-libraries to support remote Docker server
---
 kiwix.el | 51 +++
 1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index c12614a..f11fddd 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -6,7 +6,7 @@
 ;; Keywords: kiwix wikipedia
 ;; Homepage: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
-;; Version: 1.0.3
+;; Version: 1.1.0
 ;; Package-Requires: ((emacs "24.4") (request "0.3.0") (elquery "0.1.0"))
 
 ;; Copyright (C) 2019-2020  Free Software Foundation, Inc.
@@ -133,22 +133,57 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
   (const :tag "xwidget browser" xwidget-webkit-browse-url))
   :safe #'symbolp)
 
+
+(defvar kiwix-libraries ()
+  "A list of Kiwix libraries.")
+
 (defun kiwix--get-library-name (file)
   "Extract library name from library file."
   (replace-regexp-in-string "\\.zim\\'" "" file))
 
 (defun kiwix-get-libraries ()
   "Check out all available Kiwix libraries."
-  (when kiwix-zim-dir
-(mapcar #'kiwix--get-library-name
-(directory-files kiwix-zim-dir nil ".*\\.zim\\'"
-
-(defvar kiwix-libraries (kiwix-get-libraries)
-  "A list of Kiwix libraries.")
+  (cond
+   ;; ZIM library files on remote Docker server, parse index HTML page.
+   ((eq kiwix-server-type 'docker-remote)
+(let ((url (format "%s:%s" kiwix-server-url kiwix-server-port)))
+  (request url
+:type "GET"
+:sync t
+:parser (lambda ()
+  (let ((html (elquery-read-string 
(buffer-substring-no-properties (point-min) (point-max)
+(setq kiwix-libraries
+  (mapcar
+   ;; remove "/" from "/"
+   (lambda (slash_library)
+ (substring slash_library 1 nil))
+   ;; extract plist values. list of 
"/"
+   (mapcar 'cadr
+   ;; extract nodes properties in plist
+   (mapcar #'elquery-props
+   ;; return a list of elquery nodes
+   (elquery-children
+;; return the 
+(car (elquery-$ ".book__list" 
html)))
+(elquery-children (first (elquery-$ ".book__list" html)
+:error (cl-function
+(lambda (&rest args &key error-thrown &allow-other-keys)
+  (message "Function kiwix-get-libraries error.")))
+:success (cl-function
+  (lambda (&key _data &allow-other-keys)
+_data))
+:status-code '((404 . (lambda (&rest _) (message (format "Endpoint %s 
does not exist." url
+   (500 . (lambda (&rest _) (message (format "Error from 
%s." url
+   ;; ZIM library files on local host, parse directory files.
+   ((or (eq kiwix-server-type 'kiwix-serve-local)
+(eq kiwix-server-type 'docker-local))
+(when (and (file-directory-p kiwix-zim-dir) (file-readable-p 
kiwix-zim-dir))
+  (mapcar #'kiwix--get-library-name
+  (directory-files kiwix-zim-dir nil ".*\\.zim\\'"))
 
 (defun kiwix-libraries-refresh ()
   "A helper function to refresh available Kiwx libraries."
-  (setq kiwix-libraries (kiwix-get-libraries)))
+  (kiwix-get-libraries))
 
 (defun kiwix-select-library (&optional filter)
   "Select Kiwix library name."



[elpa] externals/kiwix 716f3c4 12/18: Add condition to detect kiwix library path exist to fix GitHub Actions

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 716f3c43ccf5c1d0ced2ff362fe2d68767c506cb
Author: stardiviner 
Commit: stardiviner 

Add condition to detect kiwix library path exist to fix GitHub Actions
---
 kiwix.el | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 738e3ef..0beebf5 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -69,11 +69,12 @@
   :group 'kiwix)
 
 (defcustom kiwix-zim-dir
-  (file-name-directory
-   (concat
-"~/.www.kiwix.org/kiwix"
-(car (directory-files "~/.www.kiwix.org/kiwix" nil ".*\\.default\\'")) ; 
profile folder name
-"/data/library/*.zim"))
+  (when (file-readable-p (expand-file-name "~/.www.kiwix.org/kiwix"))
+(file-name-directory
+ (concat
+  (expand-file-name "~/.www.kiwix.org/kiwix")
+  (car (directory-files (expand-file-name "~/.www.kiwix.org/kiwix") nil 
".*\\.default\\'")) ; profile folder name
+  "/data/library/*.zim")))
   "The kiwix ZIM files directory."
   :type 'string
   :safe #'stringp)



[elpa] externals/kiwix 9521d3b 15/18: Change default kiwix-server-type to docker-local

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 9521d3ba1333bdf7b026a9ef920f673b2939172b
Author: stardiviner 
Commit: stardiviner 

Change default kiwix-server-type to docker-local
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 979a478..8616cff 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -79,7 +79,7 @@
   :type 'string
   :safe #'stringp)
 
-(defcustom kiwix-server-type 'docker-remote
+(defcustom kiwix-server-type 'docker-local
   "Specify the kiwix-serve type.
 - 'docker-remote :: remote docker service
 - 'docker-local  :: local docker service



[elpa] externals/kiwix 3330d7e 08/18: Add extra library "elquery" for parsing HTTP query HTML result

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 3330d7ef3e151afab8280448928d584dce641cc3
Author: stardiviner 
Commit: stardiviner 

Add extra library "elquery" for parsing HTTP query HTML result
---
 kiwix.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 9279cee..c12614a 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; Homepage: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 1.0.3
-;; Package-Requires: ((emacs "24.4") (request "0.3.0"))
+;; Package-Requires: ((emacs "24.4") (request "0.3.0") (elquery "0.1.0"))
 
 ;; Copyright (C) 2019-2020  Free Software Foundation, Inc.
 
@@ -57,6 +57,7 @@
 (require 'subr-x)
 (require 'thingatpt)
 (require 'json)
+(require 'elquery)
 
 (declare-function helm "helm")
 (declare-function helm-build-async-source "helm")



[elpa] externals/kiwix f49557d 11/18: Fix format three fields

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit f49557d949b60857363d3617d7268ae582d64c2a
Author: stardiviner 
Commit: stardiviner 

Fix format three fields
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index 7659e67..738e3ef 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -361,7 +361,7 @@ list and return a list result."
   "Full context search QUERY in all kiwix ZIM libraries."
   (interactive
(list (read-string "kiwix full context search in all libraries: ")))
-  (browse-url (format "%s:%s/search?pattern=" kiwix-server-url 
kiwix-server-port query)))
+  (browse-url (format "%s:%s/search?pattern=%s" kiwix-server-url 
kiwix-server-port query)))
 
 ;;;###autoload
 (defun kiwix-at-point ()



[elpa] externals/kiwix d1e8fa2 10/18: Fix void variable kiwix-zim-dir

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit d1e8fa23e9634327fb132d024f31f90082eac0e6
Author: stardiviner 
Commit: stardiviner 

Fix void variable kiwix-zim-dir
---
 kiwix.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index f11fddd..7659e67 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -72,7 +72,7 @@
   (file-name-directory
(concat
 "~/.www.kiwix.org/kiwix"
-(car (directory-files kiwix-zim-dir nil ".*\\.default\\'")) ; profile 
folder name
+(car (directory-files "~/.www.kiwix.org/kiwix" nil ".*\\.default\\'")) ; 
profile folder name
 "/data/library/*.zim"))
   "The kiwix ZIM files directory."
   :type 'string



[elpa] externals/kiwix f9cae99 13/18: Improve kiwix-server-type docstring

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit f9cae99d4ac2ffc65087da72be38838f50abd6c2
Author: stardiviner 
Commit: stardiviner 

Improve kiwix-server-type docstring
---
 kiwix.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 0beebf5..979a478 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -81,9 +81,9 @@
 
 (defcustom kiwix-server-type 'docker-remote
   "Specify the kiwix-serve type.
-- remote docker service
-- local docker service
-- local kiwix-serve service"
+- 'docker-remote :: remote docker service
+- 'docker-local  :: local docker service
+- 'kiwix-serve-local :: local kiwix-serve service"
   :type '(choice
   (const :tag "Remote Docker Service" docker-remote)
   (const :tag "Local Docker Service" docker-local)



[elpa] externals/kiwix a33c4a2 16/18: Fix kiwix-libraries variable not initialized by function kiwix-get-libraries

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit a33c4a2fd00f24b899b1f2197fc104eb29897706
Author: stardiviner 
Commit: stardiviner 

Fix kiwix-libraries variable not initialized by function kiwix-get-libraries
---
 kiwix.el | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 8616cff..a47591b 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -182,12 +182,9 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
   (mapcar #'kiwix--get-library-name
   (directory-files kiwix-zim-dir nil ".*\\.zim\\'"))
 
-(defun kiwix-libraries-refresh ()
-  "A helper function to refresh available Kiwx libraries."
-  (kiwix-get-libraries))
-
 (defun kiwix-select-library (&optional filter)
   "Select Kiwix library name."
+  (kiwix-get-libraries)
   (completing-read "Kiwix library: " kiwix-libraries nil t filter))
 
 (defcustom kiwix-mode-prefix nil



[elpa] externals/kiwix 71e770c 18/18: Update config example in source code document section

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 71e770ce1e9994cf3e035cbcc7a2f26b1922323c
Author: stardiviner 
Commit: stardiviner 

Update config example in source code document section
---
 kiwix.el | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 86d577e..5761f02 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -39,10 +39,14 @@
 ;; (use-package kiwix
 ;;   :ensure t
 ;;   :after org
+;;   :commands (kiwix-launch-server kiwix-at-point kiwix-search-at-library 
kiwix-search-full-context)
 ;;   :bind (:map document-prefix ("w" . kiwix-at-point))
-;;   :init (setq kiwix-server-type 'docker-local
-;;   kiwix-server-port 8080
-;;   kiwix-default-library "wikipedia_zh_all_2015-11.zim"))
+;;   :custom ((kiwix-server-type 'docker-remote)
+;;(kiwix-server-url "http://192.168.31.251";)
+;;(kiwix-server-port 8089))
+;;   :hook (org-load . org-kiwix-setup-link)
+;;   :init (require 'org-kiwix)
+;;   :config (add-hook 'org-load-hook #'org-kiwix-setup-link))
 
  Usage:
 ;;



[elpa] externals/kiwix 0f85022 17/18: Add autoload cookies and improve docstring

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit 0f85022bc7a02c84ac8054ae9576f2d9a3c711fc
Author: stardiviner 
Commit: stardiviner 

Add autoload cookies and improve docstring
---
 kiwix.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kiwix.el b/kiwix.el
index a47591b..86d577e 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -242,6 +242,7 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
 (defvar kiwix-server-available? nil
   "The kiwix-server current available?")
 
+;;;###autoload
 (defun kiwix-ping-server ()
   "Ping Kiwix server to set `kiwix-server-available?' global state variable."
   (and (eq kiwix-server-type 'docker-local)
@@ -344,7 +345,9 @@ list and return a list result."
   nil nil
   (kiwix--get-thing-at-point)
 
+;;;###autoload
 (defun kiwix-search-at-library (zim-library query)
+  "Search QUERY in selected ZIM library."
   (interactive (let ((zim-library (kiwix-select-library)))
  (list zim-library (kiwix--ajax-select-available-hints 
zim-library
   (message (format "library: %s, query: %s" zim-library query))
@@ -355,8 +358,9 @@ list and return a list result."
   (error "Your query is invalid")
 (kiwix-query query zim-library)))
 
+;;;###autoload
 (defun kiwix-search-full-context (query)
-  "Full context search QUERY in all kiwix ZIM libraries."
+  "Full context search QUERY in all kiwix ZIM libraries. It's very slow."
   (interactive
(list (read-string "kiwix full context search in all libraries: ")))
   (browse-url (format "%s:%s/search?pattern=%s" kiwix-server-url 
kiwix-server-port query)))



[elpa] externals/kiwix c0c597d 14/18: Improve package config examples on README

2021-08-04 Thread monnier--- via
branch: externals/kiwix
commit c0c597d1e1653112f3e10c67dcc22d85beb2aed8
Author: stardiviner 
Commit: stardiviner 

Improve package config examples on README
---
 README.org | 43 ---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 360b37f..f446032 100644
--- a/README.org
+++ b/README.org
@@ -305,15 +305,52 @@ docker container ls --all | grep "kiwix-serve" | cat
 
 ** use-package
 
+*** for local kiwix-serve server
+
 #+begin_src emacs-lisp
 (use-package kiwix
   :ensure t
   :after org
-  :custom ((kiwix-server-use-docker t)
+  :commands (kiwix-launch-server kiwix-at-point)
+  :bind (:map document-prefix ("w" . kiwix-at-point))
+  :custom ((kiwix-server-type 'kiwix-serve-local)
+   (kiwix-server-url "http://127.0.0.1";)
(kiwix-server-port 8089)
-   (kiwix-default-library "wikipedia_en_all_2016-02.zim") ; 
"wikipedia_zh_all_2015-11.zim"
-   (kiwix-default-browser-function 'eww))
+   (kiwix-zim-dir (expand-file-name "/path/to/kiwix_zim_libraries")))
+  :hook (org-load . org-kiwix-setup-link)
+  :init (require 'org-kiwix)
+  :config (add-hook 'org-load-hook #'org-kiwix-setup-link))
+#+end_src
+
+*** for local Docker server
+
+#+begin_src emacs-lisp
+(use-package kiwix
+  :ensure t
+  :after org
+  :commands (kiwix-launch-server kiwix-at-point)
+  :bind (:map document-prefix ("w" . kiwix-at-point))
+  :custom ((kiwix-server-type 'docker-local)
+   (kiwix-server-url "http://127.0.0.1";)
+   (kiwix-server-port 8089)
+   (kiwix-zim-dir (expand-file-name "/path/to/kiwix_zim_libraries")))
+  :hook (org-load . org-kiwix-setup-link)
+  :init (require 'org-kiwix)
+  :config (add-hook 'org-load-hook #'org-kiwix-setup-link))
+#+end_src
+
+*** for remote Docker server
+
+#+begin_src emacs-lisp
+(use-package kiwix
+  :ensure t
+  :after org
   :commands (kiwix-launch-server kiwix-at-point)
+  :bind (:map document-prefix ("w" . kiwix-at-point))
+  :custom ((kiwix-server-type 'docker-remote)
+   (kiwix-server-url "http://192.168.31.251";)
+   (kiwix-server-port 8089))
+  :hook (org-load . org-kiwix-setup-link)
   :init (require 'org-kiwix)
   :config (add-hook 'org-load-hook #'org-kiwix-setup-link))
 #+end_src



[elpa] externals/multishell updated (35a0dd3 -> 82b2ac6)

2021-08-04 Thread monnier--- via
monnier pushed a change to branch externals/multishell.

  from  35a0dd3   * multishell/multishell.el: Require cl-lib when compiling 
for cl-letf macro.
   new  bf8285b   Make multishell command-key customization work.
   new  82b2ac6   Try to clarify multishell-command-key description, remove 
deprecated stuff.


Summary of changes:
 multishell.el | 70 +++
 1 file changed, 27 insertions(+), 43 deletions(-)



[elpa] externals/multishell bf8285b 1/2: Make multishell command-key customization work.

2021-08-04 Thread monnier--- via
branch: externals/multishell
commit bf8285ba07ae6d1939c91a2db3eae438044540b7
Author: Ken Manheimer 
Commit: Ken Manheimer 

Make multishell command-key customization work.

We're deprecating the complicated mess that wasn't working. That
deprecation is partial, because I don't see how to deprecate defcustom
entries in a way that keeps them from being show in the customization
buffer, sigh.
---
 multishell.el | 61 ---
 1 file changed, 42 insertions(+), 19 deletions(-)

diff --git a/multishell.el b/multishell.el
index 6d93485..133a1bf 100644
--- a/multishell.el
+++ b/multishell.el
@@ -60,6 +60,8 @@
 ;;
 ;; Change Log:
 ;;
+;; * 2021-08-02 1.1.10 Ken Manheimer:
+;;   - Get basic multishell command-key customization working.
 ;; * 2020-10-30 1.1.9 Ken Manheimer:
 ;;   - Require cl-lib when compiling for cl-letf macro.
 ;; * 2020-10-28 1.1.8 Ken Manheimer:
@@ -174,7 +176,7 @@
 (require 'savehist)
 (eval-when-compile (require 'cl-lib))
 
-(defvar multishell-version "1.1.9")
+(defvar multishell-version "1.1.10")
 (defun multishell-version (&optional here)
   "Return string describing the loaded multishell version."
   (interactive "P")
@@ -191,20 +193,39 @@ Customize `allout-widgets-auto-activation' to activate 
allout-widgets
 with allout-mode."
   :group 'shell)
 
+(defun multishell-command-key-setter (symbol value)
+  "Establish key binding, or do nothing if none selected."
+  symbol
+  (cond (value
+ (setq multishell-command-key value)
+ (global-set-key multishell-command-key 'multishell-pop-to-shell))
+((and multishell-command-key
+  (equal (lookup-key (current-global-map)
+ multishell-command-key)
+ 'multishell-pop-to-shell))
+ (global-unset-key multishell-command-key)
+ (setq multishell-command-key nil)))
+ )
 (defcustom multishell-command-key "\M- "
-  "The key to use if `multishell-activate-command-key' is true.
+  "Key to bind to `multishell-pop-to-shell`.
 
-You can instead manually bind `multishell-pop-to-shell' using emacs
-lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
-  :type 'key-sequence)
+Choose nil to not establish a key binding, and remove the prior binding
+if there was one."
+  :set #'multishell-command-key-setter
+  :type '(choice (const nil)
+ (key-sequence)))
 
 (defvar multishell--responsible-for-command-key nil
   "Coordination for multishell key assignment.")
+(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
+
 (defun multishell-activate-command-key-setter (symbol setting)
   "Implement `multishell-activate-command-key' choice."
+  (declare (obsolete 'multishell-activate-command-key-setter "1.1.10"))
   (set-default symbol setting)
   (when (or setting multishell--responsible-for-command-key)
 (multishell-implement-command-key-choice (not setting
+
 (defun multishell-implement-command-key-choice (&optional unbind)
   "If settings dicate, implement binding of multishell command key.
 
@@ -212,6 +233,7 @@ If optional UNBIND is true, globally unbind the key.
 
 * `multishell-activate-command-key' - Set this to get the binding or not.
 * `multishell-command-key' - The key to use for the binding, if appropriate."
+  (declare (obsolete 'multishell-implement-command-key-choice "1.1.10"))
   (when (bound-and-true-p multishell-command-key)
 (if unbind
 (global-unset-key multishell-command-key)
@@ -219,20 +241,21 @@ If optional UNBIND is true, globally unbind the key.
 (setq multishell--responsible-for-command-key t)
 (global-set-key multishell-command-key 'multishell-pop-to-shell)
 
-(defcustom multishell-activate-command-key nil
-  "Set this to impose the `multishell-command-key' binding.
-
-You can instead manually bind `multishell-pop-to-shell' using emacs
-lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
-  :type 'boolean
-  :set #'multishell-activate-command-key-setter)
-
-;; Implement the key customization whenever the package is loaded:
-(if (fboundp 'with-eval-after-load)
-(with-eval-after-load "multishell"
-  (multishell-implement-command-key-choice))
-  (eval-after-load "multishell"
-'(multishell-implement-command-key-choice)))
+;; (defcustom multishell-activate-command-key nil
+;;   "Set this to impose the `multishell-command-key' binding.
+
+;; You can instead manually bind `multishell-pop-to-shell' using emacs
+;; lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
+;;   :type 'boolean
+;;   :set #'multishell-activate-command-key-setter)
+(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
+
+;; ;; Implement the key customization whenever the package is loaded:
+;; (if (fboundp 'with-eval-after-load)
+;; (with-eval-after-load "multishell"
+;;   (multishell-implement-command-key-choice))
+;;   (eval-after-load "multishell"
+;; '(mul

[elpa] externals/multishell 82b2ac6 2/2: Try to clarify multishell-command-key description, remove deprecated stuff.

2021-08-04 Thread monnier--- via
branch: externals/multishell
commit 82b2ac67352d483a0c5eb226a506ff409f55e7d9
Author: Ken Manheimer 
Commit: Ken Manheimer 

Try to clarify multishell-command-key description, remove deprecated stuff.

The deprecation was insufficient, anyway, since I was unable to deprecate
the multishell-activate-command-key setting in a way that kept it out of
the presented customizations.
---
 multishell.el | 55 ---
 1 file changed, 8 insertions(+), 47 deletions(-)

diff --git a/multishell.el b/multishell.el
index 133a1bf..87afa27 100644
--- a/multishell.el
+++ b/multishell.el
@@ -206,56 +206,17 @@ with allout-mode."
  (global-unset-key multishell-command-key)
  (setq multishell-command-key nil)))
  )
-(defcustom multishell-command-key "\M- "
+(defcustom multishell-command-key [M-space]
   "Key to bind to `multishell-pop-to-shell`.
 
-Choose nil to not establish a key binding, and remove the prior binding
-if there was one."
+If you select None then the prior binding is removed.
+
+\(In some windowing environments `M- ` (Meta-space) doesn't
+work. A possibly appealing alternative is `M-`.)"
   :set #'multishell-command-key-setter
-  :type '(choice (const nil)
- (key-sequence)))
-
-(defvar multishell--responsible-for-command-key nil
-  "Coordination for multishell key assignment.")
-(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
-
-(defun multishell-activate-command-key-setter (symbol setting)
-  "Implement `multishell-activate-command-key' choice."
-  (declare (obsolete 'multishell-activate-command-key-setter "1.1.10"))
-  (set-default symbol setting)
-  (when (or setting multishell--responsible-for-command-key)
-(multishell-implement-command-key-choice (not setting
-
-(defun multishell-implement-command-key-choice (&optional unbind)
-  "If settings dicate, implement binding of multishell command key.
-
-If optional UNBIND is true, globally unbind the key.
-
-* `multishell-activate-command-key' - Set this to get the binding or not.
-* `multishell-command-key' - The key to use for the binding, if appropriate."
-  (declare (obsolete 'multishell-implement-command-key-choice "1.1.10"))
-  (when (bound-and-true-p multishell-command-key)
-(if unbind
-(global-unset-key multishell-command-key)
-  (when (bound-and-true-p multishell-activate-command-key)
-(setq multishell--responsible-for-command-key t)
-(global-set-key multishell-command-key 'multishell-pop-to-shell)
-
-;; (defcustom multishell-activate-command-key nil
-;;   "Set this to impose the `multishell-command-key' binding.
-
-;; You can instead manually bind `multishell-pop-to-shell' using emacs
-;; lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
-;;   :type 'boolean
-;;   :set #'multishell-activate-command-key-setter)
-(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
-
-;; ;; Implement the key customization whenever the package is loaded:
-;; (if (fboundp 'with-eval-after-load)
-;; (with-eval-after-load "multishell"
-;;   (multishell-implement-command-key-choice))
-;;   (eval-after-load "multishell"
-;; '(multishell-implement-command-key-choice)))
+  :type '(choice
+  (const :tag "None" nil)
+  (key-sequence :tag "Key sequence")))
 
 (defcustom multishell-pop-to-frame nil
   "*If non-nil, jump to a frame already showing the shell, if another one is.



[elpa] branch scratch/javaimp-wip deleted (was 71be533)

2021-08-04 Thread Filipp Gunbin
fgunbin pushed a change to branch scratch/javaimp-wip.

   was  71be533   wip

This change permanently discards the following revisions:

  discards  71be533   wip
  discards  4ac5cb4   wip
  discards  fe080eb   wip
  discards  aa0f932   wip
  discards  a5c00a7   wip
  discards  551b1a3   wip
  discards  86cd3b9   wip



[elpa] branch scratch/javaimp-wip created (now dcc6bed)

2021-08-04 Thread Filipp Gunbin
fgunbin pushed a change to branch scratch/javaimp-wip.

at  dcc6bed   wip

This branch includes the following new commits:

   new  86cd3b9   wip
   new  551b1a3   wip
   new  a5c00a7   wip
   new  aa0f932   wip
   new  fe080eb   wip
   new  4ac5cb4   wip
   new  dcc6bed   wip




[elpa] scratch/javaimp-wip 86cd3b9 1/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit 86cd3b9b9eb8f0da4d873cac2ead1475d2ed986f
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el | 101 +--
 javaimp.el   |  20 +--
 2 files changed, 87 insertions(+), 34 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index fca0369..db58e0e 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -335,6 +335,7 @@ those may later become 'local-class' (see 
`javaimp--parse-scopes')."
(javaimp--parse-skip-back-until)
(= (char-before) ?\)))
  (ignore-errors
+   ;; for method this is arglist
(goto-char
 (scan-lists (point) -1 0
 (let* (;; leave open/close parens out
@@ -367,14 +368,14 @@ those may later become 'local-class' (see 
`javaimp--parse-scopes')."
   "Attempts to parse 'array' scope."
   (save-excursion
 (and (javaimp--parse-skip-back-until)
- (member (char-before) '(?, ?{ ?\]))
+ (member (char-before) '(?, ?\]))
  (make-javaimp-scope :type 'array
  :name ""
  :start nil
  :open-brace (nth 1 state)
 
 (defun javaimp--parse-scope-unknown (state)
-  "Catch-all parser which produces `unknown' scope."
+  "Catch-all parser which produces 'unknown' scope."
   (make-javaimp-scope :type 'unknown
   :name "unknown"
   :start nil
@@ -382,34 +383,50 @@ those may later become 'local-class' (see 
`javaimp--parse-scopes')."
 
 (defun javaimp--parse-scopes (count)
   "Attempts to parse COUNT enclosing scopes at point.  If COUNT is
-nil then goes all the way up."
-  (let ((state (syntax-ppss)) res)
+nil then goes all the way up.  Examines and sets property
+'javaimp-parse-scope' at each scope's open brace."
+  (let ((state (syntax-ppss))
+res)
 (unless (syntax-ppss-context state)
-  (save-excursion
-(while (and (nth 1 state)
-(or (not count)
-(>= (setq count (1- count)) 0)))
-  ;; find innermost enclosing open-bracket
-  (goto-char (nth 1 state))
-  (when (= (char-after) ?{)
-(let ((scope (run-hook-with-args-until-success
-  'javaimp--parse-scope-hook state)))
-  (push scope res)
-  (if (javaimp-scope-start scope)
-  (goto-char (javaimp-scope-start scope)
-  (setq state (syntax-ppss)
+  (while (and (nth 1 state)
+  (or (not count)
+  (>= (setq count (1- count)) 0)))
+;; find innermost enclosing open-bracket
+(goto-char (nth 1 state))
+(when (= (char-after) ?{)
+  (let ((scope (get-text-property 'javaimp-parse-scope)))
+(unless scope
+  (setq scope (run-hook-with-args-until-success
+   'javaimp--parse-scope-hook state))
+  (put-text-property (point) (1+ (point))
+ 'javaimp--parse-scope scope))
+(push scope res)
+(if (javaimp-scope-start scope)
+(goto-char (javaimp-scope-start scope)
+(setq state (syntax-ppss
 ;; if a class is enclosed in anything other than a class, then it
 ;; should be local
 (let ((tmp res)
   in-local)
   (while tmp
 (if (javaimp--parse-is-class (car tmp))
-(if in-local
-(setf (javaimp-scope-type (car tmp)) 'local-class))
+(when in-local
+  (setf (javaimp-scope-type (car tmp)) 'local-class))
   (setq in-local t))
 (setq tmp (cdr tmp
 res))
 
+(defun javaimp--parse-all-scopes ()
+  "Parses all scopes in a buffer."
+  (goto-char (point-max))
+  (let ((parse-sexp-ignore-comments t)  ; FIXME remove with major mode
+(parse-sexp-lookup-properties nil))
+(while (javaimp--parse-rsb-keyword "{" nil t)
+  (save-excursion
+(forward-char)
+;; Set props at this brace and all the way up
+(javaimp--parse-scopes nil)
+
 
 
 ;; Main
@@ -422,18 +439,38 @@ nil then goes all the way up."
 
 (defun javaimp--parse-get-file-classes ()
   (goto-char (point-max))
-  (let (res)
-(while (javaimp--parse-rsb-keyword
-(regexp-opt javaimp--parse-class-keywords 'words) nil t)
-  (save-excursion
-(let ((parse-sexp-ignore-comments t) ; FIXME remove with major mode
-  (parse-sexp-lookup-properties nil))
-  (when (and (ignore-errors
-   (goto-char (scan-lists (point) 1 -1)))
- (= (char-before) ?{))
-(let ((scopes (javaimp--parse-scopes nil)))
-  (when (seq-every-p #'javaimp--parse-is-class scopes)
-(push (mapconcat #'javaimp-scope-name scopes ".") res)

[elpa] scratch/javaimp-wip dcc6bed 7/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit dcc6bedf64189f7c4597f8382fea1abd84da8720
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el | 128 ++
 javaimp-tests.el | 230 +--
 javaimp-util.el  |  22 ++--
 javaimp.el   |  60 --
 testdata/test1-misc-classes.java |   9 +-
 5 files changed, 254 insertions(+), 195 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index 061b18d..76da646 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -54,18 +54,12 @@ present."
 "static";static initializer block
 ))
 
-(defsubst javaimp--parse-is-classlike (scope)
-  (and scope
-   (member (symbol-name (javaimp-scope-type scope))
-   javaimp--parse-classlike-keywords)))
-
-(defsubst javaimp--parse-is-named (scope)
-  (and scope
-   (memq (javaimp-scope-type scope)
- javaimp--parse-named-scope-types)))
+(defvar javaimp-syntax-table
+  (make-syntax-table java-mode-syntax-table) ;TODO don't depend
+  "Javaimp syntax table")
 
 (defvar javaimp--arglist-syntax-table
-  (let ((st (make-syntax-table java-mode-syntax-table))) ;TODO don't depend
+  (let ((st (make-syntax-table javaimp-syntax-table)))
 (modify-syntax-entry ?< "(>" st)
 (modify-syntax-entry ?> ")<" st)
 (modify-syntax-entry ?. "_" st) ; separates parts of fully-qualified type
@@ -77,13 +71,16 @@ present."
 considered as stale.  Usually set by modification change hooks.
 Should be set to (point-min) in major mode hook.")
 
-(defmacro javaimp--parse-with-arglist-syntax (beg &rest body)
-  (declare (debug t))
+
+
+(defmacro javaimp--parse-with-syntax-table (syntax-table beg &rest body)
+  (declare (debug t)
+   (indent 2))
   (let ((begin (make-symbol "begin")))
 `(let ((,begin ,beg))
(syntax-ppss-flush-cache ,begin)
(unwind-protect
-   (with-syntax-table javaimp--arglist-syntax-table
+   (with-syntax-table ,syntax-table
  ,@body)
  (syntax-ppss-flush-cache ,begin)
 
@@ -93,6 +90,38 @@ Should be set to (point-min) in major mode hook.")
 (string-trim (substring str 0 end))
   str)))
 
+(defsubst javaimp--parse-is-classlike (scope)
+  (and scope
+   (member (symbol-name (javaimp-scope-type scope))
+   javaimp--parse-classlike-keywords)))
+
+(defsubst javaimp--parse-is-named (scope)
+  (and scope
+   (memq (javaimp-scope-type scope)
+ javaimp--parse-named-scope-types)))
+
+(defsubst javaimp--parse-is-imenu-included-method (scope)
+  (and (eq (javaimp-scope-type scope) 'method)
+   (javaimp--parse-is-classlike (javaimp-scope-parent scope
+
+(defun javaimp--parse-copy-scope (scope)
+  "Recursively copies SCOPE and its parents."
+  (let* ((res (copy-javaimp-scope scope))
+ (tmp res)
+ orig-parent)
+(while (setq orig-parent (javaimp-scope-parent tmp))
+  (setf (javaimp-scope-parent tmp) (copy-javaimp-scope orig-parent))
+  (setq tmp (javaimp-scope-parent tmp)))
+res))
+
+(defun javaimp--parse-concat-parent-names (scope)
+  (let (parents)
+(while (setq scope (javaimp-scope-parent scope))
+  (push scope parents))
+(mapconcat #'javaimp-scope-name parents ".")))
+
+
+
 (defun javaimp--parse-rsb-keyword (regexp &optional bound noerror count)
   "Like `re-search-backward', but count only occurences outside
 syntactic context as given by `syntax-ppss-context'.  Assumes
@@ -110,7 +139,7 @@ point is outside of any context initially."
   "Parse arg list between BEG and END, of the form 'TYPE NAME,
 ...'.  Return list of conses (TYPE . NAME).  If ONLY-TYPE is
 non-nil, then name parsing is skipped."
-  (javaimp--parse-with-arglist-syntax beg
+  (javaimp--parse-with-syntax-table javaimp--arglist-syntax-table beg
 (save-excursion
   (save-restriction
 (narrow-to-region beg end)
@@ -227,7 +256,7 @@ is unchanged."
 (catch 'found
   (while (javaimp--parse-rsb-keyword regexp bound t)
 (let ((scan-pos (match-end 0)))
-  (javaimp--parse-with-arglist-syntax scan-pos
+  (javaimp--parse-with-syntax-table javaimp--arglist-syntax-table 
scan-pos
 (while (and scan-pos (<= scan-pos (nth 1 state)))
   (if (ignore-errors
 (= (scan-lists scan-pos 1 -1) ;As in 
javaimp--parse-preceding
@@ -419,7 +448,7 @@ nil then goes all the way up.  Examines and sets property
   (setq scope (run-hook-with-args-until-success
'javaimp--parse-scope-hook state))
   (put-text-property (point) (1+ (point))
- 'javaimp--parse-scope scope))
+ 'javaimp-parse-scope scope))
 (push scope res)
 (if (javaimp-scope-start scope)
 (goto-char (javaimp-scope-start scope)
@@ -439,20 +468,23 @@ 

[elpa] scratch/javaimp-wip 551b1a3 2/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit 551b1a3a270612b06fec2db36026b1acebfe078d
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-gradle.el |  10 -
 javaimp-maven.el  |  11 +-
 javaimp-parse.el  |  89 +-
 javaimp-util.el   |  59 ++--
 javaimp.el| 115 +-
 5 files changed, 199 insertions(+), 85 deletions(-)

diff --git a/javaimp-gradle.el b/javaimp-gradle.el
index 85e3f2e..e99aab7 100644
--- a/javaimp-gradle.el
+++ b/javaimp-gradle.el
@@ -48,7 +48,15 @@ information."
 (javaimp--gradle-module-from-alist alist file))
   alists)))
 ;; first module is always root
-(javaimp--build-tree (car modules) nil modules)))
+(message "Building tree for root: %s"
+ (javaimp-print-id (javaimp-module-id (car modules
+(javaimp--build-tree (car modules) modules
+;; more or less reliable way to find children
+;; is to look for modules with "this" as the
+;; parent
+ (lambda (el tested)
+   (equal (javaimp-module-parent-id tested)
+  (javaimp-module-id el))
 
 (defun javaimp--gradle-handler ()
   (goto-char (point-min))
diff --git a/javaimp-maven.el b/javaimp-maven.el
index eee886f..e2c2118 100644
--- a/javaimp-maven.el
+++ b/javaimp-maven.el
@@ -87,7 +87,16 @@ resulting module trees."
  modules)))
(cdr modules)
   (mapcar (lambda (root)
-(javaimp--build-tree root nil modules))
+(message "Building tree for root: %s"
+ (javaimp-print-id (javaimp-module-id root)))
+(javaimp--build-tree
+  root modules
+ ;; more or less reliable way to find
+ ;; children is to look for modules with
+ ;; "this" as the parent
+  (lambda (el tested)
+(equal (javaimp-module-parent-id tested)
+   (javaimp-module-id el)
   roots
 
 (defun javaimp--maven-effective-pom-handler ()
diff --git a/javaimp-parse.el b/javaimp-parse.el
index db58e0e..ca8a77c 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -37,17 +37,19 @@ present."
; method, statement, simple-statement, array, unknown
   name
   start
-  open-brace)
+  open-brace
+  parent)
 
-(defconst javaimp--parse-class-keywords
+(defconst javaimp--parse-classlike-keywords
   '("class" "interface" "enum"))
 (defconst javaimp--parse-stmt-keywords
   '("if" "for" "while" "switch" "try" "catch" "finally"
 "static";static initializer block
 ))
 
-(defsubst javaimp--parse-is-class (scope)
-  (member (symbol-name (javaimp-scope-type scope)) 
javaimp--parse-class-keywords))
+(defsubst javaimp--parse-is-classlike (scope)
+  (member (symbol-name (javaimp-scope-type scope))
+  javaimp--parse-classlike-keywords))
 
 (defvar javaimp--arglist-syntax-table
   (let ((st (make-syntax-table java-mode-syntax-table))) ;TODO don't depend
@@ -265,7 +267,7 @@ is unchanged."
   "Attempts to parse 'class' / 'interface' / 'enum' scope.  Some of
 those may later become 'local-class' (see `javaimp--parse-scopes')."
   (save-excursion
-(if (javaimp--parse-preceding (regexp-opt javaimp--parse-class-keywords 
'words)
+(if (javaimp--parse-preceding (regexp-opt 
javaimp--parse-classlike-keywords 'words)
   (nth 1 state))
 (let* ((keyword-start (match-beginning 1))
(keyword-end (match-end 1))
@@ -394,7 +396,7 @@ nil then goes all the way up.  Examines and sets property
 ;; find innermost enclosing open-bracket
 (goto-char (nth 1 state))
 (when (= (char-after) ?{)
-  (let ((scope (get-text-property 'javaimp-parse-scope)))
+  (let ((scope (get-text-property (point) 'javaimp-parse-scope)))
 (unless scope
   (setq scope (run-hook-with-args-until-success
'javaimp--parse-scope-hook state))
@@ -407,15 +409,27 @@ nil then goes all the way up.  Examines and sets property
 ;; if a class is enclosed in anything other than a class, then it
 ;; should be local
 (let ((tmp res)
-  in-local)
+  in-local parent)
   (while tmp
-(if (javaimp--parse-is-class (car tmp))
+(if (javaimp--parse-is-classlike (car tmp))
 (when in-local
   (setf (javaimp-scope-type (car tmp)) 'local-class))
   (setq in-local t))
+(setf (javaimp-scope-parent (car tmp)) parent)
+(setq parent (car tmp))
 (setq tmp (cdr tmp
 

[elpa] scratch/javaimp-wip a5c00a7 3/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit a5c00a78f0ca60e73b869775e72ade87ff204996
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/javaimp.el b/javaimp.el
index 3efdae4..5b887fb 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -576,7 +576,10 @@ is `ordinary' or `static'.  Interactively, NEW-IMPORTS is 
nil."
 
 ;;;###autoload
 (defun javaimp-imenu-create-index ()
-  (let ((forest (javaimp--parse-get-forest-for-imenu)))
+  (let ((forest (save-excursion
+  (javaimp--parse-clean-all-scopes)
+  (javaimp--parse-all-scopes)
+  (javaimp--parse-get-forest-for-imenu
 (cond ((not javaimp-imenu-group-methods)
;; just plain list of methods
(javaimp--collect-nodes



[elpa] scratch/javaimp-wip fe080eb 5/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit fe080eba615ed90586a03f5e5c0b2515ddaab729
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el  | 120 ---
 javaimp-tests.el  | 272 ++
 javaimp.el|   3 +-
 testdata/test-get-file-classes-1.java |  60 
 testdata/test1-misc-classes.java  | 117 +++
 5 files changed, 331 insertions(+), 241 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index 55c89f2..1a46b65 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -33,13 +33,20 @@ present."
   :type 'function)
 
 (cl-defstruct javaimp-scope
-  type ; one of anonymous-class, class, interface, enum, local-class,
-   ; method, statement, simple-statement, array, unknown
+  type; see javaimp--parse-all-scope-types
   name
   start
   open-brace
   parent)
 
+(defconst javaimp--parse-named-scope-types
+  '(class interface enum local-class method))
+
+(defconst javaimp--parse-all-scope-types
+  (append
+   '(anonymous-class statement simple-statement array unknown)
+   javaimp--parse-named-scope-types))
+
 (defconst javaimp--parse-classlike-keywords
   '("class" "interface" "enum"))
 (defconst javaimp--parse-stmt-keywords
@@ -48,8 +55,9 @@ present."
 ))
 
 (defsubst javaimp--parse-is-classlike (scope)
-  (member (symbol-name (javaimp-scope-type scope))
-  javaimp--parse-classlike-keywords))
+  (when scope
+(member (symbol-name (javaimp-scope-type scope))
+javaimp--parse-classlike-keywords)))
 
 (defvar javaimp--arglist-syntax-table
   (let ((st (make-syntax-table java-mode-syntax-table))) ;TODO don't depend
@@ -61,7 +69,8 @@ present."
 
 (defvar-local javaimp--parse-dirty-pos nil
   "Buffer position after which all parsed information should be
-considered as stale.  Usually set by modification change hooks.")
+considered as stale.  Usually set by modification change hooks.
+Should be set to (point-min) in major mode hook.")
 
 (defmacro javaimp--parse-with-arglist-syntax (beg &rest body)
   (declare (debug t))
@@ -425,20 +434,21 @@ nil then goes all the way up.  Examines and sets property
 res))
 
 (defun javaimp--parse-all-scopes ()
-  "Parses all scopes in this buffer, but only after
-`javaimp--parse-dirty-pos' if it is non-nil."
+  "Parses scopes in this buffer which are after
+`javaimp--parse-dirty-pos', if it is non-nil.  Resets this
+variable after parsing is done."
   (when javaimp--parse-dirty-pos
 (remove-text-properties javaimp--parse-dirty-pos (point-max)
-  '(javaimp-parse-scope nil)))
-  (goto-char (point-max))
-  (let ((parse-sexp-ignore-comments t)  ; FIXME remove with major mode
-(parse-sexp-lookup-properties nil))
-(while (javaimp--parse-rsb-keyword "{" javaimp--parse-dirty-pos t)
-  (save-excursion
-(forward-char)
-;; Set props at this brace and all the way up
-(javaimp--parse-scopes nil
-  (setq javaimp--parse-dirty-pos nil))
+'(javaimp-parse-scope nil))
+(goto-char (point-max))
+(let ((parse-sexp-ignore-comments t)  ; FIXME remove with major mode
+  (parse-sexp-lookup-properties nil))
+  (while (javaimp--parse-rsb-keyword "{" javaimp--parse-dirty-pos t)
+(save-excursion
+  (forward-char)
+  ;; Set props at this brace and all the way up
+  (javaimp--parse-scopes nil
+(setq javaimp--parse-dirty-pos nil)))
 
 
 
@@ -450,19 +460,41 @@ nil then goes all the way up.  Examines and sets property
  "^\\s-*package\\s-+\\([^;\n]+\\)\\s-*;" nil t 1)
 (match-string 1)))
 
-(defun javaimp--parse-get-file-classes ()
-  (javaimp--parse-all-scopes)
-  (goto-char (point-max))
-  (let (match res)
-(while (setq match (text-property-search-backward
-'javaimp-parse-scope nil nil))
-  (when (javaimp--parse-is-classlike (prop-match-value match))
-(push (mapconcat #'javaimp-scope-name
- (javaimp--parse-scopes nil)
- ".")
-  res)
+(defun javaimp--parse-get-all-classlikes (&optional reparse)
+  (mapcar (lambda (scope)
+(let ((name (javaimp-scope-name scope))
+  (tmp scope))
+  (while (setq tmp (javaimp-scope-parent tmp))
+(setq name (concat (javaimp-scope-name tmp) "." name)))
+  name))
+  (javaimp--parse-get-all-scopes reparse 
#'javaimp--parse-is-classlike)))
+
+(defun javaimp--parse-get-forest-for-imenu (&optional reparse)
+  (let* ((methods
+  (javaimp--parse-get-all-scopes
+   reparse
+   (lambda (s)
+ (and (eq (javaimp-scope-type s) 'method)
+  (javaimp--parse-is-classlike (javaimp-scope-parent s))
+ (classes (javaimp--parse-get-all-scopes
+   nil  ;no need to

[elpa] scratch/javaimp-wip aa0f932 4/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit aa0f9324cddc5cb13f9f4239b52cf6182e13a7c1
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el | 51 +--
 javaimp-util.el  |  7 ---
 javaimp.el   | 21 ++---
 3 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index ca8a77c..55c89f2 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -59,6 +59,10 @@ present."
 st)
   "Enables parsing angle brackets as lists")
 
+(defvar-local javaimp--parse-dirty-pos nil
+  "Buffer position after which all parsed information should be
+considered as stale.  Usually set by modification change hooks.")
+
 (defmacro javaimp--parse-with-arglist-syntax (beg &rest body)
   (declare (debug t))
   (let ((begin (make-symbol "begin")))
@@ -420,33 +424,34 @@ nil then goes all the way up.  Examines and sets property
 (setq tmp (cdr tmp
 res))
 
-
-;; Main
-
-(defun javaimp--parse-get-package ()
-  (goto-char (point-max))
-  (when (javaimp--parse-rsb-keyword
- "^\\s-*package\\s-+\\([^;\n]+\\)\\s-*;" nil t 1)
-(match-string 1)))
-
-
 (defun javaimp--parse-all-scopes ()
-  "Parses all scopes in a buffer."
+  "Parses all scopes in this buffer, but only after
+`javaimp--parse-dirty-pos' if it is non-nil."
+  (when javaimp--parse-dirty-pos
+(remove-text-properties javaimp--parse-dirty-pos (point-max)
+  '(javaimp-parse-scope nil)))
   (goto-char (point-max))
   (let ((parse-sexp-ignore-comments t)  ; FIXME remove with major mode
 (parse-sexp-lookup-properties nil))
-(while (javaimp--parse-rsb-keyword "{" nil t)
+(while (javaimp--parse-rsb-keyword "{" javaimp--parse-dirty-pos t)
   (save-excursion
 (forward-char)
 ;; Set props at this brace and all the way up
-(javaimp--parse-scopes nil)
+(javaimp--parse-scopes nil
+  (setq javaimp--parse-dirty-pos nil))
 
-(defun javaimp--parse-clean-all-scopes ()
-  (remove-text-properties (point-min) (point-max)
-  '(javaimp-parse-scope nil)))
 
+
+;; Functions intended to be called from other parts of javaimp.
+
+(defun javaimp--parse-get-package ()
+  (goto-char (point-max))
+  (when (javaimp--parse-rsb-keyword
+ "^\\s-*package\\s-+\\([^;\n]+\\)\\s-*;" nil t 1)
+(match-string 1)))
 
 (defun javaimp--parse-get-file-classes ()
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
   (let (match res)
 (while (setq match (text-property-search-backward
@@ -457,15 +462,19 @@ nil then goes all the way up.  Examines and sets property
  ".")
   res)
 
-(defun javaimp--parse-get-all-scopes()
+(defun javaimp--parse-get-all-scopes (&optional reparse)
+  (when reparse
+(setq javaimp--parse-dirty-pos (point-min)))
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
-  (let (res)
+  (let (match res)
 (while (setq match (text-property-search-backward
 'javaimp-parse-scope nil nil))
   (push (prop-match-value match) res))
 res))
 
 (defun javaimp--parse-get-forest-for-imenu ()
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
   (let (match methods classes top-classes)
 (while (setq match (text-property-search-backward
@@ -490,4 +499,10 @@ nil then goes all the way up.  Examines and sets property
   (equal el (javaimp-scope-parent tested)
  top-classes)))
 
+(defun javaimp--parse-update-dirty-pos (beg _end _old-len)
+  "Function to add to `after-change-functions' hook."
+  (when (or (not javaimp--parse-dirty-pos)
+(< beg javaimp--parse-dirty-pos))
+(setq javaimp--parse-dirty-pos beg)))
+
 (provide 'javaimp-parse)
diff --git a/javaimp-util.el b/javaimp-util.el
index 5e63c01..f2b4dda 100644
--- a/javaimp-util.el
+++ b/javaimp-util.el
@@ -187,7 +187,8 @@ PARENT-NODE is indented for recursive calls."
   tree)))
(apply #'seq-concatenate 'list
   (mapcar (lambda (child)
-(javaimp--collect-nodes-from-tree child predicate))
+(javaimp--collect-nodes-from-tree
+  child predicate unwrap))
   (javaimp-node-children tree))
 
 (defun javaimp--map-nodes (mapper forest &optional unwrap)
@@ -203,9 +204,9 @@ PARENT-NODE is indented for recursive calls."
   (make-javaimp-node
   :parent (javaimp-node-parent tree)
   :children (javaimp-node-children tree)
-  :contents mapped)))
+  :contents contents)))
   (mapcar (lambda (child)
-(javaimp--map-nodes-from-tree child mapper))
+(javaimp--map-nodes-from-tree child mapper unwrap))
   (javaimp-node-children tree)
 
 (defun javaimp--get-root (node)
diff --git a/javaimp.el b/j

[elpa] scratch/javaimp-wip 4ac5cb4 6/7: wip

2021-08-04 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit 4ac5cb48db9fa6d57b937d33a336dcda8cc8c3a1
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el |  13 ++-
 javaimp-tests.el | 177 +++
 javaimp-util.el  |  60 ++---
 javaimp.el   |  65 --
 testdata/test1-misc-classes.java |   5 ++
 5 files changed, 246 insertions(+), 74 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index 1a46b65..061b18d 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -55,9 +55,14 @@ present."
 ))
 
 (defsubst javaimp--parse-is-classlike (scope)
-  (when scope
-(member (symbol-name (javaimp-scope-type scope))
-javaimp--parse-classlike-keywords)))
+  (and scope
+   (member (symbol-name (javaimp-scope-type scope))
+   javaimp--parse-classlike-keywords)))
+
+(defsubst javaimp--parse-is-named (scope)
+  (and scope
+   (memq (javaimp-scope-type scope)
+ javaimp--parse-named-scope-types)))
 
 (defvar javaimp--arglist-syntax-table
   (let ((st (make-syntax-table java-mode-syntax-table))) ;TODO don't depend
@@ -477,7 +482,7 @@ variable after parsing is done."
  (and (eq (javaimp-scope-type s) 'method)
   (javaimp--parse-is-classlike (javaimp-scope-parent s))
  (classes (javaimp--parse-get-all-scopes
-   nil  ;no need to reparse
+   nil  ; no need to reparse
#'javaimp--parse-is-classlike))
  (top-classes (mapcar (lambda (s)
 (null (javaimp-scope-parent s)))
diff --git a/javaimp-tests.el b/javaimp-tests.el
index 7bb63b5..b4788e2 100644
--- a/javaimp-tests.el
+++ b/javaimp-tests.el
@@ -189,34 +189,179 @@ throws E1 {"
  "Top.IInner1.IInner1_CInner1"
  "Top.IInner1.IInner1_IInner1"
  "Top.EInner1"
- "Top.EInner1.EInner1_EInner1")
-
-(ert-deftest javaimp-test--parse-get-forest-for-imenu ()
-  ;; TODO
-  )
-
+ "Top.EInner1.EInner1_EInner1"
+ "ColocatedTop")
 
 (ert-deftest javaimp-test--parse-get-all-scopes ()
   (with-temp-buffer
 (insert-file-contents
  (concat javaimp--basedir "testdata/test1-misc-classes.java"))
+;;
 ;; parse full buffer
-(javaimp-test--check-scopes (javaimp--parse-get-all-scopes t))
-;; reparse half buffer
+(javaimp-test--check-named-scopes
+ (javaimp--parse-get-all-scopes t #'javaimp--parse-is-named))
+;;
+;; reparse half of buffer
 (setq javaimp--parse-dirty-pos (/ (- (point-max) (point-min)) 2))
-(javaimp-test--check-scopes (javaimp--parse-get-all-scopes))
+(javaimp-test--check-named-scopes
+ (javaimp--parse-get-all-scopes nil #'javaimp--parse-is-named))
+;;
 ;; use cache
-(javaimp-test--check-scopes (javaimp--parse-get-all-scopes
+(javaimp-test--check-named-scopes
+ (javaimp--parse-get-all-scopes nil #'javaimp--parse-is-named
+
+(defun javaimp-test--check-named-scopes (scopes)
+  (let ((actual
+ (mapcar (lambda (s)
+   (let (res)
+ (while s
+   (push (list (javaimp-scope-type s)
+   (javaimp-scope-name s))
+ res)
+   (setq s (javaimp-scope-parent s)))
+ (nreverse res)))
+ scopes))
+(expected
+ '(((class "Top"))
+   ((class "CInner1") (class "Top"))
+   ((method "foo") (class "CInner1") (class "Top"))
+   ((local-class "CInner1_CLocal1")
+(method "foo") (class "CInner1") (class "Top"))
+   ((method "foo")
+(local-class "CInner1_CLocal1")
+(method "foo") (class "CInner1") (class "Top"))
+   ((local-class "CInner1_CLocal1_CLocal1")
+(method "foo")
+(local-class "CInner1_CLocal1")
+(method "foo") (class "CInner1") (class "Top"))
+   ((method "foo")
+(local-class "CInner1_CLocal1_CLocal1")
+(method "foo")
+(local-class "CInner1_CLocal1")
+(method "foo") (class "CInner1") (class "Top"))
+
+   ((local-class "CInner1_CLocal2")
+(method "foo") (class "CInner1") (class "Top"))
+   ((method "foo")
+(local-class "CInner1_CLocal2")
+(method "foo") (class "CInner1") (class "Top"))
+
+   ((class "CInner1_CInner") (class "CInner1") (class "Top"))
+   ((method "foo")
+(class "CInner1_CInner") (class "CInner1") (class "Top"))
+   ((method "bar")
+(class "CInner1_CInner") (class "CInner1") (class "Top"))
+
+   ((interface "IInner1") (class "Top"))
+   ((method "foo") (interface "IInner1") (class "Top"))
+