Gnus development mailing list
 help / color / mirror / Atom feed
From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Cc: ding@ifi.uio.no
Subject: Re: multiple .signatures possible
Date: Tue, 30 Apr 1996 14:08:14 +0200 (MET DST)	[thread overview]
Message-ID: <199604301208.OAA03190@bombur2.uio.no> (raw)
In-Reply-To: <w1gzq7uyvb0.fsf@teit.ifi.uio.no>

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


      parent reply	other threads:[~1996-04-30 12:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-30  8:23 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199604301208.OAA03190@bombur2.uio.no \
    --to=h.b.furuseth@usit.uio.no \
    --cc=ding@ifi.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).