From: Eshel Yaron Date: Thu, 23 Nov 2023 14:54:56 +0000 (+0100) Subject: Update Emacs configuration X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=832e14510bb529bf7ecad1e85ca1c0e854a939fb;p=dotfiles.git Update Emacs configuration --- diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 3fee3e0..039b894 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -417,7 +417,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t)) ;; 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 @@ -547,6 +547,7 @@ DEADLINE: %(format-time-string \"<%Y-%m-%d %H:%M>\" (org-read-date t t)) (defun esy/ttyper () (interactive) + (require 'eat) (let ((default-directory "~") (eat-kill-buffer-on-exit t)) (eat "ttyper -c ~/.config/ttyper/config.toml" t))) @@ -872,16 +873,20 @@ Interactively, POINT is point and KILL is the prefix argument." (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) @@ -1147,15 +1152,33 @@ as the initial input for completion, and return that directory." (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' @@ -1376,11 +1399,22 @@ as the initial input for completion, and return that directory." (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))) diff --git a/.emacs.d/lisp/esy-comm.el b/.emacs.d/lisp/esy-comm.el index 79947c3..5707e4f 100644 --- a/.emacs.d/lisp/esy-comm.el +++ b/.emacs.d/lisp/esy-comm.el @@ -95,6 +95,7 @@ ;; BBDB bbdb-phone-style nil + bbdb-complete-mail nil bbdb-complete-mail-allow-cycling t bbdb-completion-display-record nil