all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Subject: Re: Reducing mouse-dependency In Emacs.
Date: Wed, 13 Aug 2003 00:36:57 -0500 (CDT)	[thread overview]
Message-ID: <200308130536.h7D5avD22390@raven.dms.auburn.edu> (raw)

The current version of `print-local-help' only works with `help-echo'
properties that are strings.  The fact that it does not work with
help-echo's that evaluate to strings was just an omission on my part
and is trivial to fix (I forgot some eval's).  I knew I still had to
take care of the rarer case of help-echo's that are functions.  I also
want `short-help' to have the same legal values as `help-echo',
including functions.

To take care of functional values, I need not only the value of the
property but also need to know whether it was found in an overlay (and
if so which overlay) or as a text property.
`get_char_property_and_overlay' provides that information, but in a
form that I do not know how to use from Lisp.  (I am not very familiar
at all with the Emacs C code.)  Assuming there is no better way, would
it be OK to define the following new primitive (the documentation
string would have to get a much shorter first line and maybe the name
is not right, but I could worry about such things later):

DEFUN ("find-char-property", Ffind_char_property, Sfind_char_property, 2, 3, 0,
       doc: /* Return a cons whose car is the value of POSITION's
property PROP, in OBJECT and whose cdr is the overlay in which the
property was found, or nil if it was found as a text property.  OBJECT
is optional and defaults to the current buffer.  If POSITION is at the
end of OBJECT, the value is nil.  If OBJECT is a buffer, then overlay
properties are considered as well as text properties.  If OBJECT is a
window, then that window's buffer is used, but window-specific
overlays are considered only if they are associated with OBJECT.  */)
     (position, prop, object)
     Lisp_Object position, object;
     register Lisp_Object prop;
{
  Lisp_Object *overlay = (Lisp_Object *) alloca (sizeof (Lisp_Object));
  Lisp_Object val=
    get_char_property_and_overlay (position, prop, object, overlay);
  return Fcons(val, *overlay);
}

I also put in a "defsubr (&Sadd_text_properties);" and a "EXFUN
(Ffind_char_property, 3);" in intervals.h.

(All of this in my own Emacs, not in the CVS, of course.)

The new primitive would take the same arguments as `get-char-property'
and return a cons with car the return value of `get-char-property' and
as cdr the overlay in which it was found, or nil if none.

I am really unfamiliar with the Emacs source code, but my Emacs
version still bootstraps, my Emacs has not crashed yet after some use
and everything seems to return the correct values, even in some
reasonably complex situations.

Is here a better way to access the information I need from Lisp or is
the above OK?  I know how to access the information I need completely
from Lisp, without any new primitives, but in a somewhat inelegant
way.

Sincerely,

Luc.

             reply	other threads:[~2003-08-13  5:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-13  5:36 Luc Teirlinck [this message]
2003-08-13  7:47 ` Reducing mouse-dependency In Emacs Miles Bader
2003-08-13 12:59   ` Luc Teirlinck
2003-08-13 22:56     ` Nick Roberts
2003-08-14  0:35       ` Luc Teirlinck
2003-08-14  1:42         ` Miles Bader
2003-08-14  1:04       ` Luc Teirlinck
2003-08-13 14:32   ` Luc Teirlinck
  -- strict thread matches above, loose matches on Subject: below --
2003-08-12  2:49 Luc Teirlinck
2003-08-12  1:29 Luc Teirlinck
2003-08-12  1:43 ` Luc Teirlinck
2003-08-10  3:42 Luc Teirlinck
2003-08-10  6:08 ` Eli Zaretskii
2003-08-10 14:53   ` Luc Teirlinck
2003-08-11 12:53   ` Richard Stallman
2003-08-10 16:50 ` Stefan Monnier
2003-08-10 23:09   ` Luc Teirlinck
2003-08-11  4:05     ` Luc Teirlinck
2003-08-11 23:16       ` Richard Stallman
2003-08-11  6:04     ` Eli Zaretskii
2003-08-11 15:52       ` Luc Teirlinck
2003-08-11 17:52         ` Eli Zaretskii
2003-08-11 14:54     ` Stefan Monnier
2003-08-12  2:30       ` Luc Teirlinck
2003-08-12  6:28         ` Eli Zaretskii
2003-08-12 16:08           ` Luc Teirlinck

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=200308130536.h7D5avD22390@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    /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.