From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-devel@gnu.org
Subject: Re: did the abbrev mechanism ever expand «two words» to «two different words».
Date: Fri, 08 Jan 2021 19:48:18 +0100 [thread overview]
Message-ID: <87eeivb6z1.fsf@mat.ucm.es> (raw)
In-Reply-To: 87eeivz4mg.fsf@gmail.com
[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]
>>> "RP" == Robert Pluim <rpluim@gmail.com> writes:
> 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+\\)
This is indeed what I tried.
> 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))
Thanks where is the setq line supposed to be? Most likely in the file
in question which is in fundamental mode?
Not in the .abbrev_devs file?
I tried the former and it works! May thanks.
I might need to edit my abbrev times from time to time but that is ok
and it might be a hassle in mail modes, but better than nothing.
> (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')
Maybe some other developer has an idea?
In any case, I think it would be very useful to add some of the stuff
Robert told me to the documentation, which is a bit sparse, I'd say.
Thanks and regards
Uwe
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
next prev parent reply other threads:[~2021-01-08 18:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 20:10 did the abbrev mechanism ever expand «two words» to «two different words» Uwe Brauer
2021-01-07 20:15 ` Eli Zaretskii
2021-01-07 20:29 ` Uwe Brauer
2021-01-07 20:36 ` Stefan Monnier
2021-01-07 20:40 ` Eli Zaretskii
2021-01-08 8:20 ` Uwe Brauer
2021-01-08 10:55 ` Robert Pluim
2021-01-08 13:28 ` Uwe Brauer
2021-01-08 14:05 ` Robert Pluim
2021-01-08 15:23 ` Uwe Brauer
2021-01-08 18:05 ` Robert Pluim
2021-01-08 18:48 ` Uwe Brauer [this message]
2021-01-08 20:29 ` Stefan Monnier
2021-01-08 21:06 ` Uwe Brauer
2021-01-09 12:14 ` Eric S Fraga
2021-01-09 13:39 ` Uwe Brauer
2021-01-09 13:42 ` [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 6:37 ` did the abbrev mechanism ever expand «two words» to «two different words» Richard Stallman
2021-01-09 8:11 ` [adding abbrev using two-word-expansions] (was: did the abbrev mechanism ever expand «two words» to «two different words».) Uwe Brauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eeivb6z1.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).