Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add esk- prefixes; remove unneeded code.

  • Loading branch information...
commit 3a979e0b6c429ed9ac4438eb5255bc11d17befa3 1 parent 21f8993
@technomancy authored
Showing with 52 additions and 105 deletions.
  1. +36 −80 starter-kit-defuns.el
  2. +16 −25 starter-kit-misc.el
View
116 starter-kit-defuns.el
@@ -7,7 +7,7 @@
;; Network
-(defun view-url ()
+(defun esk-view-url ()
"Open a new buffer containing the contents of URL."
(interactive)
(let* ((default (thing-at-point-url-at-point))
@@ -20,7 +20,7 @@
;; Buffer-related
-(defun ido-imenu ()
+(defun esk-ido-imenu ()
"Update the imenu index and then use ido to select a symbol to navigate to.
Symbols matching the text at point are put first in the completion list."
(interactive)
@@ -69,80 +69,78 @@ Symbols matching the text at point are put first in the completion list."
;; hook value will repeatedly add it since there's no way to ensure
;; that a lambda doesn't already exist in the list.
-(defun local-column-number-mode ()
+(defun esk-local-column-number-mode ()
(make-local-variable 'column-number-mode)
(column-number-mode t))
-(defun local-comment-auto-fill ()
+(defun esk-local-comment-auto-fill ()
(set (make-local-variable 'comment-auto-fill-only-comments) t)
(auto-fill-mode t))
-(defun turn-on-hl-line-mode ()
+(defun esk-turn-on-hl-line-mode ()
(if window-system (hl-line-mode t)))
-(defun turn-on-save-place-mode ()
+(defun esk-turn-on-save-place-mode ()
(setq save-place t))
-(defun turn-on-whitespace ()
+(defun esk-turn-on-whitespace ()
(whitespace-mode t))
-(defun turn-on-paredit ()
+(defun esk-turn-on-paredit ()
(paredit-mode t))
-(defun turn-off-tool-bar ()
- (tool-bar-mode -1))
+(defun esk-pretty-lambdas ()
+ (font-lock-add-keywords
+ nil `(("(?\\(lambda\\>\\)"
+ (0 (progn (compose-region (match-beginning 1) (match-end 1)
+ ,(make-char 'greek-iso8859-7 107))
+ nil))))))
-(defun add-watchwords ()
+(defun esk-add-watchwords ()
(font-lock-add-keywords
nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
1 font-lock-warning-face t))))
-(add-hook 'coding-hook 'local-column-number-mode)
-(add-hook 'coding-hook 'local-comment-auto-fill)
-(add-hook 'coding-hook 'turn-on-hl-line-mode)
-(add-hook 'coding-hook 'turn-on-save-place-mode)
-(add-hook 'coding-hook 'pretty-lambdas)
-(add-hook 'coding-hook 'add-watchwords)
-(add-hook 'coding-hook 'idle-highlight)
+(add-hook 'esk-coding-hook 'esk-local-column-number-mode)
+(add-hook 'esk-coding-hook 'esk-local-comment-auto-fill)
+(add-hook 'esk-coding-hook 'esk-turn-on-hl-line-mode)
+(add-hook 'esk-coding-hook 'esk-turn-on-save-place-mode)
+(add-hook 'esk-coding-hook 'esk-pretty-lambdas)
+(add-hook 'esk-coding-hook 'esk-add-watchwords)
+(add-hook 'esk-coding-hook 'idle-highlight)
-(defun run-coding-hook ()
+(defun esk-run-coding-hook ()
"Enable things that are convenient across all coding buffers."
- (run-hooks 'coding-hook))
+ (run-hooks 'esk-coding-hook))
-(defun untabify-buffer ()
+(defun esk-turn-off-tool-bar ()
+ (tool-bar-mode -1))
+
+(defun esk-untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
-(defun indent-buffer ()
+(defun esk-indent-buffer ()
(interactive)
(indent-region (point-min) (point-max)))
-(defun cleanup-buffer ()
+(defun esk-cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(interactive)
(indent-buffer)
(untabify-buffer)
(delete-trailing-whitespace))
-(defun recentf-ido-find-file ()
+(defun esk-recentf-ido-find-file ()
"Find a recent file using ido."
(interactive)
(let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
(when file
(find-file file))))
-;; Cosmetic
-
-(defun pretty-lambdas ()
- (font-lock-add-keywords
- nil `(("(?\\(lambda\\>\\)"
- (0 (progn (compose-region (match-beginning 1) (match-end 1)
- ,(make-char 'greek-iso8859-7 107))
- nil))))))
-
;; Other
-(defun eval-and-replace ()
+(defun esk-eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
@@ -152,34 +150,13 @@ Symbols matching the text at point are put first in the completion list."
(error (message "Invalid expression")
(insert (current-kill 0)))))
-(defun recompile-init ()
- "Byte-compile all your dotfiles again."
- (interactive)
- (byte-recompile-directory dotfiles-dir 0)
- ;; TODO: remove elpa-to-submit once everything's submitted.
- (byte-recompile-directory (concat dotfiles-dir "elpa-to-submit/") 0))
-
-(defun regen-autoloads (&optional force-regen)
- "Regenerate the autoload definitions file if necessary and load it."
- (interactive "P")
- (let ((autoload-dir (concat dotfiles-dir "/elpa-to-submit"))
- (generated-autoload-file autoload-file))
- (when (or force-regen
- (not (file-exists-p autoload-file))
- (some (lambda (f) (file-newer-than-file-p f autoload-file))
- (directory-files autoload-dir t "\\.el$")))
- (message "Updating autoloads...")
- (let (emacs-lisp-mode-hook)
- (update-directory-autoloads autoload-dir))))
- (load autoload-file))
-
-(defun sudo-edit (&optional arg)
+(defun esk-sudo-edit (&optional arg)
(interactive "p")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
-(defun lorem ()
+(defun esk-lorem ()
"Insert a lorem ipsum."
(interactive)
(insert "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do "
@@ -190,20 +167,12 @@ Symbols matching the text at point are put first in the completion list."
"pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
"culpa qui officia deserunt mollit anim id est laborum."))
-(defun switch-or-start (function buffer)
- "If the buffer is current, bury it, otherwise invoke the function."
- (if (equal (buffer-name (current-buffer)) buffer)
- (bury-buffer)
- (if (get-buffer buffer)
- (switch-to-buffer buffer)
- (funcall function))))
-
-(defun insert-date ()
+(defun esk-insert-date ()
"Insert a time-stamp according to locale's date and time format."
(interactive)
(insert (format-time-string "%c" (current-time))))
-(defun pairing-bot ()
+(defun esk-pairing-bot ()
"If you can't pair program with a human, use this instead."
(interactive)
(message (if (y-or-n-p "Do you have a test for that? ") "Good." "Bad!")))
@@ -214,19 +183,6 @@ Symbols matching the text at point are put first in the completion list."
(list ?\"))
(paredit-mode 1))
-(defun message-point ()
- (interactive)
- (message "%s" (point)))
-
-(defun toggle-fullscreen ()
- (interactive)
- ;; TODO: this only works for X. patches welcome for other OSes.
- (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
- '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
- (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
- '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
-
-
;; A monkeypatch to cause annotate to ignore whitespace
(defun vc-git-annotate-command (file buf &optional rev)
(let ((name (file-relative-name file)))
View
41 starter-kit-misc.el
@@ -8,7 +8,8 @@
(mouse-wheel-mode t)
(blink-cursor-mode -1))
-(add-hook 'before-make-frame-hook 'turn-off-tool-bar)
+;; can't do it at launch or emacsclient won't always honor it
+(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
@@ -23,16 +24,16 @@
color-theme-is-global t
shift-select-mode nil
mouse-yank-at-point t
- require-final-newline t
+ require-final-newline t ; crontabs break without this
truncate-partial-width-windows nil
uniquify-buffer-name-style 'forward
whitespace-style '(trailing lines space-before-tab
indentation space-after-tab)
whitespace-line-column 100
ediff-window-setup-function 'ediff-setup-windows-plain
- oddmuse-directory (concat dotfiles-dir "oddmuse")
+ oddmuse-directory "~/.emacs.d/oddmuse"
xterm-mouse-mode t
- save-place-file (concat dotfiles-dir "places"))
+ save-place-file "~/.emacs.d/places")
(add-to-list 'safe-local-variable-values '(lexical-binding . t))
(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80))
@@ -60,7 +61,7 @@
(show-paren-mode 1)
;; ido-mode is like magic pixie dust!
-(when (> emacs-major-version 21)
+(when (functionp 'ido-mode)
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
@@ -75,32 +76,30 @@
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'turn-on-flyspell)
-(defvar coding-hook nil
+(defvar esk-coding-hook nil
"Hook that gets run on activation of any programming mode.")
(defalias 'yes-or-no-p 'y-or-n-p)
(random t) ;; Seed the random-number generator
;; Hippie expand: at times perhaps too hip
-(delete 'try-expand-line hippie-expand-try-functions-list)
-(delete 'try-expand-list hippie-expand-try-functions-list)
+(setq hippie-expand-try-functions-list
+ (remove 'try-expand-line
+ (remove 'try-expand-list
+ (remove 'try-complete-file-name-partially
+ hippie-expand-try-functions-list))))
-;; Don't clutter up directories with files~
-(setq backup-directory-alist `(("." . ,(expand-file-name
- (concat dotfiles-dir "backups")))))
+;; Add this back in at the end of the list.
+(add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t)
-;; nxhtml stuff
-(setq mumamo-chunk-coloring 'submode-colored
- nxhtml-skip-welcome t
- indent-region-mode t
- rng-nxml-auto-validate-flag nil)
+;; Don't clutter up directories with files~
+(setq backup-directory-alist `(("." . ,(expand-file-name "~/.emacs.d/backups"))))
;; Associate modes with file extensions
(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
(add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
-(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))
@@ -115,9 +114,6 @@
;; Cosmetics
-(set-face-background 'vertical-border "white")
-(set-face-foreground 'vertical-border "white")
-
(eval-after-load 'diff-mode
'(progn
(set-face-foreground 'diff-added "green4")
@@ -128,11 +124,6 @@
(set-face-foreground 'magit-diff-add "green3")
(set-face-foreground 'magit-diff-del "red3")))
-(eval-after-load 'mumamo
- '(eval-after-load 'zenburn
- '(ignore-errors (set-face-background
- 'mumamo-background-chunk-submode "gray22"))))
-
;; Platform-specific stuff
(when (eq system-type 'darwin)
;; Work around a bug on OS X where system-name is FQDN
Please sign in to comment.
Something went wrong with that request. Please try again.