all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
@ 2020-06-14 13:36 Thomas Hisch
  2020-06-14 14:42 ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Hisch @ 2020-06-14 13:36 UTC (permalink / raw)
  To: 41852

If the text is scaled (using `text-scale-increase`) in a
`tabulated-list-mode` buffer, the text of the header is not scaled,
which leads to a messed up (row data doesn't align with header row) buffer.

Evaluating the following code in "emacs -Q" and running
`text-scale-increase` in the *temp* buffer, shows the problem

(let ((columns [("Col1" 50) ("Col2" 50)])
       (rows (list '(nil ["row1xxxxxxxxxxxxxxxxxxxxxxxx" "value1"])
                   '(nil ["row2" "value2"])
                   '(nil ["row3" "value3"]))))
   (switch-to-buffer "*temp*")
   (setq tabulated-list-format columns)
   (setq tabulated-list-entries rows)
   (tabulated-list-init-header)
   (tabulated-list-print))



In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
  of 2019-12-18 built on lcy01-amd64-009
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 20.04 LTS

Recent messages:
You can run the command ‘text-scale-increase’ with M-x te-i RET
next-line: End of buffer
Mark set [2 times]
You can run the command ‘eval-buffer’ with M-x ev-b RET
Undo
Quit
Mark set [3 times]
Quit
You can run the command ‘eval-buffer’ with M-x ev-b RET
Making completion list...

Configured using:
  'configure --build=x86_64-linux-gnu --prefix=/usr
  '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
  '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
  --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
  '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
  --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
  --program-suffix=-snapshot --with-modules=yes --with-x=yes
  --with-x-toolkit=gtk3 --with-xwidgets=yes 'CFLAGS=-g -O2
  -fdebug-prefix-map=/build/emacs-snapshot-arAUbL/emacs-snapshot-99615=.
-fstack-protector-strong
  -Wformat -Werror=format-security' 'CPPFLAGS=-Wdate-time
  -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD PDUMPER LCMS2 GMP

Important settings:
   value of $LC_MONETARY: de_AT.UTF-8
   value of $LC_NUMERIC: de_AT.UTF-8
   value of $LC_TIME: de_AT.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
   text-scale-mode: t
   tooltip-mode: t
   global-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 rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x
cl-loaddefs cl-lib face-remap 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
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer 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 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
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting xwidget-internal move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 46025 9161)
  (symbols 48 6016 1)
  (strings 32 15615 1466)
  (string-bytes 1 508801)
  (vectors 16 9339)
  (vector-slots 8 125076 14228)
  (floats 8 23 46)
  (intervals 56 421 0)
  (buffers 1000 14))
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice@ims.co.at; DVR-Nr: 0374369; www.ims.co.at





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-06-14 13:36 Thomas Hisch
@ 2020-06-14 14:42 ` Eli Zaretskii
  2020-06-14 16:25   ` Thomas Hisch
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-06-14 14:42 UTC (permalink / raw)
  To: Thomas Hisch; +Cc: 41852

severity 41852 wishlist
thanks

> From: Thomas Hisch <thomas.hisch@ims.co.at>
> Date: Sun, 14 Jun 2020 15:36:23 +0200
> 
> If the text is scaled (using `text-scale-increase`) in a
> `tabulated-list-mode` buffer, the text of the header is not scaled,
> which leads to a messed up (row data doesn't align with header row) buffer.

text-scale-increase affects only the default face and faces that
inherit from it.  It isn't supposed to affect any other face, such as
the mode-line, the header-line, etc.

So you are actually asking for a new feature of the
tabulated-list-mode, whereby it defines "C-x +" etc. to produce effect
specific to that mode.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-06-14 14:42 ` Eli Zaretskii
@ 2020-06-14 16:25   ` Thomas Hisch
  2020-10-18 23:34     ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Hisch @ 2020-06-14 16:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41852

On 6/14/20 4:42 PM, Eli Zaretskii wrote:
>> From: Thomas Hisch <thomas.hisch@ims.co.at>
>> Date: Sun, 14 Jun 2020 15:36:23 +0200
>>
>> If the text is scaled (using `text-scale-increase`) in a
>> `tabulated-list-mode` buffer, the text of the header is not scaled,
>> which leads to a messed up (row data doesn't align with header row) buffer.
>
> text-scale-increase affects only the default face and faces that
> inherit from it.  It isn't supposed to affect any other face, such as
> the mode-line, the header-line, etc.

Thx for mentioning header line. I've just noticed that
tabulated-list-mode supports using a header that doesn't rely on
`header-line-format`.
This feature (setq tabulated-list-use-header-line nil) also doesn't work
as expected. I can see that the header row is rescaled now when
`text-scale-increase` is called, but the row data still looks a bit
messed up (cols are not aligned) after calling `text-scale-increase`
multiple times. The issue can be easily seen by calling
`text-scale-increase` in the *Packages* buffer.

Maybe `tabulate-list-mode` calculates the positions of the beginning of
each column only once.

>
> So you are actually asking for a new feature of the
> tabulated-list-mode, whereby it defines "C-x +" etc. to produce effect
> specific to that mode.
>

Yes it would be nice if text-scale-increase would properly rescale the
header-line, especially since (setq tabulated-list-use-header-line t) is
the default.

BR
Thomas
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice@ims.co.at; DVR-Nr: 0374369; www.ims.co.at





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
       [not found] ` <<83mu553e0x.fsf@gnu.org>
@ 2020-06-14 16:28   ` Drew Adams
  2020-06-14 17:23     ` Thomas Hisch
  0 siblings, 1 reply; 49+ messages in thread
From: Drew Adams @ 2020-06-14 16:28 UTC (permalink / raw)
  To: Eli Zaretskii, Thomas Hisch; +Cc: 41852

> > If the text is scaled (using `text-scale-increase`) in a
> > `tabulated-list-mode` buffer, the text of the header is not scaled,
> > which leads to a messed up (row data doesn't align with header row) buffer.
> 
> text-scale-increase affects only the default face and faces that
> inherit from it.  It isn't supposed to affect any other face, such as
> the mode-line, the header-line, etc.
> 
> So you are actually asking for a new feature of the
> tabulated-list-mode, whereby it defines "C-x +" etc. to produce effect
> specific to that mode.

Sounds reasonable to expect that column headings
remain over the columns they head.  We can call
that an enhancement request or a bug to be fixed.
___

Just an FYI, and not to take anything away from
either the enhancement request or Eli's note above:

There's another way to zoom in and out, which does
affect also the header-line and mode-line, in which
case the reported bug doesn't manifest - column
headers remain over the columns: zoom the frame,
not the buffer.

(Another difference, however, is that zooming a
frame affects all windows/buffers in it, and it
doesn't zoom the current buffer in other frames.
So it has different use cases from buffer zooming.
It's not what this bug report is about, but it
might be helpful info for Thomas in some contexts.)

Library `zoom-frm.el' provides frame-zooming
commands.
___

https://www.emacswiki.org/emacs/download/zoom-frm.el





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-06-14 16:28   ` bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode Drew Adams
@ 2020-06-14 17:23     ` Thomas Hisch
  0 siblings, 0 replies; 49+ messages in thread
From: Thomas Hisch @ 2020-06-14 17:23 UTC (permalink / raw)
  To: Drew Adams, Eli Zaretskii; +Cc: 41852



On 6/14/20 6:28 PM, Drew Adams wrote:
>>> If the text is scaled (using `text-scale-increase`) in a
>>> `tabulated-list-mode` buffer, the text of the header is not scaled,
>>> which leads to a messed up (row data doesn't align with header row) buffer.
>>
>> text-scale-increase affects only the default face and faces that
>> inherit from it.  It isn't supposed to affect any other face, such as
>> the mode-line, the header-line, etc.
>>
>> So you are actually asking for a new feature of the
>> tabulated-list-mode, whereby it defines "C-x +" etc. to produce effect
>> specific to that mode.
>
> Sounds reasonable to expect that column headings
> remain over the columns they head.  We can call
> that an enhancement request or a bug to be fixed.
> ___
>
> Just an FYI, and not to take anything away from
> either the enhancement request or Eli's note above:
>
> There's another way to zoom in and out, which does
> affect also the header-line and mode-line, in which
> case the reported bug doesn't manifest - column
> headers remain over the columns: zoom the frame,
> not the buffer.
>
> (Another difference, however, is that zooming a
> frame affects all windows/buffers in it, and it
> doesn't zoom the current buffer in other frames.
> So it has different use cases from buffer zooming.
> It's not what this bug report is about, but it
> might be helpful info for Thomas in some contexts.)
>
> Library `zoom-frm.el' provides frame-zooming
> commands.

Thx, this seems to be a helpful library, although it was a bit tedious
to install (required two additional libs: frame-cmds.el, frame-fns.el).

> ___
>
> https://www.emacswiki.org/emacs/download/zoom-frm.el
>
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice@ims.co.at; DVR-Nr: 0374369; www.ims.co.at





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-06-14 16:25   ` Thomas Hisch
@ 2020-10-18 23:34     ` Stefan Kangas
  2020-10-19 14:19       ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-18 23:34 UTC (permalink / raw)
  To: Thomas Hisch; +Cc: 41852

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

tags 41852 + patch
thanks

Thomas Hisch <thomas.hisch@ims.co.at> writes:

>> So you are actually asking for a new feature of the
>> tabulated-list-mode, whereby it defines "C-x +" etc. to produce effect
>> specific to that mode.
>
> Yes it would be nice if text-scale-increase would properly rescale the
> header-line, especially since (setq tabulated-list-use-header-line t) is
> the default.

How about the attached patch?

[-- Attachment #2: 41852.patch --]
[-- Type: text/x-diff, Size: 3917 bytes --]

diff --git a/etc/NEWS b/etc/NEWS
index 64758d455a..6687999155 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1313,6 +1313,15 @@ never be narrower than 19 characters.
 When the bookmark.el library is loaded, a customize choice is added
 to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list.
 
+** text-scale-mode
+
+---
+*** text-scale-mode can adjust text height of header line face.
+When the new buffer local variable 'text-scale-mode-header-line' is
+non-nil, 'text-scale-adjust' (bound to 'C-x C-+' and 'C-x C--' by
+default) will also change the text height of the header line face.
+This feature is intended for use by Emacs Lisp package authors.
+
 ** xwidget-webkit mode
 
 *** New xwidget commands.
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b13f609f88..2f7899ec51 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -761,6 +761,7 @@ tabulated-list-mode
   (setq-local revert-buffer-function #'tabulated-list-revert)
   (setq-local glyphless-char-display
               (tabulated-list-make-glyphless-char-display-table))
+  (setq-local text-scale-mode-header-line t)
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 028269a4b0..1faf575f82 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -219,7 +219,10 @@ text-scale-mode-step
 
 ;; current remapping cookie for text-scale-mode
 (defvar text-scale-mode-remapping nil)
-(make-variable-buffer-local 'text-scale-mode-remapping)
+(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
+
+(defvar text-scale-mode--remappings nil
+  "List of current remapping cookies for `text-scale-mode'.")
 
 ;; Lighter displayed for text-scale-mode in mode-line minor-mode list
 (defvar text-scale-mode-lighter "+0")
@@ -229,6 +232,22 @@ text-scale-mode-lighter
 (defvar text-scale-mode-amount 0)
 (make-variable-buffer-local 'text-scale-mode-amount)
 
+(defvar text-scale-mode-header-line nil
+  "If non-nil, also change text height of the header line.")
+(make-variable-buffer-local 'text-scale-header-line)
+
+(defun face-remap--clear-remappings ()
+  (dolist (remapping text-scale-mode--remappings)
+    (face-remap-remove-relative remapping))
+  (setq text-scale-mode--remappings nil))
+
+(defun face-remap--remap-face (sym)
+  (push (face-remap-add-relative sym
+                       :height
+                       (expt text-scale-mode-step
+                             text-scale-mode-amount))
+        text-scale-mode--remappings))
+
 (define-minor-mode text-scale-mode
   "Minor mode for displaying buffer text in a larger/smaller font.
 
@@ -240,19 +259,19 @@ text-scale-mode
 The `text-scale-increase', `text-scale-decrease', and
 `text-scale-set' functions may be used to interactively modify
 the variable `text-scale-mode-amount' (they also enable or
-disable `text-scale-mode' as necessary)."
+disable `text-scale-mode' as necessary).
+
+If `text-scale-mode-header-line' is non-nil, also change text
+height of the header line face."
   :lighter (" " text-scale-mode-lighter)
-  (when text-scale-mode-remapping
-    (face-remap-remove-relative text-scale-mode-remapping))
+  (face-remap--clear-remappings)
   (setq text-scale-mode-lighter
 	(format (if (>= text-scale-mode-amount 0) "+%d" "%d")
 		text-scale-mode-amount))
-  (setq text-scale-mode-remapping
-	(and text-scale-mode
-	     (face-remap-add-relative 'default
-					  :height
-					  (expt text-scale-mode-step
-						text-scale-mode-amount))))
+  (when text-scale-mode
+    (face-remap--remap-face 'default)
+    (when text-scale-mode-header-line
+      (face-remap--remap-face 'header-line)))
   (force-window-update (current-buffer)))
 
 (defun text-scale-min-amount ()

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-18 23:34     ` Stefan Kangas
@ 2020-10-19 14:19       ` Eli Zaretskii
  2020-10-19 18:21         ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-19 14:19 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 18 Oct 2020 16:34:23 -0700
> Cc: Eli Zaretskii <eliz@gnu.org>, 41852@debbugs.gnu.org
> 
> How about the attached patch?

It's probably a good feature, but it has at least one caveat: setting
that variable non-nil will cause not only the header-line face to be
rescaled, it will also cause any face that inherits from header-line
to be rescaled.  Not sure if this is a problem, but it should be
called out in NEWS, at least.

> +** text-scale-mode
> +
> +---
> +*** text-scale-mode can adjust text height of header line face.
> +When the new buffer local variable 'text-scale-mode-header-line' is
> +non-nil, 'text-scale-adjust' (bound to 'C-x C-+' and 'C-x C--' by
> +default) will also change the text height of the header line face.
> +This feature is intended for use by Emacs Lisp package authors.

This should mention modes that arrange their display in tabular form
below the header-line, such as tabulated-list-mode and its
descendants.  Otherwise the last sentence and the goal of the feature
itself are left on a level that's too abstract.

> -(make-variable-buffer-local 'text-scale-mode-remapping)
> +(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
> +
> +(defvar text-scale-mode--remappings nil
> +  "List of current remapping cookies for `text-scale-mode'.")

Why this change?

> +(defvar text-scale-mode-header-line nil

I suggest to name this text-scale-remap-header-line-face.

> +  "If non-nil, also change text height of the header line.")

Not just height, the size.  Also, please say "`header-line' face", and
mention that all the faces that inherit from it will be affected as
well.

> +(defun face-remap--remap-face (sym)
> +  (push (face-remap-add-relative sym
> +                       :height
> +                       (expt text-scale-mode-step
> +                             text-scale-mode-amount))
> +        text-scale-mode--remappings))

I wonder whether this is all there is to it.  The display code doesn't
automatically use the remapped face in all cases, we need to code that
"by hand" in each and every case.  So far we've been doing that only
for the default face; I wonder if we'll have to do something similar
for header-line on the C level...  Please be sure to test this in
every possible way, including cursor motion around such rescaled
header-lines etc.

Thanks.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-19 14:19       ` Eli Zaretskii
@ 2020-10-19 18:21         ` Stefan Kangas
  2020-10-19 19:02           ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-19 18:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

[-- Attachment #1: Type: text/plain, Size: 2437 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> It's probably a good feature, but it has at least one caveat: setting
> that variable non-nil will cause not only the header-line face to be
> rescaled, it will also cause any face that inherits from header-line
> to be rescaled.  Not sure if this is a problem, but it should be
> called out in NEWS, at least.
[...]
> This should mention modes that arrange their display in tabular form
> below the header-line, such as tabulated-list-mode and its
> descendants.  Otherwise the last sentence and the goal of the feature
> itself are left on a level that's too abstract.

I've made an attempt to improve this in the attached.

>> -(make-variable-buffer-local 'text-scale-mode-remapping)
>> +(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
>> +
>> +(defvar text-scale-mode--remappings nil
>> +  "List of current remapping cookies for `text-scale-mode'.")
>
> Why this change?

This is to give the variable the correct plural form, and to mark it
internal by giving it the double dash.

>> +(defvar text-scale-mode-header-line nil
>
> I suggest to name this text-scale-remap-header-line-face.

Done.

>> +  "If non-nil, also change text height of the header line.")
>
> Not just height, the size.  Also, please say "`header-line' face", and
> mention that all the faces that inherit from it will be affected as
> well.

Done.

>> +(defun face-remap--remap-face (sym)
>> +  (push (face-remap-add-relative sym
>> +                       :height
>> +                       (expt text-scale-mode-step
>> +                             text-scale-mode-amount))
>> +        text-scale-mode--remappings))
>
> I wonder whether this is all there is to it.  The display code doesn't
> automatically use the remapped face in all cases, we need to code that
> "by hand" in each and every case.  So far we've been doing that only
> for the default face; I wonder if we'll have to do something similar
> for header-line on the C level...  Please be sure to test this in
> every possible way, including cursor motion around such rescaled
> header-lines etc.

I've done my best to test it some more, including cursor motion around
the adjusted header line, as well as scrolling the window left and right
and up and down (using mouse and keyboard).  I've not been able to
produce any failures so far.  Please let me know if you have any more
ideas for what I could do to try to break it.

[-- Attachment #2: 0001-Make-text-scale-mode-optionally-adjust-header-line-f.patch --]
[-- Type: text/x-diff, Size: 4455 bytes --]

From 04f2037907b8e9335750eafbcaa587e33a92af0c Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 19 Oct 2020 01:03:53 +0200
Subject: [PATCH 1/2] Make text-scale-mode optionally adjust header line face

* lisp/face-remap.el (text-scale-remap-header-line-face): New buffer
local variable.
(text-scale-mode): Also adjust header-line face if above new
variable is non-nil.
(face-remap--clear-remappings, face-remap--remap-face): New
functions.
(text-scale-mode--remappings): New variable.
(text-scale-mode-remapping): Make obsolete.
---
 etc/NEWS           | 15 +++++++++++++++
 lisp/face-remap.el | 42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 390cccbff3..b80bcf397c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1314,6 +1314,21 @@ to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list.
 'gomoku-move-sw' and 'gomoku-move-ne' now work correctly, and
 horizontal movements now stop at the edge of the board.
 
+** text-scale-mode
+
+---
+*** text-scale-mode can now adjust font size of the 'header-line' face.
+When the new buffer local variable 'text-scale-mode-header-line' is
+non-nil, 'text-scale-adjust' (bound to 'C-x C-+' and 'C-x C--' by
+default) will also change the text height of the 'header-line' face.
+This will also affect any face that inherits from it.
+
+This feature is intended for use by Emacs Lisp package authors in
+major modes that arrange their display in tabular form below the
+header-line.  It is enabled in 'tabulated-list-mode' and its derived
+modes (such as the modes used by 'list-packages', 'list-buffers' and
+'bookmark-bmenu-list').
+
 ** xwidget-webkit mode
 
 *** New xwidget commands.
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 028269a4b0..4d7be7d65a 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -219,7 +219,10 @@ text-scale-mode-step
 
 ;; current remapping cookie for text-scale-mode
 (defvar text-scale-mode-remapping nil)
-(make-variable-buffer-local 'text-scale-mode-remapping)
+(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
+
+(defvar text-scale-mode--remappings nil
+  "List of current remapping cookies for `text-scale-mode'.")
 
 ;; Lighter displayed for text-scale-mode in mode-line minor-mode list
 (defvar text-scale-mode-lighter "+0")
@@ -229,6 +232,24 @@ text-scale-mode-lighter
 (defvar text-scale-mode-amount 0)
 (make-variable-buffer-local 'text-scale-mode-amount)
 
+(defvar text-scale-remap-header-line-face nil
+  "If non-nil, also change font size of the `header-line' face.
+This will also affect any face that inherits from
+`header-line'.")
+(make-variable-buffer-local 'text-scale-header-line)
+
+(defun face-remap--clear-remappings ()
+  (dolist (remapping text-scale-mode--remappings)
+    (face-remap-remove-relative remapping))
+  (setq text-scale-mode--remappings nil))
+
+(defun face-remap--remap-face (sym)
+  (push (face-remap-add-relative sym
+                       :height
+                       (expt text-scale-mode-step
+                             text-scale-mode-amount))
+        text-scale-mode--remappings))
+
 (define-minor-mode text-scale-mode
   "Minor mode for displaying buffer text in a larger/smaller font.
 
@@ -240,19 +261,20 @@ text-scale-mode
 The `text-scale-increase', `text-scale-decrease', and
 `text-scale-set' functions may be used to interactively modify
 the variable `text-scale-mode-amount' (they also enable or
-disable `text-scale-mode' as necessary)."
+disable `text-scale-mode' as necessary).
+
+If `text-scale-remap-header-line-face' is non-nil, also change
+the font size of the `header-line' face (and any face that
+inherits from it)."
   :lighter (" " text-scale-mode-lighter)
-  (when text-scale-mode-remapping
-    (face-remap-remove-relative text-scale-mode-remapping))
+  (face-remap--clear-remappings)
   (setq text-scale-mode-lighter
 	(format (if (>= text-scale-mode-amount 0) "+%d" "%d")
 		text-scale-mode-amount))
-  (setq text-scale-mode-remapping
-	(and text-scale-mode
-	     (face-remap-add-relative 'default
-					  :height
-					  (expt text-scale-mode-step
-						text-scale-mode-amount))))
+  (when text-scale-mode
+    (face-remap--remap-face 'default)
+    (when text-scale-remap-header-line-face
+      (face-remap--remap-face 'header-line)))
   (force-window-update (current-buffer)))
 
 (defun text-scale-min-amount ()
-- 
2.28.0


[-- Attachment #3: 0002-Set-text-scale-mode-header-line-in-tabulated-list-mo.patch --]
[-- Type: text/x-diff, Size: 1078 bytes --]

From deb68fa05b1f7f78168f3516804427cb952d221c Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 19 Oct 2020 01:05:43 +0200
Subject: [PATCH 2/2] Set text-scale-mode-header-line in tabulated-list-mode

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Set
text-scale-mode-header-line to a non-nil value.  (Bug#41852)
---
 lisp/emacs-lisp/tabulated-list.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b13f609f88..2f7899ec51 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -761,6 +761,7 @@ tabulated-list-mode
   (setq-local revert-buffer-function #'tabulated-list-revert)
   (setq-local glyphless-char-display
               (tabulated-list-make-glyphless-char-display-table))
+  (setq-local text-scale-mode-header-line t)
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-19 18:21         ` Stefan Kangas
@ 2020-10-19 19:02           ` Eli Zaretskii
  2020-10-19 22:41             ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-19 19:02 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Mon, 19 Oct 2020 18:21:06 +0000
> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> > This should mention modes that arrange their display in tabular form
> > below the header-line, such as tabulated-list-mode and its
> > descendants.  Otherwise the last sentence and the goal of the feature
> > itself are left on a level that's too abstract.
> 
> I've made an attempt to improve this in the attached.

LGTM, thanks.

> >> -(make-variable-buffer-local 'text-scale-mode-remapping)
> >> +(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
> >> +
> >> +(defvar text-scale-mode--remappings nil
> >> +  "List of current remapping cookies for `text-scale-mode'.")
> >
> > Why this change?
> 
> This is to give the variable the correct plural form, and to mark it
> internal by giving it the double dash.

Can we continue supporting text-scale-mode-remapping in
text-scale-mode--remappings?  I'd like to avoid backward-incompatible
changes if possible.

> >> +(defun face-remap--remap-face (sym)
> >> +  (push (face-remap-add-relative sym
> >> +                       :height
> >> +                       (expt text-scale-mode-step
> >> +                             text-scale-mode-amount))
> >> +        text-scale-mode--remappings))
> >
> > I wonder whether this is all there is to it.  The display code doesn't
> > automatically use the remapped face in all cases, we need to code that
> > "by hand" in each and every case.  So far we've been doing that only
> > for the default face; I wonder if we'll have to do something similar
> > for header-line on the C level...  Please be sure to test this in
> > every possible way, including cursor motion around such rescaled
> > header-lines etc.
> 
> I've done my best to test it some more, including cursor motion around
> the adjusted header line, as well as scrolling the window left and right
> and up and down (using mouse and keyboard).  I've not been able to
> produce any failures so far.  Please let me know if you have any more
> ideas for what I could do to try to break it.

Do mouse clicks work well, even if you click close to the edges of a
much-enlarged header-line?

Otherwise the changes look fine to me, thanks.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-19 19:02           ` Eli Zaretskii
@ 2020-10-19 22:41             ` Stefan Kangas
  2020-10-20 14:15               ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-19 22:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

Eli Zaretskii <eliz@gnu.org> writes:

> Can we continue supporting text-scale-mode-remapping in
> text-scale-mode--remappings?  I'd like to avoid backward-incompatible
> changes if possible.

Do you mean something like this?

diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 4d7be7d65a..377976782f 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -219,7 +219,8 @@ text-scale-mode-step

 ;; current remapping cookie for text-scale-mode
 (defvar text-scale-mode-remapping nil)
-(make-obsolete-variable 'text-scale-mode-remapping "no longer used." "28.1")
+(make-obsolete-variable 'text-scale-mode-remapping
+                        'text-scale-mode--remappings "28.1")

 (defvar text-scale-mode--remappings nil
   "List of current remapping cookies for `text-scale-mode'.")
@@ -239,8 +240,10 @@ text-scale-remap-header-line-face
 (make-variable-buffer-local 'text-scale-header-line)

 (defun face-remap--clear-remappings ()
-  (dolist (remapping text-scale-mode--remappings)
+  (dolist (remapping (cons text-scale-mode-remapping ; backwards-compatibility
+                           text-scale-mode--remappings))
     (face-remap-remove-relative remapping))
+  (setq text-scale-mode-remapping nil) ; backwards-compatibility
   (setq text-scale-mode--remappings nil))

 (defun face-remap--remap-face (sym)

> Do mouse clicks work well, even if you click close to the edges of a
> much-enlarged header-line?

This seems to work as expected, yes.  I've tested with both very large
and very small text sizes.

> Otherwise the changes look fine to me, thanks.

Thank you for reviewing.





^ permalink raw reply related	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-19 22:41             ` Stefan Kangas
@ 2020-10-20 14:15               ` Eli Zaretskii
  2020-10-20 14:40                 ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-20 14:15 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Mon, 19 Oct 2020 15:41:48 -0700
> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Can we continue supporting text-scale-mode-remapping in
> > text-scale-mode--remappings?  I'd like to avoid backward-incompatible
> > changes if possible.
> 
> Do you mean something like this?

Yes.  Except that now I'm asking whether we need to obsolete the
variable.  is that just because of the name?





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-20 14:15               ` Eli Zaretskii
@ 2020-10-20 14:40                 ` Stefan Kangas
  2020-10-20 14:45                   ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-20 14:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

Eli Zaretskii <eliz@gnu.org> writes:

>> > Can we continue supporting text-scale-mode-remapping in
>> > text-scale-mode--remappings?  I'd like to avoid backward-incompatible
>> > changes if possible.
>>
>> Do you mean something like this?
>
> Yes.  Except that now I'm asking whether we need to obsolete the
> variable.  is that just because of the name?

I guess we could re-use the old name if we really want to.  But it would
still be a breaking change, since this is now a list instead of a single
value.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-20 14:40                 ` Stefan Kangas
@ 2020-10-20 14:45                   ` Eli Zaretskii
  2020-10-20 19:10                     ` Thomas Hisch
  2020-10-29 17:33                     ` Stefan Kangas
  0 siblings, 2 replies; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-20 14:45 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 20 Oct 2020 14:40:17 +0000
> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> >> Do you mean something like this?
> >
> > Yes.  Except that now I'm asking whether we need to obsolete the
> > variable.  is that just because of the name?
> 
> I guess we could re-use the old name if we really want to.  But it would
> still be a breaking change, since this is now a list instead of a single
> value.

That's also easy to handle in a compatible way, right?





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-20 14:45                   ` Eli Zaretskii
@ 2020-10-20 19:10                     ` Thomas Hisch
  2020-10-29 17:43                       ` Stefan Kangas
  2020-10-29 17:33                     ` Stefan Kangas
  1 sibling, 1 reply; 49+ messages in thread
From: Thomas Hisch @ 2020-10-20 19:10 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: 41852

Thx for working on a fix for this issue!

I've tried testing the patches, but without success. What I did was the
following:

start emacs -Q
M-x package-list-packages
M-x text-scale-increase

The text-scale-increase command doesn't have an effect on the scale of
the header line, but only on the scale of the date in the package table.

Does the above example rescale the font in the header line for you?

Regards,
Thomas
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice@ims.co.at; DVR-Nr: 0374369; www.ims.co.at





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-20 14:45                   ` Eli Zaretskii
  2020-10-20 19:10                     ` Thomas Hisch
@ 2020-10-29 17:33                     ` Stefan Kangas
  2020-10-29 18:02                       ` Drew Adams
                                         ` (2 more replies)
  1 sibling, 3 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-29 17:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> > Yes.  Except that now I'm asking whether we need to obsolete the
>> > variable.  is that just because of the name?
>>
>> I guess we could re-use the old name if we really want to.  But it would
>> still be a breaking change, since this is now a list instead of a single
>> value.
>
> That's also easy to handle in a compatible way, right?

OK, here's what I propose.  I still suggest to make the old name into an
obsolete alias in order to mark it as internal, please let me know if
this is acceptable.

[-- Attachment #2: 0001-Make-text-scale-mode-optionally-adjust-header-line-f.patch --]
[-- Type: text/x-diff, Size: 5728 bytes --]

From 419fe81ab759823d43204d706d1e05df4b0e7052 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Thu, 29 Oct 2020 18:27:56 +0100
Subject: [PATCH] Make text-scale-mode optionally adjust header line face

* lisp/face-remap.el (text-scale-remap-header-line-face): New buffer
local variable.
(text-scale-mode): Also adjust header-line face if above new
variable is non-nil.
(face-remap--clear-remappings, face-remap--remap-face): New
functions.
(text-scale-mode--remappings): New variable.
(text-scale-mode-remapping): Make into obsolete variable alias for
above new variable.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Use
text-scale-remap-header-line-face.
---
 etc/NEWS                          | 15 +++++++++
 lisp/emacs-lisp/tabulated-list.el |  1 +
 lisp/face-remap.el                | 51 +++++++++++++++++++++++++------
 3 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 4b1272d18b..f514133680 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1368,6 +1368,21 @@ mouse now pops up a TTY menu by default instead of running the command
 'tmm-menubar'.  To restore the old behavior, set the variable
 'tty-menu-open-use-tmm' to non-nil.
 
+** text-scale-mode
+
+---
+*** text-scale-mode can now adjust font size of the 'header-line' face.
+When the new buffer local variable 'text-scale-mode-header-line' is
+non-nil, 'text-scale-adjust' (bound to 'C-x C-+' and 'C-x C--' by
+default) will also change the text height of the 'header-line' face.
+This will also affect any face that inherits from it.
+
+This feature is intended for use by Emacs Lisp package authors in
+major modes that arrange their display in tabular form below the
+header-line.  It is enabled in 'tabulated-list-mode' and its derived
+modes (such as the modes used by 'list-packages', 'list-buffers' and
+'bookmark-bmenu-list').
+
 ** xwidget-webkit mode
 
 *** New xwidget commands.
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b13f609f88..18b48edc4f 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -761,6 +761,7 @@ tabulated-list-mode
   (setq-local revert-buffer-function #'tabulated-list-revert)
   (setq-local glyphless-char-display
               (tabulated-list-make-glyphless-char-display-table))
+  (setq-local text-scale-remap-header-line-face t)
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 028269a4b0..e61fa4cb4e 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -219,7 +219,11 @@ text-scale-mode-step
 
 ;; current remapping cookie for text-scale-mode
 (defvar text-scale-mode-remapping nil)
-(make-variable-buffer-local 'text-scale-mode-remapping)
+(make-obsolete-variable 'text-scale-mode-remapping
+                        'text-scale-mode--remappings "28.1")
+
+(defvar text-scale-mode--remappings nil
+  "List of current remapping cookies for `text-scale-mode'.")
 
 ;; Lighter displayed for text-scale-mode in mode-line minor-mode list
 (defvar text-scale-mode-lighter "+0")
@@ -229,6 +233,32 @@ text-scale-mode-lighter
 (defvar text-scale-mode-amount 0)
 (make-variable-buffer-local 'text-scale-mode-amount)
 
+(defvar text-scale-remap-header-line-face nil
+  "If non-nil, also change font size of the `header-line' face.
+This will also affect any face that inherits from
+`header-line'.")
+(make-variable-buffer-local 'text-scale-header-line)
+
+(defun face-remap--clear-remappings ()
+  (dolist (remapping
+           ;; This is a bit messy to stay backwards compatible.
+           ;; In the future, this can be simplified to just use
+           ;; `text-scale-mode--remappings'.
+           (if (consp (car-safe text-scale-mode--remappings))
+               text-scale-mode--remappings
+             (cons text-scale-mode-remapping
+                   text-scale-mode--remappings)))
+    (face-remap-remove-relative remapping))
+  (setq text-scale-mode-remapping nil)  ; backwards-compatibility
+  (setq text-scale-mode--remappings nil))
+
+(defun face-remap--remap-face (sym)
+  (push (face-remap-add-relative sym
+                       :height
+                       (expt text-scale-mode-step
+                             text-scale-mode-amount))
+        text-scale-mode--remappings))
+
 (define-minor-mode text-scale-mode
   "Minor mode for displaying buffer text in a larger/smaller font.
 
@@ -240,19 +270,20 @@ text-scale-mode
 The `text-scale-increase', `text-scale-decrease', and
 `text-scale-set' functions may be used to interactively modify
 the variable `text-scale-mode-amount' (they also enable or
-disable `text-scale-mode' as necessary)."
+disable `text-scale-mode' as necessary).
+
+If `text-scale-remap-header-line-face' is non-nil, also change
+the font size of the `header-line' face (and any face that
+inherits from it)."
   :lighter (" " text-scale-mode-lighter)
-  (when text-scale-mode-remapping
-    (face-remap-remove-relative text-scale-mode-remapping))
+  (face-remap--clear-remappings)
   (setq text-scale-mode-lighter
 	(format (if (>= text-scale-mode-amount 0) "+%d" "%d")
 		text-scale-mode-amount))
-  (setq text-scale-mode-remapping
-	(and text-scale-mode
-	     (face-remap-add-relative 'default
-					  :height
-					  (expt text-scale-mode-step
-						text-scale-mode-amount))))
+  (when text-scale-mode
+    (face-remap--remap-face 'default)
+    (when text-scale-remap-header-line-face
+      (face-remap--remap-face 'header-line)))
   (force-window-update (current-buffer)))
 
 (defun text-scale-min-amount ()
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-20 19:10                     ` Thomas Hisch
@ 2020-10-29 17:43                       ` Stefan Kangas
  2020-10-29 19:37                         ` Thomas Hisch
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-29 17:43 UTC (permalink / raw)
  To: Thomas Hisch, Eli Zaretskii; +Cc: 41852

Thomas Hisch <thomas.hisch@ims.co.at> writes:

> I've tried testing the patches, but without success. What I did was the
> following:

Thanks for testing!

> start emacs -Q
> M-x package-list-packages
> M-x text-scale-increase
>
> The text-scale-increase command doesn't have an effect on the scale of
> the header line, but only on the scale of the date in the package table.
>
> Does the above example rescale the font in the header line for you?

Yes, it works for me.  Strange.

My only guess is that there was something missing in the last diff I
sent.  Could you please try again using the latest patch I sent to this
thread?





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 17:33                     ` Stefan Kangas
@ 2020-10-29 18:02                       ` Drew Adams
  2020-10-29 18:15                         ` Stefan Kangas
  2020-10-30  8:54                       ` martin rudalics
  2020-10-31  8:29                       ` Eli Zaretskii
  2 siblings, 1 reply; 49+ messages in thread
From: Drew Adams @ 2020-10-29 18:02 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

> OK, here's what I propose.  I still suggest to make the old name into an
> obsolete alias in order to mark it as internal, please let me know if
> this is acceptable.

Minor comments:

1. No need to mention this here: "(bound to 'C-x C-+'
   and 'C-x C--' by default)".  This is about what's
   new; it's not doc for the command.

2. "This feature is intended for..." sounds like it's
   intended _only_ for that use case.  I think you
   really want to point out that it is useful, _in
   particular_, for that use case.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 18:02                       ` Drew Adams
@ 2020-10-29 18:15                         ` Stefan Kangas
  2020-10-29 18:32                           ` Drew Adams
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-29 18:15 UTC (permalink / raw)
  To: Drew Adams, Eli Zaretskii; +Cc: thomas.hisch, 41852

Drew Adams <drew.adams@oracle.com> writes:

> Minor comments:
>
> 1. No need to mention this here: "(bound to 'C-x C-+'
>    and 'C-x C--' by default)".  This is about what's
>    new; it's not doc for the command.
>
> 2. "This feature is intended for..." sounds like it's
>    intended _only_ for that use case.  I think you
>    really want to point out that it is useful, _in
>    particular_, for that use case.

Thanks, I changed the text as follows:

*** text-scale-mode can now adjust font size of the 'header-line' face.
When the new buffer local variable 'text-scale-mode-header-line' is
non-nil, 'text-scale-adjust' will also change the text height of the
'header-line' face.  This will affect any face that inherits from it.

This feature is useful for major modes that arrange their display in a
tabular form below the header-line.  It is enabled by default in
'tabulated-list-mode' and its derived modes (such as the modes used by
'list-packages', 'list-buffers' and 'list-bookmarks).





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 18:15                         ` Stefan Kangas
@ 2020-10-29 18:32                           ` Drew Adams
  2020-10-29 18:47                             ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Drew Adams @ 2020-10-29 18:32 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

> Thanks, I changed the text as follows:
> 
> *** text-scale-mode can now adjust font size of the 'header-line' face.
> When the new buffer local variable 'text-scale-mode-header-line' is
> non-nil, 'text-scale-adjust' will also change the text height of the
> 'header-line' face.  This will affect any face that inherits from it.
> 
> This feature is useful for major modes that arrange their display in a
> tabular form below the header-line.  It is enabled by default in
> 'tabulated-list-mode' and its derived modes (such as the modes used by
> 'list-packages', 'list-buffers' and 'list-bookmarks).

LGTM; thx.

I'd suggest removing the text in parentheses.
NEWS items should generally be limited to what's new,
without additional explanation (unless it's important).





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 18:32                           ` Drew Adams
@ 2020-10-29 18:47                             ` Stefan Kangas
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-29 18:47 UTC (permalink / raw)
  To: Drew Adams, Eli Zaretskii; +Cc: thomas.hisch, 41852

Drew Adams <drew.adams@oracle.com> writes:

> I'd suggest removing the text in parentheses.
> NEWS items should generally be limited to what's new,
> without additional explanation (unless it's important).

OK, I'll do that.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 17:43                       ` Stefan Kangas
@ 2020-10-29 19:37                         ` Thomas Hisch
  2020-10-29 21:45                           ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Hisch @ 2020-10-29 19:37 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: 41852

[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]



On 29.10.20 18:43, Stefan Kangas wrote:
> Thomas Hisch <thomas.hisch@ims.co.at> writes:
>
>> I've tried testing the patches, but without success. What I did was the
>> following:
>
> Thanks for testing!
>

My pleasure!

>> start emacs -Q
>> M-x package-list-packages
>> M-x text-scale-increase
>>
>> The text-scale-increase command doesn't have an effect on the scale of
>> the header line, but only on the scale of the date in the package table.
>>
>> Does the above example rescale the font in the header line for you?
>
> Yes, it works for me.  Strange.
>
> My only guess is that there was something missing in the last diff I
> sent.  Could you please try again using the latest patch I sent to this
> thread?
>

You current patch seems to work - Great! There is still an issue when
the test-scale is increased multiple times, because the columns of the
header row don't align with the columns of the data rows. See the
attached image.

Regards
Thomas

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice@ims.co.at; DVR-Nr: 0374369; www.ims.co.at

[-- Attachment #2: plp.png --]
[-- Type: image/png, Size: 62287 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 19:37                         ` Thomas Hisch
@ 2020-10-29 21:45                           ` Stefan Kangas
  2020-10-30  8:01                             ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-29 21:45 UTC (permalink / raw)
  To: Thomas Hisch, Eli Zaretskii; +Cc: 41852

Thomas Hisch <thomas.hisch@ims.co.at> writes:

> You current patch seems to work - Great!

Excellent, thanks for testing.

> There is still an issue when the test-scale is increased multiple
> times, because the columns of the header row don't align with the
> columns of the data rows. See the attached image.

Indeed, this seems to be a limitation with the display property
:align-to space.  But it seems to be a separate, more general issue, so
I filed Bug#44315.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 21:45                           ` Stefan Kangas
@ 2020-10-30  8:01                             ` Eli Zaretskii
  0 siblings, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-30  8:01 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 29 Oct 2020 14:45:16 -0700
> Cc: 41852@debbugs.gnu.org
> 
> > There is still an issue when the test-scale is increased multiple
> > times, because the columns of the header row don't align with the
> > columns of the data rows. See the attached image.
> 
> Indeed, this seems to be a limitation with the display property
> :align-to space.

As explained in bug#44315, this is not a limitation.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 17:33                     ` Stefan Kangas
  2020-10-29 18:02                       ` Drew Adams
@ 2020-10-30  8:54                       ` martin rudalics
  2020-10-30 16:04                         ` Stefan Kangas
  2020-10-31  8:29                       ` Eli Zaretskii
  2 siblings, 1 reply; 49+ messages in thread
From: martin rudalics @ 2020-10-30  8:54 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

 > +default) will also change the text height of the 'header-line' face.

I'd prefer "font size" instead of "text height" here.  Also, I'd like to
see some clarification

(1) that only the size of the header line face for a buffer where
'text-scale-mode-header-line' has been set is affected (the line above
is IMHO too general to state this restriction),

(2) that text in the header line or elsewhere in such a buffer not
inheriting from (the remapped) header line face is unaffected, and

(3) whether and how existing customizations of the header line face are
taken into account.

Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
when a user customizes header line face to use some large or small font
size (a scenario where face remapping is not involved at all).

Note that maybe 'text-scale-mode-header-line' should be also watched by
'set-buffer-redisplay'.

Thanks, martin






^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30  8:54                       ` martin rudalics
@ 2020-10-30 16:04                         ` Stefan Kangas
  2020-10-30 17:37                           ` martin rudalics
  2020-10-30 18:54                           ` Eli Zaretskii
  0 siblings, 2 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-30 16:04 UTC (permalink / raw)
  To: martin rudalics, Eli Zaretskii; +Cc: thomas.hisch, 41852

martin rudalics <rudalics@gmx.at> writes:

>  > +default) will also change the text height of the 'header-line' face.
>
> I'd prefer "font size" instead of "text height" here.

Fixed.

> Also, I'd like to see some clarification
>
> (1) that only the size of the header line face for a buffer where
> 'text-scale-mode-header-line' has been set is affected (the line above
> is IMHO too general to state this restriction),

Could you be more specific?  It already says it's buffer local, but it
seems like you think it should say something more?

Do you mean to be very explicit about it, like this?

  When the new buffer local variable 'text-scale-remap-header-line-face'
  is non-nil, 'text-scale-adjust' will also change the font size of the
  'header-line' face in the current buffer.  This will also affect any
  face that inherits from it.

> (2) that text in the header line or elsewhere in such a buffer not
> inheriting from (the remapped) header line face is unaffected, and

I'm not sure I understand what you mean.  If text-scale-mode is enabled,
typically through running e.g. `text-scale-increase', the `default' face
is scaled.  The result, AFAICT, is that all faces in the buffer change
size (well, not the mode line).  And that makes sense since all other
implicitly inherits from it, right?

This works even for anonymous faces, e.g.:

   (progn
    (fundamental-mode)
    (insert (propertize "foo" 'face '(:height 1.5)))
    (text-scale-increase))

What am I missing?

> (3) whether and how existing customizations of the header line face are
> taken into account.
>
> Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
> when a user customizes header line face to use some large or small font
> size (a scenario where face remapping is not involved at all).

I tried customizing the `Height' for the `header-line' face, and it
seems to work as expected:

With no text-scale-mode it is as big as it is customized to be.  When I
run `text-scale-increase', it scales up accordingly (relative to its
customized size).  So I don't know what, if anything, should be added
here.  Since it works as expected, perhaps there is nothing to add?

> Note that maybe 'text-scale-mode-header-line' should be also watched by
> 'set-buffer-redisplay'.

I tried adding `text-scale-remap-header-line-face' to the list of
variables that are fed to `add-variable-watcher' at the end of frame.el.
That doesn't work, unfortunately.

I believe that since the remapping is done on a Lisp level,
`text-scale-mode' isn't called even with a variable watcher.  Is there a
way to work around that?  Or am I doing it wrong?

Thanks for taking the time to review this.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 16:04                         ` Stefan Kangas
@ 2020-10-30 17:37                           ` martin rudalics
  2020-10-30 19:01                             ` Eli Zaretskii
  2020-10-31  0:31                             ` Stefan Kangas
  2020-10-30 18:54                           ` Eli Zaretskii
  1 sibling, 2 replies; 49+ messages in thread
From: martin rudalics @ 2020-10-30 17:37 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

 > Could you be more specific?  It already says it's buffer local, but it
 > seems like you think it should say something more?

IIUC one cannot "set" a face buffer-locally.  One has to emulate that
via face remapping.

 > Do you mean to be very explicit about it, like this?
 >
 >    When the new buffer local variable 'text-scale-remap-header-line-face'
 >    is non-nil, 'text-scale-adjust' will also change the font size of the
 >    'header-line' face in the current buffer.

I'd say "will also scale the text in the mode line when displaying that
buffer".

 >  This will also affect any
 >    face that inherits from it.

But if I assign the header line face or some face inheriting from it to
some buffer text (not that I recommend doing that), that text will be
scaled regardless of the value of 'text-scale-remap-header-line-face'.
Right?

 >> (2) that text in the header line or elsewhere in such a buffer not
 >> inheriting from (the remapped) header line face is unaffected, and
 >
 > I'm not sure I understand what you mean.  If text-scale-mode is enabled,
 > typically through running e.g. `text-scale-increase', the `default' face
 > is scaled.

Here too I would say something like "the buffer text is scaled".  The
default face itself is not scaled by face remapping.  The remapping is
applied by the display engine whenever the buffer is displayed after all
faces have been merged.  But maybe that is clear to everyone and you
should simply ignore what I wrote.

 > The result, AFAICT, is that all faces in the buffer change
 > size (well, not the mode line).

The faces do not change size.  They just "appear" larger or smaller.
And mode, header and tab line are not part of the buffer, so face
remapping does not affect them.  So far - I wouldn't mind if your change
affected mode and tab line as well.

 > And that makes sense since all other
 > implicitly inherits from it, right?
 >
 > This works even for anonymous faces, e.g.:
 >
 >     (progn
 >      (fundamental-mode)
 >      (insert (propertize "foo" 'face '(:height 1.5)))
 >      (text-scale-increase))
 >
 > What am I missing?

Inserting "foo" makes it part of the buffer text and thus subject to
text scaling ('text-scale-increase' needs an argument btw).

 >> (3) whether and how existing customizations of the header line face are
 >> taken into account.
 >>
 >> Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
 >> when a user customizes header line face to use some large or small font
 >> size (a scenario where face remapping is not involved at all).
 >
 > I tried customizing the `Height' for the `header-line' face, and it
 > seems to work as expected:
 >
 > With no text-scale-mode it is as big as it is customized to be.  When I
 > run `text-scale-increase', it scales up accordingly (relative to its
 > customized size).  So I don't know what, if anything, should be added
 > here.  Since it works as expected, perhaps there is nothing to add?

OK.

 >> Note that maybe 'text-scale-mode-header-line' should be also watched by
 >> 'set-buffer-redisplay'.
 >
 > I tried adding `text-scale-remap-header-line-face' to the list of
 > variables that are fed to `add-variable-watcher' at the end of frame.el.
 > That doesn't work, unfortunately.
 >
 > I believe that since the remapping is done on a Lisp level,
 > `text-scale-mode' isn't called even with a variable watcher.  Is there a
 > way to work around that?  Or am I doing it wrong?

I'm not sure whether it's needed at all, Eli knows better.  I suppose it
should work out of the box because setting the header line format
already triggers 'set-buffer-redisplay' and the additional setting of
'text-scale-mode-header-line' will be covered by it.  We might have a
problem when these two are set in separate steps.

martin





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 16:04                         ` Stefan Kangas
  2020-10-30 17:37                           ` martin rudalics
@ 2020-10-30 18:54                           ` Eli Zaretskii
  2020-10-30 20:22                             ` Stefan Kangas
  1 sibling, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-30 18:54 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 41852, thomas.hisch

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 30 Oct 2020 16:04:58 +0000
> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> > (2) that text in the header line or elsewhere in such a buffer not
> > inheriting from (the remapped) header line face is unaffected, and
> 
> I'm not sure I understand what you mean.  If text-scale-mode is enabled,
> typically through running e.g. `text-scale-increase', the `default' face
> is scaled.  The result, AFAICT, is that all faces in the buffer change
> size (well, not the mode line).

No, only faces that inherit from 'default' are scaled.  And now so
will the faces that inherit from 'header-line'.

> And that makes sense since all other implicitly inherits from it,
> right?

No, not every face inherits from 'default', only those that inherit
explicitly.  A random face that is defined with defface isn't affected
by text-scale-*.

> This works even for anonymous faces, e.g.:
> 
>    (progn
>     (fundamental-mode)
>     (insert (propertize "foo" 'face '(:height 1.5)))
>     (text-scale-increase))
> 
> What am I missing?

See above.

> > Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
> > when a user customizes header line face to use some large or small font
> > size (a scenario where face remapping is not involved at all).
> 
> I tried customizing the `Height' for the `header-line' face, and it
> seems to work as expected:
> 
> With no text-scale-mode it is as big as it is customized to be.  When I
> run `text-scale-increase', it scales up accordingly (relative to its
> customized size).  So I don't know what, if anything, should be added
> here.  Since it works as expected, perhaps there is nothing to add?

What Martin means, I think, is that using a larger font in header-line
face might make the text below the header line in tabulated-list-mode
fail to align.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 17:37                           ` martin rudalics
@ 2020-10-30 19:01                             ` Eli Zaretskii
  2020-10-31  0:31                             ` Stefan Kangas
  1 sibling, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-30 19:01 UTC (permalink / raw)
  To: martin rudalics; +Cc: thomas.hisch, stefan, 41852

> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> Date: Fri, 30 Oct 2020 18:37:35 +0100
> 
>  >> Note that maybe 'text-scale-mode-header-line' should be also watched by
>  >> 'set-buffer-redisplay'.
>  >
>  > I tried adding `text-scale-remap-header-line-face' to the list of
>  > variables that are fed to `add-variable-watcher' at the end of frame.el.
>  > That doesn't work, unfortunately.
>  >
>  > I believe that since the remapping is done on a Lisp level,
>  > `text-scale-mode' isn't called even with a variable watcher.  Is there a
>  > way to work around that?  Or am I doing it wrong?
> 
> I'm not sure whether it's needed at all, Eli knows better.  I suppose it
> should work out of the box because setting the header line format
> already triggers 'set-buffer-redisplay' and the additional setting of
> 'text-scale-mode-header-line' will be covered by it.  We might have a
> problem when these two are set in separate steps.

The way to check whether some variable needs to be watched is
described in a comment near the end of frame.el.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 18:54                           ` Eli Zaretskii
@ 2020-10-30 20:22                             ` Stefan Kangas
  2020-10-30 20:53                               ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-30 20:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41852, thomas.hisch

Eli Zaretskii <eliz@gnu.org> writes:

>> > (2) that text in the header line or elsewhere in such a buffer not
>> > inheriting from (the remapped) header line face is unaffected, and
>>
>> I'm not sure I understand what you mean.  If text-scale-mode is enabled,
>> typically through running e.g. `text-scale-increase', the `default' face
>> is scaled.  The result, AFAICT, is that all faces in the buffer change
>> size (well, not the mode line).
>
> No, only faces that inherit from 'default' are scaled.  And now so
> will the faces that inherit from 'header-line'.

When I use my patch in emacs -Q, say `M-x list-buffer' and then evaluate
this in that buffer:

(setq-local header-line-format (concat
                                (propertize "foo" 'face 'mode-line) " "
                                (propertize "bar" 'face 'bold)))

Both "foo" and "bar" in the header line is scaled with the rest of the
buffer.  But I don't think either of those faces inherits from the
header-line face.

Is this the scenario you had in mind?

>> And that makes sense since all other implicitly inherits from it,
>> right?
>
> No, not every face inherits from 'default', only those that inherit
> explicitly.

`(elisp) Basic Faces' says that they do:

  ‘default’
       The default face, whose attributes are all specified.  All other
       faces implicitly inherit from it: any unspecified attribute
       defaults to the attribute on this face (*note Face Attributes::).

So I'm not sure I understand what you are saying.  I'm probably still
missing something.

> A random face that is defined with defface isn't affected by
> text-scale-*.

What do you mean by "random face" here?  When I do this, the text "bar"
is scaled along with the rest:

(progn
  (defface foo-face '((t :weight bold)) "")
  (pop-to-buffer (get-buffer-create "*test*"))
  (insert "foo\n")
  (insert (propertize "bar\n" 'face 'foo-face))
  (insert "baz\n")
  (text-scale-increase 1))

Or could you give an example of where this does not happen?

>> This works even for anonymous faces, e.g.:
>>
>>    (progn
>>     (fundamental-mode)
>>     (insert (propertize "foo" 'face '(:height 1.5)))
>>     (text-scale-increase))
>>
>> What am I missing?
>
> See above.

Could you elaborate?  What I see is that this anonymous face is scaled.
Are you saying that you see something different?

>> > Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
>> > when a user customizes header line face to use some large or small font
>> > size (a scenario where face remapping is not involved at all).
>>
>> I tried customizing the `Height' for the `header-line' face, and it
>> seems to work as expected:
>>
>> With no text-scale-mode it is as big as it is customized to be.  When I
>> run `text-scale-increase', it scales up accordingly (relative to its
>> customized size).  So I don't know what, if anything, should be added
>> here.  Since it works as expected, perhaps there is nothing to add?
>
> What Martin means, I think, is that using a larger font in header-line
> face might make the text below the header line in tabulated-list-mode
> fail to align.

Oh, okay.  Yes, that is true.

Is there anything we can or should do about that?





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 20:22                             ` Stefan Kangas
@ 2020-10-30 20:53                               ` Eli Zaretskii
  2020-10-31 16:15                                 ` Stefan Kangas
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-30 20:53 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 41852, thomas.hisch

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 30 Oct 2020 20:22:58 +0000
> Cc: rudalics@gmx.at, thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> > No, only faces that inherit from 'default' are scaled.  And now so
> > will the faces that inherit from 'header-line'.
> 
> When I use my patch in emacs -Q, say `M-x list-buffer' and then evaluate
> this in that buffer:
> 
> (setq-local header-line-format (concat
>                                 (propertize "foo" 'face 'mode-line) " "
>                                 (propertize "bar" 'face 'bold)))
> 
> Both "foo" and "bar" in the header line is scaled with the rest of the
> buffer.  But I don't think either of those faces inherits from the
> header-line face.

Try using fixed-pitch and variable-pitch instead of mode-line and
bold.  What happens then?  And what does that mean for this
discussion?

> > No, not every face inherits from 'default', only those that inherit
> > explicitly.
> 
> `(elisp) Basic Faces' says that they do:
> 
>   ‘default’
>        The default face, whose attributes are all specified.  All other
>        faces implicitly inherit from it: any unspecified attribute
>        defaults to the attribute on this face (*note Face Attributes::).
> 
> So I'm not sure I understand what you are saying.

You said it yourself: "any _unspecified_ attribute".

> > A random face that is defined with defface isn't affected by
> > text-scale-*.
> 
> What do you mean by "random face" here?  When I do this, the text "bar"
> is scaled along with the rest:
> 
> (progn
>   (defface foo-face '((t :weight bold)) "")
>   (pop-to-buffer (get-buffer-create "*test*"))
>   (insert "foo\n")
>   (insert (propertize "bar\n" 'face 'foo-face))
>   (insert "baz\n")
>   (text-scale-increase 1))
> 
> Or could you give an example of where this does not happen?

I just did: fixed-pitch and variable-pitch.  Another example would be
any defface that specifies :height as an absolute number of 1/10
point.

> >>    (progn
> >>     (fundamental-mode)
> >>     (insert (propertize "foo" 'face '(:height 1.5)))
> >>     (text-scale-increase))
> >>
> >> What am I missing?
> >
> > See above.
> 
> Could you elaborate?  What I see is that this anonymous face is scaled.

Because you specified :height as 1.5 times the default, i.e. relative
to the default face.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 17:37                           ` martin rudalics
  2020-10-30 19:01                             ` Eli Zaretskii
@ 2020-10-31  0:31                             ` Stefan Kangas
  2020-10-31  8:00                               ` martin rudalics
  1 sibling, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-10-31  0:31 UTC (permalink / raw)
  To: martin rudalics, Eli Zaretskii; +Cc: thomas.hisch, 41852

martin rudalics <rudalics@gmx.at> writes:

>  >    When the new buffer local variable 'text-scale-remap-header-line-face'
>  >    is non-nil, 'text-scale-adjust' will also change the font size of the
>  >    'header-line' face in the current buffer.
>
> I'd say "will also scale the text in the mode line when displaying that
> buffer".

It doesn't scale the text in the mode line, though.

>  >  This will also affect any
>  >    face that inherits from it.
>
> But if I assign the header line face or some face inheriting from it to
> some buffer text (not that I recommend doing that), that text will be
> scaled regardless of the value of 'text-scale-remap-header-line-face'.
> Right?

Yes.  But that seems (in my testing) to be the case for any face I
tested that doesn't have an absolute value for :height.  So I'm not sure
that it needs to be specifically mentioned in NEWS.

> Here too I would say something like "the buffer text is scaled".  The
> default face itself is not scaled by face remapping.  The remapping is
> applied by the display engine whenever the buffer is displayed after all
> faces have been merged.  But maybe that is clear to everyone and you
> should simply ignore what I wrote.

I'm not sure it is clear to everyone (it cleared some stuff up for me),
but I worry that this might be too detailed for NEWS.  The interesting
bits is probably not exactly how it works, but rather what its visible
effects are.

> We might have a problem when these two are set in separate steps.

Yes, if the variable is set after scaling, it does not take effect until
another scaling operation is done.

Adding this seems to fix that:

(add-variable-watcher 'text-scale-remap-header-line-face
		      #'text-scale--refresh)

(defun text-scale--refresh (symbol newval operation where)
  (when (and (eq symbol 'text-scale-remap-header-line-face)
             (eq operation 'set)
             text-scale-mode)
    (with-current-buffer where
      (let ((text-scale-remap-header-line-face newval))
	(text-scale-mode 1)))))





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31  0:31                             ` Stefan Kangas
@ 2020-10-31  8:00                               ` martin rudalics
  0 siblings, 0 replies; 49+ messages in thread
From: martin rudalics @ 2020-10-31  8:00 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

 >> I'd say "will also scale the text in the mode line when displaying that
 >> buffer".
 >
 > It doesn't scale the text in the mode line, though.

Silly me.  I obviously meant "header line" here.

 >> But if I assign the header line face or some face inheriting from it to
 >> some buffer text (not that I recommend doing that), that text will be
 >> scaled regardless of the value of 'text-scale-remap-header-line-face'.
 >> Right?
 >
 > Yes.  But that seems (in my testing) to be the case for any face I
 > tested that doesn't have an absolute value for :height.  So I'm not sure
 > that it needs to be specifically mentioned in NEWS.

By no means.  I just mentioned it to illustrate how elusive the text
scaling mechanism is.

 >> Here too I would say something like "the buffer text is scaled".  The
 >> default face itself is not scaled by face remapping.  The remapping is
 >> applied by the display engine whenever the buffer is displayed after all
 >> faces have been merged.  But maybe that is clear to everyone and you
 >> should simply ignore what I wrote.
 >
 > I'm not sure it is clear to everyone (it cleared some stuff up for me),
 > but I worry that this might be too detailed for NEWS.  The interesting
 > bits is probably not exactly how it works, but rather what its visible
 > effects are.

Fully agreed.  That's why in NEWS I'd try to talk only about those
visual effects and skip any details of the underlying implementation
like faces, fonts and their scaling.

 >> We might have a problem when these two are set in separate steps.
 >
 > Yes, if the variable is set after scaling, it does not take effect until
 > another scaling operation is done.
 >
 > Adding this seems to fix that:
 >
 > (add-variable-watcher 'text-scale-remap-header-line-face
 > 		      #'text-scale--refresh)
 >
 > (defun text-scale--refresh (symbol newval operation where)
 >    (when (and (eq symbol 'text-scale-remap-header-line-face)
 >               (eq operation 'set)
 >               text-scale-mode)
 >      (with-current-buffer where
 >        (let ((text-scale-remap-header-line-face newval))
 > 	(text-scale-mode 1)))))

Something like that.  Here I have a comment in my private version of
face-remap.el that says

       ;; ... face-remapping first pushes an
       ;; entry to `face-remapping-alist' and then sets its cdr to the
       ;; modified value so our variable watcher won't catch the modified
       ;; value.  Such destructive operations are a general problem with
       ;; watching non-scalar variables.

but I can't tell whether it's directly related.

martin





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-29 17:33                     ` Stefan Kangas
  2020-10-29 18:02                       ` Drew Adams
  2020-10-30  8:54                       ` martin rudalics
@ 2020-10-31  8:29                       ` Eli Zaretskii
  2020-10-31 16:25                         ` Stefan Kangas
  2 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-31  8:29 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 29 Oct 2020 10:33:05 -0700
> Cc: thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> >> > Yes.  Except that now I'm asking whether we need to obsolete the
> >> > variable.  is that just because of the name?
> >>
> >> I guess we could re-use the old name if we really want to.  But it would
> >> still be a breaking change, since this is now a list instead of a single
> >> value.
> >
> > That's also easy to handle in a compatible way, right?
> 
> OK, here's what I propose.  I still suggest to make the old name into an
> obsolete alias in order to mark it as internal, please let me know if
> this is acceptable.

I don't understand: I was asking to keep the variable and not make it
obsolete, but this patch does make it obsolete anyway.  What did I
miss?





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-30 20:53                               ` Eli Zaretskii
@ 2020-10-31 16:15                                 ` Stefan Kangas
  2020-10-31 16:48                                   ` Eli Zaretskii
  2020-10-31 16:50                                   ` Stefan Kangas
  0 siblings, 2 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-31 16:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41852, thomas.hisch

Eli Zaretskii <eliz@gnu.org> writes:

> Try using fixed-pitch and variable-pitch instead of mode-line and
> bold.  What happens then?  And what does that mean for this
> discussion?

I tried this with my patch, in emacs -Q:

(progn
 (setq-local text-scale-remap-header-line-face t)
 (setq-local header-line-format (concat
                                 (propertize "foo" 'face 'fixed-pitch) " "
                                 (propertize "bar" 'face 'variable-pitch))))

They also scale.

> I just did: fixed-pitch and variable-pitch.  Another example would be
> any defface that specifies :height as an absolute number of 1/10
> point.

I find that text inserted into a buffer using the fixed-pitch and
variable-pitch both scale.  But if I specify :height to be an absolute
number, the text does not scale.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31  8:29                       ` Eli Zaretskii
@ 2020-10-31 16:25                         ` Stefan Kangas
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-31 16:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

Eli Zaretskii <eliz@gnu.org> writes:

>> OK, here's what I propose.  I still suggest to make the old name into an
>> obsolete alias in order to mark it as internal, please let me know if
>> this is acceptable.
>
> I don't understand: I was asking to keep the variable and not make it
> obsolete, but this patch does make it obsolete anyway.  What did I
> miss?

You didn't miss anything, you just didn't like my updated proposal.
I'll change it to match what you ask.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31 16:15                                 ` Stefan Kangas
@ 2020-10-31 16:48                                   ` Eli Zaretskii
  2020-10-31 16:57                                     ` Eli Zaretskii
  2020-10-31 17:55                                     ` Eli Zaretskii
  2020-10-31 16:50                                   ` Stefan Kangas
  1 sibling, 2 replies; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-31 16:48 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 41852, thomas.hisch

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sat, 31 Oct 2020 09:15:23 -0700
> Cc: rudalics@gmx.at, thomas.hisch@ims.co.at, 41852@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Try using fixed-pitch and variable-pitch instead of mode-line and
> > bold.  What happens then?  And what does that mean for this
> > discussion?
> 
> I tried this with my patch, in emacs -Q:
> 
> (progn
>  (setq-local text-scale-remap-header-line-face t)
>  (setq-local header-line-format (concat
>                                  (propertize "foo" 'face 'fixed-pitch) " "
>                                  (propertize "bar" 'face 'variable-pitch))))
> 
> They also scale.

They don't scale obn my system, which is what I'd expect.  Maybe these
faces don't specify the font on some systems, but the principle is
nevertheless valid.

> > I just did: fixed-pitch and variable-pitch.  Another example would be
> > any defface that specifies :height as an absolute number of 1/10
> > point.
> 
> I find that text inserted into a buffer using the fixed-pitch and
> variable-pitch both scale.  But if I specify :height to be an absolute
> number, the text does not scale.

Which means your fixed-pitch and variable-pitch faces don't specify
the size of the font.  But otherwise what I said was correct, and
should be taken into account.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31 16:15                                 ` Stefan Kangas
  2020-10-31 16:48                                   ` Eli Zaretskii
@ 2020-10-31 16:50                                   ` Stefan Kangas
  1 sibling, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-10-31 16:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41852, thomas.hisch

Stefan Kangas <stefan@marxist.se> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Try using fixed-pitch and variable-pitch instead of mode-line and
>> bold.  What happens then?  And what does that mean for this
>> discussion?
>
> I tried this with my patch, in emacs -Q:
>
> (progn
>  (setq-local text-scale-remap-header-line-face t)
>  (setq-local header-line-format (concat
>                                  (propertize "foo" 'face 'fixed-pitch) " "
>                                  (propertize "bar" 'face 'variable-pitch))))
>
> They also scale.

So looking at this, I'm not sure we should even say: "This will also
affect any face that inherits from it."  It risks confusing more than
helping, IMHO.

Nor am I so sure we should talk about the 'header-line' face.

I think we should say something closer to what Martin suggested, say:

  *** text-scale-mode can now scale the header line.
  When the new buffer local variable 'text-scale-remap-header-line-face'
  is non-nil, 'text-scale-adjust' will also scale the text in the header
  line when displaying that buffer.

  This is useful for major modes that arrange their display in a tabular
  form below the header-line.  It is therefore enabled by default in
  'tabulated-list-mode' and its derived modes.

  Note that text scaling never affects text using a face where the
  :height attribute is set to an absolute value.

And then adjust the docstring accordingly.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31 16:48                                   ` Eli Zaretskii
@ 2020-10-31 16:57                                     ` Eli Zaretskii
  2020-10-31 17:55                                     ` Eli Zaretskii
  1 sibling, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-31 16:57 UTC (permalink / raw)
  To: stefan; +Cc: thomas.hisch, 41852

> Date: Sat, 31 Oct 2020 18:48:32 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 41852@debbugs.gnu.org, thomas.hisch@ims.co.at
> 
> > > I just did: fixed-pitch and variable-pitch.  Another example would be
> > > any defface that specifies :height as an absolute number of 1/10
> > > point.
> > 
> > I find that text inserted into a buffer using the fixed-pitch and
> > variable-pitch both scale.  But if I specify :height to be an absolute
> > number, the text does not scale.
> 
> Which means your fixed-pitch and variable-pitch faces don't specify
> the size of the font.  But otherwise what I said was correct, and
> should be taken into account.

And in any case, the scaling only affects the faces that are used to
display buffer text.  Other parts of the Emacs display, like display
margins and the mode line, aren't affected.  So the same face will
behave as scaled when it is on buffer text, and as unscaled elsewhere.
That's why we needed text-scale-remap-header-line-face in the first
place, right?  This is a subtlety that needs to be kept in mind, if
not made more widely known, when we are expecting that more and more
faces scale together with the default face.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31 16:48                                   ` Eli Zaretskii
  2020-10-31 16:57                                     ` Eli Zaretskii
@ 2020-10-31 17:55                                     ` Eli Zaretskii
  2020-11-12 22:25                                       ` Stefan Kangas
  1 sibling, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-10-31 17:55 UTC (permalink / raw)
  To: stefan; +Cc: thomas.hisch, 41852

> Date: Sat, 31 Oct 2020 18:48:32 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 41852@debbugs.gnu.org, thomas.hisch@ims.co.at
> 
> > (progn
> >  (setq-local text-scale-remap-header-line-face t)
> >  (setq-local header-line-format (concat
> >                                  (propertize "foo" 'face 'fixed-pitch) " "
> >                                  (propertize "bar" 'face 'variable-pitch))))
> > 
> > They also scale.
> 
> They don't scale obn my system, which is what I'd expect.  Maybe these
> faces don't specify the font on some systems, but the principle is
> nevertheless valid.

No, that's because your patch is not yet in, so setting
text-scale-remap-header-line-face has no effect.  Sorry, I didn't
realize you haven't yet committed those changes.

In any case, the general point is valid: it is incorrect to assume
that every face used anywhere will scale with the buffer text.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-10-31 17:55                                     ` Eli Zaretskii
@ 2020-11-12 22:25                                       ` Stefan Kangas
  2020-11-13  7:51                                         ` Eli Zaretskii
                                                           ` (3 more replies)
  0 siblings, 4 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-11-12 22:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> > (progn
>> >  (setq-local text-scale-remap-header-line-face t)
>> >  (setq-local header-line-format (concat
>> >                                  (propertize "foo" 'face 'fixed-pitch) " "
>> >                                  (propertize "bar" 'face 'variable-pitch))))
>> >
>> > They also scale.
>>
>> They don't scale obn my system, which is what I'd expect.  Maybe these
>> faces don't specify the font on some systems, but the principle is
>> nevertheless valid.
>
> No, that's because your patch is not yet in, so setting
> text-scale-remap-header-line-face has no effect.  Sorry, I didn't
> realize you haven't yet committed those changes.
>
> In any case, the general point is valid: it is incorrect to assume
> that every face used anywhere will scale with the buffer text.

What do you think of the attached patch?  It is along the lines of
what I suggested in a separate email, where I wrote:

> So looking at this, I'm not sure we should even say: "This will also
> affect any face that inherits from it."  It risks confusing more than
> helping, IMHO.
>
> Nor am I so sure we should talk about the 'header-line' face.
>
> I think we should say something closer to what Martin suggested, say:
>
>   *** text-scale-mode can now scale the header line.
>   When the new buffer local variable 'text-scale-remap-header-line-face'
>   is non-nil, 'text-scale-adjust' will also scale the text in the header
>   line when displaying that buffer.
>
>   This is useful for major modes that arrange their display in a tabular
>   form below the header-line.  It is therefore enabled by default in
>   'tabulated-list-mode' and its derived modes.
>
>   Note that text scaling never affects text using a face where the
>   :height attribute is set to an absolute value.
>
> And then adjust the docstring accordingly.

Do you think this is horribly wrong, or does it make sense?

Thanks in advance.

[-- Attachment #2: 0001-Make-text-scale-mode-optionally-adjust-the-header-li.patch --]
[-- Type: text/x-diff, Size: 5130 bytes --]

From ec6286f10b1357e719fca90ffa87d254193fb60f Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Thu, 12 Nov 2020 23:12:06 +0100
Subject: [PATCH] Make text-scale-mode optionally adjust the header line

* lisp/face-remap.el
(text-scale-remap-header-line-face): New buffer local variable.
(text-scale-mode): Adjust header line if above variable is non-nil.
(face-remap--clear-remappings, face-remap--remap-face): New defuns.
* lisp/face-remap.el: Arrange to watch text-scale-mode-remapping.
(text-scale--refresh): New function.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Use
text-scale-remap-header-line.
---
 etc/NEWS                          | 12 ++++++++
 lisp/emacs-lisp/tabulated-list.el |  1 +
 lisp/face-remap.el                | 51 +++++++++++++++++++++++++------
 3 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index f21c4cb02c..a21d8f9dce 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1459,6 +1459,18 @@ mouse now pops up a TTY menu by default instead of running the command
 'tmm-menubar'.  To restore the old behavior, set the user option
 'tty-menu-open-use-tmm' to non-nil.
 
+** text-scale-mode
+
+---
+*** text-scale-mode can now adjust font size of the header line.
+When the new buffer local variable 'text-scale-remap-header-line'
+is non-nil, 'text-scale-adjust' will also scale the text in the header
+line when displaying that buffer.
+
+This is useful for major modes that arrange their display in a tabular
+form below the header line.  It is enabled by default in
+'tabulated-list-mode' and its derived modes.
+
 ** xwidget-webkit mode
 
 *** New xwidget commands.
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 30577679f2..ae3ed055c5 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -767,6 +767,7 @@ tabulated-list-mode
   (setq-local revert-buffer-function #'tabulated-list-revert)
   (setq-local glyphless-char-display
               (tabulated-list-make-glyphless-char-display-table))
+  (setq-local text-scale-remap-header-line t)
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 028269a4b0..20c7607408 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -229,6 +229,39 @@ text-scale-mode-lighter
 (defvar text-scale-mode-amount 0)
 (make-variable-buffer-local 'text-scale-mode-amount)
 
+(defvar text-scale-remap-header-line nil
+  "If non-nil, also change font size of the header line.")
+(make-variable-buffer-local 'text-scale-header-line)
+
+(defun text-scale--refresh (symbol newval operation where)
+  "Watcher for `text-scale-remap-header-line'.
+See `add-variable-watcher'."
+  (when (and (eq symbol 'text-scale-remap-header-line)
+             (eq operation 'set)
+             text-scale-mode)
+    (with-current-buffer where
+      (let ((text-scale-remap-header-line newval))
+        (text-scale-mode 1)))))
+(add-variable-watcher 'text-scale-remap-header-line #'text-scale--refresh)
+
+(defun face-remap--clear-remappings ()
+  (dolist (remapping
+           ;; This is a bit messy to stay backwards compatible.
+           ;; In the future, this can be simplified to just use
+           ;; `text-scale-mode-remapping'.
+           (if (consp (car-safe text-scale-mode-remapping))
+               text-scale-mode-remapping
+             (list text-scale-mode-remapping)))
+    (face-remap-remove-relative remapping))
+  (setq text-scale-mode-remapping nil))
+
+(defun face-remap--remap-face (sym)
+  (push (face-remap-add-relative sym
+                       :height
+                       (expt text-scale-mode-step
+                             text-scale-mode-amount))
+        text-scale-mode-remapping))
+
 (define-minor-mode text-scale-mode
   "Minor mode for displaying buffer text in a larger/smaller font.
 
@@ -240,19 +273,19 @@ text-scale-mode
 The `text-scale-increase', `text-scale-decrease', and
 `text-scale-set' functions may be used to interactively modify
 the variable `text-scale-mode-amount' (they also enable or
-disable `text-scale-mode' as necessary)."
+disable `text-scale-mode' as necessary).
+
+If `text-scale-remap-header-line' is non-nil, also change
+the font size of the header line."
   :lighter (" " text-scale-mode-lighter)
-  (when text-scale-mode-remapping
-    (face-remap-remove-relative text-scale-mode-remapping))
+  (face-remap--clear-remappings)
   (setq text-scale-mode-lighter
 	(format (if (>= text-scale-mode-amount 0) "+%d" "%d")
 		text-scale-mode-amount))
-  (setq text-scale-mode-remapping
-	(and text-scale-mode
-	     (face-remap-add-relative 'default
-					  :height
-					  (expt text-scale-mode-step
-						text-scale-mode-amount))))
+  (when text-scale-mode
+    (face-remap--remap-face 'default)
+    (when text-scale-remap-header-line
+      (face-remap--remap-face 'header-line)))
   (force-window-update (current-buffer)))
 
 (defun text-scale-min-amount ()
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-12 22:25                                       ` Stefan Kangas
@ 2020-11-13  7:51                                         ` Eli Zaretskii
  2020-11-25  2:08                                           ` Stefan Kangas
  2020-11-13  8:49                                         ` martin rudalics
                                                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2020-11-13  7:51 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 12 Nov 2020 17:25:17 -0500
> Cc: 41852@debbugs.gnu.org, thomas.hisch@ims.co.at
> 
> > In any case, the general point is valid: it is incorrect to assume
> > that every face used anywhere will scale with the buffer text.
> 
> What do you think of the attached patch?

LGTM, but please wait for Martin and others to comment.

Thanks.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-12 22:25                                       ` Stefan Kangas
  2020-11-13  7:51                                         ` Eli Zaretskii
@ 2020-11-13  8:49                                         ` martin rudalics
  2020-11-25  2:08                                           ` Stefan Kangas
  2020-11-13 13:00                                         ` Jean Louis
  2020-11-13 16:07                                         ` github.com
  3 siblings, 1 reply; 49+ messages in thread
From: martin rudalics @ 2020-11-13  8:49 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: thomas.hisch, 41852

 > +(defvar text-scale-remap-header-line nil
 > +  "If non-nil, also change font size of the header line.")

I'd prefer something like the arguable a bit long

"If non-nil, text scaling may change font size of header lines too."

here.

martin





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-12 22:25                                       ` Stefan Kangas
  2020-11-13  7:51                                         ` Eli Zaretskii
  2020-11-13  8:49                                         ` martin rudalics
@ 2020-11-13 13:00                                         ` Jean Louis
  2020-11-13 14:32                                           ` Stefan Kangas
  2020-11-13 16:07                                         ` github.com
  3 siblings, 1 reply; 49+ messages in thread
From: Jean Louis @ 2020-11-13 13:00 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

I am aware of problem that header in tabulated-list-mode did not
enlarge.

I have tried patching the current git but get problems. Please send me
the full tabulated-list.el that I can try it.

Loading file /home/data1/protected/Programming/Software/emacs/lisp/emacs-lisp/tabulated-list.el failed to provide feature ‘tabulated-list’
make[1]: *** [Makefile:817: bootstrap-emacs.pdmp] Error 255
make[1]: Leaving directory '/home/data1/protected/Programming/Software/emacs/src'
make: *** [Makefile:424: src] Error 2
[~/Programming/Software/emacs]

For your note I am using tabulated-list-mode with somewhat enlarged
faces from default. I would like to test that enhancement.

(define-derived-mode hyperscope-mode tabulated-list-mode "Hyperscope" "Major Hyperscope mode"
  (hyperscope-text-scale-adjust 'hyperscope-mode)
  (setq tabulated-list-format [("ID" 8 t :right-align t)
                               ("Hyperlink" 70 t)
                               ("Type" 10 t)])
  (setq tabulated-list-padding 1)
  ;; (setq tabulated-list-sort-key (cons "ID" nil))
  (tabulated-list-init-header))

(defun hyperscope-text-scale-adjust (symbol)
  (let ((adjust nil)) ;; TODO customize to turn off or on
    (if (and adjust (eql symbol 'hyperscope-mode))
	(text-scale-adjust 2)
      (if (and adjust (eql symbol 'hyperscope-text-view-mode))
      	  (text-scale-adjust 1)
	(if (and adjust (eql symbol 'hyperscope-org-view-mode))
	    (text-scale-adjust 1))))))





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-13 13:00                                         ` Jean Louis
@ 2020-11-13 14:32                                           ` Stefan Kangas
  2020-11-13 15:33                                             ` Jean Louis
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Kangas @ 2020-11-13 14:32 UTC (permalink / raw)
  To: Jean Louis; +Cc: thomas.hisch, 41852

Jean Louis <bugs@gnu.support> writes:

> I have tried patching the current git but get problems. Please send me
> the full tabulated-list.el that I can try it.
>
> Loading file /home/data1/protected/Programming/Software/emacs/lisp/emacs-lisp/tabulated-list.el failed to provide feature ‘tabulated-list’
> make[1]: *** [Makefile:817: bootstrap-emacs.pdmp] Error 255
> make[1]: Leaving directory '/home/data1/protected/Programming/Software/emacs/src'
> make: *** [Makefile:424: src] Error 2
> [~/Programming/Software/emacs]

I do not understand how my patch could cause this.  Is there no
`provide' statement in your tabulated-list.el?  Are you applying the
patch to an otherwise clean repository?

> For your note I am using tabulated-list-mode with somewhat enlarged
> faces from default. I would like to test that enhancement.

OK.  Note that your mode needs to contain this line for the feature to
work:

    (setq-local text-scale-remap-header-line t)





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-13 14:32                                           ` Stefan Kangas
@ 2020-11-13 15:33                                             ` Jean Louis
  0 siblings, 0 replies; 49+ messages in thread
From: Jean Louis @ 2020-11-13 15:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

I am confident it is not your patch causing it. It must be some of my
mistakes. I will try again.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-12 22:25                                       ` Stefan Kangas
                                                           ` (2 preceding siblings ...)
  2020-11-13 13:00                                         ` Jean Louis
@ 2020-11-13 16:07                                         ` github.com
  2020-11-13 16:49                                           ` Stefan Kangas
  3 siblings, 1 reply; 49+ messages in thread
From: github.com @ 2020-11-13 16:07 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: thomas.hisch, 41852

I wasn't really expecting that text scaling starts working by itself
in tabulated-list-mode. That it does is fine.

I have not changed anything and I could scale. You mentioned that I
would need to make settings, I did not do any.

What I was expecting is that by doing the scaling that alignments
remain in order. But they don't.

OGV video 3.5M is here that shows how alignment of columns goes out of
order in tabulated-list-mode:
https://gnu.support/images/tmp/2020-11-13-18:56:31.ogv

If you cannot see OGV video, maybe you may see screenshots:

Smaller scale, alignment of columns is out of order:
https://gnu.support/images/tmp/Screenshot%20from%202020-11-13%2019-03-59.jpg

Larger scale, alignment out of order:
https://gnu.support/images/tmp/Screenshot%20from%202020-11-13%2019-04-08.jpg

Jean





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-13 16:07                                         ` github.com
@ 2020-11-13 16:49                                           ` Stefan Kangas
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-11-13 16:49 UTC (permalink / raw)
  To: github.com; +Cc: thomas.hisch, 41852

github.com@gnu.support writes:

> I wasn't really expecting that text scaling starts working by itself
> in tabulated-list-mode. That it does is fine.
>
> I have not changed anything and I could scale. You mentioned that I
> would need to make settings, I did not do any.

Sorry, I missed that your mode inherits from tabulated-list-mode, so as
you correctly observed it will work without any modifications.

> What I was expecting is that by doing the scaling that alignments
> remain in order. But they don't.
>
> OGV video 3.5M is here that shows how alignment of columns goes out of
> order in tabulated-list-mode:
> https://gnu.support/images/tmp/2020-11-13-18:56:31.ogv

I think this is Bug#44315.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-13  8:49                                         ` martin rudalics
@ 2020-11-25  2:08                                           ` Stefan Kangas
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-11-25  2:08 UTC (permalink / raw)
  To: martin rudalics; +Cc: thomas.hisch, 41852

martin rudalics <rudalics@gmx.at> writes:

>> +(defvar text-scale-remap-header-line nil
>> +  "If non-nil, also change font size of the header line.")
>
> I'd prefer something like the arguable a bit long
>
> "If non-nil, text scaling may change font size of header lines too."
>
> here.

Thank you, I'll change that before pushing.





^ permalink raw reply	[flat|nested] 49+ messages in thread

* bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
  2020-11-13  7:51                                         ` Eli Zaretskii
@ 2020-11-25  2:08                                           ` Stefan Kangas
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Kangas @ 2020-11-25  2:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: thomas.hisch, 41852

tags 41852 + fixed
close 41852
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> What do you think of the attached patch?
>
> LGTM, but please wait for Martin and others to comment.
>
> Thanks.

Thanks, I have fixed the patch according to Martin's comments.  There
have been no further comments within 11 days, so I've now pushed this to
master as commit 30c437752d.

I'm therefore closing this bug report.





^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2020-11-25  2:08 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <<955fe4fe-a64d-b7c6-fe31-7efd810f97a5@ims.co.at>
     [not found] ` <<83mu553e0x.fsf@gnu.org>
2020-06-14 16:28   ` bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode Drew Adams
2020-06-14 17:23     ` Thomas Hisch
2020-06-14 13:36 Thomas Hisch
2020-06-14 14:42 ` Eli Zaretskii
2020-06-14 16:25   ` Thomas Hisch
2020-10-18 23:34     ` Stefan Kangas
2020-10-19 14:19       ` Eli Zaretskii
2020-10-19 18:21         ` Stefan Kangas
2020-10-19 19:02           ` Eli Zaretskii
2020-10-19 22:41             ` Stefan Kangas
2020-10-20 14:15               ` Eli Zaretskii
2020-10-20 14:40                 ` Stefan Kangas
2020-10-20 14:45                   ` Eli Zaretskii
2020-10-20 19:10                     ` Thomas Hisch
2020-10-29 17:43                       ` Stefan Kangas
2020-10-29 19:37                         ` Thomas Hisch
2020-10-29 21:45                           ` Stefan Kangas
2020-10-30  8:01                             ` Eli Zaretskii
2020-10-29 17:33                     ` Stefan Kangas
2020-10-29 18:02                       ` Drew Adams
2020-10-29 18:15                         ` Stefan Kangas
2020-10-29 18:32                           ` Drew Adams
2020-10-29 18:47                             ` Stefan Kangas
2020-10-30  8:54                       ` martin rudalics
2020-10-30 16:04                         ` Stefan Kangas
2020-10-30 17:37                           ` martin rudalics
2020-10-30 19:01                             ` Eli Zaretskii
2020-10-31  0:31                             ` Stefan Kangas
2020-10-31  8:00                               ` martin rudalics
2020-10-30 18:54                           ` Eli Zaretskii
2020-10-30 20:22                             ` Stefan Kangas
2020-10-30 20:53                               ` Eli Zaretskii
2020-10-31 16:15                                 ` Stefan Kangas
2020-10-31 16:48                                   ` Eli Zaretskii
2020-10-31 16:57                                     ` Eli Zaretskii
2020-10-31 17:55                                     ` Eli Zaretskii
2020-11-12 22:25                                       ` Stefan Kangas
2020-11-13  7:51                                         ` Eli Zaretskii
2020-11-25  2:08                                           ` Stefan Kangas
2020-11-13  8:49                                         ` martin rudalics
2020-11-25  2:08                                           ` Stefan Kangas
2020-11-13 13:00                                         ` Jean Louis
2020-11-13 14:32                                           ` Stefan Kangas
2020-11-13 15:33                                             ` Jean Louis
2020-11-13 16:07                                         ` github.com
2020-11-13 16:49                                           ` Stefan Kangas
2020-10-31 16:50                                   ` Stefan Kangas
2020-10-31  8:29                       ` Eli Zaretskii
2020-10-31 16:25                         ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.