From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28524: 26.0.60; Truncation in %d displayed numbers in minor mode lighter Date: Wed, 20 Sep 2017 19:15:55 +0300 Message-ID: <83d16lfiro.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1505924260 32028 195.159.176.226 (20 Sep 2017 16:17:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 20 Sep 2017 16:17:40 +0000 (UTC) Cc: 28524@debbugs.gnu.org To: Kaushal Modi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 20 18:17:36 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duhgu-00084n-B7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Sep 2017 18:17:36 +0200 Original-Received: from localhost ([::1]:49436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duhh1-0005if-P9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Sep 2017 12:17:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duhgU-0005P5-IP for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 12:17:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duhgN-0006ZF-Jo for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 12:17:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41716) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duhgN-0006YI-7W for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 12:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1duhgM-0005k4-0S for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 12:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Sep 2017 16:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28524 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28524-submit@debbugs.gnu.org id=B28524.150592417722008 (code B ref 28524); Wed, 20 Sep 2017 16:17:01 +0000 Original-Received: (at 28524) by debbugs.gnu.org; 20 Sep 2017 16:16:17 +0000 Original-Received: from localhost ([127.0.0.1]:50397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duhfc-0005iu-UX for submit@debbugs.gnu.org; Wed, 20 Sep 2017 12:16:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45315) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duhfZ-0005id-Bd for 28524@debbugs.gnu.org; Wed, 20 Sep 2017 12:16:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duhfQ-0005HW-Ug for 28524@debbugs.gnu.org; Wed, 20 Sep 2017 12:16:08 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duhfQ-0005HO-Qu; Wed, 20 Sep 2017 12:16:04 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3762 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1duhfQ-0004l4-40; Wed, 20 Sep 2017 12:16:04 -0400 In-reply-to: (message from Kaushal Modi on Wed, 20 Sep 2017 13:44:49 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:137178 Archived-At: > From: Kaushal Modi > Date: Wed, 20 Sep 2017 13:44:49 +0000 > > (defvar test-cache 0) > > (defconst test-format-mode-lighter > `(" test:" (:eval (format ,(propertize "%d" 'face 'font-lock-warning-face) (test-incr))))) > > (defun test-incr () > (setq test-cache (1+ test-cache)) > test-cache) > > (define-minor-mode test-format-mode > "Test that the dynamic minor mode lighter does not get truncated." > :lighter test-format-mode-lighter > (unless test-format-mode > (setq test-cache 0))) > ===== > > 1. Start emacs -Q (emacs 26+). > 2. Evaluate the above dummy code snippet. > 3. M-x test-format-mode > > You will see this: > image.png > > 4. Now move the cursor around.. you will see the number after "test:" increment.. once it reaches 9, the next > increment would be 10.. but then the numbers disappear altogether. You see this now: > > image.png > > Upon doing C-h v test-format-mode-lighter, I see: > > test-format-mode-lighter’s value is > (" test:" > (:eval > (format > #("%d" 0 2 > (face font-lock-warning-face)) > (test-incr)))) > > I don't understand the exact meaning of those numbers "0 2", but looks like that limits the number of > characters to be displayed after "test:"? No, it means that the face covers 2 characters starting with the first one. > As a quick hack, I replace the "%d" in that variable with "%-3d". > > Now the C-h v gives: > > test-format-mode-lighter’s value is > (" test:" > (:eval > (format > #("%-3d" 0 4 > (face font-lock-warning-face)) > (test-incr)))) > > So the number of character limit got raised because "%-3d" is literally 4 characters. > > If I make that "%-10d".. the limit is literally 5 characters!! Which is all correct, the problem, if there is one, is elsewhere. I don't think I understand all the complexity you've gone through, because this works for me in the current emacs-26 branch: (insert (format (propertize "%d" 'face 'font-lock-warning-face) 10)) How is this different from what you do?