Gnus development mailing list
 help / color / mirror / Atom feed
* multiple .signatures possible
@ 1996-04-30  8:23 Uwe Sigurd Valentin Kubosch
  1996-04-30  9:34 ` Kai Grossjohann
  1996-04-30 12:08 ` Hallvard B Furuseth
  0 siblings, 2 replies; 10+ messages in thread
From: Uwe Sigurd Valentin Kubosch @ 1996-04-30  8:23 UTC (permalink / raw)


I often write for different organizations and would like the
.signature to replect this.  Sometimes I represent my University,
and sometimes just myself, or my firm, or...

I sometimes get complaints that my .signature is a bit large, so
I would like to be able to choose for each message which
.signature to use.

Is this possible?


donV
-- 
Uwe S.V. Kubosch        Milron Data             Crusaders Productions       
Stavikbakken 3          Johan Svensens vei 2a   Stasjonsveien 56            
N-1472 Fjellhamar       N-1472 Fjellhamar       N-2010 Strømmen             
Norway                  Norway                  Norway                      
Phone:+47 67 90 11 95   Phone:+47 67 90 95 24   Phone:+47 63 80 33 24       
Phone:+47 92 20 60 46                           Phone:+47 63 80 00 53 (ISDN)
                                                Phone:+47 92 20 60 63       
    Web:<http://www.ifi.uio.no/~uwek/>          Fax  :+47 63 80 00 54 (ISDN)
   Crusaders:<http://www.crusaders.no/>         BBS  :+47 22 10 46 46       


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

* Re: multiple .signatures possible
  1996-04-30  8:23 multiple .signatures possible Uwe Sigurd Valentin Kubosch
@ 1996-04-30  9:34 ` Kai Grossjohann
  1996-05-17  0:32   ` Sten Drescher
  1996-04-30 12:08 ` Hallvard B Furuseth
  1 sibling, 1 reply; 10+ messages in thread
From: Kai Grossjohann @ 1996-04-30  9:34 UTC (permalink / raw)
  Cc: ding

>>>>> On 30 Apr 1996 10:23:31 +0200, Uwe Sigurd Valentin Kubosch
>>>>> <uwek@ifi.uio.no> said:

  Uwe> I often write for different organizations and would like the
  Uwe> .signature to replect this.  Sometimes I represent my
  Uwe> University, and sometimes just myself, or my firm, or...

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

hth,
kai
-- 
Gleep!


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

* Re: multiple .signatures possible
  1996-04-30  8:23 multiple .signatures possible Uwe Sigurd Valentin Kubosch
  1996-04-30  9:34 ` Kai Grossjohann
@ 1996-04-30 12:08 ` Hallvard B Furuseth
  1 sibling, 0 replies; 10+ messages in thread
From: Hallvard B Furuseth @ 1996-04-30 12:08 UTC (permalink / raw)
  Cc: ding

> I often write for different organizations and would like the
> .signature to replect this.  Sometimes I represent my University,
> and sometimes just myself, or my firm, or...

My old (emacs-18) implementation is enclosed.  There are lots of similar
functions.

> I sometimes get complaints that my .signature is a bit large,

At least remove the spaces at the end of each line, so it's not ugly as
well for people without MIME support.  See below.  Also, you might
refrain from sending messages as MIME quoted-printable just because
there are lines with space at the end.  Encode 8-bit messages and maybe
messages where space-at-end-of-line are significant, nothing else.

> donV
> --=20
> Uwe S.V. Kubosch        Milron Data             Crusaders Productions      =
> =20
> Stavikbakken 3          Johan Svensens vei 2a   Stasjonsveien 56           =
> =20
> N-1472 Fjellhamar       N-1472 Fjellhamar       N-2010 Str=F8mmen           =
>  =20
> Norway                  Norway                  Norway                     =
> =20
> Phone:+47 67 90 11 95   Phone:+47 67 90 95 24   Phone:+47 63 80 33 24      =
> =20
> Phone:+47 92 20 60 46                           Phone:+47 63 80 00 53 (ISDN)
>                                                 Phone:+47 92 20 60 63      =
> =20
>     Web:<http://www.ifi.uio.no/~uwek/>          Fax  :+47 63 80 00 54 (ISDN)
>    Crusaders:<http://www.crusaders.no/>         BBS  :+47 22 10 46 46      =
> =20

Also, you might consider which information you relly need in the .sig.
For example, do people who receive e-mail (and thus can send e-mail
back) really need your snail-mail address?  Personally I do have a .sig
with my snail-mail address, but I almost never use it.


Regards,

Hallvard
\f
;; Extend mail-signature to prompt for ~/.signature.* file

;;; Usage:
;;;
;;; Make ~/.signature.* files with your signatures and insert this in ~/.emacs:
;;;
;;; (autoload 'hbf-mail-signature "~hbf/elisp/hbf-signature" nil t)
;;; (autoload 'set-signature-file "~hbf/elisp/hbf-signature" nil t)
;;; (setq mail-setup-hook '(lambda ()
;;;			     (fset 'mail-signature 'hbf-mail-signature)))
;;; (setq news-setup-hook '(lambda ()
;;;			     (fset 'news-reply-signature 'set-signature-file)))
;;;
;;; Now ^C^W in postnews will prompt for signature file,
;;; and with prefix arg it will prompt for signature file in mail.
;;;
;;; Use completion to see your choices.  The HELP char (usually ^H)
;;; displays the signature currently selected in the minibuffer,
;;; ^H in an empty minibuffer shows your current .signature.

(provide 'hbf-signature)


(defun set-signature-file (sfile)
  "Make ~/.signature into a (sym)link to SFILE."
  (interactive (list (hbf-signature-fileprompt "Set signature to: ")))
  (if sfile
      (let* ((default-directory (expand-file-name "~/"))
	     (signature (expand-file-name "~/.signature")))
	(setq sfile (expand-file-name sfile))
	(or (file-readable-p sfile)
	    (signal 'file-error (list "Could not read file" sfile)))
	(if (not (fboundp 'make-symbolic-link))
	    (add-name-to-file sfile signature
			      (or (not (eq (file-nlinks signature) 1)) 1))
	  (if (equal default-directory (file-name-directory sfile))
	      (setq sfile (file-name-nondirectory sfile)
		    default-directory "."))
	  (if (file-symlink-p signature)
	      (delete-file signature))
	  (make-symbolic-link sfile signature)))))


(defun hbf-mail-signature (&optional sfile)
  "Sign letter with contents of ~/.signature file.
With prefix arg, prompt for ~/.signature.* filename extension and make
~/.signature a (sym)link to that file."
  (interactive (if current-prefix-arg
		   (list (hbf-signature-fileprompt "Signature: "))))
  (and sfile
       (not (string-match "\\(^\\|/\\).signature$" sfile))
       (set-signature-file sfile))
  (save-excursion
    (goto-char (point-max))
    (insert-file-contents "~/.signature")
    (skip-chars-backward "\n")
    (let ((e (+ (point) 3)))
      (skip-chars-forward "\n")		; At least 2 newlines before signature.
      (while (< (point) e)
	(insert ?\n)))))


(defun hbf-signature-fileprompt (prompt &optional autohelp)
  (let ((minibuffer-completion-table
	 (mapcar '(lambda (s)
		    (list (substring s 11)))
		 (directory-files "~" nil "^\\.signature\\.[^#~]*$")))
	(minibuffer-completion-predicate nil)
	(minibuffer-completion-confirm nil)
	(minibuffer-help-form '(hbf-signature-help)))
    (cond (minibuffer-completion-table
	   (and autohelp (eq unread-command-char -1)
		(setq unread-command-char help-char))
	   (let ((sig (read-from-minibuffer prompt nil
					    minibuffer-local-must-match-map)))
	     (if (not (equal sig ""))
		 (concat "~/.signature." sig)))))))

(defun hbf-signature-help ()
  (let* ((f (expand-file-name (concat "~/.signature"
				      (if (> (buffer-size) 0) ".")
				      (buffer-string))))
	 (attr (file-attributes f)))
    (if attr
	(with-output-to-temp-buffer "*Help*"
	  (save-excursion
	    (set-buffer "*Help*")
	    (insert "Signature file: " (file-name-nondirectory f))
	    (cond ((stringp (car attr))	; File is a symbolic link?
		   (insert " --> " (car attr)))
		  ((> (nth 1 attr) 1)	; File has several names?
		   (insert (format " (%d links)" (nth 1 attr)))))
	    (insert "\n--\n")
	    (insert-file-contents f)
	    (goto-char (point-max))
	    (if (bolp)
		(delete-char -1))
	    (goto-char (point-min))))
      (format "No such file: ~/%s" (file-name-nondirectory f)))))


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

* Re: multiple .signatures possible
  1996-04-30  9:34 ` Kai Grossjohann
@ 1996-05-17  0:32   ` Sten Drescher
  1996-05-17  4:31     ` Lars Magne Ingebrigtsen
  1996-05-17 12:35     ` Jack Vinson
  0 siblings, 2 replies; 10+ messages in thread
From: Sten Drescher @ 1996-05-17  0:32 UTC (permalink / raw)


>>>>> Kai Grossjohann writes:

>>>>> On 30 Apr 1996 10:23:31 +0200, Uwe Sigurd Valentin Kubosch
>>>>> <uwek@ifi.uio.no> said:

Uwe> I often write for different organizations and would like the
Uwe> .signature to replect this.  Sometimes I represent my University,
Uwe> and sometimes just myself, or my firm, or...

KG> (defun my-signature () (cond ((string-match "ding"
KG> gnus-newsgroup-name) "Signature for Ding") ((string-match "^nnml:"
KG> gnus-newsgroup-name) "Signature for mail groups") (t "Default
KG> signature"))) (setq message-signature 'my-signature)

KG> You get the idea...

	Yup, but this doesn't use multiple .signature files. );  I've
tried

(setq message-signature
      '(cond ((message-news-p)
	      (insert-file-contents (expand-file-name "~/.signature")))
	     (t
	      (insert-file-contents (expand-file-name "~/.signature")))))

	(Yes, I know, they are the same.  I'm testing) But that puts
the .signature in the header.  I've tried

(setq message-signature
      '(cond ((message-news-p) "~/.signature")
	     (t "~/.signature")))

	But that makes it put in the string (appropriately).  I've
tried using the same thing for message-signature-file, but that blows
up.  Is there any way of returning the contents of a file as a string?
 I'd rather not duplicate the whole message-signature functionality in
my .gnus.

-- 
~/.signature


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

* Re: multiple .signatures possible
  1996-05-17  0:32   ` Sten Drescher
@ 1996-05-17  4:31     ` Lars Magne Ingebrigtsen
  1996-05-17 17:22       ` Sten Drescher
  1996-05-17 12:35     ` Jack Vinson
  1 sibling, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 1996-05-17  4:31 UTC (permalink / raw)


Sten Drescher <sten.drescher@tivoli.com> writes:

> 	But that makes it put in the string (appropriately).  I've
> tried using the same thing for message-signature-file, but that blows
> up. 

In what way does it blow up?  The right thing to do there is to set
`message-signature' to t and `message-signature-file' to whatever
signature file you like.

-- 
  "Yes.  The journey through the human heart 
     would have to wait until some other time."


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

* Re: multiple .signatures possible
  1996-05-17  0:32   ` Sten Drescher
  1996-05-17  4:31     ` Lars Magne Ingebrigtsen
@ 1996-05-17 12:35     ` Jack Vinson
  1996-05-17 15:29       ` Scott Blachowicz
  1 sibling, 1 reply; 10+ messages in thread
From: Jack Vinson @ 1996-05-17 12:35 UTC (permalink / raw)



>>>>> On 30 Apr 1996 10:23:31 +0200, Uwe Sigurd Valentin Kubosch
>>>>> <uwek@ifi.uio.no> said:

Uwe> I often write for different organizations and would like the
Uwe> .signature to replect this.  Sometimes I represent my University,
Uwe> and sometimes just myself, or my firm, or...

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

-- 
Jack Vinson                       jvinson@cheux.ecs.umass.edu
Sunderland, MA                    <http://www.cis.upenn.edu/~vinson/home.html>
Q. "Is a cat's urinary tract health important?"  A. "Yes, very."
     - Purina Cat Chow Special Formula Commercial


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

* Re: multiple .signatures possible
  1996-05-17 12:35     ` Jack Vinson
@ 1996-05-17 15:29       ` Scott Blachowicz
  1996-05-17 20:05         ` Steven L Baur
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Blachowicz @ 1996-05-17 15:29 UTC (permalink / raw)
  Cc: ding

>>>>> "Jack" == Jack Vinson <jvinson@cheux.ecs.umass.edu>

>>>>> On 30 Apr 1996 10:23:31 +0200, Uwe Sigurd Valentin Kubosch
>>>>> <uwek@ifi.uio.no> said:

 Uwe> I often write for different organizations and would like the
 Uwe> .signature to replect this.  Sometimes I represent my University,
 Uwe> and sometimes just myself, or my firm, or...

 Jack> For multiple signature files, I advise the message-insert-signature
 Jack> function to set message-signature-file to a random file from my
 Jack> signature directory

Hey...that sounds pretty tricky/cool.  Is 'advice' supported in XEmacs?

I thought there already was a method for doing that sort of stuff...by
setting the signature-file variable to an elisp function or by making your
.signature file an executable script or some such?  Hmmm...I guess the
script wouldn't have the gnus context information to base the decision on
though.

Scott Blachowicz  Ph: 206/283-8802x240   Mathsoft (Data Analysis Products Div)
                                         1700 Westlake Ave N #500
scott@statsci.com                        Seattle, WA USA   98109
Scott.Blachowicz@seaslug.org


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

* Re: multiple .signatures possible
  1996-05-17  4:31     ` Lars Magne Ingebrigtsen
@ 1996-05-17 17:22       ` Sten Drescher
  1996-05-17 18:54         ` Richard Pieri
  0 siblings, 1 reply; 10+ messages in thread
From: Sten Drescher @ 1996-05-17 17:22 UTC (permalink / raw)


>>>>> Lars Magne Ingebrigtsen writes:

LMI> Sten Drescher <sten.drescher@tivoli.com> writes:
>> But that makes it put in the string (appropriately).  I've tried
>> using the same thing for message-signature-file, but that blows up.

LMI> In what way does it blow up?  The right thing to do there is to
LMI> set `message-signature' to t and `message-signature-file' to
LMI> whatever signature file you like.

	But I don't want one signature file, I want multiple signature
files, selected based on where I am writing.  message-signature-file
doesn't work with a function, and message-signature doesn't let you
return a file name to be used.

-- 
+----------------------  Tivoli Customer Support  ----------------------+
|   Sten Drescher                     Tivoli Systems, Inc               |
|   email: sten.drescher@tivoli.com   9442 Capital of Texas Hwy North   |
|   phone: (512) 794-9070             Arboretum Plaza One, Suite 500    |
|   fax  : (512) 345-2784             Austin, Texas 78759               |
+-----------------------------------------------------------------------+


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

* Re: multiple .signatures possible
  1996-05-17 17:22       ` Sten Drescher
@ 1996-05-17 18:54         ` Richard Pieri
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Pieri @ 1996-05-17 18:54 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "SD" == Sten Drescher <sten.drescher@tivoli.com> writes:

SD> message-signature-file doesn't work with a function,

But it can be set within a function, like <foo>-mode-hook, which might
use a cond or alist to set message-signature-file's value based on the
value of gnus-newsgroup-name.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv

iQCVAwUBMZzLdZ6VRH7BJMxHAQGi/gP9FzI4BYhFOE/fh15wAS+L610+q7pInTAZ
DTZfTC2O8oswC9hAqi7Zh+Mc8V8FyOr0FfnmKvehZzk+7E4RCoECWFnA9ecpfBrT
7HH35BDnqHCNwIZfB6XksrNc9YP2A5yzd+5ne6T9AtNNzuXlA7uvfx+Vkzt/qepw
iSoByzDVc0U=
=icrG
-----END PGP SIGNATURE-----
-- 
Richard Pieri/Information Services \ Variety is the spice of life: one day
<ratinox@unilab.dfci.harvard.edu>   \ ignore people, the next day annoy
http://www.dfci.harvard.edu/         \ them. -A cat's guide to life


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

* Re: multiple .signatures possible
  1996-05-17 15:29       ` Scott Blachowicz
@ 1996-05-17 20:05         ` Steven L Baur
  0 siblings, 0 replies; 10+ messages in thread
From: Steven L Baur @ 1996-05-17 20:05 UTC (permalink / raw)


>>>>> "Scott" == Scott Blachowicz <scott@statsci.com> writes:

Jack> For multiple signature files, I advise the
Jack> message-insert-signature function to set message-signature-file
Jack> to a random file from my signature directory

Scott> Hey...that sounds pretty tricky/cool.  Is 'advice' supported in
Scott> XEmacs?

Yes.

defadvice: an autoloaded Lisp macro.
  -- loads from "advice".
Defines a piece of advice for FUNCTION (a symbol).
The syntax of `defadvice' is as follows:

  (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...)
    [DOCSTRING] [INTERACTIVE-FORM]
    BODY... )
...
-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be proofread for $250/hour.
Andrea Seastrand: For your vote on the Telecom bill, I will vote for anyone
except you in November.


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

end of thread, other threads:[~1996-05-17 20:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-30  8:23 multiple .signatures possible Uwe Sigurd Valentin Kubosch
1996-04-30  9:34 ` Kai Grossjohann
1996-05-17  0:32   ` Sten Drescher
1996-05-17  4:31     ` Lars Magne Ingebrigtsen
1996-05-17 17:22       ` Sten Drescher
1996-05-17 18:54         ` Richard Pieri
1996-05-17 12:35     ` Jack Vinson
1996-05-17 15:29       ` Scott Blachowicz
1996-05-17 20:05         ` Steven L Baur
1996-04-30 12:08 ` Hallvard B Furuseth

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