From cd44a56c33ce6599f90f82d2ab53d5fe6bd94777 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Thu, 13 Apr 2023 22:56:45 -0800 Subject: [PATCH] Move broken/unused code into obsolete.el to rot --- lisp/mitch-packages.el | 321 +++++------------------------------------ lisp/obsolete.el | 198 +++++++++++++++++++++++++ 2 files changed, 232 insertions(+), 287 deletions(-) create mode 100644 lisp/obsolete.el diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index 75cd943..8de6d34 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -64,26 +64,6 @@ (turn-off-line-numbers) (blink-cursor-mode -1)) -;; scribble SVGs in org buffers like it's 2005 (idk I was a baby then) -(use-package edraw - :elpaca (:repo "https://github.com/misohena/el-easydraw") - :after org - :config - (require 'edraw-org) - (edraw-org-setup-default) - ;; following function taken from https://github.com/wn/doom.d/blob/46ca46f2ef21e933fb76b1568be1a62b262ed288/config.el#L47 - (defun org-mode-open-edraw (&optional filename) - (interactive) - (let ((filename (or filename - (concat "./" - (file-relative-name - (read-file-name (edraw-msg "Write svg file: ") - default-directory) - default-directory))))) - (insert (format "[[edraw:file=%s]]" filename)) - (backward-char) - (org-return)))) - ;; diminish (use-package diminish) @@ -570,44 +550,6 @@ targets." (line-number-at-pos (point-max)))))) (add-hook 'minibuffer-exit-hook #'mitch/nlinum-buffer-setup)) -;; broken terminal that doesn't compile but at least it's fast when it does -(use-package vterm - :custom - (vterm-always-compile-module t) - (vterm-module-cmake-args "-DUSE_SYSTEM_LIBVTERM=no") - (vterm-clear-scrollback-when-clearing t) - :config - (evil-collection-define-key 'insert 'vterm-mode-map - (kbd "C-w") 'evil-window-map) - (evil-collection-define-key 'normal 'vterm-mode-map - (kbd "RET") 'hkey-either - (kbd "k") 'vterm-send-up - (kbd "j") 'vterm-send-down) - (add-to-list 'vterm-keymap-exceptions - "C-w") - (add-to-list 'vterm-keymap-exceptions - "RET") - (setq mitch/vterm-eval-cmds-strings - '("update-pwd" - "restart-emacs" - "find-file-other-window" - "find-file-other-frame" - "eshell/emacs" - "eshell/man" - "dirvish" - "magit" - "info-other-window" - "add-vterm-eval-cmd")) - (defun add-vterm-eval-cmd (function) - "Add FUNCTION to `vterm-eval-cmds' so it can be ran through sh in vterm." - (add-to-list 'vterm-eval-cmds - (list function (intern function)))) - (dolist (emacs-function mitch/vterm-eval-cmds-strings) - (add-vterm-eval-cmd emacs-function)) - :hook - (vterm-mode . mitch/terminal-setup) - (vterm-exit-functions . save-buffers-kill-terminal)) - ;; Better modeline? Better modeline. (use-package powerline :custom @@ -656,44 +598,11 @@ targets." (mitch/visual-setup) (load-theme 'airline-ravenpower t) :init (load-theme 'sv t)) -;; (use-package doom-themes -;; :config (mitch/visual-setup) -;; (load-theme 'airline-ravenpower t) -;; :init (load-theme 'doom-acario-dark t)) (use-package page-break-lines :diminish :hook (emacs-lisp-mode . page-break-lines-mode)) -(use-package yascroll - :diminish - :defer 1 - ;; :if (not (display-graphic-p)) - :custom (yascroll:delay-to-hide nil) - ;; :custom-face - ;; (yascroll:thumb-fringe - ;; ((t (:background "green3")))) - :config - (defun yascroll:make-thumb-overlay-fringe (left-or-right) - "Make thumb overlay on the LEFT-OR-RIGHT fringe." - (let* ((pos (point)) - ;; If `pos' is at the beginning of line, overlay of the - ;; fringe will be on the previous visual line. - (pos (if (= (line-end-position) pos) pos (1+ pos))) - ;; below originally said `filled-rectangle' instead of `empty-line'. - ;; Changed to fix transparency. - (display-string `(,left-or-right empty-line yascroll:thumb-fringe)) - (after-string (propertize "." 'display display-string)) - (overlay (make-overlay pos pos))) - (overlay-put overlay 'after-string after-string) - (overlay-put overlay 'fringe-helper t) - (overlay-put overlay 'window (selected-window)) - (overlay-put overlay 'priority yascroll:priority) - overlay)) - (add-to-list 'yascroll:disabled-modes 'org-mode) - ;; (global-yascroll-bar-mode 1) - ) - ;; parentheses settingses (elpaca (paredit :depth nil) (use-package paredit @@ -729,29 +638,13 @@ targets." ;; (org-startup-indented t) ;; (org-hide-emphasis-markers t) (inhibit-compacting-font-caches t) - (org-element-use-cache nil) + ;; (org-element-use-cache nil) :config (add-hook 'after-save-hook (lambda () (if (equal major-mode 'org-mode) (org-babel-tangle)))) (make-local-variable 'completion-at-point-functions) (add-to-list 'completion-at-point-functions #'cape-ispell) - (remove '(?< . ?>) electric-pair-pairs) - (electric-pair-mode -1) - (defvar org-electric-pairs '((?_ . ?_) - (?/ . ?/) - (?* . ?*) - (?+ . ?+) - (?~ . ?~) - (?= . ?=)) - "Electric pairs for org-mode. - -See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode-specific-pairs-for-electric-pair-mode") - ;; (defun org-add-electric-pairs () - ;; (setq-local electric-pair-pairs (append electric-pair-pairs org-electric-pairs)) - ;; (setq-local electric-pair-text-pairs electric-pair-pairs)) - ;; (add-hook 'org-mode-hook 'org-add-electric-pairs) - (require 'mitch-orgstuff) (defun insert-zws () (interactive) (insert 8203)) ; this is a Zero Width Space. It makes things confusing. @@ -778,104 +671,47 @@ See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode :timeout 0.1 "SPC" 'insert-zws "i" 'insert-ï)) - (general-define-key - :states '(normal visual insert) - :keymaps 'org-mode-map - "_" 'mitch/org-dwim-char - "/" 'mitch/org-dwim-char - "*" 'mitch/org-dwim-char - "+" 'mitch/org-dwim-char - "~" 'mitch/org-dwim-char - "=" 'mitch/org-dwim-char) (general-define-key :states 'normal :keymaps 'org-src-mode-map "ZZ" 'org-edit-src-exit)) -(use-package org-modern-indent - :elpaca (:host github :repo "jdtsmith/org-modern-indent") - :diminish org-indent-mode - :hook (org-mode . org-indent-mode) - :config (add-hook 'org-mode-hook #'org-modern-indent-mode 90)) -(use-package org-block-capf - :elpaca (org-block-capf - :host github - :repo "xenodium/org-block-capf") - :after org - :init (add-hook 'org-mode-hook - #'org-block-capf-add-to-completion-at-point-functions)) - -(use-package org-tempo - :elpaca nil - :after org - :config - (add-to-list 'org-structure-template-alist '("sh" . "src shell")) - (add-to-list 'org-structure-template-alist '("el" . "src elisp")) - (add-to-list 'org-structure-template-alist '("html" . "src html"))) -;; (use-package org-variable-pitch +;; (use-package ox-hugo ;; :after org -;; :if (display-graphic-p) -;; :diminish (buffer-face-mode org-variable-pitch-minor-mode) -;; :custom-face (org-meta-line -;; ((nil (:inherit -;; (font-lock-comment-delimiter-face fixed-pitch))))) -;; :hook (org-mode . org-variable-pitch-minor-mode)) -;; (use-package org-appear -;; :hook (org-mode . org-appear-mode) -;; :after org -;; :custom -;; (org-appear-autolinks t) -;; (org-appear-autoemphasis t) -;; (org-appear-autoentities t) -;; (org-appear-autokeywords t) -;; (org-appear-autosubmarkers t)) -(use-package org-pretty-table - :elpaca (org-pretty-table - :host github - :repo "Fuco1/org-pretty-table") - :diminish - :hook (org-mode . org-pretty-table-mode)) -(use-package ox-hugo - :after org - :config - (defun hugo-dir-above (dir) - "Return path of Hugo project root above or at DIR. -Return nil if DIR is not in a hugo project at all." - (let ((thisdir dir)) - (let ((lexical-binding t)) - (if (eq thisdir nil) nil - (if (file-exists-p (expand-file-name "config.toml" thisdir)) - thisdir - (let ((updir (file-name-directory (string-trim-right thisdir "/")))) - (hugo-dir-above updir))))))) - ;; (hugo-dir-above "~/.local/git/mitchmarq42.github.io/content-org/") - (defun hugo-compile (&optional dir) - (interactive) - (if (bound-and-true-p dir) nil - (setq dir default-directory)) - (let ((hugo-dir (hugo-dir-above dir))) - (if hugo-dir - (progn - (if (string-match-p (rx bol (* any) "/content-org" (opt "/") eol) - default-directory) - (org-hugo-export-wim-to-md)) - (let* ((default-directory hugo-dir) - (buffer (get-buffer-create "*hugo*"))) - (with-current-buffer buffer - ;; (compilation-mode) - (let* ((inhibit-read-only t) - (status-code (call-process-shell-command "hugo" nil buffer))) - (if (zerop status-code) - (message "Hugo re-generated!") - (error "Hugo exited %s, better change something!" status-code))))))))) - (add-hook 'after-save-hook #'hugo-compile)) +;; :config +;; (defun hugo-dir-above (dir) +;; "Return path of Hugo project root above or at DIR. +;; Return nil if DIR is not in a hugo project at all." +;; (let ((thisdir dir)) +;; (let ((lexical-binding t)) +;; (if (eq thisdir nil) nil +;; (if (file-exists-p (expand-file-name "config.toml" thisdir)) +;; thisdir +;; (let ((updir (file-name-directory (string-trim-right thisdir "/")))) +;; (hugo-dir-above updir))))))) +;; ;; (hugo-dir-above "~/.local/git/mitchmarq42.github.io/content-org/") +;; (defun hugo-compile (&optional dir) +;; (interactive) +;; (if (bound-and-true-p dir) nil +;; (setq dir default-directory)) +;; (let ((hugo-dir (hugo-dir-above dir))) +;; (if hugo-dir +;; (progn +;; (if (string-match-p (rx bol (* any) "/content-org" (opt "/") eol) +;; default-directory) +;; (org-hugo-export-wim-to-md)) +;; (let* ((default-directory hugo-dir) +;; (buffer (get-buffer-create "*hugo*"))) +;; (with-current-buffer buffer +;; ;; (compilation-mode) +;; (let* ((inhibit-read-only t) +;; (status-code (call-process-shell-command "hugo" nil buffer))) +;; (if (zerop status-code) +;; (message "Hugo re-generated!") +;; (error "Hugo exited %s, better change something!" status-code))))))))) +;; (add-hook 'after-save-hook #'hugo-compile)) (use-package ox-clip :commands ox-clip-formatted-copy) -;; fake indentation, other than the other fake indentation -;; (use-package adaptive-wrap -;; :custom (adaptive-wrap-extra-indent 2) -;; :hook (org-mode . adaptive-wrap-prefix-mode)) - ;; cheaty key popups (use-package which-key :diminish @@ -915,14 +751,6 @@ Return nil if DIR is not in a hugo project at all." :init (defun corfu/lsp-mode-setup-completion () (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) '(flex)))) -;; Tree-sitter (disabled because broken?) -;; (use-package treesit-auto -;; :elpaca (treesit-auto -;; :host github -;; :repo "renzmann/treesit-auto") -;; :custom (treesit-auto-install 'prompt) -;; ;; :init (add-to-list 'treesit-auto-fallback-alist '(bash-ts-mode . sh-mode)) -;; ) ;; broken snippets I don't care about... (use-package yasnippet @@ -989,11 +817,6 @@ Return nil if DIR is not in a hugo project at all." ((nil (:background "#afafaf" :extend t))))) ;; epic drop-down completion -;; (use-package company -;; :diminish -;; :custom ;(company-require-match nil) -;; (company-tooltip-align-annotations t) -;; :hook (prog-mode . company-mode)) (use-package corfu :elpaca (:files (:defaults "extensions/*.el")) ;; :if (display-graphic-p) ; breaks in emacsclient @@ -1215,23 +1038,6 @@ Return nil if DIR is not in a hugo project at all." :elpaca nil :custom (kkc-init-file-name (expand-file-name "kkcrc" backup-directory))) -;; see https://www.reddit.com/r/emacs/comments/xyo2fo/orgmode_vterm_tmux/ -(use-package ob-tmux - :after (org dash) - :config - (setq org-src-lang-modes (-replace - '("tmux" . sh) - '("tmux" . powershell) - org-src-lang-modes)) - :custom - (org-babel-default-header-args:tmux - '((:results . "display") - (:session . "default") - (:socket . nil))) - (org-babel-tmux-session-prefix "ob-") - (org-babel-tmux-terminal "/home/mitch/.local/bin/emacs-term-shim.sh") - (org-babel-tmux-terminal-opts)) - (use-package dwim-shell-command :elpaca (dwim-shell-command :files (:defaults "dwim-shell-commands.el")) @@ -1294,42 +1100,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html" (guid (seq uuid))) (rxt-elisp-to-pcre (rx ,@expressions))))) -;; (use-package org-modern -;; :after org -;; :custom -;; (org-modern-tag nil) -;; (org-modern-todo nil) -;; (org-modern-block-name nil) -;; (org-modern-table nil) -;; (org-modern-hide-stars nil) -;; (org-modern-star nil) -;; ;; (org-modern-block-fringe 16) -;; :hook (org-mode . org-modern-mode) -;; :config -;; ) - -;; svg-tags; disabled because reasons -;; (use-package svg-tag-mode -;; :elpaca (svg-tag-mode -;; :host github -;; :repo "rougier/svg-tag-mode") -;; ;; :after org-modern -;; :hook (org-modern-mode . svg-tag-mode) -;; :custom (svg-tag-tags -;; `((,(rx blank (group (= 4 upper)) blank) . -;; ((lambda (tag) -;; (svg-tag-make tag -;; :inverse t -;; :face (intern -;; (format "org-%s" (downcase tag))))))) -;; (,(rx (group "#+" (or "begin" "end") "_src")) . -;; ((lambda (tag) -;; (let* ((begend (string-trim tag "#\\+" "_src")) -;; (upcased (upcase begend))) -;; (svg-tag-make upcased -;; :face 'org-block-begin-line))))))) -;; ) - (use-package haskell-mode) (use-package yuck-mode) @@ -1338,29 +1108,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html" :repo "WammKD/Emacs-Klondike") :commands klondike) -;; disabled because error and useless -;; (use-package aggressive-indent -;; :after paredit -;; :commands aggressive-indent-mode -;; :hook (emacs-lisp-mode . aggresssive-indent-mode)) - -;; disabled because it breaks things and I don't care -(use-package perspective - :init (persp-mode) - :custom - (persp-suppress-no-prefix-key-warning t) - (persp-show-modestring nil) - ;; :config - ;; (consult-customize consult--source-buffer :hidden t :default nil) - ;; (add-to-list 'consult-buffer-sources persp-consult-source) - ) -(use-package perspective-tabs - :elpaca (perspective-tabs - :host sourcehut - :repo "woozong/perspective-tabs") - :after perspective - :init (perspective-tabs-mode +1)) - (use-package empv :after embark :custom diff --git a/lisp/obsolete.el b/lisp/obsolete.el new file mode 100644 index 0000000..9f25cfa --- /dev/null +++ b/lisp/obsolete.el @@ -0,0 +1,198 @@ +;;; obsolete.el --- code I don't use anymore -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 mitch + +;; Author: mitch +;; Keywords:local,maint + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; All the code here is taken from my other files. This is never meant to be +;; loaded. + +;;; Code: + +;; scribble SVGs in org buffers like it's 2005 (idk I was a baby then) +(use-package edraw + :elpaca (:repo "https://github.com/misohena/el-easydraw") + :after org + :config + (require 'edraw-org) + (edraw-org-setup-default) + ;; following function taken from https://github.com/wn/doom.d/blob/46ca46f2ef21e933fb76b1568be1a62b262ed288/config.el#L47 + (defun org-mode-open-edraw (&optional filename) + (interactive) + (let ((filename (or filename + (concat "./" + (file-relative-name + (read-file-name (edraw-msg "Write svg file: ") + default-directory) + default-directory))))) + (insert (format "[[edraw:file=%s]]" filename)) + (backward-char) + (org-return)))) + + +(use-package yascroll + :diminish + :defer 1 + ;; :if (not (display-graphic-p)) + :custom (yascroll:delay-to-hide nil) + ;; :custom-face + ;; (yascroll:thumb-fringe + ;; ((t (:background "green3")))) + :config + (defun yascroll:make-thumb-overlay-fringe (left-or-right) + "Make thumb overlay on the LEFT-OR-RIGHT fringe." + (let* ((pos (point)) + ;; If `pos' is at the beginning of line, overlay of the + ;; fringe will be on the previous visual line. + (pos (if (= (line-end-position) pos) pos (1+ pos))) + ;; below originally said `filled-rectangle' instead of `empty-line'. + ;; Changed to fix transparency. + (display-string `(,left-or-right empty-line yascroll:thumb-fringe)) + (after-string (propertize "." 'display display-string)) + (overlay (make-overlay pos pos))) + (overlay-put overlay 'after-string after-string) + (overlay-put overlay 'fringe-helper t) + (overlay-put overlay 'window (selected-window)) + (overlay-put overlay 'priority yascroll:priority) + overlay)) + (add-to-list 'yascroll:disabled-modes 'org-mode) + ;; (global-yascroll-bar-mode 1) + ) + + (remove '(?< . ?>) electric-pair-pairs) + (electric-pair-mode -1) + (defvar org-electric-pairs '((?_ . ?_) + (?/ . ?/) + (?* . ?*) + (?+ . ?+) + (?~ . ?~) + (?= . ?=)) + "Electric pairs for org-mode. + +See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode-specific-pairs-for-electric-pair-mode") + (defun org-add-electric-pairs () + (setq-local electric-pair-pairs (append electric-pair-pairs org-electric-pairs)) + (setq-local electric-pair-text-pairs electric-pair-pairs)) + (add-hook 'org-mode-hook 'org-add-electric-pairs) + (require 'mitch-orgstuff) + (general-define-key + :states '(normal visual insert) + :keymaps 'org-mode-map + "_" 'mitch/org-dwim-char + "/" 'mitch/org-dwim-char + "*" 'mitch/org-dwim-char + "+" 'mitch/org-dwim-char + "~" 'mitch/org-dwim-char + "=" 'mitch/org-dwim-char) +(use-package org-modern-indent + :elpaca (:host github :repo "jdtsmith/org-modern-indent") + :diminish org-indent-mode + :hook (org-mode . org-indent-mode) + :config (add-hook 'org-mode-hook #'org-modern-indent-mode 90)) +(use-package org-block-capf + :elpaca (org-block-capf + :host github + :repo "xenodium/org-block-capf") + :after org + :init (add-hook 'org-mode-hook + #'org-block-capf-add-to-completion-at-point-functions)) + +(use-package org-pretty-table + :elpaca (org-pretty-table + :host github + :repo "Fuco1/org-pretty-table") + :diminish + :hook (org-mode . org-pretty-table-mode)) +;; Tree-sitter (disabled because broken?) +(use-package treesit-auto + :elpaca (treesit-auto + :host github + :repo "renzmann/treesit-auto") + :custom (treesit-auto-install 'prompt) + ;; :init (add-to-list 'treesit-auto-fallback-alist '(bash-ts-mode . sh-mode)) + ) +;; see https://www.reddit.com/r/emacs/comments/xyo2fo/orgmode_vterm_tmux/ +(use-package ob-tmux + :after (org dash) + :config + (setq org-src-lang-modes (-replace + '("tmux" . sh) + '("tmux" . powershell) + org-src-lang-modes)) + :custom + (org-babel-default-header-args:tmux + '((:results . "display") + (:session . "default") + (:socket . nil))) + (org-babel-tmux-session-prefix "ob-") + (org-babel-tmux-terminal "/home/mitch/.local/bin/emacs-term-shim.sh") + (org-babel-tmux-terminal-opts)) + +(use-package org-modern + :after org + :custom + (org-modern-tag nil) + (org-modern-todo nil) + (org-modern-block-name nil) + (org-modern-table nil) + (org-modern-hide-stars nil) + (org-modern-star nil) + ;; (org-modern-block-fringe 16) + :hook (org-mode . org-modern-mode) + :config + ) + + + +;; svg-tags; disabled because reasons +(use-package svg-tag-mode + :elpaca (svg-tag-mode + :host github + :repo "rougier/svg-tag-mode") + ;; :after org-modern + :hook (org-modern-mode . svg-tag-mode) + :custom (svg-tag-tags + `((,(rx blank (group (= 4 upper)) blank) . + ((lambda (tag) + (svg-tag-make tag + :inverse t + :face (intern + (format "org-%s" (downcase tag))))))) + (,(rx (group "#+" (or "begin" "end") "_src")) . + ((lambda (tag) + (let* ((begend (string-trim tag "#\\+" "_src")) + (upcased (upcase begend))) + (svg-tag-make upcased + :face 'org-block-begin-line))))))) + ) + +;; disabled because error and useless +(use-package aggressive-indent + :after paredit + :commands aggressive-indent-mode + :hook (emacs-lisp-mode . aggresssive-indent-mode)) + + + +(error "Please don't load `obsolete.el', it's obsolete.") + +(provide 'obsolete) +;;; obsolete.el ends here + +