unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] master 785f837 6/8: hydra.el (defhydra): Use `clear-temporary-overlay-map'
Date: Fri, 30 Jan 2015 19:20:37 +0100	[thread overview]
Message-ID: <874mr8166i.fsf@gmail.com> (raw)
In-Reply-To: <jwviofoi16e.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Fri, 30 Jan 2015 13:18:23 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>     hydra.el (defhydra): Use `clear-temporary-overlay-map'
>     
> Hmm... when/where is this function defined?

It's generated by legacy code in at least in Emacs 24.3.4.  Newest
Emacs doesn't have it. It's a hack, but I need the older Emacs
versions to work.  See the old code:

    (defun set-temporary-overlay-map (map &optional keep-pred)
      "Set MAP as a temporary keymap taking precedence over most other keymaps.
    Note that this does NOT take precedence over the \"overriding\" maps
    `overriding-terminal-local-map' and `overriding-local-map' (or the
    `keymap' text property).  Unlike those maps, if no match for a key is
    found in MAP, the normal key lookup sequence then continues.
    
    Normally, MAP is used only once.  If the optional argument
    KEEP-PRED is t, MAP stays active if a key from MAP is used.
    KEEP-PRED can also be a function of no arguments: if it returns
    non-nil then MAP stays active."
      (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
             (overlaysym (make-symbol "t"))
             (alist (list (cons overlaysym map)))
             (clearfun
              ;; FIXME: Use lexical-binding.
              `(lambda ()
                 (unless ,(cond ((null keep-pred) nil)
                                ((eq t keep-pred)
                                 `(eq this-command
                                      (lookup-key ',map
                                                  (this-command-keys-vector))))
                                (t `(funcall ',keep-pred)))
                   (set ',overlaysym nil)   ;Just in case.
                   (remove-hook 'pre-command-hook ',clearfunsym)
                   (setq emulation-mode-map-alists
                         (delq ',alist emulation-mode-map-alists))))))
        (set overlaysym overlaysym)
        (fset clearfunsym clearfun)
        (add-hook 'pre-command-hook clearfunsym)
        ;; FIXME: That's the keymaps with highest precedence, except for
        ;; the `keymap' text-property ;-(
        (push alist emulation-mode-map-alists)))

Oleh



  reply	other threads:[~2015-01-30 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150130161848.31066.83266@vcs.savannah.gnu.org>
     [not found] ` <E1YHEHT-00086o-LX@vcs.savannah.gnu.org>
2015-01-30 18:18   ` [elpa] master 785f837 6/8: hydra.el (defhydra): Use `clear-temporary-overlay-map' Stefan Monnier
2015-01-30 18:20     ` Oleh Krehel [this message]
2015-01-30 20:02       ` Oleh Krehel
2015-01-30 21:06       ` Stefan Monnier
2015-01-30 21:40         ` Oleh Krehel

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=874mr8166i.fsf@gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).