Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Gnus (Emacs Newsreader) FAQ
Section - Q2.10 How do I get multiple .signature files?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Airports ]


Top Document: Gnus (Emacs Newsreader) FAQ
Previous Document: Q2.9 How can I make favorite authors be highlighted in the Summary buffer?
Next Document: Q2.11 Gnus and compression hooks
See reader questions & answers on this topic! - Help others by sharing your knowledge
   Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> writes:
(defun my-signature ()
  (cond ((string-match "ding" gnus-newsgroup-name)
         "Signature for Ding")
        ((string-match "^nnml:" gnus-newsgroup-name)
         "Signature for mail groups")
        (t
         "Default signature")))
(setq message-signature 'my-signature)

   You get the idea ...
   
   Jack Vinson <jvinson@cheux.ecs.umass.edu> writes:
   For multiple signature files, I advise the message-insert-signature
   function to set message-signature-file to a random file from my
   signature directory: (I have files that look like sig1 sig2 etc in
   that directory).
;; random insertion of .signature file
;; Thanks to Glenn R Coombs: glenn@prl.philips.co.uk
(defvar grc-signature-dir   "~/.sig/")
(defvar grc-signature-base  "sig")

(defadvice message-insert-signature (before random-mail-sig-ag act comp)
  "Change the value of message-signature-file each time
`message-insert-signature' is called."
  (let ((files (file-name-all-completions
                grc-signature-base (expand-file-name grc-signature-dir))))
    (if files (let ((file (nth (random (length files)) files)))
                (setq message-signature-file (concat grc-signature-dir file))
                ))))

   Ralph Schleicher <rs@purple.UL.BaWue.DE> writes:
   Here's a version which will add a fortune cookie to your .signature.
(setq message-signature 'fortune)

(defvar fortune-program nil
  "*Program used to generate epigrams, default \"fortune\".")

(defvar fortune-switches nil
  "*List of extra arguments when `fortune-program' is invoked.")

(defun fortune (&optional long-p)
  "Generate a random epigram.
An optional prefix argument generates a long epigram.
The epigram is inserted at point if called interactively."
  (interactive "*P")
  (let ((fortune-buffer (generate-new-buffer " fortune"))
        (fortune-string "Have an adequate day."))
    (unwind-protect
        (save-excursion
          (set-buffer fortune-buffer)
          (apply 'call-process
                 (append (list (or fortune-program "fortune") nil t nil)
                         fortune-switches (list (if long-p "-l" "-s"))))
          (skip-chars-backward "\n\t ")
          (setq fortune-string (buffer-substring (point-min) (point))))
      (kill-buffer fortune-buffer))
    (if (interactive-p)
        (insert fortune-string))
    fortune-string))

   Bjorn Borud <borud@guardian.no> offers:
(setq message-borud-newsgroup-signature
      '(
        ("^no\\.test$"       . "~/.no.test-signatur")
        ("^no\\.irc$"        . "~/.no.irc-signature")
        ("^no\\.general"     . "~/.no.general-signature")
        ("^no\\.alt\\.frust" . "~/.no.alt.frustrasjoner-signature")
        ("^no\\.alt\\."      . "~/.no.alt-signature")
        ("www"               . "~/.www-signature")
        ("^no\\."            . "~/.no-signature")
        ("^alt\\.irc"        . "~/.alt.irc-signature")
        ("^alt\\."           . "~/.alt-signature")
        ("^comp\\."          . "~/.comp-signature")))

(setq message-borud-default-signature (expand-file-name "~/.signature"))


(defun message-borud-signature (group)
  "Find the signature file that applies to the newsgroup
specified by GROUP.  If this file is not found return the
value of message-borud-default-signature"
  (let ((tmp message-borud-newsgroup-signature))
    (while (and tmp (not (string-match (caar tmp) group)))
      (setq tmp (cdr tmp)))
    (if tmp
        (cdar tmp)
      message-borud-default-signature)))


;;; Standard stuff

(setq message-signature
      (lambda ()
        (progn
          (let
              ((sigfile (message-borud-signature gnus-newsgroup-name)))
            (if (file-exists-p sigfile)
                (save-excursion
                  (progn
                    (goto-char (point-max))
                    (insert "\n\n-- \n")
                    (insert-file-contents sigfile)
                    (goto-char (point-min)))))))))

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Gnus (Emacs Newsreader) FAQ
Previous Document: Q2.9 How can I make favorite authors be highlighted in the Summary buffer?
Next Document: Q2.11 Gnus and compression hooks

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
Justin Sheehy <dworkin@ccs.neu.edu>





Last Update March 27 2014 @ 02:11 PM