From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/47228 Path: main.gmane.org!not-for-mail From: Raymond Scholz Newsgroups: gmane.emacs.gnus.general Subject: Re: [patch] More buttons for emacs stuff, MIDs, mail addresses Date: Wed, 16 Oct 2002 19:20:25 +0200 Organization: =?UTF-8?Q?/=CB=8C=C9=94=CB=90=C9=A1=C9=99na=C9=AA=CB=88ze=C9=AA=CA=83n/?= Sender: owner-ding@hpc.uh.edu Message-ID: References: <3D6FED17.6040201@yahoo.com.cn> Reply-To: Raymond Scholz NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1034788963 3706 80.91.224.249 (16 Oct 2002 17:22:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 16 Oct 2002 17:22:43 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 181rsX-0000xd-00 for ; Wed, 16 Oct 2002 19:22:41 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 181rqx-0004qr-00; Wed, 16 Oct 2002 12:21:03 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 16 Oct 2002 12:21:45 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id MAA05639 for ; Wed, 16 Oct 2002 12:21:29 -0500 (CDT) Original-Received: (qmail 14610 invoked by alias); 16 Oct 2002 17:20:36 -0000 Original-Received: (qmail 14604 invoked from network); 16 Oct 2002 17:20:36 -0000 Original-Received: from quimby.gnus.org (80.91.224.244) by gnus.org with SMTP; 16 Oct 2002 17:20:36 -0000 Original-Received: from news by quimby.gnus.org with local (Exim 3.12 #1 (Debian)) id 181shF-0006wT-00 for ; Wed, 16 Oct 2002 20:15:05 +0200 Original-To: ding@gnus.org Original-Path: fly.verified.de!not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 94 Original-NNTP-Posting-Host: b7dbe.pppool.de Original-X-Trace: quimby.gnus.org 1034792105 26687 213.7.125.190 (16 Oct 2002 18:15:05 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: 16 Oct 2002 18:15:05 GMT X-Now-Playing: Nothing X-Face: %.!RBc`e*wW)84O*\)VdkC}mU5c2Zh$y~ZRA3K594g/jp_&5bx\Oyes!/jK~4<<%KlaPn^\ 0 wrote: > Would you like to work on this? We could include another choice option > in `gnus-button-prefer-mid-or-mail' (and use it in > `gnus-button-handle-mid-or-mail'). An option would be calling pi's Perl script from Gnus and parsing the output. Like: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-art.patch Index: gnus-art.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v retrieving revision 6.248 diff -u -r6.248 gnus-art.el --- gnus-art.el 2002/09/27 08:09:05 6.248 +++ gnus-art.el 2002/10/16 18:14:10 @@ -5325,19 +5325,23 @@ (defcustom gnus-button-prefer-mid-or-mail 'guess "What to do when the button on a string as \"foo123@bar.com\" is pushed. -Strings like this can be either a message ID or a mail address. If the -variable is set to the symbol `ask', query the user what do do. If it is the -symbol `guess', Gnus will do a guess and query the user what do do if it is -ambiguous. If it is one of the sybols `mid' or `mail', Gnus will always assume -that the string is a message ID or a mail address, respectivly. See the -variable `gnus-button-guessed-mid-regexp' for details concerning the -guessing." +Strings like this can be either a message ID or a mail address. If +the variable is set to the symbol `ask', query the user what do do. +If it is the symbol `guess', Gnus will do a guess and query the user +what do do if it is ambiguous. See the variable +`gnus-button-guessed-mid-regexp' for details concerning the guessing. +If it is one of the sybols `mid' or `mail', Gnus will always assume +that the string is a message ID or a mail address, respectivly. If it +is a function, Gnus will call this function with the string in +question as the only argument. The function should return non-nil +value, if the argument is supposed to be a message ID." ;; FIXME: doc-string could/should be improved. :group 'gnus-article-buttons :type '(choice (const ask) (const guess) (const mid) - (const mail))) + (const mail) + (function :tag "Iff function evaluates to non-nil"))) (defcustom gnus-button-guessed-mid-regexp (concat @@ -5361,6 +5365,10 @@ ;; otherwise 'ask the user. (if (eq pref 'guess) (if (string-match gnus-button-guessed-mid-regexp mid-or-mail) + (setq pref 'mid) + (setq pref 'ask))) + (if (functionp pref) + (if (funcall pref mid-or-mail) (setq pref 'mid) (setq pref 'ask))) (if (eq pref 'ask) --=-=-= And something like (defun rs-is-mid (mid-or-mail) (string-match "-> m-id$" (with-temp-buffer (insert (concat "<" mid-or-mail ">")) (call-process-region (point-min) (point-max) shell-file-name t (list (current-buffer) nil) nil shell-command-switch "/home/rscholz/bin/id-or-mail.pl") (buffer-string)))) (setq gnus-button-prefer-mid-or-mail 'is-mid) I'm not sure whether funcall should be protected with something like `save-window-excursion'. Cheers, Ray -- http://www.zonix.de/ - (c) 2000 by Yamtaijika Corp. --=-=-=--