diff options
author | Case Duckworth | 2022-01-14 21:03:36 -0600 |
---|---|---|
committer | Case Duckworth | 2022-01-14 21:03:36 -0600 |
commit | 0495456fb904bf291a71ff87d59a5dda5d0c298d (patch) | |
tree | 3bf15e38022280362091cd699ce8da21d2a2a27a /lisp | |
parent | Merge branch 'main' of https://tildegit.org/acdw/emacs (diff) | |
download | emacs-0495456fb904bf291a71ff87d59a5dda5d0c298d.tar.gz emacs-0495456fb904bf291a71ff87d59a5dda5d0c298d.zip |
Ch ch ch changes
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/+consult.el | 2 | ||||
-rw-r--r-- | lisp/+eww.el | 2 | ||||
-rw-r--r-- | lisp/+init.el | 17 | ||||
-rw-r--r-- | lisp/+orderless.el | 60 |
4 files changed, 73 insertions, 8 deletions
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. | ||
22 | Dispatchers are taken from `+orderless-dispatch-alist', and added | ||
23 | to the following defaults: | ||
24 | |||
25 | - regexp$ :: matches REGEXP at the end of the pattern. | ||
26 | - .ext :: matches EXT (at end of pattern) | ||
27 | |||
28 | Dispatch characters can be added at the beginning or ending of a | ||
29 | segment 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 | ||