aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-30 12:19:31 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-30 12:19:31 +0200
commit58a5b6444c9f5d0f0b07e37a08e869cb74bef684 (patch)
treec8269634e5da26f51ba60ed4d15f4c8a434086e1
parentd4470b348e3ba0ea5df98457548a39219065997b (diff)
parent7c0bab3efe68aab790820fd7bb3914f8efc4913b (diff)
Merge branch 'var-pitch-compose' into develop
-rw-r--r--lisp/mastodon-toot.el22
-rw-r--r--lisp/mastodon.el14
2 files changed, 33 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 474337b..269a9b4 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -147,6 +147,12 @@ If the original toot visibility is different we use the more restricted one."
"Whether to enable your instance's custom emoji by default."
:type 'boolean)
+(defcustom mastodon-toot--enable-proportional-fonts-compose-buffer nil
+ "Nonnil to enable using proportional fonts in the compose buffer.
+By default fixed width fonts are used."
+ :type '(boolean :tag "Enable using proportional rather than fixed \
+width fonts"))
+
(defvar-local mastodon-toot--content-warning nil
"A flag whether the toot should be marked with a content warning.")
@@ -1450,7 +1456,7 @@ REPLY-TEXT is the text of the toot being replied to."
(propertize "None "
'toot-attachments t)
"\n")
- 'face font-lock-comment-face
+ 'face 'mastodon-toot-docs-face
'read-only "Edit your message below."
'toot-post-header t)
(if reply-text
@@ -1460,13 +1466,13 @@ REPLY-TEXT is the text of the toot being replied to."
mastodon-toot-orig-in-reply-length)
'read-only "Edit your message below."
'toot-post-header t
- 'face '(variable-pitch :foreground "#7c6f64"))
+ 'face 'mastodon-toot-docs-reply-text-face)
"\n")
"")
(propertize
(concat divider "\n")
'rear-nonsticky t
- 'face font-lock-comment-face
+ 'face 'mastodon-toot-docs-face
'read-only "Edit your message below."
'toot-post-header t))))
@@ -1680,6 +1686,8 @@ EDIT means we are editing an existing toot, not composing a new one."
(point-marker))))
(switch-to-buffer-other-window buffer)
(text-mode)
+ (when mastodon-toot--enable-proportional-fonts-compose-buffer
+ (variable-pitch-mode))
(mastodon-toot-mode t)
(setq mastodon-toot--visibility
(or (plist-get mastodon-profile-account-settings 'privacy)
@@ -1738,6 +1746,14 @@ EDIT means we are editing an existing toot, not composing a new one."
(lambda ()
(auto-fill-mode -1)))
+;; scale fixed-pitch docs relative to any possible variable pitch scaling set:
+(add-hook 'mastodon-toot-mode-hook
+ (lambda ()
+ (when mastodon-toot--enable-proportional-fonts-compose-buffer
+ (let ((height (/ 1 (face-attribute 'variable-pitch :height))))
+ (set-face-attribute 'mastodon-toot-docs-face nil
+ :height height)))))
+
(define-minor-mode mastodon-toot-mode
"Minor mode to capture Mastodon toots."
:keymap mastodon-toot-mode-map
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 980e31f..c29fd25 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -241,6 +241,20 @@ Use. e.g. \"%c\" for your locale's date and time format."
'((t :inherit success))
"Face used for content warning.")
+(defface mastodon-toot-docs-face
+ `((t :inherit font-lock-comment-face
+ :height 1.0
+ :family ,(face-attribute 'default :family)))
+ "Face used for documentation in toot compose buffer.
+If `mastodon-tl--enable-proportional-fonts' is changed,
+mastodon.el needs to be re-loaded for this to be correctly set.")
+
+(defface mastodon-toot-docs-reply-text-face
+ `((t :inherit font-lock-comment-face
+ :family ,(face-attribute 'variable-pitch :family)))
+ "Face used for reply text in toot compose buffer.
+See `mastodon-toot-display-orig-in-reply-buffer'.")
+
;;;###autoload
(defun mastodon ()
"Connect Mastodon client to `mastodon-instance-url' instance."