diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-04-29 12:02:00 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-04-29 13:00:00 +0200 |
commit | 7bc512d546477d8399208fcdf9fa53540fb5cdae (patch) | |
tree | 73962f874f60b11a002e3e1a4b623c7dda83cfa1 /lisp | |
parent | bec7a01c1fe63fdb9ca45602ec71315514b4572d (diff) |
variable pitch for toot compose buffer, but not for docs
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-toot.el | 22 | ||||
-rw-r--r-- | lisp/mastodon.el | 14 |
2 files changed, 33 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index a3f337d..1a2a3cd 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.") @@ -1452,7 +1458,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 @@ -1461,12 +1467,12 @@ 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) "") (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." |