• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created almost 4 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ’ affe.el - Asynchronous Fuzzy Finder for Emacs

affe.el - Asynchronous Fuzzy Finder for Emacs

GNU Emacs MELPA MELPA Stable

This package provides an asynchronous fuzzy finder similar to the fzf command-line fuzzy finder, written in pure Elisp. A producer process is started in the background, e.g., find or grep. The output produced by this process is filtered by an external asynchronous Emacs process. The Emacs UI always stays responsive since the work is off-loaded to other processes. The results are presented in the minibuffer using Consult, which allows to quickly select from the available items. Note that Affe is an experimental package and a demonstrator of asynchronous processing outside of Emacs in a separate process. Generally I recommend to use consult-grep or consult-ripgrep, since these commands will perform better for large projects. The Consult package itself is more mature.

Installation and Configuration

The package is available on MELPA and can be installed using the Emacs package manager. If files should not be automatically previewed, a manual preview key should be set for affe-grep.

(use-package affe
  :config
  ;; Manual preview key for `affe-grep'
  (consult-customize affe-grep :preview-key "M-."))

The default regular expression transformation of Consult is limited. It is recommended to configure Orderless as affe-regexp-compiler in Consult.

(defun affe-orderless-regexp-compiler (input _type _ignorecase)
  (setq input (orderless-pattern-compiler input))
  (cons input (apply-partially #'orderless--highlight input)))
(setq affe-regexp-compiler #'affe-orderless-regexp-compiler)

Affe requires the rg (โ€œripgrepโ€) command line program to be available. The producer processes can be customized by adjusting the variables affe-find-command and affe-grep-command.

Available commands

  • affe-grep: Filters the content of all text files in the current directory, similar to consult-grep.
  • affe-find: Filters the file paths of all files in the current directory, similar to consult-find.

Related packages

Affe depends on Consult and works best with the Vertico and the Mct completion UIs.

  • Consult: Useful search and navigation commands (Dependency of Affe).
  • Marginalia: File annotations in the minibuffer.
  • Embark: Minibuffer actions on files.
  • Orderless: Advanced completion style, can be plugged together with Affe.
  • Vertico or Mct: Vertical completion systems

Details

The Affe frontend transforms the input string to a list of regular expressions by calling the affe-regexp-function. The regular expressions are passed to the Affe backend via the emacsclient protocol. The backend controls a producer process, which generates lines of text. The lines are filtered using the regular expressions submitted by the frontend. For performance reasons, all-completions is used for the filtering. The backend returns only a limited amount of matching candidates, hopefully the most plausible ones. The frontend calls the affe-highlight-function on the returned matches, to highlight the input pattern.

Affe uses a more primitive matching technique than fzf, which uses the Smith-Waterman algorithm. Affe does not perform any ranking or sorting; it matches the lines in the order returned by the producer process against a list of regular expressions. On the upside, this allows plugging Affe together with the Orderless completion style, which can give a consistent fuzzy filtering experience across all Emacs commands, including synchronous and asynchronous commands.

As possible enhancement of Affe, one could implement alphabetical and sorting by length in the backend. By using a bucket sorting technique the sorting complexity will stay sufficiently linear such that the performance impact should be acceptable. However implementing a scoring-based sorting is probably not feasible since this requires heavier computations in Elisp. But maybe nativecomp Emacs is a game changer here?

Alternatives

More Repositories

1

org-modern

๐Ÿฆ„ Modern Org Style
Emacs Lisp
1,344
star
2

vertico

๐Ÿ’ซ vertico.el - VERTical Interactive COmpletion
Emacs Lisp
1,344
star
3

consult

๐Ÿ” consult.el - Consulting completing-read
Emacs Lisp
1,088
star
4

corfu

๐Ÿ๏ธ corfu.el - COmpletion in Region FUnction
Emacs Lisp
1,000
star
5

marginalia

๐Ÿ“œ marginalia.el - Marginalia in the minibuffer
Emacs Lisp
762
star
6

cape

๐Ÿฆธcape.el - Completion At Point Extensions
Emacs Lisp
533
star
7

osm

๐ŸŒ osm.el - OpenStreetMap viewer for Emacs
Emacs Lisp
496
star
8

tempel

๐Ÿ›๏ธ TempEl - Simple templates for Emacs
Emacs Lisp
464
star
9

jinx

๐Ÿช„ Enchanted Spell Checker
Emacs Lisp
328
star
10

lmdb

Ruby bindings for the OpenLDAP's Lightning Memory-Mapped Database (LMDB)
C
105
star
11

goggles

goggles.el - Pulse modified region
Emacs Lisp
92
star
12

bibsync

BibSync is a tool to synchronize scientific papers and bibtex bibliography files
Ruby
60
star
13

paripari

Fast parser combinator library for Haskell with two strategies (Fast acceptor and slower reporter with decent error messages)
Haskell
56
star
14

hasklig-mode

hasklig-mode.el - Hasklig ligatures for emacs
Emacs Lisp
39
star
15

gridslides

LaTeX package to create free form slides with blocks placed on a grid
TeX
38
star
16

3delta

Host software especially suited for delta 3d printers
Tcl
36
star
17

pacgem

Gem installer for Arch Linux
Ruby
34
star
18

bookmark-view

bookmark-view.el - Use bookmarks to persist the current view
Emacs Lisp
34
star
19

osm2shp

Convert large OpenStreetMap files to shapefiles (Uses sqlite3 db as temporary storage)
C++
29
star
20

consult-flycheck

Consult integration for Flycheck
Emacs Lisp
28
star
21

chasm

Java Bytecode Assembler and Disassembler which uses S-expressions
Java
26
star
22

tab-bookmark

Persist Emacs Tabs as Bookmarks
Emacs Lisp
25
star
23

unit

Unit support for numbers
Ruby
24
star
24

mini-popup

Emacs Lisp
22
star
25

gitrb

Unmaintained: Simple git implementation in ruby similar to grit, based on git_store
Ruby
21
star
26

recursion-indicator

Recursion indicator for the mode-line
Emacs Lisp
20
star
27

henk

pure type system language - henk 2000 ported to megaparsec, pretty
Haskell
20
star
28

persist

Minimal binary serialization library with focus on performance
Haskell
17
star
29

rack-embed

Rack middleware which embeds small images as base64 data-url in css/html files if the browser supports it
Ruby
16
star
30

polyp

Emacs Lisp
12
star
31

writer-cps-mtl

Stricter drop in replacements for WriterT and RWST
Haskell
11
star
32

intro

Safe and minimal Haskell Prelude
Haskell
10
star
33

writer-cps-transformers

Compatibility package for old transformers: Stricter drop in replacements for WriterT and RWST
Haskell
10
star
34

wl-pprint-annotated

Wadler/Leijen pretty printer with annotations and API conforming to modern Haskell
Haskell
7
star
35

uchronia

uchronia.el - Rewrite the minibuffer history
Emacs Lisp
7
star
36

tasty-stats

Collect statistics of your Tasty testsuite
Haskell
7
star
37

tasty-auto

Deprecated: Auto discovery for the Tasty test framework, use tasty-discover instead
Haskell
6
star
38

quickcheck-special

Edge cases and special values for QuickCheck Arbitrary instances
Haskell
5
star
39

thinkpad-tools

Unmaintained: Some scripts used on my Thinkpad X60t
Python
5
star
40

typohero

TypoHero enhances your typography
Ruby
5
star
41

diascope

Unmaintained: S5: A Simple Standards-Based Slide Show System. Alternative implementation using jquery
JavaScript
5
star
42

colorful-monoids

colorful-monoids: Styled console text output using ANSI escape sequences
Haskell
4
star
43

9mount

Unmaintained fork of http://sqweek.dnsdojo.org/hg/9mount
C
4
star
44

omega

Haskell
4
star
45

distcc

distcc scripts
4
star
46

evaluator

Mathematical expression evaluator for infix notation. Supports variables and functions.
Ruby
3
star
47

xosdbar

show osd on X11, similar to osd_cat but with update support
C
3
star
48

wl-pprint-console

Wadler/Leijen pretty printer with annotations and support for colorful console output
Haskell
3
star
49

andromeda.hs

This is a direct port of Andrej Bauer's dependent type theory implementation from OCaml to Haskell
Haskell
3
star
50

mapgen

XCSoar Map Generator
Python
3
star
51

vle

Verilog Experiments
Verilog
3
star
52

console-style

Styled console text output using ANSI escape sequences
Haskell
3
star
53

analyzer

Some tools for physics calculations
C++
3
star
54

doxygen2adoc

Doxygen import for Asciidoc using XSLT and the Doxygen XML output
XSLT
3
star
55

ihs

Interpolated Haskell
LLVM
3
star
56

bigint-unboxed

JavaScript big integers with support for ES6 BigInt and unboxed small integers
JavaScript
2
star
57

special-values

Haskell
2
star
58

hashtable

Hashtable in C with open addressing and specialization via macros
C
2
star
59

i3-config

qubes i3 configuration
Shell
2
star
60

TaskList

Mediawiki plugin which implements a task tracker
PHP
2
star
61

implant

Linux from scratch package manager using symlinks - similar to GoboLinux (2008)
Shell
2
star
62

hexns

Nameserver for IPv6 which resolves Hexspeak subdomains
C
2
star
63

emacs-theme

Emacs Lisp
2
star
64

arch-packages

My arch pkbuilds
Shell
2
star
65

temple-mustache

Temple-based implementation of Mustache (Just a finger exercises to test temple)
Ruby
2
star
66

encode-string

String encoding and decoding in Haskell
Haskell
2
star
67

writer-cps-monads-tf

Stricter drop in replacements for WriterT and RWST
Haskell
2
star
68

slim-examples

http://slim-lang.com/
Ruby
2
star
69

imaginator

Unmaintained: Image generator for LaTex/graphviz source
Ruby
1
star
70

safe-convert

Safe type conversions in Haskell
Haskell
1
star
71

echoxul

echo2 java web app + xul (2006)
Java
1
star
72

persist-state

Haskell
1
star
73

strict-base

Strict versions of some standard Haskell data types
Haskell
1
star
74

writer-cps-full

Stricter drop in replacements for WriterT and RWST
Haskell
1
star
75

writer-cps-exceptions

Control.Monad.Catch instances for CPS WriterT and RWST monad transformers
Haskell
1
star
76

grouptsp

Travelling salesman (2004)
Java
1
star
77

pasty

easy to deploy, single file, under 50 line, command line pastebin
PHP
1
star
78

arduino-pi-gefrickel

Arduino/Rasberry Pi Gefrickel - Arduino/Rasberry Pi Fiddling
JavaScript
1
star
79

intro-prelude

Reexport Intro as Prelude
Haskell
1
star
80

os-experiment

simple i386 os with console and multithreading (2005)
C
1
star