Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet thread from rec.arts.ascii, started 16 Apr 1995.
 _   _                     _        _             _     _           
| | | |___  ___ _ __   ___| |_     / \   _ __ ___| |__ (_)_   _____ 
| | | / __|/ _ \ '_ \ / _ \ __|   / _ \ | '__/ __| '_ \| \ \ / / _ \
| |_| \__ \  __/ | | |  __/ |_   / ___ \| | | (__| | | | |\ V /  __/
 \___/|___/\___|_| |_|\___|\__| /_/   \_\_|  \___|_| |_|_| \_/ \___|
SOFTWARE: signature randomizer for Emacs

SOFTWARE: signature randomizer for Emacs

rec.arts.ascii · 1 message · 16 Apr 1995
;; 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 =
`,`,`,`,`,`,`,

About this thread. These messages were posted publicly to the newsgroup rec.arts.ascii in 1995 and are 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 one of the authors? 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