From fcd47a9c3a10b6028045773ff5b197a080ac345c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:23:02 -0500 Subject: meh --- init.el | 121 ++++++++++++++++++++++++++++++++++++---------------- lisp/+browse-url.el | 6 +-- lisp/+consult.el | 2 +- lisp/+dired.el | 23 +++++----- lisp/+init.el | 9 ++-- lisp/+jabber.el | 12 ++++++ lisp/+key.el | 6 +-- lisp/+org.el | 13 ------ 8 files changed, 119 insertions(+), 73 deletions(-) diff --git a/init.el b/init.el index 4c0c4b0..206ba45 100644 --- a/init.el +++ b/init.el @@ -14,6 +14,14 @@ ;; - Be kind to yourself. ;; - Make good choices. +;;; Commentary + +;; My init.el. There are many like it, but this one is mine. + +;; Ideas: +;; [[https://emacs.stackexchange.com/questions/17278/truncate-only-certain-lines-and-use-continuation-lines-elsewhere][Truncate org-mode headings]] +;; [[https://emacs.stackexchange.com/questions/7432/make-visual-line-mode-more-compatible-with-org-mode][another link that might be useful for truncating]] + ;;; Code: (let ((early-features `((early-init . ,(locate-user-emacs-file "early-init")) @@ -104,6 +112,8 @@ (:with-mode Custom-mode (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) +(setup (:require find-script)) + (setup (:require goto-addr) (if (fboundp #'global-goto-address-mode) (global-goto-address-mode) @@ -242,17 +252,15 @@ (:option +browse-url-transformations `((,(rx (or "youtube.com" "youtu.be")) . ,+invidious-host) - ("twitter\\.com" - . "nitter.net") - ("instagram\\.com" - . "bibilogram.art") + ("twitter\\.com" . "nitter.net") + ("instagram\\.com" . "bibilogram.art") (,(rx (or "reddit.com" "old.reddit.com")) . "teddit.net") - ("medium\\.com" - . "scribe.rip") - ("www\\.npr\\.org" - . "text.npr.org"))) + ("medium\\.com" . "scribe.rip") + ("www\\.npr\\.org" . "text.npr.org") + ;;TODO: Various paste sites + )) (+browse-url-transform-url-global-mode +1)) (setup calendar @@ -458,7 +466,8 @@ '(context-menu-ffap context-menu-region context-menu-undo - context-menu-dictionary)) + ;; context-menu-dictionary + )) (context-menu-mode +1)) (dolist (click '(;; Fix scrolling in the margin wheel-down double-wheel-down triple-wheel-down @@ -467,9 +476,25 @@ (global-set-key (vector 'left-margin click) 'mwheel-scroll))) (setup net-utils + (:needs "traceroute") (:require +finger) ; fixes `finger' to use var below (:option finger-X.500-host-regexps '(".") ; only send username - )) + ) + (require 'transient) + (transient-define-prefix net-utils () + "Networking utilities" + ["Actions" + ("p" "Ping" ping) + ("i" "Ifconfig" ifconfig) + ("w" "Iwconfig" iwconfig) + ("n" "Netstat" netstat) + ("a" "Arp" arp) + ("r" "Route" route) + ("h" "Nslookup host" nslookup-host) + ("d" "Dig" dig) + ("s" "Smb Client" smbclient) + ("t" "Traceroute" traceroute)]) + (:+key "C-z M-n" #'net-utils)) (setup notmuch (:load-from "~/usr/share/emacs/site-lisp/") @@ -558,7 +583,7 @@ org-fontify-done-headline t org-fontify-quote-and-verse-blocks t org-fontify-whole-heading-line t - org-hide-emphasis-markers t + org-hide-emphasis-markers nil org-html-coding-system 'utf-8-unix org-image-actual-width (list (* (window-font-width) (- fill-column 8))) @@ -617,7 +642,15 @@ "C-c C-p" #'+org-previous-heading-widen "C-c C-o" #'+org-open-at-point-dwim "`" #'+org-insert-tilde - "~" #'+org-insert-backtick) + "~" #'+org-insert-backtick + "C-c C-x l" #'org-toggle-link-display + "C-c C-x m" (lambda () (interactive) + (setq-local org-hide-emphasis-markers + (not org-hide-emphasis-markers)) + (font-lock-update)) + "C-c C-x r" #'+org-drawer-list-add-resource + "C-M-k" #'kill-paragraph + "C-M-t" #'transpose-paragraphs) (:global [f8] #'org-clock-in [f9] #'org-clock-out "C-c l" #'org-store-link) @@ -629,6 +662,12 @@ (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) ("SCHEDULED:" . ?↷) ("CLOSED:" . ?✓)) + ;; electric-pair-pairs + ;; (append electric-pair-pairs + ;; (mapcar (lambda (emph) + ;; (let ((ch (string-to-char (car emph)))) + ;; (cons ch ch))) + ;; org-emphasis-alist)) ;;+modeline-position-function #'+org-count-words-stupidly ) (:local-hook user-save-hook #'+org-before-save@prettify-buffer) @@ -646,6 +685,9 @@ (org-link-set-parameters "sms" :follow #'+org-sms-open) (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) #'+org-open-html)) + (:face 'org-done '((t (:inherit (modus-themes-subtle-green)))) + 'org-tag '((t (:inherit (secondary-selection)))) + 'org-todo '((t (:inherit (modus-themes-subtle-red))))) ;; Extra keywords (font-lock-add-keywords 'org-mode @@ -1158,10 +1200,6 @@ (:hook #'visual-line-mode #'enable-lui-track #'visual-fill-column-mode - (defun +disable-electric-pair-mode () - "Disable `electric-pair-mode' in the current buffer." - (interactive) - (electric-pair-local-mode -1)) #'enable-lui-autopaste) (:local-set fringes-outside-margins t right-margin-width (length lui-time-stamp-format) @@ -1178,6 +1216,7 @@ (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands) '(flat)))) + (tracking-mode +1) (:with-mode tracking-mode (:option tracking-position 'before-modes) (:bind "C-c C-SPC" (lambda () (interactive) @@ -1295,19 +1334,20 @@ (with-eval-after-load 'vertico-multiform (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) (dolist (buf-cmd '(consult-find - consult-yank-pop - consult-locate - consult-grep + consult-flymake + consult-focus-lines consult-git-grep - consult-ripgrep + consult-grep + consult-imenu + consult-imenu-multi + consult-keep-lines consult-line consult-line-multi + consult-locate consult-multi-occur - consult-keep-lines - consult-focus-lines - consult-imenu - consult-imenu-multi - consult-outline)) + consult-outline + consult-ripgrep + consult-yank-pop)) (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) (setup (:straight consult-dir) @@ -1505,6 +1545,11 @@ (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) (setup (:straight embrace) + (dolist (mode '(LaTeX-mode org-mode ruby-mode)) + (add-hook (intern (format "%s-hook" mode)) + (intern (format "embrace-%s-hook" mode)))) + (:face 'embrace-help-pair-face '((t ( :inverse-video nil + :inherit font-lock-keyword-face)))) (:+key "C-," #'embrace-commander)) (setup (:straight (ement @@ -1611,7 +1656,7 @@ (setup (:straight (forge :host github :repo "magit/forge") (eq system-type 'gnu/linux)) - (require 'forge) + (:quit) ; XXX: Somehow missing compat-26 (add-to-list 'forge-alist '("tildegit.org" "tildegit.org/api/v1" "tildegit.org" forge-gitea-repository))) @@ -1624,6 +1669,7 @@ (setup (:straight (frowny :host github :repo "duckwork/frowny.el")) + (:option frowny-eyes (rx (any ":=") (opt "'") (? "-"))) (global-frowny-mode +1)) (setup (:straight gcmh) @@ -1749,9 +1795,6 @@ :fork ( :host nil :repo "https://codeberg.org/acdw/emacs-jabber"))) (:also-load +jabber) - (defvar +jabber-ws-prefix 0 "Width to pad left side of chats.") - (defvar +jabber-pre-prompt " \n" - "String to show before a prompt.") (:option jabber-account-list '(("acdw@hmm.st")) jabber-groupchat-buffer-format "%n" jabber-chat-buffer-format "%n" @@ -1760,7 +1803,7 @@ jabber-muc-decorate-presence-patterns '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") ("." . jabber-muc-presence-dim)) - jabber-muc-colorize-foreign t + jabber-muc-colorize-foreign nil ; colorizing doesn't match my color theme jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt "[%t] %n\n" (make-string +jabber-ws-prefix @@ -1794,7 +1837,6 @@ jabber-console-mode)) (let ((hook (intern (format "%s-hook" mode)))) (add-hook hook #'visual-fill-column-mode))) - (add-hook 'jabber-activity-mode-hook #'tracking-mode) (with-eval-after-load 'tracking (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) (:with-mode jabber-chat-mode @@ -1888,6 +1930,7 @@ (setup (:straight mastodon) (:option mastodon-instance-url "https://tiny.tilde.website" + mastodon-active-user "acdw" mastodon-client--token-file (.etc "mastodon.plstore") mastodon-auth-source-file (seq-some (lambda (i) (when (and (stringp i) @@ -2016,7 +2059,7 @@ (:option completion-styles '(substring orderless basic) completion-category-defaults nil completion-category-overrides - '((file (styles partial-completion)) + '((file (styles basic partial-completion)) (command (styles +orderless-with-initialism)) (variable (styles +orderless-with-initialism)) (symbol (styles +orderless-with-initialism))) @@ -2056,6 +2099,7 @@ (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) (setup (:straight org-modern) + (:quit "I think I can do most of this myself.") (:option org-modern-hide-stars nil org-modern-star nil org-modern-list nil @@ -2081,7 +2125,9 @@ (org-visibility-enable-hooks)) (setup (:straight orglink) - (global-orglink-mode +1)) + (:option orglink-activate-in-modes '(text-mode prog-mode)) + (global-orglink-mode +1) + (global-goto-address-mode -1)) (setup (:straight package-lint)) @@ -2126,7 +2172,7 @@ (executable-find "g++"))) (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal) #'pdf-view-mode) - (pdf-tools-install)) + (pdf-tools-install t)) (setup (:straight (plancat :host github @@ -2210,6 +2256,8 @@ (:also-load +slack) (:option slack-prefer-current-team t slack-buffer-emojify t + slack-thread-also-send-to-room nil + slack-typing-visibility 'buffer slack-buffer-create-on-notify t slack-enable-wysiwyg t slack-file-dir (xdg-user-dir "DOWNLOAD") @@ -2243,7 +2291,8 @@ (sophomore-enable #'narrow-to-region) (sophomore-disable ; These are mostly annoying commands #'view-hello-file - #'describe-gnu-project) + #'describe-gnu-project + #'suspend-frame) (sophomore-mode +1)) (setup (:straight ssh-config-mode) @@ -2257,7 +2306,7 @@ (setup (:straight super-save) (:option auto-save-default nil super-save-auto-save-when-idle t - super-save-idle-duration 60 + super-save-idle-duration 30 super-save-exclude '(".gpg") super-save-remote-files nil) (auto-save-visited-mode -1) diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index dbbfef2..fc479e4 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el @@ -120,9 +120,9 @@ ARGS are ignored here, but passed on for later processing." ;; along with the rest of the args, in a list to the original caller (probably ;; `browse-url'.) (apply 'list - (cl-loop with url = (substring-no-properties - (if (consp url) (car url) url)) - for (regex . transformation) in +browse-url-transformations + (cl-loop with url = (substring-no-properties + (if (consp url) (car url) url)) + for (regex . transformation) in +browse-url-transformations if (string-match regex url) return (replace-match transformation nil nil url) ;; else diff --git a/lisp/+consult.el b/lisp/+consult.el index dc06ad5..21c2565 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el @@ -5,7 +5,7 @@ (defun +consult-project-root () "Return either the current project, or the VC root, of current file." (if (and (functionp 'project-current) - (project-current)) + (project-current)) (car (project-roots (project-current))) (vc-root-dir))) diff --git a/lisp/+dired.el b/lisp/+dired.el index 9a2e01a..2e42c19 100644 --- a/lisp/+dired.el +++ b/lisp/+dired.el @@ -2,18 +2,17 @@ ;;; Code: -(require 'vertico) - -(defun +dired-goto-file (file) - "ADVICE for `dired-goto-file' to make RET call `vertico-exit'." - (interactive ; stolen from `dired-goto-file' - (prog1 - (list (dlet ((vertico-map (copy-keymap vertico-map))) - (define-key vertico-map (kbd "RET") #'vertico-exit) - (expand-file-name (read-file-name "Goto file: " - (dired-current-directory))))) - (push-mark))) - (dired-goto-file file)) +(with-eval-after-load 'vertico + (defun +dired-goto-file (file) + "ADVICE for `dired-goto-file' to make RET call `vertico-exit'." + (interactive ; stolen from `dired-goto-file' + (prog1 + (list (dlet ((vertico-map (copy-keymap vertico-map))) + (define-key vertico-map (kbd "RET") #'vertico-exit) + (expand-file-name (read-file-name "Goto file: " + (dired-current-directory))))) + (push-mark))) + (dired-goto-file file))) ;;; [[https://www.reddit.com/r/emacs/comments/u2lf9t/weekly_tips_tricks_c_thread/i4n9aoa/?context=3][Dim files in .gitignore]] diff --git a/lisp/+init.el b/lisp/+init.el index 8f999f9..a3f680b 100644 --- a/lisp/+init.el +++ b/lisp/+init.el @@ -72,11 +72,10 @@ are sorted lexigraphically." ;; otherwise, sort lexigraphically (t (string< s1 s2))))))))) ;; Return to original point relative to the defun we were in - (goto-char (point-min)) - (re-search-forward current-defun-re) - (beginning-of-defun) - (goto-char (+ (point) defun-point)) - )) + (ignore-errors (goto-char (point-min)) + (re-search-forward current-defun-re) + (beginning-of-defun) + (goto-char (+ (point) defun-point))))) (defun +init-sort-then-save () "Sort init.el, then save it." diff --git a/lisp/+jabber.el b/lisp/+jabber.el index c5d568c..e018b0c 100644 --- a/lisp/+jabber.el +++ b/lisp/+jabber.el @@ -10,6 +10,18 @@ (require 'jabber) (require 'tracking) +(defgroup +jabber nil + "Extra jabber.el customizations." + :group 'jabber) + +(defcustom +jabber-ws-prefix 0 + "Width to pad left side of chats." + :type 'string) + +(defcustom +jabber-pre-prompt " \n" + "String to put before the prompt." + :type 'string) + (defvar +jabber-tracking-show-p #'jabber-activity-show-p-default "Function that checks if the given JID should be shown in the mode line. This does the same as `jabber-activity-show-p', but for the diff --git a/lisp/+key.el b/lisp/+key.el index ad3b215..a217dad 100644 --- a/lisp/+key.el +++ b/lisp/+key.el @@ -19,9 +19,9 @@ ;; I need to define this map before the proper mode map. (defvar +key-leader-map (let ((map (make-sparse-keymap)) - (c-z (global-key-binding "\C-z"))) - (define-key map "\C-z" c-z) - map) + (c-z (global-key-binding "\C-z"))) + ;;(define-key map "\C-z" c-z) + map) "A leader keymap under the \"C-z\" bind.") ;; http://xahlee.info/emacs/emacs/emacs_menu_app_keys.html and diff --git a/lisp/+org.el b/lisp/+org.el index 252ee55..6075b60 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -588,19 +588,6 @@ and POST-PROCESS are passed to `org-export-to-file'." ("—" "---")))) (replace-match replace nil nil))))) -;;; Toggle org-hide-emphasis-markers - -(define-minor-mode +org-show-mode - "Show emphasis markers and full links in `org-mode'." - :lighter "/*/" - (setq org-hide-emphasis-markers (not +org-show-mode) - org-link-descriptive (not +org-show-mode)) - (funcall (if +org-show-mode - #'remove-from-invisibility-spec - #'add-to-invisibility-spec) - '(org-link)) - (font-lock-update)) - ;;; go forward and backward in the tree, ~ cleanly ~ ;; https://stackoverflow.com/a/25201697/10756297 -- cgit 1.4.1-21-gabe81