Skip to content

Instantly share code, notes, and snippets.

@suhailshergill
suhailshergill / update-emacs-ppa.sh
Created June 29, 2012 14:51 — forked from DamienCassou/update-emacs-ppa.sh
Emacs-snapshot build script for Ubuntu PPA
#!/bin/bash
# Author: Damien Cassou
#
# This is the script I use to build https://launchpad.net/~cassou/+archive/emacs/
# from http://emacs.naquadah.org/.
MAIN_VERSION=20120410
SUB_VERSION=1
@suhailshergill
suhailshergill / gist.el
Created July 16, 2012 02:33
gnutls voodoo for gist.el
(eval-after-load 'gist
'(progn
(defadvice gh-api-run-request (around
su/advice/gist/gh-api-run-request/around/set-tls-program a c pre)
"Set `tls-program' to favor openssl, otherwise url-retrieve-synchronously
hangs"
(let ((tls-program '(
"openssl s_client -connect %h:%p -no_ssl2 -ign_eof"
"gnutls-cli --insecure -p %p %h"
@suhailshergill
suhailshergill / gist.el
Created July 17, 2012 04:25
the heimlich: dirty hack to unchoke gist-region on `%'
(defadvice gist-region (around su/advice/gist/gist-region/around/dirty-hack
a c pre)
"Dirty hack to prevent gist-region from choking on buffers which contain
`%' character"
(save-window-excursion
(let* ((delete-old-versions t)
(dummy "foo")
(beg (ad-get-arg 0))
(end (ad-get-arg 1))
(min-beg-end (min beg end))
@suhailshergill
suhailshergill / magit.el
Created July 18, 2012 02:59
magit: commit labels
(defun su/magit/commit-message-template (&rest discard)
"Have a template for the commit message"
(unless current-prefix-arg ;; ignore commit amends
(let ((tag (format "%s: " (magit-get-current-branch))))
(goto-char (point-min))
(unless (search-forward tag nil t)
(insert tag))
(goto-char (point-max))
)))
(add-hook 'magit-log-edit-mode-hook 'su/magit/commit-message-template)
@suhailshergill
suhailshergill / magit.el
Created July 18, 2012 03:00
magit: buffer label
(defun su/magit/format-magit-status-buffer-name ()
"Append the value of current branch to `magit-status' buffer"
(let ((magit-status-buffer-name (buffer-name (magit-find-status-buffer)))
(branch-name (magit-get-current-branch))
(buffer-name-regex "^\\(\\*.*\\*\\)\\(.*\\)?$"))
(dolist (buffer-name `(,magit-status-buffer-name ,magit-log-buffer-name))
(string-match buffer-name-regex buffer-name)
(ignore-errors (with-current-buffer buffer-name
(rename-buffer (replace-match (concat "\\1" (format
@suhailshergill
suhailshergill / scratch.hs
Created July 21, 2012 16:12
haskell-src-exts eg: convert indented code into semi-colon layout
import Language.Haskell.Exts
main = putStr . prettyPrintWithMode (defaultMode {layout = PPSemiColon})
. fromParseResult . parseFileContents =<< getContents
{-# OPTIONS -Wall -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-matches #-}
{-# LANGUAGE TemplateHaskell, ViewPatterns #-}
-- | Helpful template haskell utilities. Mostly a re-write of the
-- subset of Justin Bailey's haskelldb-th that was needed, as an
-- educational exercise.
module Database.HaskellDB.TH where
import Control.Monad
;; erc-sasl.el -- handle SASL PLAIN authentication
;; Copyright (C) 2012 Joseph Gay
;; Author: Joseph Gay <[email protected]>
;; Keywords: comm
;; This file is NOT part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
(setq x-select-enable-clipboard t)
;; [[https://hugoheden.wordpress.com/2009/03/08/copypaste-with-emacs-in-terminal/][source]]
;; If emacs is run in a terminal, the clipboard- functions have no
;; effect. Instead, we use of xsel, see
;; http://www.vergenet.net/~conrad/software/xsel/ -- "a command-line
;; program for getting and setting the contents of the X selection"
(unless window-system
(when (getenv "DISPLAY")
;; Callback for when user cuts
@suhailshergill
suhailshergill / .Xresources.txt
Created July 31, 2012 17:59
urxvt horizontal font spacing fix
URxvt*letterSpace : -2