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: Ruijie Yu
Subject: Re: [emacs-humanities] electric-pair and non-breakable spaces
Date: Sun, 28 May 2023 11:00:41 +0800
User-agent: mu4e 1.9.22; emacs 30.0.50

"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?

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

-- 
Best,


RY



reply via email to

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