From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29599: 26.0; `dframe.el' binds keys unconditionally when loaded Date: Mon, 18 Dec 2017 20:40:05 -0500 Message-ID: <878tdzbimi.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1513647558 5567 195.159.176.226 (19 Dec 2017 01:39:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 19 Dec 2017 01:39:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29599@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 19 02:39:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eR6sC-0000ta-45 for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Dec 2017 02:39:12 +0100 Original-Received: from localhost ([::1]:34769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR6uA-0002CE-78 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Dec 2017 20:41:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR6u2-0002BU-KD for bug-gnu-emacs@gnu.org; Mon, 18 Dec 2017 20:41:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eR6ty-0000XK-H8 for bug-gnu-emacs@gnu.org; Mon, 18 Dec 2017 20:41:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eR6ty-0000XB-Ao for bug-gnu-emacs@gnu.org; Mon, 18 Dec 2017 20:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eR6tx-0003DN-UK for bug-gnu-emacs@gnu.org; Mon, 18 Dec 2017 20:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Dec 2017 01:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29599 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29599-submit@debbugs.gnu.org id=B29599.151364761712296 (code B ref 29599); Tue, 19 Dec 2017 01:41:01 +0000 Original-Received: (at 29599) by debbugs.gnu.org; 19 Dec 2017 01:40:17 +0000 Original-Received: from localhost ([127.0.0.1]:40968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eR6tE-0003CF-Ol for submit@debbugs.gnu.org; Mon, 18 Dec 2017 20:40:16 -0500 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:45388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eR6tB-0003Bz-QH for 29599@debbugs.gnu.org; Mon, 18 Dec 2017 20:40:14 -0500 Original-Received: by mail-it0-f43.google.com with SMTP id z6so924659iti.4 for <29599@debbugs.gnu.org>; Mon, 18 Dec 2017 17:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XSAYCpR7YE1iAIiFkdhtkF4wg/dF4dZstorY6biFwzI=; b=KCnpz6Ikj8XXmWVpcQ0YtaOSlGJpkAAz8BhC5jdntG0T0p7xzYIqK1yf1EAWQnCTpE NqTzWMRulO7u4wrNycLPSIX95qH1Nr4ZcwR1RISUUwW8SqsbRqlrDQ8MherC0fm8L5si U3cgms4itgLYJcC3y/HzM3yidFPJdG9lkEHZnvuaMQwxhcAUZcmm5xw9Q/N7Qr/1X5aE mV5RrlNy8tNX34fW+9/I/6K65cn0iLoBuQ6v4pZimmppj5TqgsyV5WKXKbTz8BtyZU+F coCXV82DPpkabDe3KZj+gIStCm1ujn2peTQyvSfwcnw9nnJqbseBb24FIyKE2qNo3Z6j ccGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=XSAYCpR7YE1iAIiFkdhtkF4wg/dF4dZstorY6biFwzI=; b=W9oNBoFe28hB5MKvlcgg+YCZenidq5U08GgSZ8cEmpPOWuMve7KjLniyfrXQBFvuYu uAAmWHOeceuWaS6qo2SgslnhQZhoqOWPGHmKHqDKOsjK/vVesKB+uFNUs7FBJJxNPrl8 PjCQPlq2GkxUSSjFjt4c28Zu2rwbFnqKV+bKTwZM7WrshXrPlCI4Qj6yRL3og0Zt9bRV 4NDb7I23PX3HnrGgnhUuN0vkCPOkAFpzM3qz2g9gj2CO8OIMuXaakUn4x/2yg0FA5OBT wMbBX7BMZLxDOxVYmggDbZkqUKsRTE6ojiihuMC/JvLJd8a4GUJr0UUPIdBw6lm8LaXa G5Bg== X-Gm-Message-State: AKGB3mKSeowTeNp9PcyXgDlfa4bMcqkbU9Zt8BIgVXiCOglAlwYdr2+L vVPWmWk2H+CY/HuG1iHVqwM9dQ== X-Google-Smtp-Source: ACJfBouvNadAbcUJIMFdq1WuDN52ezVzzAPc5/UBEJthmQJ6ni1SgaRNx8KKLHoGwfkZzG8hLQ4v3A== X-Received: by 10.36.1.4 with SMTP id 4mr1316473itk.59.1513647607714; Mon, 18 Dec 2017 17:40:07 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 202sm7061642iou.72.2017.12.18.17.40.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 17:40:06 -0800 (PST) In-Reply-To: (Drew Adams's message of "Wed, 6 Dec 2017 22:10:52 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141238 Archived-At: --=-=-= Content-Type: text/plain Drew Adams writes: > I must have done something after my init file was loaded that required > `dframe.elc' to be loaded, and that load overwrote bindings I made in my > init file. > > I don't know what I did that caused dframe to be loaded, but that > shouldn't matter. I don't think it should overwrite key bindings > just by being loaded. Yeah (it's probably the loading-on-completion thing again). > Shouldn't dframe.el bind its own commands to `special-event-map' keys > only if those keys are not already bound? > I don't know what it's doing or why, but this doesn't seem very polite > of it. Why should it think that just by being loaded it should > (re-)bind keys? The root problem is that there is no easy way to share the bindings. I think those keys should be bound to a function which calls runs a hook, like focus-in and focus-out events are. Actually, it sort of looks like dframe is trying to install such a hook; the functions it puts don't do anything except call `dframe-make-frame-{visible,iconify,delete}-function'. Anyway, at a minimum, we can't have keybindings being modified by just a load. Here's a patch which moves the keybinding to dframe-frame-mode activation instead. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-bind-dframe-events-on-load-Bug-29599.patch Content-Description: patch >From e7965c6f4f9dcce7f38ab9a51cd2638d5feb5c66 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 18 Dec 2017 20:30:10 -0500 Subject: [PATCH] Don't bind dframe events on load (Bug#29599) * lisp/dframe.el (dframe-set-special-events): New function, containing previous top-level key binding code. (dframe-frame-mode): Use it. --- lisp/dframe.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lisp/dframe.el b/lisp/dframe.el index 7f77d8991f..0766bd068d 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -288,6 +288,7 @@ dframe-frame-mode (set frame-var nil)) ;; Set this as our currently attached frame (setq dframe-attached-frame (selected-frame)) + (dframe-set-special-events) (run-hooks popup-hook) ;; Updated the buffer passed in to contain all the hacks needed ;; to make it work well in a dedicated window. @@ -543,16 +544,14 @@ dframe-detach ))) ;;; Special frame event proxies -;; -(if (boundp 'special-event-map) - (progn - (define-key special-event-map [make-frame-visible] - 'dframe-handle-make-frame-visible) - (define-key special-event-map [iconify-frame] - 'dframe-handle-iconify-frame) - (define-key special-event-map [delete-frame] - 'dframe-handle-delete-frame)) - ) +(defun dframe-set-special-events () + (when (boundp 'special-event-map) + (define-key special-event-map [make-frame-visible] + 'dframe-handle-make-frame-visible) + (define-key special-event-map [iconify-frame] + 'dframe-handle-iconify-frame) + (define-key special-event-map [delete-frame] + 'dframe-handle-delete-frame))) (defvar dframe-make-frame-visible-function nil "Function used when a dframe controlled frame is de-iconified. -- 2.11.0 --=-=-=--