;; completion-auto-help 'visible
completions-max-height 16
completion-auto-wrap t
- completion-at-point-functions '(esy/file-capf)
+ completion-at-point-functions nil
corfu-cycle t
corfu-indexed-start 1
shell-kill-buffer-on-exit t
(defun esy/ttyper ()
(interactive)
+ (require 'eat)
(let ((default-directory "~")
(eat-kill-buffer-on-exit t))
(eat "ttyper -c ~/.config/ttyper/config.toml" t)))
(when (require 'rainbow-delimiters nil t)
(rainbow-delimiters-mode))))
-;;; Extend other standard hooks
+;;; Extend standard text mode hooks
(add-hook 'text-mode-hook #'flyspell-mode)
(add-hook 'text-mode-hook #'completion-preview-mode)
-(add-hook 'text-mode-hook
- (lambda ()
- (add-hook 'completion-at-point-functions #'cape-dict 10 t)))
+;; (add-hook 'text-mode-hook
+;; (lambda ()
+;; (add-hook 'completion-at-point-functions
+;; #'ispell-completion-at-point nil t)))
+;; (keymap-unset text-mode-map "C-M-i" t)
+
;;; Bind some keys
+(keymap-global-set "C-M-i" #'completion-at-point)
(keymap-global-set "C-c c" #'org-capture)
(keymap-global-set "C-c l" #'org-store-link)
(keymap-global-set "C-c a" #'org-agenda)
(with-eval-after-load 'embark
(require 'embark-consult)))
-;;; Set up some global `completion-at-point-functions'
+;;; Define some custom `completion-at-point-functions'
-(defun esy/file-capf ()
+(defun file-capf ()
"File completion at point function."
- (let ((bs (bounds-of-thing-at-point 'filename)))
- (when bs
- (let* ((start (car bs))
- (end (cdr bs)))
- `(,start ,end completion-file-name-table :exclusive no)))))
+ (pcase (bounds-of-thing-at-point 'filename)
+ (`(,beg . ,end)
+ (list beg end #'completion-file-name-table
+ :annotation-function (lambda (_) " File")
+ :exclusive 'no))))
+
+(add-hook 'completion-at-point-functions #'file-capf)
+
+;; (defun ispell-completion-at-point ()
+;; "Word completion function for use in `completion-at-point-functions'."
+;; (pcase (bounds-of-thing-at-point 'word)
+;; (`(,beg . ,end)
+;; (when (and (< beg (point)) (<= (point) end))
+;; (let ((word (buffer-substring-no-properties beg end)))
+;; (require 'ispell)
+;; (list beg end
+;; (completion-table-subvert
+;; (seq-remove
+;; (apply-partially #'string-equal-ignore-case word)
+;; (let ((inhibit-message t)) (ispell-lookup-words word)))
+;; word (downcase word))
+;; :annotation-function (lambda (_) " Dictionary word")
+;; :exclusive 'no))))))
;;; Configure highlighting of the current line via `lin'
(add-hook 'plain-TeX-mode-hook
(lambda () (set (make-local-variable 'TeX-electric-math)
(cons "$" "$"))))
+ (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
+
+(with-eval-after-load 'latex
(add-hook 'LaTeX-mode-hook
(lambda () (set (make-local-variable 'TeX-electric-math)
(cons "\\(" "\\)"))))
- (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
- (add-hook 'LaTeX-mode-hook #'LaTeX-math-mode))
+
+ (add-hook 'LaTeX-mode-hook #'LaTeX-math-mode)
+
+ (defun LaTeX-mark-math ()
+ (interactive)
+ (when-let ((beg (search-backward "\\(" nil t))
+ (end (search-forward "\\)" nil t)))
+ (set-mark beg)))
+
+ (keymap-set LaTeX-mode-map "C-c C-SPC" #'LaTeX-mark-math))
(with-eval-after-load 'elisp-mode
(setq elisp-flymake-byte-compile-load-path (cons "./" load-path)))