From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.bugs Subject: bug#20664: 25.0.50; Customize: Link option or face name to the source definition Date: Wed, 27 May 2015 15:19:52 +0200 Message-ID: <877frup37r.fsf@gmail.com> References: <0ef05975-f3ab-4601-81bb-e4fc17d0cb87@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1432733248 25329 80.91.229.3 (27 May 2015 13:27:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 May 2015 13:27:28 +0000 (UTC) Cc: 20664@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 27 15:27:18 2015 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 1YxbMb-0002U1-6S for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 May 2015 15:27:17 +0200 Original-Received: from localhost ([::1]:53953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbMa-0002im-Ix for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 May 2015 09:27:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbMT-0002ih-OH for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 09:27:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxbMO-0003zH-KV for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 09:27:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbMO-0003zB-EB for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 09:27:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YxbMN-0008De-MD for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 09:27:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 May 2015 13:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20664 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20664-submit@debbugs.gnu.org id=B20664.143273318631545 (code B ref 20664); Wed, 27 May 2015 13:27:02 +0000 Original-Received: (at 20664) by debbugs.gnu.org; 27 May 2015 13:26:26 +0000 Original-Received: from localhost ([127.0.0.1]:58038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxbLl-0008Ch-54 for submit@debbugs.gnu.org; Wed, 27 May 2015 09:26:26 -0400 Original-Received: from mail-wi0-f181.google.com ([209.85.212.181]:37914) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxbLh-0008CO-Ar for 20664@debbugs.gnu.org; Wed, 27 May 2015 09:26:22 -0400 Original-Received: by wizo1 with SMTP id o1so22368295wiz.1 for <20664@debbugs.gnu.org>; Wed, 27 May 2015 06:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=WfbODxIzMpxMxk8ye2OLEhLp3+1cX2MzGnujWxxHqL0=; b=RGB6FaX7AShSfpKSeA09mzPh/84Fiqi7WuNZfTfU/qvAYiA12wR9RmI+K/PUnOc0xT x8rpxSIYC3lA17eemO5TV1tLkDGMdi29vJjUC97LchmJjL1Rdu4Y2kVPjEYY9u8SVHIx c48dn+qYKYcfO+qDM9QXYmECKeMcDMQa3Wns66f9ihKjmnXx4yvO3bkONTxja/ybTxP3 rhbqmmRaZAnLIMMAARuAEz99jCVOwYV1Q4XxAv0dpNg1vXkXzOa4vYHAgFaRKq/tIYOL lITAdW5Zc9FVrA6BsFR1Nppl7/wbYcV3aJi8Pd+26sbOyxIULip2GbxwLY5sZzTgMu62 7XaQ== X-Received: by 10.194.95.2 with SMTP id dg2mr59712778wjb.53.1432733175647; Wed, 27 May 2015 06:26:15 -0700 (PDT) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id eu10sm3698343wib.8.2015.05.27.06.26.14 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 May 2015 06:26:14 -0700 (PDT) In-Reply-To: <0ef05975-f3ab-4601-81bb-e4fc17d0cb87@default> (Drew Adams's message of "Tue, 26 May 2015 13:41:03 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103209 Archived-At: --=-=-= Content-Type: text/plain Drew Adams writes: > Feature request. In Customize, for options and faces. Put a link on > the option/face name, so that following the link takes you to the source > code (defcustom or defface). Please check the patch. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Allow-to-follow-to-face-definition-in-Customize.patch >From bea177aff8de195d428106003fab8b8498e7aae8 Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Wed, 27 May 2015 15:06:42 +0200 Subject: [PATCH] Allow to follow to face definition in Customize * lisp/cus-edit.el (custom-face-value-create): Make the face name into a button that calls `find-face-definition'. (Bug#20664) --- lisp/cus-edit.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 1d9a9d6..246f08e 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3483,19 +3483,22 @@ the present value is saved to its :shown-value property instead." (widget-put widget :buttons buttons)) ;; Draw an ordinary `custom-face' widget - (let ((opoint (point))) - ;; Visibility indicator. - (push (widget-create-child-and-convert - widget 'custom-visibility - :help-echo "Hide or show this face." - :on "Hide" :off "Show" - :on-glyph "down" :off-glyph "right" - :action 'custom-toggle-hide-face - (not hiddenp)) - buttons) - ;; Face name (tag). - (insert " " tag) - (widget-specify-sample widget opoint (point))) + (let (opoint) + ;; Visibility indicator. + (push (widget-create-child-and-convert + widget 'custom-visibility + :help-echo "Hide or show this face." + :on "Hide" :off "Show" + :on-glyph "down" :off-glyph "right" + :action 'custom-toggle-hide-face + (not hiddenp)) + buttons) + (setq opoint (point)) + ;; Face name (tag). + (insert " " tag) + (make-button opoint (point) + 'follow-link t + 'action (lambda (&rest _x) (find-face-definition symbol)))) (insert (cond ((eq custom-buffer-style 'face) " ") ((string-match-p "face\\'" tag) ":") -- 1.8.4 --=-=-= Content-Type: text/plain With this patch, "RET" works as expected, while "" is giving an error for a reason I don't understand. In order to make it work for the mouse, I have to do something contorted instead of a plain `make-button': (define-key (overlay-get (make-button opoint (point) 'follow-link t 'action (lambda (&rest _x) (find-face-definition symbol))) 'keymap) [down-mouse-1] (lambda () (interactive) (let ((button (button-at (point)))) (when button (button-activate button) t)))) Maybe someone can suggest a better way. Oleh --=-=-=--