From: rearman Date: Mon, 6 May 2024 16:32:07 +0000 (-0400) Subject: Re-Refactor plc defuns, modify agenda, swap string/regexp bindings X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=69ca88ccaf48850a4ea8520cc151b5e4cfeaacee;p=emacsinit.git Re-Refactor plc defuns, modify agenda, swap string/regexp bindings --- diff --git a/init.org b/init.org index c64ac30..dd70247 100644 --- a/init.org +++ b/init.org @@ -546,27 +546,26 @@ 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-todo "TODO=\"IN-PROGRESS\"-standard-REFILE" + ((org-agenda-overriding-header "In Progress"))) (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\"-TODO=\"IN-PROGRESS\"-standard-REFILE" + ((org-agenda-overriding-header "Filed Tasks"))) (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"))))))) + ((org-agenda-overriding-header "Holding"))) + (tags-todo "standard" + ((org-agenda-overriding-header "Changes to Standard"))))))) #+END_SRC Tag filtering #+BEGIN_SRC emacs-lisp (setq org-tag-alist '((:startgroup . nil) - ("@errand" . ?e) - ("@office" . ?o) - ("need" . ?n) - (:endgroup . nil))) + ("need" . ?n) + ("standard" . ?s) + (:endgroup . nil))) #+END_SRC *** Templates @@ -587,7 +586,7 @@ Start up =abbrev-mode= for org #+END_SRC **** Skeletons -***** =Emacs Lisp= source Block +***** Emacs Lisp source Block #+BEGIN_SRC emacs-lisp (define-skeleton skel-org-block-elisp "Insert an org emacs lisp block" @@ -746,7 +745,7 @@ Here are the various customizations I have for eshell. #+BEGIN_SRC emacs-lisp (add-hook 'eshell-mode-hook (lambda () - (setq-local corfu-auto nil) + ;; (setq-local corfu-auto nil) (corfu-mode))) #+END_SRC @@ -858,7 +857,7 @@ The =M-^= binding is handy, but usually I want the ed/sam/vi join function, whic #+END_SRC **** Line opening -The default behavior of =open-line= is ridiculous. It acheives the same function as hitting =RET=. I don't want to split the current line, I want to OPEN a new one, and usually go to it. These wrappers remedy that, and allow me to choose whether I want to go to the line or just add it. +The default behavior of =open-line= is ridiculous. It acheives the same function as hitting =RET=. I don't want to split the current line, I want to OPEN a new one, and usually go to it. These wrappers remedy that. #+BEGIN_SRC emacs-lisp (defun open-line-below (n) @@ -1020,8 +1019,10 @@ I made these bindings to put my more-used commands on better keys, and swap them (keymap-global-set "M-s M-." 'isearch-forward-symbol-at-point) (keymap-global-set "M-%" 'replace-regexp) (keymap-global-set "C-%" 'replace-string) -(keymap-global-set "C-S-R" 'isearch-backward-regexp) -(keymap-global-set "C-S-S" 'isearch-forward-regexp) +(keymap-global-set "C-s" 'isearch-forward-regexp) +(keymap-global-set "C-S-S" 'isearch-forward) +(keymap-global-set "C-r" 'isearch-backward-regexp) +(keymap-global-set "C-S-R" 'isearch-backward) #+END_SRC *** Elisp/Eval bindings @@ -1128,7 +1129,7 @@ Applies `c->k' to `f->c'." #+END_SRC *** Electrical -These defuns are all about electronics. Effective impedance, amps to volts and back again. +These defuns are all about electronics. Effective impedance, amps to volts, and back again. #+BEGIN_SRC emacs-lisp (defun eff-imp (r1 &optional r2) "Calculate the effective input impedance, given two resistances. @@ -1187,30 +1188,25 @@ calculate `amps->counts'. Otherwise ignore r1/r2 and calculate (list (amps->counts vmax upper resolution r1 r2) (amps->counts vmax lower resolution r1 r2)))) -(defun div-ofst (raw-max raw-min scaled-max scaled-min) - "Calculate 1/slope and offset given PLC Max/Min and Eng. Max/Min." - (let* ((divisor (/ (float (- raw-max raw-min)) (- scaled-max scaled-min))) - (offset (- scaled-min (/ raw-min divisor)))) - (list divisor offset))) +(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))) + +(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)))) -(defun fincalc (analog-input divisor offset) +(defun final (analog-input divisor offset) "Calculate the scaled value of an input." (+ (/ analog-input divisor) offset)) -(defun final (analog-input divisor &optional offset) - "Calculate the scaled value of an input, by calling `fincalc'. -Get values of divisor and offset if from a list, as returned by `div-ofst', -otherwise take two separate values" - (if (listp divisor) - (let ((div (car divisor)) - (os (car (cdr divisor)))) - (fincalc analog-input div os)) - (fincalc analog-input divisor offset))) - -(defun scale (analog-input raw-max raw-min scaled-max scaled-min) - "Calculate the divisor, offset, and final value, given the parameters." - (list (div-ofst raw-max raw-min scaled-max scaled-min) - (final analog-input (div-ofst raw-max raw-min scaled-max scaled-min)))) +(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) + (list div os) + (list div os (final analog-input div os))))) #+END_SRC *** Refrigeration