[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TINY signature randomizer
From: |
Giacomo Boffi |
Subject: |
Re: TINY signature randomizer |
Date: |
Fri, 05 May 2006 12:24:56 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b26 (linux) |
Giacomo Boffi <giacomo.boffi@polimi.it> writes:
> ;; At present, it works with a "~/.signature" file, where (possibly
> ;; multiline) stuff is separated by a line containing ONLY a "%"
> ;;
> ;; Change the filename in expand-file-name and the separator in
> ;; split-string below as you feel appropriate, and drop in your
> ;; "~/.gnus"
> ;;
> (defun sig_rand ()
> (with-temp-buffer
> (insert-file-contents-literally (expand-file-name "~/.signature"))
> (let ((lista (split-string (buffer-string (current-buffer)) "\n%\n")))
(let ((lista (split-string (buffer-string ) "\n%\n")))
> (elt lista (random (length lista))))))
> (setq message-signature 'sig_rand)
sorry, the original version is good for XEmacs, but does not run in
Emacs, where
,----
| buffer-string is a built-in function in `C source code'.
| (buffer-string)
|
| Return the contents of the current buffer as a string.
| If narrowing is in effect, this function returns only the visible part
| of the buffer.
`----
the corrected version works in XEmacs too, as the BUFFER argument is
optional
--
Sarebbe essere un atto di pieta'.
Contro i miei principi. -- whip, in IFMdI
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: TINY signature randomizer,
Giacomo Boffi <=