all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>, 34764@debbugs.gnu.org
Subject: bug#34764: prettify-symbols-mode pollutes font-lock-extra-keywords
Date: Wed, 6 Mar 2019 07:37:54 -0800 (PST)	[thread overview]
Message-ID: <675352ab-203d-45eb-afe4-0a09021c967f@default> (raw)
In-Reply-To: <4ef305f9-6501-c360-b635-63d5574abd55@gmail.com>

> > No, in fact I wasn't aware of `char-property-alias-alist'. ;-)
> >
> > I just meant in some way to try to have a library-specific
> > property control or replace a general property.  I don't
> > have in mind a general mechanism for doing that.
> 
> Font font-lock-extra-managed-props, at least, char-property-alias-alist
> seems perfect: you can declare my-abc to be an alias of abc, add my-abc
> to char-property-alias-alist when the minor mode gets activated, remove
> it when it gets deactivated, and as a bonus when clearing fontification
> font-lock will only clear the instances of abc that it applied itself.
> Very neat.

Yes, font-lock is a special case, because it already
deals in such a general way with a _list_ of properties,
"managing" them similarly.

Beyond that, one's code needs, one way or another, to
ensure that a library-specific property can have the
effect of the general, global one.  That's not built-in,
AFAIK.
_________

There is another case, which I forgot to mention, where
there is something general and built-in, but not
only for properties.  That's `buffer-invisibility-spec'.

By that I mean that you can add your own entries to
that spec, and you can remove them.  Other entries are
not affected.  (There are even specific functions to
add and remove.)

Something similar happens with hooks.

These are all places/constructs designed to be
modified by more than one library for more than one
purpose.  They are all, in a general sense, "hooks".

Another example, in the realm of properties, is the
exceptional way we treat property `face': code generally
handles both the case where the property value is a
single symbol (e.g. `lazy-highlight') and the case where
the value is a list of such.  Again: easy to add and
remove, without affecting what might be there from other
code.

A property whose value is expected/allowed to be a list
of values, each of which can determine the behavior,
is more flexible.

Whether this could or should be generalized, I don't
know.  But it sure is easier to keep the effects of
some code (e.g. a mode) separate in the cases where
we've planned ahead for a list of behavior-modifying
entries rather than just a single such.





  reply	other threads:[~2019-03-06 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 22:15 bug#34764: prettify-symbols-mode pollutes font-lock-extra-keywords Clément Pit-Claudel
2019-03-05 23:54 ` Drew Adams
2019-03-06  3:50   ` Clément Pit-Claudel
2019-03-06  6:23     ` Drew Adams
2019-03-06  6:50       ` Clément Pit-Claudel
2019-03-06 15:37         ` Drew Adams [this message]
2019-10-30 19:30         ` Lars Ingebrigtsen
2019-10-30 20:57           ` Clément Pit-Claudel

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=675352ab-203d-45eb-afe4-0a09021c967f@default \
    --to=drew.adams@oracle.com \
    --cc=34764@debbugs.gnu.org \
    --cc=cpitclaudel@gmail.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 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.