From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: Re: [elpa] master 785f837 6/8: hydra.el (defhydra): Use `clear-temporary-overlay-map' Date: Fri, 30 Jan 2015 21:02:11 +0100 Message-ID: <87iofoujek.fsf@gmail.com> References: <20150130161848.31066.83266@vcs.savannah.gnu.org> <874mr8166i.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422648377 27642 80.91.229.3 (30 Jan 2015 20:06:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Jan 2015 20:06:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 30 21:06:17 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YHHpY-0001Ej-4p for ged-emacs-devel@m.gmane.org; Fri, 30 Jan 2015 21:06:16 +0100 Original-Received: from localhost ([::1]:38476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHHpX-0008Nk-GJ for ged-emacs-devel@m.gmane.org; Fri, 30 Jan 2015 15:06:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHHpB-0008L8-8Y for emacs-devel@gnu.org; Fri, 30 Jan 2015 15:05:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHHp5-0004Jx-UY for emacs-devel@gnu.org; Fri, 30 Jan 2015 15:05:53 -0500 Original-Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:36385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHHp5-0004JF-OU for emacs-devel@gnu.org; Fri, 30 Jan 2015 15:05:47 -0500 Original-Received: by mail-wi0-f174.google.com with SMTP id n3so5516339wiv.1 for ; Fri, 30 Jan 2015 12:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=ogEIAwRHo4irDFPFyccJRs9W1Byw8wy3ZPCYsn+f/+U=; b=ZWLM//2eGzSS9TQDS8YvvctzKAXS1J1B/4w8el9lZSMhHDKwzrvQLRtGSSJMFqwTgM WDqRo0JpXZ1YWPeHW/d8tL8wp9Z3XKzgrNAGK3T7P/XBMIR3GfSoiYVVpnm4ulwhr6GF 38+2snKGdZFehV8G64J9uRJiVK+ZxSebEUrRqdjDRt7Ow7QWlMt062iggj53Jj63Tym5 7kY4O4+YS2cQjAPU7sC4VKPtZvQ6XodHDxGuZ49xYWqhYQWotkYYTsGE+l4CvPXwz+il WWNCdkhe0nYaxB+1z9xa8Y32CbaLmJINnWndCMO4S1nhslhfGo+svwS1MU2efWzTkyt+ WEgQ== X-Received: by 10.180.206.47 with SMTP id ll15mr980201wic.34.1422648346947; Fri, 30 Jan 2015 12:05:46 -0800 (PST) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id n6sm16326846wjy.8.2015.01.30.12.05.46 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 30 Jan 2015 12:05:46 -0800 (PST) In-Reply-To: <874mr8166i.fsf@gmail.com> (Oleh Krehel's message of "Fri, 30 Jan 2015 19:20:37 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182088 Archived-At: Oleh Krehel writes: > Stefan Monnier 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))) Oops, I see now that the change wasn't actually working. See the next fixing commit. Is there a more straightforward way to programmatically disable the effect of `set-temporary-overlay-map'? Oleh