Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from rec.arts.ascii, 16 Apr 1995.
SOFTWARE: signature randomizer for Emacs

SOFTWARE: signature randomizer for Emacs

;; Random signature selector
;; - selects signatures from one of two directories, overwrites ~/.sign=
ature

(defun selsig (which-sig)
  (setq real-buffer (current-buffer))
  (setq sig-buffer (find-file-noselect which-sig))
  (set-buffer sig-buffer)
  (write-file "~/.signature")
  (set-buffer real-buffer)
  (kill-buffer sig-buffer))

(defun randsig ()
  "Choose random signature to be used"
  (interactive)

  ; Directory is chosen by the distribution field
;;  (if (is-regexp-in-buf "^Distribution:.*world" "*post-news*")
  (if (call-buffer-searches-with-list sig-hillitty-regexps "*post-news*=
")
      (setq sig-directory sig-hillitty-directory)
    (setq sig-directory sig-estoton-directory))

  (if (file-directory-p sig-directory)
      ()
    (error (concat sig-directory " is not a directory")))

  ; All files that do not begin with a letter or number are eligible
  (setq sig-files (directory-files sig-directory t "^[a-zA-Z0-9]"))
  (setq sig-random (random))
  (if (< sig-random 0)
      (setq sig-random (- sig-random)))
  (setq sig-new
	(nth (% sig-random (length sig-files)) sig-files))

  ; It's nice to know which signature will be used
  (message "Current signature is %s" sig-new)
  (selsig sig-new))

;; Repeat regexp search in buffer for list
;; Return t if regexp found in buffer
(defun call-buffer-searches-with-list (list buffer)
  (if (is-regexp-in-buf (car list) buffer) t
    (if (not (cdr list)) nil
      (call-buffer-searches-with-list (cdr list) buffer))))

;; Do a regexp search for regexp in buffer buf
;; Return t if a match is found, else return nil

(defun is-regexp-in-buf (regexp buf)
  (interactive)
  (save-excursion
    (set-buffer buf)
    (goto-char (point-min))
    (if (re-search-forward regexp (point-max) t)
	t
      nil)))

;; Variables for signature selection

(setq sig-estoton-directory "~/.signatures1")
(setq sig-hillitty-directory "~/.signatures2")

(setq sig-hillitty-regexps '("^Distribution:.*koete"))


;; Select the new signature _before_ the article is sent
(setq news-inews-hook 'randsig)

;; EOF
--
`,`,`, |=AF=AF=AF| `,`,`, <Kim...@utu.fi> =B7 +358 40 500 295=
7 `,`,`,`,`,`,`,
`,`,`, |___| `,`,`, Studentbyn 84 A 10 =B7 FIN-20540 =C5bo =B7 Finland =
`,`,`,`,`,`,`,

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fbb9d,724ff72050b2fe36,start
X-Google-Attributes: gidfbb9d,public
From: Kim...@utu.fi (Kimmo Ketolainen +358 40 500 2957)
Subject: SOFTWARE: signature randomizer for Emacs
Date: 1995/04/16
Message-ID: <3msgm9$cu...@gagme.wwa.com>#1/1
X-Deja-AN: 100999581
approved: bob...@wwa.com
sender: bob...@gagme.wwa.com
organization: University of Turku
newsgroups: rec.arts.ascii
About this message. This message was posted publicly to the newsgroup rec.arts.ascii in 1995 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post