all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 15682@debbugs.gnu.org, 52@debbugs.gnu.org
Subject: bug#52: bug#15682: 24.3.50; `:link' in `defgroup' does not respect `mouse-1-click-follows-link'
Date: Wed, 27 Apr 2016 18:09:19 +0200	[thread overview]
Message-ID: <87inz3hw40.fsf@gnus.org> (raw)
In-Reply-To: <203eab8f-376f-423b-8347-3a0d354bb3e3@default> (Drew Adams's message of "Tue, 22 Oct 2013 08:28:06 -0700 (PDT)")

Drew Adams <drew.adams@oracle.com> writes:

> (defgroup foo nil
>   "..." :prefix "foo-" :group 'editing
>   :link '(url-link "http://www.emacswiki.org/"))
>
> (defcustom foobar t "..." :type 'boolean :group 'foo)
>
> M-x set-variable mouse-1-click-follows-link nil
> M-x customize-option foobar
>
> Click the link `http://www.emacswiki.org/' using `mouse-1'.  The link is
> followed - it should not be followed.
>
> Note that `mouse-on-link-p' returns `t' for positions on this link, and
> such positions have face `custom-link', property `follow-link' with
> value `mouse-face', and property `mouse-face' with a face value, all of
> which show further that the behavior violates the mandate of
> `mouse-1-click-follows-link'.

I've had another peek at this, but the main problem is that I don't
quite understand why the Widget code is so...  complicated.  Why does it
do all the stuff below?  I mean, no other modes that react to mouse
clicks need to ... do all that...

(defun widget-button-click (event)
  "Invoke the button that the mouse is pointing at."
  (interactive "e")
  (if (widget-event-point event)
      (let* ((oevent event)
	     (mouse-1 (memq (event-basic-type event) '(mouse-1 down-mouse-1)))
	     (pos (widget-event-point event))
	     (start (event-start event))
	     (button (get-char-property
		      pos 'button (and (windowp (posn-window start))
				       (window-buffer (posn-window start)))))
	     newpoint)
	(when (or (null button)
		  (catch 'button-press-cancelled
	      ;; Mouse click on a widget button.  Do the following
	      ;; in a save-excursion so that the click on the button
	      ;; doesn't change point.
	      (save-selected-window
		(select-window (posn-window (event-start event)))
		(save-excursion
		  (goto-char (posn-point (event-start event)))
		  (let* ((overlay (widget-get button :button-overlay))
			 (pressed-face (or (widget-get button :pressed-face)
					   widget-button-pressed-face))
			 (face (overlay-get overlay 'face))
			 (mouse-face (overlay-get overlay 'mouse-face)))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2016-04-27 16:09 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 ` Lars Ingebrigtsen [this message]
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
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=87inz3hw40.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=15682@debbugs.gnu.org \
    --cc=52@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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.