emacs-humanities
[Top][All Lists]
Advanced

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

Re: [emacs-humanities] electric-pair and non-breakable spaces


From: l@tlo
Subject: Re: [emacs-humanities] electric-pair and non-breakable spaces
Date: Sun, 28 May 2023 12:16:19 +0900

Thank you for the thoughtful reply!

> On May 28, 2023, at 12:00, Ruijie Yu <ruijie@netyu.xyz> wrote:
> 
> 
> "l@tlo" <lists@traduction-libre.org> writes:
> 
>> Hi there !
>> 
>> Right in the middle of finishing my MA thesis in org-mode, I'm trying to fix 
>> the electric-pair mode default that inserts «» without the required 
>> non-breakable spaces that we have in French.
>> 
>> The customize buffer tells me that the fields must contain only one 
>> character, respectively « and », and so, I'm stuck...
>> 
>> Any idea how to fix that?
> 
> Looked into the source of electric a bit and did a test edebug run, it
> seems that the single-character logic is embedded deep inside the code,
> and maybe the easiest way for your use case is to add a hook _after_
> `electric-pair-post-self-insert-function'.
> 
> Or even better, make a minor mode that adds this hook for the user.  In
> this case, this code can then be published to an Elpa repository if
> there's interest.
> 
> If, however, you (or someone else) are interested in changing
> electric.el and elec-pair.el for this purpose, take a look at
> `electric-pair-post-self-insert-function' and `electric-pair--insert',
> which is where the insertion of the closing pairs is actually
> implemented.
> 
> Just so that we are on the same page, (since I haven't revisited French
> for a few years and have never used « » in proper French contexts,)
> where should the non-break space be?  Is it « text », or is it  «text» 
> , or something else?

« text »

The nbsp type depends on the locale (France/Canada/etc.) but it is an nbsp.

> (And while you are at it, as I noticed that you have a space before the
> exclamation mark, some further insights about spacings in French with
> other punctuations would be more than welcome. :) )

Indeed. All the French "double" punctuation marks are preceded by a similar 
nbsp.

! ? ; :

The extra spaces can be added by my external spell/typo checker, but since I'm 
at it, I'd be happy to have a solution that works for French.

-- 
Jean-Christophe Helary @jchelary@emacs.ch
https://traductaire-libre.org
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




reply via email to

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