GNU bug report logs -
#29599
26.0; `dframe.el' binds keys unconditionally when loaded
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Thu, 7 Dec 2017 06:12:02 UTC
Severity: minor
Tags: fixed, patch
Found in version 26.0
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29599 in the body.
You can then email your comments to 29599 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Thu, 07 Dec 2017 06:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 07 Dec 2017 06:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Well, not completely unconditionally. But I see this:
(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))
)
That condition that the map exists isn't, I think, sufficient to give it
license to bind keys in the map.
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.
In my init file I do this (after loading library `thumb-frm.el', which
defines `thumfr-thumbify-frame-upon-event'):
(when (and (eq system-type 'windows-nt)
(fboundp 'thumfr-thumbify-frame-upon-event))
(define-key special-event-map [iconify-frame]
'thumfr-thumbify-frame-upon-event))
But dframe.el overwrites that binding when it gets loaded.
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?
In GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32)
of 2017-10-13
Repository revision: 906224eba147bdfc0514090064e8e8f53160f1d4
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 01:41:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 29599 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Drew Adams <drew.adams <at> oracle.com> 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.
[0001-Don-t-bind-dframe-events-on-load-Bug-29599.patch (text/x-diff, inline)]
From e7965c6f4f9dcce7f38ab9a51cd2638d5feb5c66 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 02:16:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 29599 <at> debbugs.gnu.org (full text, mbox):
> > 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).
I don't think I know (or didn't know or at least don't
recall) anything about such a thing. Is it something new?
> > 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.
Dunno what you mean by that ("share the bindings").
But maybe if I knew what "loading-on-completion" is
then I would understand "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.
Maybe so, but then the question would be whether and why
dframe.el (or anything else) would initialize the hook
to have one or more functions on it.
In my case, I'm pretty sure I don't want anything other
than my replacement for iconification to be on the hook.
So I would probably empty the hook before using `add-hook'
for my function. Maybe that's only out of ignorance of
what the deframe functions are for or do.
> 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'.
But (without looking at them), those sound like specific
replacements for the standard iconify etc. If so, it's
great to provide such functions, but they shouldn't be
bound to special events by default (i.e., upon loading).
> Anyway, at a minimum, we can't have keybindings being modified by just a
> load.
Yes, thank you.
> Here's a patch which moves the keybinding to dframe-frame-mode
> activation instead.
I can't speak to the value of the patch (I know nothing
about this), but thanks for working on this.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 03:52:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 29599 <at> debbugs.gnu.org (full text, mbox):
tags 29599 + patch
quit
Drew Adams <drew.adams <at> oracle.com> writes:
>> Yeah (it's probably the loading-on-completion thing again).
>
> I don't think I know (or didn't know or at least don't
> recall) anything about such a thing. Is it something new?
Yes, see Bug#28607.
>> 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'.
>
> But (without looking at them), those sound like specific
> replacements for the standard iconify etc. If so, it's
> great to provide such functions, but they shouldn't be
> bound to special events by default (i.e., upon loading).
As far as I can tell, there is no code in Emacs which sets those
functions to anything. So presumably the idea is to allow the user to
run some code when a "dframe" is made visible/iconified/deleted.
>> Here's a patch which moves the keybinding to dframe-frame-mode
>> activation instead.
>
> I can't speak to the value of the patch (I know nothing
> about this), but thanks for working on this.
Okay, it should take care of this bug, and it should be perfectly safe,
since the functions do nothing before dframe-frame-mode is activated
anyway. I'll push to emacs-26 in a few days if there are no objections.
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Tue, 19 Dec 2017 03:52:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 05:22:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 29599 <at> debbugs.gnu.org (full text, mbox):
> tags 29599 + patch
> quit
>
> Drew Adams <drew.adams <at> oracle.com> writes:
>
> >> Yeah (it's probably the loading-on-completion thing again).
> >
> > I don't think I know (or didn't know or at least don't
> > recall) anything about such a thing. Is it something new?
>
> Yes, see Bug#28607.
That's quite a bug report - no report at all (?).
Perhaps it was because all of the actual report was
in another bug report that was closed, and that now
redirects to this (vacuous) report?
The only thing in #28607 is a link to an emacs-devel
thread. No description of the problem (?).
Anyway, it's not clear to me how that bug relates to this one.
This one is about explicitly binding keys when the
source code loads. I don't get the impression that
that one is about this at all. (What am I missing?)
> > But (without looking at them), those sound like specific
> > replacements for the standard iconify etc. If so, it's
> > great to provide such functions, but they shouldn't be
> > bound to special events by default (i.e., upon loading).
>
> As far as I can tell, there is no code in Emacs which sets those
> functions to anything. So presumably the idea is to allow the user to
> run some code when a "dframe" is made visible/iconified/deleted.
No doubt. But (I think we agree?) that possibility
should be offered to users, to choose, and not imposed
just by loading the file.
> >> Here's a patch which moves the keybinding to dframe-frame-mode
> >> activation instead.
> >
> > I can't speak to the value of the patch (I know nothing
> > about this), but thanks for working on this.
>
> Okay, it should take care of this bug, and it should be perfectly safe,
> since the functions do nothing before dframe-frame-mode is activated
> anyway. I'll push to emacs-26 in a few days if there are no objections.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 13:16:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 29599 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> That's quite a bug report - no report at all (?).
>
> Perhaps it was because all of the actual report was
> in another bug report that was closed, and that now
> redirects to this (vacuous) report?
>
> The only thing in #28607 is a link to an emacs-devel
> thread. No description of the problem (?).
>
> Anyway, it's not clear to me how that bug relates to this one.
>
> This one is about explicitly binding keys when the
> source code loads. I don't get the impression that
> that one is about this at all. (What am I missing?)
Oh, yeah, I probably should have pointed to the linked stuff. Bug#28048
has more info.
Anyway, the relation is just that it probably explains how you got
dframe loaded (I have got dframe loaded in my session as well, even
though I don't use it).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Tue, 19 Dec 2017 15:23:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 29599 <at> debbugs.gnu.org (full text, mbox):
> the relation is just that it probably explains how you got
> dframe loaded (I have got dframe loaded in my session as well, even
> though I don't use it).
Got it. Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29599
; Package
emacs
.
(Wed, 03 Jan 2018 02:00:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 29599 <at> debbugs.gnu.org (full text, mbox):
tags 29599 fixed
close 29599 26.1
quit
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
> Okay, it should take care of this bug, and it should be perfectly safe,
> since the functions do nothing before dframe-frame-mode is activated
> anyway. I'll push to emacs-26 in a few days if there are no objections.
Pushed to emacs-26, but I modified the patch a bit to avoid binding the
keys repeatedly.
[1: 43e2aafae3]: 2018-01-02 20:53:42 -0500
Don't bind dframe events on load (Bug#29599)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=43e2aafae306d9f7a463cba301d0253db846e20d
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Wed, 03 Jan 2018 02:00:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
29599 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com>
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Wed, 03 Jan 2018 02:00:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 31 Jan 2018 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 137 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.