disabled.el 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. ;; icomplete
  2. ;; (use-package icomplete
  3. ;; :disable
  4. ;; :ensure nil
  5. ;; :demand t
  6. ;; :bind (:map icomplete-minibuffer-map
  7. ;; ("C-S-s" . kill-line)
  8. ;; ("C-j" . icomplete-forward-completions)
  9. ;; ("C-k" . icomplete-backward-completions)
  10. ;; ("DEL" . icomplete-fido-backward-updir)
  11. ;; ("M-DEL". delete-backward-char)
  12. ;; ("M-RET" . icomplete-force-complete-and-exit)
  13. ;; ("TAB" . icomplete-force-complete)
  14. ;; ("<escape>" . abort-recursive-edit)
  15. ;; ("C-;" . embark-dwim)
  16. ;; ("C-." . embark-act)
  17. ;; ("<left>" . backward-char)
  18. ;; ("<right>" . forward-char))
  19. ;; :hook (icomplete-minibuffer-setup . my/icomplete-setup-hook-func)
  20. ;; :init
  21. ;; (defun my/icomplete-setup-hook-func ()
  22. ;; (setq truncate-lines t))
  23. ;; (setq completion-ignore-case t
  24. ;; read-file-name-completion-ignore-case t
  25. ;; read-buffer-completion-ignore-case t
  26. ;; enable-recursive-minibuffers t
  27. ;; minibuffer-prompt-properties '(read-only t
  28. ;; cursor-intangible t
  29. ;; face minibuffer-prompt)
  30. ;; ;;completions-detailed t
  31. ;; icomplete-compute-delay 0
  32. ;; icomplete-scroll t)
  33. ;; (defun my/crm-indicator (args)
  34. ;; (cons (format "[CRM%s] %s"
  35. ;; (replace-regexp-in-string
  36. ;; "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
  37. ;; crm-separator)
  38. ;; (car args))
  39. ;; (cdr args)))
  40. ;; (advice-add #'completing-read-multiple :filter-args #'my/crm-indicator)
  41. ;; (defun my/marginalia-trim-right (list)
  42. ;; (cl-loop for (cand prefix suffix) in list collect
  43. ;; (list cand prefix (string-trim-right suffix))))
  44. ;; (advice-add #'marginalia--align :filter-return #'my/marginalia-trim-right)
  45. ;; :config
  46. ;; (set-face-attribute 'icomplete-selected-match nil :inherit 'region)
  47. ;; (fido-mode 1)
  48. ;; (fido-vertical-mode 1))
  49. ;; lsp-mode
  50. ;; (use-package consult-lsp)
  51. ;; (use-package lsp-mode
  52. ;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
  53. ;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
  54. ;; (lsp-mode . my/-setup-lsp-mode-buffer))
  55. ;; :init
  56. ;; (setq lsp-completion-provider :none
  57. ;; lsp-headerline-breadcrumb-enable nil
  58. ;; lsp-inlay-hint-enable nil
  59. ;; lsp-signature-doc-lines 1)
  60. ;; (defun my/-setup-lsp-mode-buffer ()
  61. ;; "Called by `lsp-mode-hook' to setup lsp-mode buffers."
  62. ;; (evil-define-key '(normal visual motion) 'local
  63. ;; "gR" #'lsp-rename
  64. ;; "gA" #'lsp-execute-code-action
  65. ;; "gs" #'consult-lsp-symbols)
  66. ;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
  67. ;; vterm
  68. ;; (use-package vterm
  69. ;; :hook (vterm-mode . with-editor-export-editor)
  70. ;; :init
  71. ;; (defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
  72. ;; "Hash table that maps project root dirs to vterm buffers.")
  73. ;; (defun my/project-vterm (prompt)
  74. ;; "Switch to or create a vterm buffer in the current projects root."
  75. ;; (interactive (list t))
  76. ;; (if-let ((proj (project-current prompt))
  77. ;; (default-directory (project-root proj)))
  78. ;; (if-let ((vterm-buff (gethash default-directory
  79. ;; my/project-vterm-hash-table))
  80. ;; ((buffer-live-p vterm-buff)))
  81. ;; (switch-to-buffer vterm-buff)
  82. ;; (puthash default-directory
  83. ;; (vterm (concat "*vterm for project " default-directory "*"))
  84. ;; my/project-vterm-hash-table))))
  85. ;; (defun my/project-vterm-or-default ()
  86. ;; "Open a vterm for the current project, otherwise, open a normal vterm."
  87. ;; (interactive)
  88. ;; (unless (my/project-vterm nil)
  89. ;; (if-let ((vterm-buff (gethash nil my/project-vterm-hash-table))
  90. ;; ((buffer-live-p vterm-buff)))
  91. ;; (switch-to-buffer vterm-buff)
  92. ;; (puthash nil (vterm vterm-buffer-name) my/project-vterm-hash-table)))))
  93. ;; ai stuff (also mostly fun)
  94. ;; (use-package ellama
  95. ;; :defer nil
  96. ;; :custom
  97. ;; (ellama-sessions-directory (no-littering-expand-var-file-name
  98. ;; "ellama-sessions"))
  99. ;; (ellama-major-mode 'markdown-mode) ;; fix text inserting at top of buffer
  100. ;; (ellama-session-file-extension "md")
  101. ;; (ellama-nick-prefix "##")
  102. ;; (ellama-keymap-prefix "C-c m")
  103. ;; :hook (ellama-session-mode . my/-ellama-startup-hook)
  104. ;; :init
  105. ;; (defun my/-ellama-startup-hook ()
  106. ;; "Hook to do stuff in llama buffers."
  107. ;; (auto-fill-mode -1)))
  108. ;; company (in buffer auto-complete)
  109. ;; (use-package company
  110. ;; :defer nil
  111. ;; :bind (("M-TAB" . company-complete)
  112. ;; ("M-<tab>" . company-complete)
  113. ;; ("C-c f" . company-files)
  114. ;; ([remap dabbrev-expand] . company-dabbrev)
  115. ;; :map prog-mode-map
  116. ;; ([remap company-dabbrev] . company-dabbrev-code))
  117. ;; :hook ((company-search-mode . my/-company-search-mode-add-lighter)
  118. ;; (sh-mode . my/-company-setup-shell-mode))
  119. ;; :config
  120. ;; (defun my/-company-setup-shell-mode ()
  121. ;; (setq-local company-backends '(company-files company-keywords
  122. ;; company-dabbrev-code)))
  123. ;; (defun my/-company-search-mode-add-lighter ()
  124. ;; (if company-search-mode
  125. ;; (cl-pushnew company-search-lighter global-mode-string :test 'equal)
  126. ;; (setq global-mode-string
  127. ;; (cl-delete company-search-lighter global-mode-string :test 'equal))))
  128. ;; (defun my/-company-set-completion-styles (oldfun &rest args)
  129. ;; (let ((completion-styles '(basic emacs21 flex)))
  130. ;; (apply oldfun args)))
  131. ;; (advice-add 'company-capf :around 'my/-company-set-completion-styles)
  132. ;; (setopt company-format-margin-function #'company-text-icons-margin
  133. ;; company-require-match nil
  134. ;; company-tooltip-align-annotations t)
  135. ;; (setq company-transformers '(company-sort-by-occurrence))
  136. ;; (global-company-mode 1))
  137. ;; (use-package company-quickhelp
  138. ;; :bind (:map company-active-map
  139. ;; ("M-h" . company-quickhelp-manual-begin))
  140. ;; :after company
  141. ;; :config
  142. ;; (company-quickhelp-mode 1)
  143. ;; (setopt company-quickhelp-delay nil))
  144. ;; (La)TeX
  145. ;; (use-package tex-mode
  146. ;; :hook ((latex-mode . eglot-ensure)
  147. ;; (tex-mode . my/-setup-tex-mode-compile-command))
  148. ;; :init
  149. ;; (defun my/-setup-tex-mode-compile-command ()
  150. ;; "Setup `compile-command' for `tex-mode'."
  151. ;; (let ((quoted-name (shell-quote-argument buffer-file-name)))
  152. ;; (setq-local compile-command
  153. ;; (concat "latexmk -pdf "
  154. ;; "-auxdir=" quoted-name "-build"
  155. ;; " " quoted-name))))
  156. ;; :config
  157. ;; (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode)))
  158. ;; flyspell
  159. ;; (use-package flyspell
  160. ;; :hook
  161. ;; (((text-mode message-mode tex-mode) . flyspell-mode)
  162. ;; (prog-mode . flyspell-prog-mode))
  163. ;; :config
  164. ;; (setq ispell-program-name "hunspell"
  165. ;; flyspell-issue-message-flag nil
  166. ;; flyspell-issue-welcome-flag nil)
  167. ;; (define-key flyspell-mode-map (kbd "C-;") nil t)
  168. ;; (define-key flyspell-mode-map (kbd "C-,") nil t))
  169. ;; (use-package aggressive-indent
  170. ;; :hook (prog-mode . aggressive-indent-mode)
  171. ;; :config
  172. ;; (add-to-list 'aggressive-indent-protected-commands
  173. ;; #'evil-undo))
  174. ;; ;; easier identification of local variables
  175. ;; (use-package color-identifiers-mode
  176. ;; :hook (prog-mode . color-identifiers-mode-maybe)
  177. ;; :init
  178. ;; (setq color-identifiers:num-colors 10
  179. ;; color-identifiers:recoloring-delay 0.5)
  180. ;; :config
  181. ;; ;; make sure that remapped treesitter modes are handled
  182. ;; (defun my/color-identifiers-mode-remap-ts-modes ()
  183. ;; (dolist (entry color-identifiers:modes-alist)
  184. ;; (cl-destructuring-bind (mode &rest props) entry
  185. ;; (when-let ((remapped-mode (alist-get mode major-mode-remap-alist))
  186. ;; ((string-match-p "-ts-" (symbol-name remapped-mode)))
  187. ;; ((not (assq remapped-mode color-identifiers:modes-alist))))
  188. ;; ;; no need to test with `add-to-list'
  189. ;; (push (cons remapped-mode props) color-identifiers:modes-alist)))))
  190. ;; (my/color-identifiers-mode-remap-ts-modes)
  191. ;; (setf (alist-get 'lisp-interaction-mode color-identifiers:modes-alist)
  192. ;; (alist-get 'emacs-lisp-mode color-identifiers:modes-alist))
  193. ;; (defun my/-color-identifiers-elisp-handle-let-like (sexp output)
  194. ;; (cl-destructuring-bind (_name &optional vars &rest body) sexp
  195. ;; (dolist (entry vars body)
  196. ;; (cond
  197. ;; ((and entry (symbolp entry)) (puthash entry t output))
  198. ;; ((and (car entry) (symbolp (car entry)))
  199. ;; (puthash (car entry) t output))))))
  200. ;; (defun my/-color-identifiers-parse-lambda-list (list output)
  201. ;; (dolist (entry list)
  202. ;; (cond
  203. ;; ((and entry (symbolp entry)
  204. ;; (not (string-prefix-p ":" (symbol-name entry)))
  205. ;; (not (string-prefix-p "&" (symbol-name entry))))
  206. ;; (puthash entry t output))
  207. ;; ((and (car-safe entry) (symbolp (car entry)))
  208. ;; (puthash (car entry) t output)))))
  209. ;; (defun my/-color-identifiers-elisp-handle-destructing-bind-like
  210. ;; (sexp output)
  211. ;; (cl-destructuring-bind (_name &optional vars &rest expr-and-body) sexp
  212. ;; (my/-color-identifiers-parse-lambda-list vars output)
  213. ;; expr-and-body))
  214. ;; (defun my/-color-identifiers-elisp-handle-defun-like
  215. ;; (sexp output)
  216. ;; (cl-destructuring-bind (_name _func &optional vars &rest body) sexp
  217. ;; (my/-color-identifiers-parse-lambda-list vars output)
  218. ;; body))
  219. ;; (defun my/-color-identifiers-elisp-handle-dolist-like
  220. ;; (sexp output)
  221. ;; (cl-destructuring-bind (_name &optional spec &rest body) sexp
  222. ;; (cl-destructuring-bind (&optional var &rest forms) spec
  223. ;; (when (symbolp var)
  224. ;; (puthash var t output))
  225. ;; (append body forms))))
  226. ;; (defun my/-color-identifiers-elisp-handle-loop (sexp output)
  227. ;; (let (body-forms)
  228. ;; (cl-maplist
  229. ;; (lambda (kwds)
  230. ;; (cl-case (car kwds)
  231. ;; (for ;; this could be a dotted list
  232. ;; (let ((tail (ensure-list (cadr kwds))))
  233. ;; (while tail
  234. ;; (when (and (consp tail) (symbolp (car tail)))
  235. ;; (puthash (car tail) t output))
  236. ;; (when (and (consp tail) (symbolp (cdr tail)))
  237. ;; (puthash (cdr tail) t output))
  238. ;; (setq tail (cdr-safe tail)))))
  239. ;; (using
  240. ;; (when (and (listp (cdr kwds))
  241. ;; (symbolp (cl-second (cdr kwds))))
  242. ;; (puthash (cl-second (cdr kwds)) t output)))
  243. ;; ((with into)
  244. ;; (when (symbolp (cadr kwds))
  245. ;; (puthash (cadr kwds) t output)))
  246. ;; (t
  247. ;; (unless (atom (car kwds))
  248. ;; (push (car kwds) body-forms)))))
  249. ;; (cdr sexp))
  250. ;; body-forms))
  251. ;; (defun my/-color-identifiers-elisp-handle-do-like (sexp output)
  252. ;; (let ((eval-forms))
  253. ;; (cl-destructuring-bind (name &optional vars test-forms &rest body) sexp
  254. ;; (dolist (entry vars (append eval-forms test-forms body))
  255. ;; (cl-destructuring-bind (&optional var init step &rest _)
  256. ;; entry
  257. ;; (when (symbolp var)
  258. ;; (puthash var t output)
  259. ;; (cl-callf nconc eval-forms (list init step))))))))
  260. ;; (defvar my/-color-identifiers-eslip-handlers
  261. ;; (let ((table (make-hash-table)))
  262. ;; (puthash 'quote #'ignore table)
  263. ;; (puthash 'function #'ignore table)
  264. ;; (puthash 'let #'my/-color-identifiers-elisp-handle-let-like table)
  265. ;; (puthash 'let* #'my/-color-identifiers-elisp-handle-let-like table)
  266. ;; (puthash 'cl-destructuring-bind
  267. ;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table)
  268. ;; (puthash 'with-slots
  269. ;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table)
  270. ;; (puthash 'lambda
  271. ;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table)
  272. ;; (puthash 'cl-function
  273. ;; #'my/-color-identifiers-elisp-handle-destructing-bind-like table)
  274. ;; (puthash 'defun
  275. ;; #'my/-color-identifiers-elisp-handle-defun-like table)
  276. ;; (puthash 'cl-defun
  277. ;; #'my/-color-identifiers-elisp-handle-defun-like table)
  278. ;; (puthash 'defmacro
  279. ;; #'my/-color-identifiers-elisp-handle-defun-like table)
  280. ;; (puthash 'cl-defmacro
  281. ;; #'my/-color-identifiers-elisp-handle-defun-like table)
  282. ;; (puthash 'cl-defmacro
  283. ;; #'my/-color-identifiers-elisp-handle-defun-like table)
  284. ;; (puthash 'cl-loop
  285. ;; #'my/-color-identifiers-elisp-handle-loop table)
  286. ;; (puthash 'dolist
  287. ;; #'my/-color-identifiers-elisp-handle-dolist-like table)
  288. ;; (puthash 'dotimes
  289. ;; #'my/-color-identifiers-elisp-handle-dolist-like table)
  290. ;; (puthash 'cl-dolist
  291. ;; #'my/-color-identifiers-elisp-handle-dolist-like table)
  292. ;; (puthash 'cl-dotimes
  293. ;; #'my/-color-identifiers-elisp-handle-dolist-like table)
  294. ;; (puthash 'cl-do
  295. ;; #'my/-color-identifiers-elisp-handle-do-like table)
  296. ;; table)
  297. ;; "A list of functions that find declarations in variables.
  298. ;; This is used in `my/-color-identifiers-elisp-declarations-in-sexp'. It is a
  299. ;; hash table of function (or macro) names and a function that handles them. The
  300. ;; functions should be of two arguments. The first is the sexp to parse. The
  301. ;; second is a hash table with the keys being the symbols of local variables. The
  302. ;; function should return a list of the forms that it contains that should be
  303. ;; recursively searched.")
  304. ;; (defun my/-color-identifiers-lisp-declarations-in-sexp (sexp output table)
  305. ;; "Get all of the variable declarations in SEXP and place them in OUTPUT.
  306. ;; OUTPUT is a hash table. TABLE is a table like
  307. ;; `my/-color-identifiers-elisp-declarations-in-sexp'."
  308. ;; (let ((stack (list sexp)))
  309. ;; (while (and stack (not (input-pending-p)))
  310. ;; (let ((entry (pop stack)))
  311. ;; (when (proper-list-p entry)
  312. ;; (if-let ((handler (gethash (car entry) table)))
  313. ;; (cl-callf nconc stack
  314. ;; (copy-sequence (funcall handler entry output)))
  315. ;; (cl-callf nconc stack
  316. ;; (copy-sequence (cdr entry)))))))))
  317. ;; (defun my/-color-identifiers-lisp-declarations-in-buffer (&optional buffer)
  318. ;; (let ((result (make-hash-table)))
  319. ;; (save-excursion
  320. ;; (goto-char (point-min))
  321. ;; (condition-case nil
  322. ;; (while t
  323. ;; (condition-case nil
  324. ;; (let ((sexp (read (or buffer (current-buffer)))))
  325. ;; (my/-color-identifiers-lisp-declarations-in-sexp
  326. ;; sexp result my/-color-identifiers-eslip-handlers))
  327. ;; (invalid-read-syntax nil)))
  328. ;; (end-of-file nil))
  329. ;; (let ((names))
  330. ;; (maphash (lambda (k _v)
  331. ;; (unless (or (eq k t) (not k) (boundp k))
  332. ;; (push (symbol-name k) names)))
  333. ;; result)
  334. ;; names))))
  335. ;; (color-identifiers:set-declaration-scan-fn
  336. ;; 'emacs-lisp-mode
  337. ;; 'my/-color-identifiers-lisp-declarations-in-buffer)
  338. ;; (color-identifiers:set-declaration-scan-fn
  339. ;; 'lisp-interaction-mode
  340. ;; 'my/-color-identifiers-lisp-declarations-in-buffer))