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

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

Re: Organized Learning


From: Kevin Rodgers
Subject: Re: Organized Learning
Date: Wed, 24 Sep 2003 12:20:28 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Jesper Harder wrote:

address@hidden (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))))))))

reply via email to

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