More clear font allocation
With no more DRY errors. Also, let's just jump into full screen again.
This commit is contained in:
		
							parent
							
								
									682d7e1bc8
								
							
						
					
					
						commit
						50f74914ff
					
				
					 2 changed files with 63 additions and 49 deletions
				
			
		| 
						 | 
					@ -430,6 +430,22 @@ While I’m pretty good with the VIM keybindings, I would like to play around wi
 | 
				
			||||||
     - ~i`~ :: inner back quoted string
 | 
					     - ~i`~ :: inner back quoted string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*Note:* The ~x~ in the above examples are ~d~ for delete, ~v~ for select, ~y~ for copying and ~c~ for changing.
 | 
					*Note:* The ~x~ in the above examples are ~d~ for delete, ~v~ for select, ~y~ for copying and ~c~ for changing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					What text objects are known?
 | 
				
			||||||
 | 
					  - ~w~ :: word
 | 
				
			||||||
 | 
					  - ~s~ :: sentence
 | 
				
			||||||
 | 
					  - ~p~ :: paragraph
 | 
				
			||||||
 | 
					  - ~o~ :: symbol, like a variable
 | 
				
			||||||
 | 
					  - ~’~ :: a string, surround by quotes, also ~`~ for backticks
 | 
				
			||||||
 | 
					  - ~)~ :: parenthesis, also ~}~ and ~]~, see ~g~
 | 
				
			||||||
 | 
					  - ~g~ :: within a brace, paren, etc. See below
 | 
				
			||||||
 | 
					  - ~i~ :: indention area, for YAML and Python
 | 
				
			||||||
 | 
					  - ~t~ :: an HTML tag
 | 
				
			||||||
 | 
					  - ~c~ :: for comments
 | 
				
			||||||
 | 
					  - ~u~ :: for URLs
 | 
				
			||||||
 | 
					  - ~a~ :: function arguments (probably a lot like symbol, ~o~) with the [[https://github.com/wcsmith/evil-args][evil-args]] extension (that I’m not bothering with)
 | 
				
			||||||
 | 
					**** Evil Args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*** Better Parenthesis with Text Object
 | 
					*** Better Parenthesis with Text Object
 | 
				
			||||||
I took the following clever idea and code from [[http://blog.binchen.org/posts/code-faster-by-extending-emacs-evil-text-object/][this essay]] from Chen Bin for creating a ~xig~ to grab code within any grouping characters, like parens, braces and brackets. For instance, ~dig~ cuts the content inside brackets, etc. First, we need a function to do the work (I changed the original from =my-= to =ha-= so that it is easier for me to distinguish functions from my configuration):
 | 
					I took the following clever idea and code from [[http://blog.binchen.org/posts/code-faster-by-extending-emacs-evil-text-object/][this essay]] from Chen Bin for creating a ~xig~ to grab code within any grouping characters, like parens, braces and brackets. For instance, ~dig~ cuts the content inside brackets, etc. First, we need a function to do the work (I changed the original from =my-= to =ha-= so that it is easier for me to distinguish functions from my configuration):
 | 
				
			||||||
#+begin_src emacs-lisp
 | 
					#+begin_src emacs-lisp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,8 @@ I would appreciate seeing if my Emacs installation has the features that I expec
 | 
				
			||||||
           (jit-icon  (all-the-icons-faicon "cog"))
 | 
					           (jit-icon  (all-the-icons-faicon "cog"))
 | 
				
			||||||
           (results (s-join " "
 | 
					           (results (s-join " "
 | 
				
			||||||
                            (list (when (and (fboundp 'native-comp-available-p)
 | 
					                            (list (when (and (fboundp 'native-comp-available-p)
 | 
				
			||||||
                               (native-comp-available-p)) (if iconic jit-icon "Native-Compilation"))
 | 
					                                             (native-comp-available-p))
 | 
				
			||||||
 | 
					                                                                        (if iconic jit-icon "Native-Compilation"))
 | 
				
			||||||
                                  (when (image-type-available-p 'svg)   (if iconic svg-icon "SVG"))
 | 
					                                  (when (image-type-available-p 'svg)   (if iconic svg-icon "SVG"))
 | 
				
			||||||
                                  (when (image-type-available-p 'png)   (if iconic png-icon "PNG"))
 | 
					                                  (when (image-type-available-p 'png)   (if iconic png-icon "PNG"))
 | 
				
			||||||
                                  (when (gnutls-available-p)            (if iconic tls-icon "TLS"))
 | 
					                                  (when (gnutls-available-p)            (if iconic tls-icon "TLS"))
 | 
				
			||||||
| 
						 | 
					@ -191,17 +192,16 @@ And of course, the default is /inside/ where it is dark and safe:
 | 
				
			||||||
(laptop-inside)
 | 
					(laptop-inside)
 | 
				
			||||||
#+end_src
 | 
					#+end_src
 | 
				
			||||||
* Full Size Frame
 | 
					* Full Size Frame
 | 
				
			||||||
 | 
					 | 
				
			||||||
Taken from [[https://emacsredux.com/blog/2020/12/04/maximize-the-emacs-frame-on-startup/][this essay]], I figured I would start the initial frame automatically in fullscreen, but not any subsequent frames (as this could be part of the capturing system).
 | 
					Taken from [[https://emacsredux.com/blog/2020/12/04/maximize-the-emacs-frame-on-startup/][this essay]], I figured I would start the initial frame automatically in fullscreen, but not any subsequent frames (as this could be part of the capturing system).
 | 
				
			||||||
 | 
					#+begin_src emacs-lisp
 | 
				
			||||||
#+begin_src emacs-lisp :tangle no
 | 
					  (add-to-list 'initial-frame-alist '(fullscreen . maximized))
 | 
				
			||||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
 | 
					 | 
				
			||||||
#+end_src
 | 
					#+end_src
 | 
				
			||||||
 | 
					 | 
				
			||||||
* Font Configuration
 | 
					* Font Configuration
 | 
				
			||||||
Am I ever really ever satisfied with any font? I regularly change my font based on the monospace du jour... [[http://blogs.adobe.com/typblography/2012/09/source-code-pro.html][Source Code Pro]] is attractive, and has been a staple on every programmers' screen. However, we all want ligatures, [[https://github.com/i-tu/Hasklig][Hasklig]] is a nice font that is thinner and easier to read than [[https://github.com/tonsky/FiraCode][Fira]], but [[https://typeof.net/Iosevka/][Iosevka]] seems to have it all. Oh, Microsoft just gave us [[https://docs.microsoft.com/en-us/windows/terminal/cascadia-code][Cascadia]] and that seems shiny. However, the [[https://github.com/ryanoasis/nerd-fonts][Nerd Font project]] adds the ligatures as well as all the other niceties to a font.
 | 
					Am I ever really ever satisfied with any font? I regularly change my font based on the monospace du jour... [[http://blogs.adobe.com/typblography/2012/09/source-code-pro.html][Source Code Pro]] is attractive, and has been a staple on every programmers' screen. However, we all want ligatures, [[https://github.com/i-tu/Hasklig][Hasklig]] is a nice font that is thinner and easier to read than [[https://github.com/tonsky/FiraCode][Fira]], but [[https://typeof.net/Iosevka/][Iosevka]] seems to have it all. Oh, Microsoft just gave us [[https://docs.microsoft.com/en-us/windows/terminal/cascadia-code][Cascadia]] and that seems shiny. However, the [[https://github.com/ryanoasis/nerd-fonts][Nerd Font project]] adds the ligatures as well as all the other niceties to a font.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Choosing a Font
 | 
					** Choosing a Font
 | 
				
			||||||
I stole the following idea from [[https://protesilaos.com/dotemacs/#h:9035a1ed-e988-4731-89a5-0d9e302c3dea][Protesilaos Stavrou's dotfile configuration]], and the following should minimally be /readable/:
 | 
					I stole the following idea from [[https://protesilaos.com/dotemacs/#h:9035a1ed-e988-4731-89a5-0d9e302c3dea][Protesilaos Stavrou's dotfile configuration]], and the following should minimally be /readable/:
 | 
				
			||||||
 | 
					#+begin_example
 | 
				
			||||||
  | Similarities | Regular                    |
 | 
					  | Similarities | Regular                    |
 | 
				
			||||||
  |--------------+----------------------------|
 | 
					  |--------------+----------------------------|
 | 
				
			||||||
  | ()[]{}<>«»‹› | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
 | 
					  | ()[]{}<>«»‹› | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
 | 
				
			||||||
| 
						 | 
					@ -214,15 +214,16 @@ I stole the following idea from [[https://protesilaos.com/dotemacs/#h:9035a1ed-e
 | 
				
			||||||
  | 9gqpG6       | αβγδεζηθικλμνξοπρστυφχψω   |
 | 
					  | 9gqpG6       | αβγδεζηθικλμνξοπρστυφχψω   |
 | 
				
			||||||
  | hnmMN        |                            |
 | 
					  | hnmMN        |                            |
 | 
				
			||||||
  | uvvwWuuwvy   |                            |
 | 
					  | uvvwWuuwvy   |                            |
 | 
				
			||||||
  | x×X          |  #include <stdio.h> // <= quickly.                              |
 | 
					  | x×X          |                            |
 | 
				
			||||||
  | .,·°%        |  int main(int argc, char **argv) {                             |
 | 
					  | .,·°%        |                            |
 | 
				
			||||||
  | ¡!¿?         |    long il1[]={1-2/3.4,5+6==7/8};                              |
 | 
					  | ¡!¿?         |                            |
 | 
				
			||||||
  | :;           |    int OxFaced=0xBAD||"[{(CQUINE";                             |
 | 
					  | :;           |                            |
 | 
				
			||||||
  | `''"‘’“”     |    unsigned O0,l1,Z2,S5,G6,B8__XY;                              |
 | 
					  | `''"‘’“”     |                            |
 | 
				
			||||||
  | —-~≈=≠+*_    |    printf("@$Hamburgefo%c`",'\n');                             |
 | 
					  | —-~≈=≠+*_    |                            |
 | 
				
			||||||
  | …⋯           |    return ~7&8^9?0:l1|!"j->k+=*w";                              |
 | 
					  | …⋯           |                            |
 | 
				
			||||||
  | ...          |                            |
 | 
					  | ...          |                            |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#+end_example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following is from [[https://source-foundry.github.io/Hack/font-specimen.html][Hack's website]]:
 | 
					The following is from [[https://source-foundry.github.io/Hack/font-specimen.html][Hack's website]]:
 | 
				
			||||||
#+begin_src c
 | 
					#+begin_src c
 | 
				
			||||||
| 
						 | 
					@ -243,41 +244,38 @@ brew tap homebrew/cask-fonts
 | 
				
			||||||
brew install --cask font-hack-nerd-font
 | 
					brew install --cask font-hack-nerd-font
 | 
				
			||||||
#+end_src
 | 
					#+end_src
 | 
				
			||||||
** Specifying a Font
 | 
					** Specifying a Font
 | 
				
			||||||
My /current/ favorite font is actually the top list of fonts that may be installed on my system (they usually are):
 | 
					My /current/ favorite font is actually the top list of fonts that may be installed on my system:
 | 
				
			||||||
#+begin_src emacs-lisp
 | 
					#+begin_src emacs-lisp
 | 
				
			||||||
  (defvar ha-fixed-font
 | 
					  (defvar ha-fixed-font
 | 
				
			||||||
    (when window-system
 | 
					    (when window-system
 | 
				
			||||||
      (cond
 | 
					      (or
 | 
				
			||||||
       ((x-list-fonts "Hack Nerd Font") "Hack Nerd Font")
 | 
					       (seq-first
 | 
				
			||||||
       ((x-list-fonts "Cousine Nerd Font") "Cousine Nerd Font")
 | 
					        (seq-filter (lambda (font) (when (x-list-fonts font) font))
 | 
				
			||||||
       ((x-list-fonts "Iosevka Nerd Font") "Iosevka Nerd Font")
 | 
					                    '("Hack Nerd Font"
 | 
				
			||||||
       ((x-list-fonts "Iosevka")           "Iosevka")
 | 
					                      "Cousine Nerd Font"
 | 
				
			||||||
       ((x-list-fonts "FantasqueSansMono Nerd Font") "FantasqueSansMono Nerd Font")
 | 
					                      "Iosevka Nerd Font"
 | 
				
			||||||
       ((x-list-fonts "Monoid Nerd Font")  "Monoid Nerd Font")
 | 
					                      "Iosevka"
 | 
				
			||||||
       ((x-list-fonts "Hasklig")           "Hasklig")
 | 
					                      "FantasqueSansMono Nerd Font"
 | 
				
			||||||
       ((x-list-fonts "Cascadia Code PL")  "Cascadia Code PL")
 | 
					                      "Monoid Nerd Font"
 | 
				
			||||||
       ((x-list-fonts "Source Code Pro")   "Source Code Pro")
 | 
					                      "Hasklig"
 | 
				
			||||||
       ((x-list-fonts "Anonymous Pro")     "Anonymous Pro")
 | 
					                      "Cascadia Code PL"
 | 
				
			||||||
       (t "monospaced")))
 | 
					                      "Source Code Pro")))
 | 
				
			||||||
    "My fixed width font based on what is installed, `nil' if not defined.")
 | 
					       "monospaced"))
 | 
				
			||||||
 | 
					    "My fixed width font based on what I have installed.")
 | 
				
			||||||
#+end_src
 | 
					#+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Force something as well:
 | 
					I probably don't need to have such a ranking system, as chances are good I have them all installed.
 | 
				
			||||||
#+begin_src emacs-lisp :tangle no
 | 
					 | 
				
			||||||
(setq ha-fixed-font "Hack Nerd Font")
 | 
					 | 
				
			||||||
#+end_src
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
I probably don't need to have such a ranking system, as chances are really good that I'll have all of them installed. Still.
 | 
					 | 
				
			||||||
#+begin_src emacs-lisp
 | 
					#+begin_src emacs-lisp
 | 
				
			||||||
(defvar ha-variable-font
 | 
					  (defvar ha-variable-font
 | 
				
			||||||
    (when window-system
 | 
					    (when window-system
 | 
				
			||||||
    (cond ((x-list-fonts "Overpass")        "Overpass")
 | 
					      (or
 | 
				
			||||||
          ((x-list-fonts "Source Sans Pro") "Source Sans Pro")
 | 
					       (seq-first
 | 
				
			||||||
          ((x-list-fonts "Lucida Grande")   "Lucida Grande")
 | 
					        (seq-filter (lambda (font) (when (x-list-fonts font) font))
 | 
				
			||||||
          ((x-list-fonts "Verdana")         "Verdana")
 | 
					                    '(;  Interesting idea: "Iosevka Comfy Motion Duo"
 | 
				
			||||||
          ((x-family-fonts "Sans Serif")    "Sans Serif")
 | 
					                      "Overpass" "Source Sans Pro"
 | 
				
			||||||
          (nil (warn "Cannot find a Sans Serif Font.  Install Source Sans Pro."))))
 | 
					                      "Lucida Grande" "Verdana"
 | 
				
			||||||
  "My variable width font available to org-mode files and whatnot.")
 | 
					                      "Sans Serif")))
 | 
				
			||||||
 | 
					       (warn "Cannot find a Sans Serif Font.  Install Source Sans Pro."))))
 | 
				
			||||||
#+end_src
 | 
					#+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.
 | 
					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.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue