Skip to content

Instantly share code, notes, and snippets.

(cl-defun treemacs--find-keybind (func &optional (pad 8))
"Find the keybind for FUNC in treemacs.
Return of cons of the key formatted for inclusion in the hydra string, including
a minimum width for alignment, and the key itself for the hydra heads.
Prefer evil keybinds, otherwise pick the first result."
(-if-let (keys (where-is-internal func))
(let ((key
(key-description
(-if-let (evil-keys (--first (eq 'treemacs-state (aref it 0)) keys))
(--map (aref evil-keys it) (number-sequence 1 (- (length evil-keys) 1)))
(defun treemacs--get-buffer-groups ()
"Get the list of buffers, grouped by their major mode."
(->> (buffer-list)
(--reject (eq ?\ (aref (buffer-name it) 0)))
(--group-by (buffer-local-value 'major-mode it))))
(defun treemacs--visit-buffer (_)
"Switch to buffer saved in node at point."
(let* ((btn (treemacs-current-button))
(buf (button-get btn :buffer)))
[package]
name = "mod-test"
version = "0.1.0"
[lib]
crate-type = ["cdylib"]
[dependencies]
libc = "0.2"
emacs = "0.5.1"
;;; treelib.el --- TODO -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(defsubst treelib-current-button ()
"Get the button in the current line, if any."
(if (get-text-property (point-at-bol) 'button)
(button-at (point-at-bol))
;; -*- lexical-binding: t -*-
(require 'dash)
(require 's)
(require 'company)
(defun rofi-filter (proc msg)
(backward-delete-char (length company-prefix))
(insert (s-trim msg)))