diff --git a/lisp/init-better-default.el b/lisp/init-better-default.el index 68698e4..5d25fd9 100644 --- a/lisp/init-better-default.el +++ b/lisp/init-better-default.el @@ -71,7 +71,6 @@ (setq ring-bell-function 'ignore) (setq undo-limit 80000000 - auto-save-default t password-cache-expiry nil) (setq-default delete-by-moving-to-trash t @@ -129,7 +128,7 @@ (lambda (button) (helpful-variable (button-get button 'apropos-symbol)))))))) -(setq auto-save-file-name-transforms - `((".*" ,(concat user-emacs-directory "auto-save/") t))) +;; (setq auto-save-file-name-transforms +;; `((".*" ,(concat user-emacs-directory "auto-save/") t))) (provide 'init-better-default) diff --git a/lisp/init-edit.el b/lisp/init-edit.el index 2dcd276..1019b42 100644 --- a/lisp/init-edit.el +++ b/lisp/init-edit.el @@ -1,39 +1,37 @@ ;; -*- lexical-binding: t -*- ;; (use-package smartparens -;; :demand t -;; :hook (prog-mode text-mode markdown-mode) +;; :hook (elpaca-after-init . smartparens-global-mode) +;; ;; :hook (elpaca-after-init . smartparens-global-strict-mode) +;; :init (sp-use-paredit-bindings) ;; :config -;; (require 'smartparens-config)) +;; ;; Autopair quotes more conservatively; if I'm next to a word/before another +;; ;; quote, I don't want to open a new pair or it would unbalance them. +;; (let ((unless-list '(sp-point-before-word-p +;; sp-point-after-word-p +;; sp-point-before-same-p))) +;; (sp-pair "'" nil :unless unless-list) +;; (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)) + +;; ;; Don't do square-bracket space-expansion where it doesn't make sense to +;; (sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode) +;; "[" nil :post-handlers '(:rem ("| " "SPC"))) +;; ) -(use-package smartparens - :hook (elpaca-after-init . smartparens-global-mode) - ;; :hook (elpaca-after-init . smartparens-global-strict-mode) - :init (sp-use-paredit-bindings) - :config - ;; Autopair quotes more conservatively; if I'm next to a word/before another - ;; quote, I don't want to open a new pair or it would unbalance them. - (let ((unless-list '(sp-point-before-word-p - sp-point-after-word-p - sp-point-before-same-p))) - (sp-pair "'" nil :unless unless-list) - (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)) - - ;; Don't do square-bracket space-expansion where it doesn't make sense to - (sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode) - "[" nil :post-handlers '(:rem ("| " "SPC"))) - ) +(use-package electric-pair + :ensure nil + :hook elpaca-after-init) ;; Hungry deletion (use-package hungry-delete @@ -58,6 +56,7 @@ :test 'equal)) (setq yas-triggers-in-field t) + (setq yas-key-syntaxes '("w" "w_" "w_." "^ " yas-try-key-from-whitespace)) ;; Function that tries to autoexpand YaSnippets ;; The double quoting is NOT a typo! diff --git a/lisp/init-org.el b/lisp/init-org.el index 170eb71..5683d7b 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -183,6 +183,10 @@ the element after the #+HEADER: tag." ("BUG" error bold) ("XXX" font-lock-constant-face bold)))) +(add-hook 'org-mode-hook + (lambda () + (yas-activate-extra-mode 'LaTeX-mode))) + (use-package org-latex-preview :ensure nil :hook (org-mode . org-latex-preview-mode) @@ -283,17 +287,7 @@ the element after the #+HEADER: tag." ("C-M-y" . org-download-clipboard)) :config (setq-default org-download-heading-lvl 1) - (defconst org-download-root-directory "./attachments/") - (defun set-org-download-directory () - (create-directory-if-not-exists org-download-root-directory) - (make-local-variable 'org-download--dir) - (setq org-download-image-dir (concat org-download-root-directory (buffer-name))) - (setq org-download-heading-lvl nil) - (setq org-attach-directory org-download-image-dir) - (message "set-org-download-directory") - ) - - (add-hook 'org-mode-hook #'set-org-download-directory) + (defconst org-download-image-dir "./attachments/") (setq-default org-download-method 'directory)) (use-package valign diff --git a/lisp/init-workspace.el b/lisp/init-workspace.el index 5348d49..d88e160 100644 --- a/lisp/init-workspace.el +++ b/lisp/init-workspace.el @@ -37,7 +37,7 @@ ;; sessions (tabspaces-session t) ;; (tabspaces-session-auto-restore t) - (tabspaces-keymap-prefix "C-c TAB") + (tabspaces-keymap-prefix "C-c o") (tab-bar-new-tab-choice "default") (with-eval-after-load 'consult diff --git a/snippets/latex-mode/^{} b/snippets/latex-mode/^{} new file mode 100644 index 0000000..31aca0a --- /dev/null +++ b/snippets/latex-mode/^{} @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: ^{} +# key: kj +# condition: (and (texmathp) 'auto) +# group: math +# -- +^{$0} \ No newline at end of file diff --git a/snippets/latex-mode/_{} b/snippets/latex-mode/_{} new file mode 100644 index 0000000..8c0ae07 --- /dev/null +++ b/snippets/latex-mode/_{} @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: _{} +# key: jo +# condition: (and (texmathp) 'auto) +# group: math +# -- +_{$0} \ No newline at end of file