help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Organized Learning


From: Adam Hardy
Subject: Re: Organized Learning
Date: Thu, 25 Sep 2003 10:40:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030917

Here comes the lisp amateur...... I can't get it to work! When I execute (totd) it says "(void-function loop)". Have I got to install some package or something?

On 09/24/2003 08:20 PM Kevin Rodgers wrote:
Jesper Harder wrote:

googleartist@yahoo.com (Artist) writes:

I recently came upon a website called Stumbleupon.com where there is
a small toolbar to download and you get different website each time
you click the stumble icon matching to your interest and then you
rate the website etc..

Question: How we can converge the theme of the application with
emacs to learn new emacs things


This small code snippet (by Dave Pearson) that displays a "tip of the
day":

(defun totd ()
  (interactive)
  (with-output-to-temp-buffer "*Tip of the day*"
    (let* ((commands (loop for s being the symbols
                           when (commandp s) collect s))
           (command (nth (random (length commands)) commands)))
      (princ
       (concat "Your tip for the day is:\n========================\n\n"
               (describe-function command)
               "\n\nInvoke with:\n\n"
               (with-temp-buffer
                 (where-is command t)
                 (buffer-string)))))))


That could be extended to describe user options as well as commands:


------------------------------------------------------------------------

(defun totd ()
  (interactive)
  (with-output-to-temp-buffer "*Tip of the day*"
    (let* ((symbols (loop for s being the symbols
                          when (or (commandp s) (user-variable-p s))
                          collect s))
           (symbol (nth (random (length symbols)) symbols)))
      (princ
       (concat "Your tip for the day is:\n========================\n\n"
               (cond ((commandp symbol)
                      (concat (describe-function symbol)
                              "\n\nInvoke with:\n\n"
                              (with-temp-buffer
                               (where-is symbol t)
                               (buffer-string))))
                     ((user-variable-p symbol)
                      (describe-variable symbol))))))))


------------------------------------------------------------------------

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

--
GNU Emacs 21.3.1 on Linux 2.4.20 RH9





reply via email to

[Prev in Thread] Current Thread [Next in Thread]