all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: What is the :eval form ?
Date: Fri, 08 Jun 2012 20:02:38 +0200	[thread overview]
Message-ID: <87d35965s1.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: lzvcj1tzqd.wl%philippe.coatmeur@gmail.com

Philippe M. Coatmeur <philippe.coatmeur@gmail.com> writes:

Hi Philippe,

> How can I find information about this special form ? When I ask emacs
> using C-h f with point over it, it acts like google and shows me the
> "plain eval" info page... :(

:eval is neither a function nor a special form, it is a keyword.

,----[ (info "(elisp)Symbol Type") ]
|    A symbol whose name starts with a colon (`:') is called a "keyword
| symbol".  These symbols automatically act as constants, and are
| normally used only by comparing an unknown symbol with a few specific
| alternatives.
`----

Some keywords have a special meaning for some variables such as
`global-mode-string', so let's check its docs instead of googling.

,----[ C-h v global-mode-string RET ]
| global-mode-string is a variable defined in `C source code'.
| Its value is ("" appt-mode-string)
| 
|   This variable is potentially risky when used as a file local variable.
| 
| Documentation:
| String (or mode line construct) included (normally) in `mode-line-format'.
`----

Ah, so I might want to check out `mode-line-format'.

,----[ C-h v mode-line-format RET ]
| mode-line-format is a variable defined in `C source code'.
| Its value is shown below.
| 
|   Automatically becomes buffer-local when set in any fashion.
|   This variable is potentially risky when used as a file local variable.
| 
| Documentation:
| [...]
| For a list of the form `(:eval FORM)', FORM is evaluated and the result
|  is used as a mode line element.  Be careful--FORM should not load any files,
|  because that can cause an infinite recursion.
| [...]
`----

So there's your :eval.  Another way to find out about the meaning of
eval was to use the emacs info docs.

  C-h i m elisp RET C-s :eval C-s [maybe repeatedly]

leads to:

,----[ (info "(elisp)Mode Line Data") ]
|    A mode line construct may be as simple as a fixed string of text,
| but it usually specifies how to combine fixed strings with variables'
| values to construct the text.  Many of these variables are themselves
| defined to have mode line constructs as their values.
| 
|    Here are the meanings of various data types as mode line constructs:
|
| [...]
|
| `(:eval FORM)'
|      A list whose first element is the symbol `:eval' says to evaluate
|      FORM, and use the result as a string to display.  Make sure this
|      evaluation cannot load any files, as doing so could cause infinite
|      recursion.
`----

Bye,
Tassilo




  parent reply	other threads:[~2012-06-08 18:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 18:39 What is the :eval form ? Philippe M. Coatmeur
2012-06-08 17:56 ` Eli Zaretskii
2012-06-08 18:01 ` Drew Adams
2012-06-08 18:02 ` Tassilo Horn [this message]
2012-06-09  6:40   ` Richard Riley
2012-06-09  8:34     ` Thien-Thi Nguyen
2012-06-09 14:08     ` Drew Adams
2012-06-08 18:08 ` Tassilo Horn
2012-06-08 18:10 ` Drew Adams
2012-06-08 18:21 ` Barry Margolin
     [not found] ` <mailman.2446.1339178928.855.help-gnu-emacs@gnu.org>
2012-06-08 19:19   ` Philippe M. Coatmeur

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=87d35965s1.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=help-gnu-emacs@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.