[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/emoji 010f384 3/3: Allow binding use-variable-pitch
From: |
Lars Ingebrigtsen |
Subject: |
scratch/emoji 010f384 3/3: Allow binding use-variable-pitch |
Date: |
Tue, 26 Oct 2021 17:12:54 -0400 (EDT) |
branch: scratch/emoji
commit 010f384082fb573f9295f9469acfbd6f934df1cb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow binding use-variable-pitch
---
lisp/play/emoji.el | 4 ++--
lisp/transient.el | 13 +++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index 1a5cf05..3f99675 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -132,7 +132,6 @@ when the command was issued."
nil end-func))))))
(defun emoji--init ()
- (setq transient-use-variable-pitch t)
;; Remove debugging.
(unless (and nil emoji--labels)
(setq emoji--derived (make-hash-table :test #'equal))
@@ -339,7 +338,8 @@ when the command was issued."
(setf (symbol-function name)
(lambda ()
(interactive)
- (transient-setup name)))
+ (let ((transient-use-variable-pitch t))
+ (transient-setup name))))
(pcase-let ((`(,class ,slots ,suffixes ,docstr ,_body)
(transient--expand-define-args (list args))))
(put name 'interactive-only t)
diff --git a/lisp/transient.el b/lisp/transient.el
index 8385751..f850472 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -316,7 +316,8 @@ be remapped to `fixed-pitch' in that buffer."
:type 'boolean)
(defcustom transient-use-variable-pitch nil
- "Whether to use alignment suitable for variable-pitch data."
+ "Whether to use alignment suitable for variable-pitch data.
+Bind around the call to `transient-setup' or set."
:package-version '(transient . "0.3.6")
:group 'transient
:type 'boolean)
@@ -1321,6 +1322,9 @@ Usually it remains selected while the transient is
active.")
"The buffer that was current before the transient was invoked.
Usually it remains current while the transient is active.")
+(defvar transient--use-variable-pitch nil
+ "Whether to use variable pitch or not.")
+
(defvar transient--debug nil "Whether put debug information into *Messages*.")
(defvar transient--history nil)
@@ -1703,6 +1707,7 @@ EDIT may be non-nil."
(setq transient--redisplay-map (transient--make-redisplay-map))
(setq transient--original-window (selected-window))
(setq transient--original-buffer (current-buffer))
+ (setq transient--use-variable-pitch transient-use-variable-pitch)
(transient--redisplay)
(transient--init-transient)
(transient--suspend-which-key-mode)))
@@ -2975,13 +2980,13 @@ have a history of their own.")
(rs (apply #'max (mapcar #'length columns)))
(cs (length columns))
(cw (mapcar (lambda (col)
- (apply #'max (mapcar (if transient-use-variable-pitch
+ (apply #'max (mapcar (if transient--use-variable-pitch
#'transient--pixel-width
#'length)
col)))
columns))
(cc (transient--seq-reductions-from
- (apply-partially #'+ (if transient-use-variable-pitch 30 3))
+ (apply-partially #'+ (if transient--use-variable-pitch 30 3))
cw 0)))
(if transient-force-single-column
(dotimes (c cs)
@@ -2993,7 +2998,7 @@ have a history of their own.")
(insert ?\n)))
(dotimes (r rs)
(dotimes (c cs)
- (if transient-use-variable-pitch
+ (if transient--use-variable-pitch
(progn
(when-let ((cell (nth r (nth c columns))))
(insert cell))