Solved multi-OS

This commit is contained in:
Eduardo Cueto-Mendoza 2024-04-17 14:04:38 +01:00
parent 3d0458ca6d
commit 6022f05549
2 changed files with 188 additions and 195 deletions

228
Emacs.org
View File

@ -8,28 +8,36 @@ The following variables are used to tweak some of the configuration pieces for u
#+begin_src emacs-lisp
;; NOTE: init.el is now generated from Emacs.org. Please edit that file
;; in Emacs and init.el will be generated automatically!
;; NOTE: init.el is now generated from Emacs.org. Please edit that file
;; in Emacs and init.el will be generated automatically!
(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)
))
(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)
)
((eq system-type 'berkeley-unix)
;; BSD-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)
)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
)
;; Electric pair mode
(electric-pair-mode 1)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
;; Electric pair mode
(electric-pair-mode 1)
#+end_src
@ -151,27 +159,27 @@ We use the [[https://github.com/emacscollective/no-littering/blob/master/no-litt
#+begin_src emacs-lisp
(cond
((eq system-type 'gnu/linux)
(progn
(
;; credit: yorickvP on Github
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
(cond ((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
;; credit: yorickvP on Github
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
))))
)
)
#+end_src
@ -222,54 +230,37 @@ I am using the [[https://github.com/tonsky/FiraCode][Fira Code]] and [[https://f
#+begin_src emacs-lisp
(cond ((eq system-type 'darwin)
;; mac-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code" :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 "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 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 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)
))
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular)
)
((eq system-type 'berkeley-unix)
;; BSD-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)
;(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 the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
)
)
#+end_src
@ -567,43 +558,48 @@ 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)))
(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))
))
)
;; 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))
)
((eq system-type 'berkeley-unix)
;; BSD-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :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
@ -1482,7 +1478,7 @@ Dired is a built-in file manager for Emacs that does some pretty amazing things!
(use-package mu4e
:ensure nil
:if (eq system-type 'darwin)
;:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup
;:defer t

155
init.el
View File

@ -13,7 +13,15 @@
;; 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)
))
)
((eq system-type 'berkeley-unix)
;; BSD-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)
)
)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90))
@ -95,27 +103,27 @@
(setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
(cond
((eq system-type 'gnu/linux)
(progn
(
;; credit: yorickvP on Github
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
(cond ((eq system-type 'gnu/linux)
;; Linux-specific code goes here.
;; credit: yorickvP on Github
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
))))
)
)
(setq inhibit-startup-message t)
;;(setq default-directory "~/.emacs.d")
@ -150,52 +158,36 @@
(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
; (message "Microsoft Windows")))
;((eq system-type 'darwin)
;(progn
;(
;(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
;; 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-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)
;)
;)
;)
;((eq system-type 'gnu/linux)
;(progn
;(
(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)
)
((eq system-type 'berkeley-unix)
;; BSD-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)
)
)
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
@ -374,26 +366,31 @@
(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)))
(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))
))
;; 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))
)
((eq system-type 'berkeley-unix)
;; BSD-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face))
)
)
)
;; Ensure that anything that should be fixed-pitch in Org files appears that way
@ -882,7 +879,7 @@
(use-package mu4e
:ensure nil
:if (eq system-type 'darwin)
;:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup
;:defer t