minor fixes

This commit is contained in:
Ian Griffin 2024-06-09 13:20:55 +08:00
parent b3cf8eeaac
commit bffcee2c6c
7 changed files with 114 additions and 72 deletions

View File

@ -27,7 +27,7 @@ This file stores variables containing personal information, and is not distribut
A sample of this file though is included in this config to be used A sample of this file though is included in this config to be used
#+begin_src emacs-lisp #+begin_src emacs-lisp
(let ((personal-file-path (expand-file-name "personal.org" user-emacs-config-directory)) (let ((personal-file-path (expand-file-name "personal.org" user-emacs-config-directory))
(sample-personal-file-path (expand-file-name "/personal-sample.org" user-emacs-config-directory ))) (sample-personal-file-path (expand-file-name "personal-sample.org" user-emacs-config-directory )))
;; load main personal file if it exists ;; load main personal file if it exists
(if (file-exists-p personal-file-path) (if (file-exists-p personal-file-path)

View File

@ -19,21 +19,21 @@ Set different types of fonts for differents elements of Org-mode files, like var
(defun org-config-font-setup () (defun org-config-font-setup ()
"set org mode element fonts" "set org mode element fonts"
(custom-set-faces (custom-set-faces
'(org-block ((t (:inherit fixed-pitch :height 0.91)))) '(org-block ((t (:inherit fixed-pitch))))
;; '(org-block-begin-line ((t (:inherit fixed-pitch)))) ;; '(org-block-begin-line ((t (:inherit fixed-pitch))))
;; '(org-block-end-line ((t (:inherit fixed-pitch)))) ;; '(org-block-end-line ((t (:inherit fixed-pitch))))
'(org-checkbox ((t (:inherit fixed-pitch :height 0.91)))) '(org-checkbox ((t (:inherit fixed-pitch))))
'(org-code ((t (:inherit (shadow fixed-pitch) :height 0.91)))) '(org-code ((t (:inherit (shadow fixed-pitch)))))
'(org-document-info ((t (:foreground "dark orange")))) '(org-document-info ((t (:foreground "dark orange"))))
'(org-document-info-keyword ((t (:inherit (shadow fixed-pitch) :height 0.91)))) '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch) ))))
'(org-indent ((t (:inherit (org-hide fixed-pitch) :height 0.91)))) '(org-indent ((t (:inherit (org-hide fixed-pitch) ))))
'(org-link ((t (:foreground "royal blue" :underline t)))) '(org-link ((t (:foreground "royal blue" :underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.91)))) '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) ))))
'(org-property-value ((t (:inherit fixed-pitch :height 0.91))) t) '(org-property-value ((t (:inherit fixed-pitch ))) t)
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.91)))) '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) ))))
'(org-table ((t (:inherit fixed-pitch :foreground "#83a598" :height 0.91)))) '(org-table ((t (:inherit fixed-pitch :foreground "#83a598" ))))
'(org-tag ((t (:inherit (shadow fixed-pitch) :height 0.91 :weight bold :height 0.8)))) '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
'(org-verbatim ((t (:inherit (shadow fixed-pitch) :height 0.91)))))) '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))))
#+end_src #+end_src
** Header Font Setup ** Header Font Setup
@ -63,7 +63,7 @@ Make header and document title fonts bigger for better visibility.
:custom :custom
(org-hide-emphasis-markers nil) (org-hide-emphasis-markers nil)
(org-agenda-files (org-agenda-files
`(,(expand-file-name "shared/org" (safe-getenv "HOME" user-home-path)))) `(,(expand-file-name "docs/notes" (safe-getenv "HOME" user-home-path))))
:config :config
;; font setup ;; font setup

View File

@ -1,21 +1,19 @@
#+TITLE: Font Configuration #+TITLE: Font Configuration
This config uses Mozilla's Fira Set of fonts and the related Fira Code fonts with added Nerd fonts.
So for this to run, Fira Sans and FiraCode Nerd Font needs to be installed in the system.
* Configuration * Configuration
** default fonts ** default fonts
#+begin_src emacs-lisp #+begin_src emacs-lisp
(custom-set-faces (custom-set-faces
;; set default font ;; set default font
'(default ((t (:inherit nil :extend nil :stipple nil '(default ((t (:inherit nil :extend nil :stipple nil
:inverse-video nil :box nil :inverse-video nil :box nil
:strike-through nil :overline nil :underline nil :strike-through nil :overline nil :underline nil
:slant normal :weight normal :slant normal :weight normal
:height 100 :width normal :height 100 :width normal
:foundry "CTDB" :family "FiraCode Nerd Font Mono")))) :foundry "CTDB" :family "IBM Plex Mono"))))
'(fixed-pitch ((t (:family "FiraCode Nerd Font Mono")))) '(fixed-pitch ((t (:family "IBM Plex Mono"))))
'(fixed-pitch-serif ((t (:family "FiraCode Nerd Font Mono")))) '(fixed-pitch-serif ((t (:family "IBM Plex Mono"))))
'(variable-pitch ((t (:inherit default :height 1.2 :weight medium :family "Cantarell"))))) '(variable-pitch ((t (:inherit default :weight regular :family "IBM Plex Sans")))))
#+end_src #+end_src
** Chinese Font ** Chinese Font

View File

@ -52,7 +52,7 @@ run the function at startup of a frame
#+end_src #+end_src
* Cursor Shape * Cursor Shape
The most visible type of cursor shape The most visible type of cursor shape
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq-default cursor-type 'box) (setq-default cursor-type 'box)
@ -118,39 +118,37 @@ sets the tab size 5 spaces
* Ligatures * Ligatures
#+begin_src emacs-lisp #+begin_src emacs-lisp
(when (> emacs-major-version 28) ;; (when (> emacs-major-version 28)
(use-package ligature ;; (use-package ligature
:config ;; :config
;; Enable the "www" ligature in every possible major mode ;; ;; Enable the "www" ligature in every possible major mode
(ligature-set-ligatures 't '("www")) ;; (ligature-set-ligatures 't '("www"))
;; Enable traditional ligature support in eww-mode, if the ;; ;; Enable traditional ligature support in eww-mode, if the
;; `variable-pitch' face supports it ;; ;; `variable-pitch' face supports it
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi")) ;; (ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
;; Enable all Cascadia Code ligatures in programming modes ;; ;; Enable all ligatures in programming modes
(ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>" ;; (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!==" ;; ":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<" ;; "!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->" ;; "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<" ;; "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~=" ;; "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" ;; "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" ;; "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:" ;; ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!" ;; "<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:" ;; "##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" ;; "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
"\\\\" "://")) ;; "\\\\" "://"))
;; Enables ligature checks globally in all buffers. You can also do it ;; ;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'. ;; ;; per mode with `ligature-mode'.
(global-ligature-mode t))) ;; (global-ligature-mode t)))
#+end_src #+end_src
* Theme * Theme
Load theme (that is built-in) Load theme (that is built-in)
#+begin_src emacs-lisp #+begin_src emacs-lisp
(load-theme 'modus-vivendi t) (load-theme 'modus-operandi t)
;; (use-package solarized-theme ;; (use-package solarized-theme
;; :config ;; :config
;; (load-theme 'solarized-selenized-black)) ;; (load-theme 'solarized-selenized-black))

View File

@ -13,13 +13,13 @@ Tree sitter highlighting in emacs.[[https://tree-sitter.github.io/tree-sitter/sy
Tree-sitter Syntax Highlighting website]] Tree-sitter Syntax Highlighting website]]
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package tree-sitter-langs)
(use-package tree-sitter (use-package tree-sitter
:after tree-sitter-langs
:diminish :diminish
:config :config
(global-tree-sitter-mode)) (global-tree-sitter-mode)
:hook (prog-mode . tree-sitter-hl-mode))
(use-package tree-sitter-langs
:after tree-sitter)
#+end_src #+end_src
* Imenu-list * Imenu-list

View File

@ -16,7 +16,7 @@
* Built-in Modes * Built-in Modes
** hook default settings to configured language modes ** hook default settings to configured language modes
#+begin_src emacs-lisp #+begin_src emacs-lisp
(let ((langs '("sh" "c++" "mhtml" "java" "js" "json" "python" "latex"))) (let ((langs '("sh" "c++" "mhtml" "java" "js" "json" "python" "latex" "typescript-ts" "tsx-ts")))
(dolist (lang langs) (dolist (lang langs)
(add-hook (intern (concat lang "-mode-hook")) (lambda () (lang-default-settings))))) (add-hook (intern (concat lang "-mode-hook")) (lambda () (lang-default-settings)))))
#+end_src #+end_src
@ -46,17 +46,40 @@
#+end_src #+end_src
** TypeScript ** TypeScript
No longer using typescript-mode, as there's a builtin typescript-ts mode in Emacs 29
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package typescript-mode (if (version< emacs-version "29")
:mode "\\.ts\\'" (use-package typescript-ts
:init :mode (("\\.ts\\'" . typescript-ts-mode)
(add-to-list 'eglot-server-programs `(typescript-mode . ("typescript-language-server"))) ("\\.tsx\\'" . tsx-ts-mode))
:hook :hook (lang-default-settings
(typescript-mode . (lambda () (lang-default-settings)))) (tsx-ts-mode . lang-default-settings))
:config
(let ((server-programs '(("typescript-ts-mode" . ("typescript-language-server" "--stdio"))
("tsx-ts-mode" . ("typescript-language-server""--stdio")))))
(setq eglot-server-programs (append server-programs eglot-server-programs))))
(use-package typescript-mode
:mode ("\\.ts\\'" ("\\.tsx" . typescript-tsx-mode))
:config
(define-derived-mode typescript-tsx-mode typescript-mode "TypeScriptReact")
(dolist (mode '(typescript-mode typescript-tsx-mode))
(add-to-list 'eglot-server-programs `(,mode . ("typescript-language-server", "--stdio"))))
:hook
(typescript-mode . (lambda () (lang-default-settings)
(let ((custom-tab-size 2))
(setq-default default-tab-width custom-tab-sizen
tab-width custom-tab-size
c-basic-offset custom-tab-size))))
(typescript-tsx-mode . (lambda ()
(lang-default-settings)
(let ((custom-tab-size 4))
(setq-default default-tab-width custom-tab-size
tab-width custom-tab-size
c-basic-offset custom-tab-size))))))
#+end_src #+end_src
** Markdown ** Markdown
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package markdown-mode (use-package markdown-mode
:commands (markdown-mode gfm-mode) :commands (markdown-mode gfm-mode)
@ -76,7 +99,6 @@
** Python ** Python
*** Pyenv *** Pyenv
python venv manager python venv manager
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package pyvenv (use-package pyvenv
:commands (pyvenv-mode pyvenv-activate pyvenv-workon pyvenv-exec-shell pyvenv-virtual-env) :commands (pyvenv-mode pyvenv-activate pyvenv-workon pyvenv-exec-shell pyvenv-virtual-env)

View File

@ -5,7 +5,7 @@
* Ido * Ido
Ido is a autocomplete package for emacs' commands Ido is a autocomplete package for emacs' commands
n
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package ido (use-package ido
:config :config
@ -60,11 +60,28 @@ do presentations in Org mode
#+end_src #+end_src
* Emacs Shell * Emacs Shell
This sets the prompt to a lambda, for aesthetic reasons
** History
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq eshell-prompt-function (lambda nil (add-hook 'eshell-expand-input-functions 'eshell-expand-history-references)
(if (= (user-uid) 0) " #λ " " λ "))) #+end_src
** Prompt
This sets the prompt to a lambda, for aesthetic reasons
#+begin_src emacs-lisp
(setq eshell-prompt-function
(lambda nil
(concat
(propertize (concat
"\n# "
(user-login-name)
"@"
(car (split-string system-name "\\."))
":"
(file-name-nondirectory (eshell/pwd))
(if (= (user-uid) 0) " #λ" " λ"))
'face `(:inherit 'eshell-prompt :weight bold))
(propertize " " 'face `(:inherit default)))))
(setq eshell-highlight-prompt nil) (setq eshell-highlight-prompt nil)
#+end_src #+end_src
@ -85,6 +102,13 @@ a visualizer for Emacs' cool but confusing undo/history system
; (use-package pass) ; (use-package pass)
#+end_src #+end_src
* Nov.el
Mode to read epub files
#+begin_src emacs-lisp
(use-package nov
:mode ("\\.epub\\'" . nov-mode))
#+end_src
* Elgrep * Elgrep
a built in grep command in emacs a built in grep command in emacs