This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun repro-filter (fun beg end delete) | |
(let ((string (funcall fun beg end delete))) | |
(with-temp-buffer | |
(insert string) | |
string))) | |
(with-current-buffer (get-buffer-create "*Bug*") | |
(set (make-local-variable 'filter-buffer-substring-functions) | |
'(repro-filter)) | |
(insert "Hello, World!\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
font-lock-support-mode is a variable defined in `font-lock.el'. | |
Its value is jit-lock-mode | |
Documentation: | |
Support mode for Font Lock mode. | |
Support modes speed up Font Lock mode by being choosy about when fontification | |
occurs. The default support mode, Just-in-time Lock mode (symbol | |
`jit-lock-mode'), is recommended. | |
Other, older support modes are Fast Lock mode (symbol `fast-lock-mode') and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(when (load "ess" t t) | |
(define-key ess-mode-map (kbd "_") 'pyro/underscore-or-assignment) | |
(defun pyro/underscore-or-assignment () | |
(interactive) | |
(if (eq last-command 'pyro/underscore-or-assignment) | |
(progn | |
(backward-char) | |
(insert "->")) | |
(insert "_")))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun circe-command-AKICK (args) | |
(circe-command-MSG "ChanServ" | |
(format "AKICK %s ADD %s" circe-chat-target args))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat $PYTHONSTARTUP | |
try: | |
# this add completion to python interpreter | |
import readline | |
import rlcompleter | |
# see readline man page for this | |
readline.parse_and_bind("set show-all-if-ambiguous on") | |
readline.parse_and_bind("tab: complete") | |
except: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(when (file-directory-p "~/.emacs.d/site-lisp") | |
(add-to-list 'load-path "~/.emacs.d/site-lisp") | |
(dolist (dirname (directory-files "~/.emacs.d/site-lisp" t "^[^.]")) | |
(when (file-directory-p dirname) | |
(add-to-list 'load-path dirname)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdateOrCreateMixin(object): | |
"""Mixin-Class for models.Manager subclasses. | |
Provide the update_or_create method from Django 1.7 in earlier | |
Djangos. | |
""" | |
def update_or_create(self, defaults=None, **kwargs): | |
"""A convenience method for updating an object with the given kwargs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun lyk/close-buffer-on-process-exit () | |
(set-process-sentinel (get-buffer-process (current-buffer)) | |
(lambda (proc change) | |
(when (and (string-match "finished" change) | |
(process-buffer proc)) | |
(kill-buffer (process-buffer proc)))))) | |
(add-hook 'comint-exec-hook 'lyk/close-buffer-on-process-exit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Save to foo.dot, run dot -Tpng foo.dot -o foo.png, done | |
(defun eldot () | |
(interactive) | |
(let ((nodes (make-hash-table :test #'eq)) | |
(expr nil)) | |
(catch 'done | |
(save-excursion | |
(goto-char (point-min)) | |
(while t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-set-key (kbd "C-c u") 'unfill-paragraph) | |
(defun unfill-paragraph () | |
(interactive) | |
(let ((fill-column (point-max))) | |
(fill-paragraph nil))) |