From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: bind faces?
Date: Sat, 13 May 2006 20:13:15 -0700 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICEEAKDGAA.drew.adams@oracle.com> (raw)
In-Reply-To: <fc339e4a0605131916i3a74c85cg1013004eec0e3125@mail.gmail.com>
> Why exactly do you want to do this?
>
> I thought I explained that.... Why does anyone want
> to bind variables and functions, as opposed to using
> `unwind-protect', assigning new definitions, and
> restoring afterward?
"By analogy with" isn't a very compelling reason for a feature. What
I'm asking is: "What is a real-world problem where you would need
such a thing?"
Emacs-Lisp programming. Any situation where you might want to redefine a
face only temporarily, for use in a particular context. Is that hard to
imagine?
My impression is that faces in general reflect a more permanent sort
of state
Precisely. You might want to change some properties of a face temporarily in
a function, without affecting its "more permanent" nature. You might want to
use existing code that employs a particular face (e.g. hard-coded - there
are examples of `region' and `highlight' in the standard Emacs code, for
instance), substituting another face, with different face properties, for
it. You might want to use existing code that employs a face, but not have
that face appear (be noticeable) at all.
and that the idea of "binding" face definitions is a bit
alien to the way they are used.
There is not only one way that faces are used - "the way". Binding a face
would be similar to binding a global variable. Like faces, many global
variables (including most user options) have a "more permanent sort of
state", but that doesn't mean it isn't useful sometimes to bind them to
different values locally.
It's precisely because we don't want to change the more permanent state of
global variables that we bind them to new values instead of assigning them
those values. Imagine that you had no `let' binding and you wanted to get a
similar effect. You would use `unwind-protect', save the value, assign the
new value, execute the body, and then restore the original value. That's
where we are today with faces.
"When you have only a hammer, everything looks like a nail", as they say. If
there were no `let', there would be a lot less temporary changing of global
variables (not worth the hassle; lack of appreciation of the
possibility/need), and someone suggesting to add `let' would be asked "Why
do you need that in the real world? Global variables have a permanent sort
of state. That is a bit alien to the way they are used."
next prev parent reply other threads:[~2006-05-14 3:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-13 17:54 bind faces? Drew Adams
2006-05-13 18:07 ` Chong Yidong
2006-05-13 19:40 ` Drew Adams
2006-05-14 2:39 ` Richard Stallman
2006-05-14 0:52 ` Miles Bader
2006-05-14 1:02 ` Drew Adams
2006-05-14 2:16 ` Miles Bader
2006-05-14 3:13 ` Drew Adams [this message]
2006-05-14 4:10 ` David Kastrup
2006-05-14 2:33 ` Miles Bader
2006-05-14 13:17 ` Stefan Monnier
2006-05-14 14:32 ` Drew Adams
2006-05-14 14:46 ` Miles Bader
2006-05-14 16:13 ` Drew Adams
2006-05-14 17:49 ` Stefan Monnier
2006-05-14 18:43 ` Drew Adams
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNEMKBNJBGPAOPIJOOICEEAKDGAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).