[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DISCUSS] "same text-property competing" problem in external package
From: |
Ihor Radchenko |
Subject: |
Re: [DISCUSS] "same text-property competing" problem in external packages |
Date: |
Tue, 28 Feb 2023 10:47:26 +0000 |
stardiviner <numbchild@gmail.com> writes:
> I got a problem when more than one Emacs package competing on setting
> text-property on same target from different packages.
>
> Here is the original problem and discussion link:
> https://github.com/nobiot/org-transclusion/issues/166
>
> Does anybody have a good idea to solve this problem?
I am not sure which property you are referring to.
There is a number of possible solutions you may use depending on what is
more appropriate for your specific use case:
1. Use overlays with 'priority property. That way, you can "overlay" the
property above/below existing and Emacs will automatically restore
the existing value upon removing your overlay. This is the most
common approach.
2. You can utilize `char-property-alias-alist' and actually store your
property value in a different property. This will make the priority
of the existing property _strictly higher_ than yours. org-fold-core
uses this approach.
3. You can store a "backup" of the existing property and restore it when
your minor mode is disabled. isearch.el uses this approach.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>