From: James Clark <jjc@auth-only.jclark.com>
Subject: Re: Propertizing the minor-mode-alist
Date: Fri, 17 Sep 2004 09:32:22 +0700 [thread overview]
Message-ID: <1095388341.7357.93.camel@pineapple.bkk.thaiopensource.com> (raw)
In-Reply-To: <m1pt4mnwl0.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]
On Thu, 2004-09-16 at 21:00, Stefan wrote:
> > Perhaps there could be a new keyword :propertize-default that changes
> > the text properties of only those characters in the string that do not
> > already have a value for any of the specified properties. Or maybe this
> > should be the behavior of :propertize.
>
> I think it makes sense to change the behavior of `:propertize' here.
It turns out that the existing code already tries to merge the existing
properties of the string with the properties specified in :propertize,
but it doesn't work in this case for two reasons:
- the code gets the existing properties just by looking at the first
character of the string; in my case the first character is a space which
doesn't have any properties, i.e. my code does
(concat " "
(propertize "Invalid"
'help-echo "mouse-1: go to first error"
'local-map (make-mode-line-mouse-map
'mouse-1
'rng-mouse-first-error)))
- the code gives the new properties priority over the existing
properties
Attached is a patch that
- when the first character has no properties, gets the properties from
the last character;
- gives priority to the existing properties over the new properties.
James
--
To send me mail, replace auth-only by public in the from address.
[-- Attachment #2: mode-line.patch --]
[-- Type: text/x-patch, Size: 1428 bytes --]
--- src/xdisp.c.~1.908.~ 2004-09-16 02:12:32.000000000 +0700
+++ src/xdisp.c 2004-09-17 09:17:14.626506584 +0700
@@ -15335,23 +15335,34 @@
Lisp_Object oprops, aelt;
oprops = Ftext_properties_at (make_number (0), elt);
+ /* If the first character doesn't have any properties, try
+ the last character instead, since user code might not
+ propertize a leading space character. */
+
+ if (NILP (oprops))
+ {
+ int length;
+
+ length = XFASTINT (Flength (elt));
+ if (length > 0)
+ oprops = Ftext_properties_at (make_number (length - 1), elt);
+ }
+
+
if (NILP (Fequal (props, oprops)) || risky)
{
/* If the starting string has properties,
- merge the specified ones onto the existing ones. */
+ merge the specified ones onto the existing ones.
+ Give priority to the existing one. */
if (! NILP (oprops) && !risky)
{
- Lisp_Object tem;
-
- oprops = Fcopy_sequence (oprops);
- tem = props;
- while (CONSP (tem))
+ props = Fcopy_sequence (props);
+ while (CONSP (oprops))
{
- oprops = Fplist_put (oprops, XCAR (tem),
- XCAR (XCDR (tem)));
- tem = XCDR (XCDR (tem));
+ props = Fplist_put (props, XCAR (oprops),
+ XCAR (XCDR (oprops)));
+ oprops = XCDR (XCDR (oprops));
}
- props = oprops;
}
aelt = Fassoc (elt, mode_line_proptrans_alist);
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-09-17 2:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-16 11:57 Propertizing the minor-mode-alist James Clark
2004-09-16 14:00 ` Stefan
2004-09-17 2:32 ` James Clark [this message]
2004-09-17 3:46 ` Stefan
2004-09-17 21:52 ` Kim F. Storm
2004-09-18 19:07 ` Richard Stallman
2004-09-17 23:23 ` Richard Stallman
2004-09-18 2:50 ` James Clark
2004-09-18 22:55 ` Richard Stallman
2004-09-19 6:07 ` David Kastrup
2004-09-19 6:35 ` James Clark
2004-09-20 0:05 ` Richard Stallman
2004-09-20 2:29 ` James Clark
2004-09-20 10:56 ` Kai Grossjohann
2004-09-21 18:31 ` Richard Stallman
2004-09-22 7:30 ` James Clark
2004-09-22 13:23 ` Stefan Monnier
2004-09-22 14:02 ` James Clark
2004-09-22 16:31 ` Stefan Monnier
2004-09-23 9:29 ` Richard Stallman
2004-09-23 13:15 ` James Clark
2004-09-24 12:08 ` Richard Stallman
2004-09-18 10:52 ` James Clark
2004-09-18 21:06 ` Stefan
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=1095388341.7357.93.camel@pineapple.bkk.thaiopensource.com \
--to=jjc@auth-only.jclark.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.