From 03212a8b64c53e125f484090435871b14356381a Mon Sep 17 00:00:00 2001 From: lemyx Date: Tue, 21 Jan 2025 21:48:57 +0800 Subject: [PATCH] Support rime-disable-predicates for emacs-rime --- install/install-macos.sh | 4 ++-- lisp/init-rime.el | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/install/install-macos.sh b/install/install-macos.sh index b6c1132..a7c7818 100644 --- a/install/install-macos.sh +++ b/install/install-macos.sh @@ -19,7 +19,7 @@ brew services restart d12frosted/emacs-plus/emacs-plus@29 osascript -e 'tell application "Finder" to make alias file to posix file "/opt/homebrew/opt/emacs-plus@29/Emacs.app" at POSIX file "/Applications" with properties {name:"Emacs.app"}' # fonts -brew tap laishulu/cask-fonts +brew tap laishulu/homebrew brew install --cask font-sarasa-nerd brew install --cask font-symbols-only-nerd-font @@ -58,7 +58,7 @@ cp -r ./rime-ice/* ~/Library/Rime rm -rf rime-ice brew install --cask switchkey -# pomodoro +# org-pomodoro brew install terminal-notifier # fetch submodules diff --git a/lisp/init-rime.el b/lisp/init-rime.el index 1eae096..89a8533 100644 --- a/lisp/init-rime.el +++ b/lisp/init-rime.el @@ -5,13 +5,37 @@ (use-package rime :ensure t + :custom + (default-input-method 'rime) :config - (setq default-input-method "rime") (setq rime-user-data-dir "~/.config/fcitx/rime") (setq rime-show-candidate 'posframe) (when (eq system-type 'darwin) (setq rime-emacs-module-header-root "/opt/homebrew/include") (setq rime-librime-root "/opt/homebrew/opt/librime")) + ; 临时英文模式 + (setq rime-disable-predicates + '(meow-motion-mode-p + meow-normal-mode-p + meow-keypad-mode-p + ; 在英文字符串之后, 必须以字母开头的英文字符串 + rime-predicate-after-alphabet-char-p + ; 在 prog-mode 和 conf-mode 中除注释和引号内字符串之外的区域 + rime-predicate-prog-in-code-p + ; 激活 ace-window + rime-predicate-ace-window-p + ; 当要输入的是符号时 + rime-predicate-current-input-punctuation-p + ; 在中文字符且有空格之后 + rime-predicate-space-after-cc-p + ; 将要输入的是大写字母时 + rime-predicate-current-uppercase-letter-p + ; 在 LaTeX 数学环境中或者输入 LaTeX 命令时 + rime-predicate-tex-math-or-command-p + ) + ) + ; 强制中文模式, 无视 rime-disable-predicates 中的规则 + (define-key rime-mode-map (kbd "M-j") 'rime-force-enable) ) (provide 'init-rime)