]> git.earman.xyz Git - emacsinit.git/commitdiff
Better auto-pretty-print
authorrearman <rearman@r717.net>
Tue, 16 Jul 2024 19:34:48 +0000 (15:34 -0400)
committerrearman <rearman@r717.net>
Tue, 16 Jul 2024 19:34:48 +0000 (15:34 -0400)
13 files changed:
early-init.el
init.el
re/re-c-style.el
re/re-editing-defuns.el
re/re-electronics-defuns.el
re/re-math-defuns.el
re/re-org-defuns.el
re/re-org.el
re/re-os-specific.el
re/re-packages.el
re/re-plc-defuns.el
re/re-refrigeration-defuns.el
re/re-repl-defuns.el

index d39496c82af3bbbf07b6c21afa43f5d1273bd1de..437a43ac947f7a2bec04f16fa0afd4bedc373a0a 100644 (file)
@@ -8,10 +8,8 @@
       gc-cons-percentage 0.6)
 
 (add-hook 'after-init-hook
-          (lambda
-            ()
-            (setq gc-cons-threshold
-                  (* 1800 1000)
+          (lambda ()
+            (setq gc-cons-threshold (* 1800 1000)
                   gc-cons-percentage 0.1
                   garbage-collection-messages t)))
 
diff --git a/init.el b/init.el
index c52421a70e8cafbc76cf589e248b1d9e14500d48..4a72cb3eef24e8ef9d33a952456e83d6958735e3 100644 (file)
--- a/init.el
+++ b/init.el
@@ -5,11 +5,10 @@
 ;;; Code:
 
 ;; Load Outside Hoards
-(add-to-list 'load-path
-             (concat user-emacs-directory "re/"))
+(add-to-list 'load-path (concat user-emacs-directory "re/"))
 ;; (add-to-list 'load-path (concat user-emacs-directory "acme-mouse/"))
-(add-to-list 'load-path
-             (concat user-emacs-directory "sedit-mouse/"))
+(add-to-list 'load-path (concat user-emacs-directory "sedit-mouse/"))
+
 (require 're-editing-defuns)
 (require 're-packages)
 (require 'sedit-mouse)
@@ -18,8 +17,7 @@
 
 ;; Loaded Later
 (add-hook 'after-init-hook
-          (lambda
-            ()
+          (lambda ()
             ;;(require 'acme-mouse)
             (require 're-logic-defuns)
             (require 're-repl-defuns)
             (require 're-org)
             (require 're-org-defuns)))
 
-(add-hook 'c-mode-hook
-          (lambda
-            ()
-            (require 're-c-style)))
+(add-hook 'c-mode-hook (lambda () (require 're-c-style)))
 
 ;; Damper bespokeniƋs
 (setq-default indicate-empty-lines t
@@ -54,7 +49,6 @@
       confirm-kill-processes nil
       mouse-1-click-follows-link nil)
 
-
 ;; Damper wayfindiƋ
 (windmove-default-keybindings 'control)
 (setq windmove-wrap-around t
       dired-hide-details-hide-symlink-targets nil)
 
 (add-hook 'dired-mode-hook
-          (lambda
-            ()
+          (lambda ()
             (dired-hide-details-mode t)
-            (keymap-set dired-mode-map
-                        "RET" #'dired-find-alternate-file)))
+            (keymap-set dired-mode-map "RET" #'dired-find-alternate-file)))
 
 ;; Bookmarks
 (setq bookmark-save-flag 1)
 ;; Bespoken framework
 (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
 
-(unless
-    (file-exists-p custom-file)
-  (make-empty-file custom-file))
+(unless (file-exists-p custom-file) (make-empty-file custom-file))
 
 (load custom-file)
 
index 75581b040eafd8393d003ad38d9fea0d8eb79a12..d8c7733b9138095fa611b01f41e9402fc3ba05a9 100644 (file)
@@ -1,46 +1,28 @@
 ;;; re-c-style.el --- My C style -*- lexical-binding: t; -*-
-;; This file is not part of emacs
+;; This file is not part of GNU Emacs
 ;; Fix emacs' refusal to use tabs in c files
 
 ;;; Code:
 
 (defun re/c-lineup-arglist-tabs-only (ignored)
   "Line up argument lists by tabs, not spaces. Stolen from https://kernel.org/doc/html/v4.10/process/coding-style.html"
-  (let*
-      ((anchor
-        (c-langelem-pos c-syntactic-element))
-       (column
-        (c-langelem-2nd-pos c-syntactic-element))
-       (offset
-        (-
-         (1+ column)
-         anchor))
-       (steps
-        (floor offset c-basic-offset)))
-    (*
-     (max steps 1)
-     c-basic-offset)))
+  (let* ((anchor (c-langelem-pos c-syntactic-element))
+         (column (c-langelem-2nd-pos c-syntactic-element))
+         (offset (- (1+ column) anchor))
+         (steps (floor offset c-basic-offset)))
+    (* (max steps 1) c-basic-offset)))
 
 (add-hook 'c-mode-common-hook
-          (lambda
-            ()
-            ;; Add kernel style
-            (c-add-style
-             "linux-tabs-only"
-             '("linux"
-               (c-offsets-alist
-                (arglist-cont-nonempty
-                 c-lineup-gcc-asm-reg
-                 re/c-lineup-arglist-tabs-only))))))
+          (lambda ()
+            (c-add-style "linux-tabs-only"
+                         '("linux" (c-offsets-alist (arglist-cont-nonempty c-lineup-gcc-asm-reg re/c-lineup-arglist-tabs-only))))))
 
 (add-hook 'c-mode-hook
-          (lambda
-            ()
+          (lambda ()
             (setq indent-tabs-mode t)
             (setq show-trailing-whitespace t)
             (setq c-backspace-function 'backward-delete-char)
-            ;; don't expand my tabs, just delete them.
             (c-set-style "linux-tabs-only")))
 
 (provide 're-c-style)
-;;; hic terminatur re-c-style.el
+;;; re-c-style.el ends here
index 75d480330a8c539067986067afc969e7cbf64e68..df745523e7ea72b9916e4aa55a6fea8d9ccfc06b 100644 (file)
@@ -3,24 +3,15 @@
 
 ;;; Code:
 
-(defun re/rename-current-buffer-file ()
+(defun re/rename-current-buffer-file nil
   "Renames the current buffer and the file it is visiting."
   (interactive)
-  (let
-      ((name
-        (buffer-name))
-       (filename
-        (buffer-file-name)))
-    (if
-        (not
-         (and filename
-              (file-exists-p filename)))
+  (let ((name (buffer-name))
+        (filename (buffer-file-name)))
+    (if (not (and filename (file-exists-p filename)))
         (error "Buffer '%s' is not visiting a file!" name)
-      (let
-          ((new-name
-            (read-file-name "New name: " filename)))
-        (if
-            (get-buffer new-name)
+      (let ((new-name (read-file-name "New name: " filename)))
+        (if (get-buffer new-name)
             (error "A buffer named '%s' already exists!" new-name)
           (rename-file filename new-name 1)
           (rename-buffer new-name)
@@ -41,8 +32,7 @@
   (interactive "*p")
   (end-of-line)
   (open-line n)
-  (call-interactively
-   (next-line))
+  (call-interactively (next-line))
   (indent-for-tab-command))
 
 (defun re/open-line-above (n)
   "Change all groups of blank lines to 1 blank line."
   (interactive)
   (save-excursion (mark-whole-buffer)
-                  (replace-regexp "^\n+" "\n" nil (region-beginning) (region-end))))
+                  (replace-regexp "^\n+"
+                                  "\n"
+                                  nil
+                                  (region-beginning)
+                                  (region-end))))
 
 (defun re/comment-dwim ()
   "Comment region if active, otherwise comment line.
 Stolen from https://depp.brause.cc/dotemacs"
   (interactive)
-  (if
-      (use-region-p)
-      (comment-or-uncomment-region
-       (region-beginning)
-       (region-end))
-    (comment-or-uncomment-region
-     (line-beginning-position)
-     (line-end-position))))
+  (if (use-region-p)
+      (comment-or-uncomment-region (region-beginning) (region-end))
+    (comment-or-uncomment-region (line-beginning-position)
+                                 (line-end-position))))
 
 (defun re/kill-bword-or-region ()
   "Kill region if active, otherwise kill back one word."
   (interactive)
-  (if
-      (use-region-p)
+  (if (use-region-p)
       (call-interactively 'kill-region)
     (call-interactively 'backward-kill-word)))
 
@@ -85,44 +74,27 @@ If point was already at that position, call `back-to-indentation'.
 Called a third time, move point to `beginning-of-line'.
 If in org-mode, call `org-beginning-of-line' first."
   (interactive "^")
-  (let
-      ((oldpos
-        (point)))
-    (if
-        (equal major-mode 'org-mode)
+  (let ((oldpos (point)))
+    (if (equal major-mode 'org-mode)
         (org-beginning-of-line)
       (progn
         (beginning-of-visual-line 1)
-        (skip-syntax-forward " "
-                             (line-end-position))
+        (skip-syntax-forward " " (line-end-position))
         (backward-prefix-chars)))
-    (and
-     (= oldpos
-        (point))
-     (let
-         ((newpos
-           (point)))
-       (back-to-indentation)
-       (and
-        (= newpos
-           (point))
-        (beginning-of-line))))))
+    (and (= oldpos (point))
+         (let ((newpos (point)))
+           (back-to-indentation)
+           (and (= newpos (point)) (beginning-of-line))))))
 
 (defun re/smart-end-of-line ()
   "Move point to the end of the visual line. If point was already at that position, call `move-end-of-line'.
 If in org-mode, call `org-end-of-line' first."
   (interactive "^")
-  (let
-      ((oldpos
-        (point)))
-    (if
-        (equal major-mode 'org-mode)
+  (let ((oldpos (point)))
+    (if (equal major-mode 'org-mode)
         (org-end-of-line)
       (end-of-visual-line 1))
-    (and
-     (= oldpos
-        (point))
-     (move-end-of-line nil))))
+    (and (= oldpos (point)) (move-end-of-line nil))))
 
 (defun re/goto-line ()
   "Show line numbers before going to line, then hide them again."
@@ -133,32 +105,23 @@ If in org-mode, call `org-end-of-line' first."
 
 (defun re/other-window-or-split-window (&optional window)
   (interactive)
-  (if
-      (=
-       (count-windows)
-       1)
+  (if (= (count-windows) 1)
       (funcall split-window-preferred-function window)
     (other-window 1)))
 
 (defun re/isearch-forward-use-region ()
   (interactive)
-  (when
-      (use-region-p)
+  (when (use-region-p)
     (add-to-history 'search-ring
-                    (buffer-substring
-                     (region-beginning)
-                     (region-end)))
+                    (buffer-substring (region-beginning) (region-end)))
     (deactivate-mark))
   (call-interactively 'isearch-forward))
 
 (defun re/isearch-backward-use-region ()
   (interactive)
-  (when
-      (use-region-p)
+  (when (use-region-p)
     (add-to-history 'search-ring
-                    (buffer-substring
-                     (region-beginning)
-                     (region-end)))
+                    (buffer-substring (region-beginning) (region-end)))
     (deactivate-mark))
   (call-interactively 'isearch-backward))
 
index a93d1824fff18e645cf975f421fc4391f2135445..f3abfa6b950d6b88cfac7f552349e4445693034d 100644 (file)
 For use in `amps->volts' and related.  The handling of only one
 resistance given is done here, instead of doing it in every
 function that uses this."
-  (if
-      (eq nil r2)
+  (if (eq nil r2)
       r1
-    (inv
-     (+
-      (inv r1)
-      (inv r2)))))
+    (inv (+ (inv r1) (inv r2)))))
 
 (defun amps->volts (amps r1 &optional r2)
   "Calculate the voltage, given amperage and impedance.
 Multiplies the amperage by the effective impedance calculated
 with `eff-imp'."
-  (* amps
-     (eff-imp r1 r2)))
+  (* amps (eff-imp r1 r2)))
 
 (defun volts->amps (volts r1 &optional r2)
   "Calculate the amperage, given voltage and impedance.
 Divides the voltage by the effective impedance calculated with
 `eff-imp'."
-  (/ volts
-     (eff-imp r1 r2)))
+  (/ volts (eff-imp r1 r2)))
 
 (provide 're-electronics-defuns)
 ;;; re-electronics-defuns.el ends here
index b3b63c1f6c433c6322d6132477304acb04b4f79e..ee7130f0136d32a49729c6e8488ca7d5f38765a4 100644 (file)
@@ -21,8 +21,7 @@
 (defmacro E (number exponent)
   "Prefix Engineering notation.
 i.e. (E 5 3) == 5E3 == 5000"
-  `(* ,number
-      (^ 10 ,exponent)))
+  `(* ,number (^ 10 ,exponent)))
 
 (provide 're-math-defuns)
 ;;; re-math-defuns.el ends here
index 4adb874682516699b287a7388bfb53f2a70b17fd..6c32cd2b9f068ec6e9fa8ed793f9b544392520d4 100644 (file)
 (defun re/tangle-init ()
   "Tangle and compile config.org.
 Stolen from https://github.com/larstvei/dot-emacs."
-  (when
-      (equal
-       (buffer-file-name)
-       (expand-file-name
-        (concat user-emacs-directory "config.org")))
-    (let
-        ((prog-mode-hook nil))
+  (when (equal (buffer-file-name)
+               (expand-file-name (concat user-emacs-directory "config.org")))
+    (let ((prog-mode-hook
+           nil))
       (org-babel-tangle))))
 
 (provide 're-org-defuns)
index b6ca01e0a397c4287e7e8f5d2476a22dc76a0d27..efccaf6ff8a486724a12ac5b712896c4f2f6ebee 100644 (file)
@@ -3,8 +3,7 @@
 
 ;;; Code:
 
-(setq org-startup-folded t
-      org-startup-indented t)
+(setq org-startup-indented t)
 
 (setq org-M-RET-may-split-line nil
       org-return-follows-link t
       org-default-notes-file "~/org/refile.org"
       org-journal-file "~/org/journal.org")
 
-(setq org-refile-targets '((nil :maxlevel . 9)
-                           (org-agenda-files :maxlevel . 9))
+(setq org-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9))
       org-refile-use-outline-path 'file
       org-refile-allow-creating-parent-nodes 'confirm)
 
-(setq org-todo-keywords
-      '((sequence "TODO(t)"
-                  "WAITING(w@/!)"
-                  "IN-PROGRESS(i!)"
-                  "APPT(a!)"
-                  "|"
-                  "DELEGATED(l@)"
-                  "DONE(d!/@)"
-                  "CANCELLED(c@)")))
-
-(setq org-tag-alist
-      '((:startgroup . nil)
-        ("need" . ?n)
-        ("standard" . ?s)
-        ("wisdom" . ?w)
-        (:endgroup . nil)))
+(setq org-todo-keywords '((sequence "TODO(t)"
+                                    "WAITING(w@/!)"
+                                    "IN-PROGRESS(i!)"
+                                    "APPT(a!)"
+                                    "|"
+                                    "DELEGATED(l@)"
+                                    "DONE(d!/@)"
+                                    "CANCELLED(c@)")))
+
+(setq org-tag-alist '((:startgroup . nil)
+                      ("need" . ?n)
+                      ("standard" . ?s)
+                      ("wisdom" . ?w)
+                      (:endgroup . nil)))
 
 (setq org-agenda-restore-windows-after-quit t
       org-agenda-start-on-weekday 0
@@ -70,8 +66,7 @@
 
 (setq org-agenda-custom-commands
       '((" " "Agenda"
-         (                             ;(agenda "" nil)
-          (tags "need"
+         ((tags "need"
                 ((org-agenda-overriding-header "Needed Items")))
           (tags-todo "-REFILE+TODO=\"IN-PROGRESS\""
                      ((org-agenda-overriding-header "In Progress")))
       org-clock-report-include-clocking-task t
       org-pretty-entities t)
 
-(setq org-capture-templates
-      '(("n" "Note" entry
-         (file org-default-notes-file)
-         "* %?"
-         :clock-in t
-         :clock-resume t)
-        ("t" "TODO" entry
-         (file org-default-notes-file)
-         "* TODO %?\n%U\n"
-         :clock-in t
-         :clock-resume t)
-        ("m" "Meeting" entry
-         (file+olp+datetree org-journal-file)
-         "* %? :meeting:\n%t\n** Notes\n** Action Items"
-         :time-prompt t)
-        ("s" "Semi-Weekly PLC Meeting" entry
-         (file+olp+datetree org-journal-file)
-         "* Semi-Weekly PLC Meeting :plc:semiweekly:meeting:%^g \n%t\n** Notes\n** Action Items"
-         :clock-in t
-         :clock-resume t)
-        ("a" "Appointment" entry
-         (file+olp+datetree org-journal-file)
-         "* %? :appt:\n%t"
-         :time-prompt t)
-        ("j" "Journal" entry
-         (file+olp+datetree org-journal-file)
-         "* %?\n%U\n")))
+(setq org-capture-templates '(("n" "Note" entry
+                               (file org-default-notes-file)
+                               "* %?"
+                               :clock-in t
+                               :clock-resume t)
+                              ("t" "TODO" entry
+                               (file org-default-notes-file)
+                               "* TODO %?\n%U\n"
+                               :clock-in t
+                               :clock-resume t)
+                              ("m" "Meeting" entry
+                               (file+olp+datetree org-journal-file)
+                               "* %? :meeting:\n%t\n** Notes\n** Action Items"
+                               :time-prompt t)
+                              ("s" "Semi-Weekly PLC Meeting" entry
+                               (file+olp+datetree org-journal-file)
+                               "* Semi-Weekly PLC Meeting :plc:semiweekly:meeting:%^g \n%t\n** Notes\n** Action Items"
+                               :clock-in t
+                               :clock-resume t)
+                              ("a" "Appointment" entry
+                               (file+olp+datetree org-journal-file)
+                               "* %? :appt:\n%t"
+                               :time-prompt t)
+                              ("j" "Journal" entry
+                               (file+olp+datetree org-journal-file)
+                               "* %?\n%U\n")))
 
 (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
 
index e2c5a96286d8a635728347f50e63843fe546d31e..330f7fdfc6718d1ff433041cf48cd27766cfdfd5 100644 (file)
@@ -3,46 +3,31 @@
 
 ;;; Code:
 
-;; Windows only
-(when
-    (equal system-type 'windows-nt)
-  (setq delete-by-moving-to-trash t
-        ediff-diff-program "\"c:/Program Files/Git/usr/bin/diff.exe\""
-        ediff-diff3-program "\"c:/Program Files/Git/usr/bin/diff3.exe\""
-        diff-command "\"c:/Program Files/Git/usr/bin/diff.exe\""
-        w32-recognize-altgr 'nil)
-  (defun re/unfuck-aveva-license ()
+(when (equal system-type 'windows-nt)
+  (setq delete-by-moving-to-trash t w32-recognize-altgr 'nil)
+  (defun re/unfuck-aveva-license nil
     "Remove the offending xml files.
 Use this when aveva can't find ass with both hands."
     (interactive)
-    (let
-        ((xml1 "c:/ProgramData/AVEVA/Licensing/License API2/Data/LocalAcquireInfo.xml")
-         (xml2 "c:/ProgramData/AVEVA/Licensing/License API2/Data/LocalBackEndAcquireInfo.xml"))
-      (when
-          (file-exists-p xml1)
-        (delete-file xml1))
-      (when
-          (file-exists-p xml2)
-        (delete-file xml2)))))
+    (let ((xml1 "c:/ProgramData/AVEVA/Licensing/License API2/Data/LocalAcquireInfo.xml")
+          (xml2 "c:/ProgramData/AVEVA/Licensing/License API2/Data/LocalBackEndAcquireInfo.xml"))
+      (when (file-exists-p xml1) (delete-file xml1))
+      (when (file-exists-p xml2) (delete-file xml2)))))
 
-;; Linux/BSD only
-(unless
-    (equal system-type 'windows-nt)
-  (if(equal system-type 'berkeley-unix)
-      (defun doas ()
+(unless (equal system-type 'windows-nt)
+  (if (equal system-type 'berkeley-unix)
+      (defun doas nil
         "Use TRAMP to reopen the current buffer as root using doas."
         (interactive)
         (when buffer-file-name
-          (find-alternate-file
-           (concat "/doas:root@localhost:"
-                   buffer-file-name))))
-    (defun sudo ()
+          (find-alternate-file (concat "/doas:root@localhost:"
+                                       buffer-file-name))))
+    (defun sudo nil
       "Use TRAMP to reopen the current buffer as root using sudo."
       (interactive)
       (when buffer-file-name
-        (find-alternate-file
-         (concat "/doas:root@localhost:"
-                 buffer-file-name))))))
+        (find-alternate-file (concat "/doas:root@localhost:"
+                                     buffer-file-name))))))
 
 (provide 're-os-specific)
 ;;; re-os-specific.el ends here
index 4baad34fc4ea52d87253a909af482307096ca5ab..77bf61af7f3e5be26e56b3a37869bad3681efbc3 100644 (file)
@@ -4,33 +4,33 @@
 ;;; Code:
 
 (require 'package)
-(add-to-list 'package-archives
-             '("melpa" . "https://melpa.org/packages/"))
+
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
 
 (use-package ledger-mode
-  :ensure t
+  :ensure
+  t
   :bind
-  ((:map ledger-mode-map
-         ("C-c s" . ledger-sort-buffer))))
+  ((:map ledger-mode-map ("C-c s" . ledger-sort-buffer))))
 
 (use-package visual-fill-column
-  :ensure t
+  :ensure
+  t
   :config
   (global-visual-line-mode 1)
   :custom
   (word-wrap t)
-  (visual-line-fringe-indicators
-   '(left-curly-arrow right-curly-arrow))
+  (visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
   (visual-fill-column-enable-sensible-window-split t))
 
 (keymap-global-set "C-c v"
-                   (lambda
-                     ()
+                   (lambda nil
                      (interactive)
                      (visual-fill-column-mode 'toggle)))
 
 (use-package corfu
-  :ensure t
+  :ensure
+  t
   :custom
   (corfu-auto t)
   (corfu-auto-delay 0)
   (global-corfu-mode))
 
 (use-package corfu-popupinfo
-  :ensure nil                           ; Part of corfu
-  :after corfu
+  :ensure
+  nil ;part of corfu
+  :after
+  corfu
   :hook
   (corfu-mode . corfu-popupinfo-mode)
   :custom
-  (corfu-popupinfo-delay
-   '(nil . 0.01))
+  (corfu-popupinfo-delay '(nil . 0.01))
   (corfu-popupinfo-hide nil)
   :config
   (corfu-popupinfo-mode))
-(use-package expand-region
-  :ensure t
-  :bind
-  (("C-=" . 'er/expand-region)))
+
+(use-package expand-region :ensure t :bind (("C-=" quote er/expand-region)))
 
 (use-package magit
-  :ensure t
+  :ensure
+  t
   :config
   (message "Magit Loaded")
   :bind
-  ((:map ctl-x-map
-         ("g" . magit-status))))
+  ((:map ctl-x-map ("g" . magit-status))))
 
 (use-package openwith
-  :ensure t
+  :ensure
+  t
   :config
   (openwith-mode t)
   (setq openwith-associations
-        (list
-         (list
-          (openwith-make-extension-regexp
-           '("xls" "xlsx" "doc" "docx" "ppt" "pptx" "odt" "ods" "odg" "odp"))
-          "libreoffice"                        ; Windows falls back to system default
-          '(file))
-         (list
-          (openwith-make-extension-regexp
-           '("adpro"))
-          "ProductivitySuite"
-          '(file))
-         (list
-          (openwith-make-extension-regexp
-           '("pdf"))
-          "zathura"                    ; Windows falls back to ms-office
-          '(file)))))
-
-(use-package auctex
-  :ensure t
-  :defer t)
+        (list (list (openwith-make-extension-regexp
+                     '("xls" "xlsx" "doc" "docx" "ppt" "pptx" "odt" "ods" "odg" "odp"))
+                    "libreoffice"
+                    '(file))  ; Windows falls back to system default
+              (list (openwith-make-extension-regexp
+                     '("adpro"))
+                    "ProductivitySuite"
+                    '(file))
+              (list (openwith-make-extension-regexp
+                     '("pdf"))
+                    "zathura"
+                    '(file)))))  ; Windows falls back to ms-office
+
+(use-package auctex :ensure t :defer t)
 
 (use-package slime
-  :ensure t
-  :defer t
+  :ensure
+  t
+  :defer
+  t
   :init
-  (load
-   (expand-file-name "~/quicklisp/slime-helper.el"))
+  (load (expand-file-name "~/quicklisp/slime-helper.el"))
   :config
   (setq inferior-lisp-program "sbcl")
-  (when
-      (file-exists-p "~/lisp/sbcl.core-for-slime")
-    (setq slime-lisp-implementations
-          '((sbcl
-             ("sbcl" "--core" "sbcl.core-for-slime")
-             :directory "~/lisp"))))
+  (when (file-exists-p "~/lisp/sbcl.core-for-slime")
+    (setq slime-lisp-implementations '((sbcl ("sbcl" "--core" "sbcl.core-for-slime") :directory "~/lisp"))))
   :custom
   (slime-net-coding-system 'utf-8-unix))
 
 (add-hook 'slime-mode-hook
-          (lambda
-            ()
-            (unless
-                (slime-connected-p)
-              (save-excursion
-                (slime)))))
-
-(use-package paredit
-  :ensure t
-  :bind
-  (("C-c p" . 'paredit-mode)))
+          (lambda nil (unless (slime-connected-p) (save-excursion (slime)))))
+
+(use-package paredit :ensure t :bind (("C-c p" quote paredit-mode)))
 
 (provide 're-packages)
 ;;; re-packages.el ends here
index 40924af55fea1ed2889aedd3b6f4deac682dbcbe..4212f15668129da629f0cf3ffefbceee02107282 100644 (file)
@@ -7,81 +7,55 @@
 
 (defun max-counts (resolution)
   "Calculate the max count for a PLC analog, given card's bit-resolution."
-  (1-
-   (^ 2 resolution)))
+  (1- (^ 2 resolution)))
 
 (defun volts->counts (vmax vin resolution)
   "Convert a voltage signal to a PLC count.
 Calculates a ratio of vin/vmax, then scales by `max-counts'."
-  (*
-   (/
-    (float vin)
-    vmax)
-   (max-counts resolution)))
+  (* (/ (float vin) vmax) (max-counts resolution)))
 
 (defun counts->volts (vmax cin resolution)
   "Convert a PLC count to a voltage.
 Calculates a ratio of cin/`max-counts', then multiplies by vmax."
-  (*
-   (/
-    (float cin)
-    (max-counts resolution))
-   vmax))
+  (* (/ (float cin) (max-counts resolution)) vmax))
 
 (defun amps->counts (vmax amps resolution r1 &optional r2)
   "Convert a current signal to PLC Counts.
 Converts the amperage to a voltage using `amps->volts' (with r1
 and optional r2), then applies `volts->counts' to the resulting
 voltage, vmax, and resolution."
-  (volts->counts vmax
-                 (amps->volts amps r1 r2)
-                 resolution))
+  (volts->counts vmax (amps->volts amps r1 r2) resolution))
 
 (defun count-range (upper lower vmax resolution &optional r1 r2)
   "Given an upper and lower signal, return the list of upper and lower PLC counts.
 With a current signal, use r1 and maybe r2 to
 calculate `amps->counts'.  Otherwise ignore r1/r2 and calculate
 `volts->counts'."
-  (if
-      (eq nil r1)
-      (list
-       (volts->counts vmax upper resolution)
-       (volts->counts vmax lower resolution))
-    (list
-     (amps->counts vmax upper resolution r1 r2)
-     (amps->counts vmax lower resolution r1 r2))))
+  (if (eq nil r1)
+      (list (volts->counts vmax upper resolution)
+            (volts->counts vmax lower resolution))
+    (list (amps->counts vmax upper resolution r1 r2)
+          (amps->counts vmax lower resolution r1 r2))))
 
 (defun divisor (raw-max raw-min scaled-max scaled-min)
   "Calculate 1/slope given PLC Max/Min and Eng. Max/Min."
-  (/
-   (float
-    (- raw-max raw-min))
-   (- scaled-max scaled-min)))
+  (/ (float (- raw-max raw-min)) (- scaled-max scaled-min)))
 
 (defun offset (raw-max raw-min scaled-max scaled-min)
   "Calculate offset given PLC Max/Min and Eng. Max/Min."
-  (- scaled-min
-     (/ raw-min
-        (divisor raw-max raw-min scaled-max scaled-min))))
+  (- scaled-min (/ raw-min (divisor raw-max raw-min scaled-max scaled-min))))
 
 (defun final (analog-input divisor offset)
   "Calculate the scaled value of an input."
-  (+
-   (/ analog-input divisor)
-   offset))
+  (+ (/ analog-input divisor) offset))
 
 (defun scale (raw-max raw-min scaled-max scaled-min &optional analog-input)
   "Calculate the divisor, offset, and maybe final value, given the parameters."
-  (let*
-      ((div
-        (divisor raw-max raw-min scaled-max scaled-min))
-       (os
-        (offset raw-max raw-min scaled-max scaled-min)))
-    (if
-        (eq nil analog-input)
+  (let* ((div (divisor raw-max raw-min scaled-max scaled-min))
+         (os (offset raw-max raw-min scaled-max scaled-min)))
+    (if (eq nil analog-input)
         (list div os)
-      (list div os
-            (final analog-input div os)))))
+      (list div os (final analog-input div os)))))
 
 (provide 're-plc-defuns)
 ;;; re-plc-defuns.el ends here
index 845c9b902beb41f8523063106ec9f331484796ba..9fa6ea97f3ef5553f3550ef386ddd4be701f9fd3 100644 (file)
 
 (defun c->f (tempc)
   "Convert degrees Celsius to degrees Fahrenheit."
-  (+
-   (* tempc 1.8)
-   32.0))
+  (+ (* tempc 1.8) 32.0))
 
 (defun f->c (tempf)
   "Convert degrees Fahrenheit to degrees Celsius."
-  (/
-   (- tempf 32.0)
-   1.8))
+  (/ (- tempf 32.0) 1.8))
 
 (defun k->f (tempk)
   "Convert degrees Kelvin to degrees Fahrenheit.
 Applies `c->f' to `k->c'."
-  (c->f
-   (k->c tempk)))
+  (c->f (k->c tempk)))
 
 (defun f->k (tempf)
   "Convert degrees Fahrenheit to degrees Kelvin.
 Applies `c->k' to `f->c'."
-  (c->k
-   (f->c tempf)))
+  (c->k (f->c tempf)))
 
 ;; Cooling
 (defun cfm-circ (fpm radius)
   "Calculate the CFM of a circular duct.
 Inputs are feet/minute and radius (in)."
-  (* float-pi fpm
-     (square
-      (/ radius 12.0))))
+  (* float-pi fpm (square (/ radius 12.0))))
 
 (defun cfm-rect (fpm width height)
   "Calculate the CFM of a rectangular duct.
 Inputs are feet/minute, width (in) and height (in)."
-  (* fpm
-     (/ width 12.0)
-     (/ height 12.0)))
+  (* fpm (/ width 12.0) (/ height 12.0)))
 
 (defun sat-water-press (temp)
   "Calculate the saturated water pressure at a temp (F)."
-  (+ .0182795
+  (+ 0.0182795
      (* temp 0.001029904)
-     (*
-      (square temp)
-      0.00002579408)
-     (*
-      (cube temp)
-      (E 2.400493 -7))
-     (*
-      (^ temp 4)
-      (E 8.100939 -10))
-     (*
-      (^ temp 5)
-      (E 3.256805 -11))
-     (*
-      (^ temp 6)
-      (E -1.001922 -13))
-     (*
-      (^ temp 7)
-      (E 2.44161 -16))))
+     (* (square temp) 2.579408e-05)
+     (* (cube temp) (E 2.400493 -7))
+     (* (^ temp 4) (E 8.100939 -10))
+     (* (^ temp 5) (E 3.256805 -11))
+     (* (^ temp 6) (E -1.001922 -13))
+     (* (^ temp 7) (E 2.44161 -16))))
 
 (defun hum-ratio (humidity swp)
   "Calulate the humidity ratio.
 Takes humidity in %RH, and a Saturated Water Pressure."
-  (let
-      ((hum-press
-        (*
-         (/ humidity 100.0)
-         swp)))
-    (/
-     (* hum-press 0.62198)
-     (- 14.7 hum-press))))
+  (let ((hum-press (* (/ humidity 100.0) swp)))
+    (/ (* hum-press 0.62198) (- 14.7 hum-press))))
 
 (defun gn-water-per-lb (humidity temp)
   "Calculate the grains of water per lb of air.
 Takes humidity in %RH, and temp in F."
-  (* 7000
-     (hum-ratio humidity
-                (sat-water-press temp))))
+  (* 7000 (hum-ratio humidity (sat-water-press temp))))
 
 (provide 're-refrigeration-defuns)
 ;;; re-refrigeration-defuns.el ends here
index 2ac46a43b9015ae203c09bffca685d53168deef8..a3bdfdc35b8d6ae6d87056dd583d56e843a1610a 100644 (file)
@@ -4,47 +4,34 @@
 ;;; Code:
 
 ;; Any Lisp Repl
-(defmacro re/send-on-close-paren
-    (executor)
+
+(defmacro re/send-on-close-paren (executor)
   "Generalizes sending an execute on close paren.
  Interactively call `executor'.  For `executor', use whatever
  function is called by `<RET>' in the applicable REPL.  For a
  non-repl, use `newline' or similar."
-  `(lambda
-     (&optional arg)
-     (interactive "p")
-     (insert-char 41 arg)
-     (call-interactively ,executor)))
+  `(lambda (&optional arg) (interactive "p") (insert-char 41 arg) (call-interactively ,executor)))
 
 (defun re/sexp-drop-paren-p ()
   "Returns t if sexp needs fewer parens to balance."
-  (<0
-   (car
-    (syntax-ppss))))
+  (<0 (car (syntax-ppss))))
 
 (defun re/sexp-need-paren-p ()
   "Returns t if sexp needs more parens to balance."
-  (>0
-   (car
-    (syntax-ppss))))
+  (>0 (car (syntax-ppss))))
 
 (defun re/sexp-unbalanced-count ()
   "Returns distance from balanced sexp."
-  (abs
-   (car
-    (syntax-ppss))))
+  (abs (car (syntax-ppss))))
 
 (defun re/balance-sexp ()
   "Balance the sexp before point.
 Either delete or add as many ')' as needed."
-  (let
-      ((distance
-        (re/sexp-unbalanced-count)))
-    (cond
-     ((re/sexp-need-paren-p)
-      (insert-char 41 distance))
-     ((re/sexp-drop-paren-p)
-      (backward-delete-char distance)))))
+  (let ((distance (re/sexp-unbalanced-count)))
+    (cond ((re/sexp-need-paren-p)
+           (insert-char 41 distance))
+          ((re/sexp-drop-paren-p)
+           (backward-delete-char distance)))))
 
 (defmacro re/balance-and-eval-sexp (executor)
   "Balance the sexp before point, then call `executor'.
@@ -52,43 +39,28 @@ Call `re/balance-sexp', then interactively call `executor'.  Bind
 this to ']' for the interlisp experience.  For `executor', use
 whatever function is called by `<RET>' in the applicable REPL.
 For a non-repl, use `newline' or similar."
-  `(lambda
-     ()
-     (interactive)
-     (re/balance-sexp)
-     (call-interactively ,executor)))
+  `(lambda () (interactive) (re/balance-sexp) (call-interactively ,executor)))
 
-;; Eshell
 (defun eshell-quit-or-delete-char (arg)
   "Delete char if at one, quit eshell if on empty prompt.
 Stolen from https://depp.brause.cc/dotemacs"
   (interactive "p")
-  (if
-      (and
-       (eolp)
-       (looking-back eshell-prompt-regexp 0 t))
+  (if (and (eolp) (looking-back eshell-prompt-regexp 0 t))
       (eshell-life-is-too-much)
-                                        ; https://emacshorrors.com/post/life-is-too-much
     (delete-char arg)))
 
 ;; IELM
 (defun re/ielm-init-history ()
   "Stolen from https://n16f.net/blog/making-ielm-more-comfortable."
-  (let
-      ((path
-        (expand-file-name "ielm/history" user-emacs-directory)))
-    (make-directory
-     (file-name-directory path)
-     t)
+  (let ((path (expand-file-name "ielm/history" user-emacs-directory)))
+    (make-directory (file-name-directory path) t)
     (setq-local comint-input-ring-file-name path))
-  (setq-local comint-input-ring-size 10000
-              comint-input-ignoredups t)
+  (setq-local comint-input-ring-size 10000 comint-input-ignoredups t)
   (comint-read-input-ring))
 
 (defun re/ielm-write-history (&rest _args)
   "Stolen from https://n16f.net/blog/making-ielm-more-comfortable."
-  (with-file-modes #o600
-    (comint-write-input-ring)))
+  (with-file-modes 384 (comint-write-input-ring)))
 
 (add-hook 'ielm-mode-hook #'re/ielm-init-history)
 (advice-add 'ielm-send-input :after #'re/ielm-write-history)