all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Thomas Hisch <thomas.hisch@ims.co.at>
Cc: 41852@debbugs.gnu.org
Subject: bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode
Date: Sun, 18 Oct 2020 16:34:23 -0700	[thread overview]
Message-ID: <CADwFkmkU0JNoqp9sgLTL6qvZSzvoteLcF9RW=yqSyrk4yjWUVw@mail.gmail.com> (raw)
In-Reply-To: <953c6df9-59b4-8b57-0be3-600d147fe9c7@ims.co.at> (Thomas Hisch's message of "Sun, 14 Jun 2020 18:25:26 +0200")

[-- 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 ()

  reply	other threads:[~2020-10-18 23:34 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 13:36 bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode Thomas Hisch
2020-06-14 14:42 ` Eli Zaretskii
2020-06-14 16:25   ` Thomas Hisch
2020-10-18 23:34     ` Stefan Kangas [this message]
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
     [not found] <<955fe4fe-a64d-b7c6-fe31-7efd810f97a5@ims.co.at>
     [not found] ` <<83mu553e0x.fsf@gnu.org>
2020-06-14 16:28   ` Drew Adams
2020-06-14 17:23     ` Thomas Hisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmkU0JNoqp9sgLTL6qvZSzvoteLcF9RW=yqSyrk4yjWUVw@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=41852@debbugs.gnu.org \
    --cc=thomas.hisch@ims.co.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this 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.