[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: bitten by lexical-binding
From: |
Drew Adams |
Subject: |
RE: bitten by lexical-binding |
Date: |
Sun, 22 Nov 2015 09:08:14 -0800 (PST) |
> > Starting with Emacs 25, `mouse-drag-track' does not accept
> > the second arg. But invoking it without that argument meant
> > that (my version of) `mouse-drag-region' no longer copied
> > the text to the kill ring, when `mouse-drag-copy-region'=t.
> > That was the problem.
>
> Can't reproduce here, built from Nov 21 2015.
> I copied your code into a file, one time with lexical binding
> enabled, one time without. In emacs -Q, I loaded that file
> and set mouse-drag-copy-region -> t.
> With both file versions, the region was copied to the kill
> ring after dragging with the mouse.
Thanks for checking.
Testing some more, I found that the problem occurred only for
Emacs 24.[45], not for Emacs 25. (Coulda sworn that I had
the problem for Emacs 25 also, but I sometimes use 24.5 to
avoid crashes I get with Emacs 25, and perhaps that's what
was involved here - faulty testing.)
I've removed the lex binding declaration and fixed the test
for passing two args to mouse-drag-track (which fixes the
problem for Emacs 24.[45]).
Sorry for the noise, and thanks to all for the feedback.
----
BTW, I neglected to say that the point of the code, which is
to let a mouse-1 click in the minibuffer invoke `M-x' and
remove *Messages*, if *Messages* is already shown, needs
these bindings, which are commented out as suggestions in
the file header:
;; ;; Do not use `view-echo-area-messages' for `mouse-1'.
;; ;; Use version of `mouse-drag-region' defined here
;; (when (> emacs-major-version 23)
;; (define-key minibuffer-inactive-mode-map [down-mouse-1] nil)
;; (define-key minibuffer-inactive-mode-map [mouse-1] nil))
This is independent of the normal behavior and copying the
selection to the kill ring, which was the question here.
I mention this only in case someone is interested in this
click-in-echo-area behavior and wants to try it.