Gnus development mailing list
 help / color / mirror / Atom feed
From: Ralf Angeli <angeli@iwi.uni-sb.de>
Subject: Re: Buttons for M-x customize-*
Date: Wed, 14 Dec 2005 12:25:14 +0100	[thread overview]
Message-ID: <dnovep$1da$1@sea.gmane.org> (raw)
In-Reply-To: <iluhd9dj6if.fsf@latte.josefsson.org>

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

* 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 <angeli@iwi.uni-sb.de> 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  <angeli@iwi.uni-sb.de>

	* 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1529 bytes --]

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\\|<?[Ff]1>?\\)")
 
@@ -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 ` '.

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


-- 
Ralf

  reply	other threads:[~2005-12-14 11:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 18:55 Ralf Angeli
2005-12-12 22:30 ` Reiner Steib
2005-12-13  9:05   ` Ralf Angeli
2005-12-13 16:39   ` Simon Josefsson
2005-12-14 11:25     ` Ralf Angeli [this message]
2005-12-14 13:17       ` Reiner Steib
2005-12-14 13:37         ` Ralf Angeli

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='dnovep$1da$1@sea.gmane.org' \
    --to=angeli@iwi.uni-sb.de \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).