Move broken/unused code into obsolete.el to rot

This commit is contained in:
MitchMarq42 2023-04-13 22:56:45 -08:00
parent 3d93d13389
commit cd44a56c33
2 changed files with 232 additions and 287 deletions

View File

@ -64,26 +64,6 @@
(turn-off-line-numbers) (turn-off-line-numbers)
(blink-cursor-mode -1)) (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 ;; diminish
(use-package diminish) (use-package diminish)
@ -570,44 +550,6 @@ targets."
(line-number-at-pos (point-max)))))) (line-number-at-pos (point-max))))))
(add-hook 'minibuffer-exit-hook #'mitch/nlinum-buffer-setup)) (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. ;; Better modeline? Better modeline.
(use-package powerline (use-package powerline
:custom :custom
@ -656,44 +598,11 @@ targets."
(mitch/visual-setup) (mitch/visual-setup)
(load-theme 'airline-ravenpower t) (load-theme 'airline-ravenpower t)
:init (load-theme 'sv 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 (use-package page-break-lines
:diminish :diminish
:hook (emacs-lisp-mode . page-break-lines-mode)) :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 ;; parentheses settingses
(elpaca (paredit :depth nil) (elpaca (paredit :depth nil)
(use-package paredit (use-package paredit
@ -729,29 +638,13 @@ targets."
;; (org-startup-indented t) ;; (org-startup-indented t)
;; (org-hide-emphasis-markers t) ;; (org-hide-emphasis-markers t)
(inhibit-compacting-font-caches t) (inhibit-compacting-font-caches t)
(org-element-use-cache nil) ;; (org-element-use-cache nil)
:config :config
(add-hook 'after-save-hook (add-hook 'after-save-hook
(lambda () (if (equal major-mode 'org-mode) (lambda () (if (equal major-mode 'org-mode)
(org-babel-tangle)))) (org-babel-tangle))))
(make-local-variable 'completion-at-point-functions) (make-local-variable 'completion-at-point-functions)
(add-to-list 'completion-at-point-functions #'cape-ispell) (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 () (defun insert-zws ()
(interactive) (interactive)
(insert 8203)) ; this is a Zero Width Space. It makes things confusing. (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 :timeout 0.1
"SPC" 'insert-zws "SPC" 'insert-zws
"i" 'insert-ï)) "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 (general-define-key
:states 'normal :states 'normal
:keymaps 'org-src-mode-map :keymaps 'org-src-mode-map
"ZZ" 'org-edit-src-exit)) "ZZ" 'org-edit-src-exit))
(use-package org-modern-indent ;; (use-package ox-hugo
: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
;; :after org ;; :after org
;; :if (display-graphic-p) ;; :config
;; :diminish (buffer-face-mode org-variable-pitch-minor-mode) ;; (defun hugo-dir-above (dir)
;; :custom-face (org-meta-line ;; "Return path of Hugo project root above or at DIR.
;; ((nil (:inherit ;; Return nil if DIR is not in a hugo project at all."
;; (font-lock-comment-delimiter-face fixed-pitch))))) ;; (let ((thisdir dir))
;; :hook (org-mode . org-variable-pitch-minor-mode)) ;; (let ((lexical-binding t))
;; (use-package org-appear ;; (if (eq thisdir nil) nil
;; :hook (org-mode . org-appear-mode) ;; (if (file-exists-p (expand-file-name "config.toml" thisdir))
;; :after org ;; thisdir
;; :custom ;; (let ((updir (file-name-directory (string-trim-right thisdir "/"))))
;; (org-appear-autolinks t) ;; (hugo-dir-above updir)))))))
;; (org-appear-autoemphasis t) ;; ;; (hugo-dir-above "~/.local/git/mitchmarq42.github.io/content-org/")
;; (org-appear-autoentities t) ;; (defun hugo-compile (&optional dir)
;; (org-appear-autokeywords t) ;; (interactive)
;; (org-appear-autosubmarkers t)) ;; (if (bound-and-true-p dir) nil
(use-package org-pretty-table ;; (setq dir default-directory))
:elpaca (org-pretty-table ;; (let ((hugo-dir (hugo-dir-above dir)))
:host github ;; (if hugo-dir
:repo "Fuco1/org-pretty-table") ;; (progn
:diminish ;; (if (string-match-p (rx bol (* any) "/content-org" (opt "/") eol)
:hook (org-mode . org-pretty-table-mode)) ;; default-directory)
(use-package ox-hugo ;; (org-hugo-export-wim-to-md))
:after org ;; (let* ((default-directory hugo-dir)
:config ;; (buffer (get-buffer-create "*hugo*")))
(defun hugo-dir-above (dir) ;; (with-current-buffer buffer
"Return path of Hugo project root above or at DIR. ;; ;; (compilation-mode)
Return nil if DIR is not in a hugo project at all." ;; (let* ((inhibit-read-only t)
(let ((thisdir dir)) ;; (status-code (call-process-shell-command "hugo" nil buffer)))
(let ((lexical-binding t)) ;; (if (zerop status-code)
(if (eq thisdir nil) nil ;; (message "Hugo re-generated!")
(if (file-exists-p (expand-file-name "config.toml" thisdir)) ;; (error "Hugo exited %s, better change something!" status-code)))))))))
thisdir ;; (add-hook 'after-save-hook #'hugo-compile))
(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 (use-package ox-clip
:commands ox-clip-formatted-copy) :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 ;; cheaty key popups
(use-package which-key (use-package which-key
:diminish :diminish
@ -915,14 +751,6 @@ Return nil if DIR is not in a hugo project at all."
:init (defun corfu/lsp-mode-setup-completion () :init (defun corfu/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(flex)))) '(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... ;; broken snippets I don't care about...
(use-package yasnippet (use-package yasnippet
@ -989,11 +817,6 @@ Return nil if DIR is not in a hugo project at all."
((nil (:background "#afafaf" :extend t))))) ((nil (:background "#afafaf" :extend t)))))
;; epic drop-down completion ;; 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 (use-package corfu
:elpaca (:files (:defaults "extensions/*.el")) :elpaca (:files (:defaults "extensions/*.el"))
;; :if (display-graphic-p) ; breaks in emacsclient ;; :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 :elpaca nil
:custom (kkc-init-file-name (expand-file-name "kkcrc" backup-directory))) :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 (use-package dwim-shell-command
:elpaca (dwim-shell-command :elpaca (dwim-shell-command
:files (:defaults "dwim-shell-commands.el")) :files (:defaults "dwim-shell-commands.el"))
@ -1294,42 +1100,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(guid (seq uuid))) (guid (seq uuid)))
(rxt-elisp-to-pcre (rx ,@expressions))))) (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 haskell-mode)
(use-package yuck-mode) (use-package yuck-mode)
@ -1338,29 +1108,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
:repo "WammKD/Emacs-Klondike") :repo "WammKD/Emacs-Klondike")
:commands 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 (use-package empv
:after embark :after embark
:custom :custom

198
lisp/obsolete.el Normal file
View File

@ -0,0 +1,198 @@
;;; obsolete.el --- code I don't use anymore -*- lexical-binding: t; -*-
;; Copyright (C) 2023 mitch
;; Author: mitch <mitch@mitchmarq42.xyz>
;; 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 <https://www.gnu.org/licenses/>.
;;; 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