emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Guess correct dictionary for Ispell


From: Sebastien Vauban
Subject: [O] Guess correct dictionary for Ispell
Date: Fri, 08 Nov 2013 23:45:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

Hello,

In case that can be useful for someone, here is how I detect which dictionary
to use on a file basis:

--8<---------------cut here---------------start------------->8---
  (defun my-org-switch-language ()
    "Switch language if a `#+LANGUAGE:' Org meta-tag is on top 8 lines."
    (save-excursion
      (goto-line (1+ 8))
      (let (lang
            (dico-alist '(("fr" . "francais")
                          ("en" . "american"))))
        (when (re-search-backward "#\\+LANGUAGE: +\\([[:alpha:]_]*\\)" 1 t)
          (setq lang (match-string 1))
          (ispell-change-dictionary (cdr (assoc lang dico-alist)))))))

  (add-hook 'org-mode-hook 'my-org-switch-language)
--8<---------------cut here---------------end--------------->8---

Best regards,
  Seb

-- 
Sebastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]