all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 15682@debbugs.gnu.org
Subject: bug#15682: 24.3.50; `:link' in `defgroup' does not respect `mouse-1-click-follows-link'
Date: Sun, 25 Aug 2019 12:07:14 -0300	[thread overview]
Message-ID: <CABczVwe6+PRU3UsFvQmRgyQvHBH6975jsa00NFjz2JcpsXudRQ@mail.gmail.com> (raw)
In-Reply-To: <8736hpajah.fsf@gnus.org>


[-- Attachment #1.1: Type: text/plain, Size: 673 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> I investigated the emacs sources, and have noticed that this patch could
cause
>> problems with three pieces of code:
>
> Would it be possible for you to come up with patches for fixing these
> three pieces, too?  And then we could apply all four patches at the same
> time and not break anything.

Sure.  I attach 3 patches.  The same one I attached in my previous
message, one patch for recentf.el and one patch for epa.el.

I tried MH-E, to test the mh-mime.el code, and doesn't seem to misbehave
with the change in wid-edit.el, so I didn't touch it.

Best regards,
Mauro.

[-- Attachment #1.2: Type: text/html, Size: 882 bytes --]

[-- Attachment #2: 0001-Make-link-widgets-obey-mouse-1-click-follows-link.patch --]
[-- Type: text/x-patch, Size: 1906 bytes --]

From 583cde65b0377e56c7186354571cce226e827cc5 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Tue, 20 Aug 2019 20:32:41 -0300
Subject: [PATCH] Make link widgets obey mouse-1-click-follows-link

* lisp/wid-edit.el (widget-link-keymap): New variable, a keymap to use
inside a link widget.
('link widget): Restore the :follow-link property and add
widget-link-keymap as the :keymap property.  (Bug#15682)
---
 lisp/wid-edit.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index dd03a24..1ddc461 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1790,17 +1790,22 @@ widget-link-suffix
   :type 'string
   :group 'widget-button)
 
+(defvar widget-link-keymap
+  (let ((map (copy-keymap widget-keymap)))
+    ;; Only bind mouse-2, since mouse-1 will be translated accordingly to
+    ;; the customization of `mouse-1-click-follows-link'.
+    (define-key map [down-mouse-1] (lookup-key widget-global-map [down-mouse-1]))
+    (define-key map [down-mouse-2] 'widget-button-click)
+    (define-key map [mouse-2] 'widget-button-click)
+    map)
+  "Keymap used inside a link widget.")
+
 (define-widget 'link 'item
   "An embedded link."
   :button-prefix 'widget-link-prefix
   :button-suffix 'widget-link-suffix
-  ;; The `follow-link' property should only be used in those contexts where the
-  ;; mouse-1 event normally doesn't follow the link, yet the `link' widget
-  ;; seems to almost always be used in contexts where (down-)mouse-1 is bound
-  ;; to `widget-button-click' and hence the "mouse-1 to mouse-2" remapping is
-  ;; not necessary (and can even be harmful).  So let's not add a :follow-link
-  ;; by default.  See (bug#22434).
-  ;; :follow-link 'mouse-face
+  :follow-link 'mouse-face
+  :keymap widget-link-keymap
   :help-echo "Follow the link."
   :format "%[%t%]")
 
-- 
2.7.4


[-- Attachment #3: 0001-Adapt-recentf.el-to-the-change-in-the-Widget-Library.patch --]
[-- Type: text/x-patch, Size: 962 bytes --]

From 98a4f24b0bc85c5bc3f749a13b51b8de35720c2f Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sun, 25 Aug 2019 11:37:16 -0300
Subject: [PATCH] Adapt recentf.el to the change in the Widget Library

* lisp/recentf.el (recentf-open-files-item): Stop overriding
:follow-link property of the link widgets, since now it should work as
expected.
---
 lisp/recentf.el | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lisp/recentf.el b/lisp/recentf.el
index 4112b44..2720286 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1184,9 +1184,6 @@ recentf-open-files-item
            :format "%[%t\n%]"
            :help-echo ,(concat "Open " (cdr menu-element))
            :action recentf-open-files-action
-           ;; Override the (problematic) follow-link property of the
-           ;; `link' widget (bug#22434).
-           :follow-link nil
            ,(cdr menu-element))))
 
 (defun recentf-open-files-items (files)
-- 
2.7.4


[-- Attachment #4: 0001-Create-push-button-widgets-instead-of-links-in-epa-K.patch --]
[-- Type: text/x-patch, Size: 1102 bytes --]

From 4cc06f7ec6e029ac5cc31d1dc44e5f950957441e Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sun, 25 Aug 2019 11:33:54 -0300
Subject: [PATCH] Create push-button widgets instead of links in epa *Keys*
 buffer

* lisp/epa.el (epa--select-keys): OK and Cancel should be buttons.
---
 lisp/epa.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 9e6edf4..b55a55f 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -440,12 +440,12 @@ epa--select-keys
 	      (substitute-command-keys "\
 - `\\[epa-mark-key]' to mark a key on the line
 - `\\[epa-unmark-key]' to unmark a key on the line\n"))
-      (widget-create 'link
+      (widget-create 'push-button
 		     :notify (lambda (&rest _ignore) (abort-recursive-edit))
 		     :help-echo
 		     "Click here or \\[abort-recursive-edit] to cancel"
 		     "Cancel")
-      (widget-create 'link
+      (widget-create 'push-button
 		     :notify (lambda (&rest _ignore) (exit-recursive-edit))
 		     :help-echo
 		     "Click here or \\[exit-recursive-edit] to finish"
-- 
2.7.4


  reply	other threads:[~2019-08-25 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 15:28 bug#15682: 24.3.50; `:link' in `defgroup' does not respect `mouse-1-click-follows-link' Drew Adams
2016-04-27 16:09 ` bug#52: " Lars Ingebrigtsen
2016-04-27 16:24   ` Drew Adams
2016-04-27 16:53     ` bug#52: " Lars Ingebrigtsen
2016-04-27 17:18       ` Drew Adams
2019-08-23 20:41 ` Mauro Aranda
2019-08-25  5:47   ` Lars Ingebrigtsen
2019-08-25 15:07     ` Mauro Aranda [this message]
2019-08-25 16:19       ` Drew Adams
2019-08-25 16:22         ` Drew Adams
2019-08-25 16:41           ` Eli Zaretskii
2019-08-25 16:50           ` Noam Postavsky
2019-08-25 16:58             ` Mauro Aranda
2019-08-27  6:42       ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABczVwe6+PRU3UsFvQmRgyQvHBH6975jsa00NFjz2JcpsXudRQ@mail.gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=15682@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.