Newsgroups: fj.editor.emacs
Path: galaxy.trc.rwcp.or.jp!sparky!uunet!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!jrdzzz!nozaka
From: nozaka@jrdzzz.jrd.dec.com (Masaki Nozaka)
Subject: Re: [Q] GNUS change signature 
In-Reply-To: takei@ip.titech.ac.jp's message of Fri, 11 Dec 1992 10:57:02 GMT
Message-ID: <NOZAKA.92Dec16195327@jrdzzz.jrd.dec.com>
Sender: usenet@jrd.dec.com (USENET News System)
Nntp-Posting-Host: jrdzzz.jrd.dec.com
Organization: Digital Equipment Corporation Japan, R&D center
References: <TAKEI.92Dec11195649@knuth.ip.titech.ac.jp>
Date: Wed, 16 Dec 1992 10:53:27 GMT
Lines: 120
Xref: galaxy.trc.rwcp.or.jp fj.editor.emacs:2771
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.editor.emacs&nb=2771&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

In article <TAKEI.92Dec11195649@knuth.ip.titech.ac.jp> takei@ip.titech.ac.jp (TAKEI Masahiro) writes:

>   GNUS $B$G$O(B .signature-distribution  $B$H$$$&%U%!%$%k$,$"$l$P(B
>   distribution $B$K$h$C$F(B signature $B$OJQ$o$j$^$9$,!"(B $B%K%e!<%9%0%k!<%W(B
>   $B$4$H$KJQ$($k$h$&$JJ}K!$O$"$k$N$G$7$g$&$+!)(B

~/.signature+news.group.name
    ^$B$3$NItJ,$O(B '+' $B$G$9!#(B
 
$B$H$$$&%U%!%$%k$r(B news.group.name $B$H$$$&%K%e!<%9%0%k!<%W$KBP$9$k(B 
signature $B$K$9$k%Q%C%A$G$9!#3:Ev$9$k4X?t$rC5$7$F!"CV$-49$($k$+!"(B
gnus $B$,%m!<%I$5$l$?$"$H$G!"$3$C$A$N4X?t$r%*!<%P%i%$%I$9$k$h$&$K!"(B
$B%m!<%I$9$k$+$7$F$/$@$5$$!#(B

~/.signature+news.group $B$H$$$&%U%!%$%k$r$D$/$C$F$*$1$P!"(B news.group.foo
$B$K$b(B news.group.baa $B$K$b$=$N(B .signature $B$,E,MQ$5$l$^$9!#(B

~/.signature-distribution $B$bM-8z$G$9!#(B


(defun gnus-inews-article ()
  "NNTP inews interface."
  (let ((signature
        (if gnus-signature-file
            (expand-file-name gnus-signature-file nil)))
       (distribution nil)
       (artbuf (current-buffer))
       (tmpbuf (get-buffer-create " *GNUS-posting*")))
    (save-excursion
      (set-buffer tmpbuf)
      (buffer-flush-undo (current-buffer))
      (erase-buffer)
      (insert-buffer-substring artbuf)
      ;; Get distribution.
      (save-restriction
       (goto-char (point-min))
       (search-forward "\n\n")
       (narrow-to-region (point-min) (point))
       (setq distribution (mail-fetch-field "distribution")))
      (widen)
      (if signature
         (progn
           ;; Change signature file by distribution.
           ;; Suggested by hyoko@flab.fujitsu.junet.
   (if (signature-by-news-group signature)
       (setq signature (signature-by-news-group signature)))
           (if (file-exists-p (concat signature "-" distribution))
               (setq signature (concat signature "-" distribution)))
           ;; Insert signature.
           (if (file-exists-p signature)
               (progn
                 (goto-char (point-max))
                 (insert "--\n")
                 (insert-file-contents signature)))
           ))
      ;; Prepare article headers.
      (save-restriction
       (goto-char (point-min))
       (search-forward "\n\n")
       (narrow-to-region (point-min) (point))
       (gnus-inews-insert-headers)
       ;; Save author copy of posted article. The article must be
       ;;  copied before being posted because `gnus-request-post'
       ;;  modifies the buffer.
       (let ((case-fold-search t))
         ;; Find and handle any FCC fields.
         (goto-char (point-min))
         (if (re-search-forward "^FCC:" nil t)
             (gnus-inews-do-fcc))))
      (widen)
      ;; Run final inews hooks.
      (run-hooks 'gnus-Inews-article-hook)
      ;; Post an article to NNTP server.
      ;; Return NIL if post failed.
      (prog1
         (gnus-request-post)
       (kill-buffer (current-buffer)))
      )))


(defun signature-by-news-group (signature)
  (let ((field-name "newsgroups"))
    (save-excursion
      (goto-char (point-min))
      (let ((case-fold-search t)
    (name (concat "^" (regexp-quote field-name) "[ \t]*:[ \t]*")))
(goto-char (point-min))
(if (re-search-forward name nil t)
    (progn
      (let ((opoint (point)))
(re-search-forward "[^a-z\\.]" nil t)
(re-search-backward "[a-z\\.]" nil t)
(forward-char 1)
(while 
    (and (not (file-exists-p 
       (concat signature "+"
       (buffer-substring opoint (point)))))
 (> (point) opoint))
  (re-search-backward "[^a-z]" nil t))
(if (file-exists-p 
     (concat signature "+"
     (buffer-substring opoint (point))))
    (concat signature "+"
    (buffer-substring opoint (point)))
  nil)))
  nil)))))


$B<B$O0JA0<RFb%m!<%+%k%K%e!<%9%0%k!<%W$G$b?t9T$N(B signature $B$OD92a$.$k!"(B
1 $B9T$K$7$m!*$H$+$$$&?M$,$$$F!"$G$7$+$b!"$=$&$$$&$3$H$r8@$&?M$,$$$k$N$O(B
$B7h$^$C$?%K%e!<%9%0%k!<%W$@$C$?$N$G!"$8$c$!H`$i$,$$$k$H$3$m$G$O(B 1 $B9T$N(B
signature $B$K$7$F!"B>$G$OJL$N$b$&$9$3$7D9$$$N$r;H$*$&$H;W$C$F$D$/$C$?$b$N(B
$B$G$9!#(B 8-)

$B$N$6$+(B
--
  Digital Equipment Corporation Japan
  Research and Development center
  International System & Engineering Development Architecture
  Masaki NOZAKA Tel. 045(336)5306             |d|i|g|i|t|a|l|
