unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Vigouroux via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: non word abbrevs
Date: Mon, 08 Nov 2021 06:36:13 +0100	[thread overview]
Message-ID: <87v913nr8y.fsf@laposte.net> (raw)
In-Reply-To: <B6E5EBFC-D563-48C6-AF58-57206E98F954@traduction-libre.org> (Jean-Christophe Helary's message of "Sun, 7 Nov 2021 12:24:27 +0900")

Jean-Christophe Helary <lists@traduction-libre.org> writes:

>> On Nov 7, 2021, at 12:15, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
>> Not completely: the original motivation for adding that `:regexp`
>> keyword was to handle abbrevs of the form "`foo" as well as others of
>> the form "foo/bar" ;-)
>
> And the overall feature seems severely under-documented... Honestly, I barely understood your explanations...
>
> Maybe expecting to have abbrevs work way was a mistake, but it does not seem possible to have (easy...) arbitrary string expansion in out-of-the-box-emacs without abbrevs.
>
> Would there be another more idiomatic way ?
> I know about assigning key shortcuts to arbitrary string insertion,
> but that needlessly fills the keymaps with shortcuts that could be put
> to better use *and* the combination would be longer to enter than a
> normal abbrev...
>

You can insert a Unicode character with `insert-char'. This does not
shorten the typing but at least you can insert any character easily.

In word processors, you can insert these characters if they are
available in the dialog box called “Special Characters”.

>> 
>>>> You might want to `M-x report-emacs-bug` and request that this
>>>> constraint be made more flexible.
>>> I will. Thank you again.
>> 
>> In the mean time, you might be able to implement
>> a `post-self-insert-hook` which runs expands your abbrevs.
>
> Christmas in November ? :-)
>
>> You could start with something like:
>> 
>>    (add-hook 'post-self-insert-hook #'my-expand-arrow-abbrevs)
>>    (defun my-expand-arrow-abbrevs ()
>>      (if (memq (char-before) '(?= ?< ?-))
>>          (expand-abbrev)))
>
> I'll try that and will report. Thank you !

-- 
Best regards,
Kevin Vigouroux



  parent reply	other threads:[~2021-11-08  5:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31  5:45 non word abbrevs Jean-Christophe Helary
2021-10-31 19:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-01  7:57   ` Jean-Christophe Helary
2021-11-01 10:54     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-01 12:03     ` Stefan Monnier
2021-11-01 12:13       ` Jean-Christophe Helary
2021-11-01 12:43         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-01 13:17           ` Jean-Christophe Helary
2021-11-01 13:49             ` Leo Butler
2021-11-01 14:03             ` tomas
2021-11-01 17:58             ` Stefan Monnier
2021-11-06  8:20         ` Jean-Christophe Helary
2021-11-06 22:32           ` Stefan Monnier
2021-11-07  0:01             ` Jean-Christophe Helary
2021-11-07  3:15               ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-07  3:24                 ` Jean-Christophe Helary
2021-11-07  4:11                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-08  5:36                   ` Kevin Vigouroux via Users list for the GNU Emacs text editor [this message]
2021-11-08  7:18                     ` Jean-Christophe Helary
2021-11-08 23:29                       ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-07  4:06                 ` Emanuel Berg via Users list for the GNU Emacs text editor

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=87v913nr8y.fsf@laposte.net \
    --to=help-gnu-emacs@gnu.org \
    --cc=ke.vigouroux@laposte.net \
    /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.
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).