[elpa] externals/pyim 4b7f617: 优化 shortcode 和 ishortcode 的处理过程。

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 4b7f6172e21af707b7caeaaa6139dc1379ada04a
Author: Feng Shu 
Commit: Feng Shu 

优化 shortcode 和 ishortcode 的处理过程。

* pyim-dhashcache.el (pyim-dhashcache-get-shortcode): do not call 
pyim-dcache-code-split.
(pyim-dhashcache-update-icode2word): call 
pyim-dhashcache-update-ishortcode2word.
(pyim-dhashcache-update-personal-words): Do not call 
pyim-dhashcache-update-ishortcode2word.
(pyim-dhashcache-update-code2word): Call 
pyim-dhashcache-update-shortcode2word.

* tests/pyim-tests.el (pyim-tests-pyim-dhashcache-get-shortcode): 
Updated.

* pyim-dcache.el (pyim-dcache-update): do not call 
pyim-dcache-update-code2word.
(pyim-dcache-code-split): removed.
---
 pyim-dcache.el  | 23 +--
 pyim-dhashcache.el  | 15 ---
 tests/pyim-tests.el |  6 ++
 3 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 324fbf1..06c4a34 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -207,9 +207,7 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
 如果 FORCE 为真,强制加载。"
   (pyim-dcache-init-variables)
   (pyim-dcache-update-personal-words force)
-  (pyim-dcache-update-code2word force)
-  ;; 这个命令 *当前* 主要用于五笔输入法。
-  (pyim-dcache-update-shortcode2word force))
+  (pyim-dcache-update-code2word force))
 
 (defun pyim-dcache-update-code2word (&optional force)
   "读取并加载词库.
@@ -291,25 +289,6 @@ code 对应的中文词条了."
   `(,@(pyim-dcache-call-api 'get code from)
 ,@(pyim-pymap-py2cchar-get code t t)))
 
-;; ** 分割 code
-(defun pyim-dcache-code-split (code)
-  "将 CODE 分成 code-prefix 和 rest code."
-  (cond
-   ;; 处理 nil
-   ((not code) nil)
-   ;; 兼容性代码:旧版本的 pyim 使用一个标点符号作为 code-prefix
-   ((pyim-string-match-p "^[[:punct:]]" code)
-(list (substring code 0 1) (substring code 1)))
-   ;; 拼音输入法不使用 code-prefix, 并且包含 -
-   ((pyim-string-match-p "-" code)
-(list "" code))
-   ((not (pyim-string-match-p "[[:punct:]]" code))
-(list "" code))
-   ;; 新 code-prefix 使用类似 "wubi/" 的格式。
-   (t (let ((x (split-string code "/")))
-(list (concat (nth 0 x) "/")
-  (nth 1 x))
-
 ;; * Footer
 (provide 'pyim-dcache)
 
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 9f64161..c81155e 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -66,10 +66,10 @@
   "获取一个 CODE 的所有简写.
 
 比如:.nihao -> .nihao .niha .nih .ni .n"
-  (when (and (> (length code) 0)
- (not (string-match-p "-" code)))
-(let* ((x (pyim-dcache-code-split code))
-   (prefix (nth 0 x))
+  (when (and (pyim-string-match-p "/" code)
+ (not (pyim-string-match-p "-" code)))
+(let* ((x (split-string code "/"))
+   (prefix (concat (nth 0 x) "/"))
(code1 (nth 1 x))
(n (length code1))
results)
@@ -256,6 +256,7 @@ DCACHE 是一个 code -> words 的 hashtable.
(lambda (_)
  (pyim-dcache-set-variable 'pyim-dhashcache-code2word t)
  (pyim-dcache-set-variable 'pyim-dhashcache-word2code t)
+ (pyim-dhashcache-update-shortcode2word force)
  (setq pyim-dhashcache-update-code2word-running-p nil))
 
 (defun pyim-dhashcache-export (dcache file &optional confirm)
@@ -328,7 +329,8 @@ code 对应的中文词条了。
 (pyim-dcache-save-variable 'pyim-dhashcache-icode2word)
 nil)
  (lambda (_)
-   (pyim-dcache-set-variable 'pyim-dhashcache-icode2word t)
+   (pyim-dcache-set-variable 'pyim-dhashcache-icode2word t)
+   (pyim-dhashcache-update-ishortcode2word force)
 
 (defun pyim-dhashcache-upgrade-icode2word ()
   "升级 icode2word 缓存。"
@@ -361,8 +363,7 @@ code 对应的中文词条了。
pyim-dhashcache-icode2word))
 
 (defun pyim-dhashcache-update-personal-words (&optional force)
-  (pyim-dhashcache-update-icode2word force)
-  (pyim-dhashcache-update-ishortcode2word force))
+  (pyim-dhashcache-update-icode2word force))
 
 (defun pyim-dhashcache-init-variables ()
   "初始化 dcache 缓存相关变量."
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index a8cf903..c75fb31 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -598,12 +598,10 @@
 
 ;; ** pyim-dhashcache 相关单元测试
 (ert-deftest pyim-tests-pyim-dhashcache-get-shortcode ()
-  (should (equal (pyim-dhashcache-get-shortcode ".abcde")
- '(".abcd" ".abc" ".ab")))
+  (should (equal (pyim-dhashcache-get-shortcode ".abcde") nil))
   (should (equal (pyim-dhashcache-get-shortcode "wubi/abcde")
  '("wubi/abcd" "wubi/abc" "wubi/ab")))
-  (should (equal (pyim-dhashcache-get-shortcode "abcde")
- '("abcd" "abc" "ab")))
+  (should (equal (pyim-dhashcache-get-shortcode "abcde") nil))
   (should (equal (pyim-dhashcache-get-shortcode "ni-hao") nil))
   (should (equal (pyim-dhashcache-get-shortcode "") nil)))
 



[elpa] externals/pyim 69c0f0e: * tests/pyim-tests.el (pyim-tests-pyim-import-words-and-counts): Try to fix this test.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 69c0f0ee062215c34b47de4f306649bc50ad79f5
Author: Feng Shu 
Commit: Feng Shu 

* tests/pyim-tests.el (pyim-tests-pyim-import-words-and-counts): Try to fix 
this test.
---
 tests/pyim-tests.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index c75fb31..f0cf90a 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -566,9 +566,9 @@
 
 ;; ** pyim-import 相关单元测试
 (ert-deftest pyim-tests-pyim-import-words-and-counts ()
-  ;; 这个测试目前主要用于手工测试,在 github 上这个测试无法通过的。
-  :expected-result :failed
-  (let ((file (make-temp-file "pyim-tests-import")))
+  (let ((pyim-dcache-directory
+ (file-name-as-directory (make-temp-name "pyim-dcache-")))
+(file (make-temp-file "pyim-tests-import")))
 ;; 删除测试用词条
 (dolist (x '("测㤅" "测嘊" "测伌"))
   (pyim-process-delete-word x))



[elpa] externals/rec-mode 2a7735d: Add autoload token to define-derived-mode rec-mode

2021-12-13 Thread ELPA Syncer
branch: externals/rec-mode
commit 2a7735d490b35197174d789855ef2da1de84e974
Author: Jose E. Marchesi 
Commit: Jose E. Marchesi 

Add autoload token to define-derived-mode rec-mode
---
 rec-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rec-mode.el b/rec-mode.el
index 86f284a..657f02f 100644
--- a/rec-mode.el
+++ b/rec-mode.el
@@ -2998,6 +2998,7 @@ onto the chosen record."
 ["---"nil:visible (derived-mode-p 
'rec-edit-mode)]
 ["Finish editing" rec-finish-editing :visible (derived-mode-p 
'rec-edit-mode)]))
 
+;;;###autoload
 (define-derived-mode rec-mode nil "Rec"
   "A major mode for editing rec files.
 \\{rec-mode-map}"



[elpa] externals/pyim updated (69c0f0e -> 051e463)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  69c0f0e   * tests/pyim-tests.el 
(pyim-tests-pyim-import-words-and-counts): Try to fix this test.
   new  ba3f7e5   Add pyim-kill-emacs-hook-function
   new  051e463   * tests/pyim-tests.el 
(pyim-tests-pyim-import-words-and-counts):  :expected-result :failed again.


Summary of changes:
 pyim.el | 11 +++
 tests/pyim-tests.el |  5 -
 2 files changed, 11 insertions(+), 5 deletions(-)



[elpa] externals/pyim ba3f7e5 1/2: Add pyim-kill-emacs-hook-function

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit ba3f7e5f94713239249564a19494f4cd3023f813
Author: Feng Shu 
Commit: Feng Shu 

Add pyim-kill-emacs-hook-function

* tests/pyim-tests.el (pyim-kill-emacs-hook-function): alias to 'ignore.

* pyim.el (pyim-kill-emacs-hook-function): New function.
(pyim-activate): Use pyim-kill-emacs-hook-function.
---
 pyim.el | 11 +++
 tests/pyim-tests.el |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pyim.el b/pyim.el
index d92d5ef..c972a6a 100644
--- a/pyim.el
+++ b/pyim.el
@@ -233,7 +233,7 @@ pyim 是使用 `pyim-activate' 来启动输入法,这个命令主要做如下
 2. 创建汉字到拼音和拼音到汉字的 hash table。
 3. 创建词库缓存 dcache.
 4. 运行 hook: `pyim-load-hook'。
-5. 将 `pyim-dcache-save-caches' 命令添加到 `kill-emacs-hook' , emacs 关闭
+5. 将 `pyim-kill-emacs-hook-function' 命令添加到 `kill-emacs-hook' , emacs 关闭
 之前将用户选择过的词生成的缓存和词频缓存保存到文件,供以后使用。
 6. 设定变量:
1. `input-method-function'
@@ -259,9 +259,8 @@ pyim 使用函数 `pyim-activate' 启动输入法的时候,会将变量
 
   (run-hooks 'pyim-load-hook)
   ;; Make sure personal or other dcache are saved to file before kill emacs.
-  (add-hook 'kill-emacs-hook
-(lambda ()
-  (pyim-process-save-dcaches t)))
+  (add-hook 'kill-emacs-hook #'pyim-kill-emacs-hook-function)
+
   (setq deactivate-current-input-method-function #'pyim-deactivate)
   ;; If we are in minibuffer, turn off the current input method
   ;; before exiting.
@@ -271,6 +270,10 @@ pyim 使用函数 `pyim-activate' 启动输入法的时候,会将变量
   (setq-local input-method-function #'pyim-input-method)
   nil)
 
+(defun pyim-kill-emacs-hook-function ()
+  "Pyim function which is used in `kill-emacs-hook'."
+  (pyim-process-save-dcaches t))
+
 ;; ** 取消激活功能
 (define-obsolete-function-alias 'pyim-inactivate 'pyim-deactivate "4.0.0")
 (defun pyim-deactivate ()
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index f0cf90a..8697b5f 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -48,6 +48,8 @@
 (pyim-tests-add-dict "pyim-basedict.pyim")
 (pyim-dcache-init-variables)
 
+(defalias 'pyim-kill-emacs-hook-function #'ignore)
+
 ;; ** pyim-schemes 相关单元测试
 (ert-deftest pyim-tests-pyim-schemes ()
   (let ((pyim-default-scheme 'wubi))



[elpa] externals/pyim 051e463 2/2: * tests/pyim-tests.el (pyim-tests-pyim-import-words-and-counts): :expected-result :failed again.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 051e46329025b1dc002a69c6cb7432b5ec2b746f
Author: Feng Shu 
Commit: Feng Shu 

* tests/pyim-tests.el (pyim-tests-pyim-import-words-and-counts):  
:expected-result :failed again.
---
 tests/pyim-tests.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 8697b5f..4b4a416 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -568,6 +568,8 @@
 
 ;; ** pyim-import 相关单元测试
 (ert-deftest pyim-tests-pyim-import-words-and-counts ()
+  ;; 这个测试目前主要用于手工测试,在 github 上这个测试无法通过的。
+  :expected-result :failed
   (let ((pyim-dcache-directory
  (file-name-as-directory (make-temp-name "pyim-dcache-")))
 (file (make-temp-file "pyim-tests-import")))
@@ -589,7 +591,6 @@
 测伌")
   (write-file file))
 (pyim-import-words-and-counts file (lambda (orig-count new-count) 
new-count) t)
-(pyim-delete-word)
 
 ;; 测试词条是否存在
 (dolist (x '("测㤅" "测嘊" "测伌"))



[elpa] externals/corfu updated (76339f0 -> 160bd53)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/corfu.

  from  76339f0   Use run-at-time instead of idle timer
   new  c187097   Workaround for bug#50470: Fix misbehaving Capfs
   new  160bd53   corfu--capf-wrapper: Add comment


Summary of changes:
 corfu.el | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)



[elpa] externals/corfu 160bd53 2/2: corfu--capf-wrapper: Add comment

2021-12-13 Thread ELPA Syncer
branch: externals/corfu
commit 160bd53db56f279d87377a8068aab754ec4b5d0c
Author: Daniel Mendler 
Commit: Daniel Mendler 

corfu--capf-wrapper: Add comment
---
 corfu.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/corfu.el b/corfu.el
index 0b5cc91..c27e1c6 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1175,6 +1175,10 @@ Determines if the capf is applicable at the current 
position."
  (pt (- (point) beg))
  (pred (plist-get plist :predicate))
  (md (completion-metadata (substring str 0 pt) table 
pred)))
+;; We use `completion-try-completion' to check if there are
+;; completions. The upstream `completion--capf-wrapper' uses
+;; `try-completion' which is incorrect since it only checks for
+;; prefix completions.
 (completion-try-completion str table pred pt md)))
   (cons fun res)
 



[elpa] externals/corfu c187097 1/2: Workaround for bug#50470: Fix misbehaving Capfs

2021-12-13 Thread ELPA Syncer
branch: externals/corfu
commit c1870977f6a9107cef59c482446fca60991dfd4b
Author: Daniel Mendler 
Commit: Daniel Mendler 

Workaround for bug#50470: Fix misbehaving Capfs

- Ensure that Capfs do not manipulate the buffer
- Redirect illegal calls to completion-in-region
---
 corfu.el | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/corfu.el b/corfu.el
index a36d119..0b5cc91 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1153,7 +1153,19 @@ there hasn't been any input, then quit."
 (defun corfu--capf-wrapper (fun)
   "Wrapper for `completion-at-point' FUN.
 Determines if the capf is applicable at the current position."
-  (pcase (funcall fun)
+  (pcase
+  ;; bug#50470: Fix Capfs which illegally modify the buffer
+  ;; or which illegally call `completion-in-region'
+  (catch 'corfu--illegal-completion-in-region
+(condition-case nil
+(let ((buffer-read-only t)
+  (inhibit-read-only nil)
+  (completion-in-region-function
+   (lambda (beg end coll pred)
+ (throw 'corfu--illegal-completion-in-region
+(list beg end coll :predicate pred)
+  (funcall fun))
+  (buffer-read-only nil)))
 ((and res `(,beg ,end ,table . ,plist))
  (and (integer-or-marker-p beg) ;; Valid capf result
   (<= beg (point) end) ;; Sanity checking



[elpa] externals/rec-mode 058dbe4: set version to 1.8.2

2021-12-13 Thread ELPA Syncer
branch: externals/rec-mode
commit 058dbe420e63bd460c0c8d09dd97ab55bc45533a
Author: Antoine Kalmbach 
Commit: Antoine Kalmbach 

set version to 1.8.2
---
 rec-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rec-mode.el b/rec-mode.el
index 657f02f..95d608b 100644
--- a/rec-mode.el
+++ b/rec-mode.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Antoine Kalmbach 
 ;; URL: https://www.gnu.org/software/recutils/
 ;; Package-Requires: ((emacs "25"))
-;; Version: 1.8.1
+;; Version: 1.8.2
 
 ;; This file is NOT part of GNU Emacs.
 



[elpa] externals/corfu a82a0cc: Properly credit @jakanakaevangeli

2021-12-13 Thread ELPA Syncer
branch: externals/corfu
commit a82a0ccb8da95f6d8cc68655670631912431fa3e
Author: Daniel Mendler 
Commit: Daniel Mendler 

Properly credit @jakanakaevangeli

The patch is from the capf-autosuggest package.
---
 corfu.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/corfu.el b/corfu.el
index c27e1c6..e514b65 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1154,8 +1154,10 @@ there hasn't been any input, then quit."
   "Wrapper for `completion-at-point' FUN.
 Determines if the capf is applicable at the current position."
   (pcase
-  ;; bug#50470: Fix Capfs which illegally modify the buffer
-  ;; or which illegally call `completion-in-region'
+  ;; bug#50470: Fix Capfs which illegally modify the buffer or which
+  ;; illegally call `completion-in-region'. The workaround here has been
+  ;; proposed @jakanakaevangeli in bug#50470 and is used in
+  ;; @jakanakaevangeli's capf-autosuggest package.
   (catch 'corfu--illegal-completion-in-region
 (condition-case nil
 (let ((buffer-read-only t)



[elpa] externals/pyim 02c5004: 简化 pyim-dhashcache-update-ishortcode2word-1 和 pyim-dhashcache-update-shortcode2word-1.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 02c50045cb14ab253d8d8435e83e7f10b0bbc130
Author: Feng Shu 
Commit: Feng Shu 

简化 pyim-dhashcache-update-ishortcode2word-1 和 
pyim-dhashcache-update-shortcode2word-1.

* tests/pyim-tests.el (pyim-tests-pyim-dhashcache-update-shortcode2word)
(pyim-tests-pyim-dhashcache-update-ishortcode2word): Simplify.

* pyim-dhashcache.el (pyim-dhashcache-sort-words): Add iword2count 
argument.
(pyim-dhashcache-update-ishortcode2word): simplify.
(pyim-dhashcache-update-ishortcode2word-1): Add icode2word and 
iword2count argument.
(pyim-dhashcache-update-shortcode2word): simplify.
(pyim-dhashcache-update-shortcode2word-1): Add code2word and 
iword2count argument.
(pyim-dhashcache-update-icode2word): update for 
pyim-dhashcache-sord-words.

* pyim-dcache.el (pyim-dcache-save-variable): Add value argument.
---
 pyim-dcache.el  |   4 +-
 pyim-dhashcache.el  | 125 +++-
 tests/pyim-tests.el |  56 ++-
 3 files changed, 92 insertions(+), 93 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 06c4a34..ef7990f 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -103,11 +103,11 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
 fallback-value
 (make-hash-table :test #'equal))
 
-(defun pyim-dcache-save-variable (variable)
+(defun pyim-dcache-save-variable (variable &optional value)
   "将 VARIABLE 变量的取值保存到 `pyim-dcache-directory' 中对应文件中."
   (let ((file (expand-file-name (symbol-name variable)
 pyim-dcache-directory))
-(value (symbol-value variable)))
+(value (or value (symbol-value variable
 (pyim-dcache-save-value-to-file value file)))
 
 (defun pyim-dcache-save-value-to-file (value file)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index c81155e..b5aa590 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -53,14 +53,16 @@
 (defvar pyim-dhashcache-update-icode2word-p nil)
 (defvar pyim-dhashcache-update-code2word-running-p nil)
 
-(defun pyim-dhashcache-sort-words (words-list)
+(defun pyim-dhashcache-sort-words (words-list &optional iword2count)
   "对 WORDS-LIST 排序,词频大的排在前面.
 
-排序使用 `pyim-dhashcache-iword2count' 中记录的词频信息"
-  (sort words-list
-(lambda (a b)
-  (> (or (gethash a pyim-dhashcache-iword2count) 0)
- (or (gethash b pyim-dhashcache-iword2count) 0)
+如果 IWORD2COUNT 为 nil, 排序将使用 `pyim-dhashcache-iword2count'
+中记录的词频信息"
+  (let ((iword2count (or iword2count pyim-dhashcache-iword2count)))
+(sort words-list
+  (lambda (a b)
+(> (or (gethash a iword2count) 0)
+   (or (gethash b iword2count) 0))
 
 (defun pyim-dhashcache-get-shortcode (code)
   "获取一个 CODE 的所有简写.
@@ -99,34 +101,37 @@
 (require 'pyim-dhashcache)
 (pyim-dcache-set-variable 'pyim-dhashcache-icode2word)
 (pyim-dcache-set-variable 'pyim-dhashcache-iword2count)
-(pyim-dhashcache-update-ishortcode2word-1))
+(pyim-dcache-save-variable
+ 'pyim-dhashcache-ishortcode2word
+ (pyim-dhashcache-update-ishortcode2word-1
+  pyim-dhashcache-icode2word
+  pyim-dhashcache-iword2count)))
  (lambda (_)
(pyim-dcache-set-variable 'pyim-dhashcache-ishortcode2word t)
 
-(defun pyim-dhashcache-update-ishortcode2word-1 ()
+(defun pyim-dhashcache-update-ishortcode2word-1 (icode2word iword2count)
   "`pyim-dhashcache-update-ishortcode2word' 内部函数."
-  (setq pyim-dhashcache-ishortcode2word
-(make-hash-table :test #'equal))
-  (maphash
-   (lambda (key value)
- (when (and (> (length key) 0)
-(not (string-match-p "[^a-z-]" key)))
-   (let* ((newkey (mapconcat
-   (lambda (x)
- (substring x 0 1))
-   (split-string key "-") "-")))
- (puthash newkey
-  (delete-dups
-   `(,@(gethash newkey pyim-dhashcache-ishortcode2word)
- ,@value))
-  pyim-dhashcache-ishortcode2word
-   pyim-dhashcache-icode2word)
-  (maphash
-   (lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
-  pyim-dhashcache-ishortcode2word))
-   pyim-dhashcache-ishortcode2word)
-  (pyim-dcache-save-variable 'pyim-dhashcache-ishortcode2word))
+  (let ((ishortcode2word (make-hash-table :test #'equal)))
+(maphash
+ (lambda (key value)
+   (when (and (> (length key) 0)
+  (not (string-match-p "[^a-z-]" key)))
+ (let* ((newkey (mapconcat
+ (lambda (x)
+   (substring x 0 1))
+ (split-string key "-") "-")))
+   (puthash newkey
+(delete-dups
+ `(,@(gethash newkey ishortcode2word)
+   ,@value))
+

[elpa] externals/consult 1cfc068 1/2: Add consult-crm-selected

2021-12-13 Thread ELPA Syncer
branch: externals/consult
commit 1cfc06800bb5663f0e516cd74179256bd738b38d
Author: Daniel Mendler 
Commit: Daniel Mendler 

Add consult-crm-selected

cc @iyefrat
---
 consult.el | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/consult.el b/consult.el
index 473c7b4..651d147 100644
--- a/consult.el
+++ b/consult.el
@@ -2387,6 +2387,17 @@ These configuration options are supported:
 
 ; Function: consult-completing-read-multiple
 
+(defun consult-crm-selected ()
+  "Return selected candidates from `consult-completing-read-multiple'."
+  (when (eq minibuffer-history-variable 'consult--crm-history)
+(all-completions
+ "" minibuffer-completion-table
+ (lambda (cand)
+   (and (stringp cand)
+(get-text-property 0 'consult--crm-selected cand)
+(or (not minibuffer-completion-predicate)
+(funcall minibuffer-completion-predicate cand)))
+
 ;;;###autoload
 (defun consult-completing-read-multiple (prompt table &optional
 pred require-match 
initial-input



[elpa] externals/consult 8cadf14 2/2: Make consult--crm-selected private, since it is not actually user facing

2021-12-13 Thread ELPA Syncer
branch: externals/consult
commit 8cadf148239be7f4a5b0350068d17fe07739fc3b
Author: Daniel Mendler 
Commit: Daniel Mendler 

Make consult--crm-selected private, since it is not actually user facing

Also it is a bit experimental right now.
---
 consult.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/consult.el b/consult.el
index 651d147..2bdf8a1 100644
--- a/consult.el
+++ b/consult.el
@@ -2387,7 +2387,7 @@ These configuration options are supported:
 
 ; Function: consult-completing-read-multiple
 
-(defun consult-crm-selected ()
+(defun consult--crm-selected ()
   "Return selected candidates from `consult-completing-read-multiple'."
   (when (eq minibuffer-history-variable 'consult--crm-history)
 (all-completions



[elpa] externals/consult updated (8500870 -> 8cadf14)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/consult.

  from  8500870   README: Fix typo
   new  1cfc068   Add consult-crm-selected
   new  8cadf14   Make consult--crm-selected private, since it is not 
actually user facing


Summary of changes:
 consult.el | 11 +++
 1 file changed, 11 insertions(+)



[elpa] externals/embark-consult updated (725794f -> 666a3c5)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/embark-consult.

  from  725794f   Merge pull request #430 from localauthor/fix-file-at-point
  adds  666a3c5   Have embark-insert insert some whitespace if needed

No new revisions were added by this update.

Summary of changes:
 embark.el | 38 --
 1 file changed, 32 insertions(+), 6 deletions(-)



[elpa] externals/embark 666a3c5: Have embark-insert insert some whitespace if needed

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit 666a3c598b57dbc089fb29311b385eb77246befa
Author: Omar Antolín 
Commit: Omar Antolín 

Have embark-insert insert some whitespace if needed

For a while I've been thinking that embark-insert should put some
space around the string it inserts to avoid having it run together
with the text in the buffer. The lack of padding made it very awkward
to insert several string in a row. For example, I often write comment
for GitHub or Reddit about Emacs in a Markdown buffer and use C-h f to
collect the function names I want to mention. Inserting more than one
of them in a single C-h f session made them run together. With the new
embark-act-all command this problem is even worse!

It seems unlikely that some people may prefer the old mash-em-up
behavior, so I'm not initially making this configurable. If a user is
happy with the padding but for some specific use case wants no spaces
it is easy to get to the space with motion commands and delete them.
By contrast, with the old behavior it was unnecessarily hard to insert
the missing spaces since you could't use easy word navigation commands
to get to the right spot: it required moving by characters or using
isearch or clicking with the mouse, etc.
---
 embark.el | 38 --
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/embark.el b/embark.el
index f24d182..72654c1 100644
--- a/embark.el
+++ b/embark.el
@@ -3233,7 +3233,7 @@ Return the category metadatum as the type of the target."
   (add-hook 'embark-target-finders #'embark--ivy-selected)
   (add-hook 'embark-candidate-collectors #'embark--ivy-candidates))
 
-;;; Custom actions
+;;; Custom actions open-line open-line
 
 (defun embark-keymap-help ()
   "Prompt for an action to perform or command to become and run it."
@@ -3241,12 +3241,38 @@ Return the category metadatum as the type of the 
target."
   (user-error "Not meant to be called directly"))
 
 (defun embark-insert (string)
-  "Insert STRING at point."
+  "Insert STRING at point.
+Some whitespace is also inserted if necessary to avoid having the
+inserted string blend into the existing buffer text.  More
+precisely:
+
+1. If the inserted string does not contain newlines, a space may
+be added before or after it as needed to avoid inserting a word
+constituent character next to an existing word constituent.
+
+2. For a multiline inserted string, newlines may be added before
+or after as needed to ensure the inserted string is on lines of
+its own."
   (interactive "sInsert: ")
-  (if buffer-read-only
-  (with-selected-window (other-window-for-scrolling)
-(insert string))
-(insert string)))
+  (let ((multiline (string-match-p "\n" string)))
+(cl-flet* ((maybe-space ()
+ (and (looking-at "\\w") (looking-back "\\w" 1)
+  (insert " ")))
+   (maybe-newline ()
+ (or (looking-back "^[ \t]*" 40) (looking-at "\n\n")
+ (newline-and-indent)))
+   (maybe-whitespace ()
+ (if multiline (maybe-newline) (maybe-space)))
+   (insert-string ()
+ (save-excursion
+   (insert string)
+   (maybe-whitespace)
+   (delete-blank-lines))
+ (maybe-whitespace)))
+  (if buffer-read-only
+  (with-selected-window (other-window-for-scrolling)
+(insert-string))
+(insert-string)
 
 (define-obsolete-function-alias
   'embark-save



[elpa] externals/embark 54e5efa 2/2: Merge pull request #432 from minad/consult-crm

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit 54e5efae17a5c2898faabeaca9564a4d5f05761f
Merge: 666a3c5 5655bef
Author: Omar Antolín Camarena 
Commit: GitHub 

Merge pull request #432 from minad/consult-crm

Add candidate collector for consult-completing-read-multiple
---
 embark-consult.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/embark-consult.el b/embark-consult.el
index 9c2911e..fb9e0dd 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -320,5 +320,14 @@ that is a Consult async command."
 (setf (alist-get 'imenu embark-default-action-overrides) #'consult-imenu)
 (add-to-list 'embark-candidate-collectors #'embark-consult-outline-candidates 
'append)
 
+;; consult-completing-read-multiple
+
+(defun embark-consult--crm-selected ()
+  "Return selected candidates from `consult-completing-read-multiple'."
+  (when-let (cands (consult--crm-selected))
+(cons (completion-metadata-get (embark--metadata) 'category) cands)))
+
+(add-hook 'embark-candidate-collectors #'embark-consult--crm-selected)
+
 (provide 'embark-consult)
 ;;; embark-consult.el ends here



[elpa] externals/embark 5655bef 1/2: Add candidate collector for consult-completing-read-multiple

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit 5655bef1af313c3ecac7aa3779ca750e02a35c4f
Author: Daniel Mendler 
Commit: Daniel Mendler 

Add candidate collector for consult-completing-read-multiple
---
 embark-consult.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/embark-consult.el b/embark-consult.el
index 9c2911e..fb9e0dd 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -320,5 +320,14 @@ that is a Consult async command."
 (setf (alist-get 'imenu embark-default-action-overrides) #'consult-imenu)
 (add-to-list 'embark-candidate-collectors #'embark-consult-outline-candidates 
'append)
 
+;; consult-completing-read-multiple
+
+(defun embark-consult--crm-selected ()
+  "Return selected candidates from `consult-completing-read-multiple'."
+  (when-let (cands (consult--crm-selected))
+(cons (completion-metadata-get (embark--metadata) 'category) cands)))
+
+(add-hook 'embark-candidate-collectors #'embark-consult--crm-selected)
+
 (provide 'embark-consult)
 ;;; embark-consult.el ends here



[elpa] externals/embark-consult updated (666a3c5 -> 54e5efa)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/embark-consult.

  from  666a3c5   Have embark-insert insert some whitespace if needed
  adds  5655bef   Add candidate collector for 
consult-completing-read-multiple
  adds  54e5efa   Merge pull request #432 from minad/consult-crm

No new revisions were added by this update.

Summary of changes:
 embark-consult.el | 9 +
 1 file changed, 9 insertions(+)



[elpa] externals/consult updated (8cadf14 -> cc8eff9)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/consult.

  from  8cadf14   Make consult--crm-selected private, since it is not 
actually user facing
   new  97dc258   consult--crm-selected: Return original candidates
   new  cc8eff9   consult-completing-read-multiple: Cleanup


Summary of changes:
 consult.el | 29 -
 1 file changed, 16 insertions(+), 13 deletions(-)



[elpa] externals/consult cc8eff9 2/2: consult-completing-read-multiple: Cleanup

2021-12-13 Thread ELPA Syncer
branch: externals/consult
commit cc8eff9578f5d089735e8b7dd7a08732890ed648
Author: Daniel Mendler 
Commit: Daniel Mendler 

consult-completing-read-multiple: Cleanup
---
 consult.el | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/consult.el b/consult.el
index 57193ee..cdde0e2 100644
--- a/consult.el
+++ b/consult.el
@@ -2406,21 +2406,19 @@ These configuration options are supported:
 hist def inherit-input-method)
   "Enhanced replacement for `completing-read-multiple'.
 See `completing-read-multiple' for the documentation of the arguments."
-  (let* ((orig-items
+  (let* ((orig-items (all-completions "" table pred))
+ (prefixed-orig-items
   (funcall
(if-let (prefix (car consult-crm-prefix))
(apply-partially #'mapcar (lambda (item) (propertize item 
'line-prefix prefix)))
  #'identity)
-   (all-completions "" table pred)))
+   orig-items))
  (format-item
   (lambda (item)
-(setq item (propertize
-;; Restore original candidate in order to preserve 
formatting
-(or (get-text-property 0 'consult--crm-selected item)
-(car (member item orig-items))
-item)
-'consult--crm-selected item
-'line-prefix (cdr consult-crm-prefix)))
+;; Restore original candidate in order to preserve formatting
+(setq item (or (car (member item orig-items)) item)
+  item (propertize item 'consult--crm-selected item
+   'line-prefix (cdr consult-crm-prefix)))
 (add-face-text-property 0 (length item) 'consult-crm-selected 
'append item)
 item))
  (separator (or (bound-and-true-p crm-separator) "[ \t]*,[ \t]*"))
@@ -2444,7 +2442,7 @@ See `completing-read-multiple' for the documentation of 
the arguments."
  (consult--crm-history (append (mapcar #'substring-no-properties 
selected) hist-val))
  (items (append selected
 (seq-remove (lambda (x) (member x selected))
-orig-items)))
+prefixed-orig-items)))
  (orig-md (and (functionp table) (cdr (funcall table "" nil 
'metadata
  (group-fun (alist-get 'group-function orig-md))
  (sort-fun
@@ -2495,7 +2493,7 @@ See `completing-read-multiple' for the documentation of 
the arguments."
  consult--crm-history (append (mapcar 
#'substring-no-properties selected) hist-val)
  items (append selected
(seq-remove (lambda (x) (member x 
selected))
-   orig-items)))
+   prefixed-orig-items)))
(when overlay
  (overlay-put overlay 'display
   (when selected



[elpa] externals/consult 97dc258 1/2: consult--crm-selected: Return original candidates

2021-12-13 Thread ELPA Syncer
branch: externals/consult
commit 97dc258b7ed5d08a3872b01acb57aa2c813a3c84
Author: Daniel Mendler 
Commit: Daniel Mendler 

consult--crm-selected: Return original candidates
---
 consult.el | 27 ---
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/consult.el b/consult.el
index 2bdf8a1..57193ee 100644
--- a/consult.el
+++ b/consult.el
@@ -2390,13 +2390,15 @@ These configuration options are supported:
 (defun consult--crm-selected ()
   "Return selected candidates from `consult-completing-read-multiple'."
   (when (eq minibuffer-history-variable 'consult--crm-history)
-(all-completions
- "" minibuffer-completion-table
- (lambda (cand)
-   (and (stringp cand)
-(get-text-property 0 'consult--crm-selected cand)
-(or (not minibuffer-completion-predicate)
-(funcall minibuffer-completion-predicate cand)))
+(mapcar
+ (apply-partially #'get-text-property 0 'consult--crm-selected)
+ (all-completions
+  "" minibuffer-completion-table
+  (lambda (cand)
+(and (stringp cand)
+ (get-text-property 0 'consult--crm-selected cand)
+ (or (not minibuffer-completion-predicate)
+ (funcall minibuffer-completion-predicate cand
 
 ;;;###autoload
 (defun consult-completing-read-multiple (prompt table &optional
@@ -2412,10 +2414,13 @@ See `completing-read-multiple' for the documentation of 
the arguments."
(all-completions "" table pred)))
  (format-item
   (lambda (item)
-;; Restore original candidate in order to preserve formatting
-(setq item (propertize (or (car (member item orig-items)) item)
-   'consult--crm-selected t
-   'line-prefix (cdr consult-crm-prefix)))
+(setq item (propertize
+;; Restore original candidate in order to preserve 
formatting
+(or (get-text-property 0 'consult--crm-selected item)
+(car (member item orig-items))
+item)
+'consult--crm-selected item
+'line-prefix (cdr consult-crm-prefix)))
 (add-face-text-property 0 (length item) 'consult-crm-selected 
'append item)
 item))
  (separator (or (bound-and-true-p crm-separator) "[ \t]*,[ \t]*"))



[elpa] externals/org-transclusion c4a396a: intrnl:add .elpaignore; bump to v1.0.1 to enable ELPA

2021-12-13 Thread ELPA Syncer
branch: externals/org-transclusion
commit c4a396a5acbf4c9b26d9db8ed28ed85564bfb609
Author: Noboru Ota 
Commit: Noboru Ota 

intrnl:add .elpaignore; bump to v1.0.1 to enable ELPA

No functional change
---
 .elpaignore | 2 ++
 NEWS| 5 +
 org-transclusion.el | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 000..1b1c018
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1,2 @@
+test/
+docs/
\ No newline at end of file
diff --git a/NEWS b/NEWS
index ef470d7..9814e63 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+* Version 1.0.1
+
+- Add .elpaignore
+- Bump up version only to enable ELPA; no functional changes
+
 * Version 1.0.0
 
 - Initial version available on ELPA (https://elpa.gnu.org/)
\ No newline at end of file
diff --git a/org-transclusion.el b/org-transclusion.el
index f3ef39d..5569397 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -22,7 +22,7 @@
 ;; URL: https://github.com/nobiot/org-transclusion
 ;; Keywords: org-mode, transclusion, writing
 
-;; Version: 1.0.0
+;; Version: 1.0.1
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 
 ;; This file is not part of GNU Emacs.



[elpa] externals/javaimp 2fb2812: Doc fixes

2021-12-13 Thread Filipp Gunbin
branch: externals/javaimp
commit 2fb28124cc7a282ee3369ca11c9f0967b28d0a5a
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

Doc fixes
---
 javaimp.el | 65 +++---
 1 file changed, 41 insertions(+), 24 deletions(-)

diff --git a/javaimp.el b/javaimp.el
index 5bfefa2..8d4f344 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -36,7 +36,8 @@
 ;;
 ;; - Call `javaimp-visit-project', giving it the top-level build file
 ;; of your project.  If called within a project, supplies useful
-;; default candidates in minibuffer input.
+;; default candidates in minibuffer input (topmost build file in the
+;; current directory hierarchy, then nested ones).
 ;;
 ;; - Then in a Java buffer visiting a file under that project or one
 ;; of its submodules call `javaimp-organize-imports' or
@@ -51,17 +52,29 @@
 ;; complete.  Project structure is re-read if a module's build file or
 ;; any of its parents' build files (within visited tree) was modified
 ;; since last check.  `javaimp-flush-cache' clears jar / source cache.
-;; To forget visited projects structure, eval `(setq javaimp-project
-;; forest nil)'.
+;;
+;; To forget visited projects structure eval this:
+;; (setq javaimp-project forest nil)
 ;;
 ;; Project structure and dependency information is retrieved from the
-;; build tool, see `javaimp--maven-visit' and `javaimp--gradle-visit'.
-;; The output from the build tool can be inspected in buffer named by
-;; `javaimp-tool-output-buf-name' variable.
+;; build tool, see `javaimp--maven-visit' and `javaimp--gradle-visit',
+;; and the `javaimp-handler-regexp-alist' variable.  The output from
+;; the build tool can be inspected in buffer named by
+;; `javaimp-tool-output-buf-name' variable.  If there exists
+;; Maven/Gradle wrapper in the project directory, as it is popular
+;; these days, it will be used in preference to `javaimp-mvn-program'
+;; / `javaimp-gradle-program'.
 ;;
 ;; See docstring of `javaimp-add-import' for how import completion
 ;; alternative are collected.
 ;;
+;; If you get jar reading errors with Gradle despite following
+;; recommendation which is shown (text from
+;; `javaimp--jar-error-header' followed by offending jars), then it
+;; might be the case that Gradle reordered build in such a way that
+;; those jars are really not built yet.  In this case, just build them
+;; manually, like: './gradlew :project1:build :project2:build'.
+;;
 ;; Important defcustoms are:
 ;;
 ;; - `javaimp-java-home' - used to obtain classes in the JDK, and also
@@ -69,8 +82,8 @@
 ;; to it.  It's initialized from JAVA_HOME env var, so typically it's
 ;; not required to set it explicitly in Lisp.
 ;;
-;; - `javaimp-enable-parsing' - determines whether we parse the
-;; current project for the list of classes.  Parsing is implemented in
+;; - `javaimp-parse-current-module' - determines whether we parse the
+;; current module for the list of classes.  Parsing is implemented in
 ;; javaimp-parse.el using `syntax-ppss', generally is simple (we do
 ;; not try to parse the source completely - just the interesting
 ;; pieces), but can be time-consuming for large projects (to be
@@ -105,7 +118,7 @@
 ;; (local-set-key (kbd "C-c o") #'javaimp-organize-imports)
 ;; (local-set-key (kbd "C-c s") #'javaimp-help-show-scopes)
 ;;
-;; To enable Imenu, overriding Imenu support from cc-mode:
+;; To enable Imenu (overriding Imenu support from cc-mode):
 ;;
 ;; (setq imenu-create-index-function #'javaimp-imenu-create-index)
 
@@ -150,9 +163,9 @@ The order of classes which were not matched is defined by
   (let ((val (getenv "JAVA_HOME")))
 (and val (not (string-blank-p val))
  val))
-  "Path to the JDK.  Should contain subdirectory
-\"jre/lib\" (pre-JDK9) or just \"lib\".  By default, it is
-initialized from the JAVA_HOME environment variable."
+  "Path to the JDK.  The directory given should contain
+subdirectory \"jre/lib\" (pre-JDK9) or just \"lib\".  By default,
+it is initialized from the JAVA_HOME environment variable."
   :type 'string)
 
 (defcustom javaimp-additional-source-dirs nil
@@ -170,10 +183,12 @@ becomes \"generated-sources/\" (note the 
absence of
 the leading slash)."
   :type '(repeat (string :tag "Relative directory")))
 
-(defcustom javaimp-enable-parsing t
+(defcustom javaimp-parse-current-module t
   "If non-nil, javaimp will try to parse current module's source
 files to determine completion alternatives, in addition to those
-from module dependencies."
+from module dependencies.  This can be time-consuming, that's why
+this defcustom exists, to turn it off if it's annoying (perhaps
+in per-directory locals)."
   :type 'boolean)
 
 (defcustom javaimp-imenu-use-sub-alists nil
@@ -233,7 +248,7 @@ is expanded file name and CACHED-FILE is javaimp-cached-file
 struct.")
 
 (defvar javaimp-syntax-table
-  (make-syntax-table java-mode-syntax-table) ;TODO don't depend
+  (make-syntax-table java-mode-syntax-table) ;TODO don't depend on cc-mode
   "Javaimp syntax table")

[elpa] externals/javaimp 4221563: Version 0.8

2021-12-13 Thread Filipp Gunbin
branch: externals/javaimp
commit 4221563a022cbb538ad0c1f9558e35c8de568f5a
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

Version 0.8
---
 javaimp.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/javaimp.el b/javaimp.el
index 8d4f344..3ce295a 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -4,7 +4,7 @@
 
 ;; Author: Filipp Gunbin 
 ;; Maintainer: Filipp Gunbin 
-;; Version: 0.7.1
+;; Version: 0.8
 ;; Keywords: java, maven, gradle, programming
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] externals/org-transclusion 0a9cd03: docs:README:fix texinfo issue for makeinfo part of ELPA build

2021-12-13 Thread ELPA Syncer
branch: externals/org-transclusion
commit 0a9cd03d2c6ea740ff0bb90c12665b752b8184d5
Author: Noboru Ota 
Commit: Noboru Ota 

docs:README:fix texinfo issue for makeinfo part of ELPA build

README.texi:767: warning: @item missing argument
---
 README.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index ba5f2ec..c93442e 100644
--- a/README.org
+++ b/README.org
@@ -616,8 +616,8 @@ Main features and changes only.
 - Fix ::
   - =org-transclusion-before-kill= now checks if the buffer to be killed
 contains any transclusion AND it is visting a file before saving. This
-fixes some issues related to temp buffers, etc.
-- fix: search options for src-lines extension for =:lines=, =:src=, and =:end= 
properties
+fixes some issues related to temp buffers, etc.
+  - fix: search options for src-lines extension for =:lines=, =:src=, and 
=:end= properties
 
 ** 0.2.2
 - New Features ::



[elpa] externals/embark-consult updated (54e5efa -> 522ffa2)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/embark-consult.

  from  54e5efa   Merge pull request #432 from minad/consult-crm
  adds  64eb66b   embark-face-map: Add describe-face
  adds  522ffa2   Merge pull request #434 from minad/add-describe-face

No new revisions were added by this update.

Summary of changes:
 embark.el | 1 +
 1 file changed, 1 insertion(+)



[elpa] externals/embark 522ffa2 2/2: Merge pull request #434 from minad/add-describe-face

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit 522ffa24798c33a03844ab3bd3de79f050f7827f
Merge: 54e5efa 64eb66b
Author: Omar Antolín Camarena 
Commit: GitHub 

Merge pull request #434 from minad/add-describe-face

embark-face-map: Add describe-face
---
 embark.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/embark.el b/embark.el
index 72654c1..e28b585 100644
--- a/embark.el
+++ b/embark.el
@@ -3870,6 +3870,7 @@ and leaves the point to the left of it."
 (embark-define-keymap embark-face-map
   "Keymap for Embark face actions."
   :parent embark-symbol-map
+  ("h" describe-face)
   ("c" customize-face)
   ("+" make-face-bold)
   ("-" make-face-unbold)



[elpa] externals/embark 64eb66b 1/2: embark-face-map: Add describe-face

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit 64eb66b8917ee6f780efc882a6f943bed2d61914
Author: Daniel Mendler 
Commit: Daniel Mendler 

embark-face-map: Add describe-face
---
 embark.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/embark.el b/embark.el
index 72654c1..e28b585 100644
--- a/embark.el
+++ b/embark.el
@@ -3870,6 +3870,7 @@ and leaves the point to the left of it."
 (embark-define-keymap embark-face-map
   "Keymap for Embark face actions."
   :parent embark-symbol-map
+  ("h" describe-face)
   ("c" customize-face)
   ("+" make-face-bold)
   ("-" make-face-unbold)



[elpa] externals/embark e08899e: Prioritize headings in text modes (fix #421)

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit e08899ef2e7fb9c1ed4b4b21e44cd368561f91f9
Author: Omar Antolín Camarena 
Commit: Omar Antolín Camarena 

Prioritize headings in text modes (fix #421)
---
 embark.el | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/embark.el b/embark.el
index e28b585..e69ad2e 100644
--- a/embark.el
+++ b/embark.el
@@ -149,6 +149,7 @@ For any type not listed here, `embark-act' will use
 (defcustom embark-target-finders
   '(embark-target-top-minibuffer-completion
 embark-target-active-region
+embark-target-text-heading-at-point
 embark-target-collect-candidate
 embark-target-completion-at-point
 embark-target-bug-reference-at-point
@@ -163,7 +164,7 @@ For any type not listed here, `embark-act' will use
 embark-target-sentence-at-point
 embark-target-paragraph-at-point
 embark-target-defun-at-point
-embark-target-heading-at-point)
+embark-target-prog-heading-at-point)
   "List of functions to determine the target in current context.
 Each function should take no arguments and return either nil to
 indicate that no target has been found, a cons (type . target)
@@ -859,6 +860,16 @@ As a convenience, in Org Mode an initial ' or surrounding 
== or
   (require 'outline) ;; Ensure that outline commands are available
   `(heading ,(buffer-substring beg end) ,beg . ,end
 
+(defun embark-target-text-heading-at-point ()
+  "Target the outline heading at point in text modes."
+  (when (derived-mode-p 'text-mode)
+(embark-target-heading-at-point)))
+
+(defun embark-target-prog-heading-at-point ()
+  "Target the outline heading at point in programming modes."
+  (when (derived-mode-p 'prog-mode)
+(embark-target-heading-at-point)))
+
 (defun embark-target-top-minibuffer-completion ()
   "Target the top completion candidate in the minibuffer.
 Return the category metadatum as the type of the target.



[elpa] externals/embark-consult updated (522ffa2 -> e08899e)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/embark-consult.

  from  522ffa2   Merge pull request #434 from minad/add-describe-face
  adds  e08899e   Prioritize headings in text modes (fix #421)

No new revisions were added by this update.

Summary of changes:
 embark.el | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)



[elpa] externals/embark b17af02: Introduce new multitarget actions (fix #433)

2021-12-13 Thread ELPA Syncer
branch: externals/embark
commit b17af024d92e5c8532ed94f157e65aa7f4cda334
Author: Omar Antolín 
Commit: Omar Antolín 

Introduce new multitarget actions (fix #433)

Any action listed in embark-multitarget-actions is treated specially
by embark-act and embark-act-all:

- It is called non-interactively whether or not it is interactive.
- embark-act calls it with a singleton list containing the target.
- embark-act-all calls it with a list of all candidates.
---
 embark.el | 56 ++--
 1 file changed, 38 insertions(+), 18 deletions(-)

diff --git a/embark.el b/embark.el
index e69ad2e..753323f 100644
--- a/embark.el
+++ b/embark.el
@@ -378,7 +378,7 @@ with `find-file'."
   "Enable editing of target prior to acting for these commands.
 Editing the target is useful as a confirmation feature for
 destructive commands like `delete-file'."
-  :type '(repeat symbol))
+  :type '(repeat function))
 
 (defvar embark-skip-edit-commands nil)
 (defvar embark-allow-edit-default t)
@@ -501,6 +501,17 @@ arguments and more details."
"see the new `embark-post-action-hooks' variable."
"0.12")
 
+(defcustom embark-multitarget-actions nil
+  "Commands for which `embark-act-all' should pass a list of targets.
+Normally `embark-act-all' runs the same action on each candiate
+separately, but when a command included in this variable's value
+is used as an action, `embark-act-all' will instead call it
+non-interactively with a single argument: the list of all
+candidates.  For commands on this list `embark-act' behaves
+similarly: it calls them non-interactively with a single
+argument: a one element list containing the target."
+  :type '(repeat function))
+
 (defcustom embark-repeat-actions
   '(mark
 ;; outline commands
@@ -1680,8 +1691,8 @@ hooks."
   "Perform ACTION injecting the TARGET.
 If called from a minibuffer with non-nil QUIT, quit the
 minibuffer before executing the action."
-  (if (memq action '(embark-become; these actions should not
- embark-collect-live  ; run in the target window
+  (if (memq action '(embark-become   ; these actions should not
+ embark-collect-live ; run in the target window
  embark-collect-snapshot
  embark-export
  embark-act-all))
@@ -1706,8 +1717,9 @@ minibuffer before executing the action."
(dedicate (and (derived-mode-p 'embark-collect-mode)
   (not (window-dedicated-p))
   (selected-window)))
+   (multi (memq action embark-multitarget-actions))
(run-action
-(if (commandp action)
+(if (and (commandp action) (not multi))
 (lambda ()
   (minibuffer-with-setup-hook inject
 (let (final-window)
@@ -1730,13 +1742,18 @@ minibuffer before executing the action."
 (when dedicate (set-window-dedicated-p dedicate nil)))
   (unless (eq final-window action-window)
 (select-window final-window)
-  (lambda ()
-(with-selected-window action-window
-  (embark--run-action-hooks embark-pre-action-hooks
-action target quit)
-  (unwind-protect (funcall action (plist-get target :target))
-(embark--run-action-hooks embark-post-action-hooks
-  action target quit)))
+  (let ((argument
+ (if multi
+ (or (plist-get target :candidates) ; embark-act-all
+ (list (plist-get target :target)))
+   (plist-get target :target
+(lambda ()
+  (with-selected-window action-window
+(embark--run-action-hooks embark-pre-action-hooks
+  action target quit)
+(unwind-protect (funcall action argument)
+  (embark--run-action-hooks embark-post-action-hooks
+action target quit
   (if quit (embark--quit-and-run run-action) (funcall run-action)
 
 (defun embark--refine-symbol-type (_type target)
@@ -2044,18 +2061,21 @@ ARG is the prefix argument."
(act (lambda (candidate)
   (let ((embark-allow-edit-actions nil)
 (embark-post-action-hooks post-action-wo-restart))
-(embark--act action candidate)
+(embark--act action candidate
+   (quit (if embark-quit-after-action (not arg) arg)))
   (when (and (eq action (embark--default-action type))
  (eq action embark--command))
   

[elpa] externals/embark-consult updated (e08899e -> b17af02)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/embark-consult.

  from  e08899e   Prioritize headings in text modes (fix #421)
  adds  b17af02   Introduce new multitarget actions (fix #433)

No new revisions were added by this update.

Summary of changes:
 embark.el | 56 ++--
 1 file changed, 38 insertions(+), 18 deletions(-)



[elpa] externals/pyim updated (02c5004 -> f72f23c)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  02c5004   简化 pyim-dhashcache-update-ishortcode2word-1 和 
pyim-dhashcache-update-shortcode2word-1.
   new  a96a131   pyim-dhashcache-get-shortcode -> 
pyim-dhashcache-get-shortcodes
   new  f72f23c   Add pyim-dhashcache-get-ishortcodes.


Summary of changes:
 pyim-dhashcache.el  | 51 ++-
 tests/pyim-tests.el | 18 --
 2 files changed, 42 insertions(+), 27 deletions(-)



[elpa] externals/pyim f72f23c 2/2: Add pyim-dhashcache-get-ishortcodes.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit f72f23c2f78dd89bf6eb7101e18442cf7f34d1eb
Author: Feng Shu 
Commit: Feng Shu 

Add pyim-dhashcache-get-ishortcodes.

* pyim-dhashcache.el (pyim-dhashcache-get-ishortcodes): New function.
(pyim-dhashcache-update-ishortcode2word-1)
(pyim-dhashcache-insert-word-into-ishortcode2word): Use 
pyim-dhashcache-get-ishortcodes.
---
 pyim-dhashcache.el  | 39 ++-
 tests/pyim-tests.el |  6 ++
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 2e800a8..aae3dc0 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -84,6 +84,20 @@
   (push (concat prefix (substring code1 0 i)) results)))
   results)))
 
+(defun pyim-dhashcache-get-ishortcodes (code)
+  "获取CODE 所有的简写 ishortcodes.
+
+比如: ni-hao -> (n-h)
+
+注意事项:这个函数用于全拼输入法。"
+  (when (and (> (length code) 0)
+ (not (pyim-string-match-p "/" code))
+ (not (pyim-string-match-p "[^a-z-]" code)))
+(list (mapconcat
+   (lambda (x)
+ (substring x 0 1))
+   (split-string code "-") "-"
+
 (defun pyim-dhashcache-async-inject-variables ()
   "pyim's async-inject-variables."
   (list (async-inject-variables "^load-path$")
@@ -118,17 +132,12 @@
   (let ((ishortcode2word (make-hash-table :test #'equal)))
 (maphash
  (lambda (key value)
-   (when (and (> (length key) 0)
-  (not (string-match-p "[^a-z-]" key)))
- (let* ((newkey (mapconcat
- (lambda (x)
-   (substring x 0 1))
- (split-string key "-") "-")))
-   (puthash newkey
-(delete-dups
- `(,@(gethash newkey ishortcode2word)
-   ,@value))
-ishortcode2word
+   (dolist (newkey (pyim-dhashcache-get-ishortcodes key))
+ (puthash newkey
+  (delete-dups
+   `(,@(gethash newkey ishortcode2word)
+ ,@value))
+  ishortcode2word)))
  icode2word)
 (maphash
  (lambda (key value)
@@ -446,14 +455,10 @@ code 对应的中文词条了。
 
 默认 WORD 放到已有词条的最后,如果 PREPEND 为 non-nil, WORD 将放
 到已有词条的最前面。"
-  (when (string-match-p "-" code)
+  (dolist (newcode (pyim-dhashcache-get-ishortcodes code))
 (pyim-dhashcache-put
   pyim-dhashcache-ishortcode2word
-  ;; ni-hao -> n-h
-  (mapconcat (lambda (x)
-   (substring x 0 1))
- (split-string code "-")
- "-")
+  newcode
   (if prepend
   `(,word ,@(remove word orig-value))
 `(,@(remove word orig-value) ,word)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index fd92455..2fcfcf0 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -608,6 +608,12 @@
   (should (equal (pyim-dhashcache-get-shortcodes "ni-hao") nil))
   (should (equal (pyim-dhashcache-get-shortcodes "") nil)))
 
+(ert-deftest pyim-tests-pyim-dhashcache-get-ishortcodes ()
+  (should (equal (pyim-dhashcache-get-ishortcodes "ni-hao") '("n-h")))
+  (should (equal (pyim-dhashcache-get-ishortcodes "wubi/") nil))
+  (should (equal (pyim-dhashcache-get-ishortcodes "ni") '("n")))
+  (should (equal (pyim-dhashcache-get-ishortcodes "") nil)))
+
 (ert-deftest pyim-tests-pyim-dhashcache-get-path ()
   (let ((pyim-dcache-directory "/tmp/dcache"))
 (should (equal (pyim-dhashcache-get-path 'hello) "/tmp/dcache/hello"))



[elpa] externals/pyim a96a131 1/2: pyim-dhashcache-get-shortcode -> pyim-dhashcache-get-shortcodes

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit a96a131196f8b82c1995cade27304da5e5174328
Author: Feng Shu 
Commit: Feng Shu 

pyim-dhashcache-get-shortcode -> pyim-dhashcache-get-shortcodes

* tests/pyim-tests.el (pyim-tests-pyim-dhashcache-get-shortcodes):

* pyim-dhashcache.el (pyim-dhashcache-get-shortcodes)
(pyim-dhashcache-update-shortcode2word-1):
---
 pyim-dhashcache.el  | 12 
 tests/pyim-tests.el | 12 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index b5aa590..2e800a8 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -64,10 +64,14 @@
 (> (or (gethash a iword2count) 0)
(or (gethash b iword2count) 0))
 
-(defun pyim-dhashcache-get-shortcode (code)
-  "获取一个 CODE 的所有简写.
+(defun pyim-dhashcache-get-shortcodes (code)
+  "获取 CODE 所有的 shortcodes.
 
-比如:.nihao -> .nihao .niha .nih .ni .n"
+比如:wubi/ -> (wubi/aaa wubi/aa)
+
+注意事项:这个函数目前只用于五笔等型码输入法,不用于拼音输入法,
+因为拼音输入法词库太大,这样处理之后,会生成一个特别大的哈希表,
+占用太多内存资源,拼音输入法使用 ishortcode 机制。"
   (when (and (pyim-string-match-p "/" code)
  (not (pyim-string-match-p "-" code)))
 (let* ((x (split-string code "/"))
@@ -161,7 +165,7 @@
   (let ((shortcode2word (make-hash-table :test #'equal)))
 (maphash
  (lambda (key value)
-   (dolist (x (pyim-dhashcache-get-shortcode key))
+   (dolist (x (pyim-dhashcache-get-shortcodes key))
  (puthash x
   (mapcar
(lambda (word)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 93fe7cc..fd92455 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -600,13 +600,13 @@
 (should (equal (gethash "测伌" pyim-dhashcache-iword2count) 0
 
 ;; ** pyim-dhashcache 相关单元测试
-(ert-deftest pyim-tests-pyim-dhashcache-get-shortcode ()
-  (should (equal (pyim-dhashcache-get-shortcode ".abcde") nil))
-  (should (equal (pyim-dhashcache-get-shortcode "wubi/abcde")
+(ert-deftest pyim-tests-pyim-dhashcache-get-shortcodes ()
+  (should (equal (pyim-dhashcache-get-shortcodes ".abcde") nil))
+  (should (equal (pyim-dhashcache-get-shortcodes "wubi/abcde")
  '("wubi/abcd" "wubi/abc" "wubi/ab")))
-  (should (equal (pyim-dhashcache-get-shortcode "abcde") nil))
-  (should (equal (pyim-dhashcache-get-shortcode "ni-hao") nil))
-  (should (equal (pyim-dhashcache-get-shortcode "") nil)))
+  (should (equal (pyim-dhashcache-get-shortcodes "abcde") nil))
+  (should (equal (pyim-dhashcache-get-shortcodes "ni-hao") nil))
+  (should (equal (pyim-dhashcache-get-shortcodes "") nil)))
 
 (ert-deftest pyim-tests-pyim-dhashcache-get-path ()
   (let ((pyim-dcache-directory "/tmp/dcache"))



[elpa] externals/pyim e0a88a8 1/2: * pyim-candidates.el (pyim-candidates-create:quanpin): do not use pyim-entered-get.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit e0a88a8dd2271ef79dfaec5803d2b0628b8ecb7f
Author: Feng Shu 
Commit: Feng Shu 

* pyim-candidates.el (pyim-candidates-create:quanpin): do not use 
pyim-entered-get.
---
 pyim-candidates.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pyim-candidates.el b/pyim-candidates.el
index b30b928..88f7948 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -92,9 +92,11 @@ IMOBJS 获得候选词条。"
 (defun pyim-candidates-create:quanpin (imobjs scheme-name &optional async)
   "`pyim-candidates-create' 处理全拼输入法的函数."
   (if async
-  ;; 使用当前的 entered 构建一个搜索中文的正则表达式, 然后使用这个正则表达式
-  ;; 在当前 buffer 中搜索词条。
-  (let ((str (pyim-entered-get)))
+  ;; 构建一个搜索中文的正则表达式, 然后使用这个正则表达式在当前 buffer 中搜
+  ;; 索词条。
+  (let ((str (mapconcat #'identity
+(pyim-codes-create (car imobjs) scheme-name)
+"")))
 (if (< (length str) 1)
 pyim-candidates
   ;; NOTE: 让第一个词保持不变是不是合理,有待进一步的观察。



[elpa] externals/pyim updated (f72f23c -> 0758baa)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  f72f23c   Add pyim-dhashcache-get-ishortcodes.
   new  e0a88a8   * pyim-candidates.el (pyim-candidates-create:quanpin): do 
not use pyim-entered-get.
   new  0758baa   Use string-join.


Summary of changes:
 pyim-candidates.el  | 30 --
 pyim-common.el  |  2 +-
 pyim-cregexp.el | 34 --
 pyim-cstring.el |  4 ++--
 pyim-dregcache.el   |  2 +-
 pyim-liberime.el| 22 +-
 pyim-page.el| 30 --
 pyim-pinyin.el  | 28 ++--
 pyim-process.el |  6 +++---
 pyim-punctuation.el |  2 +-
 pyim-pymap.el   | 20 +---
 pyim.el | 10 --
 12 files changed, 84 insertions(+), 106 deletions(-)



[elpa] externals/pyim 0758baa 2/2: Use string-join.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 0758baaa2888eb30d4e77001f1ad196c48d32870
Author: Feng Shu 
Commit: Feng Shu 

Use string-join.

* pyim-candidates.el (pyim-candidates-create:quanpin)
(pyim-candidates-create-quanpin):

* pyim.el (pyim-select-word:pinyin):

* pyim-pymap.el (pyim-pymap-sort-pymap, pyim-pymap-build-pymap):

* pyim-punctuation.el (pyim-punctuation-translate):

* pyim-process.el (pyim-process-create-code-criteria):

* pyim-pinyin.el (pyim-pinyin-shuangpin-invalid-pinyin-regexp):

* pyim-page.el (pyim-page-preview-create:quanpin)
(pyim-page-preview-create:shuangpin, pyim-page-menu-create):

* pyim-liberime.el (pyim-liberime-create-word)
(pyim-liberime-get-code):

* pyim-dregcache.el (pyim-dregcache-sort-icode2word):

* pyim-cstring.el (pyim-cstring-split-to-string-1)
(pyim-cstring-to-pinyin):

* pyim-cregexp.el (pyim-cregexp-build-1)
(pyim-cregexp-build:xingma):

* pyim-common.el (pyim-subconcat):
---
 pyim-candidates.el  | 28 ++--
 pyim-common.el  |  2 +-
 pyim-cregexp.el | 34 --
 pyim-cstring.el |  4 ++--
 pyim-dregcache.el   |  2 +-
 pyim-liberime.el| 22 +-
 pyim-page.el| 30 --
 pyim-pinyin.el  | 28 ++--
 pyim-process.el |  6 +++---
 pyim-punctuation.el |  2 +-
 pyim-pymap.el   | 20 +---
 pyim.el | 10 --
 12 files changed, 82 insertions(+), 106 deletions(-)

diff --git a/pyim-candidates.el b/pyim-candidates.el
index 88f7948..c2ee97a 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -94,9 +94,7 @@ IMOBJS 获得候选词条。"
   (if async
   ;; 构建一个搜索中文的正则表达式, 然后使用这个正则表达式在当前 buffer 中搜
   ;; 索词条。
-  (let ((str (mapconcat #'identity
-(pyim-codes-create (car imobjs) scheme-name)
-"")))
+  (let ((str (string-join (pyim-codes-create (car imobjs) scheme-name
 (if (< (length str) 1)
 pyim-candidates
   ;; NOTE: 让第一个词保持不变是不是合理,有待进一步的观察。
@@ -155,16 +153,14 @@ IMOBJS 获得候选词条。"
(> (length (car imobjs)) 1))
   (dolist (imobj imobjs)
 (let* ((w (pyim-dcache-get
-   (mapconcat #'identity
-  (pyim-codes-create imobj scheme-name 1)
-  "-")
+   (string-join (pyim-codes-create imobj scheme-name 1) "-")
'(ishortcode2word)))
-   (regexp1 (mapconcat #'identity
-   (pyim-codes-create imobj scheme-name)
-   "-"))
-   (regexp2 (mapconcat #'identity
-   (pyim-codes-create imobj scheme-name)
-   "[^-]*-"))
+   (regexp1 (string-join
+ (pyim-codes-create imobj scheme-name)
+ "-"))
+   (regexp2 (string-join
+ (pyim-codes-create imobj scheme-name)
+ "[^-]*-"))
(w1 (cl-remove-if-not
 (lambda (cstr)
   (let ((py (pyim-cstring-to-pinyin cstr nil "-")))
@@ -181,17 +177,13 @@ IMOBJS 获得候选词条。"
 (dolist (imobj imobjs)
   (let* (;; 个人词条
  (w1 (pyim-dcache-get
-  (mapconcat #'identity
- (pyim-codes-create imobj scheme-name)
- "-")
+  (string-join (pyim-codes-create imobj scheme-name) "-")
   (if pyim-enable-shortcode
   '(icode2word ishortcode2word)
 '(icode2word
  ;; 词库词条
  (w2 (pyim-dcache-get
-  (mapconcat #'identity
- (pyim-codes-create imobj scheme-name)
- "-")
+  (string-join (pyim-codes-create imobj scheme-name) "-")
   (if pyim-enable-shortcode
   '(code2word shortcode2word)
 '(code2word
diff --git a/pyim-common.el b/pyim-common.el
index 7b421d3..25b386e 100644
--- a/pyim-common.el
+++ b/pyim-common.el
@@ -126,7 +126,7 @@ When CARE-FIRST-ONE is no-nil, ((a b c) (d e)) => (a d)."
 output)
 (dotimes (i (- n 1))
   (let ((list (cl-subseq list 0 (- n i
-(push (mapconcat #'identity list (or sep "")) output)))
+(push (string-join list (or sep "")) output)))
 (nreverse output)))
 
 (defun pyim-char-before-to-string (num)
diff --git a/pyim-cregexp.el b/pyim-cregexp.el
index 2a999a1..51a3ef2 100644
--- a/pyim-cregexp.el
+++ b/pyim-cregexp.el
@@ -137,9 +137,7 @@ regexp, 所以搜索单字的时候一般可以搜到生僻字,但搜索句子
   imobjs))
  

[elpa] externals/which-key 5f19ec6: Update to the newer advice API

2021-12-13 Thread ELPA Syncer
branch: externals/which-key
commit 5f19ec67f58585ab0b8fa713905243ea0de190e0
Author: Justin Burkett 
Commit: Justin Burkett 

Update to the newer advice API

Patch submitted by Stefan Monnier
---
 which-key.el | 35 ---
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/which-key.el b/which-key.el
index edbad7a..c71c741 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1,6 +1,6 @@
 ;;; which-key.el --- Display available keybindings in popup  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017  Free Software Foundation, Inc.
+;; Copyright (C) 2017-2021  Free Software Foundation, Inc.
 
 ;; Author: Justin Burkett 
 ;; Maintainer: Justin Burkett 
@@ -742,11 +742,10 @@ problems at github.")
 (defvar which-key--god-mode-key-string nil
   "Holds key string to use for god-mode support.")
 
-(defadvice god-mode-lookup-command
-(around which-key--god-mode-lookup-command-advice disable)
-  (setq which-key--god-mode-key-string (ad-get-arg 0))
+(defun which-key--god-mode-lookup-command-advice (orig-fun arg1 &rest args)
+  (setq which-key--god-mode-key-string arg1)
   (unwind-protect
-  ad-do-it
+  (apply orig-fun arg1 args)
 (when (bound-and-true-p which-key-mode)
   (which-key--hide-popup
 
@@ -758,13 +757,10 @@ disable support."
   (interactive "P")
   (setq which-key--god-mode-support-enabled (null disable))
   (if disable
-  (ad-disable-advice
-   'god-mode-lookup-command
-   'around 'which-key--god-mode-lookup-command-advice)
-(ad-enable-advice
- 'god-mode-lookup-command
- 'around 'which-key--god-mode-lookup-command-advice))
-  (ad-activate 'god-mode-lookup-command))
+  (advice-remove 'god-mode-lookup-command
+ #'which-key--god-mode-lookup-command-advice)
+(advice-add 'god-mode-lookup-command :around
+#'which-key--god-mode-lookup-command-advice)))
 
 ;;; Mode
 
@@ -796,7 +792,7 @@ disable support."
   (add-hook 'pre-command-hook #'which-key--lighter-restore))
 (add-hook 'pre-command-hook #'which-key--hide-popup)
 (add-hook 'window-size-change-functions
-  'which-key--hide-popup-on-frame-size-change)
+  #'which-key--hide-popup-on-frame-size-change)
 (which-key--start-timer))
 (setq echo-keystrokes which-key--echo-keystrokes-backup)
 (when which-key--prefix-help-cmd-backup
@@ -805,7 +801,7 @@ disable support."
   (remove-hook 'pre-command-hook #'which-key--lighter-restore))
 (remove-hook 'pre-command-hook #'which-key--hide-popup)
 (remove-hook 'window-size-change-functions
- 'which-key--hide-popup-on-frame-size-change)
+ #'which-key--hide-popup-on-frame-size-change)
 (which-key--stop-timer)))
 
 (defun which-key--init-buffer ()
@@ -1561,8 +1557,9 @@ If KEY contains any \"special keys\" defined in
 `which-key-special-key-face'."
   (let ((key-w-face (which-key--propertize key 'face 'which-key-key-face))
 (regexp (concat "\\("
-(mapconcat 'identity which-key-special-keys
-   "\\|") "\\)"))
+(mapconcat #'identity which-key-special-keys
+   "\\|")
+"\\)"))
 case-fold-search)
 (save-match-data
   (if (and which-key-special-keys
@@ -2025,7 +2022,7 @@ max-lines max-width avl-lines avl-width 
(which-key--pages-height result))
 (eval-and-compile
   (if (fboundp 'universal-argument--description)
   (defalias 'which-key--universal-argument--description
-'universal-argument--description)
+#'universal-argument--description)
 (defun which-key--universal-argument--description ()
   ;; Backport of the definition of universal-argument--description in
   ;; emacs25 on 2015-12-04
@@ -2313,7 +2310,7 @@ PREFIX should be a string suitable for `kbd'."
(which-key--create-buffer-and-show (apply #'vector key-lst)))
   (t (setq which-key--automatic-display nil)
  (which-key-show-top-level)
-(defalias 'which-key-undo 'which-key-undo-key)
+(defalias 'which-key-undo #'which-key-undo-key)
 
 (defun which-key-abort (&optional _)
   "Abort key sequence."
@@ -2474,7 +2471,7 @@ KEYMAP is selected interactively by mode in
  (intern
   (completing-read
"Minor Mode: "
-   (mapcar 'car
+   (mapcar #'car
(cl-remove-if-not
 (lambda (entry)
   (and (symbol-value (car entry))



[elpa] externals/pyim 28df36b: Add two tests about dhashcache insert word.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 28df36bb815a2c9a97c02f0b604363aa3733c15c
Author: Feng Shu 
Commit: Feng Shu 

Add two tests about dhashcache insert word.

* tests/pyim-tests.el 
(pyim-tests-pyim-dhashcache-insert-word-into-icode2word)
(pyim-tests-pyim-dhashcache-insert-word-into-ishortcode2word): New 
tests.
---
 tests/pyim-tests.el | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 2fcfcf0..42495db 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -742,6 +742,22 @@ yin-xing 因行
 (should (equal (pyim-dhashcache-get "ni-hao" '(code2word icode2word)) 
'("你好" "呢耗")))
 (should (equal (pyim-dhashcache-get "ni-hao") '("呢耗" "你好")
 
+(ert-deftest pyim-tests-pyim-dhashcache-insert-word-into-icode2word ()
+  (let ((pyim-dhashcache-icode2word (make-hash-table :test #'equal)))
+(pyim-dhashcache-insert-word-into-icode2word "你好" "ni-hao" t)
+(pyim-dhashcache-insert-word-into-icode2word "你耗" "ni-hao" t)
+(pyim-dhashcache-insert-word-into-icode2word "你豪" "ni-hao" nil)
+(should (equal (gethash "ni-hao" pyim-dhashcache-icode2word)
+   '("你耗" "你好" "你豪")
+
+(ert-deftest pyim-tests-pyim-dhashcache-insert-word-into-ishortcode2word ()
+  (let ((pyim-dhashcache-ishortcode2word (make-hash-table :test #'equal)))
+(pyim-dhashcache-insert-word-into-ishortcode2word "你好" "ni-hao" t)
+(pyim-dhashcache-insert-word-into-ishortcode2word "你慌" "ni-huang" t)
+(pyim-dhashcache-insert-word-into-ishortcode2word "你坏" "ni-huai" nil)
+(should (equal (gethash "n-h" pyim-dhashcache-ishortcode2word)
+   '("你慌" "你好" "你坏")
+
 ;; ** pyim-dregcache 相关单元测试
 (ert-deftest pyim-tests-pyim-general ()
   (let ((pyim-dcache-backend 'pyim-dregcache))



[elpa] externals/pyim 00d388e 1/6: * pyim-dcache.el (pyim-dcache-update-shortcode2word): removed.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 00d388e320be9849732b126c09f0eeede1a5d7a2
Author: Feng Shu 
Commit: Feng Shu 

* pyim-dcache.el (pyim-dcache-update-shortcode2word): removed.
---
 pyim-dcache.el | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index ef7990f..01c6ef2 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -238,13 +238,6 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   (when pyim-dcache-auto-update
 (pyim-dcache-call-api 'update-personal-words force)))
 
-(defun pyim-dcache-update-shortcode2word (&optional force)
-  "更新 shortcode2word 缓存。
-
-如果 FORCE non-nil, 则强制更新。"
-  (when pyim-dcache-auto-update
-(pyim-dcache-call-api 'update-shortcode2word force)))
-
 (defun pyim-dcache-update-iword2count (word &optional prepend 
wordcount-handler)
   "保存词频到缓存."
   (pyim-dcache-call-api 'update-iword2count word prepend wordcount-handler))



[elpa] externals/pyim 4a78f35 6/6: * pyim-dcache.el (pyim-dcache-create-dicts-md5): Simplify.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 4a78f358e6f6c036a1e0e520af3127525222a878
Author: Feng Shu 
Commit: Feng Shu 

* pyim-dcache.el (pyim-dcache-create-dicts-md5): Simplify.
---
 pyim-dcache.el | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 4223664..dbd71f4 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -216,12 +216,13 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   (pyim-dcache-call-api 'update-code2word dict-files dicts-md5 force
 
 (defun pyim-dcache-create-dicts-md5 (dict-files)
-  (let* ((version "v1") ;当需要强制更新 dict 缓存时,更改这个字符串。
- (dicts-md5 (md5 (prin1-to-string
-  (mapcar (lambda (file)
-(list version file (nth 5 (file-attributes 
file 'string
-  dict-files)
-dicts-md5))
+  "为 DICT-FILES 生成 md5 字符串。"
+  ;;当需要强制更新 dict 缓存时,更改这个字符串。
+  (let ((version "v1"))
+(md5 (prin1-to-string
+  (mapcar (lambda (file)
+(list version file (nth 5 (file-attributes file 'string
+  dict-files)
 
 (defun pyim-dcache-update-wordcount (word &optional prepend wordcount-handler)
   "保存词频到缓存."



[elpa] externals/pyim updated (28df36b -> 4a78f35)

2021-12-13 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  28df36b   Add two tests about dhashcache insert word.
   new  00d388e   * pyim-dcache.el (pyim-dcache-update-shortcode2word): 
removed.
   new  d839181   Remove pyim-dcache-update-personal-words and  
pyim-dcache-update-code2word.
   new  62077cc   * pyim-dcache.el (pyim-dcache-create-dicts-md5): removed.
   new  4b8bf15   pyim-dcache-update-iword2count -> 
pyim-dcache-update-wordcount
   new  3dd17d7   * pyim-dcache.el (pyim-dcache-upgrade): Rename from 
pyim-dcache-upgrade-icode2word.
   new  4a78f35   * pyim-dcache.el (pyim-dcache-create-dicts-md5): Simplify.


Summary of changes:
 README.org  |  2 +-
 pyim-dcache.el  | 53 ++---
 pyim-process.el |  2 +-
 tests/pyim-tests.el |  2 +-
 4 files changed, 17 insertions(+), 42 deletions(-)



[elpa] externals/pyim 4b8bf15 4/6: pyim-dcache-update-iword2count -> pyim-dcache-update-wordcount

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 4b8bf153804c6084e6a352e918aeea934c03e95e
Author: Feng Shu 
Commit: Feng Shu 

pyim-dcache-update-iword2count -> pyim-dcache-update-wordcount

* pyim-dcache.el (pyim-dcache-update-wordcount): Rename from 
pyim-dcache-update-iword2count.

* pyim-process.el (pyim-process-create-word): use 
pyim-dcache-update-wordcount.
---
 pyim-dcache.el  | 2 +-
 pyim-process.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 0165042..f4ab8dd 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -223,7 +223,7 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   dict-files)
 dicts-md5))
 
-(defun pyim-dcache-update-iword2count (word &optional prepend 
wordcount-handler)
+(defun pyim-dcache-update-wordcount (word &optional prepend wordcount-handler)
   "保存词频到缓存."
   (pyim-dcache-call-api 'update-iword2count word prepend wordcount-handler))
 
diff --git a/pyim-process.el b/pyim-process.el
index 1d3a601..f793118 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -557,7 +557,7 @@ BUG:拼音无法有效地处理多音字。"
(or criteria pyim-cstring-to-code-criteria
   ;; 保存对应词条的词频
   (when (> (length word) 0)
-(pyim-dcache-update-iword2count word prepend wordcount-handler))
+(pyim-dcache-update-wordcount word prepend wordcount-handler))
   ;; 添加词条到个人缓存
   (dolist (code codes)
 (unless (pyim-string-match-p "[^ a-z-]" code)



[elpa] externals/pyim 3dd17d7 5/6: * pyim-dcache.el (pyim-dcache-upgrade): Rename from pyim-dcache-upgrade-icode2word.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 3dd17d7d06450d900cd05d66d971797bedda2a51
Author: Feng Shu 
Commit: Feng Shu 

* pyim-dcache.el (pyim-dcache-upgrade): Rename from 
pyim-dcache-upgrade-icode2word.
---
 README.org | 2 +-
 pyim-dcache.el | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index 4fd795a..ef3e9e5 100644
--- a/README.org
+++ b/README.org
@@ -25,7 +25,7 @@ code-prefix.
 1. 五笔用户
1. 需要 (require 'pyim-wbdict), 加载五笔 scheme 设置。
2. 需要将自己的五笔词库文件中的 code-prefix "." 替换为 "wubi/".
-   3. 运行 `pyim-dcache-upgrade-icode2word' 命令,升级 icode2word 词库缓存。
+   3. 运行 `pyim-dcache-upgrade' 命令,升级 icode2word 词库缓存。
 2. 仓颉用户
1. 需要 (require 'pyim-cangjie5dict), 加载仓颉 scheme 设置。
2. 需要将自己的五笔词库文件中的 code-prefix "@" 替换为 "cangjie/".
diff --git a/pyim-dcache.el b/pyim-dcache.el
index f4ab8dd..4223664 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -241,11 +241,11 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   (pyim-dcache-call-api 'insert-word-into-ishortcode2word word code prepend))
 
 ;; ** Dcache 升级功能
-(defun pyim-dcache-upgrade-icode2word ()
-  "升级个人词库缓存.
+(defun pyim-dcache-upgrade ()
+  "升级词库缓存.
 
-主要是将个人词库中旧的 code-prefix 升级为新的 code-prefix. 用到
-scheme 中的 :code-prefix-history 信息。"
+当前已有的功能:
+1. 基于 :code-prefix-history 信息,升级为新的 code-prefix。"
   (interactive)
   (pyim-dcache-call-api 'upgrade-icode2word))
 



[elpa] externals/pyim 62077cc 3/6: * pyim-dcache.el (pyim-dcache-create-dicts-md5): removed.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit 62077ccbed357691c8a3af5488bba84ca243601c
Author: Feng Shu 
Commit: Feng Shu 

* pyim-dcache.el (pyim-dcache-create-dicts-md5): removed.
---
 pyim-dcache.el | 4 
 1 file changed, 4 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 86a1f6f..0165042 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -227,10 +227,6 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   "保存词频到缓存."
   (pyim-dcache-call-api 'update-iword2count word prepend wordcount-handler))
 
-(defun pyim-dcache-search-word-code (word)
-  "搜素中文词条 WORD 对应的 code."
-  (pyim-dcache-call-api 'search-word-code word))
-
 ;; ** Dcache 加词功能
 (defun pyim-dcache-insert-word (word code prepend)
   "将词条 WORD 插入到 dcache 中。



[elpa] externals/pyim d839181 2/6: Remove pyim-dcache-update-personal-words and pyim-dcache-update-code2word.

2021-12-13 Thread ELPA Syncer
branch: externals/pyim
commit d8391818289f035bdb79dec681ce3c4adbd0b77b
Author: Feng Shu 
Commit: Feng Shu 

Remove pyim-dcache-update-personal-words and  pyim-dcache-update-code2word.

* pyim-dcache.el (pyim-dcache-update-personal-words)
(pyim-dcache-update-code2word): removed.
---
 pyim-dcache.el  | 17 +
 tests/pyim-tests.el |  2 +-
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 01c6ef2..86a1f6f 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -206,17 +206,8 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
 
 如果 FORCE 为真,强制加载。"
   (pyim-dcache-init-variables)
-  (pyim-dcache-update-personal-words force)
-  (pyim-dcache-update-code2word force))
-
-(defun pyim-dcache-update-code2word (&optional force)
-  "读取并加载词库.
-
-读取 `pyim-dicts' 和 `pyim-extra-dicts' 里面的词库文件,生成对应的
-词库缓冲文件,然后加载词库缓存。
-
-如果 FORCE 为真,强制加载。"
   (when pyim-dcache-auto-update
+(pyim-dcache-call-api 'update-personal-words force)
 (let* ((dict-files (mapcar (lambda (x)
  (unless (plist-get x :disable)
(plist-get x :file)))
@@ -232,12 +223,6 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   dict-files)
 dicts-md5))
 
-(defun pyim-dcache-update-personal-words (&optional force)
-  "更新个人缓存词库。
-如果 FORCE non-nil, 则强制更新。"
-  (when pyim-dcache-auto-update
-(pyim-dcache-call-api 'update-personal-words force)))
-
 (defun pyim-dcache-update-iword2count (word &optional prepend 
wordcount-handler)
   "保存词频到缓存."
   (pyim-dcache-call-api 'update-iword2count word prepend wordcount-handler))
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 42495db..5824c05 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -770,7 +770,7 @@ yin-xing 因行
 words)
 (should (eq (length pyim-dregcache-cache) 0))
 ;; load dictionary
-(pyim-dcache-update-code2word t)
+(pyim-dcache-update t)
 ;; cache is filled
 (should (> (length pyim-dregcache-cache) 0))