(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
- (when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (call-process "git" nil buffer t "clone"
("install-info" "--dir=dir" "eat.info"))))
(elpaca (elfeed
:pre-build (("pandoc" "-o" "elfeed.texi" "README.md"))))
-(elpaca embark)
(elpaca emms)
(elpaca htmlize)
-(elpaca keycast)
(elpaca kubernetes)
(elpaca (oauth2
:repo "git://git.sv.gnu.org/emacs/elpa"
"--eval" "(setq org-babel-confirm-evaluate-answer-no t)"
"-f" "org-texinfo-export-to-texinfo"))))
(elpaca (openai :repo "https://git.sr.ht/~eshel/openai.el"))
-(elpaca package-lint)
(elpaca paredit)
(elpaca rainbow-delimiters)
(elpaca rainbow-mode)
;; follow links to version-controlled files without confirming
vc-follow-symlinks t
;; jump from .c to .h files with find-sibling-file
- find-sibling-rules '(("\\([^/]+\\)\\.c\\'" "\\1.h"))
+ find-sibling-rules '(("\\([^/]+\\)\\.c\\'" "\\1.h")
+ ("nextstep/Emacs.app/Contents/Resources/\\(.*\\)\\'"
+ "\\1\\'"))
;; use ISO format for calendar dates
calendar-date-style 'iso
;; maintain legibility of rendered text in HTML mails
kill-do-not-save-duplicates t
show-trailing-whitespace t
read-extended-command-predicate #'command-completion-default-include-p
- completions-format 'one-column
+ completions-format 'horizontal
+ completions-group t
completions-detailed t
completion-auto-select nil
completion-styles '(substring partial-completion)
- completion-category-overrides '((buffer (styles substring))
- (file (styles basic
- partial-completion
- substring)))
+ completion-category-overrides
+ '((buffer (styles substring))
+ (file (styles basic partial-completion substring))
+ (project-file (styles basic partial-completion substring))
+ (recent-file (styles basic partial-completion substring))
+ (command (display-sort-function . minibuffer-sort-by-history)
+ (cycle-sort-function . minibuffer-sort-by-history)))
completion-show-help nil
;; completions-header-format nil
;; completion-auto-help 'visible
shell-kill-buffer-on-exit t
compilation-scroll-output t
display-time-default-load-average nil
- ;; allow disabling confirming before compilation via local variables
+ ;; allow disabling confirming before compilation via local variables foo bar baz
safe-local-variable-values '((compilation-read-command . nil))
- xref-search-program 'ripgrep
+ xref-search-program 'ripgrep
;; include CWD in shell command prompts
shell-command-prompt-show-cwd t
sqlformat-command 'pgformatter
LaTeX-electric-left-right-brace t
;; Read remote man pages
Man-support-remote-systems t
- confirm-nonexistent-file-or-buffer t
- extended-command-dim-hyphens t)
+ ;; confirm-nonexistent-file-or-buffer nil
+ extended-command-dim-hyphens t
+ read-buffer-completion-ignore-case t)
(setq-default indent-tabs-mode nil)
(keymap-global-set "M-o" #'previous-buffer)
(keymap-global-set "M-O" #'next-buffer)
(keymap-global-set "C-," #'delete-backward-char)
-(keymap-global-set "C-." #'embark-act)
(keymap-global-set "C-;" #'avy-goto-char-timer)
(keymap-global-set "C-s-f" #'toggle-frame-fullscreen)
(keymap-global-set "C-s-l" #'esy/pulse-line)
(keymap-global-set "M-]" #'up-list)
(keymap-set ctl-x-map "C-b" #'ibuffer)
+(keymap-set ctl-x-map "k" #'esy/kill-buffers)
(keymap-set search-map "r" #'rg)
(keymap-set search-map "l" #'rg-literal)
(dolist (key-binding '(("C-p" . minibuffer-previous-completion)
("C-n" . minibuffer-next-completion)
- ("M-j" . minibuffer-force-complete-and-exit)
- ("SPC" . nil)))
+ ("M-j" . minibuffer-force-complete-and-exit)))
(keymap-set minibuffer-local-completion-map
(car key-binding)
(cdr key-binding)))
completions-auto-update-mode
global-corfu-mode
mode-face-global-mode
+ which-function-mode
))
(funcall mode))
("\\.rs\\'" . rust-ts-mode)
("\\.go\\'" . go-ts-mode)
("\\.plt?\\'" . prolog-mode)
- ("\\.tex\\'" . TeX-latex-mode)))
+ ("\\.tex\\'" . LaTeX-mode)))
(push cell auto-mode-alist))
;;; Configure Help
;;; Configure TeX
+(with-eval-after-load 'tex-mode
+ (require 'tex))
+
(with-eval-after-load 'tex
(setopt TeX-modes '(tex-mode plain-tex-mode latex-mode doctex-mode))
(add-hook 'plain-TeX-mode-hook
(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)))
+ (setq elisp-flymake-byte-compile-load-path (cons "./" load-path))
+ (keymap-set emacs-lisp-mode-map "C-c C-t" #'trace-function))
(dolist (mm '((go-ts-mode . go-ts-mode-hook)
(typescript-ts-mode . typescript-ts-mode-hook)
(insert (buffer-name buf))
(exit-minibuffer)))
+;; (defun read-buffer-isearch (buffers string)
+;; (interactive
+;; (let ((s (minibuffer-contents-no-properties)))
+;; (list (remove (current-buffer)
+;; (seq-filter
+;; (lambda (b)
+;; (and (buffer-match-p '(not (or (major-mode . messages-buffer-mode)
+;; (major-mode . fundamental-mode)))
+;; b)
+;; (with-current-buffer b
+;; (save-excursion
+;; (goto-char (point-min))
+;; (search-forward s nil t)))))
+;; (buffer-list)))
+;; s))
+;; minibuffer-mode)
+;; (unless buffers
+;; (user-error "No buffers contain `%s'" string))
+;; (multi-isearch-buffers buffers)
+;; (isearch-process-search-string string string))
+
(defvar-keymap read-buffer-to-switch-mode-map
:doc "Keymap for `read-buffer-to-switch-mode'."
"M-m" #'read-buffer-to-switch-bookmark
- "M-r" #'read-buffer-to-switch-recentf)
+ "M-r" #'read-buffer-to-switch-recentf
+ ;; "C-s" #'read-buffer-isearch
+ )
(define-minor-mode read-buffer-to-switch-mode
"Minor mode for reading a buffer name in the minibuffer."
(let ((read-buffer-function nil))
(read-buffer prompt def require-match predicate))))
+(defun esy/kill-buffers (buffers)
+ (interactive
+ (list (let ((def (buffer-name)))
+ (completing-read-multiple
+ (format-prompt "Kill buffers" def)
+ #'completion-buffer-name-table nil t nil
+ 'buffer-name-history def))))
+ (when buffers
+ (let ((num (length buffers)))
+ (while (and buffers (kill-buffer (car buffers)))
+ (setq buffers (cdr buffers)))
+ (let* ((spared (length buffers))
+ (killed (- num spared)))
+ (message "Killed %d buffer%s%s."
+ killed (ngettext "" "s" killed)
+ (if buffers (format ", %s spared" spared) ""))))))
+
(setq read-buffer-function #'esy/read-buffer)
(load-file (expand-file-name "admin/cherry.el" source-directory))
+(defvar-local minibuffer-hint-timer nil)
+
+(defvar minibuffer-hint-idle-time 1)
+
+(defun minibuffer-hint ()
+ (when-let ((beg-end (minibuffer--completion-boundaries))
+ (beg (car beg-end)) (end (cdr beg-end))
+ (all (let ((completion--input completion--input)
+ (completion-lazy-hilit t))
+ (completion-all-sorted-completions beg end))))
+ (let (minibuffer-message-timeout)
+ ;; TODO show number of completions and/or use different face when exact.
+ (minibuffer-message (propertize (car all) 'face 'completions-common-part)))))
+
+(defun minibuffer-hint-cancel-timer ()
+ (when (timerp minibuffer-hint-timer)
+ (cancel-timer minibuffer-hint-timer)
+ (setq minibuffer-hint-timer nil)))
+
+(defun minibuffer-hint-fn (buffer)
+ (lambda ()
+ (when (equal (current-buffer) buffer)
+ (minibuffer-hint))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer (minibuffer-hint-cancel-timer)))))
+
+(defun minibuffer-hint-start-timer ()
+ (unless (timerp minibuffer-hint-timer)
+ (setq minibuffer-hint-timer
+ (run-with-idle-timer minibuffer-hint-idle-time
+ nil (minibuffer-hint-fn (current-buffer))))))
+
+(define-minor-mode minibuffer-hint-mode
+ "Foo."
+ :lighter nil
+ (if minibuffer-hint-mode
+ (progn
+ (add-hook 'post-self-insert-hook #'minibuffer-hint-start-timer nil t)
+ (add-hook 'minibuffer-exit-hook #'minibuffer-hint-cancel-timer nil t))
+ (remove-hook 'post-self-insert-hook #'minibuffer-hint-start-timer t)
+ (minibuffer-hint-cancel-timer)))
+
+(add-hook 'minibuffer-setup-hook (lambda ()
+ (when minibuffer-completion-table
+ (minibuffer-hint-mode))))
+
(provide 'init)
;;; init.el ends here