GNU bug report logs - #44328
27.1; [PATCH] Add expand-abbrev-maybe condition key binding

Previous Next

Package: emacs;

Reported by: Zhu Zihao <all_but_last <at> 163.com>

Date: Fri, 30 Oct 2020 14:49:02 UTC

Severity: normal

Tags: patch, wontfix

Found in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Zhu Zihao <all_but_last <at> 163.com>
Cc: 44328 <at> 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
Zhu Zihao <all_but_last <at> 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




This bug report was last modified 4 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.