From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#11756: 24.1.50; mode-line string and properties Date: Wed, 20 Jun 2012 17:27:09 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340238521 18188 80.91.229.3 (21 Jun 2012 00:28:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2012 00:28:41 +0000 (UTC) To: 11756@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 21 02:28:40 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ShVGI-00060W-Lj for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Jun 2012 02:28:38 +0200 Original-Received: from localhost ([::1]:56602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVGI-0002zB-Gn for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jun 2012 20:28:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVGF-0002yu-7l for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:28:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShVGD-0002i8-Av for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:28:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVGD-0002i4-6j for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:28:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1ShVJa-0007SZ-Gc for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Jun 2012 00:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11756 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.134023867828615 (code B ref -1); Thu, 21 Jun 2012 00:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jun 2012 00:31:18 +0000 Original-Received: from localhost ([127.0.0.1]:50382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ShVIr-0007RU-By for submit@debbugs.gnu.org; Wed, 20 Jun 2012 20:31:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38046) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ShVIm-0007RK-Pv for submit@debbugs.gnu.org; Wed, 20 Jun 2012 20:31:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShVFN-0002Zn-6Q for submit@debbugs.gnu.org; Wed, 20 Jun 2012 20:27:42 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:37944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVFN-0002Zh-34 for submit@debbugs.gnu.org; Wed, 20 Jun 2012 20:27:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVFL-0002qd-A6 for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:27:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShVFJ-0002ZF-C4 for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:27:38 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:17335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShVFJ-0002Yq-4j for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2012 20:27:37 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q5L0RXA9003158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jun 2012 00:27:34 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q5L0RXEE018634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Jun 2012 00:27:33 GMT Original-Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q5L0RXBg006590 for ; Wed, 20 Jun 2012 19:27:33 -0500 Original-Received: from dradamslap1 (/10.159.186.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Jun 2012 17:27:33 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac1PRJhDp/OBnKdgQoem312GazMxlA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61156 Archived-At: Consider this snippet from Dired+: (setq mode-name `(,(format "Dired/%s" (match-string 2 mode-name)) (:eval (let* ((dired-marker-char (if (eq ?D dired-marker-char) ?* ; `dired-do-flagged-delete' binds it. dired-marker-char)) (marked-regexp (dired-marker-regexp)) (nb-marked (count-matches marked-regexp (point-min) (point-max)))) (if (not (> nb-marked 0)) "" (propertize (format " %s%d%c" (save-excursion (forward-line 0) (if (looking-at (concat marked-regexp ".*")) (format "%d/" (1+ (count-matches marked-regexp (point-min) (point)))) "")) nb-marked dired-marker-char) 'face 'diredp-mode-line-marked)))) (:eval (let* ((flagged-regexp (let ((dired-marker-char dired-del-marker)) (dired-marker-regexp))) (nb-flagged (count-matches flagged-regexp (point-min) (point-max)))) (if (not (> nb-flagged 0)) "" (propertize (format " %s%dD" (save-excursion (forward-line 0) (if (looking-at (concat flagged-regexp ".*")) (format "%d/" (1+ (count-matches flagged-regexp (point-min) (point)))) "")) nb-flagged) 'face 'diredp-mode-line-flagged)))))) Here we set `mode-name' to a list of three items: a string and two :eval constructs that each evaluate to a string. The result in the mode line is that what _should_ act as a single unit, the `mode-name', ends up acting like 3 separate units, duplicates except for their strings: same mouseover tooltip, same popup menus. This is not good. What's the alternative? I tried using just one :eval construct that produces a single string of the concatenated substrings. That solves the problem just mentioned, but introduces a worse problem: The propertized portions of the string are ignored. Or if you use two constructs: the first string from above and a single :eval that concatenates the other two strings, then you get two mode-line units (two popups etc.) (so the first problem isn't really solved), and the face of the last string is ignored - the face of the middle string is used for the whole second unit. In sum, we should be able to use a propertized string as the value of something like `mode-name', and have different portions of the string be propertized with different faces. You can define it that way, but what you see in the code is not what you get in the mode line. In GNU Emacs 24.1.50.1 (i386-mingw-nt5.1.2600) of 2012-06-18 on MARVIN Bzr revision: 108646 michael.albinus@gmx.de-20120617185439-jfcgwwbr97nbflkz Windowing system distributor `Microsoft Corp.', version 5.1.2600 Configured using: `configure --with-gcc (4.6) --no-opt --enable-checking --cflags -ID:/devel/emacs/libs/libXpm-3.5.8/include -ID:/devel/emacs/libs/libXpm-3.5.8/src -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include -ID:/devel/emacs/libs/giflib-4.1.4-1/include -ID:/devel/emacs/libs/jpeg-6b-4/include -ID:/devel/emacs/libs/tiff-3.8.2-1/include -ID:/devel/emacs/libs/gnutls-3.0.9/include -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'