From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/14265 Path: news.gmane.org!not-for-mail From: Stinky Wizzleteet Newsgroups: gmane.emacs.gnus.user Subject: Customize Gnus: signature rotation Date: Wed, 11 Aug 2010 11:02:07 +0200 Message-ID: <87vd7hed4g.fsf@mauc.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1291957196 13781 80.91.229.12 (10 Dec 2010 04:59:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 04:59:56 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Fri Dec 10 05:59:51 2010 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQv5D-0006mt-BL for gegu-info-gnus-english@m.gmane.org; Fri, 10 Dec 2010 05:59:51 +0100 Original-Received: from localhost ([127.0.0.1]:52592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQv4f-0004fH-O5 for gegu-info-gnus-english@m.gmane.org; Thu, 09 Dec 2010 23:59:17 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Original-Newsgroups: gnu.emacs.gnus User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:h2hVHAa3jpo8kOeMLf4y2Obp5HA= Original-Lines: 76 Original-NNTP-Posting-Host: 83.160.190.30 Original-X-Trace: 1281517328 news.xs4all.nl 22916 [::ffff:83.160.190.30]:35329 Original-X-Complaints-To: abuse@xs4all.nl Original-Xref: usenet.stanford.edu gnu.emacs.gnus:84627 X-Mailman-Approved-At: Thu, 09 Dec 2010 20:27:49 -0500 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:14265 Archived-At: 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.