From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Getting the click position in a string Date: Wed, 26 Apr 2006 10:17:51 +0200 Message-ID: <85fyk0rbrk.fsf@lola.goethe.zz> References: <85fyk2ugle.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1146039519 22777 80.91.229.2 (26 Apr 2006 08:18:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2006 08:18:39 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 26 10:18:35 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FYfEH-00080Q-Ey for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 10:18:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYfEG-0006KL-AN for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 04:18:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYfE2-0006Is-1p for emacs-devel@gnu.org; Wed, 26 Apr 2006 04:18:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYfE0-0006IN-JP for emacs-devel@gnu.org; Wed, 26 Apr 2006 04:18:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYfE0-0006IJ-GF for emacs-devel@gnu.org; Wed, 26 Apr 2006 04:18:16 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYfGe-0005yn-Ra for emacs-devel@gnu.org; Wed, 26 Apr 2006 04:21:01 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1FYfDz-000076-I2 for emacs-devel@gnu.org; Wed, 26 Apr 2006 04:18:15 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 36EFD1D1FFCE; Wed, 26 Apr 2006 10:17:52 +0200 (CEST) Original-To: emacs-devel@gnu.org In-Reply-To: <85fyk2ugle.fsf@lola.goethe.zz> (David Kastrup's message of "Tue, 25 Apr 2006 11:53:01 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53451 Archived-At: --=-=-= David Kastrup writes: > Hi, > > I am trying to fix mouse.el so that it can heed follow-link properties > in display strings. But it does not appear that the mouse click info > gives the requisite position information: there is posn-string, and > there is posn-point, but it does not look like there is > posn-string-pos or whatever else which would be able to pinpoint the > actual position within a string that is used as a display property or > before-string or after-string. > > Consequently, one can't fetch the text property at the position of the > click in such a string. > > Am I wrong here? On another tangent, is this change ok? For implementing follow-link, I need to take a look at the follow-link binding in the keymap of a click, not the binding of the click itself. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment *** help.el 25 Mar 2006 20:49:31 +0100 1.308 --- help.el 26 Apr 2006 10:08:16 +0200 *************** *** 525,541 **** (princ string))))) nil) ! (defun string-key-binding (key) ! "Value is the binding of KEY in a string. ! If KEY is an event on a string, and that string has a `local-map' ! or `keymap' property, return the binding of KEY in the string's keymap." (let* ((defn nil) ! (start (when (vectorp key) ! (if (memq (aref key 0) '(mode-line header-line left-margin right-margin)) ! (event-start (aref key 1)) ! (and (consp (aref key 0)) ! (event-start (aref key 0)))))) (string-info (and (consp start) (nth 4 start)))) (when string-info (let* ((string (car string-info)) --- 525,542 ---- (princ string))))) nil) ! (defun string-key-binding (event &optional key) ! "With some string EVENT, return the local binding of KEY. ! If EVENT is an event on a string, and that string has a `local-map' ! or `keymap' property, return the binding of KEY in the string's keymap. ! If KEY is not specified, it is taken from the event." (let* ((defn nil) ! (start (when (vectorp event) ! (if (memq (aref event 0) '(mode-line header-line left-margin right-margin)) ! (event-start (aref event 1)) ! (and (consp (aref event 0)) ! (event-start (aref event 0)))))) (string-info (and (consp start) (nth 4 start)))) (when string-info (let* ((string (car string-info)) *************** *** 544,550 **** (< pos (length string)) (or (get-text-property pos 'local-map string) (get-text-property pos 'keymap string))))) ! (setq defn (and local-map (lookup-key local-map key))))) defn)) (defun help-key-description (key untranslated) --- 545,551 ---- (< pos (length string)) (or (get-text-property pos 'local-map string) (get-text-property pos 'keymap string))))) ! (setq defn (and local-map (lookup-key local-map (or key event)))))) defn)) (defun help-key-description (key untranslated) --=-=-= Incidentally, this function looks faulty: it should search the keymap _and_ the local-map property (in _that_ order) instead of searching at most one of the two, even if that search would fail. Apart from fixing it and adding an optional key argument, is help.el the right place for it? -- David Kastrup, Kriemhildstr. 15, 44793 Bochum --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--