This commit is contained in:
Zelong Kuang
2026-04-05 21:31:02 +10:00
parent a47707a471
commit 2fe4ba46e8
15 changed files with 100 additions and 158 deletions

View File

@@ -10,7 +10,7 @@
(setq package-enable-at-startup nil) (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) (setq native-comp-async-report-warnings-errors nil)
(add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory)) (add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory))

View File

@@ -151,7 +151,8 @@ If this is a daemon session, load them all immediately instead."
'("\\.?cache" ".cask" "url" "COMMIT_EDITMSG\\'" "bookmarks" '("\\.?cache" ".cask" "url" "COMMIT_EDITMSG\\'" "bookmarks"
"\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$" "\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$"
"\\.?ido\\.last$" "\\.revive$" "/G?TAGS$" "/.elfeed/" "\\.?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))) (lambda (file) (file-in-directory-p file package-user-dir)))
recentf-auto-cleanup 'never) recentf-auto-cleanup 'never)
:config :config
@@ -267,14 +268,14 @@ If this is a daemon session, load them all immediately instead."
;; (setq auto-save-file-name-transforms ;; (setq auto-save-file-name-transforms
;; `((".*" ,(concat user-emacs-directory "auto-save/") t))) ;; `((".*" ,(concat user-emacs-directory "auto-save/") t)))
(setq tramp-default-method "rpc") (use-package tramp
:config
(use-package tramp) (setq tramp-default-method "rpc"))
(use-package tramp-hlo (use-package tramp-hlo
:config :hook (elpaca-after-init . tramp-hlo-setup))
(tramp-hlo-setup))
(use-package msgpack)
(use-package tramp-rpc (use-package tramp-rpc
:ensure (tramp-rpc :host github :repo "ArthurHeymans/emacs-tramp-rpc") :ensure (tramp-rpc :host github :repo "ArthurHeymans/emacs-tramp-rpc")
:config :config

View File

@@ -20,13 +20,13 @@
;; Display errors a little quicker (default is 0.9s) ;; Display errors a little quicker (default is 0.9s)
flycheck-display-errors-delay 0.25)) flycheck-display-errors-delay 0.25))
(use-package flyover ;; (use-package flyover
:diminish ;; :diminish
:hook prog-mode ;; :hook prog-mode
:config ;; :config
;; Disable flyover-mode in emacs-lisp-mode ;; ;; Disable flyover-mode in emacs-lisp-mode
(add-hook 'emacs-lisp-mode-hook (lambda () (flyover-mode -1))) ;; (add-hook 'emacs-lisp-mode-hook (lambda () (flyover-mode -1)))
:custom (flyover-checkers '(flycheck))) ;; :custom (flyover-checkers '(flycheck)))
(provide 'init-check) (provide 'init-check)

View File

@@ -236,6 +236,7 @@
circe-mode circe-mode
help-mode help-mode
gud-mode gud-mode
eat-mode
vterm-mode) vterm-mode)
t)) t))
:custom-face :custom-face

View File

@@ -9,6 +9,7 @@
;; Always delete and copy recursively ;; Always delete and copy recursively
(setq dired-recursive-deletes 'always (setq dired-recursive-deletes 'always
dired-recursive-copies 'always dired-recursive-copies 'always
dired-dwim-target t
dired-kill-when-opening-new-dired-buffer t) dired-kill-when-opening-new-dired-buffer t)
;; Show directory first ;; Show directory first

View File

@@ -135,7 +135,7 @@
(use-package olivetti (use-package olivetti
:hook org-mode :hook org-mode
:diminish :diminish
:bind ("<f7>" . olivetti-mode) :bind (("<f7>" . olivetti-mode))
:custom :custom
(olivetti-style 'fancy) (olivetti-style 'fancy)
(olivetti-margin-width 5) (olivetti-margin-width 5)

View File

@@ -14,5 +14,16 @@
haskell-process-auto-import-loaded-modules t) haskell-process-auto-import-loaded-modules t)
(add-to-list 'completion-ignored-extensions ".hi")) (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) (provide 'init-haskell)

View File

@@ -82,9 +82,12 @@
'("z" . meow-pop-selection) '("z" . meow-pop-selection)
'("'" . repeat) '("'" . repeat)
'("<escape>" . ignore)) '("<escape>" . ignore))
(meow-define-keys ;; (meow-define-keys
'beacon ;; 'beacon
'("C-g" . meow-grab)) ;; '("C-g" . meow-grab))
;; (meow-define-keys
;; 'insert
;; '("ESC" . <escape>))
) )
(use-package meow (use-package meow

View File

@@ -23,9 +23,4 @@
(with-eval-after-load 'exec-path-from-shell (with-eval-after-load 'exec-path-from-shell
(exec-path-from-shell-copy-env "PYTHONPATH"))) (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) (provide 'init-python)

View File

@@ -1,8 +1,7 @@
;; Rust -*- lexical-binding: t; -*- ;; Rust -*- lexical-binding: t; -*-
(use-package rust-mode (use-package rust-mode
:functions treesit-available-p :config
:init (setq rust-format-on-save t (add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode)))
rust-mode-treesitter-derive (treesit-available-p)))
(use-package ron-mode (use-package ron-mode
:mode ("\\.ron" . ron-mode)) :mode ("\\.ron" . ron-mode))

View File

@@ -40,71 +40,8 @@
:defines eshell-prompt-function :defines eshell-prompt-function
:bind (:map eshell-mode-map :bind (:map eshell-mode-map
([remap recenter-top-bottom] . eshell/clear)) ([remap recenter-top-bottom] . eshell/clear))
:config :config
(setq eshell-banner-message "") (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)))
(use-package xterm-color (use-package xterm-color
:defines (compilation-environment :defines (compilation-environment

View File

@@ -88,6 +88,33 @@
(?c ("\\circ")) (?c ("\\circ"))
)) ))
(setq cdlatex-math-modify-alist '((?f "\\mathbb" nil t nil nil))) (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
("<tab>" . 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" (dolist (cmd '(("smat" "Insert smallmatrix env"
"\\left( \\begin{smallmatrix} ? \\end{smallmatrix} \\right)" "\\left( \\begin{smallmatrix} ? \\end{smallmatrix} \\right)"
lazytab-position-cursor-and-edit lazytab-position-cursor-and-edit
@@ -109,29 +136,7 @@
lazytab-position-cursor-and-edit lazytab-position-cursor-and-edit
nil t nil))) nil t nil)))
(push cmd cdlatex-command-alist)) (push cmd cdlatex-command-alist))
(defun tjh/cdlatex-yas-expand () (cdlatex-reset-mode)
"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
("<tab>" . 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)
) )
;; (use-package texpresso ;; (use-package texpresso

View File

@@ -3,19 +3,13 @@
(use-package typst-ts-mode (use-package typst-ts-mode
:ensure (:type git :host codeberg :repo "meow_king/typst-ts-mode") :ensure (:type git :host codeberg :repo "meow_king/typst-ts-mode")
:hook (typst-ts-mode . lsp-deferred)
:custom :custom
;; (typst-ts-watch-options "--open") ;; (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-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory))
(typst-ts-mode-enable-raw-blocks-highlight t) (typst-ts-mode-enable-raw-blocks-highlight t)
:config :config
(keymap-set typst-ts-mode-map "C-c C-c" #'typst-ts-tmenu) (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)) (setq typst-ts-preview-function 'find-file-other-window))
(use-package typst-preview (use-package typst-preview

View File

@@ -114,19 +114,19 @@
window-divider-default-right-width 1) window-divider-default-right-width 1)
(add-hook 'window-setup-hook #'window-divider-mode) (add-hook 'window-setup-hook #'window-divider-mode)
(pcase system-type ;; (pcase system-type
('darwin ; macOS ;; ('darwin ; macOS
(set-face-attribute 'default nil :font "Sarasa Term SC-22") ; 20 * 1.5 (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 'variable-pitch nil :font "Bookerly-20" :weight 'light)
(set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-22") (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 '(height . 53))
(add-to-list 'default-frame-alist '(width . 90))) (add-to-list 'default-frame-alist '(width . 90))
('gnu/linux ; Linux (including Debian) ;; ('gnu/linux ; Linux (including Debian)
(set-face-attribute 'variable-pitch nil :font "Sarasa Mono TC Nerd Font-14") ; 20 * 1.5 ;; (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 '(height . 40))
(add-to-list 'default-frame-alist '(width . 90)))) ;; (add-to-list 'default-frame-alist '(width . 90))))
(use-package mixed-pitch (use-package mixed-pitch
:diminish :diminish
@@ -195,7 +195,7 @@
;; hl current line ;; hl current line
(use-package hl-line (use-package hl-line
:ensure nil :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) . ((dashboard-mode eshell-mode shell-mode term-mode vterm-mode eat-mode) .
(lambda () (setq-local global-hl-line-mode nil))))) (lambda () (setq-local global-hl-line-mode nil)))))

View File

@@ -30,19 +30,18 @@
(which-key-add-key-based-replacements "C-x t" "tabs") (which-key-add-key-based-replacements "C-x t" "tabs")
(which-key-add-key-based-replacements "C-x v" "version control")) (which-key-add-key-based-replacements "C-x v" "version control"))
(use-package grep ;; (use-package grep
:ensure nil ;; :ensure nil
:autoload grep-apply-setting ;; :autoload grep-apply-setting
:init ;; :init
(when (executable-find "rg") ;; (grep-apply-setting
(grep-apply-setting ;; 'grep-command "rg --color=auto --null -nH --no-heading -e ")
'grep-command "rg --color=auto --null -nH --no-heading -e ") ;; (grep-apply-setting
(grep-apply-setting ;; 'grep-template "rg --color=auto --null --no-heading -g '!*/' -e <R> <D>")
'grep-template "rg --color=auto --null --no-heading -g '!*/' -e <R> <D>") ;; (grep-apply-setting
(grep-apply-setting ;; 'grep-find-command '("rg --color=auto --null -nH --no-heading -e ''" . 38))
'grep-find-command '("rg --color=auto --null -nH --no-heading -e ''" . 38)) ;; (grep-apply-setting
(grep-apply-setting ;; 'grep-find-template "rg --color=auto --null -nH --no-heading -e <R> <D>"))
'grep-find-template "rg --color=auto --null -nH --no-heading -e <R> <D>")))
;; Writable grep buffer ;; Writable grep buffer
(use-package wgrep (use-package wgrep
@@ -51,7 +50,7 @@
;; Fast search tool `ripgrep' ;; Fast search tool `ripgrep'
(use-package rg (use-package rg
:hook (elpaca-after-init . rg-enable-default-bindings) :bind ("C-c s" . rg-menu)
:bind (:map rg-global-map :bind (:map rg-global-map
("c" . rg-dwim-current-dir) ("c" . rg-dwim-current-dir)
("f" . rg-dwim-current-file) ("f" . rg-dwim-current-file)
@@ -62,13 +61,9 @@
(rg-enable-default-bindings) (rg-enable-default-bindings)
) )
;; (use-package pdf-tools ;; (use-package sudo-edit
;; :config ;; :commands sudo-edit sudo-edit-find-file
;; (pdf-tools-install)) ;; :bind ("C-c C-r" . sudo-edit))
;; (use-package saveplace-pdf-view
;; :after pdf-tools
;; :demand t)
;; (use-package keycast ;; (use-package keycast
;; :hook (elpaca-after-init . keycast-mode-line-mode) ;; :hook (elpaca-after-init . keycast-mode-line-mode)