From 000aa101c1d13db6bb6c04b8962d3c98a8e7b45c Mon Sep 17 00:00:00 2001 From: nailuoGG Date: Wed, 14 Aug 2024 23:24:41 +0800 Subject: [PATCH 1/2] Keep compatibility since Emacs has removed typo. the missing `chinse-two-byte` may broken the package https://github.com/emacs-mirror/emacs/commit/4437d730a5fff6dca61f99a146c99aefd0f67577 --- pangu-spacing.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pangu-spacing.el b/pangu-spacing.el index 4c7157a..00cb5e8 100644 --- a/pangu-spacing.el +++ b/pangu-spacing.el @@ -167,19 +167,25 @@ When you set t here, the space will be insert when you save file." ;; [Emacs-diffs] trunk r115873: Fix misspelling of 'chinese' in rx. ;; ;; Url: http://lists.gnu.org/archive/html/emacs-diffs/2014-01/msg00049.html +;; +(defun pangu-spacing-chinese-two-byte-category () + "Return the correct category name for Chinese two-byte characters." + (if (assq 'chinese-two-byte rx--categories) + "chinese-two-byte" + "chinse-two-byte")) (defvar pangu-spacing-include-regexp ;; we didn't add korean because korean-hangul-two-byte is not implemented - (rx (or (and (or (group-n 3 (any "。,!?;:「」()、")) - (group-n 1 (or (category chinse-two-byte) - (category japanese-hiragana-two-byte) - (category japanese-katakana-two-byte)))) - (group-n 2 (in "a-zA-Z0-9"))) - (and (group-n 1 (in "a-zA-Z0-9")) - (or (group-n 3 (any "。,!?;:「」()、")) - (group-n 2 (or (category chinse-two-byte) - (category japanese-hiragana-two-byte) - (category japanese-katakana-two-byte))))))) + (eval `(rx (or (and (or (group-n 3 (any "。,!?;:「」()、")) + (group-n 1 (or (category ,(intern (pangu-spacing-chinese-two-byte-category))) + (category japanese-hiragana-two-byte) + (category japanese-katakana-two-byte)))) + (group-n 2 (in "a-zA-Z0-9"))) + (and (group-n 1 (in "a-zA-Z0-9")) + (or (group-n 3 (any "。,!?;:「」()、")) + (group-n 2 (or (category ,(intern (pangu-spacing-chinese-two-byte-category))) + (category japanese-hiragana-two-byte) + (category japanese-katakana-two-byte)))))))) "Regexp to find Chinese character before English character. Group 1 contains the character before the potential pangu From 4590bd51f49f35089a7874cd1093e943efcdf97f Mon Sep 17 00:00:00 2001 From: nailuoGG Date: Wed, 18 Sep 2024 13:15:33 +0800 Subject: [PATCH 2/2] fix missing package --- pangu-spacing.el | 1 + 1 file changed, 1 insertion(+) diff --git a/pangu-spacing.el b/pangu-spacing.el index 00cb5e8..c1ca555 100644 --- a/pangu-spacing.el +++ b/pangu-spacing.el @@ -168,6 +168,7 @@ When you set t here, the space will be insert when you save file." ;; ;; Url: http://lists.gnu.org/archive/html/emacs-diffs/2014-01/msg00049.html ;; +(eval-when-compile (require 'rx)) (defun pangu-spacing-chinese-two-byte-category () "Return the correct category name for Chinese two-byte characters." (if (assq 'chinese-two-byte rx--categories)