[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Propertizing the minor-mode-alist

From: James Clark
Subject: Re: Propertizing the minor-mode-alist
Date: Sun, 19 Sep 2004 13:35:08 +0700

On Sun, 2004-09-19 at 05:55, Richard Stallman wrote:
>     How would you suggest fixing the original problem (of a minor mode
>     wanting to make the string that it puts in the mode line clickable in a
>     way specific to that minor mode)?
> I have somewhat of a bad feeling about this interface as a way of
> doing things.  Users would not expect such an interface or look for
> it, so the mode ought to provide something else.  What is that
> other interface?

In this case, the command that is invoked by the mode-line click is also
available on a key and a menu.  I agree that clicking on the mode-line
shouldn't be the only way to invoke a particular function.

On the other hand, it's normal Emacs behavior that clicking on a word on
the mode-line does something useful, somehow related to that word.  In
this case, the word on the mode-line is "Invalid". (It changes from
"Valid" when the background validation discovers an error; it also says
e.g. "Validating:42%" when it's validated 42% of the buffer.)

The implementation of nxml-mode is split into a number of independent
parts to maximize the possibility of reuse in the future by other modes,
but things are set up so that a normal end-user doesn't need to know
about this.  Although the word "Invalid" comes from a part of nxml-mode
that, as it happens, is implemented as a minor mode, this is not
something that the average user would be aware of. In 21.3, if the user
mouses over "Invalid", they will see "mouse-1: go to first error".  With
the current CVS emacs, they will see "mouse-2: help for minor modes,
mouse-3: minor mode menu".  This doesn't seem an improvement to me. One
can argue about exactly what clicking on "Invalid" should do, but surely
it should be something that is related to the invalid status of the

I was thinking I could avoid this whole issue by getting Invalid into
the mode-line using mode-line-process instead of minor-mode-alist, since
default-mode-line-format doesn't propertize mode-line-process.

>     - another keyword (say :propertize-default) which gives the new
>     properties priority over the existing properties
> :propertize gives its new priority over the existing properties
> in the strings.  I think you mean giving the existing properties
> priority.

Yes, sorry, you're right.

> Such a feature could certainly be implemented and made safe.
> One must not simply copy and tweak the code for :propertize,
> because the handling of risky needs to be thought about.

The comment in the code says:

 If RISKY is nonzero, remove (disregard) any properties in any string
 we encounter, and ignore :eval and :propertize.

Obviously, :propertize-default would also be ignored, when RISKY is
non-zero.  Is there anything more to it than that?

Also, it one's going to do this, the code should probably be fixed at
the same time to do the right thing with existing properties that apply
to only a substring.

> However, I tend to think that the right solution is to use
> an interface that is more typical of Emacs features.

I think we can distinguish two issues here:

- Is something like :propertize-default a useful feature, which you
would be willing to install if somebody implemented it cleanly?

- What should clicking on "Invalid" in the mode-line in nxml-mode do?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]