Skip to content

Instantly share code, notes, and snippets.

@spacebat
spacebat / condition-case+.el
Last active March 28, 2018 22:27
An extension to the syntax of condition-case to support else and finally cases
;; This gist licensed GPLv3
(cl-defmacro condition-case+ (var form (&rest handlers/else/finally))
"Like condition-case, only if the last handlers have matching
forms of :else or :finally. In that case, the body of an :else
handler is evaluated if no exception was thrown. The body of
a :finally clause is evaluated always as the last thing before
the form is exited whether normally or not. If both :else
and :finally appear among the handlers, :else must be second last
and :finally must be last."
(cl-flet ((maybe-split-last (symbol handlers)
@ejmr
ejmr / git-branch-show-description.sh
Last active May 29, 2022 07:41
Show the Description for the Current Branch
#!/bin/bash
#
# You can use `git branch --edit-description` to write a description
# for a branch, but Git provides no simple command to display that
# description. The "easiest" way to see it is via `git config --get
# branch.BRANCH_NAME.description`.
#
# This script automates that process and is meant to be used as
# a Git alias to provide a shorter command for showing the
# description of the current branch.
@jplindstrom
jplindstrom / evil_defun_textobject.el
Created September 13, 2012 13:41
A "defun" Emacs Evil text object
;; Define a "defun" Emacs Evil text object
(defun jpl-line-before-end-of-defun (&optional arg)
(interactive)
(end-of-defun arg)
(previous-line))
(defun jpl-line-after-beginning-of-defun (&optional arg)
(interactive)
(beginning-of-defun arg)
(next-line))