From a2657993bad828af6743c68931a0e848bfcdec53 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 21 Nov 2021 23:57:41 -0600 Subject: I DECLARE BANKRUPTCY ... 8 Didn't think to do this till pretty .. written, so here we are. --- lisp/acdw-consult.el | 93 ---------------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 lisp/acdw-consult.el (limited to 'lisp/acdw-consult.el') diff --git a/lisp/acdw-consult.el b/lisp/acdw-consult.el deleted file mode 100644 index 84a7fea..0000000 --- a/lisp/acdw-consult.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; acdw-consult.el -*- lexical-binding: t; coding: utf-8-unix -*- - -;; Customization for consult. - -(require 'consult) - -(defun acdw-consult/sensible-grep (&optional arg) - "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' -if ripgrep is installed, otherwise `consult-grep'." - (interactive "P") - (call-interactively - (cond ((executable-find "rg") - (if (fboundp 'affe-grep) - #'affe-grep - #'consult-ripgrep)) - ((string-equal (vc-backend buffer-file-name) "Git") - #'consult-git-grep) - (t #'consult-grep)))) - -(defun acdw-consult/sensible-find (&optional arg) - "Peform `consult-locate' if locate is installed, otehrwise `consult-find'." - (interactive "P") - (call-interactively - (cond ((executable-find "locate") - #'consult-locate) - ((fboundp 'affe-find) - (when (executable-find "fd") - (setq affe-find-command "fd -HI -t f")) - #'affe-find) - (t #'consult-find)))) - -;; Orderless Regexp Compiler! -- from Consult Wiki -(defun consult--orderless-regexp-compiler (input type) - (setq input (orderless-pattern-compiler input)) - (cons - (mapcar (lambda (r) (consult--convert-regexp r type)) input) - (lambda (str) (orderless--highlight input str)))) - -(defun acdw-consult/complete-in-region (&rest args) - (apply (if vertico-mode - #'consult-completion-in-region - #'completion--in-region) - args)) - -(defmacro consult-history-to-modes (map-hook-alist) - (let (defuns) - (dolist (map-hook map-hook-alist) - (let ((map-name (symbol-name (car map-hook))) - (key-defs `(progn (define-key - ,(car map-hook) - (kbd "M-r") - (function consult-history)) - (define-key ,(car map-hook) - (kbd "M-s") nil)))) - (push (if (cdr map-hook) - `(add-hook ',(cdr map-hook) - (defun - ,(intern (concat map-name - "@consult-history-bind")) - nil - ,(concat - "Bind `consult-history' to M-r in " - map-name ".\n" - "Defined by `consult-history-to-modes'.") - ,key-defs)) - key-defs) - defuns))) - `(progn ,@ (nreverse defuns)))) - -;;; Circe buffers source - -(require 'cl-lib) -(autoload 'circe-server-buffers "circe") -(autoload 'circe-server-chat-buffers "circe") - -(defun circe-all-buffers () - (cl-loop with servers = (circe-server-buffers) - for server in servers - collect server - nconc - (with-current-buffer server - (cl-loop for buf in (circe-server-chat-buffers) - collect buf)))) - -(defvar circe-buffer-source - `(:name "circe" - :hidden t - :narrow ?c - :category buffer - :state ,#'consult--buffer-state - :items ,(lambda () (mapcar #'buffer-name (circe-all-buffers))))) - -(provide 'acdw-consult) -- cgit 1.4.1-21-gabe81