Solved configs by OS

This commit is contained in:
Eduardo Cueto-Mendoza 2024-04-16 22:36:50 +01:00
parent bf77adab8b
commit 3d0458ca6d
2 changed files with 193 additions and 137 deletions

243
Emacs.org
View File

@ -3,6 +3,7 @@
* Welcome!
The following variables are used to tweak some of the configuration pieces for use in the live streams so you might need to adjust them for your local machine if you try to use this configuration directly.
#+begin_src emacs-lisp
@ -10,25 +11,25 @@ The following variables are used to tweak some of the configuration pieces for u
;; NOTE: init.el is now generated from Emacs.org. Please edit that file
;; in Emacs and init.el will be generated automatically!
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120)
(defvar efs/default-variable-font-size 120)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
(cond ((eq system-type 'darwin)
;; mac-specific code goes here.
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 220)
(defvar efs/default-variable-font-size 220)
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120)
(defvar efs/default-variable-font-size 120)
))
;; Electric pair mode
(electric-pair-mode 1)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
#+end_src
* Getting environment
#+begin_src emacs-lisp
;(defvar current-os '(shell-command-to-string "uname -s"))
(defvar current-os '(shell-command "uname -s"))
;; Electric pair mode
(electric-pair-mode 1)
#+end_src
@ -221,37 +222,53 @@ I am using the [[https://github.com/tonsky/FiraCode][Fira Code]] and [[https://f
#+begin_src emacs-lisp
;(cond
;((eq system-type 'windows-nt)
;(progn
; (message "Microsoft Windows")))
;((eq system-type 'darwin)
;(progn
;(
;(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
(cond ((eq system-type 'darwin)
;; mac-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
;; Set the fixed pitch face
;(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
;; Set the variable pitch face
;(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
;)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular)
))
;(cond
;((eq system-type 'windows-nt)
;(progn
; (message "Microsoft Windows")))
;((eq system-type 'darwin)
;(progn
;(
;(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
;; Set the fixed pitch face
;(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
;; Set the variable pitch face
;(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
;)
;)
;)
;)
;((eq system-type 'gnu/linux)
;(progn
;(
(set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;((eq system-type 'gnu/linux)
;(progn
;(
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular)
;)
;)
;))
;)
;)
;))
#+end_src
@ -550,36 +567,43 @@ The =efs/org-font-setup= function configures various text faces to tweak the siz
#+begin_src emacs-lisp
(defun efs/org-font-setup ()
;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
(defun efs/org-font-setup ()
;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
;(set-face-attribute (car face) nil :font "BigBlueTermPlus Nerd Font" :weight 'regular :height (cdr face)))
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face)))
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
(cond ((eq system-type 'darwin)
;; Mac-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face))
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code Regular" :weight 'regular :height (cdr face))
))
)
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
#+end_src
@ -1456,51 +1480,52 @@ Dired is a built-in file manager for Emacs that does some pretty amazing things!
#+begin_src emacs-lisp
(use-package mu4e
:ensure nil
;:load-path ""
;:defer 20 ; Wait until 20 seconds after startup
;:defer t
:config
;; Make sure that moving a message (like to Trash) causes the
;; message to get a new file name. This helps to avoid the
;; dreaded "UID is N beyond highest assigned" error.
;; See this link for more info: https://stackoverflow.com/a/43461973
(setq mu4e-change-filenames-when-moving t)
(use-package mu4e
:ensure nil
:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup
;:defer t
:config
;; Make sure that moving a message (like to Trash) causes the
;; message to get a new file name. This helps to avoid the
;; dreaded "UID is N beyond highest assigned" error.
;; See this link for more info: https://stackoverflow.com/a/43461973
(setq mu4e-change-filenames-when-moving t)
;; Load org-mode integration
;(require 'org-mu4e)
;; Load org-mode integration
;(require 'org-mu4e)
;; Refresh mail using isync every 10 minutes
(setq mu4e-update-interval (* 10 60))
(setq mu4e-get-mail-command "mbsync -a")
(setq mu4e-maildir "~/Mail")
;; Refresh mail using isync every 10 minutes
(setq mu4e-update-interval (* 10 60))
(setq mu4e-get-mail-command "mbsync -a")
(setq mu4e-maildir "~/Mail")
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-sent-folder "/Sent")
(setq mu4e-refile-folder "/Archive")
(setq mu4e-trash-folder "/Trash")
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-sent-folder "/Sent")
(setq mu4e-refile-folder "/Archive")
(setq mu4e-trash-folder "/Trash")
(setq mu4e-maildir-shortcuts
'(("/Inbox" . ?i)
("/Sent" . ?s)
("/Trash" . ?t)
("/Drafts" . ?d)
("/Spam" . ?z)
("/Archive" . ?a)
))
(setq mu4e-maildir-shortcuts
'(("/Inbox" . ?i)
("/Sent" . ?s)
("/Trash" . ?t)
("/Drafts" . ?d)
("/Spam" . ?z)
("/Archive" . ?a)
))
;(dw/leader-key-def
; "m" '(:ignore t :which-key "mail")
; "mm" 'mu4e
; "mc" 'mu4e-compose-new
; "mi" 'dw/go-to-inbox
; "ms" 'mu4e-update-mail-and-index)
;(dw/leader-key-def
; "m" '(:ignore t :which-key "mail")
; "mm" 'mu4e
; "mc" 'mu4e-compose-new
; "mi" 'dw/go-to-inbox
; "ms" 'mu4e-update-mail-and-index)
;; Start mu4e in the background so that it syncs mail periodically
(mu4e t)
)
;; Start mu4e in the background so that it syncs mail periodically
(mu4e t)
)
#+end_src

87
init.el
View File

@ -1,18 +1,25 @@
;; NOTE: init.el is now generated from Emacs.org. Please edit that file
;; in Emacs and init.el will be generated automatically!
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120)
(defvar efs/default-variable-font-size 120)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
(cond ((eq system-type 'darwin)
;; mac-specific code goes here.
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 220)
(defvar efs/default-variable-font-size 220)
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120)
(defvar efs/default-variable-font-size 120)
))
;; Electric pair mode
(electric-pair-mode 1)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
;(defvar current-os '(shell-command-to-string "uname -s"))
(defvar current-os '(shell-command "uname -s"))
;; Electric pair mode
(electric-pair-mode 1)
;; The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
@ -142,6 +149,29 @@
(global-set-key (kbd "C-x l") 'load-file)
(cond ((eq system-type 'darwin)
;; mac-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular)
))
;(cond
;((eq system-type 'windows-nt)
;(progn
@ -162,13 +192,6 @@
;((eq system-type 'gnu/linux)
;(progn
;(
(set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular)
;)
;)
@ -351,20 +374,27 @@
(defun efs/org-font-setup ()
;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
;(set-face-attribute (car face) nil :font "BigBlueTermPlus Nerd Font" :weight 'regular :height (cdr face)))
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face)))
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
(cond ((eq system-type 'darwin)
;; Mac-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face))
)
((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code Regular" :weight 'regular :height (cdr face))
))
)
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
@ -852,7 +882,8 @@
(use-package mu4e
:ensure nil
;:load-path ""
:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup
;:defer t
:config