[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: did the abbrev mechanism ever expand «two words» to «two different w
From: |
Robert Pluim |
Subject: |
Re: did the abbrev mechanism ever expand «two words» to «two different words». |
Date: |
Fri, 08 Jan 2021 19:05:11 +0100 |
Uwe Brauer <oub@mat.ucm.es> writes:
> Right, thanks, however good and bad news.
>
>
> I am using
>
> (define-abbrev-table 'fundamental-mode-abbrev-table
> '(
> ("a que" "a qué" nil :count 0)
> ("asi" "así" nil :count 0))
> "Uwe's table"
> :regexp "\\(\\w+ \\w+\\)")
>
>
> 1. It works in the sense that "a que" is expanded to "a qué"
>
> 2. But now asi is *not* expanded to así
>
> The reasons seems to me that what you did is globally for the whole
> table, while I hoped it could be done locally for each entry.
>
Thatʼs not the way abbrev tables work: the regexp answers the question
"which characters before point do I use to lookup abbrevs in this
table?". That can't be both two words separated by a space and a
single word at the same time, ie using
"\\(\\w+ \\w+\\)\\|\\(w+\\)
will fail, since that will match the 'two word' version if thereʼs a
space on the line, so in order to get what you want you need two
abbrev tables:
(define-abbrev-table 'fundamental-mode-abbrev-table
'(
("asi" "así" nil :count 0)))
(define-abbrev-table 'my-abbrev-table
'(
("a que" "a qué" nil :count 0))
"Uwe's table"
:regexp "\\(\\w+ \\w+\\)")
(setq local-abbrev-table (list my-abbrev-table
fundamental-mode-abbrev-table))
(thereʼs a ':parents' property you can set on an abbrev table to achieve
the same thing, in theory, but I donʼt know how that interacts with
':regexp')
Robert
- did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/07
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Eli Zaretskii, 2021/01/07
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/07
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Stefan Monnier, 2021/01/07
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Eli Zaretskii, 2021/01/07
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Robert Pluim, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Robert Pluim, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words».,
Robert Pluim <=
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Stefan Monnier, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/08
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Eric S Fraga, 2021/01/09
- Re: did the abbrev mechanism ever expand «two words» to «two different words»., Uwe Brauer, 2021/01/09
- [BUG? write-abbrev-file destroys this construction] (was: did the abbrev mechanism ever expand «two words» to «two different words».), Uwe Brauer, 2021/01/09
Re: did the abbrev mechanism ever expand «two words» to «two different words»., Richard Stallman, 2021/01/09