2012-07-06 37 views

回答

2

我有辦法兩種語言之間切換:

;; You should have aspell-ru and aspell-en packages installed 
(let ((langs '("english" "russian"))) 
    (setq lang-ring (make-ring (length langs))) 
    (dolist (elem langs) (ring-insert lang-ring elem))) 
(defun cycle-ispell-languages() 
    (interactive) 
    (let ((lang (ring-ref lang-ring -1))) 
    (ring-insert lang-ring lang) 
    (ispell-change-dictionary lang))) 

(global-set-key (kbd "C-1") 'cycle-ispell-languages) 
+0

我很感激你的代碼。這是一個很好的提示,但我想自動化。每次我寫報價時,我都不想在語言之間切換。 – msampaio 2012-07-07 12:29:57

0

請嘗試swl模式從http://www.emacswiki.org/emacs/TN/#toc13。它適用於flyspell。選擇當前點位置處文本的字典。你應該適應你的需求。 語言標識符字符串(如\ selectlanguage {...})必須從行首開始。

同時我也發現下頁flyspell-babel.el:

https://tex.stackexchange.com/questions/40988/how-can-i-make-auctex-spell-check-in-the-language-specified-by-babel-and-csquote

我認爲這是更加人性化(封裝)。它不使用即時格式(jit-lock-mode)和文本屬性,因此可能會有一些性能問題。但也許,這不是問題,我太謹慎了。

相關問題