From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/61530 Path: news.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.gnus.general Subject: Re: Buttons for M-x customize-* Date: Wed, 14 Dec 2005 12:25:14 +0100 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1134560014 13054 80.91.229.2 (14 Dec 2005 11:33:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2005 11:33:34 +0000 (UTC) Original-X-From: ding-owner+m10062@lists.math.uh.edu Wed Dec 14 12:33:33 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EmUqQ-0007CM-MU for ding-account@gmane.org; Wed, 14 Dec 2005 12:30:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1EmUqN-0004px-00; Wed, 14 Dec 2005 05:30:47 -0600 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1EmUpC-0004ps-00 for ding@lists.math.uh.edu; Wed, 14 Dec 2005 05:29:34 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1EmUp4-0000Qn-DW for ding@lists.math.uh.edu; Wed, 14 Dec 2005 05:29:34 -0600 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1EmUp3-0004l0-00 for ; Wed, 14 Dec 2005 12:29:25 +0100 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EmUn9-0005tv-RN for ding@gnus.org; Wed, 14 Dec 2005 12:27:28 +0100 Original-Received: from iwi190.iwi.uni-saarland.de ([134.96.72.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Dec 2005 12:27:27 +0100 Original-Received: from angeli by iwi190.iwi.uni-saarland.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Dec 2005 12:27:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Lines: 90 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: iwi190.iwi.uni-saarland.de Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEUAAAD7+vVSPEL+/v79 /v1rDy/y7uQtAhK3tbD99doDAALV08n////+//78/fw7ARdgBieLg4LQmlLpAAACPklEQVR4nK2V 27KrMAiGTUCC0OLi/V92kRitp73HziwuOq3m4+cQ6PD60oY/AVCZEzwHkBXZ6Tmgikmc7yVuAGQD UOLHCqgEL7DnCpCYEFUfK1TCs9tz4AXokvEL4AUq5RuFF5DIF30IwES+SLoSRZ73Ifyri+To3xMA AMxlkDCPjsMZugLEWYZmkp3p/wAaeRl2JsXJENDwCgBgXKAiMhyIkMk5+zYeGwBG7J4P/ltYzYPk lfgAfD7bFSQEQpfxBCSpb6+Aa6SQONMZsOxK6VOifn6ZiigG2xEA1Vp0SOR7Ii/NI+d1PlbAFg+Y i+5z8SWQuO3GR6A7AM/Jd0A/FQrYR3YD+m02xF1MkQL0Htk/gKbfzvbrtD6lUw601hksWlVy9LBW XxT603OVMHZjfQfI4XeKLZCdtEgmeLfz5z7U3WJtFMKvTrnGw1OMReHaHd4i3t0lj2LzEk98cVeN 4ntDM8IFiLzbK9cprH0spl52ue+BGLTC05252/sGwJTp9vw0MV2Aeo/IWwjcTav58t1OOcTgx6YY R47jyqafFFRtV6INqLM8VvMIim2fCZsnvABA42pRTdoB5DEJ7yMQs/8535iltDUbrx4OC60BqcYT TSg/4425nUIC4Hhc2kzLDeJ4DimNTaBviZD5mRs3N8VMh3+KCqwC22IRiQfzOEvfsEcgbt1HYNuQ s5RwUtdYOQFv06reHB/2V/1dgXWGVmAVCFdyPF+ntMQK8RNAY6/pvKUd80AxERXKsZsOwC94/1VQ /4fx6QAAAABJRU5ErkJggg== User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:BrrVRY2nIeUQdJoIOXIjJPSwaN4= X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:61530 Archived-At: --=-=-= * Simon Josefsson (2005-12-13) writes: > No. Since it is not registered, we should either register it or > remove it. I'm not sure custom: URLs are that useful, so removing it > is probably fine. Okay, this is still being done in the updated patch attached to this message. > Ralf Angeli writes: > >> One additional thought: The function `gnus-button-handle-custom' in >> the patch is so generic now that it could probably be called something >> like `gnus-button-funcall-on-strings'. If it should be named like >> that, I'll change its interface so that it can accept an arbitrary >> number of arguments just like `funcall'. > > I think this would be better. I thought about this once more and I don't think it can be generalized so easily. The customize-* functions expect symbols as arguments, so the strings coming from the regexps used for parsing an article have to be interned. So I'd have to intern every argument passed to a hypothetical `gnus-button-funcall-on-strings'. But of course not every possible function to be called through it expects symbols as arguments. So for now I left the function name alone in order to document its limited usefuleness. Here is a ChangeLog entry and the patch: 2005-12-14 Ralf Angeli * gnus-art.el (gnus-button-handle-custom): Do not just use `customize-apropos' for any "M-x customize-*" button but the function called for. Accept both the function name and its argument in order to achieve this. (gnus-button-alist): Remove support for "custom:" URL's. Pass function name to `gnus-button-handle-custom' in case of "M-x customize-*" buttons. --=-=-= Content-Type: text/x-patch Content-Disposition: inline Index: gnus-art.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v retrieving revision 7.133 diff -u -r7.133 gnus-art.el --- gnus-art.el 12 Dec 2005 23:06:59 -0000 7.133 +++ gnus-art.el 14 Dec 2005 11:24:00 -0000 @@ -6297,9 +6297,11 @@ (gnus-url-mailto url-mailto)) (t (gnus-message 3 "Invalid string."))))) -(defun gnus-button-handle-custom (url) - "Follow a Custom URL." - (customize-apropos (gnus-url-unhex-string url))) +(defun gnus-button-handle-custom (fun arg) + "Call function FUN on argument ARG. +Both FUN and ARG are supposed to be strings. ARG will be passed +as a symbol to FUN." + (funcall (intern fun) (intern symbol))) (defvar gnus-button-handle-describe-prefix "^\\(C-h\\|?\\)") @@ -6479,10 +6481,8 @@ ;; Info links like `C-h i d m CC Mode RET' 0 (>= gnus-button-emacs-level 1) gnus-button-handle-info-keystrokes 2) ;; This is custom - ("\\bcustom:\\(//\\)?\\([^'\">\n\t ]+\\)" - 0 (>= gnus-button-emacs-level 5) gnus-button-handle-custom 2) - ("M-x[ \t\n]customize-[^ ]+[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET" 0 - (>= gnus-button-emacs-level 1) gnus-button-handle-custom 1) + ("M-x[ \t\n]\\(customize-[^ ]+\\)[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET" 0 + (>= gnus-button-emacs-level 1) gnus-button-handle-custom 1 2) ;; Emacs help commands ("M-x[ \t\n]+apropos[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET" ;; regexp doesn't match arguments containing ` '. --=-=-= -- Ralf --=-=-=--