[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set dictionary for a file
From: |
Fabian Braennstroem |
Subject: |
Re: set dictionary for a file |
Date: |
Thu, 13 Oct 2005 04:40:44 +0000 (UTC) |
User-agent: |
slrn/0.9.8.1/rt (Linux) |
Hi Kevin,
thanks for the tips!
On 2005-10-12, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> Fabian Braennstroem wrote:
> > I would like to set/change dictionary for certain files,
> > which I would declare in .emacs. I tried the
> > ispell-multi.el, but it somehow didn't work for me. In my
> > Gnus I had
> >
> > (add-hook 'gnus-select-group-hook
> > (lambda ()
> > (cond
> > ((string-match
> > "^de\\." (gnus-group-real-name gnus-newsgroup-name))
> > (ispell-change-dictionary "deutsch8"))
> >
> > which worked a while ago.
>
> Here's what ispell.el itself says:
>
> ;; Buffer-Local features:
> ;; There are a number of buffer-local features that can be used to customize
> ;; ispell for the current buffer. This includes language dictionaries,
> ;; personal dictionaries, parsing, and local word spellings. Each of these
> ;; local customizations are done either through local variables, or by
> ;; including the keyword and argument(s) at the end of the buffer (usually
> ;; prefixed by the comment characters). See the end of this file for
> ;; examples. The local keywords and variables are:
>
> ;; ispell-dictionary-keyword language-dictionary
> ;; uses local variable ispell-local-dictionary
> ;; ispell-pdict-keyword personal-dictionary
> ;; uses local variable ispell-local-pdict
> ;; ispell-parsing-keyword mode-arg extended-char-arg
> ;; ispell-words-keyword any number of local word spellings
>
> And:
>
> ,----[ C-h v ispell-local-dictionary RET ]
> | ispell-local-dictionary's value is nil
> |
> | Documentation:
> | If non-nil, the dictionary to be used for Ispell commands.
> | The value must be a string dictionary name in `ispell-dictionary-alist'.
> | This variable becomes buffer-local when set in any fashion.
> |
> | Setting `ispell-local-dictionary' to a value has the same effect as
> | calling M-x ispell-change-dictionary with that value. This variable
> | is automatically set when defined in the file with either
> | `ispell-dictionary-keyword' or the Local Variable syntax.
> |
> | To create a non-standard default dictionary (not from
> `ispell-dictionary-alist')
> | call function `set-default' with the new dictionary name.
> |
> | You can customize this variable.
> |
> | Defined in `ispell'.
> `----
>
> So try (setq ispell-local-dictionary "deutsch8") in your hook.
>
> > Does something similar (file-load-hook?) exist for ordinary files?
>
> ,----[ C-h v find-file-hooks RET ]
> | find-file-hooks's value is
> | (vc-find-file-hook)
> |
> |
> | Documentation:
> | List of functions to be called after a buffer is loaded from a file.
> | The buffer's local variables (if any) will have been processed before the
> | functions are called.
> |
> | Defined in `files'.
> `----
I am not sure, if I understood that correctly. Customizing
the find-file-hook I get a list of functions which are
called when a buffer gets loaded; e.g. vc-find-file-hook
gets loaded. So something like could work when I open
'test.tex':
(add-hook 'vc-find-file-hook
(lambda ()
(cond
((string-match "test.tex" )
(setq ispell-local-dictionary "deutsch8")))))
Somehow it doesn't work!?
Now,I just tried to use:
(if (eq buffer-file-name "article.tex" )
(setq ispell-local-dictionary "deutsch8"))
which doesn't work either!?
Greetings!
Fabian