From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Reducing mouse-dependency In Emacs. Date: Wed, 13 Aug 2003 00:36:57 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200308130536.h7D5avD22390@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1060753322 20918 80.91.224.253 (13 Aug 2003 05:42:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2003 05:42:02 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Aug 13 07:42:01 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19moOX-0000lr-00 for ; Wed, 13 Aug 2003 07:42:01 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19moWY-0004er-00 for ; Wed, 13 Aug 2003 07:50:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19moMD-0002e8-Cm for emacs-devel@quimby.gnus.org; Wed, 13 Aug 2003 01:39:37 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19moLw-0002WB-8l for emacs-devel@gnu.org; Wed, 13 Aug 2003 01:39:20 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19moLP-0001ia-B5 for emacs-devel@gnu.org; Wed, 13 Aug 2003 01:39:18 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.20) id 19moLO-0001iW-VE for emacs-devel@gnu.org; Wed, 13 Aug 2003 01:38:47 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.9/8.12.9) with ESMTP id h7D5cjeQ011976 for ; Wed, 13 Aug 2003 00:38:46 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id h7D5avD22390; Wed, 13 Aug 2003 00:36:57 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15920 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15920 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.