From a47707a471bd7fcaf37f061757fd755b2dcd99b7 Mon Sep 17 00:00:00 2001 From: Zelong Kuang Date: Fri, 3 Apr 2026 22:48:09 +1100 Subject: [PATCH] small mod --- lisp/init-better-default.el | 12 +++++------ lisp/init-completion.el | 1 - lisp/init-elpaca.el | 6 +++--- lisp/init-meow.el | 1 + lisp/init-tex.el | 32 ++++++++++++++++++++++++++++++ lisp/init-ui.el | 10 +++------- lisp/init-utils.el | 2 +- lisp/init-workspace.el | 3 +-- snippets/latex-mode/frac.yasnippet | 1 + 9 files changed, 48 insertions(+), 20 deletions(-) diff --git a/lisp/init-better-default.el b/lisp/init-better-default.el index 71efd37..f32e8d3 100644 --- a/lisp/init-better-default.el +++ b/lisp/init-better-default.el @@ -88,7 +88,7 @@ If this is a daemon session, load them all immediately instead." (exec-path-from-shell-initialize))) (setq custom-file (expand-file-name "~/.emacs.d/custom.el")) -(add-hook 'elpaca-elpaca-after-init-hook (lambda () (load custom-file 'no-error 'no-message))) +(add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'no-error 'no-message))) ;; Start server (use-package server @@ -100,7 +100,7 @@ If this is a daemon session, load them all immediately instead." ;; Save place (use-package saveplace :ensure nil - :hook (elpaca-elpaca-after-init . save-place-mode)) + :hook (elpaca-after-init . save-place-mode)) (use-package display-line-numbers :ensure nil @@ -136,7 +136,7 @@ If this is a daemon session, load them all immediately instead." (use-package paren :ensure nil - :hook (elpaca-elpaca-after-init . show-paren-mode)) + :hook (elpaca-after-init . show-paren-mode)) ;; ;; Show trailing whitespace only in prog-mode and text-mode ;; (add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace t))) @@ -160,7 +160,7 @@ If this is a daemon session, load them all immediately instead." (use-package savehist :ensure nil - :hook (elpaca-elpaca-after-init . savehist-mode) + :hook (elpaca-after-init . savehist-mode) :init (setq enable-recursive-minibuffers t ; Allow commands in minibuffers history-length 1000 savehist-additional-variables '(mark-ring @@ -219,7 +219,7 @@ If this is a daemon session, load them all immediately instead." (use-package browse-kill-ring :bind ("C-c k" . browse-kill-ring) - :hook (elpaca-elpaca-after-init . browse-kill-ring-default-keybindings) + :hook (elpaca-after-init . browse-kill-ring-default-keybindings) :init (setq browse-kill-ring-separator "────────────────" browse-kill-ring-separator-face 'shadow)) @@ -227,7 +227,7 @@ If this is a daemon session, load them all immediately instead." :init (setq scroll-conservatively 3 scroll-margin 0) - :hook (elpaca-elpaca-after-init . ultra-scroll-mode)) + :hook (elpaca-after-init . ultra-scroll-mode)) (use-package helpful :bind (([remap describe-function] . helpful-callable) diff --git a/lisp/init-completion.el b/lisp/init-completion.el index 80178db..05678cd 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -163,7 +163,6 @@ (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref)) -;; (use-package consult-projectile) (use-package consult-flycheck) (use-package consult-dir diff --git a/lisp/init-elpaca.el b/lisp/init-elpaca.el index 61bd46b..215507c 100644 --- a/lisp/init-elpaca.el +++ b/lisp/init-elpaca.el @@ -2,15 +2,15 @@ ;;;;;;;;;;;; elpaca initialise ;;;;;;;;;;;;;;;;;; (defvar elpaca-installer-version 0.12) -(defvar elpaca-directory (expand-file-name "elpa/" user-emacs-directory)) +(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory)) (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" :ref nil :depth 1 :inherit ignore :files (:defaults "elpaca-test.el" (:exclude "extensions")) :build (:not elpaca-activate))) -(let* ((repo (expand-file-name "elpa/" elpaca-sources-directory)) - (build (expand-file-name "elpa/" elpaca-builds-directory)) +(let* ((repo (expand-file-name "elpaca/" elpaca-sources-directory)) + (build (expand-file-name "elpaca/" elpaca-builds-directory)) (order (cdr elpaca-order)) (default-directory repo)) (add-to-list 'load-path (if (file-exists-p build) build repo)) diff --git a/lisp/init-meow.el b/lisp/init-meow.el index c4d1d9c..dc24e89 100644 --- a/lisp/init-meow.el +++ b/lisp/init-meow.el @@ -95,6 +95,7 @@ (add-to-list 'meow-mode-state-list '(magit-mode . insert)) (add-to-list 'meow-mode-state-list '(eat-mode . insert)) (add-to-list 'meow-mode-state-list '(eshell-mode . insert)) + (add-to-list 'meow-mode-state-list '(git-commit-elisp-text-mode . insert)) (setq meow-keypad-leader-dispatch "C-c" meow-use-clipboard t) diff --git a/lisp/init-tex.el b/lisp/init-tex.el index 56f202d..859b119 100644 --- a/lisp/init-tex.el +++ b/lisp/init-tex.el @@ -88,6 +88,27 @@ (?c ("\\circ")) )) (setq cdlatex-math-modify-alist '((?f "\\mathbb" nil t nil nil))) + (dolist (cmd '(("smat" "Insert smallmatrix env" + "\\left( \\begin{smallmatrix} ? \\end{smallmatrix} \\right)" + lazytab-position-cursor-and-edit + nil nil t) + ("bmat" "Insert bmatrix env" + "\\begin{bmatrix} ? \\end{bmatrix}" + lazytab-position-cursor-and-edit + nil nil t) + ("pmat" "Insert pmatrix env" + "\\begin{pmatrix} ? \\end{pmatrix}" + lazytab-position-cursor-and-edit + nil nil t) + ("ali" "Insert pmatrix env" + "\\begin{aligned} ? \\end{aligned}" + lazytab-position-cursor-and-edit + nil nil t) + ("tbl" "Insert table" + "\\begin{table}\n\\centering ? \\caption{}\n\\end{table}\n" + 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 @@ -102,6 +123,17 @@ expansion, then cdlatex expansion." 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) + ) + ;; (use-package texpresso ;; :defer nil ;; :load-path "~/.emacs.d/lisp/packages/") diff --git a/lisp/init-ui.el b/lisp/init-ui.el index 11df0b3..531f839 100644 --- a/lisp/init-ui.el +++ b/lisp/init-ui.el @@ -196,15 +196,11 @@ (use-package hl-line :ensure nil :hook ((after-init . global-hl-line-mode) - ((dashboard-mode eshell-mode shell-mode term-mode vterm-mode) . + ((dashboard-mode eshell-mode shell-mode term-mode vterm-mode eat-mode) . (lambda () (setq-local global-hl-line-mode nil))))) -;; Pulse highlight on selection -(use-package pulsar - :custom-face - (pulsar-generic ((t :inherit region :extend t))) - :custom (pulsar-delay pulse-delay) - :hook (emacs-startup . pulsar-global-mode)) +(use-package beacon + :hook elpaca-after-init) (use-package spacious-padding :diminish diff --git a/lisp/init-utils.el b/lisp/init-utils.el index 89998e0..bc8b73c 100644 --- a/lisp/init-utils.el +++ b/lisp/init-utils.el @@ -51,7 +51,7 @@ ;; Fast search tool `ripgrep' (use-package rg - ;; :hook (elpaca-after-init . rg-enable-default-bindings) + :hook (elpaca-after-init . rg-enable-default-bindings) :bind (:map rg-global-map ("c" . rg-dwim-current-dir) ("f" . rg-dwim-current-file) diff --git a/lisp/init-workspace.el b/lisp/init-workspace.el index def35d3..53d7003 100644 --- a/lisp/init-workspace.el +++ b/lisp/init-workspace.el @@ -14,8 +14,7 @@ :ensure nil :bind ("C-x C-b" . ibuffer) :bind (:map ibuffer-mode-map - ("M-o" . nil)) - :hook (ibuffer-mode . hl-line-mode) + ("M-o" . nil)) :config (add-to-list 'ibuffer-help-buffer-modes 'helpful-mode) (add-to-list 'ibuffer-help-buffer-modes 'Man-mode) diff --git a/snippets/latex-mode/frac.yasnippet b/snippets/latex-mode/frac.yasnippet index 12fa023..3899833 100644 --- a/snippets/latex-mode/frac.yasnippet +++ b/snippets/latex-mode/frac.yasnippet @@ -3,5 +3,6 @@ # key: frac # group: math # name: \frac{numerator}{denominator} +# condition: (and (texmathp) 'auto) # -- \frac{${1:numerator}}{${2:denominator}}$0 \ No newline at end of file