unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Zhu Zihao <all_but_last@163.com>
Cc: 44328@debbugs.gnu.org
Subject: bug#44328: 27.1; [PATCH] Add expand-abbrev-maybe condition key binding
Date: Thu, 13 May 2021 13:25:52 +0200	[thread overview]
Message-ID: <87zgwyq3i7.fsf@gnus.org> (raw)
In-Reply-To: <86eelbaw8b.fsf@163.com> (Zhu Zihao's message of "Tue, 03 Nov 2020 12:40:52 +0800")

Zhu Zihao <all_but_last@163.com> writes:

> And I define a abbrev "lb" in Elisp mode. then enable minor mode
> my-override-map in Elisp mode. If my cursor is following "lb"(like
> "lb|"), it will expand the abbrev, otherwise it will execute eww.
>
> Now I change the key binding of C-' in global map(change to gnus). the
> behaviour of keybinding in my-override-map will become "Expand abbrev if
> possible otherwise execute gnus" 

Ah, I understand what you mean now -- you want a key that's normally
bound to a different command, but if it's after an abbreviation, it
should expand the abbreviation instead.

Yes, that menu trick does work for that use case, but you could also use
a command like:

(defun my-expand ()
  (interactive)
  (if (abbrev--before-point)
      (expand-abbrev)
    (call-interactively
     (lookup-key (delq my-override-map (current-active-maps))
		 (this-command-keys)))))

In any case, I don't think these sort of "chained" keystrokes are very
common -- I think most users would find them somewhat confusing, so I
don't think adding something like this to Emacs would be appropriate.
So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





      reply	other threads:[~2021-05-13 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 14:32 bug#44328: 27.1; [PATCH] Add expand-abbrev-maybe condition key binding Zhu Zihao
2020-11-01 14:25 ` Lars Ingebrigtsen
2020-11-02  5:41   ` bug#44328: " Zhu Zihao
2020-11-02 15:30     ` Lars Ingebrigtsen
2020-11-03  4:40       ` Zhu Zihao
2021-05-13 11:25         ` Lars Ingebrigtsen [this message]

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=87zgwyq3i7.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=44328@debbugs.gnu.org \
    --cc=all_but_last@163.com \
    /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).