From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: James Clark Newsgroups: gmane.emacs.devel Subject: Re: Propertizing the minor-mode-alist Date: Fri, 17 Sep 2004 09:32:22 +0700 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <1095388341.7357.93.camel@pineapple.bkk.thaiopensource.com> References: <1095335866.7357.83.camel@pineapple.bkk.thaiopensource.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-V1+11AkZKXRvs+RXEMKp" X-Trace: sea.gmane.org 1095388382 10174 80.91.229.6 (17 Sep 2004 02:33:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Sep 2004 02:33:02 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 17 04:32:49 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C88YL-0005qq-00 for ; Fri, 17 Sep 2004 04:32:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C88e2-0003xz-SC for ged-emacs-devel@m.gmane.org; Thu, 16 Sep 2004 22:38:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C88dv-0003xs-33 for emacs-devel@gnu.org; Thu, 16 Sep 2004 22:38:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C88dt-0003xg-7M for emacs-devel@gnu.org; Thu, 16 Sep 2004 22:38:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C88dt-0003xd-5y for emacs-devel@gnu.org; Thu, 16 Sep 2004 22:38:33 -0400 Original-Received: from [161.58.244.53] (helo=thaiopensource.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C88Y3-0003rm-FR for emacs-devel@gnu.org; Thu, 16 Sep 2004 22:32:31 -0400 Original-Received: from dmz-1.bkk.thaiopensource.com ([203.130.150.188]) by thaiopensource.com (8.12.11/8.11.2) with ESMTP id i8H2WPKS008623 for ; Fri, 17 Sep 2004 09:32:29 +0700 (ICT) Original-Received: from [192.168.0.100] (home-gw.bkk.thaiopensource.com [203.130.150.187]) by dmz-1.bkk.thaiopensource.com (Postfix) with ESMTP id 53575FA03 for ; Fri, 17 Sep 2004 09:32:16 +0700 (ICT) Original-To: "emacs-devel@gnu.org" In-Reply-To: X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2.1thaiopen) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27177 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27177 --=-V1+11AkZKXRvs+RXEMKp Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2004-09-16 at 21:00, Stefan wrote: > > Perhaps there could be a new keyword :propertize-default that changes > > the text properties of only those characters in the string that do not > > already have a value for any of the specified properties. Or maybe this > > should be the behavior of :propertize. > > I think it makes sense to change the behavior of `:propertize' here. It turns out that the existing code already tries to merge the existing properties of the string with the properties specified in :propertize, but it doesn't work in this case for two reasons: - the code gets the existing properties just by looking at the first character of the string; in my case the first character is a space which doesn't have any properties, i.e. my code does (concat " " (propertize "Invalid" 'help-echo "mouse-1: go to first error" 'local-map (make-mode-line-mouse-map 'mouse-1 'rng-mouse-first-error))) - the code gives the new properties priority over the existing properties Attached is a patch that - when the first character has no properties, gets the properties from the last character; - gives priority to the existing properties over the new properties. James -- To send me mail, replace auth-only by public in the from address. --=-V1+11AkZKXRvs+RXEMKp Content-Disposition: attachment; filename=mode-line.patch Content-Type: text/x-patch; name=mode-line.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit --- src/xdisp.c.~1.908.~ 2004-09-16 02:12:32.000000000 +0700 +++ src/xdisp.c 2004-09-17 09:17:14.626506584 +0700 @@ -15335,23 +15335,34 @@ Lisp_Object oprops, aelt; oprops = Ftext_properties_at (make_number (0), elt); + /* If the first character doesn't have any properties, try + the last character instead, since user code might not + propertize a leading space character. */ + + if (NILP (oprops)) + { + int length; + + length = XFASTINT (Flength (elt)); + if (length > 0) + oprops = Ftext_properties_at (make_number (length - 1), elt); + } + + if (NILP (Fequal (props, oprops)) || risky) { /* If the starting string has properties, - merge the specified ones onto the existing ones. */ + merge the specified ones onto the existing ones. + Give priority to the existing one. */ if (! NILP (oprops) && !risky) { - Lisp_Object tem; - - oprops = Fcopy_sequence (oprops); - tem = props; - while (CONSP (tem)) + props = Fcopy_sequence (props); + while (CONSP (oprops)) { - oprops = Fplist_put (oprops, XCAR (tem), - XCAR (XCDR (tem))); - tem = XCDR (XCDR (tem)); + props = Fplist_put (props, XCAR (oprops), + XCAR (XCDR (oprops))); + oprops = XCDR (XCDR (oprops)); } - props = oprops; } aelt = Fassoc (elt, mode_line_proptrans_alist); --=-V1+11AkZKXRvs+RXEMKp 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 --=-V1+11AkZKXRvs+RXEMKp--