Finally fixed my fonts so that variable-pitch works in org
At least, it works in Org with the ability to change the font sizes, which is important when giving presentations with larger fonts. The real culprit was the mixed-pitch project that didn't allow for changing font sizes (which was easy enough to configure).
This commit is contained in:
parent
1a5e20a359
commit
0599164dec
3 changed files with 51 additions and 40 deletions
|
@ -780,6 +780,8 @@ While the ~C-h~ is easy enough, I am now in the habit of typing ~SPC h~ instead.
|
|||
"h" '(:ignore t :which-key "help")
|
||||
"h e" '("errors" . view-echo-area-messages)
|
||||
"h f" '("function" . describe-function)
|
||||
"h F" '("font" . describe-font)
|
||||
"h =" '("face" . describe-face)
|
||||
"h v" '("variable" . describe-variable)
|
||||
"h k" '("key binding" . describe-key)
|
||||
"h B" '("embark" . embark-bindings)
|
||||
|
@ -1172,9 +1174,7 @@ Let's extend Magit with [[https://github.com/magit/forge][Magit Forge]] for work
|
|||
"g c p" '("Pull request" . forge-create-pullreq)))
|
||||
#+END_SRC
|
||||
|
||||
Every /so often/, pop over to the following URLs and generate a new
|
||||
token where the *Note* is =forge=, and then copy that into the
|
||||
[[file:~/.authinfo.gpg][~/.authinfo.gpg]]:
|
||||
Every /so often/, pop over to the following URLs and generate a new token where the *Note* is =forge=, and then copy that into the [[file:~/.authinfo.gpg][~/.authinfo.gpg]]:
|
||||
|
||||
- [[https://gitlab.com/-/profile/personal_access_tokens][Gitlab]]
|
||||
- [[https://github.com/settings/tokens][Github]]
|
||||
|
@ -1318,16 +1318,14 @@ Let's try [[https://github.com/bastibe/annotate.el][annotate-mode]], which allow
|
|||
#+END_SRC
|
||||
Keep the annotations simple, almost /tag-like/, and then the summary allows you to display them.
|
||||
** Demo It
|
||||
Making demonstrations /within/ Emacs with [[https://github.com/howardabrams/demo-it][demo-it]].
|
||||
Making demonstrations /within/ Emacs with my [[https://github.com/howardabrams/demo-it][demo-it]] project. While it is on MELPA, I want to use my own cloned version to make sure I can keep debugging aspects of it. Especially since its use of [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] has separated.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package demo-it
|
||||
:straight (:type git :protocol ssh :host github :repo "howardabrams/demo-it")
|
||||
:commands (demo-it-create demo-it-start))
|
||||
|
||||
#+END_SRC
|
||||
Perhaps I should change the reference to this for more local development:
|
||||
#+begin_example
|
||||
:straight (:local-repo "~/other/demo-it")
|
||||
#+end_example
|
||||
|
||||
* Technical Artifacts :noexport:
|
||||
Let's provide a name so that the file can be required:
|
||||
|
||||
|
|
|
@ -130,7 +130,6 @@ Most of the time, Emacs is on my desk is a darkened room, so I choose the dark t
|
|||
(interactive)
|
||||
(load-theme 'sanityinc-tomorrow-night t)
|
||||
(set-face-attribute 'region nil :background "#000096")
|
||||
;; font-lock-comment-face #8a8b8a
|
||||
(set-face-attribute 'mode-line nil :background "black")
|
||||
(set-face-attribute 'mode-line-inactive nil :background "#333333"))
|
||||
#+END_SRC
|
||||
|
@ -142,7 +141,6 @@ But, when feeling adventurous, I /sometimes/ take my laptop outside:
|
|||
(interactive)
|
||||
(load-theme 'sanityinc-tomorrow-day t)
|
||||
(set-face-attribute 'region nil :background "orange1")
|
||||
;; font-lock-comment-face #8a8b8a
|
||||
(set-face-attribute 'mode-line nil :background "#cccccc")
|
||||
(set-face-attribute 'mode-line-inactive nil :background "#888888"))
|
||||
#+END_SRC
|
||||
|
@ -248,19 +246,15 @@ I probably don't need to have such a ranking system, as chances are really good
|
|||
"My variable width font available to org-mode files and whatnot.")
|
||||
#+END_SRC
|
||||
|
||||
Simple function that gives me the font information based on the size I need. This calls =set-frame-font=, but also sets the monospaced font for org code blocks.
|
||||
Simple function that gives me the font information based on the size I need. Recently updated after reading [[https://protesilaos.com/codelog/2020-09-05-emacs-note-mixed-font-heights/][this essay]], as I wanted my =fixed-pitch= to scale along with my =variable-pitch= font.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha-set-favorite-font-size (size)
|
||||
"Set the default font size as well as equalize the fixed and variable fonts."
|
||||
(let ((fav-font (format "%s-%d" ha-fixed-font size)))
|
||||
(set-frame-font fav-font nil t)
|
||||
|
||||
;; When using variable-pitch in org, we need to specifically set the
|
||||
;; fixed-pitch as my default fixed-pitched font.
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(variable-pitch ((t (:family ,ha-variable-font :slant normal :weight normal :height 1.3 :width normal))))
|
||||
`(fixed-pitch ((t (:family ,ha-fixed-font :slant normal :weight normal :height 1.0 :width normal)))))))
|
||||
(set-face-attribute 'default nil :font fav-font)
|
||||
(set-face-attribute 'fixed-pitch nil :family ha-fixed-font :inherit 'default :height 1.0)
|
||||
(set-face-attribute 'variable-pitch nil :family ha-variable-font :inherit 'default :height 1.15)))
|
||||
#+END_SRC
|
||||
|
||||
Define /interactive/ functions to quickly adjusting the font size based on my computing scenario:
|
||||
|
@ -269,7 +263,7 @@ Simple function that gives me the font information based on the size I need. Thi
|
|||
(defun ha-mac-monitor-fontsize ()
|
||||
"Quickly set reset my font size when I connect my laptop to a monitor on a Mac."
|
||||
(interactive)
|
||||
(ha-set-favorite-font-size 16))
|
||||
(ha-set-favorite-font-size 17))
|
||||
|
||||
(defun ha-linux-monitor-fontsize ()
|
||||
"Quickly set reset my font size when I connect my laptop to a monitor on Linux."
|
||||
|
|
|
@ -105,17 +105,39 @@ Next, we just need to change the header sizes:
|
|||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(when window-system
|
||||
(set-face-attribute 'org-level-1 nil :height 2.2 :inherit 'default)
|
||||
(set-face-attribute 'org-level-2 nil :height 1.8 :inherit 'default)
|
||||
(set-face-attribute 'org-level-3 nil :height 1.4 :inherit 'default)
|
||||
(set-face-attribute 'org-level-4 nil :height 1.1 :inherit 'default))
|
||||
(set-face-attribute 'org-level-1 nil :height 2.2)
|
||||
(set-face-attribute 'org-level-2 nil :height 1.8)
|
||||
(set-face-attribute 'org-level-3 nil :height 1.4)
|
||||
(set-face-attribute 'org-level-4 nil :height 1.1))
|
||||
#+END_SRC
|
||||
|
||||
While we are at it, let’s make sure the code blocks are using my fixed with font:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package mixed-pitch
|
||||
:init (setq mixed-pitch-set-height t)
|
||||
:hook (org-mode . mixed-pitch-mode))
|
||||
(when window-system
|
||||
(dolist (face '(org-block org-code org-verbatim org-table org-drawer
|
||||
org-special-keyword org-property-value org-document-info-keyword))
|
||||
(set-face-attribute face nil :inherit 'fixed-pitch)))
|
||||
#+END_SRC
|
||||
Not sure why the above code removes the color of =org-verbatim=, so let’s make it stand out slightly:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(set-face-attribute 'org-verbatim nil :foreground "#aaaacc")
|
||||
#+END_SRC
|
||||
And some slight adjustments to the way blocks are displayed:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(set-face-attribute 'org-block-begin-line nil :background "#282828")
|
||||
(set-face-attribute 'org-block nil :height 0.95)
|
||||
(set-face-attribute 'org-block-end-line nil :background "#262626")
|
||||
#+END_SRC
|
||||
And decrease the prominence of the property drawers:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(set-face-attribute 'org-drawer nil :height 0.8 :line-height 0.8)
|
||||
(set-face-attribute 'org-property-value nil :height 0.85)
|
||||
(set-face-attribute 'org-special-keyword nil :height 0.85)
|
||||
#+END_SRC
|
||||
This process allows us to use =variable-pitch= mode for all org documents.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org
|
||||
:hook (org-mode . variable-pitch-mode))
|
||||
#+END_SRC
|
||||
* Superstar
|
||||
Now that headers are noticeable, I have no reason to see a number of asterisks. Once I used the [[https://github.com/sabof/org-bullets][org-bullets]] package, but believe we've replaced it with [[https://github.com/integral-dw/org-superstar-mode][org-superstar-mode]], so the following is an improvement, especially with the sub-bullets:
|
||||
|
@ -148,7 +170,6 @@ If this works, then we get the prettier bulleted list:
|
|||
- Birds
|
||||
|
||||
Oh, and as I indent lists, they should change the /bulleting/ in a particular sequence. If I begin with an =*= asterisk, I walk down the chain, but with the dashed bullets (my default choice), I just stay with dashed bullets. Numeric bullets should cycle:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-list-demote-modify-bullet '(("*" . "+") ("+" . "-") ("-" . "-")
|
||||
("1." . "a.") ("a." . "1.")))
|
||||
|
@ -183,13 +204,11 @@ According to an idea by [[https://jft.home.blog/2019/07/17/use-unicode-symbol-to
|
|||
#+END_SRC
|
||||
|
||||
And now we can attach it to a newly loaded org files:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'org-mode-hook 'ha-org-prettify-checkboxes)
|
||||
#+END_SRC
|
||||
|
||||
To make it more distinguishable, he also changed the colors:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defface org-checkbox-done-text
|
||||
'((t (:foreground "#71696A" :strike-through t)))
|
||||
|
@ -258,7 +277,7 @@ However, I'm just going to have to write a function to clean this.
|
|||
Now that is some complicated regular expressions.
|
||||
* Pasting
|
||||
I like the idea that I will paste HTML text from the clipboard and have it converted to org-formatted text:
|
||||
#+BEGIN_SRC emacs-lisp :results silent
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha-org-paste ()
|
||||
(interactive)
|
||||
(if (eq system-type 'gnu/linux)
|
||||
|
|
Loading…
Reference in a new issue