-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconsult-web-buffer.el
44 lines (34 loc) · 1.62 KB
/
consult-web-buffer.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;;; consult-web-buffer.el --- Consulting Buffers -*- lexical-binding: t -*-
;; Copyright (C) 2024 Armin Darvish
;; Author: Armin Darvish
;; Maintainer: Armin Darvish
;; Created: 2024
;; Version: 0.1
;; Package-Requires: ((emacs "28.1") (consult "1.1"))
;; Homepage: https://github.com/armindarvish/consult-web
;; Keywords: convenience
;;; Commentary:
;;; Code:
(require 'consult-web)
(defun consult-web--consult-buffer-preview (cand)
"Preview function for `consult-web--buffer'."
(if cand
(let* ((title (get-text-property 0 :title cand)))
(when-let ((buff (get-buffer title)))
(consult--buffer-action buff))
)))
(cl-loop for source in consult-buffer-sources
do (if (symbolp source) (consult-web--make-source-from-consult-source source
:category 'consult-web
:on-preview #'consult-web--consult-buffer-preview
:on-return #'identity
:on-callback #'consult--buffer-action
:search-history 'consult-web--search-history
:selection-history 'consult-web--selection-history
:dynamic 'both
:preview-key 'consult-preview-key
)))
;;; provide `consult-web-buffer' module
(provide 'consult-web-buffer)
(add-to-list 'consult-web-sources-modules-to-load 'consult-web-buffer)
;;; consult-web-buffer.el ends here