From: Stinky Wizzleteet <wizzleteet@hotmail.com>
To: info-gnus-english@gnu.org
Subject: Customize Gnus: signature rotation
Date: Wed, 11 Aug 2010 11:02:07 +0200 [thread overview]
Message-ID: <87vd7hed4g.fsf@mauc.nl> (raw)
Hi,
I'm tweaking my signature to be generated by a custom fortune and it's
working swimmingly.
I noticed Adam Sjøgren put his in a table, that's looking really neat !
Dear adam, could you please enlighten me (us ?) on how you did that ?
I took a script from Bill Clementson's blog (see below) to read my own
fortune file, so it's more or less emacsen independant and I can add my
own little gems. For now I just copied /usr/share/games/fortunes/fortunes to ~/.emacs.d/misc/fortune.txt
(.emacs.d is svn controlled, to keep everythig in sync)
This is what I did:
in .gnus:
;;;;;;;;;;;;;;;;;;;;;;;; start
(setq
gnus-posting-styles
'(
((message-news-p)
(name "Stinky Wizzleteet")
(address "wizzleteet@hotmail.com")
(signature (concat "Stinky Wizzleteet thinks: \n"(myfortune)))
)))
;;;;;;;;;;;;;;;;;;;;;;;; stop
I tweaked the script from Bill Clementson blog
http://bc.tech.coop/blog/071226.html
to not conflict with emacs' fortune
in .emacs (or, in my case in ~/.emacs.d/site-start.d/92-Fortune.el, this
is different trick):
;;;;;;;;;;;;;;;;;;;;;;;; start
(defvar myfortune-file "~/.emacs.d/misc/fortune.txt"
"The file that fortunes come from.")
(defvar myfortune-strings nil
"The fortunes in the fortune file.")
(defun open-myfortune-file (file)
(find-file file)
(if (null myfortune-strings)
(let ((strings nil)
(prev 1))
(goto-char (point-min))
(while (re-search-forward "^%$" (point-max) t)
(push (buffer-substring-no-properties prev (- (point) 1))
strings)
(setq prev (1+ (point))))
(push (buffer-substring-no-properties prev (point-max)) strings)
(setq myfortune-strings (apply 'vector strings)))))
(defun myfortune ()
"Get a fortune to display."
(interactive)
(when (null myfortune-strings)
(open-myfortune-file myfortune-file)
(kill-buffer (current-buffer)))
(let* ((n (random (length myfortune-strings)))
(string (aref myfortune-strings n)))
(if (interactive-p)
(message (format "%s" string))
string)))
;; Override standard startup message
(defun startup-echo-area-message ()
(myfortune))
;;;;;;;;;;;;;;;;;;;;;;;; stop
This is what it gives:
--
Stinky Wizzleteet thinks:
You will stop at nothing to reach your objective, but only because your
brakes are defective.
next reply other threads:[~2010-08-11 9:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 9:02 Stinky Wizzleteet [this message]
[not found] ` <87fwyll90j.fsf@topper.koldfront.dk>
[not found] ` <877hjxtkh4.fsf@mauc.nl>
[not found] ` <7jbp99jqgd.fsf@rapun.sel.cam.ac.uk>
2010-08-11 18:32 ` Stinky Wizzleteet
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=87vd7hed4g.fsf@mauc.nl \
--to=wizzleteet@hotmail.com \
--cc=info-gnus-english@gnu.org \
/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).