From 0d311d36b9d5f430324d919ac097f2364588a432 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 20 Oct 2021 17:31:13 -0500 Subject: blayfduoisaudfoiasdupjfoiu --- TODO.org | 13 +++++++++ early-init.el | 2 +- eshell.el | 9 +++++- init.el | 81 +++++++++++++++++++++++------------------------------- lisp/acdw-circe.el | 10 +++---- lisp/acdw.el | 14 ++++++---- lisp/chd.el | 29 +++++++++++++------ 7 files changed, 90 insertions(+), 68 deletions(-) diff --git a/TODO.org b/TODO.org index 1759aca..bd146a8 100644 --- a/TODO.org +++ b/TODO.org @@ -215,3 +215,16 @@ https://tildegit.org/acdw/emacs/src/branch/main/init.el#L1166, e.g. It adds one for blank lines. ** TODO [[https://stackoverflow.com/questions/25161792/emacs-org-mode-how-can-i-fold-everything-but-the-current-headline][Org mode hide all but current heading]] + +** Work around =C-m=, =RET=, etc + +#+begin_src emacs-lisp + ;; from artefact + + (define-key key-translation-map (kbd "") nil) + (define-key key-translation-map (kbd "C-m") nil) + (define-key key-translation-map (kbd "RET") nil) + (global-set-key (kbd "") 'newline) + (define-key erc-mode-map (kbd "") 'erc-send-current-line) + (global-set-key (kbd "C-m") (lambda () (interactive) (message "hello from C-m"))) +#+end_src diff --git a/early-init.el b/early-init.el index 5f77c82..43dc045 100644 --- a/early-init.el +++ b/early-init.el @@ -182,6 +182,6 @@ say, `tool-bar-mode' once to toggle the tool bar back on." (setup (:straight el-patch)) ;; My private variables and stuff - (require 'acdw-private (acdw/sync-dir "private.el") :noerror) +(require 'private (acdw/sync-dir "private") :noerror) ;;; early-init.el ends here diff --git a/eshell.el b/eshell.el index a2ac33b..c6d8e16 100644 --- a/eshell.el +++ b/eshell.el @@ -24,7 +24,9 @@ ("ff" . "find-file $1") ("emacs" . "find-file $1") ("ee" . "find-file-other-window $1"))) - (eshell/alias (car definition) (cdr definition))) + (cl-letf (((symbol-function 'eshell-write-aliases-list) #'ignore)) + (eshell/alias (car definition) (cdr definition)))) +(eshell-write-aliases-list) ;;; Functions @@ -62,6 +64,11 @@ any directory proferred by `consult-dir'." (:autoload global-fish-completion-mode) (global-fish-completion-mode +1)) +(setup (:straight-when eshell-vterm + (require 'vterm nil :noerror)) + (eshell-vterm-mode +1) + (defalias 'eshell/v 'eshell-exec-visual)) + ;;; Miscellaneous ;; Fix modeline diff --git a/init.el b/init.el index c2a3579..8886660 100644 --- a/init.el +++ b/init.el @@ -95,6 +95,10 @@ (expand-file-name-exists-p "pkg/" user-emacs-directory))) (normal-top-level-add-subdirs-to-load-path))) +(setup auto-fill + (:hook (defun auto-fill@truncate-lines () + (setq-local truncate-lines t)))) + (setup autoinsert (require 'acdw-autoinsert) (acdw/define-auto-insert '(:replace t) @@ -169,7 +173,8 @@ (cons (rx (or "youtube.com" ; videos "youtu.be" (seq "." (or "mp4" - "gif") + "gif" + "mov" "MOV") eos))) (lambda (&rest args) (apply (if (executable-find "mpv") @@ -390,7 +395,9 @@ native-comp-async-report-warnings-errors nil password-cache t password-cache-expiry (* 60 5) ; seconds - set-mark-command-repeat-pop t) + set-mark-command-repeat-pop t + hscroll-step 1 + scroll-step 1) (when (fboundp 'command-completion-default-include-p) (setq read-extended-command-predicate @@ -414,6 +421,9 @@ "C-c _" #'add-file-local-variable "C-x C-c" #'acdw/fat-finger-exit) + (global-set-key (kbd "M-n") (kbd "C-u 1 C-v")) + (global-set-key (kbd "M-p") (kbd "C-u 1 M-v")) + ;; inspo: https://github.com/zaeph/.emacs.d/blob/master/init.el#L479 (defvar toggle-map (make-sparse-keymap) "A keymap for toggling!") @@ -555,7 +565,9 @@ "C-c l v" #'find-variable)) (setup flymake - + ;; TODO: look at flycheck for ideas around `flycheck-disabled-checkers' and + ;; `flycheck-emacs-lisp-load-path'... there must be a way to get flymake to + ;; recognize new values in the load path. (defvar-local flymake-inhibit nil "Buffer-local variable to inhibit `flymake'.") (add-to-list 'safe-local-variable-values '(flymake-inhibit . t)) @@ -1760,6 +1772,8 @@ See also `crux-reopen-as-root-mode'." (setup (:straight (frowny :host github :repo "duckwork/frowny.el")) + (:option frowny-eyes (rx (| ":" ":-" ":'" "=")) + frowny-eyes-looking-back-limit 2) (global-frowny-mode +1)) (setup (:straight gcmh) @@ -2194,7 +2208,7 @@ browser defined in `browse-url-secondary-browser-function'." (:bind "RET" #'acdw-org/return-dwim "" #'acdw-org/org-table-copy-down - "M-SPC M-SPC" #'insert-zero-width-space + ;; "M-SPC M-SPC" #'insert-zero-width-space "C-c C-l" #'org-insert-link-dwim "C-c w" #'chd/do-the-thing "C-c C-n" #'acdw/org-next-heading-widen @@ -2216,40 +2230,15 @@ browser defined in `browse-url-secondary-browser-function'." #'org-export-remove-zero-width-spaces)) (:local-hook before-save-hook - (defun org/before-save@fix-blank-lines () - (acdw-org/fix-blank-lines t)) - before-save-hook - (defun org/before-save@align-tags () + (defun org/before-save@prettify-buffer () + (run-with-idle-timer 1 nil + (lambda () + (with-temp-message "Filling..." + (save-mark-and-excursion + (mark-whole-buffer) + (org-fill-paragraph nil t))))) + (acdw-org/fix-blank-lines t) (org-align-tags :all))) - - (:hook ;; #'variable-pitch-mode - - ;; (defun org-mode@before-save@fill-buffer () - ;; (add-hook 'before-save-hook - ;; (defun before-save@fill-buffer () - ;; (fill-region (point-min) (point-max))) - ;; nil :local)) - - ;; This is super ugly because I need to add a function to - ;; `before-save-hook', but only in org-mode buffers. So I make a hook - ;; to make a hook. I'm sure there's a better way to do this. - ;; (defun org-mode@fix-blank-lines-on-save () - ;; (add-hook 'before-save-hook - ;; (defun acdw-org/fix-blank-lines-in-buffer () - ;; (acdw-org/fix-blank-lines t)) - ;; 0 :local)) - - ;; (defun org-mode@wc-stupid () - ;; (unless (and wc-mode - ;; (> 0 (+ (or wc-orig-words 0) - ;; (or wc-words-delta 0))))) - ;; (setq-local - ;; wc-count-words-function - ;; (lambda (start end) "Count words stupidly with a limit." - ;; (acdw-org/count-words-stupidly start - ;; end - ;; 999)))) - ) (with-eval-after-load 'org (org-clock-persistence-insinuate)) @@ -2708,16 +2697,16 @@ If used with a numeric prefix argument N, N backticks will be inserted." (setup (:straight wgrep) (wgrep-setup)) -(setup (:straight which-key) - (:option which-key-show-early-on-C-h t - which-key-idle-delay 1 - which-key-idle-secondary-delay 0.5 - which-key-sort-order 'which-key-prefix-then-key-order) +;; (setup (:straight which-key) +;; (:option which-key-show-early-on-C-h t +;; which-key-idle-delay 1 +;; which-key-idle-secondary-delay 0.5 +;; which-key-sort-order 'which-key-prefix-then-key-order) - (:global "C-h m" #'which-key-show-major-mode) - - (which-key-setup-side-window-right-bottom) - (which-key-mode +1)) +;; (:global "C-h m" #'which-key-show-major-mode) + +;; (which-key-setup-side-window-right-bottom) +;; (which-key-mode +1)) (setup (:straight whitespace-cleanup-mode) (global-whitespace-cleanup-mode +1)) diff --git a/lisp/acdw-circe.el b/lisp/acdw-circe.el index 4ff3fdf..73b1cdf 100644 --- a/lisp/acdw-circe.el +++ b/lisp/acdw-circe.el @@ -98,8 +98,8 @@ message the current topic." (with-circe-server-buffer (dolist (buf (circe-server-chat-buffers)) (let ((circe-channel-killed-confirmation nil)) - (kill-buffer buf))) - (kill-buffer)))) + (run-with-timer 0.1 nil #'kill-buffer buf))) + (run-with-timer 0.1 nil #'kill-buffer)))) (defun circe-gquit@kill-buffer (&rest _) "Advice to kill all Circe related buffers after GQUIT." @@ -111,10 +111,8 @@ message the current topic." (with-current-buffer buf (dolist (buf (circe-server-chat-buffers)) (let ((circe-channel-killed-confirmation nil)) - (kill-buffer buf)) - (cancel-timer 'irc-send--queue)) - (message "%s: %s" buf circe-server-killed-confirmation) - (kill-buffer))))) + (run-with-timer 0.1 nil #'kill-buffer buf))) + (run-with-timer 0.1 nil #'kill-buffer))))) ;;; Patches diff --git a/lisp/acdw.el b/lisp/acdw.el index 48ed19b..56b661f 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -474,12 +474,12 @@ first." (let ((extracted-heading (acdw/org-extract-heading-text)) (org-export-show-temporary-export-buffer nil) (org-export-filter-final-output-functions - '(html-body-id-filter html-body-div-filter)) - (org-export-with-smart-quotes nil) - (org-export-smart-quotes-alist nil)) + '(html-body-id-filter html-body-div-filter))) (insert "* ORG IS STUPID SOMETIMES\n") (goto-char (point-min)) - (org-html-export-as-html nil t nil t) + (org-html-export-as-html nil t nil t + (list :with-smart-quotes nil + :with-special-strings t)) (with-current-buffer "*Org HTML Export*" (goto-char (point-min)) (replace-regexp "

.*

" "") @@ -498,13 +498,15 @@ first." nil) (defun acdw/org-export-copy () - "copy a tree" + "Copy a tree as ASCII." (interactive) (require 'ox-ascii) (let ((extracted-heading (acdw/org-extract-heading-text))) ;; Export to ASCII - not async, subtree only, visible-only, body-only (let ((org-export-show-temporary-export-buffer nil)) - (org-ascii-export-as-ascii nil t nil t)) + (org-ascii-export-as-ascii nil t nil t + (list :with-smart-quotes t + :with-special-strings t))) (with-current-buffer "*Org ASCII Export*" (goto-char (point-min)) (insert extracted-heading) diff --git a/lisp/chd.el b/lisp/chd.el index e1d96cb..c6efad0 100644 --- a/lisp/chd.el +++ b/lisp/chd.el @@ -3,6 +3,19 @@ (require 'acdw-org) (require 'org) +(defvar chd/dir (acdw/sync-dir "Click Here Digital/") + "Where Click Here stuff is stored.") + +(defun chd/dir (file &optional make-directory) + "Expand FILE relative to variable `chd/dir'. +If MAKE-DIRECTORY is non-nil, ensure the file's +containing directory exists." + (let ((file-name (expand-file-name (convert-standard-filename file) + chd/dir))) + (when make-directory + (make-directory (file-name-directory file-name) :parents)) + file-name)) + (defun chd/narrow-to-task (&optional point) "Narrow the buffer to the task POINT is in." (interactive "d") @@ -40,14 +53,6 @@ (org-back-to-heading) (org-open-at-point))) -(defun chd/click-bits (date) - "Create a new Click Bits org file, or edit the one for DATE." - (interactive (list (progn - (require 'org) - (org-read-date)))) - ;; TODO: implement actual logic. - (message "%s" date)) - (defun chd/insert-client () "Insert the current client at point." (interactive) @@ -56,6 +61,14 @@ (beep) (user-error "No client found in current subtree"))) +;;; Click Bits! +(require 'acdw-autoinsert) +(require 'acdw) +(require 'private (acdw/sync-dir "private")) +(acdw/define-auto-insert '(:replace t) + (cons (chd/dir "Click Bits" t) "Click Bits!") + chd/click-bits-skeleton) + ;;; NOTES ;; org-protocol: https://orgmode.org/worg/org-contrib/org-protocol.html ;; the bit i wanna pull from TaskIQ: 'document.getElementById("preview") -- cgit 1.4.1-21-gabe81