aboutsummaryrefslogtreecommitdiffstats
path: root/oni-core.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-12-13 07:14:06 -0800
committerGravatar Tom Willemse2022-12-13 07:14:06 -0800
commitd0420ae5e32293a8b3960e3630deed006dad05ff (patch)
tree40f2ae8cd1c519f138468c0a3e157c4d8f96888a /oni-core.el
parent5f7a6b8dddbbff8f948c744226f1bae1c7076db5 (diff)
downloademacs-config-d0420ae5e32293a8b3960e3630deed006dad05ff.tar.gz
emacs-config-d0420ae5e32293a8b3960e3630deed006dad05ff.zip
[oni-core] Add related-files[1] to consult-buffer[2]
[1]: https://github.com/DamienCassou/related-files [2]: https://github.com/minad/consult
Diffstat (limited to 'oni-core.el')
-rw-r--r--oni-core.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/oni-core.el b/oni-core.el
index 0f55ee9..9ba6943 100644
--- a/oni-core.el
+++ b/oni-core.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2022.1213.071035
+;; Version: 2022.1213.071336
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr)
;; This program is free software; you can redistribute it and/or modify
@@ -407,6 +407,28 @@ _s_: String list"
(global-set-key (kbd "M-g M") '("Jump to a mark anywhere" . consult-global-mark))
(global-set-key [remap imenu] 'consult-imenu)
+(defun oni-core-related-files ()
+ "Return a list of files related to the current buffer."
+ (let* ((jumpers related-files-jumpers)
+ (current-place (buffer-file-name)))
+ (cond ((not jumpers)
+ (user-error "No jumpers. Consider configuring `related-files-jumpers'"))
+ ((not current-place)
+ (user-error "Related-Files only works from file-based buffers"))
+ (t
+ (related-files--collect-existing-places jumpers current-place)))))
+
+(defvar oni-core-related-places-source
+ '(:name "Related File"
+ :category file
+ :items oni-related-files
+ :enabled buffer-file-name
+ :action find-file))
+
+(with-eval-after-load 'consult
+ (with-eval-after-load 'related-files
+ (add-to-list 'consult-buffer-sources 'oni-related-places-source)))
+
;;; Embark
(global-set-key (kbd "C-.") 'embark-act)