Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 783fac85c4
Fetching contributors…

Cannot retrieve contributors at this time

123 lines (102 sloc) 3.883 kb
;;; lob-defuns.el
(defmacro lob/nevar-fail (primary failover)
"Runs primary code. If primary code fails, then executes
failover code."
`(condition-case exc
(message (format "Caught exception: [%s]" exc))
(defun lob/sudo (&optional path)
(concat "/sudo:root@localhost:" (or path buffer-file-name))))
(defun lob/unfill-paragraph ()
"The opposite of fill-paragraph. Takes a multi-line paragraph
and makes it into a single line of text. Thanks: Stefan Monnier
<foo at>"
(let ((fill-column (point-max)))
(fill-paragraph nil)))
(defun lob/regen-autoloads (&optional force)
"Regenerate the autoload definitions file if necessary and load it."
(interactive "P")
(when (or force (not (file-exists-p autoload-file)))
(message "updating autoloads...")
(let ((generated-autoload-file autoload-file))
(eval (cons 'update-directory-autoloads lob/vendor-dirs))))
(load autoload-file))
(defun lob/reload ()
"Save the .emacs buffer if needed, then reload .emacs."
(let ((dot-emacs (concat dotfiles-dir "/init.el")))
(and (get-file-buffer dot-emacs)
(save-buffer (get-file-buffer dot-emacs)))
(load-file dot-emacs))
(message "Re-initialized!"))
(defun lob/recompile ()
"Recompiles everything so emacs loads wicked fast"
(lob/regen-autoloads t)
(byte-recompile-directory dotfiles-dir 0)
(byte-recompile-directory (concat dotfiles-dir "/vendor") 0))
(defun lob/cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(indent-region (point-min) (point-max))
(untabify (point-min) (point-max))
(defun lob/recentf-ido-find-file ()
"Find a recent file using ido."
(let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
(when file
(find-file file))))
(defun lob/run-coding-hook ()
"Enable things that are convenient across all coding buffers."
(run-hooks 'lob/coding-hook))
(defun lob/pretty-lambdas ()
nil `(("(?\\(lambda\\>\\)"
(0 (progn (compose-region (match-beginning 1) (match-end 1)
,(make-char 'greek-iso8859-7 107))
(defun lob/local-comment-auto-fill ()
(set (make-local-variable 'comment-auto-fill-only-comments) t)
(auto-fill-mode t))
(defun lob/turn-on-paredit ()
(paredit-mode t))
(defun lob/turn-on-company ()
(company-mode t))
(defun lob/turn-off-tool-bar ()
(tool-bar-mode -1))
(define-key isearch-mode-map (kbd "C-o")
(lambda () (interactive)
(let ((case-fold-search isearch-case-fold-search))
(occur (if isearch-regexp isearch-string
(regexp-quote isearch-string))))))
(defun lob/face-at-point ()
"Tells me who is responsible for ugly color under cursor"
(message "%S: %s" (face-at-point)
(face-documentation (face-at-point))))
(defun lob/paredit-close-parenthesis ()
"How do you expect me to rebalance my parens if you won't let
me type omg!"
(lob/nevar-fail (paredit-close-parenthesis)
(insert ")")))
(defun lob/paredit-close-parenthesis-and-newline ()
"How do you expect me to rebalance my parens if you won't let
me type omg!"
(lob/nevar-fail (paredit-close-parenthesis-and-newline)
(insert ")")))
(defun lob/remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))))
(provide 'lob-defuns)
Jump to Line
Something went wrong with that request. Please try again.