emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Guess correct dictionary for Ispell
@ 2013-11-08 22:45 Sebastien Vauban
  2013-11-09  0:39 ` Thomas S. Dye
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Vauban @ 2013-11-08 22:45 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-09  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 22:45 Guess correct dictionary for Ispell Sebastien Vauban
2013-11-09  0:39 ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).