Skip to content

Instantly share code, notes, and snippets.

(defun write-revive-file ()
(interactive)
(let ((file "~/.emacsresume"))
(with-temp-buffer
(insert (prin1-to-string (current-window-configuration-printable)))
(when (file-writable-p file)
(write-region (point-min)
(point-max)
file)))))
(defun point-to-middle ()
"Put cursor on middle line of window"
(interactive)
(let ((win-height (if (> (count-screen-lines) (window-height))
(window-height)
(count-screen-lines))))
(move-to-window-line (/ win-height 2))))
;; gist.el --- Emacs integration for gist.github.com
;; Author: Christian Neukirchen <purl.org/net/chneukirchen>
;; Maintainer: Chris Wanstrath <chris@ozmm.org>
;; Contributors:
;; Will Farrington <wcfarrington@gmail.com>
;; Michael Ivey
;; Phil Hagelberg
;; Dan McKinley
;; Version: 0.5
// Keysnail function that pulls up your entire session history
// Based on tips from: http://malblue.tumblr.com/post/349001250/tips-japanese-keysnail-github
ext.add("list-session-history", function () {
const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
var tabHistory = [];
var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"].getService(Components.interfaces.nsIFaviconService);
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsINavHistoryService);
(defun twittering-mode-exit ()
"twittering-mode を終了する。"
(interactive)
(when (y-or-n-p "Really exit twittering-mode? ")
(if twittering-timer
(twittering-stop))
(dolist (buf (twittering-get-active-buffer-list))
(if (get-buffer buf)
(kill-buffer buf))))
(garbage-collect))
(require 'gist)
(setq gist-use-curl t)
@baron
baron / twspell
Created November 26, 2010 05:39
spell check for twittering-mode tweets
(defun twittering-spell-check ()
(when (eq major-mode 'twittering-edit-mode)
(progn (ispell-minor-mode)
(flyspell-mode))))
(add-hook 'text-mode-hook 'twittering-spell-check)
@baron
baron / emacs ui intrusions
Created November 25, 2010 03:43
keep the ui from getting in your face (looks like a dedicated terminal window)
;; just use y or n for confirmations
(defalias 'yes-or-no-p 'y-or-n-p)
;; don't use popups of any kind
(setq use-dialog-box nil)
(defalias 'message-box 'message)
;; just the frame thanks
(tool-bar-mode -1)
;; gist.el --- Emacs integration for gist.github.com
;; Author: Christian Neukirchen <purl.org/net/chneukirchen>
;; Maintainer: Chris Wanstrath <chris@ozmm.org>
;; Contributors:
;; Will Farrington <wcfarrington@gmail.com>
;; Michael Ivey
;; Phil Hagelberg
;; Dan McKinley
;; Version: 0.5
;;;_ , my-remove-duplicates
; This little fellow is great. It removes duplicates from region i.e.
; transforms "foo baz foo bar baz" into "foo baz bar".
(defun my-remove-duplicates (start end)
(interactive "r")
(save-excursion
(goto-char start)
(narrow-to-region start end)