diff --git a/early-init.el b/early-init.el index 55a2ea7..131e52e 100644 --- a/early-init.el +++ b/early-init.el @@ -10,7 +10,7 @@ (setq package-enable-at-startup nil) -(setq native-comp-jit-compilation t) +(setq native-comp-jit-compilation nil) (setq native-comp-async-report-warnings-errors nil) (add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory)) diff --git a/lisp/init-better-default.el b/lisp/init-better-default.el index f32e8d3..c88ab41 100644 --- a/lisp/init-better-default.el +++ b/lisp/init-better-default.el @@ -151,7 +151,8 @@ If this is a daemon session, load them all immediately instead." '("\\.?cache" ".cask" "url" "COMMIT_EDITMSG\\'" "bookmarks" "\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$" "\\.?ido\\.last$" "\\.revive$" "/G?TAGS$" "/.elfeed/" - "^/tmp/" "^/var/folders/.+$" "^/ssh:" "/persp-confs/" + "^/tmp/" "^/var/folders/.+$" "^/ssh:" "^/rpc:" "/persp-confs/" + "^/sshx:" "^/sudo:" (lambda (file) (file-in-directory-p file package-user-dir))) recentf-auto-cleanup 'never) :config @@ -267,14 +268,14 @@ If this is a daemon session, load them all immediately instead." ;; (setq auto-save-file-name-transforms ;; `((".*" ,(concat user-emacs-directory "auto-save/") t))) -(setq tramp-default-method "rpc") - -(use-package tramp) +(use-package tramp + :config + (setq tramp-default-method "rpc")) (use-package tramp-hlo - :config - (tramp-hlo-setup)) + :hook (elpaca-after-init . tramp-hlo-setup)) +(use-package msgpack) (use-package tramp-rpc :ensure (tramp-rpc :host github :repo "ArthurHeymans/emacs-tramp-rpc") :config diff --git a/lisp/init-check.el b/lisp/init-check.el index 844e5ca..6fe6838 100644 --- a/lisp/init-check.el +++ b/lisp/init-check.el @@ -20,13 +20,13 @@ ;; Display errors a little quicker (default is 0.9s) flycheck-display-errors-delay 0.25)) -(use-package flyover - :diminish - :hook prog-mode - :config - ;; Disable flyover-mode in emacs-lisp-mode - (add-hook 'emacs-lisp-mode-hook (lambda () (flyover-mode -1))) - :custom (flyover-checkers '(flycheck))) +;; (use-package flyover +;; :diminish +;; :hook prog-mode +;; :config +;; ;; Disable flyover-mode in emacs-lisp-mode +;; (add-hook 'emacs-lisp-mode-hook (lambda () (flyover-mode -1))) +;; :custom (flyover-checkers '(flycheck))) (provide 'init-check) diff --git a/lisp/init-completion.el b/lisp/init-completion.el index 05678cd..743efc9 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -236,6 +236,7 @@ circe-mode help-mode gud-mode + eat-mode vterm-mode) t)) :custom-face diff --git a/lisp/init-dired.el b/lisp/init-dired.el index 67cc1ae..86a39fe 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -9,6 +9,7 @@ ;; Always delete and copy recursively (setq dired-recursive-deletes 'always dired-recursive-copies 'always + dired-dwim-target t dired-kill-when-opening-new-dired-buffer t) ;; Show directory first diff --git a/lisp/init-edit.el b/lisp/init-edit.el index 1b9c07e..021195b 100644 --- a/lisp/init-edit.el +++ b/lisp/init-edit.el @@ -135,7 +135,7 @@ (use-package olivetti :hook org-mode :diminish - :bind ("" . olivetti-mode) + :bind (("" . olivetti-mode)) :custom (olivetti-style 'fancy) (olivetti-margin-width 5) diff --git a/lisp/init-haskell.el b/lisp/init-haskell.el index 2671597..fe73771 100644 --- a/lisp/init-haskell.el +++ b/lisp/init-haskell.el @@ -14,5 +14,16 @@ haskell-process-auto-import-loaded-modules t) (add-to-list 'completion-ignored-extensions ".hi")) +(use-package haskell-ts-mode + :custom + (haskell-ts-font-lock-level 4) + (haskell-ts-use-indent t) + (haskell-ts-ghci "ghci") + (haskell-ts-use-indent t) + :config + (add-to-list 'major-mode-remap-alist '(haskell-mode . haskell-ts-mode))) + + +(use-package lsp-haskell) (provide 'init-haskell) diff --git a/lisp/init-meow.el b/lisp/init-meow.el index dc24e89..6d6a84b 100644 --- a/lisp/init-meow.el +++ b/lisp/init-meow.el @@ -82,9 +82,12 @@ '("z" . meow-pop-selection) '("'" . repeat) '("" . ignore)) - (meow-define-keys - 'beacon - '("C-g" . meow-grab)) + ;; (meow-define-keys + ;; 'beacon + ;; '("C-g" . meow-grab)) + ;; (meow-define-keys + ;; 'insert + ;; '("ESC" . )) ) (use-package meow diff --git a/lisp/init-python.el b/lisp/init-python.el index 5a619a0..c77d128 100644 --- a/lisp/init-python.el +++ b/lisp/init-python.el @@ -23,9 +23,4 @@ (with-eval-after-load 'exec-path-from-shell (exec-path-from-shell-copy-env "PYTHONPATH"))) -;; (with-eval-after-load 'eglot -;; (add-hook 'python-ts-mode-hook #'eglot-ensure) -;; (add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("pyright-langserver" "--stdio")))) - - (provide 'init-python) diff --git a/lisp/init-rust.el b/lisp/init-rust.el index f3a8223..c181f37 100644 --- a/lisp/init-rust.el +++ b/lisp/init-rust.el @@ -1,8 +1,7 @@ ;; Rust -*- lexical-binding: t; -*- (use-package rust-mode - :functions treesit-available-p - :init (setq rust-format-on-save t - rust-mode-treesitter-derive (treesit-available-p))) + :config + (add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode))) (use-package ron-mode :mode ("\\.ron" . ron-mode)) diff --git a/lisp/init-shell.el b/lisp/init-shell.el index 9ea00aa..0b8a8b7 100644 --- a/lisp/init-shell.el +++ b/lisp/init-shell.el @@ -40,71 +40,8 @@ :defines eshell-prompt-function :bind (:map eshell-mode-map ([remap recenter-top-bottom] . eshell/clear)) - :config - (setq eshell-banner-message "") - (with-no-warnings - (defun eshell/clear () - "Clear the eshell buffer." - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer) - (eshell-send-input))) - (defun eshell/emacs (&rest args) - "Open a file (ARGS) in Emacs. Some habits die hard." - (if (null args) - ;; If I just ran "emacs", I probably expect to be launching - ;; Emacs, which is rather silly since I'm already in Emacs. - ;; So just pretend to do what I ask. - (bury-buffer) - ;; We have to expand the file names or else naming a directory in an - ;; argument causes later arguments to be looked for in that directory, - ;; not the starting directory - (mapc #'find-file (mapcar #'expand-file-name (flatten-tree (reverse args)))))) - (defalias 'eshell/e #'eshell/emacs) - (defalias 'eshell/ec #'eshell/emacs) - (defun eshell/ebc (&rest args) - "Compile a file (ARGS) in Emacs. Use `compile' to do background make." - (if (eshell-interactive-output-p) - (let ((compilation-process-setup-function - (list 'lambda nil - (list 'setq 'process-environment - (list 'quote (eshell-copy-environment)))))) - (compile (eshell-flatten-and-stringify args)) - (pop-to-buffer compilation-last-buffer)) - (throw 'eshell-replace-command - (let ((l (eshell-stringify-list (flatten-tree args)))) - (eshell-parse-command (car l) (cdr l)))))) - (put 'eshell/ebc 'eshell-no-numeric-conversions t) - (defun eshell-view-file (file) - "View FILE. A version of `view-file' which properly rets the eshell prompt." - (interactive "fView file: ") - (unless (file-exists-p file) (error "%s does not exist" file)) - (let ((buffer (find-file-noselect file))) - (if (eq (get (buffer-local-value 'major-mode buffer) 'mode-class) - 'special) - (progn - (switch-to-buffer buffer) - (message "Not using View mode because the major mode is special")) - (let ((undo-window (list (window-buffer) (window-start) - (+ (window-point) - (length (funcall eshell-prompt-function)))))) - (switch-to-buffer buffer) - (view-mode-enter (cons (selected-window) (cons nil undo-window)) - 'kill-buffer))))) - - (defun eshell/less (&rest args) - "Invoke `view-file' on a file (ARGS). - -\"less +42 foo\" will go to line 42 in the buffer for foo." - (while args - (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args)) - (let* ((line (string-to-number (match-string 1 (pop args)))) - (file (pop args))) - (eshell-view-file file) - (forward-line line)) - (eshell-view-file (pop args))))) - (defalias 'eshell/more #'eshell/less))) + (setq eshell-banner-message "")) (use-package xterm-color :defines (compilation-environment @@ -150,11 +87,11 @@ :hook ((eshell-load . eat-eshell-mode) (eshell-load . eat-eshell-visual-command-mode)) :ensure `(eat :repo "https://codeberg.org/akib/emacs-eat" - :files ("*.el" ("term" "term/*.el") "*.texi" - "*.ti" ("terminfo/e" "terminfo/e/*") - ("terminfo/65" "terminfo/65/*") - ("integration" "integration/*") - (:exclude ".dir-locals.el" "*-tests.el"))) + :files ("*.el" ("term" "term/*.el") "*.texi" + "*.ti" ("terminfo/e" "terminfo/e/*") + ("terminfo/65" "terminfo/65/*") + ("integration" "integration/*") + (:exclude ".dir-locals.el" "*-tests.el"))) :custom (eat-term-name "xterm-256color") (eat-kill-buffer-on-exit t) diff --git a/lisp/init-tex.el b/lisp/init-tex.el index 859b119..23a2072 100644 --- a/lisp/init-tex.el +++ b/lisp/init-tex.el @@ -88,6 +88,33 @@ (?c ("\\circ")) )) (setq cdlatex-math-modify-alist '((?f "\\mathbb" nil t nil nil))) + + (defun tjh/cdlatex-yas-expand () + "Resolve the conflict between cdlatex and yasnippet. When this +function returns true, the default `cdlatex-tab` will not be +executed. The effect of function is to first try yasnippet +expansion, then cdlatex expansion." + (interactive) + (if (or (bound-and-true-p yas-minor-mode) + (bound-and-true-p yas-global-mode)) + (if (yas-expand) + t + nil) + nil)) + (add-hook 'cdlatex-tab-hook 'tjh/cdlatex-yas-expand) + (cdlatex-reset-mode)) + +(use-package lazytab + :demand t + :after cdlatex latex + :ensure '(lazytab :type git :host github :repo "karthink/lazytab" :files ("*.el")) + :bind (:map LaTeX-mode-map + ("C-x |" . (lambda () (interactive) (lazytab-position-cursor-and-edit)))) + :bind (:map orgtbl-mode-map + ("" . lazytab-org-table-next-field-maybe) + ("TAB" . lazytab-org-table-next-field-maybe)) + :config + (add-hook 'cdlatex-tab-hook #'lazytab-cdlatex-or-orgtbl-next-field 90) (dolist (cmd '(("smat" "Insert smallmatrix env" "\\left( \\begin{smallmatrix} ? \\end{smallmatrix} \\right)" lazytab-position-cursor-and-edit @@ -109,29 +136,7 @@ lazytab-position-cursor-and-edit nil t nil))) (push cmd cdlatex-command-alist)) - (defun tjh/cdlatex-yas-expand () - "Resolve the conflict between cdlatex and yasnippet. When this -function returns true, the default `cdlatex-tab` will not be -executed. The effect of function is to first try yasnippet -expansion, then cdlatex expansion." - (interactive) - (if (or (bound-and-true-p yas-minor-mode) - (bound-and-true-p yas-global-mode)) - (if (yas-expand) - t - nil) - nil)) - (add-hook 'cdlatex-tab-hook 'tjh/cdlatex-yas-expand)) - -(use-package lazytab - :demand t - :after cdlatex - :ensure '(lazytab :type git :host github :repo "karthink/lazytab" :files ("*.el")) - :bind (:map orgtbl-mode-map - ("" . lazytab-org-table-next-field-maybe) - ("TAB" . lazytab-org-table-next-field-maybe)) - :config - (add-hook 'cdlatex-tab-hook #'lazytab-cdlatex-or-orgtbl-next-field 90) + (cdlatex-reset-mode) ) ;; (use-package texpresso diff --git a/lisp/init-typst.el b/lisp/init-typst.el index e724aef..122d39b 100644 --- a/lisp/init-typst.el +++ b/lisp/init-typst.el @@ -3,19 +3,13 @@ (use-package typst-ts-mode :ensure (:type git :host codeberg :repo "meow_king/typst-ts-mode") + :hook (typst-ts-mode . lsp-deferred) :custom ;; (typst-ts-watch-options "--open") (typst-ts-mode-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory)) (typst-ts-mode-enable-raw-blocks-highlight t) :config (keymap-set typst-ts-mode-map "C-c C-c" #'typst-ts-tmenu) - ;; (with-eval-after-load 'eglot - ;; (with-eval-after-load 'typst-ts-mode - ;; (add-to-list 'eglot-server-programs - ;; `((typst-ts-mode) . - ;; ,(eglot-alternatives `(,typst-ts-lsp-download-path - ;; "tinymist" - ;; "typst-lsp")))))) (setq typst-ts-preview-function 'find-file-other-window)) (use-package typst-preview diff --git a/lisp/init-ui.el b/lisp/init-ui.el index 531f839..5a41ef3 100644 --- a/lisp/init-ui.el +++ b/lisp/init-ui.el @@ -114,19 +114,19 @@ window-divider-default-right-width 1) (add-hook 'window-setup-hook #'window-divider-mode) -(pcase system-type - ('darwin ; macOS - (set-face-attribute 'default nil :font "Sarasa Term SC-22") ; 20 * 1.5 - (set-face-attribute 'variable-pitch nil :font "Bookerly-22" :weight 'light) - (set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-22") +;; (pcase system-type +;; ('darwin ; macOS +(set-face-attribute 'default nil :font "Sarasa Term SC-22") ; 20 * 1.5 +(set-face-attribute 'variable-pitch nil :font "Bookerly-20" :weight 'light) +(set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-22") - (add-to-list 'default-frame-alist '(height . 53)) - (add-to-list 'default-frame-alist '(width . 90))) +(add-to-list 'default-frame-alist '(height . 53)) +(add-to-list 'default-frame-alist '(width . 90)) - ('gnu/linux ; Linux (including Debian) - (set-face-attribute 'variable-pitch nil :font "Sarasa Mono TC Nerd Font-14") ; 20 * 1.5 - (add-to-list 'default-frame-alist '(height . 40)) - (add-to-list 'default-frame-alist '(width . 90)))) +;; ('gnu/linux ; Linux (including Debian) +;; (set-face-attribute 'variable-pitch nil :font "Sarasa Mono TC Nerd Font-14") ; 20 * 1.5 +;; (add-to-list 'default-frame-alist '(height . 40)) +;; (add-to-list 'default-frame-alist '(width . 90)))) (use-package mixed-pitch :diminish @@ -195,7 +195,7 @@ ;; hl current line (use-package hl-line :ensure nil - :hook ((after-init . global-hl-line-mode) + :hook ((elpaca-after-init . global-hl-line-mode) ((dashboard-mode eshell-mode shell-mode term-mode vterm-mode eat-mode) . (lambda () (setq-local global-hl-line-mode nil))))) diff --git a/lisp/init-utils.el b/lisp/init-utils.el index bc8b73c..88f6447 100644 --- a/lisp/init-utils.el +++ b/lisp/init-utils.el @@ -30,19 +30,18 @@ (which-key-add-key-based-replacements "C-x t" "tabs") (which-key-add-key-based-replacements "C-x v" "version control")) -(use-package grep - :ensure nil - :autoload grep-apply-setting - :init - (when (executable-find "rg") - (grep-apply-setting - 'grep-command "rg --color=auto --null -nH --no-heading -e ") - (grep-apply-setting - 'grep-template "rg --color=auto --null --no-heading -g '!*/' -e ") - (grep-apply-setting - 'grep-find-command '("rg --color=auto --null -nH --no-heading -e ''" . 38)) - (grep-apply-setting - 'grep-find-template "rg --color=auto --null -nH --no-heading -e "))) +;; (use-package grep +;; :ensure nil +;; :autoload grep-apply-setting +;; :init +;; (grep-apply-setting +;; 'grep-command "rg --color=auto --null -nH --no-heading -e ") +;; (grep-apply-setting +;; 'grep-template "rg --color=auto --null --no-heading -g '!*/' -e ") +;; (grep-apply-setting +;; 'grep-find-command '("rg --color=auto --null -nH --no-heading -e ''" . 38)) +;; (grep-apply-setting +;; 'grep-find-template "rg --color=auto --null -nH --no-heading -e ")) ;; Writable grep buffer (use-package wgrep @@ -51,7 +50,7 @@ ;; Fast search tool `ripgrep' (use-package rg - :hook (elpaca-after-init . rg-enable-default-bindings) + :bind ("C-c s" . rg-menu) :bind (:map rg-global-map ("c" . rg-dwim-current-dir) ("f" . rg-dwim-current-file) @@ -62,13 +61,9 @@ (rg-enable-default-bindings) ) -;; (use-package pdf-tools -;; :config -;; (pdf-tools-install)) - -;; (use-package saveplace-pdf-view -;; :after pdf-tools -;; :demand t) +;; (use-package sudo-edit +;; :commands sudo-edit sudo-edit-find-file +;; :bind ("C-c C-r" . sudo-edit)) ;; (use-package keycast ;; :hook (elpaca-after-init . keycast-mode-line-mode)