unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Idea: Allow faces to have text-like properties
@ 2002-02-28 10:25 Kim F. Storm
  2002-02-28 12:05 ` Per Abrahamsen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kim F. Storm @ 2002-02-28 10:25 UTC (permalink / raw)
  Cc: tzz


I saw the article below in comp.emacs, and it got me wondering whether
it would make sense for a `face' to have an `invisible' property.

That would - among other things, make it very easy to toggle
visibility of comments in a buffer by simply changing the `invisible'
property of the comment face (or setting font-lock-comment-face to a
face derived from the original comment face with the invisible
property set).

In general, maybe a `face' could have all the normal `text properties'
like keymap, invisible, intangible, etc.  (except face of course).

I don't know whether it is worth any efforts to pursue this, but
it might open up some interesting possibilities -- e.g. clicking
mouse-3 on a comment will open a pop-up menu with the options to
spell check it, refill it, uncomment it, ...   That could be
achieved simply by adding the keymap property to the comment face.

What do you think?

++kfs

------------- comp.emacs article follows ----------------
From: Ted Zlatanov <tzz@beld.net>

eugene kim <eugene1977@hotmail.com> writes:

> i think i found a lisp package which does what i wanted...
> hideshow..
>
> but i can't figure out how i can hide/show all comments in buffer..
> could u help a newbie?

Hideshow is overkill, I think.

You could temporarily set the comment face (a face is like a
combination of font size and text color properties as far as the user
is concerned) color to be invisible.  This may not be the way to
achieve the results you were looking for, but the effect will be the
same, and likely much easier to do.

Put this in your .emacs:

(make-face 'fl1-comment-face) ;; comment
(set-face-foreground 'fl1-comment-face "white")
(set-face-background 'fl1-comment-face "black")
(setq font-lock-comment-face 'fl1-comment-face)

Bind a key to a lambda function that executes

(set-face-foreground 'fl1-comment-face "black")
(set-face-background 'fl1-comment-face "black")

And another one to a lambda that executes

(set-face-foreground 'fl1-comment-face "white")
(set-face-background 'fl1-comment-face "black")

You can use colors other than black and white, if you wish.  The idea
is just to make the foreground temporarily invisible by making it the
same as the background.

Ted


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-03-05 19:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-28 10:25 Idea: Allow faces to have text-like properties Kim F. Storm
2002-02-28 12:05 ` Per Abrahamsen
2002-02-28 13:15   ` Kim F. Storm
2002-03-01  1:05 ` Stefan Monnier
2002-03-01  1:11 ` Richard Stallman
2002-03-01  1:24   ` Stefan Monnier
2002-03-05 19:02     ` Teodor Zlatanov

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).