diff --git a/early-init.el b/early-init.el index c379934..2569602 100644 --- a/early-init.el +++ b/early-init.el @@ -54,10 +54,10 @@ See `no-littering' for examples.") "My Syncthing directory.") ;; Load system-specific changes. -(progn (require 'system) - (setq system-default-font "DejaVu Sans Mono" - system-variable-pitch-font "DejaVu Sans") - (system-settings-load)) +;; (progn (require 'system) +;; (setq system-default-font "DejaVu Sans Mono" +;; system-variable-pitch-font "DejaVu Sans") +;; (system-settings-load)) ;;; Default frame settings @@ -77,11 +77,11 @@ See `no-littering' for examples.") (+with-ensure-after-init ;; Set default faces (+with-message "Setting default faces" - (let ((font-name system-default-font) - (font-size system-default-height) - (variable-font-name system-variable-pitch-font) - (variable-font-size system-variable-pitch-height)) - (set-face-attribute 'default nil :family system-default-font + (let ((font-name machine-default-font) + (font-size machine-default-height) + (variable-font-name machine-variable-pitch-font) + (variable-font-size machine-variable-pitch-height)) + (set-face-attribute 'default nil :family font-name :height font-size :weight 'book) (set-face-attribute 'italic nil :family font-name :height font-size :slant 'italic) diff --git a/init.el b/init.el index 151bc69..4eb05bd 100644 --- a/init.el +++ b/init.el @@ -258,10 +258,10 @@ #'hl-line-mode) (:+key "C-x C-j" #'dired-jump) (with-eval-after-load 'dired - (pcase system-system - ('windows + (cl-case system-type + ((windows-nt ms-dos) (:straight w32-browser)) - ('linux + (gnu/linux (:straight dired-open) (:option dired-listing-switches (concat dired-listing-switches " -F"))))) @@ -398,12 +398,6 @@ (+kmacro-recording-indicator-mode +1) (+kmacro-block-undo-mode +1))) -(setup magit - ;; This setup is weird because of dependency issues - (:straight (transient :host github :repo "magit/transient" :branch "master") - (magit :host github :repo "magit/magit") - (git-modes :host github :repo "magit/git-modes"))) - (setup minibuffer (:require +minibuffer) (:with-map minibuffer-local-map @@ -1232,6 +1226,10 @@ See also `crux-reopen-as-root-mode'." (:file-match (rx ".rkt" eos) (rx ".scm" eos))) +(setup (:straight (git-modes + :host github :repo "magit/git-modes")) + (:require git-modes)) + ;; (setup (:straight god-mode) ;; (setq god-mode-enable-function-key-translation nil) ;; (:require god-mode @@ -1330,6 +1328,8 @@ See also `crux-reopen-as-root-mode'." (:with-mode emacs-lisp-mode (:bind "C-c e" #'macrostep-expand))) +(setup (:straight (magit :host github :repo "magit/magit"))) + (setup (:straight marginalia) (marginalia-mode +1)) @@ -1723,3 +1723,9 @@ See also `crux-reopen-as-root-mode'." (:require +zzz-to-char) (:option zzz-to-char-reach (+bytes 1 :kib)) (:global "M-z" #'+zzz-to-char)) + +(setup (:straight (machine + :host github :repo "duckwork/machine.el")) + (:option machine-default-font "DejaVu Sans Mono" + machine-variable-pitch-font "DejaVu Sans") + (machine-settings-load)) diff --git a/lisp/system.el b/lisp/system.el index 0c1e457..73cd80b 100644 --- a/lisp/system.el +++ b/lisp/system.el @@ -6,6 +6,12 @@ ;; different definitions. This library is built to assist in working with ;; different system configurations for Emacs. +;;; TODO: + +;; machine.el +;; machine-case to switch on machine +;; + ;;; Code: (require 'cl-lib) @@ -171,5 +177,3 @@ NOMESSAGE is passed directly to `load'." (provide 'system) ;;; system.el ends here - - diff --git a/lisp/titlecase.el b/lisp/titlecase.el deleted file mode 100644 index c79f558..0000000 --- a/lisp/titlecase.el +++ /dev/null @@ -1,197 +0,0 @@ -;;; titlecase.el --- title-case phrases -*- lexical-binding: t; -*- - -;;; Commentary: - -;; adapted from https://hungyi.net/posts/programmers-way-to-title-case/ - -;;; Code: - -(require 'seq) - -(defgroup titlecase nil - "Customizations for titlecasing phrases." - :prefix "titlecase-" - :group 'text) - -;;; Lists of words /never/ to capitalize - -(defvar titlecase-prepositions - '("'thout" "'tween" "aboard" "about" "above" - "abreast" "absent" "abt." "across" "after" "against" "ago" "aloft" "along" - "alongside" "amid" "amidst" "among" "amongst" "anti" "apart" "apropos" - "around" "as" "aside" "aslant" "astride" "at" "atop" "away" "before" - "behind" "below" "beneath" "beside" "besides" "between" "beyond" "but" "by" - "c." "ca." "circa" "come" "concerning" "contra" "counting" "cum" "despite" - "down" "during" "effective" "ere" "except" "excepting" "excluding" "failing" - "following" "for" "from" "hence" "in" "including" "inside" "into" "less" - "like" "mid" "midst" "minus" "mod" "modulo" "near" "nearer" "nearest" - "neath" "next" "notwithstanding" "o'" "o'er" "of" "off" "offshore" "on" - "onto" "ontop" "opposite" "out" "outside" "over" "pace" "past" "pending" - "per" "plus" "post" "pre" "pro" "qua" "re" "regarding" "respecting" "round" - "sans" "save" "saving" "short" "since" "sub" "t'" "than" "through" - "throughout" "thru" "thruout" "till" "times" "to" "toward" "towards" "under" - "underneath" "unlike" "until" "unto" "up" "upon" "v." "versus" "via" - "vis-à-vis" "vs." "w." "w/" "w/i" "w/o" "wanting" "with" "within" - "without") - "List of prepositions in English. -This list is, by necessity, incomplete, even though prepositions -are a closed lexical group in the English language. This list -was pulled and culled from -https://en.wikipedia.org/wiki/List_of_English_prepositions.") - -(defvar titlecase-articles '("a" "an" "the") - "List of articles in English.") - -(defvar titlecase-coordinating-conjunctions '("for" "and" "nor" "but" "or" - "yet" "so") - "List of coordinating conjunctions in English.") - -(defvar titlecase-lowercase-chicago (append titlecase-articles - titlecase-prepositions - titlecase-coordinating-conjunctions) - "Words to lowercase in Chicago Style. -Include: articles, coordinating conjunctions, prepositions, and -\"to\" in an infinitive (though that's caught as a preposition).") - -(defvar titlecase-lowercase-apa (append titlecase-articles - (seq-filter (lambda (p) - (< (length p) 4)) - titlecase-prepositions)) - "Words to lowercase in APA Style.") - -(defvar titlecase-lowercase-mla (append titlecase-articles - titlecase-prepositions - titlecase-coordinating-conjunctions) - "Words to lowercase in MLA Style.") - -(defvar titlecase-lowercase-ap (append titlecase-articles - (seq-filter (lambda (p) - (< (length p) 4)) - titlecase-prepositions) - (seq-filter - (lambda (p) - (< (length p) 4)) - titlecase-coordinating-conjunctions)) - "Words to lowercase in AP Style.") - -(defvar titlecase-lowercase-bluebook (append titlecase-articles - titlecase-coordinating-conjunctions - (seq-filter - (lambda (p) - (< (length p) 4)) - titlecase-prepositions)) - "Words to lowercase in Bluebook Style.") - -(defvar titlecase-lowercase-ama (append titlecase-articles - titlecase-coordinating-conjunctions - (seq-filter (lambda (p) - (< (length p) 4)) - titlecase-prepositions)) - "Words to lowercase in AMA Style.") - -(defvar titlecase-lowercase-nyt (append titlecase-articles - titlecase-prepositions - titlecase-coordinating-conjunctions) - "Words to lowercase in New York Times Style.") - -(defvar titlecase-lowercase-wikipedia - (append titlecase-articles - (seq-filter (lambda (p) (< (length p) 5)) titlecase-prepositions) - titlecase-coordinating-conjunctions) - "Words to lowercase in Wikipedia Style.") - -(defcustom titlecase-style 'chicago - "Which style to use when titlecasing." - :type '(choice (const :tag "Chicago Style" chicago) - (const :tag "APA Style" apa) - (const :tag "MLA Style" mla) - (const :tag "AP Style" ap) - (const :tag "Bluebook Style" bluebook) - (const :tag "AMA Style" ama) - (const :tag "New York Times Style" nyt) - (const :tag "Wikipedia Style" wikipedia))) - -(defun titlecase--normalize (begin end) - "Normalize region from BEGIN to END." - (goto-char begin) - (unless (re-search-forward "[a-z]" end :noerror) - (downcase-region begin end))) - -(defun titlecase--capitalize-first-word (begin end) - "Capitalize the first word of region from BEGIN to END." - (goto-char begin) - (capitalize-word 1)) - -(defun titlecase--capitalize-last-word (begin end) - "Capitalize the last word of region from BEGIN to END." - (goto-char end) - (backward-word 1) - (when (and (>= (point) begin)) - (capitalize-word 1))) - - - - -(defun titlecase-region-with-style (begin end style) - "Titlecase the region of English text from BEGIN to END, using STYLE." - (interactive "*r") - (save-excursion - (goto-char begin) - ;; If the region is in ALL-CAPS, normalize it first - (unless (re-search-forward "[a-z]" end :noerror) - (downcase-region begin end)) - (goto-char begin) ; gotta go back to the beginning - (let (;; Constants during this function's runtime - (case-fold-search nil) - (downcase-word-list (symbol-value - (intern (format "titlecase-lowercase-%s" - style)))) - ;; State variables - (this-word (current-word)) - (force-capitalize t)) - ;; And loop over the rest - (while (< (point) end) - (setq this-word (current-word)) - (cond - ;; Skip ALL-CAPS words - ((string-match "^[A-Z]+$" this-word) (forward-word 1)) - ;; Force capitalization if `force-capitalize' is t - (force-capitalize (progn (capitalize-word 1) - (setq force-capitalize nil))) - ;; Special rules for different styles - ((and (memq style '(ap)) - (> (length this-word) 3)) - (capitalize-word 1)) - ;; Downcase words that should be - ((member (downcase this-word) downcase-word-list) - (downcase-word 1)) - ;; Otherwise, capitalize the word - (t (capitalize-word 1))) - ;; If the word ends with a :, ., ?, newline, or carriage-return, force - ;; the next word to be capitalized. - (when (looking-at "[:.?;\n\r]") - (setq force-capitalize t)) - (skip-syntax-forward "^w" end)) - ;; Capitalize the last word, only in some styles - (when (memq style '(chicago ap bluebook ama nyt wikipedia)) - (backward-word 1) - (when (and (>= (point) begin)) - (capitalize-word 1)))))) - -;;;###autoload -(defun titlecase-region (begin end) - "Titlecase the region of English text from BEGIN to END. -Uses the style provided in `titlecase-style'." - (interactive "*r") - (titlecase-region-with-style begin end titlecase-style)) - -;;;###autoload -(defun titlecase-dwim () - "Titlecase either the region, if active, or the current line." - (interactive) - (if (region-active-p) - (titlecase-region (region-beginning) (region-end)) - (titlecase-region (point-at-bol) (point-at-eol)))) - -(provide 'titlecase) -;;; titlecase.el ends here diff --git a/systems/bob.el b/machines/bob.el similarity index 59% rename from systems/bob.el rename to machines/bob.el index 427f38a..e9b444c 100644 --- a/systems/bob.el +++ b/machines/bob.el @@ -4,7 +4,7 @@ ;;; Code: -(setq system-default-font "DejaVu Sans Mono" - system-default-height 105) +(setq machine-default-font "DejaVu Sans Mono" + machine-default-height 105) ;;; bob.el ends here diff --git a/systems/gnu-linux.el b/machines/gnu-linux.el similarity index 66% rename from systems/gnu-linux.el rename to machines/gnu-linux.el index 333f15a..309ca34 100644 --- a/systems/gnu-linux.el +++ b/machines/gnu-linux.el @@ -1,5 +1,5 @@ ;;; linux.el -*- lexical-binding: t; -*- -(setq system-default-height 105) +(setq machine-default-height 105) ;;; linux.el ends here diff --git a/systems/windows-nt.el b/machines/windows-nt.el similarity index 80% rename from systems/windows-nt.el rename to machines/windows-nt.el index 3a0deee..a95754e 100644 --- a/systems/windows-nt.el +++ b/machines/windows-nt.el @@ -7,10 +7,10 @@ ;; Fonts -(setq system-default-font "Cascadia Mono" - system-default-height 90 - system-variable-pitch-font "Carlito" - system-variable-pitch-height 1.2) +(setq machine-default-font "Cascadia Mono" + machine-default-height 90 + machine-variable-pitch-font "Carlito" + machine-variable-pitch-height 1.2) ;; Add C:\Program Files\* and C:\Program Files (x86)\* to exec-path (dolist (path (append (file-expand-wildcards "C:/Program Files/*")