From: Adolf Mathias <adolf.mathias@gmail.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: 34014@debbugs.gnu.org
Subject: bug#34014: 25.2; binding down mouse event with modifier to mouse-drag-region does not work
Date: Fri, 14 Aug 2020 20:58:41 +0200 [thread overview]
Message-ID: <CACHJYucSP8QChH1EV4BcC9ibfV++wnJvmnpbub6gYNw3rO1trQ@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmkuRpjB_XPTGaW9QdaUqHsHPqA7W1cRpt0j2Vx7hQ-k7w@mail.gmail.com>
Yes, your two expressions works on emacs-27.1 which I just installed
with snap on an Ubuntu 18.04, dragging S-mouse1 sets the region like
mouse-1.
The thing is, on Emacs24 and before I had the following working code:
==========================
(defun mouse-stay-and-copy (click)
"leaves cursor at current position, allows to drag a region which is
yanked at cursor position"
(interactive "e")
(let ((selected nil)
(win (selected-window))
(otherwin nil)
(otherstart nil)
(eventstart nil))
(save-excursion
(setq eventstart (event-start click))
(setq otherwin (car eventstart))
(setq otherstart (window-start otherwin))
(mouse-drag-track click)
(if mark-active
(progn (kill-new (buffer-substring (region-beginning) (region-end)))
(setq selected 1)
)))
(select-window win)
(if selected
(progn
(if mark-active (delete-region (region-beginning) (region-end)))
(yank)
;;(redraw-display)
))
(set-window-start otherwin otherstart nil)))
(define-key global-map '[S-down-mouse-1] 'mouse-stay-and-copy)
==========================
On Emacs Post 24, this stopped to work. When I filed the bug report, I
reduced this to a builtin Emacs function.
On Emacs 24, to bind Shift-mouse1, only the following call is required:
(define-key global-map '[S-down-mouse-1] 'mouse-drag-region)
My mouse-stay-and-copy is just a fancy replacement for
mouse-drag-region. Sadly, its API in conjunction with mouse-drag-track
has changed mysteriously with post-24.
On Fri, Aug 14, 2020 at 4:29 PM Stefan Kangas <stefan@marxist.se> wrote:
>
> reopen 34014
> thanks
>
> Hi Adolf,
>
> [Please use "Reply to all" so that the discussion is recorded in the bug
> tracker.]
>
> Adolf Mathias <adolf.mathias@gmail.com> writes:
>
> > Sorry for the apparent delay. I myself got a bit frustrated with the
> > issue and rewrote a simple version of mouse-drag-region for myself
> > which does not deal with double/triple-clicks acting on words and
> > lines however. I was not able to disentangle what Emacs does there.
> > I somehow was convinced that I had answered back then why I wanted to
> > bind mouse-drag-region to a button-down event.
> > I did so because the Emacs help on mouse-drag-region told me so, and
> > because it used to work that way.
>
> Thanks for replying back. I am therefore reopening this bug.
> With your help, we could try to figure out what is going on here.
>
> Does it work like you expect if you evaluate this in emacs -Q?
>
> (define-key global-map '[S-down-mouse-1] 'mouse-drag-region)
> (define-key global-map '[S-drag-mouse-1] 'mouse-set-region)
>
> If that does not help, could you please try to describe the use-case in
> more detail and explain what it is you're trying to achieve?
>
> Thanks in advance.
>
> Best regards,
> Stefan Kangas
next prev parent reply other threads:[~2020-08-14 18:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-08 9:51 bug#34014: 25.2; binding down mouse event with modifier to mouse-drag-region does not work Adolf Mathias
2019-03-01 8:00 ` Eli Zaretskii
2020-08-13 12:02 ` Stefan Kangas
[not found] ` <CACHJYuftHtcJ_ixA0vKbRavKstkaR8fkBaZxyoO_N41Zq7Qy4w@mail.gmail.com>
2020-08-14 14:29 ` Stefan Kangas
2020-08-14 18:58 ` Adolf Mathias [this message]
2020-08-15 2:20 ` Stefan Kangas
2020-08-15 11:53 ` Adolf Mathias
2020-08-16 14:34 ` Stefan Kangas
2020-08-16 16:20 ` Adolf Mathias
2020-08-16 17:10 ` Stefan Kangas
2020-08-16 20:54 ` Adolf Mathias
2020-08-17 14:27 ` Stefan Kangas
[not found] ` <CACHJYue_KVWZ=wF-sa6nHCsAso0SDb0XSoXCRgW0teiR_Gt15Q@mail.gmail.com>
2020-08-18 13:26 ` Stefan Kangas
2020-08-18 15:07 ` Adolf Mathias
2020-08-18 15:32 ` Stefan Kangas
2020-08-15 12:07 ` Adolf Mathias
2020-08-16 21:00 ` bug#34014: Adolf Mathias
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=CACHJYucSP8QChH1EV4BcC9ibfV++wnJvmnpbub6gYNw3rO1trQ@mail.gmail.com \
--to=adolf.mathias@gmail.com \
--cc=34014@debbugs.gnu.org \
--cc=stefan@marxist.se \
/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).