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 #+begin_src emacs-lisp
;; NOTE: init.el is now generated from Emacs.org. Please edit that file ;; NOTE: init.el is now generated from Emacs.org. Please edit that file
;; in Emacs and init.el will be generated automatically! ;; in Emacs and init.el will be generated automatically!
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
;; mac-specific code goes here. ;; mac-specific code goes here.
;; You will most likely need to adjust this font size for your system! ;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 220) (defvar efs/default-font-size 220)
(defvar efs/default-variable-font-size 220) (defvar efs/default-variable-font-size 220)
) )
((eq system-type 'gnu/linux) ((eq system-type 'gnu/linux)
;; Linux-specific code goes here. ;; Linux-specific code goes here.
;; You will most likely need to adjust this font size for your system! ;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120) (defvar efs/default-font-size 120)
(defvar efs/default-variable-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 ;; Make frame transparency overridable
(electric-pair-mode 1) (defvar efs/frame-transparency '(90 . 90))
;; Electric pair mode
(electric-pair-mode 1)
#+end_src #+end_src
@ -151,27 +159,27 @@ We use the [[https://github.com/emacscollective/no-littering/blob/master/no-litt
#+begin_src emacs-lisp #+begin_src emacs-lisp
(cond (cond ((eq system-type 'gnu/linux)
((eq system-type 'gnu/linux) ;; Linux-specific code goes here.
(progn ;; credit: yorickvP on Github
( (setq wl-copy-process nil)
;; credit: yorickvP on Github (defun wl-copy (text)
(setq wl-copy-process nil) (setq wl-copy-process (make-process :name "wl-copy"
(defun wl-copy (text) :buffer nil
(setq wl-copy-process (make-process :name "wl-copy" :command '("wl-copy" "-f" "-n")
:buffer nil :connection-type 'pipe))
:command '("wl-copy" "-f" "-n") (process-send-string wl-copy-process text)
:connection-type 'pipe)) (process-send-eof wl-copy-process))
(process-send-string wl-copy-process text) (defun wl-paste ()
(process-send-eof wl-copy-process)) (if (and wl-copy-process (process-live-p wl-copy-process))
(defun wl-paste () nil ; should return nil if we're the current paste owner
(if (and wl-copy-process (process-live-p wl-copy-process)) (shell-command-to-string "wl-paste -n | tr -d \r")))
nil ; should return nil if we're the current paste owner (setq interprogram-cut-function 'wl-copy)
(shell-command-to-string "wl-paste -n | tr -d \r"))) (setq interprogram-paste-function 'wl-paste)
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
)))) )
)
#+end_src #+end_src
@ -222,54 +230,37 @@ I am using the [[https://github.com/tonsky/FiraCode][Fira Code]] and [[https://f
#+begin_src emacs-lisp #+begin_src emacs-lisp
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
;; mac-specific code goes here. ;; mac-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size) (set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
;; Set the fixed pitch face ;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :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 the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular) (set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
) )
((eq system-type 'gnu/linux) ((eq system-type 'gnu/linux)
;; Linux-specific code goes here. ;; Linux-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size) (set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the fixed pitch face ;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size) (set-face-attribute 'fixed-pitch nil :font "Comic Code Regular" :height efs/default-font-size)
;; Set the variable pitch face ;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Comic Code Regular" :height efs/default-variable-font-size :weight 'regular) (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
;(cond (set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
;((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
;(
;)
;)
;))
#+end_src #+end_src
@ -567,43 +558,48 @@ The =efs/org-font-setup= function configures various text faces to tweak the siz
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun efs/org-font-setup () (defun efs/org-font-setup ()
;; Replace list hyphen with dot ;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode (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 ;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2) (dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1) (org-level-2 . 1.1)
(org-level-3 . 1.05) (org-level-3 . 1.05)
(org-level-4 . 1.0) (org-level-4 . 1.0)
(org-level-5 . 1.1) (org-level-5 . 1.1)
(org-level-6 . 1.1) (org-level-6 . 1.1)
(org-level-7 . 1.1) (org-level-7 . 1.1)
(org-level-8 . 1.1))) (org-level-8 . 1.1)))
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
;; Mac-specific code goes here. ;; Mac-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face)) (set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face))
) )
((eq system-type 'gnu/linux) ((eq system-type 'gnu/linux)
;; Linux-specific code goes here. ;; Linux-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code Regular" :weight 'regular :height (cdr face)) (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 ;; 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-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table 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-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow 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-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim 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-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-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit '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 nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
#+end_src #+end_src
@ -1482,7 +1478,7 @@ Dired is a built-in file manager for Emacs that does some pretty amazing things!
(use-package mu4e (use-package mu4e
:ensure nil :ensure nil
:if (eq system-type 'darwin) ;:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e" :load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup ;:defer 20 ; Wait until 20 seconds after startup
;:defer t ;:defer t

155
init.el
View File

@ -13,7 +13,15 @@
;; You will most likely need to adjust this font size for your system! ;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 120) (defvar efs/default-font-size 120)
(defvar efs/default-variable-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 ;; Make frame transparency overridable
(defvar efs/frame-transparency '(90 . 90)) (defvar efs/frame-transparency '(90 . 90))
@ -95,27 +103,27 @@
(setq auto-save-file-name-transforms (setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
(cond (cond ((eq system-type 'gnu/linux)
((eq system-type 'gnu/linux) ;; Linux-specific code goes here.
(progn ;; credit: yorickvP on Github
( (setq wl-copy-process nil)
;; credit: yorickvP on Github (defun wl-copy (text)
(setq wl-copy-process nil) (setq wl-copy-process (make-process :name "wl-copy"
(defun wl-copy (text) :buffer nil
(setq wl-copy-process (make-process :name "wl-copy" :command '("wl-copy" "-f" "-n")
:buffer nil :connection-type 'pipe))
:command '("wl-copy" "-f" "-n") (process-send-string wl-copy-process text)
:connection-type 'pipe)) (process-send-eof wl-copy-process))
(process-send-string wl-copy-process text) (defun wl-paste ()
(process-send-eof wl-copy-process)) (if (and wl-copy-process (process-live-p wl-copy-process))
(defun wl-paste () nil ; should return nil if we're the current paste owner
(if (and wl-copy-process (process-live-p wl-copy-process)) (shell-command-to-string "wl-paste -n | tr -d \r")))
nil ; should return nil if we're the current paste owner (setq interprogram-cut-function 'wl-copy)
(shell-command-to-string "wl-paste -n | tr -d \r"))) (setq interprogram-paste-function 'wl-paste)
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
)))) )
)
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
;;(setq default-directory "~/.emacs.d") ;;(setq default-directory "~/.emacs.d")
@ -150,52 +158,36 @@
(global-set-key (kbd "C-x l") 'load-file) (global-set-key (kbd "C-x l") 'load-file)
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
;; mac-specific code goes here. ;; mac-specific code goes here.
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size) (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)
;; Set the fixed pitch face ;; 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 the variable pitch face
;(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular) (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.
;((eq system-type 'gnu/linux) (set-face-attribute 'default nil :font "Comic Code Regular" :height efs/default-font-size)
;(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)
)
((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 ;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
@ -374,26 +366,31 @@
(defun efs/org-font-setup () (defun efs/org-font-setup ()
;; Replace list hyphen with dot ;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode (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 ;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2) (dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1) (org-level-2 . 1.1)
(org-level-3 . 1.05) (org-level-3 . 1.05)
(org-level-4 . 1.0) (org-level-4 . 1.0)
(org-level-5 . 1.1) (org-level-5 . 1.1)
(org-level-6 . 1.1) (org-level-6 . 1.1)
(org-level-7 . 1.1) (org-level-7 . 1.1)
(org-level-8 . 1.1))) (org-level-8 . 1.1)))
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
;; Mac-specific code goes here. ;; Mac-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face)) (set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face))
) )
((eq system-type 'gnu/linux) ((eq system-type 'gnu/linux)
;; Linux-specific code goes here. ;; Linux-specific code goes here.
(set-face-attribute (car face) nil :font "Comic Code Regular" :weight 'regular :height (cdr face)) (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 ;; Ensure that anything that should be fixed-pitch in Org files appears that way
@ -882,7 +879,7 @@
(use-package mu4e (use-package mu4e
:ensure nil :ensure nil
:if (eq system-type 'darwin) ;:if (eq system-type 'darwin)
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e" :load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
;:defer 20 ; Wait until 20 seconds after startup ;:defer 20 ; Wait until 20 seconds after startup
;:defer t ;:defer t