Compare commits

...

20 Commits

Author SHA1 Message Date
Zelong Kuang
4a779a480c Update 2026-04-11 00:00:04 +10:00
Zelong Kuang
7fb855f332 replace moodline with Doom modeline 2026-04-10 23:59:41 +10:00
Zelong Kuang
b03af9e719 Update 2026-04-10 18:21:13 +10:00
Zelong Kuang
3490e9daa9 Update 2026-04-08 15:25:39 +10:00
Zelong Kuang
14ecd3b17a Update 2026-04-06 19:51:57 +10:00
Zelong Kuang
2fe4ba46e8 Update 2026-04-05 21:31:02 +10:00
Zelong Kuang
a47707a471 small mod 2026-04-03 22:48:09 +11:00
Zelong Kuang
2b6faa0e39 Update 2026-04-03 19:00:38 +11:00
Zelong Kuang
c3b368711e Update 2026-04-03 15:54:22 +11:00
Zelong Kuang
154c0c3fb8 Update 2026-04-03 15:12:32 +11:00
Zelong Kuang
4607880ca4 Better dvisvgm latex preview 2026-04-03 15:12:01 +11:00
Zelong Kuang
204c683083 Update 2026-04-03 00:22:19 +11:00
Zelong Kuang
f2ec25c9d9 Moving back to elpaca, again 2026-04-02 19:21:30 +11:00
Zelong Kuang
abaeeb6486 Update 2026-04-02 15:31:43 +11:00
Zelong Kuang
a416bffb54 Update 2026-04-02 13:27:43 +11:00
Zelong Kuang
3e88318f79 Update 2026-03-30 16:37:02 +11:00
Zelong Kuang
a3468b833e Lot of optimisation, replace eglot with lsp-mode 2026-03-30 11:49:18 +11:00
Zelong Kuang
e1374b0e88 Reframed with straight.el 2026-03-29 19:12:45 +11:00
Zelong Kuang
6b017648ef Update 2026-03-24 22:21:29 +11:00
Zelong Kuang
a56b36b3f5 Update 2026-03-24 22:02:04 +11:00
63 changed files with 1199 additions and 1774 deletions

6
.gitignore vendored
View File

@@ -35,6 +35,7 @@ rime
.yas-compiled-snippets.el .yas-compiled-snippets.el
flycheck_*.el flycheck_*.el
tabsession.el tabsession.el
.lsp-session-v1
emacs.desktop emacs.desktop
history history
!alias !alias
@@ -42,6 +43,7 @@ history
# generated by elisp packages at root # generated by elisp packages at root
/.local/ /.local/
/.cask/ /.cask/
/tabspaces/
/auto/ /auto/
/auto-save-list/ /auto-save-list/
/cask/ /cask/
@@ -64,4 +66,6 @@ history
/undo-fu-session/ /undo-fu-session/
/..emacs.d-tabspaces-session.el /..emacs.d-tabspaces-session.el
/easysession /easysession
/tramp-rpc /tramp-rpc
/straight/
/eaf/

View File

@@ -1,2 +1 @@
* Basically there is nothing extra you need to do * Just Pull and run. Enjoy
run M-x my/generate-envvar-file

View File

@@ -1,49 +1,60 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
(setq gc-cons-threshold most-positive-fixnum (if noninteractive ; in CLI sessions
gc-cons-percentage 0.6) (setq-default gc-cons-threshold 100000000 ; 128MB
;; Backport from 29 (see emacs-mirror/emacs@73a384a98698)
gc-cons-percentage 1.0)
(setq-default gc-cons-threshold most-positive-fixnum))
;; After init, use gcmh (setq read-process-output-max (* 1024 1024))
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold #x6400000
gc-cons-percentage 0.1)))
(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))
(add-to-list 'load-path (expand-file-name "site-lisp/" user-emacs-directory))
(setq use-package-enable-imenu-support t) (setq use-package-enable-imenu-support t)
(setq load-prefer-newer noninteractive) (setq load-prefer-newer noninteractive)
(setenv "LSP_USE_PLISTS" "true") ;; Lsp-mode plists
(setenv "LIBGS" "/opt/homebrew/lib/libgs.dylib")
;; PERF: Many elisp file API calls consult `file-name-handler-alist'.
;; Setting it to nil speeds up startup significantly.
;; We restore it in init.el after startup.
(setq file-name-handler-alist nil)
;; PERF: Reduce file-name operations on `load-path'.
;; No dynamic modules are loaded this early, so we skip .so/.dll search.
;; Also skip .gz to avoid decompression checks.
(setq load-suffixes '(".elc" ".el")
load-file-rep-suffixes '(""))
(prefer-coding-system 'utf-8) (prefer-coding-system 'utf-8)
;; Inhibit resizing frame ;; Inhibit resizing frame
(setq frame-inhibit-implied-resize t) (setq frame-inhibit-implied-resize t)
;; Optimize `auto-mode-alist` ;; Suppress GUI features
(setq auto-mode-case-fold nil) (setq use-file-dialog nil
(unless (or (daemonp) noninteractive init-file-debug) use-dialog-box nil
;; Temporarily suppress file-handler processing to speed up startup inhibit-startup-screen t
(let ((default-handlers file-name-handler-alist)) inhibit-startup-echo-area-message user-login-name
(setq file-name-handler-alist nil) inhibit-default-init t
;; Recover handlers after startup ;; initial-major-mode 'l-mode
(add-hook 'emacs-startup-hook initial-scratch-message nil)
(lambda ()
(setq file-name-handler-alist
(delete-dups (append file-name-handler-alist default-handlers))))
101)))
;; Faster to disable these here (before they've been initialized) ;; Faster to disable these here (before they've been initialized)
(push '(menu-bar-lines . 0) default-frame-alist) (push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist) (push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars . 0) default-frame-alist) (push '(vertical-scroll-bars . nil) default-frame-alist)
(push '(horizontal-scroll-bars . nil) default-frame-alist)
(when (featurep 'ns) (when (featurep 'ns)
(push '(ns-transparent-titlebar . t) default-frame-alist)) (push '(ns-transparent-titlebar . t) default-frame-alist))
;; (push '(ns-appearance . light) default-frame-alist)) ;; (push '(ns-appearance . light) default-frame-alist))
;; Prevent flash of unstyled mode line ;; Prevent flash of unstyled mode line
;; (setq mode-line-format nil) (setq mode-line-format nil)
(provide 'early-init) (provide 'early-init)

16
history
View File

@@ -1,16 +0,0 @@
;; -*- mode: emacs-lisp; lexical-binding: t; coding: utf-8-emacs-unix -*-
;; Minibuffer history file, automatically generated by savehist.
(setq savehist-minibuffer-history-variables '(minibuffer-history consult--line-history rg-files-history rg-pattern-history file-name-history extended-command-history buffer-name-history))
(setq minibuffer-history '("cmake-mode MELPA"))
(setq consult--line-history '("ss"))
(setq rg-files-history '("elisp"))
(setq rg-pattern-history '("ss"))
(setq file-name-history '("~/.emacs.d/init.el" "~/.emacs.d/lisp/" "~/.emacs.d/lisp/init-coding.el" "~/.emacs.d/lisp/init-better-default.el" "~/.emacs.d/lisp/init-coding.el" "~/.emacs.d/lisp/init-shell.el" "~/.emacs.d/init.el" "~/.emacs.d/lisp/init-snippet.el" "~/.emacs.d/lisp/init-ui.el" "~/.emacs.d/lisp/init-vcs.el" "~/.emacs.d/lisp/init-workspace.el" "~/.emacs.d/early-init.el" "~/.emacs.d/lisp/init-edit.el" "~/.emacs.d/lisp/init-utils.el" "~/uni/Seminars/Algebraic Geometry/exer.tex" "~/.emacs.d/lisp/init-completion.el" "~/.emacs.d/lisp/init-eglot.el" "~/org/roam/20260222193638-ring.org" "~/org/yunnan.org" "~/org/workout.org" "~/org/todo.org" "~/org/notes.org" "~/org/learn-haskell.org" "~/org/diary.org" "~/org/roam/20260105223044-ideal_of_ring.org" "~/Library/texmf/tex/latex/local/elegantbook.cls" "~/.emacs.d/auctex/elegantbook.el" "~/Library/Rime/wubi091.dict.yaml" "~/Library/Rime/wubi091.schema.yaml" "~/.emacs.d/snippets/LaTeX-mode/in" "~/.emacs.d/snippets/LaTeX-mode/not in" "~/Library/Rime/pinyin_simp.txt" "~/.emacs.d/rime/user.yaml" "~/.emacs.d/snippets/LaTeX-mode/sqrt" "~/.emacs.d/bookmarks.eld" "~/org/roam/20260322143810-noetherian_topological_space_is_compact.org" "~/.config/aerospace/aerospace.toml" "~/.config/sketchybar/plugins/current_space.sh" "~/.config/sketchybar/sketchybarrc" "~/.config/sketchybar/plugins/aerospace.sh" "~/.emacs.d/lisp/init-org.el" "~/.emacs.d/elpaca/builds/org/org-loaddefs.el" "~/.emacs.d/lisp/init-tex.el" "~/uni/undergrad/26s1/Geometry/ass1/main.tex" "~/.emacs.d/snippets/LaTeX-mode/.yas-ignore-filenames-as-triggers" "~/uni/undergrad/26s1/Geometry/" "~/uni/undergrad/26s1/PFi/main.tex" "~/.emacs.d/snippets/LaTeX-mode/chastar.yasnippet" "~/.emacs.d/snippets/LaTeX-mode/star" "~/.emacs.d/snippets/LaTeX-mode/substar.yasnippet" "~/.emacs.d/snippets/LaTeX-mode/Display Math" "~/.emacs.d/snippets/LaTeX-mode/implied by" "~/.emacs.d/snippets/LaTeX-mode/less or equal" "~/.emacs.d/snippets/LaTeX-mode/lesser lesser" "~/.emacs.d/snippets/LaTeX-mode/greater or equal" "~/.emacs.d/snippets/LaTeX-mode/lrangle" "~/.emacs.d/eshell/alias" "~/.emacs.d/.gitignore" "~/.latexmkrc" "~/.emacs.d/lisp/init-window.el" "~/uni/undergrad/26s1/.projectile" "~/.emacs.d/snippets/LaTeX-mode/bigop.yasnippet" "~/org/roam/20260222194140-category_theory.org" "~/uni/Seminars/Representation theory/.projectile" "~/uni/Seminars/Representation theory/main.tex" "~/.emacs.d/snippets/LaTeX-mode/odot" "~/.emacs.d/snippets/LaTeX-mode/supset" "~/Library/texmf/tex/latex/local/auto/elegantbook.el" "~/uni/Seminars/Algebraic Geometry/auto/exer.el" "~/.config/nvim/LuaSnip/tex/math-commands.lua" "~/.emacs.d/snippets/LaTeX-mode/supseteq" "~/uni/Seminars/Representation theory/auto/main.el" "~/.emacs.d/auctex/auto/elegantbook.el" "~/org/roam/20260307170815-the_first_isomorphism_theorem.org" "~/org/roam/20251208162138-eu4_chinese_on_linux.org" "~/org/roam/20251207033411-quant.org" "~/org/roam/20251117171745-emacs.org" "~/.emacs.d/README.org" "~/.cache/org-persist/d8/df010c-12af-4345-96ea-38c574c74b6f-782ac370c3e966153f81b05909bf82d8.png" "~/org/todo.org_archive" "~/build-emacs-for-macos/flake.nix" "~/build-emacs-for-macos/go.mod" "~/build-emacs-for-macos/Brewfile" "~/.emacs.d/lisp/init-hydra.el" "~/docker_compose/yama.toml" "~/.emacs.d/snippets/LaTeX-mode/cap" "~/.emacs.d/snippets/LaTeX-mode/cup" "~/.emacs.d/snippets/LaTeX-mode/template" "~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/lisp/loaddefs.el.gz" "~/uni/undergrad/25s1/VCA/Notes/Vector-Calculus-Note.tex" "~/.emacs.d/lisp/init-dashboard.el"))
(setq extended-command-history '("easysession-reset" "elpaca-browse" "savehist-mode" "xref-find-definitions" "elisp-enable-lexical-binding" "elpaca-browse" "transient-posframe-mode" "elpaca-browse" "elisp-enable-lexical-binding" "transient-posframe-mode" "elpaca-browse" "proced" "elpaca-browse" "eldoc-mode" "benchmark-init/show-durations-tabulated"))
(setq buffer-name-history '("*Proced*"))
(setq projectile-project-command-history '#s(hash-table test equal))
(setq mark-ring 'nil)
(setq global-mark-ring 'nil)
(setq search-ring '(#("cod" 0 3 (isearch-case-fold-search t isearch-regexp-function nil)) #("recentf" 0 7 (isearch-case-fold-search t isearch-regexp-function nil)) #("doom-mode" 0 9 (isearch-case-fold-search t isearch-regexp-function nil)) #("easy" 0 4 (isearch-case-fold-search t isearch-regexp-function nil)) #("use-package rg" 0 14 (isearch-case-fold-search t isearch-regexp-function nil))))
(setq regexp-search-ring 'nil)

55
init.el
View File

@@ -2,50 +2,65 @@
;;; Commentary: ;;; Commentary:
;;; blablabla ;;; blablabla
;; Optimize `auto-mode-alist`
(setq auto-mode-case-fold nil)
;; Restore file-name-handler-alist after startup.
(unless (or (daemonp) noninteractive init-file-debug)
;; Temporarily suppress file-handler processing to speed up startup
(let ((default-handlers file-name-handler-alist))
(setq file-name-handler-alist nil)
;; Recover handlers after startup
(add-hook 'emacs-startup-hook
(lambda ()
(setq file-name-handler-alist
(delete-dups (append file-name-handler-alist default-handlers))))
101)))
(require 'init-elpaca) (require 'init-elpaca)
;; (require 'init-straight)
(require 'init-gc) (require 'init-gc)
(require 'init-better-default) (require 'init-better-default)
(require 'init-ui)
;; (require 'init-dashboard) ;; not working
(require 'init-god)
;; (require 'init-meow)
(require 'init-hydra) (require 'init-hydra)
(require 'init-utils) (require 'init-ui)
(require 'init-completion)
(require 'init-input)
(require 'init-edit) (require 'init-edit)
(require 'init-window) (require 'init-completion)
(require 'init-snippet)
(require 'init-bindings) (require 'init-bindings)
(require 'init-dired) (require 'init-dired)
;; (require 'init-dashboard) ;; not working
(require 'init-window)
(require 'init-shell)
;; (require 'init-treemacs) ;; not working
(require 'init-workspace)
(require 'init-llm) ;; (require 'init-god)
;; (require 'init-meow)
(require 'init-input)
(require 'init-utils)
;; (require 'init-eaf)
(require 'init-snippet)
(require 'init-coding) (require 'init-coding)
(require 'init-vcs) (require 'init-vcs)
(require 'init-shell) (require 'init-llm)
(require 'init-check) (require 'init-check)
;; (require 'init-treemacs) ;; not working (require 'init-writing)
(require 'init-eglot) ;; (require 'init-eglot)
;; (require 'init-lsp) ;; not working (require 'init-lsp)
(require 'init-org) (require 'init-org)
(require 'init-tex) (require 'init-tex)
(require 'init-markdown)
(require 'init-typst)
(require 'init-cc) (require 'init-cc)
(require 'init-python) (require 'init-python)
(require 'init-haskell) (require 'init-haskell)
(require 'init-rust) (require 'init-rust)
(require 'init-ocaml) (require 'init-ocaml)
(require 'init-typst)
(require 'init-workspace)
(provide 'init) (provide 'init)
;;; Code: ;;; Code:

View File

@@ -1,23 +1,106 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
(use-package benchmark-init (use-package benchmark-init :demand t
:ensure t :hook (elpaca-after-init . benchmark-init/deactivate))
:demand t
:config ;; Load some component of large package (org, magit etc.) before complete mount
;; To disable collection of benchmark data after init is done. (defvar elemacs-incremental-packages '(t)
(add-hook 'elpaca-after-init-hook 'benchmark-init/deactivate)) "A list of packages to load incrementally after startup. Any large packages
here may cause noticeable pauses, so it's recommended you break them up into
sub-packages. For example, `org' is comprised of many packages, and can be
broken up into:
(elemacs-load-packages-incrementally
'(calendar find-func format-spec org-macs org-compat
org-faces org-entities org-list org-pcomplete org-src
org-footnote org-macro ob org org-clock org-agenda
org-capture))
This is already done by the lang/org module, however.
If you want to disable incremental loading altogether, either remove
`doom-load-packages-incrementally-h' from `emacs-startup-hook' or set
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
in daemon sessions (they are loaded immediately at startup).")
(defvar elemacs-incremental-first-idle-timer 2.0
"How long (in idle seconds) until incremental loading starts.
Set this to nil to disable incremental loading.")
(defvar elemacs-incremental-idle-timer 0.75
"How long (in idle seconds) in between incrementally loading packages.")
(defvar elemacs-incremental-load-immediately (daemonp)
"If non-nil, load all incrementally deferred packages immediately at startup.")
(defun elemacs-load-packages-incrementally (packages &optional now)
"Registers PACKAGES to be loaded incrementally.
If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer'
intervals."
(if (not now)
(setq elemacs-incremental-packages (append elemacs-incremental-packages packages ))
(while packages
(let* ((gc-cons-threshold most-positive-fixnum)
(req (pop packages)))
(unless (featurep req)
(message "Incrementally loading %s" req)
(condition-case-unless-debug e
(or (while-no-input
;; If `default-directory' is a directory that doesn't exist
;; or is unreadable, Emacs throws up file-missing errors, so
;; we set it to a directory we know exists and is readable.
(let ((default-directory user-emacs-directory)
(inhibit-message t)
file-name-handler-alist)
(require req nil t))
t)
(push req packages))
(error
(message "Failed to load %S package incrementally, because: %s"
req e)))
(if (not packages)
(message "Finished incremental loading")
(run-with-idle-timer elemacs-incremental-idle-timer
nil #'elemacs-load-packages-incrementally
packages t)
(setq packages nil)))))))
(defun elemacs-load-packages-incrementally-h ()
"Begin incrementally loading packages in `elemacs-incremental-packages'.
If this is a daemon session, load them all immediately instead."
(if elemacs-incremental-load-immediately
(mapc #'require (cdr elemacs-incremental-packages))
(when (numberp elemacs-incremental-first-idle-timer)
(run-with-idle-timer elemacs-incremental-first-idle-timer
nil #'elemacs-load-packages-incrementally
(cdr elemacs-incremental-packages) t))))
(add-hook 'emacs-startup-hook #'elemacs-load-packages-incrementally-h)
(when (memq window-system '(mac ns x)) (when (memq window-system '(mac ns x))
(use-package exec-path-from-shell (use-package exec-path-from-shell
:commands exec-path-from-shell-initialize
:init :init
(setq exec-path-from-shell-arguments '("-l"))
(exec-path-from-shell-initialize))) (exec-path-from-shell-initialize)))
(setq custom-file (expand-file-name "~/.emacs.d/custom.el")) (setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
(add-hook '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 (use-package server
:ensure nil :ensure nil
:hook (elpaca-after-init . server-mode)) :autoload server-running-p
:hook (emacs-startup . (lambda ()
(unless (server-running-p)
(server-mode 1)))))
(use-package saveplace
:ensure nil
:hook (elpaca-after-init . save-place-mode))
(use-package display-line-numbers (use-package display-line-numbers
:ensure nil :ensure nil
@@ -28,21 +111,23 @@
circe-mode-hook circe-mode-hook
help-mode-hook help-mode-hook
gud-mode-hook gud-mode-hook
treemacs-mode-hook treemacs-mode-hook
org-mode-hook org-mode-hook
vterm-mode-hook)) vterm-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode -1)))) (add-hook mode (lambda () (display-line-numbers-mode -1))))
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
) )
(column-number-mode 1)
(scroll-bar-mode -1)
;; (use-package delete-trailing ;; (use-package del-trailing-white
;; :ensure nil ;; :ensure nil
;; :hook (text-mode delete-trailing-whitespace-mode) ;; :hook ((prog-mode markdown-mode conf-mode) . enable-trailing-whitespace)
;; :hook (prog-mode delete-trailing-whitespace-mode)) ;; :init
(add-hook 'prog-mode #'delete-trailing-whitespace-mode) ;; (setq-default show-trailing-whitespace nil)
(add-hook 'text-mode #'delete-trailing-whitespace-mode) ;; (defun enable-trailing-whitespace ()
;; "Show trailing spaces and delete on saving."
;; (setq show-trailing-whitespace t)
;; (add-hook 'before-save-hook #'delete-trailing-whitespace nil t))
;; )
(use-package subword (use-package subword
:ensure nil :ensure nil
@@ -53,25 +138,26 @@
:ensure nil :ensure nil
:hook (elpaca-after-init . show-paren-mode)) :hook (elpaca-after-init . show-paren-mode))
;; Show trailing whitespace only in prog-mode and text-mode ;; ;; Show trailing whitespace only in prog-mode and text-mode
(add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace t))) ;; (add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace t)))
(add-hook 'text-mode-hook (lambda () (setq show-trailing-whitespace t))) ;; (add-hook 'text-mode-hook (lambda () (setq show-trailing-whitespace t)))
(use-package recentf (use-package recentf
:ensure nil :ensure nil
:hook (elpaca-after-init . recentf-mode) :hook (elpaca-after-init . recentf-mode)
:custom :init
(recentf-max-saved-items 500) (setq recentf-max-saved-items 500
(recentf-exclude recentf-exclude
'("\\.?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/"
(lambda (file) (file-in-directory-p file package-user-dir)))) "^/sshx:" "^/sudo:"
(lambda (file) (file-in-directory-p file package-user-dir)))
recentf-auto-cleanup 'never)
:config :config
(push (expand-file-name recentf-save-file) recentf-exclude) (push (expand-file-name recentf-save-file) recentf-exclude)
(add-to-list 'recentf-filename-handlers #'abbreviate-file-name) (add-to-list 'recentf-filename-handlers #'abbreviate-file-name))
)
(use-package savehist (use-package savehist
:ensure nil :ensure nil
@@ -86,9 +172,15 @@
savehist-autosave-interval 300)) savehist-autosave-interval 300))
(setq-default cursor-type 'bar) (setq-default cursor-type 'bar)
(setq kill-whole-line t)
(setq make-backup-files nil) (setq make-backup-files nil)
(setq use-short-answers t) (setq use-short-answers t)
;; (setq frame-title-format "\n") (setq frame-title-format
'((:eval (if (and (boundp 'projectile-mode)
projectile-mode
(projectile-project-p))
(format "[%s] %s" (projectile-project-name) (buffer-name)) ;; Add project name in front when avaliable
"%b")))) ;; Otherwise buffer name only
(setq custom-safe-themes t) (setq custom-safe-themes t)
(add-to-list 'default-frame-alist '(drag-internal-border . 1)) (add-to-list 'default-frame-alist '(drag-internal-border . 1))
@@ -106,16 +198,8 @@
password-cache-expiry nil) password-cache-expiry nil)
(setq-default delete-by-moving-to-trash t (setq-default delete-by-moving-to-trash t
x-stretch-cursor t x-stretch-cursor t
window-combination-resize t) window-combination-resize t)
(define-key global-map (kbd "C-<wheel-up>") nil)
(define-key global-map (kbd "C-<wheel-down>") nil)
(global-set-key (kbd "s-a") 'mark-whole-buffer) ;;对应Windows上面的Ctrl-a 全选
(global-set-key (kbd "s-c") 'kill-ring-save) ;;对应Windows上面的Ctrl-c 复制
(global-set-key (kbd "s-s") 'save-buffer) ;; 对应Windows上面的Ctrl-s 保存
(global-set-key (kbd "s-v") 'yank) ;对应Windows上面的Ctrl-v 粘贴
(global-set-key (kbd "s-z") 'undo) ;对应Windows上面的Ctrol-z 撤销
(setq kill-ring-max 200) (setq kill-ring-max 200)
;; Save clipboard contents into kill-ring before replace them ;; Save clipboard contents into kill-ring before replace them
@@ -135,7 +219,7 @@
(use-package ultra-scroll (use-package ultra-scroll
:init :init
(setq scroll-conservatively 3 (setq scroll-conservatively 3
scroll-margin 0) scroll-margin 0)
:hook (elpaca-after-init . ultra-scroll-mode)) :hook (elpaca-after-init . ultra-scroll-mode))
(use-package helpful (use-package helpful
@@ -167,14 +251,23 @@
(lambda (button) (lambda (button)
(helpful-variable (button-get button 'apropos-symbol)))))))) (helpful-variable (button-get button 'apropos-symbol))))))))
(setq delete-by-moving-to-trash t
inhibit-compacting-font-caches t
make-backup-files nil)
(setq-default auto-save-default nil) (setq-default auto-save-default nil)
(setq create-lockfiles nil)
;; (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)))
(use-package tramp-hlo (use-package tramp
:config :config
(tramp-hlo-setup)) (setq tramp-default-method "rpc"))
(use-package tramp-hlo
:hook (elpaca-after-init . 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

@@ -1,12 +1,13 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
(define-prefix-command 'orgmode-map) (define-key global-map (kbd "C-<wheel-up>") nil)
(global-set-key (kbd "C-c n") 'orgmode-map) (define-key global-map (kbd "C-<wheel-down>") nil)
(global-set-key (kbd "s-a") 'mark-whole-buffer) ;;对应Windows上面的Ctrl-a 全选
(define-key orgmode-map (kbd "a") #'org-agenda) (global-set-key (kbd "s-c") 'kill-ring-save) ;;对应Windows上面的Ctrl-c 复制
(define-key orgmode-map (kbd "n") #'org-capture) (global-set-key (kbd "s-s") 'save-buffer) ;; 对应Windows上面的Ctrl-s 保存
(define-key orgmode-map (kbd "t") #'org-todo-list) (global-set-key (kbd "s-v") 'yank) ;对应Windows上面的Ctrl-v 粘贴
(global-set-key (kbd "s-x") 'execute-extended-command) ;对应Windows上面的Ctrol-z 撤销
(global-set-key (kbd "s-z") 'undo) ;对应Windows上面的Ctrol-z 撤销
(setq duplicate-line-final-position 1) (setq duplicate-line-final-position 1)
(global-set-key (kbd "M-p") #'duplicate-dwim) (global-set-key (kbd "M-p") #'duplicate-dwim)
@@ -15,4 +16,24 @@
(global-set-key (kbd "C-c C-c") #'compile) (global-set-key (kbd "C-c C-c") #'compile)
(defun delete-this-file ()
"Delete the current file, and kill the buffer."
(interactive)
(unless (buffer-file-name)
(error "No file is currently being edited"))
(when (yes-or-no-p (format "Really delete '%s'?"
(file-name-nondirectory buffer-file-name)))
(delete-file (buffer-file-name))
(kill-this-buffer)))
(defun reload-init-file ()
"Reload Emacs configurations."
(interactive)
(load user-init-file))
(bind-keys ("s-r" . revert-buffer-quick)
("C-x K" . delete-this-file)
("C-c C-l" . reload-init-file)
("C-c C-w 0" . desktop-clear))
(provide 'init-bindings) (provide 'init-bindings)

View File

@@ -19,10 +19,10 @@
(add-to-list 'major-mode-remap-alist (add-to-list 'major-mode-remap-alist
'(c-or-c++-mode . c-or-c++-ts-mode))))) '(c-or-c++-mode . c-or-c++-ts-mode)))))
(with-eval-after-load 'eglot ;; (with-eval-after-load 'eglot
(add-hook 'c-ts-mode-hook #'eglot-ensure) ;; (add-hook 'c-ts-mode-hook #'eglot-ensure)
(add-hook 'c++-ts-mode-hook #'eglot-ensure) ;; (add-hook 'c++-ts-mode-hook #'eglot-ensure)
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))) ;; (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
(provide 'init-cc) (provide 'init-cc)

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

@@ -11,39 +11,13 @@
(setq xref-show-definitions-function #'xref-show-definitions-completing-read (setq xref-show-definitions-function #'xref-show-definitions-completing-read
xref-show-xrefs-function #'xref-show-definitions-completing-read)) xref-show-xrefs-function #'xref-show-definitions-completing-read))
(use-package apheleia (use-package apheleia :diminish
:diminish :hook (prog-mode))
:hook (elpaca-after-init . apheleia-global-mode))
(use-package editorconfig (use-package editorconfig
:diminish :diminish
:hook elpaca-after-init) :hook elpaca-after-init)
(use-package cask-mode)
(use-package csv-mode)
(use-package cue-sheet-mode)
(use-package dart-mode)
(use-package lua-mode)
(use-package v-mode)
(use-package vimrc-mode)
(use-package julia-ts-mode)
(use-package scala-ts-mode)
(use-package yaml-ts-mode
:ensure nil
:mode ("\\.yaml\\'" . yaml-ts-mode))
;; Fish shell mode and auto-formatting
(use-package fish-mode
:commands fish_indent-before-save
:defines eglot-server-programs
:hook (fish-mode . (lambda ()
"Integrate `fish_indent` formatting with Fish shell mode."
(add-hook 'before-save-hook #'fish_indent-before-save)))
:config
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(fish-mode . ("fish-lsp" "start")))))
(use-package docker-compose-mode) (use-package docker-compose-mode)
(use-package treesit-auto (use-package treesit-auto

View File

@@ -32,7 +32,7 @@
;; Optionally use the `orderless' completion style. ;; Optionally use the `orderless' completion style.
(use-package orderless (use-package orderless
:custom :custom
(completion-styles '(orderless basic)) (completion-styles '(orderless partial-completion basic))
(completion-category-defaults nil) (completion-category-defaults nil)
(completion-category-overrides '((file (styles orderless partial-completion)))) (completion-category-overrides '((file (styles orderless partial-completion))))
(orderless-component-separator #'orderless-escapable-split-on-space)) (orderless-component-separator #'orderless-escapable-split-on-space))
@@ -52,9 +52,9 @@
(use-package vertico (use-package vertico
:custom (vertico-count 15) :custom (vertico-count 15)
:bind (:map vertico-map :bind (:map vertico-map
("RET" . vertico-directory-enter) ("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char) ("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word)) ("M-DEL" . vertico-directory-delete-word))
:hook (elpaca-after-init . vertico-mode) :hook (elpaca-after-init . vertico-mode)
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy)) :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
@@ -111,16 +111,14 @@
;; Consulting completing-read ;; Consulting completing-read
(use-package consult (use-package consult
:commands consult-customize
:bind (("C-." . consult-imenu) :bind (("C-." . consult-imenu)
("C-c T" . consult-theme) ("C-c T" . consult-theme)
([remap Info-search] . consult-info)
([remap Info-search] . consult-info)
;; ([remap isearch-forward] . consult-line) ;; ([remap isearch-forward] . consult-line)
([remap recentf-open-files] . consult-recent-file) ([remap recentf-open-files] . consult-recent-file)
([remap bookmark-jump] . consult-bookmark)
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
;; Custom M-# bindings for fast register access ;; Custom M-# bindings for fast register access
("M-#" . consult-register-load) ("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
@@ -138,9 +136,9 @@
("M-g k" . consult-global-mark) ("M-g k" . consult-global-mark)
("M-g i" . consult-imenu) ("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi) ("M-g I" . consult-imenu-multi)
;; M-g bindings in `search-map' ;; M-g bindings in `search-map'
("s-f" . consult-line) ("s-f" . consult-line)
("M-g d" . consult-find) ;; Alternative: consult-fd ("M-g d" . consult-find) ;; Alternative: consult-fd
("M-g c" . consult-locate) ("M-g c" . consult-locate)
("M-g G" . consult-git-grep) ("M-g G" . consult-git-grep)
@@ -149,8 +147,8 @@
("M-g L" . consult-line-multi) ("M-g L" . consult-line-multi)
("M-g k" . consult-keep-lines) ("M-g k" . consult-keep-lines)
("M-g u" . consult-focus-lines) ("M-g u" . consult-focus-lines)
("C-x C-r" . consult-recent-file) ("C-x C-r" . consult-recent-file)
("C-x B" . consult-buffer) ("C-x b" . consult-buffer)
("M-g e" . consult-isearch-history) ("M-g e" . consult-isearch-history)
:map isearch-mode-map :map isearch-mode-map
@@ -165,11 +163,9 @@
(setq xref-show-xrefs-function #'consult-xref (setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)) xref-show-definitions-function #'consult-xref))
;; (use-package consult-projectile)
(use-package consult-flycheck) (use-package consult-flycheck)
(use-package consult-dir (use-package consult-dir
:ensure t
:bind (("C-x C-d" . consult-dir) :bind (("C-x C-d" . consult-dir)
:map minibuffer-local-completion-map :map minibuffer-local-completion-map
("C-x C-d" . consult-dir) ("C-x C-d" . consult-dir)
@@ -223,7 +219,7 @@
(use-package embark-consult (use-package embark-consult
:bind (:map minibuffer-mode-map :bind (:map minibuffer-mode-map
("C-c C-o" . embark-export)) ("C-c C-o" . embark-export))
:hook (embark-collect-mode . consult-preview-at-point-mode)) :hook (embark-collect-mode . consult-preview-at-point-mode))
;; Auto completion ;; Auto completion
@@ -240,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
@@ -255,10 +252,9 @@
(advice-add #'persistent-scratch-save :before #'corfu-quit) (advice-add #'persistent-scratch-save :before #'corfu-quit)
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer)) (add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer))
;; (use-package nerd-icons-corfu (use-package nerd-icons-corfu
;; :init :init
;; (with-eval-after-load 'corfu (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
;; (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)))
;; A few more useful configurations... ;; A few more useful configurations...
(use-package emacs (use-package emacs
@@ -294,14 +290,10 @@
(advice-add 'lsp-completion-at-point :around #'cape-wrap-noninterruptible) (advice-add 'lsp-completion-at-point :around #'cape-wrap-noninterruptible)
(advice-add 'lsp-completion-at-point :around #'cape-wrap-nonexclusive) (advice-add 'lsp-completion-at-point :around #'cape-wrap-nonexclusive)
(advice-add 'comint-completion-at-point :around #'cape-wrap-nonexclusive) (advice-add 'comint-completion-at-point :around #'cape-wrap-nonexclusive)
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) ;; (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
(advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive) ;; (advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive)
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive)) (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive))
;; (use-package yasnippet-capf
;; :after cape
;; :config
;; (add-to-list 'completion-at-point-functions #'yasnippet-capf))
(provide 'init-completion) (provide 'init-completion)

View File

@@ -4,45 +4,37 @@
:ensure nil :ensure nil
:bind (:map dired-mode-map :bind (:map dired-mode-map
("C-c C-p" . wdired-change-to-wdired-mode) ("C-c C-p" . wdired-change-to-wdired-mode)
("b" . dired-up-directory)) ("b" . dired-up-directory))
:config :config
;; 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
(setq dired-listing-switches "-alh --group-directories-first" (setq dired-listing-switches "-alh --group-directories-first"
dired-use-ls-dired t) dired-use-ls-dired t))
;; Colorful dired
(use-package diredfl
:diminish
:hook dired-mode
:hook dirvish-directory-view-mode)
;; Extra Dired functionality ;; Colorful dired
(use-package dired-aux :ensure nil)) (use-package diredfl
:diminish
:hook dired-mode
:hook dirvish-directory-view-mode)
;; Extra Dired functionality
(use-package dired-aux :ensure nil)
(use-package nerd-icons-dired (use-package nerd-icons-dired
:diminish :diminish
:functions (nerd-icons-icon-for-dir my-nerd-icons-icon-for-dir) :hook
:hook dired-mode (dired-mode . nerd-icons-dired-mode))
:init
(defface nerd-icons-dired-dir-face
'((t (:inherit 'font-lock-doc-face)))
"Face for the directory icon."
:group 'nerd-icons-faces)
(defun my-nerd-icons-icon-for-dir (dir)
(nerd-icons-icon-for-dir dir :face 'nerd-icons-dired-dir-face))
(setq nerd-icons-dired-dir-icon-function #'my-nerd-icons-icon-for-dir))
;; (use-package dirvish ;; (use-package dirvish
;; :bind ("C-c o p" . dirvish-side) ;; :bind ("C-c o p" . dirvish-side)
;; :init (dirvish-override-dired-mode)
;; :config ;; :config
;; (setq dirvish-use-header-line nil ;; (setq dirvish-use-header-line nil
;; dirvish-use-mode-line nil)) ;; dirvish-use-mode-line nil))
(provide 'init-dired) (provide 'init-dired)

28
lisp/init-eaf.el Normal file
View File

@@ -0,0 +1,28 @@
;; -*- lexical-binding: t; -*-
(use-package eaf
:defer nil
:load-path "~/.emacs.d/site-lisp/emacs-application-framework/"
:custom ; See https://github.com/emacs-eaf/emacs-application-framework/wiki/Customization
(eaf-browser-continue-where-left-off t)
(eaf-browser-enable-adblocker t)
;; (browse-url-browser-function 'eaf-open-browser)
:defines eaf-pdf-viewer-keybinding
:config
(require 'eaf-pdf-viewer)
(require 'eaf-music-player)
;; (require 'eaf-jupyter)
(require 'eaf-mindmap)
(require 'eaf-markdown-previewer)
(require 'eaf-system-monitor)
(require 'eaf-js-video-player)
(require 'eaf-image-viewer)
(eaf-bind-key scroll_up "C-n" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_down "C-p" eaf-pdf-viewer-keybinding)
)
(provide 'init-eaf)

View File

@@ -4,53 +4,45 @@
:ensure nil :ensure nil
:hook (elpaca-after-init . delete-selection-mode)) :hook (elpaca-after-init . delete-selection-mode))
(use-package smartparens (use-package electric-pair-mode
:diminish :ensure nil
:hook (elpaca-after-init . smartparens-global-mode) :hook elpaca-after-init
;; :hook (elpaca-after-init . smartparens-global-strict-mode)
:init (sp-use-paredit-bindings)
:config :config
;; Autopair quotes more conservatively; if I'm next to a word/before another (dolist (mode '(LaTeX-mode-hook org-mode-hook))
;; quote, I don't want to open a new pair or it would unbalance them. (add-hook mode
(let ((unless-list '(sp-point-before-word-p (lambda ()
sp-point-after-word-p (setq-local electric-pair-pairs
sp-point-before-same-p))) (append electric-pair-pairs '((?\\ . ?\\))))
(sp-pair "'" nil :unless unless-list) (setq-local electric-pair-text-pairs electric-pair-pairs)))))
(sp-pair "\"" nil :unless unless-list))
(dolist (brace '("(" "{" "["))
(sp-pair brace nil
:post-handlers '(("||\n[i]" "RET") ("| " "SPC"))
;; Don't autopair opening braces if before a word character or
;; other opening brace. The rationale: it interferes with manual
;; balancing of braces, and is odd form to have s-exps with no
;; whitespace in between, e.g. ()()(). Insert whitespace if
;; genuinely want to start a new form in the middle of a word.
:unless '(sp-point-before-word-p sp-point-before-same-p)))
(sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p)) (use-package puni
:hook (elpaca-after-init . puni-global-mode)
:custom
(puni-confirm-when-delete-unbalanced-active-region nil)
:bind (:map puni-mode-map
("M-s" . puni-splice)
("DEL" . my-backspace)
("C-=" . puni-expand-region)
)
:init
(defun my-backspace ()
(interactive)
(if (looking-back (rx line-start (+ blank)))
(delete-region (line-beginning-position) (point))
(puni-backward-delete-char))))
;; Don't do square-bracket space-expansion where it doesn't make sense to ;; (use-package combobulate
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode) ;; :ensure (:host github :repo "mickeynp/combobulate")
"[" nil :post-handlers '(:rem ("| " "SPC"))) ;; :hook prog-mode
;; :config
;; resolve conflict with hungry-delete ;; ;; You can customize Combobulate's key prefix here.
(defadvice hungry-delete-backward (before sp-delete-pair-advice activate) (save-match-data (sp-delete-pair (ad-get-arg 0))))) ;; ;; Note that you may have to restart Emacs for this to take effect!
;; (setq combobulate-key-prefix "C-c o")
;; (use-package electric-pair ;; )
;; :ensure nil
;; :hook elpaca-after-init)
;; Hungry deletion
(use-package hungry-delete
:diminish
:hook (elpaca-after-init . global-hungry-delete-mode)
:init (setq hungry-delete-chars-to-skip " \t\f\v"
hungry-delete-except-modes
'(help-mode minibuffer-mode minibuffer-inactive-mode calc-mode)))
(use-package abbrev (use-package abbrev
:diminish
:ensure nil :ensure nil
:diminish
:config :config
(setq-default abbrev-mode t) (setq-default abbrev-mode t)
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory))) (setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory)))
@@ -78,8 +70,8 @@
:map mc/keymap :map mc/keymap
("C-|" . mc/vertical-align-with-space))) ("C-|" . mc/vertical-align-with-space)))
(use-package smart-region ;; (use-package expand-region
:hook (after-init . smart-region-on)) ;; :bind ("C-=" . er/expand-region))
(use-package mwim (use-package mwim
:bind (([remap move-beginning-of-line] . mwim-beginning) :bind (([remap move-beginning-of-line] . mwim-beginning)
@@ -138,10 +130,18 @@
(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)
(olivetti-body-width 90)) (olivetti-body-width 80))
(setq-default bidi-display-reordering 'left-to-right
bidi-paragraph-direction 'left-to-right
bidi-display-reordering nil)
(setq bidi-inhibit-bpa t
long-line-threshold 1000
large-hscroll-threshold 1000
syntax-wholeline-max 1000)
(provide 'init-edit) (provide 'init-edit)

View File

@@ -1,9 +1,7 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
(use-package jsonrpc)
(use-package eglot (use-package eglot
:defer t :commands (eglot eglot-ensure)
:hook ((prog-mode . (lambda () :hook ((prog-mode . (lambda ()
(unless (derived-mode-p (unless (derived-mode-p
'emacs-lisp-mode 'lisp-mode 'emacs-lisp-mode 'lisp-mode
@@ -13,7 +11,7 @@
(eglot-ensure)))) (eglot-ensure))))
((markdown-mode yaml-mode yaml-ts-mode) . eglot-ensure)) ((markdown-mode yaml-mode yaml-ts-mode) . eglot-ensure))
:bind (:map eglot-mode-map :bind (:map eglot-mode-map
("C-c c a" . eglot-code-actions)) ("C-c c a" . eglot-code-actions))
:config :config
(setq completion-category-defaults nil) (setq completion-category-defaults nil)
(setq eglot-autoshutdown t (setq eglot-autoshutdown t
@@ -27,12 +25,14 @@
:config (eglot-booster-mode)) :config (eglot-booster-mode))
(use-package flycheck-eglot (use-package flycheck-eglot
:after eglot
:hook (eglot-managed-mode . flycheck-eglot-mode)) :hook (eglot-managed-mode . flycheck-eglot-mode))
(use-package consult-eglot (use-package consult-eglot
:after consult eglot :after consult
:after eglot
:bind (:map eglot-mode-map :bind (:map eglot-mode-map
([remap xref-find-apropos] . consult-eglot-symbols)) ([remap xref-find-apropos] . consult-eglot-symbols))
:config :config
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)) (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
@@ -40,10 +40,12 @@
;; :hook (eglot-managed-mode . eldoc-box-hover-at-point-mode)) ;; :hook (eglot-managed-mode . eldoc-box-hover-at-point-mode))
(use-package eldoc (use-package eldoc
:after eglot
:ensure nil :ensure nil
:diminish) :diminish)
(use-package eldoc-mouse (use-package eldoc-mouse
:after eldoc
:diminish :diminish
:hook eldoc-mode) :hook eldoc-mode)

View File

@@ -39,12 +39,6 @@
(let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) (let ((load-source-file-function nil)) (load "./elpaca-autoloads"))))
(add-hook 'after-init-hook #'elpaca-process-queues) (add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order)) (elpaca `(,@elpaca-order))
;; Install a package via the elpaca macro
;; See the "recipes" section of the manual for more details.
;; (elpaca example-package)
;; Uncomment for systems which cannot create symlinks:
(when (eq system-type 'windows-nt) (when (eq system-type 'windows-nt)
(elpaca-no-symlink-mode)) (elpaca-no-symlink-mode))
@@ -60,13 +54,34 @@
;;For example: ;;For example:
;;(use-package general :ensure (:wait t) :demand t) ;;(use-package general :ensure (:wait t) :demand t)
(setq elpaca-lock-file (expand-file-name "lock-file.eld" user-emacs-directory))
(setq use-package-always-ensure t (setq use-package-always-ensure t
use-package-expand-minimally t use-package-expand-minimally t
use-package-always-defer t) use-package-always-defer t)
(use-package diminish) (use-package elpaca-ui
:ensure nil
:bind (:map elpaca-ui-mode-map
("p" . previous-line)
("F" . elpaca-ui-mark-pull))
:hook (elpaca-log-mode . elpaca-log-update-mode)
:after popper
:init
(add-to-list 'popper-reference-buffers
'elpaca-log-mode)
(setf (alist-get '(major-mode . elpaca-log-mode)
display-buffer-alist
nil nil #'equal)
'((display-buffer-at-bottom
display-buffer-in-side-window)
(side . below)
(slot . 49)
(window-height . 0.4)
(body-function . select-window))
(alist-get "\\*elpaca-diff\\*" display-buffer-alist
nil nil #'equal)
'((display-buffer-reuse-window
display-buffer-in-atom-window)
(side . right))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@@ -3,10 +3,10 @@
(use-package gcmh (use-package gcmh
:diminish :diminish
:ensure (:wait t) ;; what does this do in elpaca :hook (emacs-startup . gcmh-mode)
:init
(gcmh-mode 1)
:config :config
(setq gcmh-high-cons-threshold #x6400000)) (setq gcmh-high-cons-threshold #x4000000
gcmh-idle-delay 'auto
gcmh-auto-idle-delay-factor 10))
(provide 'init-gc) (provide 'init-gc)

View File

@@ -1,3 +1,5 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
(use-package god-mode (use-package god-mode

View File

@@ -12,8 +12,18 @@
:config :config
(setq haskell-process-suggest-remove-import-lines t (setq haskell-process-suggest-remove-import-lines t
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"))
(add-hook 'haskell-mode-hook #'eglot-ensure))
(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

@@ -4,6 +4,14 @@
:custom :custom
(default-input-method "rime") (default-input-method "rime")
(rime-librime-root "/opt/homebrew") (rime-librime-root "/opt/homebrew")
(rime-emacs-module-header-root "~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/include/")) (rime-emacs-module-header-root "~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/include/")
(rime-show-candidate 'posframe)
(rime-posframe-properties nil))
;; (use-package sis
;; :hook ((elpaca-after-init . sis-global-respect-mode)
;; (elpaca-after-init . sis-global-context-mode)
;; (elpaca-after-init . sis-global-inline-mode)))
(provide 'init-input) (provide 'init-input)

View File

@@ -3,9 +3,9 @@
(use-package gptel (use-package gptel
:defer t :defer t
:bind (("C-c l s" . gptel-send) :bind (("C-c l s" . gptel-send)
("C-c l m" . gptel-menu)) ("C-c l m" . gptel-menu))
:config :config
(setq gptel-model 'claude-sonnet-4.5) (setq gptel-model 'gpt-5.2)
(setq gptel-backend (gptel-make-gh-copilot "Copilot")) (setq gptel-backend (gptel-make-gh-copilot "Copilot"))
(setq gptel-default-mode #'org-mode) (setq gptel-default-mode #'org-mode)
(setq gptel-display-buffer-action nil) ; if user changes this, popup manager will bow out (setq gptel-display-buffer-action nil) ; if user changes this, popup manager will bow out

View File

@@ -1,147 +1,189 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
;; LSP booster
(use-package lsp-mode (use-package lsp-mode
:diminish :diminish
:defines (lsp-diagnostics-disabled-modes lsp-clients-python-library-directories)
:autoload lsp-enable-which-key-integration :autoload lsp-enable-which-key-integration
:commands (lsp-format-buffer lsp-organize-imports lsp lsp-deferred)
:hook ((prog-mode . (lambda () :hook ((prog-mode . (lambda ()
(unless (derived-mode-p (unless (derived-mode-p
'emacs-lisp-mode 'lisp-mode 'emacs-lisp-mode 'lisp-mode
'makefile-mode 'snippet-mode 'makefile-mode 'snippet-mode
'ron-mode) 'lisp-data-mode 'ron-mode)
(lsp-deferred)))) (lsp-deferred))))
((markdown-mode yaml-mode yaml-ts-mode) . lsp-deferred) ((markdown-mode yaml-mode yaml-ts-mode) . lsp-deferred)
(lsp-mode . (lambda () (lsp-mode . (lambda ()
;; Integrate `which-key' ;; Integrate `which-key'
(lsp-enable-which-key-integration)))) (lsp-enable-which-key-integration)
;; (add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))))
:hook (lsp-completion-mode . my/lsp-mode-setup-completion)
:bind (:map lsp-mode-map :bind (:map lsp-mode-map
("C-c c d" . lsp-describe-thing-at-point) ("C-c c d" . lsp-describe-thing-at-point)
([remap xref-find-definitions] . lsp-find-definition) ([remap xref-find-definitions] . lsp-find-definition)
([remap xref-find-references] . lsp-find-references)) ([remap xref-find-references] . lsp-find-references))
:init (setq lsp-use-plists t :init
lsp-log-io nil (defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless)))
(setq lsp-use-plists t
lsp-log-io nil
lsp-keymap-prefix "C-c c" lsp-enable-suggest-server-download t
lsp-keep-workspace-alive nil ;; lsp-auto-configure t
lsp-signature-auto-activate nil
lsp-modeline-code-actions-enable nil
lsp-modeline-diagnostics-enable nil
lsp-modeline-workspace-status-enable nil
lsp-semantic-tokens-enable t lsp-keymap-prefix "C-c c"
lsp-progress-spinner-type 'progress-bar-filled lsp-keep-workspace-alive nil
lsp-signature-auto-activate nil
lsp-modeline-code-actions-enable nil
lsp-modeline-diagnostics-enable nil
lsp-modeline-workspace-status-enable nil
lsp-enable-file-watchers nil lsp-completion-enable t
lsp-enable-folding nil lsp-completion-provider :none ;; using corfu
lsp-enable-symbol-highlighting nil lsp-completion-enable-additional-text-edit t
lsp-enable-text-document-color nil lsp-enable-snippet t
lsp-completion-show-kind t
lsp-enable-indentation nil lsp-semantic-tokens-enable t
lsp-enable-on-type-formatting nil) lsp-progress-spinner-type 'progress-bar-filled
lsp-enable-file-watchers nil
lsp-enable-folding nil
lsp-enable-symbol-highlighting nil
lsp-enable-text-document-color nil
lsp-enable-imenu t
lsp-enable-indentation nil
lsp-enable-on-type-formatting nil
;; For diagnostics
lsp-diagnostics-disabled-modes '(markdown-mode gfm-mode))
:config :config
(use-package consult-lsp (with-no-warnings
:bind (:map lsp-mode-map ;; Disable `lsp-mode' in `git-timemachine-mode'
("C-M-." . consult-lsp-symbols))) (defun my/lsp--init-if-visible (fn &rest args)
(unless (bound-and-true-p git-timemachine-mode)
(apply fn args)))
(advice-add #'lsp--init-if-visible :around #'my/lsp--init-if-visible))
;; Enable `lsp-mode' in sh/bash/zsh
(defun my/lsp-bash-check-sh-shell (&rest _)
(and (memq major-mode '(sh-mode bash-ts-mode))
(memq sh-shell '(sh bash zsh))))
(advice-add #'lsp-bash-check-sh-shell :override #'my/lsp-bash-check-sh-shell)
(add-to-list 'lsp-language-id-configuration '(bash-ts-mode . "shellscript"))
:preface
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
(when (equal (following-char) ?#)
(let ((bytecode (read (current-buffer))))
(when (byte-code-function-p bytecode)
(funcall bytecode))))
(apply old-fn args)))
(advice-add (if (progn (require 'json)
(fboundp 'json-parse-buffer))
'json-parse-buffer
'json-read)
:around
#'lsp-booster--advice-json-parse)
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(append (list "emacs-lsp-booster" "--") orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
)
(use-package consult-lsp
:bind (:map lsp-mode-map
("C-M-." . consult-lsp-symbols)))
(use-package lsp-ui
:custom-face
(lsp-ui-sideline-code-action ((t (:inherit warning))))
:pretty-hydra
((:color amaranth :quit-key ("q" "C-g"))
("Doc"
(("d e" (progn
(lsp-ui-doc-enable (not lsp-ui-doc-mode))
(setq lsp-ui-doc-enable (not lsp-ui-doc-enable)))
"enable" :toggle lsp-ui-doc-mode)
("d s" (setq lsp-ui-doc-include-signature (not lsp-ui-doc-include-signature))
"signature" :toggle lsp-ui-doc-include-signature)
("d t" (setq lsp-ui-doc-position 'top)
"top" :toggle (eq lsp-ui-doc-position 'top))
("d b" (setq lsp-ui-doc-position 'bottom)
"bottom" :toggle (eq lsp-ui-doc-position 'bottom))
("d p" (setq lsp-ui-doc-position 'at-point)
"at point" :toggle (eq lsp-ui-doc-position 'at-point))
("d h" (setq lsp-ui-doc-header (not lsp-ui-doc-header))
"header" :toggle lsp-ui-doc-header)
("d f" (setq lsp-ui-doc-alignment 'frame)
"align frame" :toggle (eq lsp-ui-doc-alignment 'frame))
("d w" (setq lsp-ui-doc-alignment 'window)
"align window" :toggle (eq lsp-ui-doc-alignment 'window)))
"Sideline"
(("s e" (progn
(lsp-ui-sideline-enable (not lsp-ui-sideline-mode))
(setq lsp-ui-sideline-enable (not lsp-ui-sideline-enable)))
"enable" :toggle lsp-ui-sideline-mode)
("s h" (setq lsp-ui-sideline-show-hover (not lsp-ui-sideline-show-hover))
"hover" :toggle lsp-ui-sideline-show-hover)
("s d" (setq lsp-ui-sideline-show-diagnostics (not lsp-ui-sideline-show-diagnostics))
"diagnostics" :toggle lsp-ui-sideline-show-diagnostics)
("s s" (setq lsp-ui-sideline-show-symbol (not lsp-ui-sideline-show-symbol))
"symbol" :toggle lsp-ui-sideline-show-symbol)
("s c" (setq lsp-ui-sideline-show-code-actions (not lsp-ui-sideline-show-code-actions))
"code actions" :toggle lsp-ui-sideline-show-code-actions)
("s i" (setq lsp-ui-sideline-ignore-duplicate (not lsp-ui-sideline-ignore-duplicate))
"ignore duplicate" :toggle lsp-ui-sideline-ignore-duplicate))
"Action"
(("h" backward-char "")
("j" next-line "")
("k" previous-line "")
("l" forward-char "")
("C-a" mwim-beginning-of-code-or-line nil)
("C-e" mwim-end-of-code-or-line nil)
("C-b" backward-char nil)
("C-n" next-line nil)
("C-p" previous-line nil)
("C-f" forward-char nil)
("M-b" backward-word nil)
("M-f" forward-word nil)
("c" lsp-ui-sideline-apply-code-actions "apply code actions"))))
:bind (("C-c u" . lsp-ui-imenu)
:map lsp-ui-mode-map
("M-<f6>" . lsp-ui-hydra/body)
("s-<return>" . lsp-ui-sideline-apply-code-actions)
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references))
:hook ((lsp-mode . lsp-ui-mode)
(after-load-theme . lsp-ui-set-doc-border))
:init
(setq lsp-ui-sideline-show-diagnostics nil
lsp-ui-sideline-ignore-duplicate t
lsp-ui-doc-delay 0.1
lsp-ui-doc-show-with-cursor (not (display-graphic-p))
lsp-ui-imenu-auto-refresh 'after-save
lsp-ui-imenu-colors `(,(face-foreground 'font-lock-keyword-face)
,(face-foreground 'font-lock-string-face)
,(face-foreground 'font-lock-constant-face)
,(face-foreground 'font-lock-variable-name-face))))
(use-package lsp-ui
:custom-face
(lsp-ui-sideline-code-action ((t (:inherit warning))))
:pretty-hydra
((:color amaranth :quit-key ("q" "C-g"))
("Doc"
(("d e" (progn
(lsp-ui-doc-enable (not lsp-ui-doc-mode))
(setq lsp-ui-doc-enable (not lsp-ui-doc-enable)))
"enable" :toggle lsp-ui-doc-mode)
("d s" (setq lsp-ui-doc-include-signature (not lsp-ui-doc-include-signature))
"signature" :toggle lsp-ui-doc-include-signature)
("d t" (setq lsp-ui-doc-position 'top)
"top" :toggle (eq lsp-ui-doc-position 'top))
("d b" (setq lsp-ui-doc-position 'bottom)
"bottom" :toggle (eq lsp-ui-doc-position 'bottom))
("d p" (setq lsp-ui-doc-position 'at-point)
"at point" :toggle (eq lsp-ui-doc-position 'at-point))
("d h" (setq lsp-ui-doc-header (not lsp-ui-doc-header))
"header" :toggle lsp-ui-doc-header)
("d f" (setq lsp-ui-doc-alignment 'frame)
"align frame" :toggle (eq lsp-ui-doc-alignment 'frame))
("d w" (setq lsp-ui-doc-alignment 'window)
"align window" :toggle (eq lsp-ui-doc-alignment 'window)))
"Sideline"
(("s e" (progn
(lsp-ui-sideline-enable (not lsp-ui-sideline-mode))
(setq lsp-ui-sideline-enable (not lsp-ui-sideline-enable)))
"enable" :toggle lsp-ui-sideline-mode)
("s h" (setq lsp-ui-sideline-show-hover (not lsp-ui-sideline-show-hover))
"hover" :toggle lsp-ui-sideline-show-hover)
("s d" (setq lsp-ui-sideline-show-diagnostics (not lsp-ui-sideline-show-diagnostics))
"diagnostics" :toggle lsp-ui-sideline-show-diagnostics)
("s s" (setq lsp-ui-sideline-show-symbol (not lsp-ui-sideline-show-symbol))
"symbol" :toggle lsp-ui-sideline-show-symbol)
("s c" (setq lsp-ui-sideline-show-code-actions (not lsp-ui-sideline-show-code-actions))
"code actions" :toggle lsp-ui-sideline-show-code-actions)
("s i" (setq lsp-ui-sideline-ignore-duplicate (not lsp-ui-sideline-ignore-duplicate))
"ignore duplicate" :toggle lsp-ui-sideline-ignore-duplicate))
"Action"
(("h" backward-char "")
("j" next-line "")
("k" previous-line "")
("l" forward-char "")
("C-a" mwim-beginning-of-code-or-line nil)
("C-e" mwim-end-of-code-or-line nil)
("C-b" backward-char nil)
("C-n" next-line nil)
("C-p" previous-line nil)
("C-f" forward-char nil)
("M-b" backward-word nil)
("M-f" forward-word nil)
("c" lsp-ui-sideline-apply-code-actions "apply code actions"))))
:bind (("C-c u" . lsp-ui-imenu)
:map lsp-ui-mode-map
("M-<f6>" . lsp-ui-hydra/body)
("s-<return>" . lsp-ui-sideline-apply-code-actions)
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references))
:hook ((lsp-mode . lsp-ui-mode)
(after-load-theme . lsp-ui-set-doc-border))
:init
(setq lsp-ui-sideline-show-diagnostics nil
lsp-ui-sideline-ignore-duplicate t
lsp-ui-doc-delay 0.1
lsp-ui-doc-show-with-cursor (not (display-graphic-p))
lsp-ui-imenu-auto-refresh 'after-save
lsp-ui-imenu-colors `(,(face-foreground 'font-lock-keyword-face)
,(face-foreground 'font-lock-string-face)
,(face-foreground 'font-lock-constant-face)
,(face-foreground 'font-lock-variable-name-face))))
(use-package lsp-pyright
:functions lsp-pyright-format-buffer
:hook (((python-mode python-ts-mode) . (lambda ()
(require 'lsp-pyright)
(add-hook 'after-save-hook #'lsp-pyright-format-buffer t t))))
:init
;; (when (executable-find "python3")
;; (setq lsp-pyright-python-executable-cmd "python3"))
(defun lsp-pyright-format-buffer ()
"Use `yapf' to format the buffer."
(interactive)
(when (and (executable-find "yapf") buffer-file-name)
(call-process "yapf" nil nil nil "-i" buffer-file-name))))
(use-package ccls
:hook ((c-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls)))
:config
(with-no-warnings
;; FIXME: fail to call ccls.xref
;; @see https://github.com/emacs-lsp/emacs-ccls/issues/109
(cl-defmethod my-lsp-execute-command
((_server (eql ccls)) (command (eql ccls.xref)) arguments)
(when-let* ((xrefs (lsp--locations-to-xref-items
(lsp--send-execute-command (symbol-name command) arguments))))
(xref--show-xrefs xrefs nil)))
(advice-add #'lsp-execute-command :override #'my-lsp-execute-command))))
(provide 'init-lsp) (provide 'init-lsp)

View File

@@ -81,19 +81,69 @@
'("Y" . meow-sync-grab) '("Y" . meow-sync-grab)
'("z" . meow-pop-selection) '("z" . meow-pop-selection)
'("'" . repeat) '("'" . repeat)
'("<escape>" . ignore))) '("<escape>" . ignore))
(meow-define-keys
'beacon
'("C-g" . meow-grab))
)
(use-package meow (use-package meow
:demand t :demand t
:hook (elpaca-after-init . meow-global-mode) :hook (elpaca-after-init . meow-global-mode)
:config :config
(meow-setup) (meow-setup)
(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))
(define-key input-decode-map (kbd "C-[") [control-bracketleft])
(define-key meow-insert-state-keymap [control-bracketleft] 'meow-insert-exit)
(setq meow-keypad-leader-dispatch "C-c"
meow-use-clipboard t)
(setq meow-replace-state-name-list (setq meow-replace-state-name-list
'((normal . "<N>") '((normal . "<N>")
(motion . "<M>") (motion . "<M>")
(keypad . "<K>") (keypad . "<K>")
(insert . "<I>") (insert . "<I>")
(beacon . "<B>"))) (beacon . "<B>")))
(setq meow-cursor-type-normal 'bar)) (setq meow-cursor-type-normal 'bar))
;; Meow jk exit
(use-package meow
:disabled t
:after meow
:config
;; Use jk to escape from insert state to normal state
(defvar meow-two-char-escape-sequence "jk")
(defvar meow-two-char-escape-delay 0.5)
(defun meow--two-char-exit-insert-state (s)
"Exit meow insert state when pressing consecutive two keys.
S is string of the two-key sequence."
(when (meow-insert-mode-p)
(let ((modified (buffer-modified-p))
(undo-list buffer-undo-list))
(insert (elt s 0))
(let* ((second-char (elt s 1))
(event
(if defining-kbd-macro
(read-event nil nil)
(read-event nil nil meow-two-char-escape-delay))))
(when event
(if (and (characterp event) (= event second-char))
(progn
(backward-delete-char 1)
(set-buffer-modified-p modified)
(setq buffer-undo-list undo-list)
(meow-insert-exit))
(push event unread-command-events)))))))
(defun meow-two-char-exit-insert-state ()
"Exit meow insert state when pressing consecutive two keys."
(interactive)
(meow--two-char-exit-insert-state meow-two-char-escape-sequence))
(define-key meow-insert-state-keymap (substring meow-two-char-escape-sequence 0 1)
#'meow-two-char-exit-insert-state))
(provide 'init-meow) (provide 'init-meow)

View File

@@ -5,19 +5,9 @@
:ensure t :ensure t
:mode (("\\.ocamlinit\\'" . tuareg-mode)) :mode (("\\.ocamlinit\\'" . tuareg-mode))
:config :config
(setq tuareg-prettify-symbols-full t) (setq tuareg-prettify-symbols-full t))
(add-hook 'tuareg-mode-hook (lambda () )))
;; (use-package dune)
(use-package ocaml-eglot
:ensure t
:after tuareg
:hook (tuareg-mode . ocaml-eglot)
:hook (ocaml-eglot . eglot-ensure)
:config
(setq ocaml-eglot-syntax-checker 'flycheck))
(use-package dune)
(use-package opam-switch-mode (use-package opam-switch-mode
:hook (tuareg-mode . opam-switch-mode) :hook (tuareg-mode . opam-switch-mode)
@@ -25,10 +15,19 @@
(setq tuareg-opam-insinuate t)) (setq tuareg-opam-insinuate t))
(use-package ocp-indent (use-package ocp-indent
:hook (ocaml-eglot . ocp-setup-indent)) :hook (tuareg-mode . ocp-setup-indent))
(use-package utop) (use-package utop)
;; (use-package ocaml-eglot
;; :ensure t
;; :after tuareg
;; :hook (tuareg-mode . ocaml-eglot)
;; :hook (ocaml-eglot . eglot-ensure)
;; :config
;; (setq ocaml-eglot-syntax-checker 'flycheck))
;; (use-package merlin ;; (use-package merlin
;; :hook (tuareg-mode . +ocaml-init-merlin) ;; :hook (tuareg-mode . +ocaml-init-merlin)
;; :init ;; :init
@@ -41,7 +40,7 @@
;; (use-package merlin-eldoc ;; (use-package merlin-eldoc
;; :hook (merlin-mode . merlin-eldoc-setup)) ;; :hook (merlin-mode . merlin-eldoc-setup))
;; (use-package flycheck-ocaml) (use-package flycheck-ocaml)

View File

@@ -1,17 +1,12 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
;; (defun org-capture-init()
;; (setq org-capture-templates
;; '(("t" "Personal todo" entry ("Inbox")
;; "* TODO %?\n%i\n%a" :prepend t))))
(use-package org (use-package org
:defer
:ensure (org :repo "https://code.tecosaur.net/tec/org-mode.git/" :ensure (org :repo "https://code.tecosaur.net/tec/org-mode.git/"
:branch "dev") :branch "dev")
:hook (org-mode . org-cdlatex-mode) :hook ((org-mode . org-cdlatex-mode)
:hook (org-mode . org-indent-mode) (org-mode . org-indent-mode)
:hook (org-mode . visual-line-mode) (org-mode . visual-line-mode))
:pretty-hydra :pretty-hydra
;; See `org-structure-template-alist' ;; See `org-structure-template-alist'
((:color blue :quit-key ("q" "C-g")) ((:color blue :quit-key ("q" "C-g"))
@@ -57,8 +52,21 @@
(if (or (region-active-p) (looking-back "^\s*" 1)) (if (or (region-active-p) (looking-back "^\s*" 1))
(org-hydra/body) (org-hydra/body)
(self-insert-command 1)))) (self-insert-command 1))))
("M-<return>" . org-insert-subheading)) ("M-<return>" . org-insert-subheading)
("C-'" . nil))
:bind (("C-c n t" . org-todo-list)
("C-c n a" . org-agenda)
("C-c n n" . org-capture))
:config :config
(elemacs-load-packages-incrementally
'(calendar find-func format-spec org-macs org-compat
org-faces org-entities org-list org-pcomplete org-src
org-footnote org-macro ob org org-clock org-agenda
org-capture))
(add-hook 'org-mode-hook
(lambda ()
(yas-activate-extra-mode 'LaTeX-mode)))
;; For hydra ;; For hydra
(defun hot-expand (str &optional mod) (defun hot-expand (str &optional mod)
"Expand org template. "Expand org template.
@@ -91,6 +99,7 @@ the element after the #+HEADER: tag."
(setq org-pretty-entities t (setq org-pretty-entities t
org-pretty-entities-include-sub-superscripts nil) org-pretty-entities-include-sub-superscripts nil)
(setq org-default-note-file (expand-file-name "notes.org" org-directory) (setq org-default-note-file (expand-file-name "notes.org" org-directory)
org-capture-templates org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
@@ -101,16 +110,80 @@ the element after the #+HEADER: tag."
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry ("j" "Journal" entry
(file+olp+datetree "diary.org") (file+olp+datetree "diary.org")
"* %U %?\n%i\n%a" :prepend t)) "* %U %?\n%i\n%a" :prepend t)))
(with-no-warnings
org-todo-keywords (custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "")
'((sequence "TODO(t)" "IN-PROGRESS(i)" "ON-HOLD(h)" "|" "DONE(d)" "NO(n)"))) (custom-declare-face '+org-todo-project '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
(custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) "")
(custom-declare-face '+org-todo-cancel '((t (:inherit (bold error org-todo)))) ""))
(setq org-todo-keywords
'((sequence
"TODO(t)" ; A task that needs doing & is ready to do
"PROJ(p)" ; A project, which usually contains other tasks
"LOOP(r)" ; A recurring task
"STRT(s)" ; A task that is in progress
"WAIT(w)" ; Something external is holding up this task
"HOLD(h)" ; This task is paused/on hold because of me
"IDEA(i)" ; An unconfirmed and unapproved task or notion
"|"
"DONE(d)" ; Task successfully completed
"KILL(k)") ; Task was cancelled, aborted, or is no longer applicable
(sequence
"|"
"OKAY(o)"
"YES(y)"
"NO(n)"))
org-todo-keyword-faces
'(("[-]" . +org-todo-active)
("STRT" . +org-todo-active)
("[?]" . +org-todo-onhold)
("WAIT" . +org-todo-onhold)
("HOLD" . +org-todo-onhold)
("PROJ" . +org-todo-project)
("NO" . +org-todo-cancel)
("KILL" . +org-todo-cancel)))
(add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t))) (add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t)))
(add-hook 'org-after-refile-insert-hook (add-hook 'org-after-refile-insert-hook
(defun save-buffer-after-capture () (defun save-buffer-after-capture ()
(when (bound-and-true-p org-capture-is-refiling) (when (bound-and-true-p org-capture-is-refiling)
(save-buffer))))) (save-buffer))))
;; ;; Enable lsp in org-babel
(cl-defmacro lsp-org-babel-enable (lang)
"Support LANG in org source code block."
(cl-check-type lang string)
(let* ((edit-pre (intern (format "org-babel-edit-prep:%s" lang)))
(intern-pre (intern (format "lsp--%s" (symbol-name edit-pre)))))
`(progn
(defun ,intern-pre (info)
(setq buffer-file-name (or (->> info caddr (alist-get :file))
"org-src-babel.tmp"))
(when (fboundp 'lsp-deferred)
;; Avoid headerline conflicts
(setq-local lsp-headerline-breadcrumb-enable nil)
(lsp-deferred)
(_
(user-error "LSP:: invalid type"))))
(put ',intern-pre 'function-documentation
(format "Enable lsp-mode in the buffer of org source block (%s)."
(upcase ,lang)))
(if (fboundp ',edit-pre)
(advice-add ',edit-pre :after ',intern-pre)
(progn
(defun ,edit-pre (info)
(,intern-pre info))
(put ',edit-pre 'function-documentation
(format "Prepare local buffer environment for org source block (%s)."
(upcase ,lang))))))))
(defconst org-babel-lang-list
'("go" "python" "ipython" "ruby" "js" "css" "sass" "c" "rust" "java" "cpp" "c++" "shell" "haskell")
"The supported programming languages for interactive Babel.")
(dolist (lang org-babel-lang-list)
(eval `(lsp-org-babel-enable ,lang)))
)
(use-package org-contrib) (use-package org-contrib)
@@ -124,11 +197,11 @@ the element after the #+HEADER: tag."
:init :init
(with-eval-after-load 'org (with-eval-after-load 'org
(setq org-hide-emphasis-markers t (setq org-hide-emphasis-markers t
org-pretty-entities t)) org-pretty-entities t))
:config :config
(setq org-modern-table-vertical 1 (setq org-modern-table-vertical 1
org-modern-table-horizontal 0.2 org-modern-table-horizontal 0.2
org-modern-todo-faces org-modern-todo-faces
'(("TODO" :inverse-video t :inherit org-todo) '(("TODO" :inverse-video t :inherit org-todo)
("PROJ" :inverse-video t :inherit +org-todo-project) ("PROJ" :inverse-video t :inherit +org-todo-project)
("STRT" :inverse-video t :inherit +org-todo-active) ("STRT" :inverse-video t :inherit +org-todo-active)
@@ -138,10 +211,10 @@ the element after the #+HEADER: tag."
("[?]" :inverse-video t :inherit +org-todo-onhold) ("[?]" :inverse-video t :inherit +org-todo-onhold)
("KILL" :inverse-video t :inherit +org-todo-cancel) ("KILL" :inverse-video t :inherit +org-todo-cancel)
("NO" :inverse-video t :inherit +org-todo-cancel)) ("NO" :inverse-video t :inherit +org-todo-cancel))
org-modern-list '((43 . "") org-modern-list '((43 . "")
(45 . "") (45 . "")
(42 . "")) (42 . ""))
)) ))
(use-package org-modern-indent (use-package org-modern-indent
:ensure (org-modern-indent :type git :host github :repo "jdtsmith/org-modern-indent") :ensure (org-modern-indent :type git :host github :repo "jdtsmith/org-modern-indent")
@@ -152,13 +225,12 @@ the element after the #+HEADER: tag."
:hook (org-mode . org-appear-mode) :hook (org-mode . org-appear-mode)
:config :config
(setq org-appear-autoemphasis t (setq org-appear-autoemphasis t
org-appear-autosubmarkers t org-appear-autosubmarkers t
org-appear-autolinks nil) org-appear-autolinks nil)
(run-at-time nil nil #'org-appear--set-elements)) (run-at-time nil nil #'org-appear--set-elements))
(use-package hl-todo (use-package hl-todo
:hook (prog-mode . hl-todo-mode) :hook (elpaca-after-init . global-hl-todo-mode)
:hook (yaml-mode . hl-todo-mode)
:config :config
(setq hl-todo-highlight-punctuation ":" (setq hl-todo-highlight-punctuation ":"
hl-todo-keyword-faces hl-todo-keyword-faces
@@ -183,30 +255,50 @@ the element after the #+HEADER: tag."
("BUG" error bold) ("BUG" error bold)
("XXX" font-lock-constant-face bold)))) ("XXX" font-lock-constant-face bold))))
(add-hook 'org-mode-hook
(lambda ()
(yas-activate-extra-mode 'LaTeX-mode)))
(use-package org-latex-preview (use-package org-latex-preview
:ensure nil :ensure nil
:hook (org-mode . org-latex-preview-mode) :hook (org-mode . org-latex-preview-mode)
:hook (org-latex-preview-mode . org-latex-preview-center-mode) :hook (org-latex-preview-mode . org-latex-preview-center-mode)
:bind ("C-c C-x SPC" . org-latex-preview-clear-cache)
:config :config
;; Higher resolution when using dvipng ;; preview buffer on enter
(plist-put org-latex-preview-appearance-options :page-width 1.0) (add-hook 'org-mode-hook
;; (plist-put org-latex-preview-appearance-options :margin 1) (lambda ()
(plist-put org-latex-preview-appearance-options :scale 2.0) (run-with-idle-timer 0.5 nil
(lambda () (org-latex-preview '(16))))))
;; ;; Block C-n, C-p etc from opening up previews when using `org-latex-preview-mode' ;; Add margin and rescale display math
;; (setq org-latex-preview-mode-ignored-commands (defvar my/org-latex-display-math-scale 1)
;; '(next-line previous-line mwheel-scroll (defvar my/org-latex-display-math-margin 5)
;; scroll-up-command scroll-down-command)) (defun my/org-latex-preview-add-margin-advice (ov _path-info)
(save-excursion
(setq org-latex-preview-numbered t) (goto-char (overlay-start ov))
(when-let* ((elem (org-element-context))
((or (eq (org-element-type elem) 'latex-environment)
(string-match-p "^\\\\\\[" (org-element-property :value elem))))
(img (overlay-get ov 'preview-image))
((and (consp img) (eq (car img) 'image))))
(let* ((plist (copy-sequence (cdr img)))
(height (plist-get plist :height)))
(when (and (consp height) (numberp (car height)))
(setq plist
(plist-put plist :height
(cons (* my/org-latex-display-math-scale (car height))
(cdr height)))))
(setq plist (plist-put plist :margin my/org-latex-display-math-margin))
(let ((new-img (cons 'image plist)))
(overlay-put ov 'preview-image new-img)
(when (overlay-get ov 'display)
(overlay-put ov 'display new-img)))))))
(advice-add 'org-latex-preview--update-overlay :after
#'my/org-latex-preview-add-margin-advice)
;; (setq org-latex-preview-numbered t)
(setq org-latex-preview-mode-display-live t) (setq org-latex-preview-mode-display-live t)
(setq org-latex-preview-process-default 'dvipng) (setq org-latex-preview-process-default 'dvisvgm)
(setq org-latex-preview-mode-update-delay 0.25) (setq org-latex-preview-mode-update-delay 0.25)
(defun my/org-latex-preview-uncenter (ov)
;; Centre display maths
(defun my/org-latex-preview-uncenter (ov)
(overlay-put ov 'before-string nil)) (overlay-put ov 'before-string nil))
(defun my/org-latex-preview-recenter (ov) (defun my/org-latex-preview-recenter (ov)
(overlay-put ov 'before-string (overlay-get ov 'justify))) (overlay-put ov 'before-string (overlay-get ov 'justify)))
@@ -233,9 +325,9 @@ the element after the #+HEADER: tag."
(add-hook 'org-latex-preview-overlay-update-functions (add-hook 'org-latex-preview-overlay-update-functions
#'my/org-latex-preview-center nil :local)) #'my/org-latex-preview-center nil :local))
(remove-hook 'org-latex-preview-overlay-close-functions (remove-hook 'org-latex-preview-overlay-close-functions
#'my/org-latex-preview-recenter) #'my/org-latex-preview-recenter)
(remove-hook 'org-latex-preview-overlay-update-functions (remove-hook 'org-latex-preview-overlay-update-functions
#'my/org-latex-preview-center) #'my/org-latex-preview-center)
(remove-hook 'org-latex-preview-overlay-open-functions (remove-hook 'org-latex-preview-overlay-open-functions
#'my/org-latex-preview-uncenter))) #'my/org-latex-preview-uncenter)))
(defun my/text-scale-adjust-latex-previews () (defun my/text-scale-adjust-latex-previews ()
@@ -263,7 +355,6 @@ the element after the #+HEADER: tag."
(add-hook 'text-scale-mode-hook #'my/text-scale-adjust-latex-previews)) (add-hook 'text-scale-mode-hook #'my/text-scale-adjust-latex-previews))
(use-package org-roam (use-package org-roam
:ensure t
:custom :custom
(org-roam-directory (file-truename "~/org/roam")) (org-roam-directory (file-truename "~/org/roam"))
:bind (("C-c n l" . org-roam-buffer-toggle) :bind (("C-c n l" . org-roam-buffer-toggle)
@@ -298,8 +389,7 @@ the element after the #+HEADER: tag."
(use-package valign (use-package valign
:hook (org-mode . valign-mode)) :hook (org-mode . valign-mode))
(use-package org-noter (use-package djvu)
:config (use-package org-noter)
(use-package djvu))
(provide 'init-org) (provide 'init-org)

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

@@ -34,6 +34,18 @@
(ansi-color-for-comint-mode-on) (ansi-color-for-comint-mode-on)
(setq comint-input-sender 'my/shell-simple-send)))) (setq comint-input-sender 'my/shell-simple-send))))
;; Emacs command shell
(use-package eshell
:ensure nil
:defines eshell-prompt-function
:bind (:map eshell-mode-map
([remap recenter-top-bottom] . eshell/clear))
:config
;; (defun eshell/clear ()
;; (interactive)
;; (eshell/clear-scrollback))
(setq eshell-banner-message ""))
(use-package xterm-color (use-package xterm-color
:defines (compilation-environment :defines (compilation-environment
eshell-preoutput-filter-functions eshell-preoutput-filter-functions
@@ -42,6 +54,18 @@
;; For shell and interpreters ;; For shell and interpreters
(setenv "TERM" "xterm-256color") (setenv "TERM" "xterm-256color")
(setq comint-output-filter-functions
(remove 'ansi-color-process-output comint-output-filter-functions))
(add-hook 'comint-preoutput-filter-functions 'xterm-color-filter)
(add-hook 'shell-mode-hook
(lambda ()
;; Disable font-locking to improve performance
(font-lock-mode -1)
;; Prevent font-locking from being re-enabled
(make-local-variable 'font-lock-function)
(setq font-lock-function #'ignore)))
;; For eshell
(with-eval-after-load 'esh-mode (with-eval-after-load 'esh-mode
(add-hook 'eshell-before-prompt-hook (add-hook 'eshell-before-prompt-hook
(lambda () (lambda ()
@@ -49,32 +73,47 @@
(add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter) (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
(setq eshell-output-filter-functions (setq eshell-output-filter-functions
(remove 'eshell-handle-ansi-color eshell-output-filter-functions))) (remove 'eshell-handle-ansi-color eshell-output-filter-functions)))
(setq compilation-environment '("TERM=xterm-256color")) (setq compilation-environment '("TERM=xterm-256color"))
(defun my/advice-compilation-filter (fn proc string)
(funcall fn proc
(if (eq major-mode 'rg-mode) ; compatible with `rg'
string
(xterm-color-filter string))))
(advice-add 'compilation-filter :around #'my/advice-compilation-filter)
(advice-add 'gud-filter :around #'my/advice-compilation-filter)
) )
(setq eshell-banner-message "")
(use-package eat (use-package eat
:bind ("C-`" . eat-toggle) :bind ("C-<escape>" . eat-toggle)
:bind ("C-`" . eshell-toggle)
:hook ((eshell-load . eat-eshell-mode) :hook ((eshell-load . eat-eshell-mode)
(eshell-load . eat-eshell-visual-command-mode)) (eshell-load . eat-eshell-visual-command-mode))
:ensure `(eat :repo "https://codeberg.org/akib/emacs-eat" :ensure `(eat :repo "https://codeberg.org/akib/emacs-eat"
:files ("*.el" ("term" "term/*.el") "*.texi" :files ("*.el" ("term" "term/*.el") "*.texi"
"*.ti" ("terminfo/e" "terminfo/e/*") "*.ti" ("terminfo/e" "terminfo/e/*")
("terminfo/65" "terminfo/65/*") ("terminfo/65" "terminfo/65/*")
("integration" "integration/*") ("integration" "integration/*")
(:exclude ".dir-locals.el" "*-tests.el"))) (:exclude ".dir-locals.el" "*-tests.el")))
:custom :custom
(eat-term-name "xterm-256color") (eat-term-name "xterm-256color")
(eat-kill-buffer-on-exit t) (eat-kill-buffer-on-exit t)
;; (eat-shell ) ;; (eat-shell )
:config :config
(defun eshell-toggle () (interactive)
(if (string= (buffer-name) "*eshell*")
(delete-window)
(eshell)))
(defun eat-toggle () (interactive) (defun eat-toggle () (interactive)
(if (string= (buffer-name) "*eshell*") (if (string= (buffer-name) "*eat*")
(delete-window) (delete-window)
(eshell))) (eat)))
(setq tramp-remote-process-environment '("TERM=xterm-256color" "TERMINFO=''" "ENV=''" "TMOUT=0" "LC_CTYPE=''" "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" "autocorrect=" "correct=")) ;; Improve latency
(setq process-adaptive-read-buffering t)
(with-eval-after-load 'tramp
(setq tramp-remote-process-environment '("TERM=xterm-256color" "TERMINFO=''" "ENV=''" "TMOUT=0" "LC_CTYPE=''" "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" "autocorrect=" "correct=")))
(when (eq system-type 'darwin) (when (eq system-type 'darwin)
(define-key eat-semi-char-mode-map (kbd "C-h") #'eat-self-input) (define-key eat-semi-char-mode-map (kbd "C-h") #'eat-self-input)
(define-key eat-semi-char-mode-map (kbd "<backspace>") (kbd "C-h")))) (define-key eat-semi-char-mode-map (kbd "<backspace>") (kbd "C-h"))))
@@ -84,8 +123,8 @@
:defines eshell-highlight-prompt :defines eshell-highlight-prompt
:autoload (epe-theme-lambda epe-theme-dakrone epe-theme-pipeline) :autoload (epe-theme-lambda epe-theme-dakrone epe-theme-pipeline)
:init :init
(setq eshell-highlight-prompt t (setq eshell-highlight-prompt t)
eshell-prompt-function #'epe-theme-lambda)) (setq eshell-prompt-function #'epe-theme-lambda))
;; (use-package eshell-z ;; (use-package eshell-z
;; :hook (eshell-mode . (lambda () (require 'eshell-z)))) ;; :hook (eshell-mode . (lambda () (require 'eshell-z))))

View File

@@ -3,11 +3,22 @@
;; Yasnippet settings ;; Yasnippet settings
(use-package yasnippet (use-package yasnippet
:diminish :diminish
:ensure t
:hook (elpaca-after-init . yas-global-mode) :hook (elpaca-after-init . yas-global-mode)
:hook ((LaTeX-mode . yas-minor-mode) :hook ((post-self-insert . my/yas-try-expanding-auto-snippets))
(post-self-insert . my/yas-try-expanding-auto-snippets)) :commands (yas-minor-mode-on
yas-expand
yas-expand-snippet
yas-lookup-snippet
yas-insert-snippet
yas-new-snippet
yas-visit-snippet-file
yas-activate-extra-mode
yas-deactivate-extra-mode
yas-maybe-expand-abbrev-key-filter)
:init
(defvar yas-verbosity 2)
:config :config
(elemacs-load-packages-incrementally '(eldoc easymenu help-mode))
(use-package warnings (use-package warnings
:ensure nil :ensure nil
:config :config
@@ -27,9 +38,8 @@
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto))) (let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand))))) (yas-expand)))))
;; Collection of yasnippet snippets (use-package doom-snippets
(use-package yasnippet-snippets) :after yasnippet
:ensure (doom-snippets :type git :host github :repo "doomemacs/snippets" :files ("*.el" "*")))
(provide 'init-snippet) (provide 'init-snippet)

24
lisp/init-straight.el Normal file
View File

@@ -0,0 +1,24 @@
;; -*- lexical-binding: t; -*-
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t
use-package-expand-minimally t
use-package-always-defer t)
(provide 'init-straight)

View File

@@ -1,16 +1,34 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
(use-package latex (use-package latex
:after tex
:ensure (auctex :pre-build (("./autogen.sh") :ensure (auctex :pre-build (("./autogen.sh")
("./configure" "--without-texmf-dir" "--with-lispdir=.") ("./configure" "--without-texmf-dir" "--with-lispdir=.")
("make"))) ("make")))
;; :ensure (auctex :type git :host nil :repo "https://git.savannah.gnu.org/git/auctex.git")
:defines (TeX-auto-save
TeX-parse-self
TeX-electric-escape
TeX-PDF-mode
TeX-DVI-via-PDFTeX
TeX-clean-confirm
TeX-source-correlate-mode
TeX-source-correlate-method
TeX-display-help
TeX-show-compilation
TeX-command-extra-options
TeX-view-program-selection)
:mode (("\\.tex\\'" . LaTeX-mode)) :mode (("\\.tex\\'" . LaTeX-mode))
:hook (LaTeX-mode . prettify-symbols-mode) :hook ((LaTeX-mode . prettify-symbols-mode)
:hook (LaTeX-mode . visual-line-mode) (LaTeX-mode . visual-line-mode)
:hook (LaTeX-mode . turn-on-reftex) (LaTeX-mode . turn-on-reftex)
(LaTeX-mode . lsp-deferred)
(LaTeX-mode . (lambda () (lsp-ui-mode -1)))
(LaTeX-mode . (lambda () (apheleia-mode -1))))
:bind (:map LaTeX-mode-map :bind (:map LaTeX-mode-map
("C-S-e" . latex-math-from-calc) ("C-S-e" . latex-math-from-calc)
("C-c x" . TeX-clean)) ("C-c x" . TeX-clean)
("S-s-<mouse-1>" . TeX-view))
:custom :custom
(TeX-auto-save t) (TeX-auto-save t)
(TeX-parse-self t) (TeX-parse-self t)
@@ -23,13 +41,17 @@
(TeX-display-help t) (TeX-display-help t)
(TeX-show-compilation nil) (TeX-show-compilation nil)
(TeX-command-extra-options "-shell-escape") (TeX-command-extra-options "-shell-escape")
(TeX-view-program-selection '((output-pdf "displayline")))
:config :config
(add-hook 'LaTeX-mode-hook (lambda () (add-hook 'LaTeX-mode-hook '(lambda ()
(setq TeX-command-default "LaTeXMk"))) (setq TeX-command-default "LaTeXMk")))
;; Format math as a Latex string with Calc ;; Format math as a Latex string with Calc
(add-hook 'LaTeX-mode-hook #'eglot-ensure) ;; (add-hook 'LaTeX-mode-hook #'eglot-ensure)
(setq-default LaTeX-indent-environment-list nil)
(defun latex-math-from-calc () (defun latex-math-from-calc ()
"Evaluate `calc' on the contents of line at point." "Evaluate `calc' on the contents of line at point."
(interactive) (interactive)
@@ -50,23 +72,30 @@
;; (setq TeX-view-program-selection '((output-pdf "PDF Tools"))) ;; (setq TeX-view-program-selection '((output-pdf "PDF Tools")))
;; (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer) ;; (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
;; (with-eval-after-load 'eglot
;; (add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab")))
(setq reftex-plug-into-AUCTeX t) (setq reftex-plug-into-AUCTeX t)
(use-package texpresso
(with-eval-after-load 'eglot :ensure (:host github :repo "let-def/texpresso" :files ("emacs/*.el"))
(add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab")))) :hook (texpresso-mode . texpresso-sync-mode)
:after auctex
:bind (:map LaTeX-mode-map
("C-c C-p" . texpresso)))
)
(use-package cdlatex (use-package cdlatex
:diminish :diminish
:ensure t
:hook (LaTeX-mode . turn-on-cdlatex) :hook (LaTeX-mode . turn-on-cdlatex)
;; :bind (:map cdlatex-mode-map ;; :bind (:map cdlatex-mode-map
;; ("<tab>" . cdlatex-tab)) ;; ("<tab>" . cdlatex-tab))
:config :config
(setq cdlatex-math-symbol-alist '((?f ("\\varphi" "\\phi")) (setq cdlatex-math-symbol-alist '((?f ("\\varphi" "\\phi"))
(?i ("\\iota")) (?i ("\\iota"))
(?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 () (defun tjh/cdlatex-yas-expand ()
"Resolve the conflict between cdlatex and yasnippet. When this "Resolve the conflict between cdlatex and yasnippet. When this
function returns true, the default `cdlatex-tab` will not be function returns true, the default `cdlatex-tab` will not be
@@ -79,10 +108,42 @@ expansion, then cdlatex expansion."
t t
nil) nil)
nil)) nil))
(add-hook 'cdlatex-tab-hook 'tjh/cdlatex-yas-expand)) (add-hook 'cdlatex-tab-hook 'tjh/cdlatex-yas-expand)
(cdlatex-reset-mode))
(use-package texpresso (use-package lazytab
:defer nil :demand t
:load-path "~/.emacs.d/lisp/packages/") :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"
"\\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))
(cdlatex-reset-mode)
)
(provide 'init-tex) (provide 'init-tex)

View File

@@ -17,7 +17,7 @@
treemacs-missing-project-action 'remove treemacs-missing-project-action 'remove
treemacs-user-mode-line-format 'none treemacs-user-mode-line-format 'none
treemacs-sorting 'alphabetic-asc treemacs-sorting 'alphabetic-asc
treemacs-follow-after-init t treemacs-follow-elpaca-after-init t
treemacs-width 30 treemacs-width 30
treemacs-show-hidden-files nil treemacs-show-hidden-files nil
treemacs-silent-refresh t treemacs-silent-refresh t

View File

@@ -1,29 +1,17 @@
;; -*- lexical-binding: t;-*- ;; -*- lexical-binding: t;-*-
(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 . eglot-ensure) :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 :config
;; (typst-ts-watch-options "--open")
(setq typst-ts-mode-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory))
(setq typst-ts-mode-enable-raw-blocks-highlight t)
(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
:ensure (:type git :host github :repo "havarddj/typst-preview.el") :ensure (:type git :host github :repo "havarddj/typst-preview.el")
:init
(setq typst-preview-autostart t) ; start preview automatically when typst-preview-mode is activated
(setq typst-preview-open-browser-automatically t) ; open browser automatically when typst-preview-start is run
:custom :custom
(typst-preview-browser "default") ; this is the default option; other options are `eaf-browser' or `xwidget'. (typst-preview-browser "default") ; this is the default option; other options are `eaf-browser' or `xwidget'.
@@ -32,6 +20,8 @@
(typst-preview-partial-rendering t) ; enable partial rendering (typst-preview-partial-rendering t) ; enable partial rendering
:config :config
(setq typst-preview-autostart t) ; start preview automatically when typst-preview-mode is activated
(setq typst-preview-open-browser-automatically t) ; open browser automatically when typst-preview-start is run
(define-key typst-ts-mode-map (kbd "C-c C-j") 'typst-preview-send-position) (define-key typst-ts-mode-map (kbd "C-c C-j") 'typst-preview-send-position)
(define-key typst-ts-mode-map (kbd "C-c C-l") #'typst-preview-mode)) (define-key typst-ts-mode-map (kbd "C-c C-l") #'typst-preview-mode))

View File

@@ -5,14 +5,7 @@
;; (setq-default line-height 0.16) ;; (setq-default line-height 0.16)
;; (setq-local default-text-properties '(line-spacing 0.1 line-height 1.1)) ;; (setq-local default-text-properties '(line-spacing 0.1 line-height 1.1))
(use-package diminish)
;; Suppress GUI features
(setq use-file-dialog nil
use-dialog-box nil
inhibit-startup-screen t
inhibit-startup-echo-area-message user-login-name
inhibit-default-init t
initial-scratch-message nil)
(setq-default cursor-in-non-selected-windows nil) (setq-default cursor-in-non-selected-windows nil)
(setq highlight-nonselected-windows nil) (setq highlight-nonselected-windows nil)
@@ -20,11 +13,10 @@
(setq fast-but-imprecise-scrolling t) (setq fast-but-imprecise-scrolling t)
(setq redisplay-skip-fontification-on-input t) (setq redisplay-skip-fontification-on-input t)
(setq frame-inhibit-implied-resize t (setq frame-resize-pixelwise t)
frame-resize-pixelwise t)
;; 隐藏 title bar ;; 隐藏 title bar
(setq default-frame-alist '((undecorated-round . t))) (add-to-list 'default-frame-alist '(undecorated-round . t))
(use-package solaire-mode (use-package solaire-mode
:hook (elpaca-after-init . solaire-global-mode)) :hook (elpaca-after-init . solaire-global-mode))
@@ -33,81 +25,81 @@
:init :init
(setq modus-themes-italic-constructs t (setq modus-themes-italic-constructs t
modus-themes-bold-constructs t modus-themes-bold-constructs t
modus-themes-mixed-fonts t)) modus-themes-mixed-fonts t)
:commands (modus-themes-load-random-dark
;; (use-package standard-themes :demand t modus-themes-load-random-light
;; :config modus-themes-load-random))
;; (modus-themes-load-theme 'standard-light-tinted))
(use-package doric-themes (use-package doric-themes
:demand t ;; :bind ("<f5>" . doric-themes-load-random)
:bind ("<f5>" . doric-themes-load-random) ;; :bind ("C-<f5>" . (lambda () (interactive) (doric-themes-load-random 'light)))
:bind ("C-<f5>" . doric-load-random-light) ;; :bind ("M-<f5>" . (lambda () (interactive) (doric-themes-load-random 'dark)))
:bind ("M-<f5>" . doric-load-random-dark) :commands doric-themes-load-random)
(use-package ef-themes
:bind ("<f5>" . modus-themes-load-random)
:bind ("C-<f5>" . modus-themes-load-random-light)
:bind ("M-<f5>" . modus-themes-load-random-dark)
:init :init
(defvar my/doric-dark-themes (setq ef-themes-light-themes '(ef-arbutus ef-cyprus ef-day ef-duo-light ef-eagle ef-elea-light
'(doric-fire ef-kassio ef-melissa-light ef-orange ef-reverie
doric-valley ef-spring ef-summer ef-trio-light ef-tritanopia-light))
doric-walnut
doric-mermaid
doric-pine
doric-plum
doric-water))
(defvar my/doric-light-themes
'(doric-oak
doric-jade
doric-wind
doric-beach
doric-coral
doric-earth
doric-almond))
(defun synchronise-theme () (setq ef-themes-dark-themes '(ef-autumn ef-bio ef-cherie ef-dark ef-deuteranopia-dark ef-dream
(let* ((hour (string-to-number ef-duo-dark ef-elea-dark ef-fig ef-maris-dark
(substring (current-time-string) 11 13))) ef-melissa-dark ef-night ef-owl ef-rosa ef-symbiosis
(theme-list (if (member hour (number-sequence 6 18)) ef-trio-dark ef-tritanopia-dark ef-winter))
my/doric-light-themes ;; This makes the Modus commands listed below consider only the Ef
my/doric-dark-themes)) ;; themes. For an alternative that includes Modus and all
(loaded (seq-random-elt theme-list))) ;; derivative themes (like Ef), enable the
(mapc #'disable-theme custom-enabled-themes) ;; `modus-themes-include-derivatives-mode' instead. The manual of
(load-theme loaded :no-confirm))) ;; the Ef themes has a section that explains all the possibilities:
;;
;; - Evaluate `(info "(ef-themes) Working with other Modus themes or taking over Modus")'
;; - Visit <https://protesilaos.com/emacs/ef-themes#h:6585235a-5219-4f78-9dd5-6a64d87d1b6e>
(ef-themes-take-over-modus-themes-mode 1))
(synchronise-theme) (use-package auto-dark
(run-with-timer 3600 3600 'synchronise-theme) :when (and (eq system-type 'darwin) (display-graphic-p))
:ensure t
;; :custom
;; (auto-dark-themes '((doric-beach) (leuven)))
;; (auto-dark-allow-osascript t)
;; (auto-dark-detection-method nil) ;; dangerous to be set manually
:hook
(auto-dark-dark-mode
. (lambda ()
;; something to execute when dark mode is detected
;; (doric-themes-load-random 'dark))
(ef-themes-load-random-dark)
))
(auto-dark-light-mode
. (lambda ()
;; something to execute when light mode is detected
;; (doric-themes-load-random 'light)
(ef-themes-load-random-light)
))
:hook elpaca-after-init)
(defun doric-load-random-light ()
(interactive)
(mapc #'disable-theme custom-enabled-themes)
(let ((loaded (seq-random-elt my/doric-light-themes)))
(load-theme loaded :no-confirm)))
(defun doric-load-random-dark ()
(interactive)
(mapc #'disable-theme custom-enabled-themes)
(let ((loaded (seq-random-elt my/doric-dark-themes)))
(load-theme loaded :no-confirm))))
(use-package rainbow-delimiters (use-package rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode) :hook ((prog-mode . rainbow-delimiters-mode)
(typst-ts-mode . rainbow-delimiters-mode) (typst-ts-mode . rainbow-delimiters-mode)
(python-ts-mode . rainbow-delimiters-mode))) (python-ts-mode . rainbow-delimiters-mode)))
;; (use-package prism
;; :hook (prog-mode . prism-mode)
;; :hook (text-mode . prism-mode)
;; :hook (typst-ts-mode . prism-mode)
;; :hook (python-ts-mode . prism-whitespace-mode)
;; :config
;; (setq prism-parens t))
(use-package rainbow-mode (use-package rainbow-mode
:hook text-mode :hook text-mode
:hook prog-mode) :hook prog-mode)
;; (use-package mood-line
;; :hook emacs-startup
;; :custom (mood-line-glyph-alist mood-line-glyphs-fira-code))
(use-package doom-modeline (use-package doom-modeline
:hook (elpaca-after-init . doom-modeline-mode) :hook (elpaca-after-init . doom-modeline-mode)
:config :config
(setq doom-modeline-support-imenu t (setq doom-modeline-support-imenu t
doom-modeline-icons nil
doom-modeline-height 30 doom-modeline-height 30
doom-modeline-buffer-file-name-style 'relative-from-project doom-modeline-buffer-file-name-style 'relative-from-project
doom-modeline-enable-word-count t doom-modeline-enable-word-count t
@@ -133,19 +125,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 Mono TC Nerd Font-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 Mono TC Nerd Font-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
@@ -181,28 +173,13 @@
:ensure (nerd-icons :ensure (nerd-icons
:type git :type git
:host github :host github
:repo "rainstormstudio/nerd-icons.el" :repo "rainstormstudio/nerd-icons.el"))
:files (:defaults "data")) ;; :files (:defaults "data"))
:custom ;; :custom
;; The Nerd Font you want to use in GUI ;; The Nerd Font you want to use in GUI
;; "Symbols Nerd Font Mono" is the default and is recommended ;; "Symbols Nerd Font Mono" is the default and is recommended
;; but you can use any other Nerd Font if you want ;; but you can use any other Nerd Font if you want
(nerd-icons-font-family "Symbols Nerd Font Mono")) ;; (nerd-icons-font-family "Symbols Nerd Font Mono"))
(use-package nerd-icons-ibuffer
:ensure t
:hook (ibuffer-mode-hook . nerd-icons-ibuffer-mode))
;; Display transient in child frame
;; (use-package transient-posframe
;; :diminish
;; :commands transient-posframe-mode
;; :custom-face
;; (transient-posframe-border ((t (:inherit posframe-border :background unspecified))))
;; :hook elpaca-after-init
;; :init (setq transient-mode-line-format nil
;; transient-posframe-parameters '((left-fringe . 8)
;; (right-fringe . 8))))
(with-no-warnings (with-no-warnings
(when (featurep 'ns) (when (featurep 'ns)
@@ -211,12 +188,29 @@
;; Don't open a file in a new frame ;; Don't open a file in a new frame
(setq ns-pop-up-frames nil))) (setq ns-pop-up-frames nil)))
(use-package beacon ;; hl current line
:diminish (use-package hl-line
:hook elpaca-after-init) :ensure nil
: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)))))
;; (use-package beacon
;; :diminish
;; :hook elpaca-after-init)
(use-package spacious-padding (use-package spacious-padding
:diminish :diminish
:hook elpaca-after-init) :hook elpaca-after-init)
;; Eval result overlay
(use-package eros
:hook elpaca-after-init
:bind (([remap eval-defun] . eros-eval-defun)
([remap eval-last-sexp] . eros-eval-last-sexp)))
(use-package goggles
:diminish
:hook (prog-mode text-mode conf-mode))
(provide 'init-ui) (provide 'init-ui)

View File

@@ -1,17 +1,19 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
(use-package transient)
(use-package which-key (use-package which-key
:diminish :diminish
:functions childframe-completion-workable-p :functions childframe-completion-workable-p
:bind ("C-h M-m" . which-key-show-major-mode) :bind ("C-h M-m" . which-key-show-major-mode)
:hook (elpaca-after-init . which-key-mode) :hook (elpaca-after-init . which-key-mode)
:init (setq which-key-max-description-length 30 :init (setq which-key-max-description-length 30
which-key-idle-delay 0.5 which-key-idle-delay 0.5
which-key-lighter nil which-key-lighter nil
which-key-show-remaining-keys t) which-key-show-remaining-keys t)
:config :config
(which-key-add-key-based-replacements "C-c a" "LSP") (which-key-add-key-based-replacements "C-c a" "LSP")
(which-key-add-key-based-replacements "C-c c" "code") (which-key-add-key-based-replacements "C-c b" "beframe")
(which-key-add-key-based-replacements "C-c c" "code") (which-key-add-key-based-replacements "C-c c" "code")
(which-key-add-key-based-replacements "C-c n" "org") (which-key-add-key-based-replacements "C-c n" "org")
(which-key-add-key-based-replacements "C-c l" "llm") (which-key-add-key-based-replacements "C-c l" "llm")
@@ -28,20 +30,6 @@
(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
: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 <R> <D>")
(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 <R> <D>")))
;; Writable grep buffer ;; Writable grep buffer
(use-package wgrep (use-package wgrep
:init (setq wgrep-auto-save-buffer t :init (setq wgrep-auto-save-buffer t
@@ -49,23 +37,48 @@
;; 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)
("m" . rg-menu)) ("m" . rg-menu))
:init (setq rg-show-columns t) :init (setq rg-show-columns t)
:config (add-to-list 'rg-custom-type-aliases '("tmpl" . "*.tmpl")))
(use-package pdf-tools
:config :config
(pdf-tools-install)) (add-to-list 'rg-custom-type-aliases '("tmpl" . "*.tmpl"))
(rg-enable-default-bindings)
)
;; (use-package keycast
;; :hook (elpaca-after-init . keycast-mode-line-mode)
;; :config
;; (setq keycast-mode-line-remove-tail-elements nil))
(use-package elcord) (use-package elcord)
;; (when (display-graphic-p)
;; (use-package pdf-view
;; :ensure pdf-tools
;; :diminish (pdf-view-themed-minor-mode
;; pdf-view-midnight-minor-mode
;; pdf-view-roll-minor-mode
;; pdf-view-printer-minor-mode)
;; :functions pdf-tools-install
;; :hook ((pdf-tools-enabled . pdf-view-auto-slice-minor-mode)
;; (pdf-tools-enabled . pdf-view-roll-minor-mode)
;; (pdf-tools-enabled . pdf-isearch-minor-mode))
;; ;; :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
;; :magic ("%PDF" . pdf-view-mode)
;; :bind (:map pdf-view-mode-map
;; ("C-s" . isearch-forward))
;; ;; :init (setq pdf-view-use-scaling t
;; ;; pdf-view-use-imagemagick nil)
;; :config
;; ;; Activate the package
;; (pdf-tools-install t nil t nil))
;; ;; Recover last viewed position
;; (use-package saveplace-pdf-view
;; :when (ignore-errors (pdf-info-check-epdfinfo) t)
;; :autoload (saveplace-pdf-view-find-file-advice saveplace-pdf-view-to-alist-advice)
;; :functions pdf-info-check-epdfinfo
;; :init
;; (advice-add 'save-place-find-file-hook :around #'saveplace-pdf-view-find-file-advice)
;; (advice-add 'save-place-to-alist :around #'saveplace-pdf-view-to-alist-advice)))
(provide 'init-utils) (provide 'init-utils)

View File

@@ -1,27 +1,28 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
(use-package transient)
(use-package magit (use-package magit
:defer t
:bind (("C-c g" . magit-dispatch)) :bind (("C-c g" . magit-dispatch))
:custom :custom
(magit-diff-refine-hunk t) (magit-diff-refine-hunk t)
(git-commit-major-mode 'git-commit-elisp-text-mode) (git-commit-major-mode 'git-commit-elisp-text-mode)
:config :config
(elemacs-load-packages-incrementally '(dash f s with-editor eieio transient git-commit))
(setq magit-show-long-lines-warning nil)) (setq magit-show-long-lines-warning nil))
;; Prime cache before Magit refresh ;; Prime cache before Magit refresh
(use-package magit-prime (use-package magit-prime
:diminish :diminish
:hook elpaca-after-init) :config
(magit-prime-mode))
;; Show TODOs in Magit ;; Show TODOs in Magit
(use-package magit-todos (use-package magit-todos
:after magit-status :after magit-status
:hook magit
:commands magit-todos-mode :commands magit-todos-mode
:init :init
(setq magit-todos-nice (if (executable-find "nice") t nil)) (setq magit-todos-nice (if (executable-find "nice") t nil)))
(magit-todos-mode 1))
;; Walk through git revisions of a file ;; Walk through git revisions of a file
(use-package git-timemachine (use-package git-timemachine

View File

@@ -39,7 +39,10 @@
(use-package ace-window (use-package ace-window
:hook (emacs-startup . ace-window-display-mode) :hook (emacs-startup . ace-window-display-mode)
:bind (([remap other-window] . ace-window) :bind (([remap other-window] . ace-window)
("M-o" . ace-window)
("C-c w" . ace-window-hydra/body)) ("C-c w" . ace-window-hydra/body))
:custom
(aw-scope 'frame)
:pretty-hydra :pretty-hydra
(("Actions" (("Actions"
(("TAB" other-window "switch") (("TAB" other-window "switch")
@@ -47,7 +50,7 @@
("X" ace-delete-other-windows "delete other" :exit t) ("X" ace-delete-other-windows "delete other" :exit t)
("s" ace-swap-window "swap") ("s" ace-swap-window "swap")
("a" ace-select-window "select" :exit t) ("a" ace-select-window "select" :exit t)
("m" toggle-frame-maximized "maximize" :exit t) ("m" maximize-window "maximize" :exit t)
("u" toggle-frame-fullscreen "fullscreen" :exit t)) ("u" toggle-frame-fullscreen "fullscreen" :exit t))
"Resize" "Resize"
(("h" shrink-window-horizontally "") (("h" shrink-window-horizontally "")
@@ -77,9 +80,9 @@
(popper-group-function #'popper-group-by-directory) (popper-group-function #'popper-group-by-directory)
(popper-echo-dispatch-actions t) (popper-echo-dispatch-actions t)
:bind (:map popper-mode-map :bind (:map popper-mode-map
("C-h z" . popper-toggle) ("C-h z" . popper-toggle)
("C-<tab>" . popper-cycle) ("C-<tab>" . popper-cycle)
("C-M-<tab>" . popper-toggle-type)) ("C-M-<tab>" . popper-toggle-type))
:hook (emacs-startup . popper-echo-mode) :hook (emacs-startup . popper-echo-mode)
:init :init
(setq popper-mode-line "" (setq popper-mode-line ""
@@ -142,10 +145,10 @@
rustic-cargo-outdated-mode rustic-cargo-run-mode rustic-cargo-test-mode rustic-cargo-outdated-mode rustic-cargo-run-mode rustic-cargo-test-mode
"\\*haskell\\*")) "\\*haskell\\*"))
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\*OCaml\\*" '("\\*OCaml\\*"
(display-buffer-reuse-window display-buffer-in-direction) (display-buffer-reuse-window display-buffer-in-direction)
(direction . right) (direction . right)
(window-width . 0.5))) (window-width . 0.5)))
:config :config
(with-no-warnings (with-no-warnings

View File

@@ -8,74 +8,57 @@
;; Recommended keymap prefix on macOS ;; Recommended keymap prefix on macOS
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
;; Recommended keymap prefix on Windows/Linux ;; Recommended keymap prefix on Windows/Linux
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)) (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
(use-package ibuffer
:ensure nil
:bind ("C-x C-b" . ibuffer)
:bind (:map ibuffer-mode-map
("M-o" . nil))
:config
(add-to-list 'ibuffer-help-buffer-modes 'helpful-mode)
(add-to-list 'ibuffer-help-buffer-modes 'Man-mode)
:init (setq ibuffer-filter-group-name-face '(:inherit (font-lock-string-face bold))))
(use-package nerd-icons-ibuffer
:ensure t
:hook (ibuffer-mode-hook . nerd-icons-ibuffer-mode))
(use-package ibuffer-projectile (use-package ibuffer-projectile
:config :init
(add-hook 'ibuffer-hook (add-hook 'ibuffer-hook
(lambda () (lambda ()
(ibuffer-projectile-set-filter-groups) (ibuffer-projectile-set-filter-groups)
(unless (eq ibuffer-sorting-mode 'alphabetic) (unless (eq ibuffer-sorting-mode 'alphabetic)
(ibuffer-do-sort-by-alphabetic))))) (ibuffer-do-sort-by-alphabetic)))))
(use-package consult-projectile (use-package beframe
:bind (([remap projectile-find-file] . consult-projectile-find-file)
([remap projectile-recentf] . consult-projectile-recentf)
([remap projectile-switch-project] . consult-projectile-switch-project)
([remap projectile-switch-to-buffer] . consult-projectile-switch-to-buffer)
([remap projectile-find-dir] . consult-projectile-find-dir)))
;; (use-package org-project-capture)
;; (use-package org-projectile
;; :config
;; (setq org-project-capture-default-backend
;; (make-instance 'org-project-capture-projectile-backend)))
(global-set-key (kbd "C-x C-b") #'ibuffer)
;; (use-package beframe
;; :hook elpaca-after-init
;; :bind (("C-x b" . beframe-switch-buffer)
;; ("C-x C-b" . beframe-buffer-menu)
;; ("C-x f" . other-frame-prefix))
;; :config
;; (define-key global-map (kbd "C-c b") #'beframe-prefix-map))
(use-package eyebrowse
:hook elpaca-after-init :hook elpaca-after-init
:custom :bind ("C-x f" . other-frame-prefix)
(eyebrowse-new-workspace t))
(use-package easysession
:diminish
:demand t
;; :hook (elpaca-after-init easysession-scratch-mode)
;; :hook (elpaca-after-init easysession-magit-mode)
:bind (("s-1" . eyebrowse-switch-to-window-config-1)
("s-2" . eyebrowse-switch-to-window-config-2)
("s-3" . eyebrowse-switch-to-window-config-3)
("s-4" . eyebrowse-switch-to-window-config-4)
("s-5" . eyebrowse-switch-to-window-config-5)
("s-6" . eyebrowse-switch-to-window-config-6)
("s-7" . eyebrowse-switch-to-window-config-7)
("s-8" . eyebrowse-switch-to-window-config-8))
;; ("C-c C-s l" . easysession-switch-to)
;; ("C-c C-s L" . easysession-switch-to-and-restore-geometry)
;; ("C-c C-s s" . easysession-save)
;; ("C-c C-s r" . easysession-rename)
;; ("C-c C-s R" . easysession-reset)
;; ("C-c C-s u" . easysession-unload)
;; ("C-c C-s d" . easysession-delete))
:custom
(easysession-switch-to-save-session t)
(easysession-switch-to-exclude-current nil)
:config :config
(setq easysession-setup-load-session t) (define-key global-map (kbd "C-c b") #'beframe-prefix-map)
(easysession-setup) (setq beframe-functions-in-frames '(projectile-switch-project)
(easysession-magit-mode) beframe-rename-function #'ignore
(easysession-scratch-mode)) beframe-global-buffers '("*scratch*" "*Messages*" "*Backtrace*"))
(use-package embark
:defer
:config
(define-key embark-buffer-map (kbd "fu")
(defun my/beframe-unassume-buffer (buf)
(interactive "bUnassume: ")
(beframe--unassume
(list (get-buffer buf)))))
(define-key embark-buffer-map (kbd "fa")
(defun my/beframe-assume-buffer (buf)
(interactive "bAssume: ")
(beframe--assume
(list (get-buffer buf))))))
;; Beframe integration with other packages
(with-eval-after-load 'consult
(defun consult-beframe-buffer-list (&optional frame)
"Return the list of buffers from `beframe-buffer-names' sorted by visibility.
With optional argument FRAME, return the list of buffers of FRAME."
(beframe-buffer-list frame :sort #'beframe-buffer-sort-visibility))
(setq consult-buffer-list-function #'consult-beframe-buffer-list)))
(provide 'init-workspace) (provide 'init-workspace)

19
lisp/init-writing.el Normal file
View File

@@ -0,0 +1,19 @@
;; -*- lexical-binding: t; -*-
(use-package flyspell
:ensure nil
:commands flyspell-mode
:bind (:map flyspell-mode-map
("C-M-i" . nil)
("C-;" . nil)
("C-," . nil)
("C-; C-4" . 'flyspell-auto-correct-previous-word)
;; ("C-; n" . 'flyspell-goto-next-error)
))
(use-package jinx
:hook ((text-mode prog-mode conf-mode org-mode) . jinx-mode)
:commands jinx-mode
:bind ([remap ispell-word] . jinx-correct))
(provide 'init-writing)

View File

@@ -1,236 +0,0 @@
;; -*- lexical-binding: t; -*-
(setq modus-themes-operandi-colors-override
'((bg-main "#fff0f2")
(bg-dim "#fbe6ef")
(bg-alt "#f5dae6")
(bg-hl-line "#fad8e3")
(bg-active "#efcadf")
(bg-inactive "#f3ddef")
(bg-active-accent "#ffbbef")
(bg-region "#dfc5d1")
(bg-region-accent "#efbfef")
(bg-region-accent-subtle "#ffd6ef")
(bg-header "#edd3e0")
(bg-tab-active "#ffeff2")
(bg-tab-inactive "#f8d3ef")
(bg-tab-inactive-accent "#ffd9f5")
(bg-tab-inactive-alt "#e5c0d5")
(bg-tab-inactive-alt-accent "#f3cce0")
(fg-main "#543f78")
(fg-dim "#5f476f")
(fg-alt "#7f6f99")
(fg-unfocused "#8f6f9f")
(fg-active "#563068")
(fg-inactive "#8a5698")
(fg-docstring "#5f5fa7")
(fg-comment-yellow "#a9534f")
(fg-escape-char-construct "#8b207f")
(fg-escape-char-backslash "#a06d00")
(bg-special-cold "#d3e0f4")
(bg-special-faint-cold "#e0efff")
(bg-special-mild "#c4ede0")
(bg-special-faint-mild "#e0f0ea")
(bg-special-warm "#efd0c4")
(bg-special-faint-warm "#ffe4da")
(bg-special-calm "#f0d3ea")
(bg-special-faint-calm "#fadff9")
(fg-special-cold "#405fb8")
(fg-special-mild "#407f74")
(fg-special-warm "#9d6f4f")
(fg-special-calm "#af509f")
(bg-completion "#ffc5e5")
(bg-completion-subtle "#f7cfef")
(red "#ed2f44")
(red-alt "#e0403d")
(red-alt-other "#e04059")
(red-faint "#ed4f44")
(red-alt-faint "#e0603d")
(red-alt-other-faint "#e06059")
(green "#217a3c")
(green-alt "#417a1c")
(green-alt-other "#006f3c")
(green-faint "#318a4c")
(green-alt-faint "#518a2c")
(green-alt-other-faint "#20885c")
(yellow "#b06202")
(yellow-alt "#a95642")
(yellow-alt-other "#a06f42")
(yellow-faint "#b07232")
(yellow-alt-faint "#a96642")
(yellow-alt-other-faint "#a08042")
(blue "#275ccf")
(blue-alt "#475cc0")
(blue-alt-other "#3340ef")
(blue-faint "#476ce0")
(blue-alt-faint "#575ccf")
(blue-alt-other-faint "#3f60d7")
(magenta "#bf317f")
(magenta-alt "#d033c0")
(magenta-alt-other "#844fe4")
(magenta-faint "#bf517f")
(magenta-alt-faint "#d053c0")
(magenta-alt-other-faint "#846fe4")
(cyan "#007a9f")
(cyan-alt "#3f709f")
(cyan-alt-other "#107f7f")
(cyan-faint "#108aaf")
(cyan-alt-faint "#3f80af")
(cyan-alt-other-faint "#3088af")
(red-active "#cd2f44")
(green-active "#116a6c")
(yellow-active "#993602")
(blue-active "#475ccf")
(magenta-active "#7f2ccf")
(cyan-active "#007a8f")
(red-nuanced-bg "#ffdbd0")
(red-nuanced-fg "#ed6f74")
(green-nuanced-bg "#dcf0dd")
(green-nuanced-fg "#3f9a4c")
(yellow-nuanced-bg "#fff3aa")
(yellow-nuanced-fg "#b47232")
(blue-nuanced-bg "#e3e3ff")
(blue-nuanced-fg "#201f6f")
(magenta-nuanced-bg "#fdd0ff")
(magenta-nuanced-fg "#c0527f")
(cyan-nuanced-bg "#dbefff")
(cyan-nuanced-fg "#0f3f60")
(bg-diff-heading "#b7cfe0")
(fg-diff-heading "#041645")
(bg-diff-added "#d6f0d6")
(fg-diff-added "#004520")
(bg-diff-changed "#fcefcf")
(fg-diff-changed "#524200")
(bg-diff-removed "#ffe0ef")
(fg-diff-removed "#891626")
(bg-diff-refine-added "#84cfa4")
(fg-diff-refine-added "#002a00")
(bg-diff-refine-changed "#cccf8f")
(fg-diff-refine-changed "#302010")
(bg-diff-refine-removed "#da92b0")
(fg-diff-refine-removed "#500010")
(bg-diff-focus-added "#a6e5c6")
(fg-diff-focus-added "#002c00")
(bg-diff-focus-changed "#ecdfbf")
(fg-diff-focus-changed "#392900")
(bg-diff-focus-removed "#efbbcf")
(fg-diff-focus-removed "#5a0010"))
modus-themes-vivendi-color-overrides
'((bg-main "#25152a")
(bg-dim "#2a1930")
(bg-alt "#382443")
(bg-hl-line "#332650")
(bg-active "#463358")
(bg-inactive "#2d1f3a")
(bg-active-accent "#50308f")
(bg-region "#5d4a67")
(bg-region-accent "#60509f")
(bg-region-accent-subtle "#3f285f")
(bg-header "#3a2543")
(bg-tab-active "#26162f")
(bg-tab-inactive "#362647")
(bg-tab-inactive-accent "#36265a")
(bg-tab-inactive-alt "#3e2f5a")
(bg-tab-inactive-alt-accent "#3e2f6f")
(fg-main "#debfe0")
(fg-dim "#d0b0da")
(fg-alt "#ae85af")
(fg-unfocused "#8e7f9f")
(fg-active "#cfbfef")
(fg-inactive "#b0a0c0")
(fg-docstring "#c8d9f7")
(fg-comment-yellow "#cf9a70")
(fg-escape-char-construct "#ff75aa")
(fg-escape-char-backslash "#dbab40")
(bg-special-cold "#2a3f58")
(bg-special-faint-cold "#1e283f")
(bg-special-mild "#0f3f31")
(bg-special-faint-mild "#0f281f")
(bg-special-warm "#44331f")
(bg-special-faint-warm "#372213")
(bg-special-calm "#4a314f")
(bg-special-faint-calm "#3a223f")
(fg-special-cold "#c0b0ff")
(fg-special-mild "#bfe0cf")
(fg-special-warm "#edc0a6")
(fg-special-calm "#ff9fdf")
(bg-completion "#502d70")
(bg-completion-subtle "#451d65")
(red "#ff5f6f")
(red-alt "#ff8f6d")
(red-alt-other "#ff6f9d")
(red-faint "#ffa0a0")
(red-alt-faint "#f5aa80")
(red-alt-other-faint "#ff9fbf")
(green "#51ca5c")
(green-alt "#71ca3c")
(green-alt-other "#51ca9c")
(green-faint "#78bf78")
(green-alt-faint "#99b56f")
(green-alt-other-faint "#88bf99")
(yellow "#f0b262")
(yellow-alt "#f0e242")
(yellow-alt-other "#d0a272")
(yellow-faint "#d2b580")
(yellow-alt-faint "#cabf77")
(yellow-alt-other-faint "#d0ba95")
(blue "#778cff")
(blue-alt "#8f90ff")
(blue-alt-other "#8380ff")
(blue-faint "#82b0ec")
(blue-alt-faint "#a0acef")
(blue-alt-other-faint "#80b2f0")
(magenta "#ff70cf")
(magenta-alt "#ff77f0")
(magenta-alt-other "#ca7fff")
(magenta-faint "#e0b2d6")
(magenta-alt-faint "#ef9fe4")
(magenta-alt-other-faint "#cfa6ff")
(cyan "#30cacf")
(cyan-alt "#60caff")
(cyan-alt-other "#40b79f")
(cyan-faint "#90c4ed")
(cyan-alt-faint "#a0bfdf")
(cyan-alt-other-faint "#a4d0bb")
(red-active "#ff6059")
(green-active "#64dc64")
(yellow-active "#ffac80")
(blue-active "#4fafff")
(magenta-active "#cf88ff")
(cyan-active "#50d3d0")
(red-nuanced-bg "#440a1f")
(red-nuanced-fg "#ffcccc")
(green-nuanced-bg "#002904")
(green-nuanced-fg "#b8e2b8")
(yellow-nuanced-bg "#422000")
(yellow-nuanced-fg "#dfdfb0")
(blue-nuanced-bg "#1f1f5f")
(blue-nuanced-fg "#bfd9ff")
(magenta-nuanced-bg "#431641")
(magenta-nuanced-fg "#e5cfef")
(cyan-nuanced-bg "#042f49")
(cyan-nuanced-fg "#a8e5e5")
(bg-diff-heading "#304466")
(fg-diff-heading "#dae7ff")
(bg-diff-added "#0a383a")
(fg-diff-added "#94ba94")
(bg-diff-changed "#2a2000")
(fg-diff-changed "#b0ba9f")
(bg-diff-removed "#50163f")
(fg-diff-removed "#c6adaa")
(bg-diff-refine-added "#006a46")
(fg-diff-refine-added "#e0f6e0")
(bg-diff-refine-changed "#585800")
(fg-diff-refine-changed "#ffffcc")
(bg-diff-refine-removed "#952838")
(fg-diff-refine-removed "#ffd9eb")
(bg-diff-focus-added "#1d4c3f")
(fg-diff-focus-added "#b4dfb4")
(bg-diff-focus-changed "#424200")
(fg-diff-focus-changed "#d0daaf")
(bg-diff-focus-removed "#6f0f39")
(fg-diff-focus-removed "#eebdba")))
(provide 'modus-summer-time)
;;

View File

@@ -1,192 +0,0 @@
;;; persp-mode-project-bridge.el --- Integration of persp-mode + project.el -*- lexical-binding: t -*-
;; Copyright (C) 2017 Constantin Kulikov
;; Copyright (C) 2021 Siavash Askari Nasr
;;
;; Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com>
;; Siavash Askari Nasr <siavash.askari.nasr@gmail.com>
;; Maintainer: Siavash Askari Nasr <siavash.askari.nasr@gmail.com>
;; Version: 0.1
;; Package-Requires: ((emacs "27.1") (persp-mode "2.9"))
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Keywords: vc, persp-mode, perspective, project, project.el
;; URL: https://github.com/CIAvash/persp-mode-project-bridge
;;; License:
;; This file is not part of GNU Emacs.
;; 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, 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, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Creates a perspective for each project.el project. (Based on the persp-mode-projectile-bridge)
;;; Usage:
;; Installation:
;; M-x package-install-file RET persp-mode-project-bridge RET
;; Example configuration:
;; (with-eval-after-load "persp-mode-project-bridge-autoloads"
;; (add-hook 'persp-mode-project-bridge-mode-hook
;; (lambda ()
;; (if persp-mode-project-bridge-mode
;; (persp-mode-project-bridge-find-perspectives-for-all-buffers)
;; (persp-mode-project-bridge-kill-perspectives))))
;; (add-hook 'after-init-hook
;; (lambda ()
;; (persp-mode-project-bridge-mode 1))
;; t))
;;
;; With use-package:
;; (use-package persp-mode-project-bridge
;; :hook
;; (persp-mode-project-bridge-mode . (lambda ()
;; (if persp-mode-project-bridge-mode
;; (persp-mode-project-bridge-find-perspectives-for-all-buffers)
;; (persp-mode-project-bridge-kill-perspectives))))
;; (persp-mode . persp-mode-project-bridge-mode))
;;; Code:
(require 'persp-mode)
(require 'project)
(require 'cl-lib)
(declare-function project-root "project")
(defvar persp-mode-project-bridge-mode nil)
(defgroup persp-mode-project-bridge nil
"persp-mode project.el integration."
:group 'persp-mode
:group 'project
:prefix "persp-mode-project-bridge-"
:link
'(url-link
:tag "Github" "https://github.com/CIAvash/persp-mode-project-bridge"))
(defcustom persp-mode-project-bridge-persp-name-prefix "[p] "
"Prefix to use for project perspective names."
:group 'persp-mode-project-bridge
:type 'string
:set (lambda (sym val)
(if persp-mode-project-bridge-mode
(let ((old-prefix (symbol-value sym)))
(custom-set-default sym val)
(let (old-name)
(mapc (lambda (p)
(when (and
p (persp-parameter
'persp-mode-project-bridge p))
(setq old-name
(substring (persp-name p)
(string-width old-prefix)))
(persp-rename (concat val old-name) p)))
(persp-persps))))
(custom-set-default sym val))))
(defun persp-mode-project-bridge-add-new-persp (name)
"Create a new perspective NAME."
(let ((persp (persp-get-by-name name *persp-hash* :nil)))
(if (eq :nil persp)
(prog1
(setq persp (persp-add-new name))
(when persp
(set-persp-parameter 'persp-mode-project-bridge t persp)
(set-persp-parameter 'dont-save-to-file t persp)
(persp-add-buffer (cl-remove-if-not #'get-file-buffer (project-files (project-current)))
persp nil nil)))
persp)))
(defun persp-mode-project-bridge-find-perspective-for-buffer (b)
"Find a perspective for buffer B."
(when (buffer-live-p b)
(with-current-buffer b
(when (and persp-mode-project-bridge-mode
(buffer-name b) (project-current))
(let ((persp (persp-mode-project-bridge-add-new-persp
(concat persp-mode-project-bridge-persp-name-prefix
(file-name-nondirectory
(directory-file-name
(if (fboundp 'project-root)
(project-root (project-current))
(car (project-roots (project-current))))))))))
(when persp
(persp-add-buffer b persp nil nil)
persp))))))
(defun persp-mode-project-bridge-hook-switch (&rest _args)
"Switch to a perspective when hook is activated."
(let ((persp
(persp-mode-project-bridge-find-perspective-for-buffer
(current-buffer))))
(when persp
(persp-frame-switch (persp-name persp)))))
(defun persp-mode-project-bridge-find-perspectives-for-all-buffers ()
"Find perspectives for all buffers."
(when persp-mode-project-bridge-mode
(mapc #'persp-mode-project-bridge-find-perspective-for-buffer
(buffer-list))))
(defun persp-mode-project-bridge-kill-perspectives ()
"Kill all bridge perspectives."
(when persp-mode
(mapc #'persp-kill
(mapcar #'persp-name
(cl-delete-if-not
(apply-partially
#'persp-parameter
'persp-mode-project-bridge)
(persp-persps))))))
(defvar persp-mode-project-bridge-switch-hooks
(list 'find-file-hook 'dired-mode-hook 'vc-dir-mode-hook 'eshell-mode-hook))
;;;###autoload
(define-minor-mode persp-mode-project-bridge-mode
"`persp-mode' and `project.el' integration.
Creates perspectives for project.el projects."
:require 'persp-mode-project-bridge
:group 'persp-mode-project-bridge
:init-value nil
:global t
(if persp-mode-project-bridge-mode
(if persp-mode
(progn
;; Add hooks
(add-hook 'persp-mode-hook
(lambda ()
(unless persp-mode
(persp-mode-project-bridge-mode -1))))
(dolist (hook persp-mode-project-bridge-switch-hooks)
(add-hook hook #'persp-mode-project-bridge-hook-switch)))
(message "You can not enable persp-mode-project-bridge-mode \
unless persp-mode is active.")
(setq persp-mode-project-bridge-mode nil))
;; Remove hooks
(dolist (hook persp-mode-project-bridge-switch-hooks)
(remove-hook hook #'persp-mode-project-bridge-hook-switch))))
(provide 'persp-mode-project-bridge)
;;; persp-mode-project-bridge.el ends here

View File

@@ -1,432 +0,0 @@
;;; texpresso.el --- Render and synchronize buffers with TeXpresso -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2023 Frédéric Bour
;; Hello world
;; Author: Frédéric Bour <frederic.bour@lakaban.net>
;; Maintainer: Frédéric Bour <frederic.bour@lakaban.net>
;; Created: March 25, 2023
;; Modified: March 25, 2023
;; Version: 0.0.1
;; Keywords: lisp local processes tex tools unix
;; Homepage: https://github.com/def/sync
;; Package-Requires: ((emacs "25.1"))
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; TeXpresso is a tool to recompute LaTeX documents and error log interactively.
;;
;;; Code:
;; Customizable variables
(defcustom texpresso-binary nil
"Path of TeXpresso binary."
:group 'tex
:risky t
:type '(choice (file :tag "Path")
(const :tag "Auto" nil)))
(defcustom texpresso-follow-edition nil
"If true, TeXpresso scrolls the view to the code being edited."
:group 'tex
:type 'boolean)
(defcustom texpresso-follow-cursor nil
"If true, TeXpresso scrolls the view to the cursor."
:group 'tex
:type 'boolean)
;; Main code
(defvar texpresso--process nil
"The running instance of TeXpresso as an Emacs process object, or nil.
`texpresso--process' is the latest process launched, it might be dead.
The process is also guaranteed to have a property named `'marker` that is
updated when synchronization state is reset.
When a buffer is synchronized with a process, it keeps a reference to the marker
object of that process. To check if incremental synchronization is possible, the
marker objects are compared for physical equality.
\(In practice they are `(cons nil nil)` objects, though their structural value is
not used anywhere.\)")
(defun texpresso--send (&rest value)
"Send VALUE as a serialized s-expression to `texpresso--process'."
(setq value (prin1-to-string value))
; (with-current-buffer (get-buffer-create "*texpresso-log*")
; (let ((inhibit-read-only t))
; (insert value)
; (insert "\n")))
(process-send-string texpresso--process value))
(defvar-local texpresso--state nil
"Internal synchronization state for current buffer.
The state is either nil (buffer not yet synchronized) or a list
`(list (buffer-file-name) texpresso--process marker)'.
The list is used to detect if, since last synchronization, the filename has
changed, the process has changed, or the synchronization state was reset
\(new marker\).")
(defvar-local texpresso--before-change nil
"A list (start end txt) saved during the last call to `texpresso--before-change'.
TeXpresso changes are expressed using byte offsets.
In the `after-change-functions' hook, one can only access the number of
characters removed by the change, and since the text has been already removed,
it is too late to access the number of bytes. To work around this limitation,
the changed region is saved by the `texpresso--before-change' function (a
`before-change-functions' hook).")
(define-minor-mode texpresso-mode
"A global minor mode that synchronizes buffer with TeXpresso.
Also launches a new TeXpresso process if none is running."
:init-value nil ; Initial value, nil for disabled
:global nil
:group 'tex
:lighter ""
(if texpresso-mode
(progn
(message "TeXpresso ☕ enabled")
(add-hook 'after-change-functions #'texpresso--after-change)
(add-hook 'before-change-functions #'texpresso--before-change)
(add-hook 'post-command-hook #'texpresso--post-command))
(message "TeXpresso ☕ disabled")
(remove-hook 'after-change-functions #'texpresso--after-change)
(remove-hook 'before-change-functions #'texpresso--before-change)
(remove-hook 'post-command-hook #'texpresso--post-command)))
(define-minor-mode texpresso-sync-mode
"A minor mode that forces a buffer to be synchronized with TeXpresso.
Otherwise a buffer is synchronized if its major mode derives from `tex-mode'."
:init-value nil ; Initial value, nil for disabled
:global nil
:group 'tex
:lighter ""
(setq texpresso--state nil))
(defvar-local texpresso--output-bound nil)
(defvar-local texpresso--output-timer nil)
(defun texpresso-move-to-cursor (&optional position)
"Scroll TeXpresso views to POSITION (or point)."
(interactive)
(when (texpresso--enabled-p)
(texpresso--send 'synctex-forward
(buffer-file-name)
(line-number-at-pos position t))))
(defun texpresso--output-truncate (buffer)
"Truncate TeXpresso output buffer BUFFER."
(with-current-buffer buffer
(when texpresso--output-timer
(cancel-timer texpresso--output-timer))
(when (and texpresso--output-bound
(<= texpresso--output-bound (point-max)))
(let ((inhibit-read-only t))
(delete-region texpresso--output-bound (point-max))))))
(defun texpresso--output-schedule-truncate (point)
"Schedule a truncation of current buffer to POINT.
Scheduling allows truncation to not happen too often, slowing down the editor
and causing it to flicker."
(when texpresso--output-timer
(cancel-timer texpresso--output-timer))
(setq texpresso--output-bound point)
(setq texpresso--output-timer
(run-with-timer 1 nil #'texpresso--output-truncate (current-buffer))))
(defun texpresso--enabled-p ()
"Check if TeXpresso is running and enabled for the current buffer."
(and (process-live-p texpresso--process)
(or texpresso-sync-mode
(derived-mode-p 'tex-mode))))
(defun texpresso--before-change (start end)
"A `before-change-functions' hook to update `texpresso--before-change' variable.
It records the number of bytes between START and END (the bytes removed)."
(when (texpresso--enabled-p)
; (message "before change %S %S" start end)
(setq texpresso--before-change
(list start end (buffer-substring-no-properties start end)))))
(defun texpresso--after-change (start end removed)
"An `after-change-functions' hook to synchronize the buffer with TeXpresso.
It instructs `texpresso--process' to replace REMOVED characters by the contents
between START and END.
Character counts are converted to byte offsets using `texpresso--before-change'."
(when (texpresso--enabled-p)
; (message "after change %S %S %S" start end removed)
(let ((filename (nth 0 texpresso--state))
(process (nth 1 texpresso--state))
(marker (nth 2 texpresso--state))
(bstart (nth 0 texpresso--before-change))
(bend (nth 1 texpresso--before-change))
(btext (nth 2 texpresso--before-change))
same-process)
(setq same-process
(and (eq filename (buffer-file-name))
(eq process texpresso--process)
(eq marker (process-get texpresso--process 'marker))))
(if (and same-process (<= bstart start (+ start removed) bend))
(let ((ofs (- start bstart)))
(texpresso--send 'change filename (1- (position-bytes start))
(string-bytes (substring btext ofs (+ ofs removed)))
(buffer-substring-no-properties start end)))
(when same-process
(message "TeXpresso: change hooks called with invalid arguments")
(message "(before-change %S %S %S)" bstart bend btext)
(message "(after-change %S %S %S)" start end removed))
(when (process-live-p process)
(process-send-string
process (prin1-to-string (list 'close filename))))
(setq texpresso--state
(list (buffer-file-name) texpresso--process
(process-get texpresso--process 'marker)))
(texpresso--send 'open (buffer-file-name)
(buffer-substring-no-properties
(point-min) (point-max))))
(when texpresso-follow-edition
(texpresso--send 'synctex-forward
(buffer-file-name)
(line-number-at-pos nil t))))))
(defun texpresso--post-command ()
"Function executed on post-command hook.
Sends cursor position to TeXpresso if `texpresso-follow-cursor'."
(when texpresso-follow-cursor
(texpresso-move-to-cursor)))
(defun texpresso--stderr-filter (process text)
"Save debug TEXT from TeXpresso PROCESS in *texpresso-stderr* buffer.
The output is truncated to ~50k."
(let ((buffer (process-buffer process)))
(when buffer
(with-current-buffer buffer
(save-excursion
(when (> (point-max) 49152)
(delete-region (point-min) 16384))
(goto-char (point-max))
(insert text))))))
(defun texpresso--display-output (buffer)
"Display BUFFER in a small window at bottom."
(if nil ;(fboundp '+popup/buffer)
(with-current-buffer buffer (+popup/buffer))
(display-buffer-at-bottom buffer '(nil (allow-no-window . t) (window-height . 0.2)))))
(defun texpresso--get-output-buffer (name &optional force)
"Return the buffer associated to TeXpresso channel NAME.
TeXpresso forwards different outputs of TeX process.
The standard output is named `'out' and the log file `'log'.
If it doesn't exists and FORCE is set, the buffer is created, otherwise nil is
returned."
(let (fullname buffer)
(setq fullname (cond
((eq name 'out) "*texpresso-out*")
((eq name 'log) "*texpresso-log*")
(t (error "TeXpresso: unknown buffer %S" name))))
(setq buffer (get-buffer fullname))
(when (and (not buffer) force)
(setq buffer (get-buffer-create fullname))
(with-current-buffer buffer
(setq buffer-read-only t
buffer-undo-list t)
(when (eq name 'out)
(compilation-mode)
(texpresso--display-output buffer))))
buffer))
(defun texpresso-display-output ()
"Open a small window to display TeXpresso output messages."
(interactive)
(texpresso--display-output (texpresso--get-output-buffer 'out 'force)))
(defun texpresso--stdout-dispatch (process expr)
"Interpret s-expression EXPR sent by TeXpresso PROCESS.
TeXpresso communicates with Emacs by writing a sequence of s-expressions on its
standard output. This function interprets one of these."
(let ((tag (car expr)))
(cond
((eq tag 'reset-sync)
(process-put process 'marker (cons nil nil)))
((eq tag 'truncate)
(let ((buffer (texpresso--get-output-buffer (nth 1 expr))))
(when buffer
(with-current-buffer buffer
(let ((pos (byte-to-position (1+ (nth 2 expr)))))
(when pos
(texpresso--output-schedule-truncate pos)))))))
((eq tag 'append)
(with-current-buffer (texpresso--get-output-buffer (nth 1 expr) 'force)
(let ((inhibit-read-only t)
(pos (byte-to-position (1+ (nth 2 expr))))
(text (nth 3 expr))
(window (get-buffer-window))
lines endpos)
(setq endpos (+ pos (length text)))
(unless (and (>= (point-max) endpos)
(string= text (buffer-substring pos endpos)))
(goto-char pos)
(setq lines (line-number-at-pos pos))
(insert text)
(setq lines (- (line-number-at-pos (point)) lines))
(when (> lines 0)
(save-excursion
(let ((beg (point)))
(forward-line lines)
(delete-region beg (point)))))
(when window (with-selected-window window
(goto-char (1- (point-max)))
(recenter -1))))
(texpresso--output-schedule-truncate endpos))))
((eq tag 'flush)
(dolist (buffer (list (texpresso--get-output-buffer 'out)
(texpresso--get-output-buffer 'log)))
(when buffer (texpresso--output-truncate buffer))))
((eq tag 'synctex)
(let ((fname (nth 1 expr)) buf)
(setq buf (and (file-exists-p fname)
(if (string= (buffer-name) "*TeXpresso window*")
(find-file-other-window fname)
(find-file fname))))
(if buf
(with-current-buffer buf
(goto-char (point-min))
(forward-line (1- (nth 2 expr)))
(switch-to-buffer buf))
(message "TeXpresso: unknown file %s" (nth 1 expr)))))
(t (message "Unknown message in texpresso output: %S" expr)))))
(defun texpresso--stdout-filter (process text)
"Interpret output of TeXpresso PROCESS.
TeXpresso communicates with Emacs by writing a sequence of textual s-expressions
on its standard output. This function receives a chunk of this TEXT, parses and
forwards the complete ones to `texpresso--stdout-dispatch', and buffers the
remainder."
(let ((prefix (process-get process 'buffer)))
(when prefix (setq text (concat prefix text))))
(let ((pos 0))
(condition-case nil
(while t
(let ((result (read-from-string text pos)))
(setq pos (cdr result))
(condition-case-unless-debug err
(texpresso--stdout-dispatch process (car result))
(error (message
"Error in texpresso--stdout-dispatch: %S\nWhile processing: %S"
err (car result))))))
((end-of-file)
(process-put process 'buffer (substring text pos))))))
(defun texpresso-reset ()
"Invalidate the synchronization state of all buffers."
(interactive)
(when texpresso--process
(process-put texpresso--process 'marker (cons nil nil))))
(defun texpresso-reset-buffer ()
"Invalidate the synchronization state of current buffer."
(interactive)
(setq texpresso--state nil))
(defadvice enable-theme (after texpresso--theme-change protect activate)
"Tell TeXpresso about new theme colors."
(when (process-live-p texpresso--process)
(texpresso--send 'theme
(color-name-to-rgb (face-attribute 'default :background))
(color-name-to-rgb (face-attribute 'default :foreground)))))
(defun texpresso--make-process (&rest command)
"Create and setup a new TeXpresso process with given COMMAND."
(when (process-live-p texpresso--process)
(kill-process texpresso--process))
(let ((texpresso-stderr (get-buffer-create "*texpresso-stderr*")))
(with-current-buffer texpresso-stderr (setq buffer-undo-list t))
(dolist (buffer (list (texpresso--get-output-buffer 'out 'force)
(texpresso--get-output-buffer 'log)))
(let ((inhibit-read-only t))
(when buffer
(with-current-buffer buffer
(delete-region (point-min) (point-max))))))
(setq texpresso--process
(make-process :name "texpresso"
:stderr texpresso-stderr
:connection-type 'pipe
:command command))
(set-process-filter (get-buffer-process texpresso-stderr)
#'texpresso--stderr-filter)
(set-process-filter texpresso--process
#'texpresso--stdout-filter)
(process-put texpresso--process 'marker (cons nil nil))
(texpresso--send 'theme
(color-name-to-rgb (face-attribute 'default :background))
(color-name-to-rgb (face-attribute 'default :foreground)))))
(defun texpresso-connect-debugger ()
"Create a new TeXpresso process using the debug proxy.
Normal TeXpresso processes are started using `texpresso-mode' or
`texpresso-restart'. This function is reserved for debugging purposes. It
connects to an existing TeXpresso instance launched in a terminal using
\"texpresso-debug\" shell command.
I came up with this workflow because Emacs (29.0.60 on macOS) bugged
when attaching a debugger to a process it launched. More specifically,
the bug was that the first interaction was successful, but then Emacs marked the
process as exited (in `process-status') and no more contents could be sent to
it, even though the process was still sending its stderr to Emacs."
(interactive)
(texpresso--make-process "texpresso-debug-proxy"))
(defun texpresso (&optional filename)
"Start a new TeXpresso process using FILENAME as the master TeX file.
When called interactively with a prefix argument, ask for the file.
If FILENAME is nil, use `TeX-master' from AUCTeX or `buffer-file-name'."
(interactive "P")
(unless texpresso-mode
(texpresso-mode 1))
(let ((tm-fn (when (boundp 'TeX-master)
(TeX-master-file t))))
(if (or (consp filename) (numberp filename)
(and (called-interactively-p) (null filename) (null tm-fn)))
;; called interactively with a prefix or default unavailable
(setq filename (read-file-name "TeX root file: " nil tm-fn))
;; called interactively without prefix or from lisp, fall back
(unless filename (setq filename tm-fn)))
(unless filename (error "TeXpresso: no valid TeX root file available.")))
(condition-case err
(texpresso--make-process (or texpresso-binary "texpresso")
(expand-file-name filename))
((file-missing)
(customize-variable 'texpresso-binary)
(message "Cannot launch TeXpresso. Please select the executable file and try again. (error: %S)"
(cdr err)))))
(defun texpresso-signal ()
"Tell TeXpresso processes to check filesystem for changed files.
This is an alternative, more manual, workflow.
During development, it can also be used to hot-reload TeXpresso code."
(interactive)
(call-process "killall" nil 0 nil "-SIGUSR1" "texpresso"))
(defun texpresso-previous-page ()
"Tell TeXpresso to move to previous page."
(interactive)
(texpresso--send 'previous-page))
(defun texpresso-next-page ()
"Tell TeXpresso to move to next page."
(interactive)
(texpresso--send 'next-page))
(provide 'texpresso)
;;; texpresso.el ends here

View File

@@ -2,4 +2,8 @@
# name: provide # name: provide
# key: provide # key: provide
# -- # --
;; -*- lexical-binding: t; -*-
$0
(provide '${1:`(file-name-sans-extension (file-name-nondirectory (buffer-file-name)))`})$0 (provide '${1:`(file-name-sans-extension (file-name-nondirectory (buffer-file-name)))`})$0

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor : Mads D. Kristensen <madsdk@gmail.com>
# key : abstract
# group: sections
# name : \abstract
# --
\begin{abstract}
$0
\end{abstract}

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor : Rasmus Borgsmidt <rasmus@borgsmidt.dk>
# key : align
# group: environments
# name : \begin{align} ... \end{align}
# --
\begin{align}
$0
\end{align}

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor : Rasmus Borgsmidt <rasmus@borgsmidt.dk>
# key : align*
# group: environments
# name : \begin{align*} ... \end{align*}
# --
\begin{align*}
$0
\end{align*}

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor : Peter Urbak <peter@dragonwasrobot.com>
# key : arr
# group: environments
# name : \begin{array} ... \end{array}
# --
\begin{array}{$1}
$0
\end{array}

View File

@@ -1,28 +0,0 @@
# -*- mode: snippet -*-
# contributor: Mads D. Kristensen <madsdk@gmail.com>
# contributor : Song Qiang <tsiangsung@gmail.com>
# key: article
# group: skeleton
# name: \documentclass{article} ...
# --
\documentclass[11pt]{article}
\usepackage{graphicx,amsmath,amssymb,subfigure,url,xspace}
\newcommand{\eg}{e.g.,\xspace}
\newcommand{\bigeg}{E.g.,\xspace}
\newcommand{\etal}{\textit{et~al.\xspace}}
\newcommand{\etc}{etc.\@\xspace}
\newcommand{\ie}{i.e.,\xspace}
\newcommand{\bigie}{I.e.,\xspace}
\title{${1:title}}
\author{${2:Author Name}}
\begin{document}
\maketitle
\bibliographystyle{${3:plain}}
\bibliography{${4:literature.bib}}
\end{document}

View File

@@ -1,37 +0,0 @@
# -*- mode: snippet -*-
# contributor: Claudio Marforio <marforio@gmail.com>
# key: beamer
# group: skeleton
# name: \documentclass{beamer} ...
# --
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{graphicx,subfigure,url}
% example themes
\usetheme{Frankfurt}
\usecolortheme{seahorse}
\usecolortheme{rose}
% put page numbers
% \setbeamertemplate{footline}[frame number]{}
% remove navigation symbols
% \setbeamertemplate{navigation symbols}{}
\title{${1:Presentation Title}}
\author{${2:Author Name}}
\begin{document}
\frame[plain]{\titlepage}
\begin{frame}[plain]{Outline}
\tableofcontents
\end{frame}
\section{${3:Example Section}}
\begin{frame}{${4:Frame Title}}
\end{frame}
\end{document}

View File

@@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# key : beg
# name : \begin{} ... \end{}
# --
\begin{${1:$$(yas-choose-value (mapcar 'car LaTeX-environment-list))}}
$0
\end{$1}

View File

@@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# contributor: Mads D. Kristensen <madsdk@gmail.com>
# key: bib
# group: misc
# name: \bibliography
# --
\bibliographystyle{plain}
\bibliography{$1}$0

View File

@@ -1,7 +1,8 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# contributor: François Garillot <francois@garillot.net> # contributor: François Garillot <francois@garillot.net>
# key: bigop # key: bop
# group: math # group: math
# name: \bigop_{n}^{} # name: \bigop_{n}^{}
# condition: (and (texmathp) 'auto)
# -- # --
\\big${1:$$(yas/choose-value '("oplus" "otimes" "odot" "cup" "cap" "uplus" "sqcup" "vee" "wedge"))}_{$2}^{$3}$0 \\big${1:$$(yas/choose-value '("oplus" "otimes" "odot" "cup" "cap" "uplus" "sqcup" "vee" "wedge"))}_{$2}^{$3}$0

View File

@@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# contributor : Mads D. Kristensen <madsdk@gmail.com>
# key : cha*
# group: sections
# name : \chapter*
# --
\chapter*{${1:name}}
$0

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor : Mads D. Kristensen <madsdk@gmail.com>
# key: enum
# group: environments
# name : \begin{enumerate} ... \end{enumerate}
# --
\begin{enumerate}
\item $0
\end{enumerate}

View File

@@ -1,10 +0,0 @@
# -*- mode: snippet -*-
# contributor: Mads D. Kristensen <madsdk@gmail.com>
# key: eq
# group: math
# name: \begin{equation} ... \end{equation}
# --
\begin{equation}
\label{${1:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-insert))}}
$0
\end{equation}

View File

@@ -1,10 +0,0 @@
# -*- mode: snippet -*-
# contributor: Mads D. Kristensen <madsdk@gmail.com>
# key: eqs
# group: math
# name: \begin{align} ... \end{align}
# --
\begin{${1:$$(yas/choose-value '("align" "align*" "multline" "gather" "subequations"))}}
\label{${2:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-insert))}}
$0
\end{$1}

View File

@@ -1,12 +0,0 @@
# -*- mode: snippet -*-
# contributor : Mads D. Kristensen <madsdk@gmail.com>
# key : fig
# group: environments
# name : \begin{figure} ... \end{figure}
# --
\begin{figure}[htbp]
\centering
$0
\caption{${1:caption}}
\label{${2:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-insert))}}
\end{figure}

View File

@@ -3,5 +3,6 @@
# key: frac # key: frac
# group: math # group: math
# name: \frac{numerator}{denominator} # name: \frac{numerator}{denominator}
# condition: (and (texmathp) 'auto)
# -- # --
\frac{${1:numerator}}{${2:denominator}}$0 \frac{${1:numerator}}{${2:denominator}}$0

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor: Claudio Marforio <marforio@gmail.com>
# key: frame
# group: environments
# name : \begin{frame} ... \end{frame}
# --
\begin{frame}{${1:Frame Title$(capitalize yas-text)}}
$0
\end{frame}

View File

@@ -1,6 +1,6 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# contributor: Song Qiang <tsiangsung@gmail.com> # contributor: Song Qiang <tsiangsung@gmail.com>
# key: integ # key: int
# group: math # group: math
# condition: (and (texmathp) 'auto) # condition: (and (texmathp) 'auto)
# name: Indefinite integral (all) # name: Indefinite integral (all)

View File

@@ -4,4 +4,4 @@
# condition: (and (texmathp) 'auto) # condition: (and (texmathp) 'auto)
# group: math # group: math
# -- # --
^{\text{-}1} ^{-1}

View File

@@ -1,7 +1,7 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# name: limit # name: limit
# key: lim # key: lim
# conditon: (texmathp) # condition: (and (texmathp) 'auto)
# group: math # group: math
# -- # --
\\lim_{${1:n} \\to ${2:\\infty}} $0 \\lim_{${1:n} \\to ${2:\\infty}} $0

View File

@@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# contributor: Mads D. Kristensen <madsdk@gmail.com>
# key: minipage
# group: environments
# name: \begin{minipage}[position][width] ... \end{minipage}
# --
\begin{minipage}[${1:htbp}]{${2:1.0}${3:\linewidth}}
$0
\end{minipage}