unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Štepán Nemec'" <stepnem@gmail.com>,
	"'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 'Eli Zaretskii' <eliz@gnu.org>, emacs-devel@gnu.org
Subject: use of `mouse-face' to delimit text zones [was: bidi-display-reordering is now non-nil by default]
Date: Tue, 23 Aug 2011 08:29:22 -0700	[thread overview]
Message-ID: <77465C28555E49ACA714C9A439EA4396@us.oracle.com> (raw)
In-Reply-To: <87ei0cjvow.fsf@gmail.com>

The question is about whether `mouse-face' should be used only for highlighting
(write-only), or whether it can be good practice to also examine `mouse-face'
boundaries to determine text zones.

Eli> I couldn't imagine the mouse-face is used for anything besides the
Eli> highlight.  Sounds like a kludge to me.

And yet `mouse-face' is used here and there throughout Emacs to determine the
boundaries of certain regions of text. If it were used only for highlighting
then you would find only its addition as a text property (i.e., write-only),
almost never its use/testing (e.g., `get-text-property',
`next(-single)-char-property').

Grep the Lisp sources for `mouse-face', then check occurrences where we retrieve
that property to determine the boundaries and position of various text
"candidates" (e.g. look for `next(-single)-char-property'). We do this for
comint history, Dired, tmm, gnus articles, quail completions,... 

It is true that in many libraries we only set the property, without ever
examining/reading it. But in other libraries we do examine it to determine
boundaries. This is not something new or unusual.

> > OTOH bug#8897 is for a use that's pretty far from the 
> > normal use case of the completion code, so I wouldn't
> > make such a significant change just to accomodate this use case.
> 
> now there's also the fact that using the [mouse-face property]
> for this seems like a kludge to Eli (and possibly others?
> certainly me included) and gets in the way of other unrelated
> code (or at least makes certain "obvious" solutions "non-obvious").

FWIW, in Icicles, just as in the vanilla Emacs completion code, I make heavy use
of the fact that the `mouse-face' property indicates the boundaries of
completion candidates. And in the case of Icicles, completion candidates are
often more complex (various text properties, embedded newline chars etc.).

I grant that perhaps a different text property could be used for completion
candidate delimiting in *Completions*.

But I expect it would anyway more or less need to coincide with the `mouse-face'
limits (though I might be missing something - haven't really followed this
thread or Štěpán's bug report).

Candidate layout (vertical, horizontal), cycling, sorting, highlighting, moving
to a candidate in a given position, grabbing a clicked candidate, drag-selecting
multiple candidates, etc. all depend on properly picking up candidate
boundaries. Sometimes such operations can be a bit complex. Today, Icicles, like
vanilla Emacs, uses `mouse-face' for that.

So I guess I echo what Stefan M. said. Logically I guess a different text
property could be used to delimit candidates, but things might be a lot more
complex if two properties were used or if displayed-text limits did not
correspond to the other (new) limits. Not to mention the extra hairiness
required for code like Icicles that supports multiple Emacs versions.

And tomorrow you or someone else might make the same argument about any new
property we introduced to delimit candidates. Yes, `mouse-face' is doing double
duty currently: highlight + delimit. I'm not convinced that's a bad thing. I
don't see it as a kludge, in any case.

All this is just to say that if you're counting voices (Eli + Štěpán vs Stefan),
count me, a priori, as not keen on abandoning the use of `mouse-face' to delimit
candidates. IOW, +1 for Stefan's reluctance in this regard.

[Wrt bug #8897, it sounds from a quick reading like the problem is not so much
with the use of `mouse-face' to delimit completion candidates as it is with some
hard-coding (implicit use) of `mouse-face' within the button code. But you can
ignore this comment, as I have not really followed that thread.]




  reply	other threads:[~2011-08-23 15:29 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15  8:04 bidi-display-reordering is now non-nil by default Andrey Paramonov
2011-08-15  9:10 ` Eli Zaretskii
2011-08-15  9:24   ` David Kastrup
2011-08-15 10:20     ` Eli Zaretskii
2011-08-15 10:46       ` David Kastrup
2011-08-15 11:10         ` Eli Zaretskii
2011-08-15 11:27           ` David Kastrup
2011-08-15 11:56             ` Eli Zaretskii
2011-08-15 12:56               ` David Kastrup
2011-08-15 13:07                 ` Eli Zaretskii
2011-08-15 13:59     ` Stefan Monnier
2011-08-15 14:18       ` David Kastrup
2011-08-15 16:57         ` Stefan Monnier
2011-08-15 17:12         ` Eli Zaretskii
2011-08-15 16:55       ` Eli Zaretskii
2011-08-15 18:13         ` Stefan Monnier
2011-08-17 20:34           ` Lars Magne Ingebrigtsen
2011-08-18 16:14           ` Eli Zaretskii
2011-08-22  6:02             ` Eli Zaretskii
2011-08-22 19:35               ` Stefan Monnier
2011-08-23  8:05                 ` Eli Zaretskii
2011-08-23 18:19                   ` Stefan Monnier
2011-08-23 19:03                     ` Eli Zaretskii
2011-08-23 19:17                       ` Stefan Monnier
2011-08-24  6:35                         ` Eli Zaretskii
2011-08-24  9:02                         ` Eli Zaretskii
2011-08-24 14:51                           ` Stefan Monnier
2011-08-24 16:55                             ` Eli Zaretskii
2011-08-25  4:38                               ` Stefan Monnier
2011-08-25  6:12                                 ` Eli Zaretskii
2011-08-26  3:55                                   ` Stefan Monnier
2011-08-26  7:31                                     ` Eli Zaretskii
2011-08-27  2:53                                       ` Stefan Monnier
2011-08-27  8:16                                         ` Eli Zaretskii
2011-08-28  2:52                                           ` Stefan Monnier
2011-08-28  6:03                                             ` Eli Zaretskii
2011-08-29 14:46                                               ` Stefan Monnier
2011-08-25 10:50                                 ` Eli Zaretskii
2011-08-22 19:37               ` Stefan Monnier
2011-08-22 21:35                 ` Štěpán Němec
2011-08-23  1:13                   ` Stefan Monnier
2011-08-23  9:58                     ` Štěpán Němec
2011-08-23 15:29                       ` Drew Adams [this message]
2011-08-23 16:15                         ` use of `mouse-face' to delimit text zones [was: bidi-display-reordering is now non-nil by default] Eli Zaretskii
2011-08-23 18:34                           ` Stefan Monnier
2011-08-23 18:45                             ` use of `mouse-face' to delimit text zones Eli Zaretskii
2011-08-23 19:17                               ` Štěpán Němec
2011-08-23 19:22                               ` Stefan Monnier
2011-08-23 18:24                       ` bidi-display-reordering is now non-nil by default Stefan Monnier
2011-08-23 19:14                         ` Štěpán Němec
2011-08-23  8:40                 ` Eli Zaretskii
2011-08-15 18:28         ` Chong Yidong
2011-08-15 20:41           ` Eli Zaretskii
2011-08-16  1:11             ` Stefan Monnier
2011-08-16  2:02             ` Chong Yidong
2011-08-16  6:47               ` Eli Zaretskii
2011-08-16  7:07                 ` David Kastrup
2011-08-16  9:25                   ` Eli Zaretskii
2011-08-16 10:01                     ` David Kastrup
2011-08-16 10:37                       ` Eli Zaretskii
2011-08-16  7:40                 ` Andreas Schwab
2011-08-16  7:54                   ` David Kastrup
2011-08-16  9:20                     ` Eli Zaretskii
2011-08-16  9:40                       ` David Kastrup
2011-08-16 10:01                         ` Eli Zaretskii
2011-08-16 14:10                           ` Stefan Monnier
2011-08-16  9:03                   ` Eli Zaretskii
2011-08-16  9:10                     ` Andreas Schwab
2011-08-16  9:55                       ` Eli Zaretskii
2011-08-16  9:03                   ` Eli Zaretskii
2011-08-16 14:03                 ` Stefan Monnier
2011-08-16 14:48                   ` Eli Zaretskii
2011-08-16 15:48                 ` Chong Yidong
2011-08-16 17:50                   ` Eli Zaretskii
2011-08-16 22:24                     ` Chong Yidong
2011-08-17  6:30                       ` Eli Zaretskii
2011-08-17  9:34                         ` Juri Linkov
2011-08-17 10:05                           ` Eli Zaretskii
2011-08-17 22:32                         ` Chong Yidong
2011-08-18  8:21                           ` Eli Zaretskii
2011-08-18 17:13                             ` Chong Yidong
2011-08-18 17:45                               ` Eli Zaretskii
2011-08-18 22:44                                 ` Chong Yidong
2011-08-19  3:16                                   ` Stefan Monnier
2011-08-19  7:25                                     ` Eli Zaretskii
2011-08-19 20:00                                       ` Chong Yidong
2011-08-20  8:14                                         ` bidi reordering in program source buffers (was: bidi-display-reordering is now non-nil by default) Eli Zaretskii
2011-08-20  9:28                                           ` Andreas Schwab
2011-08-20 10:53                                             ` Eli Zaretskii
2011-08-25 13:51                                               ` Ehud Karni
2011-08-25 17:28                                                 ` bidi reordering in program source buffers Eli Zaretskii
2011-08-25 20:01                                                   ` Ehud Karni
2011-08-25 21:09                                                     ` Eli Zaretskii
2011-08-19 19:29                                     ` bidi-display-reordering is now non-nil by default Chong Yidong
2011-08-19  7:13                                   ` Eli Zaretskii
2011-08-19 19:43                                     ` Chong Yidong
2011-08-20  7:39                                       ` Eli Zaretskii
2011-08-19 14:51                                   ` Lars Magne Ingebrigtsen
2011-08-19 15:12                                     ` Eli Zaretskii
2011-08-15  9:27   ` Andrey Paramonov

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77465C28555E49ACA714C9A439EA4396@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stepnem@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).