• Stars
    star
    265
  • Rank 149,854 (Top 4 %)
  • Language
    Emacs Lisp
  • Created about 9 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

Hunt down errors in elisp files.

hunter.png The Bug Hunter https://travis-ci.org/Malabarba/elisp-bug-hunter.svg?branch=master

Automatically debug and bisect your init (.emacs) file!

The Bug Hunter is an Emacs library that finds the source of an error or unexpected behavior inside an elisp configuration file (typically init.el or .emacs).

hunter-screencast.gif

Usage Examples

Automated error hunting

If your Emacs init file signals an error during startup, but you don’t know why, simply issue

M-x bug-hunter-init-file RET e

and The Bug Hunter will find it for you.

Interactive hunt

If Emacs starts up without errors but something is not working as it should, invoke the same command, but choose the interactive option:

M-x bug-hunter-init-file RET i

The Bug Hunter will start a separate Emacs instance several times, and then it will ask you each time whether that instance presented the problem you have. After doing this about 5–12 times, you’ll be given the results.

Assertion hunt

The Bug Hunter can also find your issue based on an assertion. Essentially, if you can write a code snippet that returns non-nil when it detects the issue, just provide this snippet as the assertion and the Bug Hunter will do the rest.

For example, let’s say there’s something in your init file that’s loading the cl library, and you don’t want that. You know you’re not loading it yourself, but how can you figure out which external package is responsible for this outrage?

M-x bug-hunter-init-file RET a (featurep 'cl) RET

That’s it! You’ll be given a nice buffer reporting the results:

cl-example.png

  • Are you getting obscure errors when trying to open “.tex” files?
    • Don’t despair! Just use (and (find-file "dummy.tex") nil) as the assertion.
  • Did ox-html stop working due to some arcane misconfiguration?
    • Just write an assertion that does an export and checks the result.
  • Does some random command suddenly bind itself to C-j and you can’t figure out why?
    • (eq (key-binding "\n") 'unwanted-command) is the assertion for you!

Finally, you can also use bug-hunter-file to hunt in other files.

Installation

The Bug Hunter is available from GNU Elpa to all Emacs versions since 24.1. To install, just issue

M-x package-install RET bug-hunter

init.org and other literate-style configs

Some people (me included) like to organize their init files by writting it in org-mode instead of Emacs-Lisp. This usually involves adding something like this to init.el,

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Maybe some code up here ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'org)
(org-babel-tangle-file "~/.emacs.d/org-init.org"
                       "~/.emacs.d/org-init.el")
(load "~/.emacs.d/org-init.el")

At first, this makes the Bug-Hunter essentially useless, for it will do the hunting in init.el instead of the much more extensive org-init.el. The name of the second file (org-init.el) will vary, but the point is the same. But fear not! There’s a simple solution:

  1. If you have any code above the call to org-babel-tangle-file, copy that to the top of org-init.el (or whatever is the name of your tangled file). This includes that (require 'org) over there.
  2. Invoke M-x bug-hunter-file (instead of bug-hunter-init-file). It will ask you which file to debug, and you need to point it to your tangled output file org-init.el.

More Repositories

1

smart-mode-line

A powerful and beautiful mode-line for Emacs.
Emacs Lisp
881
star
2

aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
Emacs Lisp
827
star
3

beacon

A light that follows your cursor around so you don't lose it!
Emacs Lisp
641
star
4

paradox

Project for modernizing Emacs' Package Menu. With package ratings, usage statistics, customizability, and more.
Emacs Lisp
559
star
5

emacs-google-this

A set of emacs functions and bindings to google under point.
Emacs Lisp
259
star
6

names

A Namespace implementation for Emacs-Lisp
Emacs Lisp
244
star
7

Nameless

Less is more. Hide package namespace in your emacs-lisp code
Emacs Lisp
133
star
8

fancy-narrow

Emacs package to immitate narrow-to-region with more eye-candy
Emacs Lisp
129
star
9

rich-minority

Emacs package for hiding and/or highlighting the list of minor-modes in the mode-line.
Emacs Lisp
106
star
10

camcorder.el

Tool for capturing screencasts directly from Emacs.
Emacs Lisp
106
star
11

spinner.el

Emacs mode-line spinner for operations in progress
Emacs Lisp
102
star
12

latex-extra

A series of usability improvements for Emacs latex-mode.
Emacs Lisp
69
star
13

speed-of-thought-lisp

Write elisp at the speed of thought. Emacs minor mode with abbrevs and keybinds.
Emacs Lisp
69
star
14

org-agenda-property

Display org properties in the agenda buffer.
Emacs Lisp
63
star
15

gmail-mode

A major-mode for editing gmail messages using markdown syntax (in emacs).
Emacs Lisp
57
star
16

lazy-map-clojure

Create Clojure maps whose values are only calculated when accessed, either from data or from java objects.
Clojure
48
star
17

ham-mode

Html As Markdown. Transparently edit an html file using markdown.
Emacs Lisp
42
star
18

control-pianobar

Pair of scripts that interact with pianobar entirely through notification bubbles and hotkeys. No terminal necessary.
Shell
34
star
19

ox-jekyll-subtree

Extension to ox-jexkyll for better export of subtrees
Emacs Lisp
30
star
20

audio-notes-mode

Emacs mode to play audio notes synced from somewhere else.
Emacs Lisp
26
star
21

speed-of-thought-clojure

Write clojure at the speed of thought.
Emacs Lisp
23
star
22

emacs-online-documentation

A project meant to keep an updated online documentation of ALL emacs' built-in functions and variables.
Emacs Lisp
22
star
23

validate.el

Schema validator for Emacs-lisp
Emacs Lisp
22
star
24

alpine-osd-notify

Script to run alpine mail client using a notify-osd notification system.
Shell
17
star
25

conkeror-minor-mode

Mode for editing conkeror javascript files.
Emacs Lisp
17
star
26

html-to-markdown

HTML to Markdown converter written in emacs-lisp.
Emacs Lisp
16
star
27

emacs-archive-tracker

A script in emacs-lisp to track some statistics about emacs package archives.
Emacs Lisp
14
star
28

org-bibtex

Simple example of combining a .bib file with org-mode.
8
star
29

comment-or-uncomment-sexp

Emacs-lisp command for inteligently commenting and commenting the sexp under point.
Emacs Lisp
8
star
30

emacs-documentation-android

Emacs Documentation android app. Search emacs variables/functions and view their documentations on android.
Java
5
star
31

HugeSQLiteCursor

A version of SQLiteCursor which remains fast even when the cursor is arbitrarily large.
Java
4
star
32

EndlessParentheses

Endless Parentheses blog. See http://endlessparentheses.com
HTML
4
star
33

lisp-assistant

A set of functions, variables, and snippets to assist in developing lisp code.
Emacs Lisp
3
star
34

threads-list-mode

tabulated-list-mode specialized at viewing threads
Emacs Lisp
3
star
35

Keystone

Play Hearthstone with the keyboard.
AutoHotkey
2
star
36

Zumi

Rails WebApp for apartment listings
Ruby
2
star
37

hdh

Ruby gem for rendering plain data into HTML
Ruby
2
star
38

Zumi-front

Frontend for https://github.com/Malabarba/Zumi
Vue
1
star
39

display-keys-emacs

Popup that displays keys pressed for certain commands
Emacs Lisp
1
star
40

greek-unicode-insert

Simple keymap to insert Unicode Greek characters in emacs.
Emacs Lisp
1
star