gc-cons-percentage 0.6)
(add-hook 'after-init-hook #'(lambda () (setq gc-cons-threshold (* 1024 1024 25)
- gc-cons-percentage 0.1)))
+ gc-cons-percentage 0.1)))
#+END_SRC
** Basic UI preferences
#+BEGIN_SRC emacs-lisp :tangle ./early-init.el
(setq default-frame-alist '((fullscreen . maximized)
- (vertical-scroll-bars . nil)))
+ (vertical-scroll-bars . nil)))
#+END_SRC
** Misc/odd issues
(openwith-mode t))
(setq openwith-associations (list
- (list (openwith-make-extension-regexp
- '("xls" "xlsx" "doc" "docx"
- "ppt" "odt" "ods" "odg" "odp"))
- "LibreOffice"
- '(file))
- (list (openwith-make-extension-regexp
- '("adpro"))
- "ProductivitySuite"
- '(file))))
+ (list (openwith-make-extension-regexp
+ '("xls" "xlsx" "doc" "docx"
+ "ppt" "odt" "ods" "odg" "odp"))
+ "LibreOffice"
+ '(file))
+ (list (openwith-make-extension-regexp
+ '("adpro"))
+ "ProductivitySuite"
+ '(file))))
#+END_SRC
*** org-transclusion
(use-package org-transclusion
:ensure t
:bind (("<f12>" . org-transclusion-add)
- ("C-c n t" . org-transclusion-mode)))
+ ("C-c n t" . org-transclusion-mode)))
#+END_SRC
*** acme-mouse
:defer t)
#+END_SRC
+*** centered-cursor-mode
+Trying out the (veritcally) centered cursor, heard about it on [[gemini://gem.librehacker.com/gemlog/starlog/20240228-0.gmi][gemini]]
+#+BEGIN_SRC emacs-lisp
+(use-package centered-cursor-mode
+ :ensure t
+ :custom
+ (ccm-recenter-at-end-of-file t)
+ (ccm-step-delay 0)
+ :config
+ (global-centered-cursor-mode t))
+
+#+END_SRC
+
+
** Non-Package customization
This section has '/base/' emacs customization. All the general stuff.
#+BEGIN_SRC emacs-lisp
(setq-default indicate-empty-lines t
- fill-column 80
- cursor-type 'bar
- cursor-in-non-selected-windows 'hollow)
+ fill-column 80
+ cursor-type 'bar
+ cursor-in-non-selected-windows 'hollow)
#+END_SRC
*** Backup/Autosave
I want nice symbols to look at
#+BEGIN_SRC emacs-lisp
(setq prettify-symbols-alist '(("lambda" . 955)
- ("delta" . 120517)
- ("epsilon" . 120518)
- ("->" . 8594)
- ("<=" . 8804)
- (">=" . 8805)))
+ ("delta" . 120517)
+ ("epsilon" . 120518)
+ ("->" . 8594)
+ ("<=" . 8804)
+ (">=" . 8805)))
(global-prettify-symbols-mode t)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(set-face-attribute 'show-paren-match nil
- :background 'unspecified
- :underline t)
+ :background 'unspecified
+ :underline t)
#+END_SRC
*** Modeline
(defun 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)))
+ (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
- c-lineup-arglist-tabs-only))))))
+ (lambda ()
+ ;; Add kernel style
+ (c-add-style
+ "linux-tabs-only"
+ '("linux"
+ (c-offsets-alist
+ (arglist-cont-nonempty
+ c-lineup-gcc-asm-reg
+ c-lineup-arglist-tabs-only))))))
(add-hook 'c-mode-hook
- (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")))
+ (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")))
#+END_SRC
*** Windows-Specific
#+BEGIN_SRC emacs-lisp
(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))
+ 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))
#+END_SRC
** org configuration
Let me refile anywhere, use outline paths, confirm when creating parent nodes.
#+BEGIN_SRC emacs-lisp
(setq org-refile-targets '((nil :maxlevel . 9)
- (org-agenda-files :maxlevel . 9))
+ (org-agenda-files :maxlevel . 9))
org-refile-use-outline-path 'file
org-refile-allow-creating-parent-nodes '(confirm))
#+END_SRC
Set up some more todo keywords
#+BEGIN_SRC emacs-lisp
(setq org-todo-keywords '((sequence "TODO(t)"
- "WAITING(w@/!)"
- "IN-PROGRESS(i!)"
- "APPT(a!)"
- "|"
- "DELEGATED(l@)"
- "DONE(d!/@)"
- "CANCELLED(c@)")))
+ "WAITING(w@/!)"
+ "IN-PROGRESS(i!)"
+ "APPT(a!)"
+ "|"
+ "DELEGATED(l@)"
+ "DONE(d!/@)"
+ "CANCELLED(c@)")))
#+END_SRC
Set up the agenda view. Access it with =C-c a SPC=.
#+BEGIN_SRC emacs-lisp
(setq org-agenda-custom-commands '((" " "Agenda"
- ((agenda "" nil)
- (todo "APPT"
- ((org-agenda-overriding-header "Appointments")))
- (tags "need"
- ((org-agenda-overriding-header "Needed Items")))
- (tags "REFILE"
- ((org-agenda-overriding-header "Tasks to Refile")))
- (tags-todo "TODO=\"IN-PROGRESS\"-REFILE"
- ((org-agenda-overriding-header "In Progress")))
- (tags-todo "TODO=\"WAITING\"-REFILE"
- ((org-agenda-overriding-header "Halted")))
- (tags-todo "-TODO=\"WAITING\"-TODO=\"IN-PROGRESS\"-REFILE-JOURNAL"
- ((org-agenda-overriding-header "Filed Tasks")))))))
+ ((agenda "" nil)
+ (todo "APPT"
+ ((org-agenda-overriding-header "Appointments")))
+ (tags "need"
+ ((org-agenda-overriding-header "Needed Items")))
+ (tags "REFILE"
+ ((org-agenda-overriding-header "Tasks to Refile")))
+ (tags-todo "TODO=\"IN-PROGRESS\"-REFILE"
+ ((org-agenda-overriding-header "In Progress")))
+ (tags-todo "TODO=\"WAITING\"-REFILE"
+ ((org-agenda-overriding-header "Halted")))
+ (tags-todo "-TODO=\"WAITING\"-TODO=\"IN-PROGRESS\"-REFILE-JOURNAL"
+ ((org-agenda-overriding-header "Filed Tasks")))))))
#+END_SRC
Tag filtering
#+BEGIN_SRC emacs-lisp
(setq org-tag-alist '((:startgroup . nil)
- ("@errand" . ?e)
- ("@office" . ?o)
- ("need" . ?n)
- (:endgroup . nil)))
+ ("@errand" . ?e)
+ ("@office" . ?o)
+ ("need" . ?n)
+ (:endgroup . nil)))
#+END_SRC
*** Templates
Capture Templates per my proclivities.
#+BEGIN_SRC emacs-lisp
(setq org-capture-templates '(("n" "Note" entry (file org-default-notes-file) "* %u %?")
- ("t" "TODO" entry (file org-default-notes-file) "* TODO %?\n%U\n")
- ("a" "Appointment" entry (file+olp+datetree org-journal-file) "* APPT %?\nSCHEDULED: %t" :time-prompt t)
- ("j" "Journal" entry (file+olp+datetree org-journal-file) "* %?\n%U\n")))
+ ("t" "TODO" entry (file org-default-notes-file) "* TODO %?\n%U\n")
+ ("a" "Appointment" entry (file+olp+datetree org-journal-file) "* APPT %?\nSCHEDULED: %t" :time-prompt t)
+ ("j" "Journal" entry (file+olp+datetree org-journal-file) "* %?\n%U\n")))
#+END_SRC
*** Abbreviations + Snippets
"Tangle and compile init.org.
Stolen from https://github.com/larstvei/dot-emacs."
(when (equal (buffer-file-name)
- (expand-file-name (concat user-emacs-directory "init.org")))
+ (expand-file-name (concat user-emacs-directory "init.org")))
(let ((prog-mode-hook nil))
(org-babel-tangle))))
For some reason, the org people decided that =verbatim= doesn't actually mean =verbatim=! This attempts to fix that. I found this solution at [[https://emacs.stackexchange.com/questions/13820/inline-verbatim-and-code-with-quotes-in-org-mode][stackexchange]].
#+BEGIN_SRC emacs-lisp
(eval-after-load "org" '(lambda ()
- (setcar (nthcdr 2 org-emphasis-regexp-components) " \t\r\n,")
- (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
- (org-element--set-regexps)))
+ (setcar (nthcdr 2 org-emphasis-regexp-components) " \t\r\n,")
+ (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
+ (org-element--set-regexps)))
#+END_SRC
*** File Opening
#+BEGIN_SRC emacs-lisp
(setq org-link-frame-setup '((vm . vm-visit-folder-other-frame)
- (vm-imap . vm-visit-imap-folder-other-frame)
- (gnus . org-gnus-no-new-news)
- (file . find-file)
- (wl . wl-other-frame)))
+ (vm-imap . vm-visit-imap-folder-other-frame)
+ (gnus . org-gnus-no-new-news)
+ (file . find-file)
+ (wl . wl-other-frame)))
#+END_SRC
** Dired configuration
Make dired use the same switches I prefer for =ls=, give me a simpler listing, and default to using its current buffer for visiting a file rather than creating a new one.
(setq dired-listing-switches "-alv --group-directories-first")
(add-hook 'dired-mode-hook
- (lambda ()
- (dired-hide-details-mode t)
- (keymap-set dired-mode-map
- "RET" 'dired-find-alternate-file)))
+ (lambda ()
+ (dired-hide-details-mode t)
+ (keymap-set dired-mode-map
+ "RET" 'dired-find-alternate-file)))
#+END_SRC
** Eshell configuration
#+BEGIN_SRC emacs-lisp
(add-hook 'eshell-mode-hook (lambda ()
- (setq-local corfu-auto nil)
- (corfu-mode)))
+ (setq-local corfu-auto nil)
+ (corfu-mode)))
#+END_SRC
*** Send on Close-Paren
(interactive)
(insert-char ?\))
(when (= 0 (car (syntax-ppss)))
- (eshell-send-input)))
+ (eshell-send-input)))
#+END_SRC
*** Quit or delete-char
#+BEGIN_SRC emacs-lisp
(add-hook 'eshell-mode-hook
- (lambda ()
- (keymap-set eshell-mode-map ")" 'eshell-send-on-close-paren)
- (keymap-set eshell-mode-map "C-d" 'eshell-quit-or-delete-char)))
+ (lambda ()
+ (keymap-set eshell-mode-map ")" 'eshell-send-on-close-paren)
+ (keymap-set eshell-mode-map "C-d" 'eshell-quit-or-delete-char)))
#+END_SRC
** Defuns and Bindings
"Renames the current buffer and the file it is visiting."
(interactive)
(let ((name (buffer-name))
- (filename (buffer-file-name)))
+ (filename (buffer-file-name)))
(if (not (and filename (file-exists-p filename)))
- (error "Buffer '%s' is not visiting a file!" name)
+ (error "Buffer '%s' is not visiting a file!" 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)
- (set-visited-file-name new-name)
- (set-buffer-modified-p nil)
- (message "File '%s' successfully renamed to '%s'"
- name (file-name-nondirectory new-name)))))))
+ (if (get-buffer new-name)
+ (error "A buffer named '%s' already exists!" new-name)
+ (rename-file filename new-name 1)
+ (rename-buffer new-name)
+ (set-visited-file-name new-name)
+ (set-buffer-modified-p nil)
+ (message "File '%s' successfully renamed to '%s'"
+ name (file-name-nondirectory new-name)))))))
(keymap-global-set "C-x C-r" 'rename-current-buffer-file)
#+END_SRC
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end))
(comment-or-uncomment-region (line-beginning-position)
- (line-end-position))))
+ (line-end-position))))
(keymap-global-set "M-;" 'my-comment-dwim)
#+END_SRC
(let ((oldpos (point)))
(back-to-indentation)
(and (= oldpos (point))
- (beginning-of-line))))
+ (beginning-of-line))))
#+END_SRC
I had issues with =smart-beginning-of-line= in =visual-line-mode=, so =smart-beginning-of-visual-line= was created. It implements part of =back-to-indentation=, but with changes to use =beginning-of-visual-line= instead of =beginning-of-line=.
(skip-syntax-forward " " (line-end-position))
(backward-prefix-chars)
(and (= oldpos (point))
- (beginning-of-visual-line))))
+ (beginning-of-visual-line))))
#+END_SRC
Remap =move-beginning-of-line=, then remap =beginning-of-visual-line= when going into =visual-line-mode=. A simple remap would not work for =visual-line-mode=, so I explicitly set =C-a=.
#+BEGIN_SRC emacs-lisp
(global-set-key [remap move-beginning-of-line] 'smart-beginning-of-line)
(add-hook 'visual-line-mode-hook
- (lambda ()
- (keymap-global-set "C-a" 'smart-beginning-of-visual-line)))
+ (lambda ()
+ (keymap-global-set "C-a" 'smart-beginning-of-visual-line)))
#+END_SRC
I don't want line numbers in the margin unless I am actively trying to go to a line. I override =goto-line= with this function, which shows line numbers, asks me where I want to go, and then hides line numbers.
(unless (equal system-type 'windows-nt)
(if(equal system-type 'berkeley-unix)
(defun doas ()
- "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))))
+ "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 ()
"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))))))
#+END_SRC
*** Windows
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"))
+ (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)))))
#+END_SRC
calculate `amps->counts'. Otherwise ignore r1/r2 and calculate
`volts->counts'."
(cond ((or (equal 'v type)
- (equal 'V type))
- (list (volts->counts upper vmax resolution)
- (volts->counts lower vmax resolution)))
- ((or (equal 'i type)
- (equal 'I type))
- (list (amps->counts upper vmax resolution r1 r2)
- (amps->counts lower vmax resolution r1 r2)))))
+ (equal 'V type))
+ (list (volts->counts upper vmax resolution)
+ (volts->counts lower vmax resolution)))
+ ((or (equal 'i type)
+ (equal 'I type))
+ (list (amps->counts upper vmax resolution r1 r2)
+ (amps->counts lower vmax resolution r1 r2)))))
(defun scaleval (pmax pmin emax emin &optional ai)
"Calculate the slope and offset given PLC Max/Min and Eng. Max/Min.
With optional argument `ai', also calculate a final scaled value from an input."
(let* ((div (/ (- pmax pmin) (- (float emax) (float emin))))
- (ofst (- emin (/ pmin div))))
+ (ofst (- emin (/ pmin div))))
(if (eq nil ai)
- (list div ofst)
+ (list div ofst)
(list div ofst (+ ofst (/ ai div))))))
#+END_SRC
Saturated Water Pressure, Humidity Ratio, and Grains of water per
lb of air."
(let* ((sat-water-press (+ .0182795
- (* temp .001029904)
- (* (square temp) 0.00002579408)
- (* (cube temp) (* 2.400493 (^ 10 -7)))
- (* (^ temp 4) (* 8.100939 (^ 10 -10)))
- (* (^ temp 5) (* 3.256805 (^ 10 -11)))
- (* (^ temp 6) (* -1.001922 (^ 10 -13)))
- (* (^ temp 7) (* 2.44161 (^ 10 -16)))))
- (hum-press (* (/ humidity 100.0) sat-water-press))
- (hum-ratio (/ (* hum-press 0.62198) (- 14.7 hum-press)))
- (gns-water-lb-air (* hum-ratio 7000)))
+ (* temp .001029904)
+ (* (square temp) 0.00002579408)
+ (* (cube temp) (* 2.400493 (^ 10 -7)))
+ (* (^ temp 4) (* 8.100939 (^ 10 -10)))
+ (* (^ temp 5) (* 3.256805 (^ 10 -11)))
+ (* (^ temp 6) (* -1.001922 (^ 10 -13)))
+ (* (^ temp 7) (* 2.44161 (^ 10 -16)))))
+ (hum-press (* (/ humidity 100.0) sat-water-press))
+ (hum-ratio (/ (* hum-press 0.62198) (- 14.7 hum-press)))
+ (gns-water-lb-air (* hum-ratio 7000)))
(list sat-water-press hum-ratio gns-water-lb-air)))
#+END_SRC