From: Kaushal Modi <kaushal.modi@gmail.com>
To: 28524@debbugs.gnu.org
Subject: bug#28524: 26.0.60; Truncation in %d displayed numbers in minor mode lighter
Date: Wed, 20 Sep 2017 13:44:49 +0000 [thread overview]
Message-ID: <CAFyQvY0F8Bc-phh-ChQER_GxkQCnRSxxVRVotU6zKSmuyujSGQ@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 6069 bytes --]
Hello,
This issue is a regression from emacs 25.x.
I discovered this issue while using multiple-cursors package that uses a
dynamic minor mode lighter that shows the active number of multiple cursors.
(defcustom mc/mode-line
`(" mc:" (:eval (format ,(propertize "%d" 'face 'font-lock-warning-face)
(mc/num-cursors))))
"What to display in the mode line while multiple-cursors-mode is active."
:group 'multiple-cursors)
Ref:
https://github.com/magnars/multiple-cursors.el/blob/10752700084595bb24712c27ba70a2326302e45b/multiple-cursors-core.el#L523-L527
But the issue can be easily recreated using this dummy code:
=====
(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: 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: 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:"?
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!!
test-format-mode-lighter’s value is
(" test:"
(:eval
(format
#("%-10d" 0 5
(face font-lock-warning-face))
(test-incr))))
This strange truncation behavior did not exist on emacs 25+.
My guess is that the
In GNU Emacs 26.0.60 (build 3, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
of 2017-09-20
Repository revision: f16a8d5dbd3bb8a319c951bdde9a6a75dbdb8c17
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --with-modules
--prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-26
'--program-transform-name=s/^ctags$/ctags_emacs/'
'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
-I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
-ggdb3'
PKG_CONFIG_PATH=/home/kmodi/usr_local/6/lib/pkgconfig:/home/kmodi/usr_local/6/lib64/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/lib64/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 97048 7622)
(symbols 48 20814 1)
(miscs 40 42 119)
(strings 32 28795 1337)
(string-bytes 1 765341)
(vectors 16 14940)
(vector-slots 8 508725 5443)
(floats 8 48 73)
(intervals 56 245 0)
(buffers 992 11)
(heap 1024 21678 835))
--
Kaushal Modi
[-- Attachment #1.2: Type: text/html, Size: 8703 bytes --]
[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 62733 bytes --]
[-- Attachment #3: image.png --]
[-- Type: image/png, Size: 60597 bytes --]
next reply other threads:[~2017-09-20 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 13:44 Kaushal Modi [this message]
2017-09-20 16:15 ` bug#28524: 26.0.60; Truncation in %d displayed numbers in minor mode lighter Eli Zaretskii
2017-09-20 16:18 ` Kaushal Modi
2017-09-20 19:33 ` Eli Zaretskii
2021-08-13 13:07 ` Lars Ingebrigtsen
2021-08-13 13:46 ` Kaushal Modi
2021-08-13 13:51 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY0F8Bc-phh-ChQER_GxkQCnRSxxVRVotU6zKSmuyujSGQ@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=28524@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).