emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Update ispell-dictionary to text language
@ 2010-01-11 11:27 Sébastien Vauban
  2010-01-11 15:31 ` Benjamin Andresen
  2010-02-21  8:25 ` Carsten Dominik
  0 siblings, 2 replies; 7+ messages in thread
From: Sébastien Vauban @ 2010-01-11 11:27 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Here my proposal (and my very first self-written chunk of ELisp code) for
switching to the right language for ispell, upon reading the contents of the
meta-tag `LANGUAGE'.

--8<---------------cut here---------------start------------->8---
  (defun org-switch-language ()
    "Switch language for Org file, if a `#+LANGUAGE:' meta-tag is on top 14 lines."
    (save-excursion
      (goto-line 15)
      (if (re-search-backward "#\\+LANGUAGE: +\\([A-Za-z_]*\\)" 1 t)
          (ispell-change-dictionary (match-string 1)))))
--8<---------------cut here---------------end--------------->8---

That should be hooked, such in:

--8<---------------cut here---------------start------------->8---
  (add-hook 'org-mode-hook
            (lambda ()
              ;; file modification date
              (set (make-local-variable 'time-stamp-format) "%:y-%02m-%02d")
              (set (make-local-variable 'time-stamp-start) "^#\\+DATE: +")
              (set (make-local-variable 'time-stamp-end) "$")

              ;; guess language
              (org-switch-language)

              ;; flyspell mode to spell check everywhere
              (flyspell-mode 1)))
--8<---------------cut here---------------end--------------->8---

Maybe that could become a default in Org. I think that makes sense.

Comments are (more than) welcome...

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Update ispell-dictionary to text language
  2010-01-11 11:27 Update ispell-dictionary to text language Sébastien Vauban
@ 2010-01-11 15:31 ` Benjamin Andresen
  2010-01-13 10:20   ` Sébastien Vauban
  2010-02-21  8:25 ` Carsten Dominik
  1 sibling, 1 reply; 7+ messages in thread
From: Benjamin Andresen @ 2010-01-11 15:31 UTC (permalink / raw)
  To: emacs-orgmode

Hey Sébastien,

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hello,
>
> Here my proposal (and my very first self-written chunk of ELisp code) for
> switching to the right language for ispell, upon reading the contents of the
> meta-tag `LANGUAGE'.

I think using File Variables are better for this. For no particular
reason except they are standardized and don't require any additional
code in Org Mode.
(info "(emacs)Specifying File Variables")
# -*- ispell-local-dictionary: "german" -*-

> Best regards,
>   Seb

br,
benny

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

* Re: Update ispell-dictionary to text language
  2010-01-11 15:31 ` Benjamin Andresen
@ 2010-01-13 10:20   ` Sébastien Vauban
  2010-01-15  7:14     ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-01-13 10:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Benjamin,

Benjamin Andresen wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>
>> Here my proposal (and my very first self-written chunk of ELisp code) for
>> switching to the right language for ispell, upon reading the contents of
>> the meta-tag `LANGUAGE'.
>
> I think using File Variables are better for this. For no particular reason
> except they are standardized and don't require any additional code in Org
> Mode.
> (info "(emacs)Specifying File Variables")
> # -*- ispell-local-dictionary: "german" -*-

I know them, even use them in directories (see `.dir-locals.el'), instead of
files.

--8<---------------cut here---------------start------------->8---
((org-mode . ((ispell-local-dictionary . "american")
              (time-stamp-format . "%:y-%02m-%02d")
              (time-stamp-start . "^#\\+DATE: +")
              (time-stamp-end . "$"))))
--8<---------------cut here---------------end--------------->8---

BUT there is a *language specification* in the Org template:

--8<---------------cut here---------------start------------->8---
#+TITLE:     Scorpios.org
#+AUTHOR:    Seb Vauban
#+EMAIL:     no-LMehjL4SQ+Y@public.gmane.org
#+DATE:      2010-01-13 Wed
#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en
--8<---------------cut here---------------end--------------->8---
             ^^

AND it is *used by Org* (at least for the HTML export, and for LaTeX as well I
think -- or, in any case, it should use it).

Thus, I try to avoid declaring which language is used in the buffer at two
different spots, because we can change one and forget to change the other.

Therefore, I would like to keep only one language declaration (the one of the
Org template, in this case), and get Emacs follow it.

Does this make sense?

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Update ispell-dictionary to text language
  2010-01-13 10:20   ` Sébastien Vauban
@ 2010-01-15  7:14     ` Carsten Dominik
  2010-01-15  8:55       ` Sébastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2010-01-15  7:14 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

I have seen this thread and I am still contemplating what
to do with it.  More input and opinions would be welcome.

- Carsten

On Jan 13, 2010, at 11:20 AM, Sébastien Vauban wrote:

> Hi Benjamin,
>
> Benjamin Andresen wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>>
>>> Here my proposal (and my very first self-written chunk of ELisp  
>>> code) for
>>> switching to the right language for ispell, upon reading the  
>>> contents of
>>> the meta-tag `LANGUAGE'.
>>
>> I think using File Variables are better for this. For no particular  
>> reason
>> except they are standardized and don't require any additional code  
>> in Org
>> Mode.
>> (info "(emacs)Specifying File Variables")
>> # -*- ispell-local-dictionary: "german" -*-
>
> I know them, even use them in directories (see `.dir-locals.el'),  
> instead of
> files.
>
> --8<---------------cut here---------------start------------->8---
> ((org-mode . ((ispell-local-dictionary . "american")
>              (time-stamp-format . "%:y-%02m-%02d")
>              (time-stamp-start . "^#\\+DATE: +")
>              (time-stamp-end . "$"))))
> --8<---------------cut here---------------end--------------->8---
>
> BUT there is a *language specification* in the Org template:
>
> --8<---------------cut here---------------start------------->8---
> #+TITLE:     Scorpios.org
> #+AUTHOR:    Seb Vauban
> #+EMAIL:     no@one.com
> #+DATE:      2010-01-13 Wed
> #+DESCRIPTION:
> #+KEYWORDS:
> #+LANGUAGE:  en
> --8<---------------cut here---------------end--------------->8---
>             ^^
>
> AND it is *used by Org* (at least for the HTML export, and for LaTeX  
> as well I
> think -- or, in any case, it should use it).
>
> Thus, I try to avoid declaring which language is used in the buffer  
> at two
> different spots, because we can change one and forget to change the  
> other.
>
> Therefore, I would like to keep only one language declaration (the  
> one of the
> Org template, in this case), and get Emacs follow it.
>
> Does this make sense?
>
> Best regards,
>  Seb
>
> -- 
> Sébastien Vauban
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: Update ispell-dictionary to text language
  2010-01-15  7:14     ` Carsten Dominik
@ 2010-01-15  8:55       ` Sébastien Vauban
  2010-01-15 10:22         ` Torsten Wagner
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-01-15  8:55 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Carsten,

Carsten Dominik wrote:
> On Jan 13, 2010, at 11:20 AM, Sébastien Vauban wrote:
>> Benjamin Andresen wrote:
>>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>>>
>>>> Here my proposal (and my very first self-written chunk of ELisp code) for
>>>> switching to the right language for ispell, upon reading the contents of
>>>> the meta-tag `LANGUAGE'.
>>>
>>> I think using File Variables are better for this. For no particular reason
>>> except they are standardized and don't require any additional code in Org
>>> Mode.
>>> (info "(emacs)Specifying File Variables")
>>> # -*- ispell-local-dictionary: "german" -*-
>>
>> I know them [...] BUT there is a *language specification* in the Org
>> template [...] AND it is *used by Org* (at least for the HTML export, and
>> for LaTeX as well I think -- or, in any case, it should use it).
>>
>> Thus, I try to avoid declaring which language is used in the buffer at two
>> different spots, because we can change one and forget to change the other.
>>
>> Therefore, I would like to keep only one language declaration (the one of
>> the Org template, in this case), and get Emacs follow it.
>>
>> Does this make sense?
>
> I have seen this thread and I am still contemplating what
> to do with it.

My arguments are:

- We have a language specification in the Org template
- That should be used during the export to HTML (DONE)
- That should be used during the export to LaTeX (TODO)
- That should be used for editing the buffer in the right language (TODO/DONE,
  see my proposal)

I'm quite against /mixing language declarations/:
- in the Org template *and*
- in buffer local variables.

Of course, we could imagine the other way around: using the value of
`ispell-local-dictionary' for the 3 objectives (edition in correct language,
correct setting for generated HTML, correct setting for generated LaTeX). It'd
be as good for me.


> More input and opinions would be welcome.

So do I!  ;-)

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Update ispell-dictionary to text language
  2010-01-15  8:55       ` Sébastien Vauban
@ 2010-01-15 10:22         ` Torsten Wagner
  0 siblings, 0 replies; 7+ messages in thread
From: Torsten Wagner @ 2010-01-15 10:22 UTC (permalink / raw)
  To: emacs-orgmode

Hi Seb,
Hi Carsten,

I guess it depends highly on the definition. I can see Sebastien's points. It 
is somewhat strange to have a header-row "language" which does not have 
anything to do with the way how org-mode (resp. emacs) handels the org-buffer.
And the danger to use two different places + the confusion of two slightly 
different styles may confuse esp. newbies like me.

However, on the other side, it is said that C-c C-e t "insert the *export* 
option template". Which strongly refer to export features.

I guess it would be more clear if there is a #+EXPORT_LANGUAGE tag.
But to change this now is stupid as well. 

So not right sure what to do. 
Maybe leave it to people and offer a flag to say in the org config something like 
export_language is equal to ispell_language (maybe working both directions) 

Just two newbie-cents

Totti

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

* Re: Update ispell-dictionary to text language
  2010-01-11 11:27 Update ispell-dictionary to text language Sébastien Vauban
  2010-01-11 15:31 ` Benjamin Andresen
@ 2010-02-21  8:25 ` Carsten Dominik
  1 sibling, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2010-02-21  8:25 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hi everyone,

in the end I decided to not do this change.  I am uncomfortable to  
link these different areas in Emacs in a way that is fixed.

Maybe you want to post your code in org-hacks.php on Worg.... ?

- Carsten

On Jan 11, 2010, at 12:27 PM, Sébastien Vauban wrote:

> Hello,
>
> Here my proposal (and my very first self-written chunk of ELisp  
> code) for
> switching to the right language for ispell, upon reading the  
> contents of the
> meta-tag `LANGUAGE'.
>
> --8<---------------cut here---------------start------------->8---
>  (defun org-switch-language ()
>    "Switch language for Org file, if a `#+LANGUAGE:' meta-tag is on  
> top 14 lines."
>    (save-excursion
>      (goto-line 15)
>      (if (re-search-backward "#\\+LANGUAGE: +\\([A-Za-z_]*\\)" 1 t)
>          (ispell-change-dictionary (match-string 1)))))
> --8<---------------cut here---------------end--------------->8---
>
> That should be hooked, such in:
>
> --8<---------------cut here---------------start------------->8---
>  (add-hook 'org-mode-hook
>            (lambda ()
>              ;; file modification date
>              (set (make-local-variable 'time-stamp-format) "%:y-%02m- 
> %02d")
>              (set (make-local-variable 'time-stamp-start) "^#\\ 
> +DATE: +")
>              (set (make-local-variable 'time-stamp-end) "$")
>
>              ;; guess language
>              (org-switch-language)
>
>              ;; flyspell mode to spell check everywhere
>              (flyspell-mode 1)))
> --8<---------------cut here---------------end--------------->8---
>
> Maybe that could become a default in Org. I think that makes sense.
>
> Comments are (more than) welcome...
>
> Best regards,
>  Seb
>
> -- 
> Sébastien Vauban
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-02-21  8:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 11:27 Update ispell-dictionary to text language Sébastien Vauban
2010-01-11 15:31 ` Benjamin Andresen
2010-01-13 10:20   ` Sébastien Vauban
2010-01-15  7:14     ` Carsten Dominik
2010-01-15  8:55       ` Sébastien Vauban
2010-01-15 10:22         ` Torsten Wagner
2010-02-21  8:25 ` Carsten Dominik

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).