diff options
| author | Albert Krewinkel | 2014-07-18 08:23:49 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2014-07-18 08:23:49 +0000 |
| commit | 32a608307c53bd8bb1e29015bc36438f0ff0c572 (patch) | |
| tree | 060e684462501f40f081bf4638ba73e98c0eae2c | |
| parent | 0e6040770c6d7c819f985e1a665dce3e78751480 (diff) | |
| download | emacs-32a608307c53bd8bb1e29015bc36438f0ff0c572.tar.gz emacs-32a608307c53bd8bb1e29015bc36438f0ff0c572.zip | |
* lisp/gnus/gnus-msg.el (gnus-configure-posting-style):
Allow string replacements in values when matching against a header.
* doc/misc/gnus.texi (Posting Styles): Document the possibility to
perform string replacements when matching against headers.
| -rw-r--r-- | doc/misc/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/misc/gnus.texi | 14 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-msg.el | 14 |
4 files changed, 29 insertions, 9 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 44c2272a63d..d78543183df 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-07-18 Albert Krewinkel <albert+gnus@zeitkraut.de> | ||
| 2 | |||
| 3 | * gnus.texi (Posting Styles): Document the possibility to perform | ||
| 4 | string replacements when matching against headers. | ||
| 5 | |||
| 1 | 2014-07-09 Stephen Berman <stephen.berman@gmx.net> | 6 | 2014-07-09 Stephen Berman <stephen.berman@gmx.net> |
| 2 | 7 | ||
| 3 | * todo-mode.texi (Levels of Organization): Comment out statement | 8 | * todo-mode.texi (Levels of Organization): Comment out statement |
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index f77fd20dbf2..80c1cc2ef03 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -12813,10 +12813,12 @@ variable, which is a vector of the following headers: number subject | |||
| 12813 | from date id references chars lines xref extra. | 12813 | from date id references chars lines xref extra. |
| 12814 | 12814 | ||
| 12815 | In the case of a string value, if the @code{match} is a regular | 12815 | In the case of a string value, if the @code{match} is a regular |
| 12816 | expression, a @samp{gnus-match-substitute-replacement} is proceed on | 12816 | expression, or if it takes the form @code{(header @var{match} |
| 12817 | the value to replace the positional parameters @samp{\@var{n}} by the | 12817 | @var{regexp})}, a @samp{gnus-match-substitute-replacement} is proceed |
| 12818 | corresponding parenthetical matches (see @xref{Replacing Match,, | 12818 | on the value to replace the positional parameters @samp{\@var{n}} by |
| 12819 | Replacing the Text that Matched, elisp, The Emacs Lisp Reference Manual}.) | 12819 | the corresponding parenthetical matches (see @xref{Replacing Match,, |
| 12820 | Replacing the Text that Matched, elisp, The Emacs Lisp Reference | ||
| 12821 | Manual}.) | ||
| 12820 | 12822 | ||
| 12821 | @vindex message-reply-headers | 12823 | @vindex message-reply-headers |
| 12822 | 12824 | ||
| @@ -12848,6 +12850,10 @@ So here's a new example: | |||
| 12848 | ;; @r{If I'm replying to Larsi, set the Organization header.} | 12850 | ;; @r{If I'm replying to Larsi, set the Organization header.} |
| 12849 | ((header "from" "larsi.*org") | 12851 | ((header "from" "larsi.*org") |
| 12850 | (Organization "Somewhere, Inc.")) | 12852 | (Organization "Somewhere, Inc.")) |
| 12853 | ;; @r{Reply to a message from the same subaddress the message} | ||
| 12854 | ;; @r{was sent to.} | ||
| 12855 | ((header "x-original-to" "me\\(\\+.+\\)@@example.org") | ||
| 12856 | (address "me\\1@@example.org")) | ||
| 12851 | ((posting-from-work-p) ;; @r{A user defined function} | 12857 | ((posting-from-work-p) ;; @r{A user defined function} |
| 12852 | (signature-file "~/.work-signature") | 12858 | (signature-file "~/.work-signature") |
| 12853 | (address "user@@bar.foo") | 12859 | (address "user@@bar.foo") |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index e3c978331ec..cdfe4f4dea8 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-07-17 Albert Krewinkel <albert@zeitkraut.de> | ||
| 2 | |||
| 3 | * gnus-msg.el (gnus-configure-posting-style): | ||
| 4 | Allow string replacements in values when matching against a header. | ||
| 5 | |||
| 1 | 2014-07-07 Katsumi Yamaoka <yamaoka@jpl.org> | 6 | 2014-07-07 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 7 | ||
| 3 | * gnus-start.el (gnus-dribble-read-file): Don't stop the auto-saving of | 8 | * gnus-start.el (gnus-dribble-read-file): Don't stop the auto-saving of |
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 1c8635c5992..469b9d2cf81 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el | |||
| @@ -1826,7 +1826,7 @@ this is a reply." | |||
| 1826 | (with-current-buffer gnus-summary-buffer | 1826 | (with-current-buffer gnus-summary-buffer |
| 1827 | gnus-posting-styles) | 1827 | gnus-posting-styles) |
| 1828 | gnus-posting-styles)) | 1828 | gnus-posting-styles)) |
| 1829 | style match attribute value v results | 1829 | style match attribute value v results matched-string |
| 1830 | filep name address element) | 1830 | filep name address element) |
| 1831 | ;; If the group has a posting-style parameter, add it at the end with a | 1831 | ;; If the group has a posting-style parameter, add it at the end with a |
| 1832 | ;; regexp matching everything, to be sure it takes precedence over all | 1832 | ;; regexp matching everything, to be sure it takes precedence over all |
| @@ -1846,7 +1846,9 @@ this is a reply." | |||
| 1846 | (when (cond | 1846 | (when (cond |
| 1847 | ((stringp match) | 1847 | ((stringp match) |
| 1848 | ;; Regexp string match on the group name. | 1848 | ;; Regexp string match on the group name. |
| 1849 | (string-match match group)) | 1849 | (when (string-match match group) |
| 1850 | (setq matched-string group) | ||
| 1851 | t)) | ||
| 1850 | ((eq match 'header) | 1852 | ((eq match 'header) |
| 1851 | ;; Obsolete format of header match. | 1853 | ;; Obsolete format of header match. |
| 1852 | (and (gnus-buffer-live-p gnus-article-copy) | 1854 | (and (gnus-buffer-live-p gnus-article-copy) |
| @@ -1875,7 +1877,8 @@ this is a reply." | |||
| 1875 | (nnheader-narrow-to-headers) | 1877 | (nnheader-narrow-to-headers) |
| 1876 | (let ((header (message-fetch-field (nth 1 match)))) | 1878 | (let ((header (message-fetch-field (nth 1 match)))) |
| 1877 | (and header | 1879 | (and header |
| 1878 | (string-match (nth 2 match) header))))))) | 1880 | (string-match (nth 2 match) header) |
| 1881 | (setq matched-string header))))))) | ||
| 1879 | (t | 1882 | (t |
| 1880 | ;; This is a form to be evalled. | 1883 | ;; This is a form to be evalled. |
| 1881 | (eval match))))) | 1884 | (eval match))))) |
| @@ -1896,10 +1899,11 @@ this is a reply." | |||
| 1896 | (setq v | 1899 | (setq v |
| 1897 | (cond | 1900 | (cond |
| 1898 | ((stringp value) | 1901 | ((stringp value) |
| 1899 | (if (and (stringp match) | 1902 | (if (and matched-string |
| 1900 | (gnus-string-match-p "\\\\[&[:digit:]]" value) | 1903 | (gnus-string-match-p "\\\\[&[:digit:]]" value) |
| 1901 | (match-beginning 1)) | 1904 | (match-beginning 1)) |
| 1902 | (gnus-match-substitute-replacement value nil nil group) | 1905 | (gnus-match-substitute-replacement value nil nil |
| 1906 | matched-string) | ||
| 1903 | value)) | 1907 | value)) |
| 1904 | ((or (symbolp value) | 1908 | ((or (symbolp value) |
| 1905 | (functionp value)) | 1909 | (functionp value)) |