all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: no-spam@cua.dk (Kim F. Storm)
Cc: tzz@beld.net
Subject: Idea: Allow faces to have text-like properties
Date: 28 Feb 2002 11:25:45 +0100	[thread overview]
Message-ID: <5xbse93nti.fsf@kfs2.cua.dk> (raw)


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


             reply	other threads:[~2002-02-28 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-28 10:25 Kim F. Storm [this message]
2002-02-28 12:05 ` Idea: Allow faces to have text-like properties 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

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=5xbse93nti.fsf@kfs2.cua.dk \
    --to=no-spam@cua.dk \
    --cc=tzz@beld.net \
    /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.