Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Use replace-match in posting-style.
@ 2009-07-07 21:15 Daniel Dehennin
  2009-07-08 18:51 ` Ted Zlatanov
  0 siblings, 1 reply; 42+ messages in thread
From: Daniel Dehennin @ 2009-07-07 21:15 UTC (permalink / raw)
  To: ding


[-- Attachment #1.1: Type: text/plain, Size: 966 bytes --]

With this patch we can use \N in attributes of posting-style, this is
usefull when using several email on a domain, like:

--8<---------------cut here---------------start------------->8---
(setq gnus-posting-styles
      '(("mydomain.\\(.*\\)"
         (name "Daniel Dehennin")
         (address "\\1@mydomain")
         (signature-file "~/.signature.mydomain.\\1"))))
--8<---------------cut here---------------end--------------->8---

This only works for string match on group name.

------------------------------------------------------------
revno: 142
committer: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
branch nick: posting-style
timestamp: Tue 2009-07-07 23:02:32 +0200
message:
  Use replace-match in posting-style.
  
  * lisp/gnus-msg.el (gnus-configure-posting-styles): If the value is a
    string and if the match is a group name (string)
  
  * texi/gnus.texi (Posting Styles): Add documentation on replace-match call.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: posting-style-142.patch --]
[-- Type: text/x-patch, Size: 2554 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: daniel.dehennin@baby-gnu.org-20090707210232-\
#   uenjtpeindzsq9bb
# target_branch: ../../gnus.head
# testament_sha1: d8581219cb5d8a4ad733edd26cec02ee4306555e
# timestamp: 2009-07-07 23:04:52 +0200
# source_branch: .
# base_revision_id: daniel.dehennin@baby-gnu.org-20090623223900-\
#   ydqdsazun1mg75c6
# 
# Begin patch
=== modified file 'lisp/gnus-msg.el'
--- lisp/gnus-msg.el	2009-01-22 07:02:15 +0000
+++ lisp/gnus-msg.el	2009-07-07 21:02:32 +0000
@@ -1890,7 +1890,10 @@
 	    (setq v
 		  (cond
 		   ((stringp value)
-		    value)
+		    (if (and (stringp match)
+			     (match-beginning 1))
+			(replace-match value nil nil group)
+		      value))
 		   ((or (symbolp value)
 			(functionp value))
 		    (cond ((functionp value)

=== modified file 'texi/gnus.texi'
--- texi/gnus.texi	2009-06-08 22:47:52 +0000
+++ texi/gnus.texi	2009-07-07 21:02:32 +0000
@@ -13393,14 +13393,20 @@
 name will be removed.  If the attribute name is @code{eval}, the form
 is evaluated, and the result is thrown away.
 
-The attribute value can be a string (used verbatim), a function with
-zero arguments (the return value will be used), a variable (its value
-will be used) or a list (it will be @code{eval}ed and the return value
-will be used).  The functions and sexps are called/@code{eval}ed in the
-message buffer that is being set up.  The headers of the current article
-are available through the @code{message-reply-headers} variable, which
-is a vector of the following headers: number subject from date id
-references chars lines xref extra.
+The attribute value can be a string, a function with zero arguments
+(the return value will be used), a variable (its value will be used)
+or a list (it will be @code{eval}ed and the return value will be
+used).  The functions and sexps are called/@code{eval}ed in the
+message buffer that is being set up.  The headers of the current
+article are available through the @code{message-reply-headers}
+variable, which is a vector of the following headers: number subject
+from date id references chars lines xref extra.
+
+In the case of a string value, if the @code{match} is a regular
+expression, a @samp{replace-match} is proceed on the value to replace
+the positional parameters @samp{\@var{n}} by the corresponding
+parenthetical matches (see @xref{Replacing the Text that Matched, ,
+Text Replacement, elisp, The Emacs Lisp Reference Manual}.)
 
 @vindex message-reply-headers
 


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2010-09-06 23:18 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-07 21:15 [PATCH] Use replace-match in posting-style Daniel Dehennin
2009-07-08 18:51 ` Ted Zlatanov
2010-04-10  9:57   ` Daniel Dehennin
2010-04-10 19:10     ` Johan Bockgård
2010-04-10 23:22       ` Daniel Dehennin
2010-04-11 13:13         ` Andreas Schwab
2010-04-11 14:04           ` Daniel Dehennin
2010-04-11 15:06             ` Andreas Schwab
2010-04-12 12:18               ` Daniel Dehennin
2010-06-23 21:02                 ` Daniel Dehennin
2010-07-08 13:57                   ` Ted Zlatanov
2010-07-12 19:43                     ` Daniel Dehennin
2010-07-30 17:43                       ` replace matches in any string (was: [PATCH] Use replace-match in posting-style.) Ted Zlatanov
2010-09-01 13:55                         ` replace matches in any string Ted Zlatanov
2010-09-02 11:29                           ` Stefan Monnier
2010-09-02 13:10                             ` Ted Zlatanov
2010-09-02 14:44                               ` Lars Magne Ingebrigtsen
2010-09-02 16:21                               ` Stefan Monnier
2010-09-02 16:45                                 ` David Kastrup
2010-09-02 17:08                                 ` Ted Zlatanov
2010-09-02 17:22                                   ` David Kastrup
2010-09-02 17:51                                     ` Ted Zlatanov
2010-09-02 18:04                                       ` David Kastrup
2010-09-02 19:12                                         ` Ted Zlatanov
     [not found]                                           ` <8739tsosyg.fsf_-_@maguirefamily.org>
2010-09-02 21:52                                             ` Recommended gnus spam filter system? Ted Zlatanov
2010-09-02 20:27                                     ` replace matches in any string Stefan Monnier
2010-09-02 22:18                                       ` Lars Magne Ingebrigtsen
2010-09-03  5:33                                       ` David Kastrup
2010-09-03 17:06                                         ` Lars Magne Ingebrigtsen
2010-08-29 20:07                   ` [PATCH] Use replace-match in posting-style Lars Magne Ingebrigtsen
2010-08-30 13:41                     ` Ted Zlatanov
2010-08-30 17:11                       ` Lars Magne Ingebrigtsen
2010-08-31 18:42                         ` Ted Zlatanov
2010-08-31 18:47                           ` Lars Magne Ingebrigtsen
2010-09-02 17:59                 ` Ted Zlatanov
2010-09-02 19:32                   ` Daniel Dehennin
2010-09-02 19:50                   ` [PATCH] Permit the use of regular expression match and replace in posting styles Daniel Dehennin
2010-09-02 21:56                     ` Ted Zlatanov
2010-09-04 22:47                       ` Mike Kupfer
2010-09-05  2:36                         ` Ted Zlatanov
2010-09-06 22:43                           ` Mike Kupfer
2010-09-06 23:18                             ` Ted Zlatanov

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