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 14:54:20 +0200 Message-ID: <85u08gpkeb.fsf@lola.goethe.zz> References: <85fyk2ugle.fsf@lola.goethe.zz> <85fyk0rbrk.fsf@lola.goethe.zz> <853bg0r1ms.fsf@lola.goethe.zz> <85y7xspkgk.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1146056097 17100 80.91.229.2 (26 Apr 2006 12:54:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2006 12:54:57 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 26 14:54:53 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 1FYjXd-0004n4-Ey for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 14:54:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYjXc-0002Ow-Vm for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 08:54:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYjXP-0002Na-64 for emacs-devel@gnu.org; Wed, 26 Apr 2006 08:54:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYjXO-0002NK-Cu for emacs-devel@gnu.org; Wed, 26 Apr 2006 08:54:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYjXO-0002NH-7m for emacs-devel@gnu.org; Wed, 26 Apr 2006 08:54:34 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYja4-0008Fk-PN for emacs-devel@gnu.org; Wed, 26 Apr 2006 08:57:20 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1FYjXN-0002C2-0A; Wed, 26 Apr 2006 08:54:33 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 8B8231D1FFCD; Wed, 26 Apr 2006 14:54:20 +0200 (CEST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: <85y7xspkgk.fsf@lola.goethe.zz> (David Kastrup's message of "Wed, 26 Apr 2006 14:52:59 +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:53471 Archived-At: --=-=-= David Kastrup writes: > Well, here is the current patch. Uh, actually here. --=-=-= Content-Type: text/x-patch Content-Disposition: inline *** help.el 25 Mar 2006 20:49:31 +0100 1.308 --- help.el 26 Apr 2006 14:09:59 +0200 *************** *** 525,550 **** (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)) (pos (cdr string-info)) ! (local-map (and (>= pos 0) ! (< 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) --- 525,554 ---- (princ string))))) nil) ! (defun string-key-binding (event &optional key) ! "With some EVENT on a string, 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)) (pos (cdr string-info)) ! (maps '(keymap local-map)) ! local-map) ! (when (and (>= pos 0) ! (< pos (length string))) ! (while (and maps (not defn)) ! (when ! (setq local-map (get-text-property pos (pop maps) string)) ! (setq defn (lookup-key local-map (or key event)))))))) defn)) (defun help-key-description (key untranslated) --=-=-= -- 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 --=-=-=--