From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs 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 Message-ID: <87inz3hw40.fsf@gnus.org> References: <203eab8f-376f-423b-8347-3a0d354bb3e3@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1461773424 4796 80.91.229.3 (27 Apr 2016 16:10:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Apr 2016 16:10:24 +0000 (UTC) Cc: 15682@debbugs.gnu.org, 52@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 27 18:10:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1avS2V-0003aA-FL for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 18:10:11 +0200 Original-Received: from localhost ([::1]:44114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avS2U-0007qs-Ok for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 12:10:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avS2Q-0007lG-Hc for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 12:10:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avS2M-0004Vp-RR for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 12:10:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avS2M-0004Vh-P8 for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 12:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1avS2M-00069Z-L4 for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 12:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Apr 2016 16:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 52-submit@debbugs.gnu.org id=B52.146177336723593 (code B ref 52); Wed, 27 Apr 2016 16:10:02 +0000 Original-Received: (at 52) by debbugs.gnu.org; 27 Apr 2016 16:09:27 +0000 Original-Received: from localhost ([127.0.0.1]:50246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avS1m-00068S-Iw for submit@debbugs.gnu.org; Wed, 27 Apr 2016 12:09:26 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:45625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avS1k-00068G-1x; Wed, 27 Apr 2016 12:09:25 -0400 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1avS1f-0007qU-T0; Wed, 27 Apr 2016 18:09:23 +0200 In-Reply-To: <203eab8f-376f-423b-8347-3a0d354bb3e3@default> (Drew Adams's message of "Tue, 22 Oct 2013 08:28:06 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116916 Archived-At: Drew Adams 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