about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el13
-rw-r--r--lisp/+consult.el2
-rw-r--r--lisp/+eww.el2
-rw-r--r--lisp/+init.el17
-rw-r--r--lisp/+orderless.el60
5 files changed, 84 insertions, 10 deletions
diff --git a/init.el b/init.el index 36c2bed..134b81a 100644 --- a/init.el +++ b/init.el
@@ -920,7 +920,7 @@
920 (comint-mode-map . comint-mode-hook) 920 (comint-mode-map . comint-mode-hook)
921 (sly-mrepl-mode-map . sly-mrepl-hook))) 921 (sly-mrepl-mode-map . sly-mrepl-hook)))
922 (with-eval-after-load 'orderless 922 (with-eval-after-load 'orderless
923 (:option consult--regexp-compiler 'consult--orderless-regexp-compiler)))) 923 (:option consult--regexp-compiler #'consult--orderless-regexp-compiler))))
924 924
925(setup (:straight consult-dir) 925(setup (:straight consult-dir)
926 (:+key "C-x C-d" #'consult-dir) 926 (:+key "C-x C-d" #'consult-dir)
@@ -1278,7 +1278,16 @@ See also `crux-reopen-as-root-mode'."
1278 "C-e" #'mwim-end)) 1278 "C-e" #'mwim-end))
1279 1279
1280(setup (:straight orderless) 1280(setup (:straight orderless)
1281 (:option completion-styles '(orderless))) 1281 (:also-load +orderless)
1282 (:option completion-styles '(substring orderless basic)
1283 completion-category-defaults nil
1284 completion-category-overrides
1285 '((file (styles partial-completion))
1286 (command (styles +orderless-with-initialism))
1287 (variable (styles +orderless-with-initialism))
1288 (symbol (styles +orderless-with-initialism)))
1289 orderless-component-separator #'orderless-escapable-split-on-space
1290 orderless-style-dispatchers '(+orderless-dispatch)))
1282 1291
1283(setup (:straight org-appear) 1292(setup (:straight org-appear)
1284 (:option org-appear-autoemphasis t 1293 (:option org-appear-autoemphasis t
diff --git a/lisp/+consult.el b/lisp/+consult.el index 7b6a20f..0f5bf45 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el
@@ -5,7 +5,7 @@
5(defun +consult-project-root () 5(defun +consult-project-root ()
6 "Return either the current project, or the VC root, of current file." 6 "Return either the current project, or the VC root, of current file."
7 (if (and (functionp 'project-current) 7 (if (and (functionp 'project-current)
8 (project-current)) 8 (project-current))
9 (car (project-roots (project-current))) 9 (car (project-roots (project-current)))
10 (vc-root-dir))) 10 (vc-root-dir)))
11 11
diff --git a/lisp/+eww.el b/lisp/+eww.el index aad602f..8d53571 100644 --- a/lisp/+eww.el +++ b/lisp/+eww.el
@@ -65,7 +65,7 @@
65 65
66(defun +eww-bookmark-setup () 66(defun +eww-bookmark-setup ()
67 "Setup eww bookmark integration." 67 "Setup eww bookmark integration."
68 (setq-local bookmark-make-record-function #'eww-bookmark--make)) 68 (setq-local bookmark-make-record-function #'+eww-bookmark--make))
69 69
70(provide '+eww) 70(provide '+eww)
71;;; +eww.el ends here 71;;; +eww.el ends here
diff --git a/lisp/+init.el b/lisp/+init.el index c1f3cb5..a4c3b5a 100644 --- a/lisp/+init.el +++ b/lisp/+init.el
@@ -80,12 +80,17 @@ are sorted lexigraphically."
80(defun +init-add-setup-to-imenu () 80(defun +init-add-setup-to-imenu ()
81 "Recognize `setup' forms in `imenu'." 81 "Recognize `setup' forms in `imenu'."
82 ;; `imenu-generic-expression' automatically becomes buffer-local when set 82 ;; `imenu-generic-expression' automatically becomes buffer-local when set
83 (setf (alist-get "Setup" imenu-generic-expression nil nil 'string-equal) 83 (setf (alist-get "Setup" imenu-generic-expression nil nil #'equal)
84 (list 84 (list
85 (rx (: bol (* space) 85 (rx (: "(setup" (+ space)
86 "(setup" (+ space) 86 (group (? "(") (* nonl))))
87 (group (? "(") (* nonl)))) 87 1))
88 1))) 88 (when (boundp 'consult-imenu-config)
89 (setf (alist-get ?s
90 (plist-get
91 (alist-get 'emacs-lisp-mode consult-imenu-config)
92 :types))
93 '("Setup"))))
89 94
90;;; Major mode 95;;; Major mode
91 96
diff --git a/lisp/+orderless.el b/lisp/+orderless.el new file mode 100644 index 0000000..b2f53b0 --- /dev/null +++ b/lisp/+orderless.el
@@ -0,0 +1,60 @@
1;;; +orderless.el --- Mostly from minad -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; See https://github.com/minad/consult/wiki#minads-orderless-configuration
6
7;;; Code:
8
9(require 'orderless)
10
11;;; Dispataching
12
13(defvar +orderless-dispatch-alist '((?% . char-fold-to-regexp)
14 (?! . orderless-without-literal)
15 (?` . orderless-initialism)
16 (?= . orderless-literal)
17 (?~ . orderless-flex))
18 "Charcters to dispatch styles on orderless segments.")
19
20(defun +orderless-dispatch (pattern index _total)
21 "Dispatch orderless segments of a search string.
22Dispatchers are taken from `+orderless-dispatch-alist', and added
23to the following defaults:
24
25- regexp$ :: matches REGEXP at the end of the pattern.
26- .ext :: matches EXT (at end of pattern)
27
28Dispatch characters can be added at the beginning or ending of a
29segment to make that segment match accordingly."
30 (cond
31 ;; Ensure that $ works with Consult commands, which add disambiguation
32 ;; suffixes
33 ((string-suffix-p "$" pattern)
34 (cons 'orderless-regexp
35 (concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
36 ;; File extensions
37 ((and
38 ;; Completing filename or eshell
39 (or minibuffer-completing-file-name
40 (derived-mode-p 'eshell-mode))
41 ;; File extension
42 (string-match-p "\\`\\.." pattern))
43 (cons orderless-regexp
44 (concat "\\." (substring pattern 1) "[\x100000-\x10FFFD]*$")))
45 ;; Ignore single !
46 ((string= "!" pattern) `(orderless-literal . ""))
47 ;; Prefix and suffix
48 ((if-let (x (assq (aref pattern 0) +orderless-dispatch-alist))
49 (cons (cdr x) (substring pattern 1))
50 (when-let (x (assq (aref pattern (1- (length pattern)))
51 +orderless-dispatch-alist))
52 (cons (cdr x) (substring pattern 0 -1)))))))
53
54(orderless-define-completion-style +orderless-with-initialism
55 (orderless-matching-styles '(orderless-initialism
56 orderless-literal
57 orderless-regexp)))
58
59(provide '+orderless)
60;;; +orderless.el ends here