summaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-10 14:34:27 +0100
committerDavid Robillard <d@drobilla.net>2017-12-10 14:39:53 +0100
commitd2da4e5d2866083b8159f57eb04da01662b0dc17 (patch)
tree14fd5bf57fbaedccd00d1490639319c40b163638 /emacs/.emacs.d
parentba6f1ea48ccc54f0afdd5eafee65ad6bf9b502c6 (diff)
downloaddotfiles-d2da4e5d2866083b8159f57eb04da01662b0dc17.tar.gz
dotfiles-d2da4e5d2866083b8159f57eb04da01662b0dc17.tar.bz2
dotfiles-d2da4e5d2866083b8159f57eb04da01662b0dc17.zip
Make dotfiles stow compatible
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r--emacs/.emacs.d/drobillized-theme.el235
-rw-r--r--emacs/.emacs.d/init.el428
-rw-r--r--emacs/.emacs.d/site-lisp/n3-mode.el44
-rw-r--r--emacs/.emacs.d/site-lisp/ppindent.el138
-rw-r--r--emacs/.emacs.d/site-lisp/ttl-mode.el209
5 files changed, 1054 insertions, 0 deletions
diff --git a/emacs/.emacs.d/drobillized-theme.el b/emacs/.emacs.d/drobillized-theme.el
new file mode 100644
index 0000000..1a5b240
--- /dev/null
+++ b/emacs/.emacs.d/drobillized-theme.el
@@ -0,0 +1,235 @@
+(deftheme drobillized
+ "Subdued theme based on Solarized palette.")
+
+(defgroup drobillized nil
+ "Drobillized theme options.
+Reload the theme after changing anything in this group."
+ :group 'faces)
+
+;; Background (dark)
+(defcustom base03 "#002B36" "Dark base 3" :group 'drobillized :type '(color))
+(defcustom base02 "#073642" "Dark base 2" :group 'drobillized :type '(color))
+
+;; Content
+(defcustom base01 "#586E75" "Dark content 1" :group 'drobillized :type '(color))
+(defcustom base00 "#657B83" "Dark content 0" :group 'drobillized :type '(color))
+(defcustom base0 "#839496" "Light content 0" :group 'drobillized :type '(color))
+(defcustom base1 "#93A1A1" "Light content 1" :group 'drobillized :type '(color))
+
+;; Background (light)
+(defcustom base2 "#EEE8D5" "Light base 2" :group 'drobillized :type '(color))
+(defcustom base3 "#FDF6E3" "Light base 3" :group 'drobillized :type '(color))
+
+;; Basic colors
+(defcustom yellow "#B58900" "Yellow" :group 'drobillized :type '(color))
+(defcustom orange "#CB4B16" "Orange" :group 'drobillized :type '(color))
+(defcustom red "#DC322F" "Red" :group 'drobillized :type '(color))
+(defcustom magenta "#D33682" "Magenta" :group 'drobillized :type '(color))
+(defcustom violet "#6C71C4" "Violet" :group 'drobillized :type '(color))
+(defcustom blue "#268BD2" "Blue" :group 'drobillized :type '(color))
+(defcustom cyan "#2AA198" "Cyan" :group 'drobillized :type '(color))
+(defcustom green "#859900" "Green" :group 'drobillized :type '(color))
+
+;; Darker colors
+(defcustom yellow-d "#7B6000" "Dark yellow" :group 'drobillized :type '(color))
+(defcustom orange-d "#8B2C02" "Dark orange" :group 'drobillized :type '(color))
+(defcustom red-d "#990A1B" "Dark red" :group 'drobillized :type '(color))
+(defcustom magenta-d "#93115C" "Dark magenta" :group 'drobillized :type '(color))
+(defcustom violet-d "#3F4D91" "Dark violet" :group 'drobillized :type '(color))
+(defcustom blue-d "#00629D" "Dark blue" :group 'drobillized :type '(color))
+(defcustom cyan-d "#00736F" "Dark cyan" :group 'drobillized :type '(color))
+(defcustom green-d "#546E00" "Dark green" :group 'drobillized :type '(color))
+
+;; Lighter colors
+(defcustom yellow-l "#DEB542" "Light yellow" :group 'drobillized :type '(color))
+(defcustom orange-l "#F2804F" "Light orange" :group 'drobillized :type '(color))
+(defcustom red-l "#FF6E64" "Light red" :group 'drobillized :type '(color))
+(defcustom magenta-l "#F771AC" "Light magenta" :group 'drobillized :type '(color))
+(defcustom violet-l "#9EA0E5" "Light violet" :group 'drobillized :type '(color))
+(defcustom blue-l "#69B7F0" "Light blue" :group 'drobillized :type '(color))
+(defcustom cyan-l "#69CABF" "Light cyan" :group 'drobillized :type '(color))
+(defcustom green-l "#B4C342" "Light green" :group 'drobillized :type '(color))
+
+(custom-theme-set-variables
+ 'drobillized
+ )
+
+(custom-theme-set-faces
+ 'drobillized
+ `(bold ((t (:weight bold))))
+ `(compilation-column-number ((t (:foreground "grey40"))))
+ `(cursor ((t (:background "grey80"))))
+ `(custom-button ((t (:background "#2D3232" :foreground "#DDD" :box (:line-width 2 :style released-button)))))
+ `(custom-state ((t (:foreground ,green))))
+ `(default ((t (:inherit nil :stipple nil :background "#141414" :foreground "#C3D1D1" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
+ `(diff-added ((t (:foreground ,green))))
+ `(diff-file-header ((((class color) (min-colors 88) (background dark)) (:weight bold))))
+ `(diff-header ((((class color) (min-colors 88) (background dark)) (:foreground ,violet))))
+ `(diff-refine-added ((t (:inherit diff-refine-change :foreground "green"))))
+ `(diff-refine-change ((t (:background "grey15"))) t)
+ `(diff-refine-changed ((t (:background "grey15"))))
+ `(diff-refine-removed ((t (:inherit diff-refine-change :foreground "red"))))
+ `(diff-removed ((t (:foreground ,red-d))))
+ `(dired-directory ((t (:foreground ,blue))))
+ `(diredp-compressed-file-suffix ((t (:foreground "grey50"))))
+ `(diredp-date-time ((t (:foreground ,violet))))
+ `(diredp-dir-heading ((t (:foreground ,green))))
+ `(diredp-dir-name ((t (:foreground ,blue))))
+ `(diredp-dir-priv ((t (:foreground ,blue-l))))
+ `(diredp-exec-priv ((t (:foreground ,green))))
+ `(diredp-file-name ((t (:inherit default))))
+ `(diredp-file-suffix ((t (:foreground "grey70"))))
+ `(diredp-ignored-file-name ((t (:foreground ,base01))))
+ `(diredp-no-priv ((t nil)))
+ `(diredp-number ((t (:foreground "grey50"))))
+ `(diredp-rare-priv ((t (:foreground ,cyan-l))))
+ `(diredp-read-priv ((t (:foreground "grey70"))))
+ `(diredp-symlink ((t (:foreground ,cyan))))
+ `(diredp-write-priv ((t (:foreground "grey90"))))
+ `(erc-action-face ((t (:slant italic))))
+ `(erc-current-nick-face ((t (:foreground ,cyan :weight bold))))
+ `(erc-input-face ((t (:foreground ,orange))))
+ `(erc-my-nick-face ((t (:foreground ,orange :weight bold))))
+ `(erc-nick-default-face ((t (:foreground "#A3B1B1"))))
+ `(erc-notice-face ((t (:foreground ,violet))))
+ `(erc-prompt-face ((t (:foreground "white" :weight bold))))
+ `(erc-timestamp-face ((t (:foreground ,green))))
+ `(error ((t (:foreground ,red :weight bold))))
+ `(escape-glyph ((((background dark)) (:foreground "cyan"))))
+ `(eshell-prompt ((t (:foreground ,green :weight bold))))
+ `(font-latex-italic-face ((t (:inherit italic :foreground ,green))))
+ `(font-latex-math-face ((t (:foreground ,red))))
+ `(font-latex-sectioning-5-face ((t (:inherit nil :foreground ,yellow :weight bold))))
+ `(font-latex-sedate-face ((t (:foreground ,cyan-d))))
+ `(font-latex-string-face ((t (:foreground ,orange))))
+ `(font-latex-warning-face ((t (:inherit bold :foreground ,red))))
+ `(font-lock-builtin-face ((t (:foreground ,green))))
+ `(font-lock-comment-delimiter-face ((t (:inherit font-lock-comment-face))))
+ `(font-lock-comment-face ((t (:foreground ,violet :slant normal))))
+ `(font-lock-constant-face ((t (:foreground ,base1))))
+ `(font-lock-doc-face ((t (:inherit font-lock-string-face :foreground ,violet))))
+ `(font-lock-function-name-face ((t (:inherit default :foreground "#C3D1D1"))))
+ `(font-lock-keyword-face ((t (:foreground ,base00 :weight bold))))
+ `(font-lock-preprocessor-face ((nil (:foreground ,magenta))))
+ `(font-lock-string-face ((t (:foreground ,orange))))
+ `(font-lock-type-face ((t (:foreground ,green :weight normal))))
+ `(font-lock-variable-name-face ((t (:foreground "#E3F1F1" :weight normal))))
+ `(font-lock-warning-face ((t (:foreground ,red))))
+ `(fringe ((((class color) (background dark)) (:background "grey25"))))
+ `(ggtags-global-line ((t (:inherit secondary-selection))))
+ `(header-line ((t (:inherit mode-line))))
+ `(highlight-beyond-fill-column-face ((t (:background ,red-d))))
+ `(ivy-confirm-face ((t (:inherit minibuffer-prompt :foreground ,green))))
+ `(ivy-current-match ((t (:background ,green-d))))
+ `(ivy-match-required-face ((t (:inherit minibuffer-prompt :foreground ,red))))
+ `(ivy-minibuffer-match-face-1 ((t (:inherit minibuffer-prompt))))
+ `(ivy-minibuffer-match-face-2 ((t (:inherit minibuffer-prompt))))
+ `(ivy-minibuffer-match-face-3 ((t (:inherit minibuffer-prompt))))
+ `(ivy-minibuffer-match-face-4 ((t (:inherit minibuffer-prompt))))
+ `(swiper-line-face ((t (:background "#354900"))))
+ `(swiper-match-face-1 ((t (:background ,cyan-d))))
+ `(swiper-match-face-2 ((t (:background ,green-d))))
+ `(swiper-match-face-3 ((t (:background ,cyan-d))))
+ `(swiper-match-face-4 ((t (:background ,green-d))))
+ `(ivy-remote ((t (:foreground ,violet))))
+ `(jabber-chat-prompt-foreign ((t (:foreground ,cyan-d :weight bold))))
+ `(jabber-chat-prompt-local ((t (:foreground ,green :weight bold))))
+ `(jabber-rare-time-face ((t (:foreground ,violet :weight bold))))
+ `(jabber-roster-user-away ((t (:foreground ,green-d :slant italic :weight normal))))
+ `(jabber-roster-user-online ((t (:foreground ,green-l :slant normal :weight bold))))
+ `(jabber-title-large ((t (:foreground "white" :weight bold))))
+ `(jabber-title-medium ((t (:weight bold :height 1.0 :width expanded))))
+ `(link ((((class color) (min-colors 88) (background dark)) (:foreground ,blue :inverse-video nil :underline t))))
+ `(link-visited ((default (:inherit link)) (((class color) (background dark)) (:foreground ,violet))))
+ `(magit-bisect-bad ((t (:foreground ,red))))
+ `(magit-bisect-good ((t (:foreground ,green))))
+ `(magit-bisect-skip ((t (:foreground ,yellow))))
+ `(magit-blame-heading ((t (:background "grey15" :foreground "grey80"))))
+ `(magit-branch-current ((t (:inherit magit-branch-local :box 1))))
+ `(magit-branch-local ((t (:foreground ,cyan))))
+ `(magit-branch-remote ((t (:foreground ,green))))
+ `(magit-cherry-equivalent ((t (:foreground ,magenta-d))))
+ `(magit-cherry-unmatched ((t (:foreground ,cyan-d))))
+ `(magit-diff-added ((t (:foreground ,green))))
+ `(magit-diff-added-highlight ((t (:foreground ,green))))
+ `(magit-diff-base ((t (:background ,green-d :foreground "gray80"))))
+ `(magit-diff-base-highlight ((t (:background ,green-d :foreground "white"))))
+ `(magit-diff-context ((t (:foreground "grey70"))))
+ `(magit-diff-context-highlight ((t (:foreground "grey80"))))
+ `(magit-diff-file-heading-selection ((t (:inherit magit-diff-file-heading-highlight :foreground ,red))))
+ `(magit-diff-hunk-heading ((t (:foreground ,violet))))
+ `(magit-diff-hunk-heading-highlight ((t (:foreground ,violet :weight bold))))
+ `(magit-diff-hunk-heading-selection ((t (:inherit magit-diff-hunk-heading-highlight :foreground ,red))))
+ `(magit-diff-lines-heading ((t (:inherit magit-diff-hunk-heading-highlight :background ,red :foreground "grey80"))))
+ `(magit-diff-removed ((t (:foreground ,red))))
+ `(magit-diff-removed-highlight ((t (:foreground "red"))))
+ `(magit-diffstat-added ((t (:inherit diff-added))))
+ `(magit-diffstat-removed ((t (:inherit diff-removed))))
+ `(magit-item-highlight ((t (:background "grey15"))))
+ `(magit-log-author ((t (:foreground ,red))))
+ `(magit-process-ng ((t (:inherit magit-section-heading :foreground ,red))))
+ `(magit-process-ok ((t (:inherit magit-section-heading :foreground ,green))))
+ `(magit-reflog-amend ((t (:foreground ,magenta))))
+ `(magit-reflog-checkout ((t (:foreground ,blue))))
+ `(magit-reflog-cherry-pick ((t (:foreground ,green))))
+ `(magit-reflog-commit ((t (:foreground ,green))))
+ `(magit-reflog-merge ((t (:foreground ,green))))
+ `(magit-reflog-other ((t (:foreground ,cyan))))
+ `(magit-reflog-rebase ((t (:foreground ,magenta))))
+ `(magit-reflog-remote ((t (:foreground ,cyan))))
+ `(magit-reflog-reset ((t (:foreground ,red))))
+ `(magit-section-heading ((t (:foreground ,green :weight bold))))
+ `(magit-section-heading-selection ((t (:foreground ,red))))
+ `(magit-sequence-drop ((t (:foreground ,red))))
+ `(magit-sequence-head ((t (:foreground ,blue))))
+ `(magit-sequence-part ((t (:foreground ,yellow))))
+ `(magit-sequence-stop ((t (:foreground ,green))))
+ `(magit-signature-bad ((t (:foreground ,red :weight bold))))
+ `(magit-signature-error ((t (:foreground ,red))))
+ `(magit-signature-expired ((t (:foreground ,orange))))
+ `(magit-signature-good ((t (:foreground ,green))))
+ `(magit-signature-revoked ((t (:foreground ,violet))))
+ `(magit-signature-untrusted ((t (:foreground ,cyan))))
+ `(magit-tag ((t (:foreground ,yellow))))
+ `(magit-section-highlight ((t (:background "grey15"))))
+ `(minibuffer-prompt ((((background dark)) (:foreground "white"))))
+ `(mode-line ((t (:background "#2D3232" :foreground "#AFB3B2" :box nil))))
+ `(mode-line-buffer-id ((t (:weight bold))))
+ `(mode-line-buffer-id-inactive ((t (:inherit mode-line-buffer-id :foreground "gray30"))))
+ `(mode-line-inactive ((t (:inherit mode-line :background "#222727" :foreground "gray30"))))
+ `(nobreak-space ((((class color) (min-colors 88)) (:inherit escape-glyph :underline t))))
+ `(powerline-active0 ((t (:inherit mode-line :background "#121717"))))
+ `(powerline-active1 ((t (:inherit mode-line :background "#222727"))))
+ `(powerline-active2 ((t (:inherit mode-line :background "#222727"))))
+ `(powerline-inactive0 ((t (:inherit mode-line-inactive :background "black"))))
+ `(powerline-inactive1 ((t (:inherit mode-line-inactive :background "#121717"))))
+ `(powerline-inactive2 ((t (:inherit mode-line-inactive :background "#121717"))))
+ `(rainbow-delimiters-depth-1-face ((t (:inherit rainbow-delimiters-base-face :foreground "#93A1A1"))))
+ `(rainbow-delimiters-depth-2-face ((t (:inherit rainbow-delimiters-base-face :foreground "#8BA898"))))
+ `(rainbow-delimiters-depth-3-face ((t (:inherit rainbow-delimiters-base-face :foreground "#8391A1"))))
+ `(rainbow-delimiters-depth-4-face ((t (:inherit rainbow-delimiters-base-face :foreground "#7B9888"))))
+ `(rainbow-delimiters-depth-5-face ((t (:inherit rainbow-delimiters-base-face :foreground "#738191"))))
+ `(rainbow-delimiters-depth-6-face ((t (:inherit rainbow-delimiters-base-face :foreground "#6B8878"))))
+ `(rainbow-delimiters-depth-7-face ((t (:inherit rainbow-delimiters-base-face :foreground "#637181"))))
+ `(rainbow-delimiters-depth-8-face ((t (:inherit rainbow-delimiters-base-face :foreground "#5B7868"))))
+ `(rainbow-delimiters-depth-9-face ((t (:inherit rainbow-delimiters-base-face :foreground "#536171"))))
+ `(region ((t (:background "#354900"))))
+ `(secondary-selection ((t (:background "#344E00"))))
+ `(smerge-refined-change ((t (:background "grey20"))) t)
+ `(smerge-refined-changed ((t (:background "grey20"))))
+ `(spaceline-highlight-face ((t (:background "#272A2A" :foreground "#FFFFFF" :inherit (quote mode-line)))))
+ `(spaceline-modified ((t (:background "#A66" :foreground "#3E3D31" :inherit (quote mode-line)))))
+ `(spaceline-unmodified ((t (:background "#777" :foreground "#3E3D31" :inherit (quote mode-line)))))
+ `(success ((t (:foreground ,green :weight bold))))
+ `(warning ((t (:foreground ,yellow :weight bold))))
+ `(whitespace-indentation ((t (:foreground "grey20"))))
+ `(whitespace-newline ((t (:foreground "grey20" :weight normal))))
+ `(whitespace-space ((t (:foreground "grey20"))))
+ `(whitespace-space-after-tab ((t (:foreground "grey20"))))
+ `(whitespace-tab ((t (:foreground "grey20"))))
+ `(widget-field ((t (:background "#222" :box (:line-width 2 :color "#555")))))
+ `(woman-addition ((t (:inherit font-lock-builtin-face :foreground ,blue))))
+ `(woman-bold ((t (:inherit bold :foreground ,green))))
+ `(woman-italic ((t (:inherit italic :slant italic)))))
+
+(provide-theme 'drobillized)
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
new file mode 100644
index 0000000..aaa136f
--- /dev/null
+++ b/emacs/.emacs.d/init.el
@@ -0,0 +1,428 @@
+;;; System
+
+(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp"))
+
+;; Platform specific configuration
+(cond ((equal system-type 'darwin)
+ (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
+ (setq exec-path (append exec-path '("/usr/local/bin")))
+ (setq dired-listing-switches "-al")
+ (scroll-bar-mode nil)
+ (global-set-key [home] 'move-beginning-of-line)
+ (global-set-key [end] 'move-end-of-line))
+ ((or (equal system-type 'gnu/linux) (equal system-type 'gnu/kfreebsd))
+ (setq dired-listing-switches "-al --time-style=long-iso")
+ (scroll-bar-mode (quote right))))
+
+(setq-default
+ gc-cons-threshold 10000000
+ backup-by-copying t
+ backup-directory-alist `((".*" . ,temporary-file-directory))
+ auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
+ scheme-program-name "mzscheme"
+ browse-url-generic-program (executable-find "sensible-browser")
+ browse-url-browser-function 'browse-url-generic)
+
+;;; Packages
+
+(require 'package)
+(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
+(package-initialize)
+(unless (package-installed-p 'use-package)
+ (progn
+ (package-refresh-contents)
+ (package-install 'use-package)))
+
+(require 'use-package)
+
+(setq use-package-always-ensure t)
+(use-package ace-window)
+(use-package clang-format :commands (c-mode c++-mode))
+(use-package counsel :after (ivy) :config (counsel-mode))
+(use-package counsel-gtags :commands ggtags-mode)
+(use-package counsel-projectile :after (counsel projectile))
+(use-package diminish)
+(use-package dired+)
+(use-package dired-rainbow :after (dired+))
+(use-package flyspell :commands flyspell-mode)
+(use-package flyspell-correct-ivy :after (flyspell ivy) :commands flyspell-mode)
+(use-package ggtags :commands ggtags-mode)
+(use-package ivy :config (ivy-mode))
+(use-package llvm-mode :commands llvm-mode)
+(use-package magit :commands magit-status :bind ("C-c m" . magit-status) :config (define-key magit-mode-map (kbd "C-<tab>") nil))
+(use-package markdown-mode :commands markdown-mode)
+(use-package pdf-tools :magic ("%PDF" . pdf-view-mode) :config (pdf-tools-install))
+(use-package projectile :config (projectile-global-mode))
+(use-package rainbow-delimiters :commands prog-mode)
+(use-package smart-tabs-mode :commands (c-mode c++-mode))
+(use-package spaceline)
+(use-package swiper :commands swiper)
+(use-package tramp)
+
+(require 'spaceline-config)
+
+;;; Basic editor configuration
+
+(defalias 'yes-or-no-p 'y-or-n-p)
+(delete-selection-mode 1)
+(winner-mode 1)
+(setq-default tab-width 4)
+(setq-default indent-tabs-mode nil)
+(setq-default scroll-margin 3)
+(spaceline-toggle-buffer-size-off)
+(spaceline-toggle-hud-off)
+(spaceline-toggle-buffer-encoding-abbrev-off)
+(diminish 'abbrev-mode "")
+(diminish 'auto-fill-function "↵")
+(diminish 'auto-revert-mode "↻")
+(diminish 'compilation-in-progress "⚙")
+(diminish 'counsel-mode "")
+(diminish 'flyspell-mode "✓")
+(diminish 'ggtags-mode "☚")
+(diminish 'ivy-mode "")
+(setq spaceline-minor-modes-separator " ")
+
+(spaceline-define-segment version-control
+ "Version control information."
+ (when vc-mode
+ (powerline-raw
+ (s-trim (concat vc-mode
+ (when (buffer-file-name)
+ (pcase (vc-state (buffer-file-name))
+ (`up-to-date " ")
+ (`edited " *")
+ (`added " +")
+ (`unregistered " ?")
+ (`removed " -")
+ (`needs-merge " !")
+ (`needs-update " ^")
+ (`ignored " I")
+ (_ " ?"))))))))
+
+(spaceline-define-segment buffer-position
+ "Buffer position in percent"
+ (format "%3d%%%%" (/ (* 100 (- (line-number-at-pos) 1))
+ (max 1 (count-lines (point-min) (point-max))))))
+
+;;; Variables
+
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(auto-revert-interval 1)
+ '(backup-by-copying t)
+ '(backup-directory-alist (\` ((".*" \, temporary-file-directory))))
+ '(browse-url-firefox-new-window-is-tab t)
+ '(column-number-mode t)
+ '(compilation-scroll-output t)
+ '(cursor-in-non-selected-windows (quote hollow))
+ '(custom-enabled-themes (quote (drobillized)))
+ '(custom-safe-themes
+ (quote
+ ("c2616934f29a24eded08ab10db3615ba9fa6b91ce0427dd53700d43f94705f42" default)))
+ '(delete-old-versions t)
+ '(dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.\\|^\\..*$")
+ '(diredp-hide-details-initially-flag t)
+ '(diredp-wrap-around-flag nil)
+ '(erc-autojoin-channels-alist
+ (quote
+ ((".*\\.freenode.net" "#ardour" "#ardour-dev" "#ingen" "#lv2" "#moddevices" "#lad"))))
+ '(erc-autojoin-mode t)
+ '(erc-join-buffer (quote bury))
+ '(erc-log-channels-directory "~/.erc/logs")
+ '(erc-log-insert-log-on-open t)
+ '(erc-log-mode t)
+ '(erc-mode-line-format "%t")
+ '(erc-prompt ">")
+ '(erc-track-exclude-server-buffer t)
+ '(erc-track-exclude-types
+ (quote
+ ("JOIN" "NICK" "PART" "QUIT" "MODE" "333" "353" "324" "329" "332" "477")))
+ '(fill-column 79)
+ '(font-lock-maximum-decoration t)
+ '(frame-background-mode (quote dark))
+ '(fringe-mode 0 nil (fringe))
+ '(gc-cons-threshold 10000000)
+ '(grep-find-command
+ "find . -type f -not -name \"*.svn-base\" -print0 | xargs -0 grep -I -n -s -F ")
+ '(indicate-empty-lines t)
+ '(inhibit-startup-screen t)
+ '(ivy-magic-tilde nil)
+ '(jabber-account-list
+ (quote
+ (("david.e.robillard@gmail.com"
+ (:network-server . "talk.google.com")
+ (:port . 5223)
+ (:connection-type . ssl)))))
+ '(jabber-chat-buffer-show-avatar nil)
+ '(jabber-chat-header-line-format
+ (quote
+ (""
+ (:eval
+ (jabber-jid-displayname jabber-chatting-with))
+ " "
+ (:eval
+ (let
+ ((buddy
+ (jabber-jid-symbol jabber-chatting-with)))
+ (propertize
+ (or
+ (cdr
+ (assoc
+ (get buddy
+ (quote show))
+ jabber-presence-strings))
+ (get buddy
+ (quote show)))
+ (quote face)
+ (or
+ (cdr
+ (assoc
+ (get buddy
+ (quote show))
+ jabber-presence-faces))
+ (quote jabber-roster-user-online)))))
+ " "
+ (:eval
+ (jabber-fix-status
+ (get
+ (jabber-jid-symbol jabber-chatting-with)
+ (quote status))))
+ " " jabber-events-message " " jabber-chatstates-message)))
+ '(jabber-roster-line-format " %c %-25n %u %-8s %S")
+ '(jshint-mode-node-program "nodejs")
+ '(magit-auto-revert-mode nil)
+ '(magit-diff-refine-hunk (quote all))
+ '(menu-bar-mode nil)
+ '(ns-use-srgb-colorspace nil)
+ '(package-selected-packages
+ (quote
+ (rainbow-delimiters auctex clang-format counsel-gtags counsel-projectile dired+ dired-rainbow flyspell-correct-ivy ggtags ivy magit markdown-mode n3-mode pdf-tools projectile spaceline use-package)))
+ '(pdf-view-midnight-colors (quote ("#C3D1D1" . "#141414")))
+ '(powerline-default-separator (quote arrow))
+ '(projectile-completion-system (quote ivy))
+ '(projectile-enable-caching t)
+ '(projectile-mode-line nil)
+ '(projectile-use-git-grep t)
+ '(quack-pretty-lambda-p t)
+ '(quack-run-scheme-always-prompts-p nil)
+ '(savehist-mode t)
+ '(scroll-conservatively 5)
+ '(send-mail-function (quote sendmail-send-it))
+ '(show-paren-mode t)
+ '(speedbar-use-images nil)
+ '(split-window-preferred-function (quote split-window-horizontally))
+ '(tool-bar-mode nil)
+ '(version-control t)
+ '(visible-bell nil))
+
+(setq ring-bell-function
+ (lambda ()
+ (let ((orig-fg (face-foreground 'mode-line)))
+ (set-face-foreground 'mode-line "#F2804F")
+ (run-with-idle-timer 0.1 nil
+ (lambda (fg) (set-face-foreground 'mode-line fg))
+ orig-fg))))
+
+;;; Colours
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ )
+
+;;; Windows
+
+(defun compile-autoclose (buffer string)
+ "Close compilation window on success"
+ (cond ((and (string-match "compilation" (buffer-name buffer))
+ (string-match "finished" string))
+ (bury-buffer "*compilation*")
+ (winner-undo)
+ (message "Build successful."))
+ (t
+ (message "Compilation exited abnormally: %s" string))))
+
+(defun rotate-windows ()
+ "Rotate windows"
+ (interactive)
+ (if (> (count-windows) 1)
+ (let ((i 0)
+ (num-windows (count-windows)))
+ (while (< i (- num-windows 1))
+ (let* ((w1 (elt (window-list) i))
+ (w2 (elt (window-list) (% (+ i 1) num-windows)))
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+ (s1 (window-start w1))
+ (s2 (window-start w2)))
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)
+ (setq i (+ i 1)))))))
+
+(setq split-height-threshold nil)
+(setq split-width-threshold 0)
+(setq compilation-finish-functions 'compile-autoclose)
+
+;; Remove slow Maven regexp that makes the compilation buffer clunky
+(setq compilation-error-regexp-alist
+ (delete 'maven compilation-error-regexp-alist))
+
+;;; Key bindings
+
+(global-set-key (kbd "C-<left>") 'previous-buffer)
+(global-set-key (kbd "C-<right>") 'next-buffer)
+(global-set-key (kbd "C-<tab>") 'ace-window)
+(global-set-key (kbd "C-b") 'compile)
+(global-set-key (kbd "C-m") 'newline-and-indent)
+(global-set-key (kbd "C-n") 'next-error)
+(global-set-key (kbd "C-p") 'previous-error)
+(global-set-key (kbd "C-s") 'swiper)
+
+(global-set-key (kbd "C-c <") 'first-error)
+(global-set-key (kbd "C-c =") 'set-variable)
+(global-set-key (kbd "C-c I") 'clang-format-region)
+(global-set-key (kbd "C-c R") 'replace-regexp)
+(global-set-key (kbd "C-c a") 'align)
+(global-set-key (kbd "C-c c") 'comment-region)
+(global-set-key (kbd "C-c d") 'svn-status-show-svn-diff)
+(global-set-key (kbd "C-c e") 'erc-track-switch-buffer)
+(global-set-key (kbd "C-c f") 'ff-find-other-file)
+(global-set-key (kbd "C-c g") 'grep-find)
+(global-set-key (kbd "C-c i") 'clang-format-buffer)
+(global-set-key (kbd "C-c m") 'magit-status)
+(global-set-key (kbd "C-c r") 'replace-string)
+(global-set-key (kbd "C-c s") 'sort-lines)
+(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
+(global-set-key (kbd "C-c u") 'uncomment-region)
+(global-set-key (kbd "C-c w") 'rotate-windows)
+
+;;; File modes
+
+(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
+
+;; C/C++
+
+(defconst my-c-style
+ '((c-block-comment-prefix . " ")
+ (c-comment-only-line-offset . 0)
+ (c-auto-align-backslashes . nil)
+ (c-label-minimum-indentation . 0)
+ (c-hungry-delete-key . t)
+ (c-indent-comments-syntactically-p . nil)
+ (c-hanging-braces-alist . ((brace-list-open after)
+ (defun-open after)
+ (defun-close before after)
+ (class-open after)
+ (class-close before after)
+ (namespace-open after)
+ (inline-open after)
+ (inline-close before after)
+ (block-open after)
+ (block-close . c-snug-do-while)
+ (extern-lang-open after)
+ (extern-lang-close after)
+ (statement-case-open after)
+ (substatement-open after)))
+ (c-hanging-colons-alist . ((case-label)
+ (label after)
+ (access-label after)
+ (member-init-intro before)
+ (inher-intro)))
+ (c-hanging-semi&comma-criteria . (c-semi&comma-no-newlines-for-oneline-inliners
+ c-semi&comma-inside-parenlist
+ c-semi&comma-no-newlines-before-nonblanks))
+ (c-cleanup-list . (brace-catch-brace
+ brace-else-brace
+ brace-elseif-brace
+ compact-empty-funcall
+ defun-close-semi
+ empty-defun-braces
+ list-close-comma
+ one-liner-defun
+ scope-operator))
+ (c-offsets-alist . ((func-decl-cont . ++)
+ (member-init-intro . +)
+ (inher-intro . ++)
+ (comment-intro . 0)
+ (arglist-close . c-lineup-arglist)
+ (topmost-intro . 0)
+ (block-open . 0)
+ (inline-open . 0)
+ (substatement-open . 0)
+ (label . /)
+ (case-label . 0)
+ (statement-case-open . +)
+ (statement-case-intro . +)
+ (access-label . -)
+ (innamespace . 0)
+ (inextern-lang . 0)
+ (extern-lang-open . 0)
+ (label . -)))))
+
+(c-add-style "drobilla" my-c-style)
+
+(defun my-c-mode-common-hook ()
+ "C mode for people with taste."
+ (require 'smarttabs)
+ (auto-fill-mode 1)
+ (abbrev-mode -1)
+ (set-fill-column 79)
+ (smart-tabs-mode-enable)
+ (setq tab-width 4)
+ (setq indent-tabs-mode t)
+ (setq truncate-lines t)
+ (setq show-trailing-whitespace t)
+ (smart-tabs-advice c-indent-line c-basic-offset)
+ (c-set-style "drobilla"))
+
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
+(add-hook 'c++-mode-common-hook 'my-c-mode-common-hook)
+
+;; Python
+
+(add-hook 'python-mode-hook
+ (lambda ()
+ (setq tab-width 4)
+ (setq indent-tabs-mode nil)
+ (setq show-trailing-whitespace)))
+
+;; PDF
+
+(defun my-doc-view-hook ()
+ (auto-revert-mode)
+ (blink-cursor-mode -1))
+
+(add-hook 'doc-view-mode-hook 'my-doc-view-hook)
+(add-hook 'pdf-view-mode-hook 'my-doc-view-hook)
+
+(spaceline-define-segment line-column
+ "The current line and column numbers."
+ (if (eq major-mode 'pdf-view-mode)
+ ;; Show page number and count for PDF documents
+ (concat (number-to-string (pdf-view-current-page))
+ "/"
+ (number-to-string (pdf-cache-number-of-pages)))
+ mode-line-position
+ "%l:%c"))
+
+;; Associations
+
+(add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
+(add-to-list 'auto-mode-alist '("\\.n3" . n3-mode))
+(add-to-list 'auto-mode-alist '("\\.ttl" . n3-mode))
+(add-to-list 'auto-mode-alist '("\\.owl" . n3-mode))
+(add-to-list 'auto-mode-alist '("\\.ll" . llvm-mode))
+(add-to-list 'auto-mode-alist '("\\.md" . markdown-mode))
+(add-to-list 'auto-mode-alist '("\\.pdf" . pdf-view-mode))
+
+;;; Launch
+
+(spaceline-spacemacs-theme)
+(server-start)
diff --git a/emacs/.emacs.d/site-lisp/n3-mode.el b/emacs/.emacs.d/site-lisp/n3-mode.el
new file mode 100644
index 0000000..8beced6
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/n3-mode.el
@@ -0,0 +1,44 @@
+;;; n3-mode.el --- mode for Notation 3
+; $Id: n3-mode.el 4084 2007-12-15 17:10:13Z hugoh $
+
+;; Copyright (c) 2003-2007 Hugo Haas <hugo@larve.net>
+
+;; For documentation on Notation 3, see:
+;; http://www.w3.org/DesignIssues/Notation3.html
+
+;;; Comentary:
+
+;; Goals:
+;; - sytax highlighting
+;; - completion
+;; - indentation
+
+;; What it does now:
+;; - Syntax highlighting
+
+;;; Code:
+
+(require 'generic)
+
+(define-generic-mode 'n3-mode
+ ;; comment char
+ (list "# ")
+ ;; keywords
+ (list "this" "a")
+ ;; additional font-lock'ing
+ '(("\\(@prefix\\)\\>" 1 font-lock-keyword-face t)
+ ("\\(\\S-*?:\\)" 1 font-lock-type-face t)
+ (":\\(\\S-+?\\)\\>" 1 font-lock-constant-face t)
+ ("\\(<.*?>\\)" 1 font-lock-function-name-face t)
+ ("\\(\\\".*?\\\"\\)" 1 font-lock-string-face t)
+; Bug: some trailing characters are highlighted; restricting comments regexp
+; ("\\(#.*\\)" 1 font-lock-comment-face t)
+ ("^\\s-*\\(#.*\\)" 1 font-lock-comment-face t)
+ )
+ ;; auto-mode
+ (list "\\.n3$")
+ ;; additional setup
+ nil
+ ;; description
+ "Mode for Notation 3 documents."
+ )
diff --git a/emacs/.emacs.d/site-lisp/ppindent.el b/emacs/.emacs.d/site-lisp/ppindent.el
new file mode 100644
index 0000000..84c9702
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/ppindent.el
@@ -0,0 +1,138 @@
+;;; ppindent.el --- Indents C preprocessor directives
+
+;; Copyright (C) 2007 Free Software Foundation, Inc.
+
+;; Author: Craig McDaniel <craigmcd@gmail.com>
+;; Keywords: languages, c
+;; Maintainer: Craig McDaniel <craigmcd@gmail.com>
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; PPINDENT indents C-preprocessor statements depending on the current
+;; #if..., #el.., #endif level. It only modifies lines with "#" as the
+;; first non-blank character and therefore does not conflict with the
+;; normal C indentation. Unlike a true indent, it inserts the
+;; requisite number of spaces after, rather than before the "#"
+;; character. This type of preprocesor indent is commonly used to
+;; provide the most compatibility with different C-compilers.
+;;
+;; Example:
+
+;; #ifdef WOO
+;; ....
+;; #if defined(X) && !defined(Y)
+;; #ifdef Q8
+;; ...
+;; #else
+;; ...
+;; ....
+;; #elif defined (Z)
+;; ....
+;; #endif
+;; #endif
+;; #endif
+
+;; After "M-x ppindent-c" becomes:
+
+;; #ifdef WOO
+;; ....
+;; # if defined(X) && !defined(Y)
+;; # ifdef Q8
+;; ...
+;; # else
+;; ...
+;; ....
+;; # elif defined (Z)
+;; ....
+;; # endif
+;; # endif
+;; #endif
+
+;; Two functions are provided: PPINDENT-C indents as described
+;; above. PPINDENT-H does not indent the first level, assuming that
+;; .h/.hpp files use an #ifdef guard around the entire file.
+
+;; You can customize PPINDENT-INCREMENT if you want to use something
+;; other than 2 spaces for the indent.
+
+;;; History:
+
+;; 2007-01-19 WCM Initial version
+
+;;; Code:
+
+(provide 'ppindent)
+
+(defgroup pp-indent nil
+ "Indent C preproccessor directives."
+ :group 'c)
+
+(defcustom ppindent-increment 2
+ "Number of spaces per indention level.
+
+Used in C pre-processor indent functions ppindent-c and ppindent-h"
+ :type 'number
+ :group 'pp-indent)
+
+(defun starts-withp (str prefix)
+ "str starts with prefix"
+ (eql (compare-strings prefix nil nil str nil (length prefix)) t))
+
+(defun my-make-string (length init)
+ "just like make-string, but makes an empty string if length is negative"
+ (when (minusp length)
+ (setf length 0))
+ (make-string length init))
+
+(defun ppindent-aux (start)
+ (let ((cnt start))
+ (goto-char (point-min))
+ (while (re-search-forward "^[ \t]*#[ \t]*\\(.*\\)" nil t)
+ (cond ((starts-withp (match-string-no-properties 1) "if")
+ (replace-match (concat "#" (my-make-string cnt ?\s) "\\1"))
+ (incf cnt ppindent-increment))
+ ((starts-withp (match-string-no-properties 1) "el")
+ (when (< (- cnt ppindent-increment) start)
+ (throw 'err `(,(line-number-at-pos) "Unmatched #else or #elif")))
+ (replace-match (concat "#" (my-make-string
+ (- cnt ppindent-increment)
+ ?\s) "\\1")))
+ ((starts-withp (match-string-no-properties 1) "endif")
+ (when (< (- cnt ppindent-increment) start)
+ (throw 'err `(,(line-number-at-pos) "Unmatched #endif")))
+ (decf cnt ppindent-increment)
+ (replace-match (concat "#" (my-make-string cnt ?\s) "\\1")))
+ (t
+ (replace-match (concat "#" (my-make-string cnt ?\s) "\\1")))))))
+
+(defun ppindent-buffer (start)
+ (let ((result (catch 'err (save-excursion (ppindent-aux start)))))
+ (when result
+ (goto-line (car result))
+ (error "Error: %s" (cadr result)))))
+
+(defun ppindent-c ()
+ "Indent all C pre-processor statements"
+ (interactive)
+ (ppindent-buffer 0))
+
+(defun ppindent-h ()
+ "Indent C pre-processor statements, keeping first level #ifdef unindented"
+ (interactive)
+ (ppindent-buffer (- ppindent-increment)))
+
diff --git a/emacs/.emacs.d/site-lisp/ttl-mode.el b/emacs/.emacs.d/site-lisp/ttl-mode.el
new file mode 100644
index 0000000..ee147de
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/ttl-mode.el
@@ -0,0 +1,209 @@
+;;; ttl-mode.el --- mode for Turtle(RDF)
+;; Based on n3-mode.el --- mode for Notation 3,
+;; at http://larve.net/people/hugo/2003/scratchpad/NotationThreeEmacsMode.html
+;; Also draws on http://dishevelled.net/elisp/turtle-mode.el (which is for the _other_ turtle!)
+
+;; Copyright (c) 2003-2007 Hugo Haas <hugo@larve.net>
+;; Extended 2011-2012, by Norman Gray <http://nxg.me.uk>
+;;
+;; See Hugo's commentary for original goals and further discussion.
+
+;; Project hosted at <https://bitbucket.org/nxg/ttl-mode>. See there for updates.
+
+;; To use:
+;;
+;; (autoload 'ttl-mode "ttl-mode" "Major mode for OWL or Turtle files" t)
+;; (add-hook 'ttl-mode-hook ; Turn on font lock when in ttl mode
+;; 'turn-on-font-lock)
+;; (setq auto-mode-alist
+;; (append
+;; (list
+;; '("\\.n3" . ttl-mode)
+;; '("\\.ttl" . ttl-mode))
+;; auto-mode-alist))
+
+;;; Code:
+
+(require 'generic)
+
+(define-generic-mode 'ttl
+ ;; comment char
+ (list "# ")
+ ;; keywords
+ (list "this" "a")
+ ;; additional font-lock'ing
+ '(("\\(@prefix\\)\\>" 1 font-lock-keyword-face t) ;keywords
+ ("\\^\\^[^,;.]+" 0 font-lock-preprocessor-face t) ;literal types
+ ("@[[:word:]_]+" 0 font-lock-preprocessor-face t) ;languages
+ ("\\(\\S-*?:\\)" 1 font-lock-type-face nil) ;prefix
+ (":\\([[:word:]_-]+\\)\\>" 1 font-lock-constant-face nil) ;suffix
+ ("\\(<.*?>\\)" 1 font-lock-function-name-face t) ;resources
+ ("\\(\\\".*?\\\"\\)" 1 font-lock-string-face t) ;strings
+ ("\\(\\\"\\\"\\\".*?\\\"\\\"\\\"\\)" 1 font-lock-string-face t) ;doesn't work over newlines?
+; Bug: some trailing characters are highlighted; restricting comments regexp
+; ("\\(#.*\\)" 1 font-lock-comment-face t)
+ ("^\\s-*\\(#.*\\)" 1 font-lock-comment-face t) ;comment
+ )
+ ;; auto-mode
+ (list "\\.n3$" "\\.ttl")
+ ;; additional setup
+ nil
+ ;; description
+ "Mode for Turtle RDF documents."
+ )
+
+(defun ttl-base ()
+ (interactive)
+ (generic-mode "ttl"))
+
+(defun ttl-indent-line ()
+ (interactive)
+ (indent-line-to
+ (or (ignore-errors (ttl-calculate-indentation))
+ 0)))
+
+(defun ttl-calculate-indentation ()
+ (save-excursion
+ (beginning-of-line) (skip-chars-forward "\t ")
+ (cond ((ttl-in-string-p) 8)
+ ((looking-at "$")
+ ;; empty line -- use same indentation as previous line
+ (save-excursion
+ (forward-line -1)
+ (skip-chars-forward "\t ")
+ (current-column)))
+ ((looking-at "@") 0) ;@prefix or @base
+ ((looking-at "#") 0)
+ ((looking-at "<");(looking-at "\\S-+\\s-*$")
+ ;;only a single expression on the line -- a subject
+ 0)
+ ((save-excursion
+ (forward-line -1)
+ (end-of-line)
+ (if (not (looking-back "\\["))
+ nil
+ (beginning-of-line)
+ (skip-chars-forward "\t ")
+ (+ (current-column) 4))))
+ (t 4))))
+
+;; (defun turtle-indent-block ()
+;; (interactive)
+;; (indent-region (point)
+;; (save-excursion (forward-xxx) (point))))
+
+(defvar ttl-mode-map (make-sparse-keymap))
+(define-derived-mode ttl-mode ttl-base
+ "Turtle RDF"
+ (setq indent-tabs-mode t)
+ (ttl-mode-variables)
+; (define-key ttl-mode-map (kbd "C-M-q")
+; 'turtle-indent-block)
+ (define-key ttl-mode-map (kbd "\;") 'ttl-electric-semi)
+ (define-key ttl-mode-map (kbd "\.") 'ttl-electric-dot)
+ (define-key ttl-mode-map (kbd "RET") 'newline-and-indent)
+ (define-key ttl-mode-map [backspace] 'ttl-hungry-delete-backwards)
+ (use-local-map ttl-mode-map))
+
+(defcustom ttl-electric-semi-mode nil
+ "*If non-nil, `\;' will self insert, reindent the line, and do a newline.
+If nil, just insert a `\;'. (To insert while t, do: \\[quoted-insert] \;)."
+ :group 'ttl
+ :type 'boolean)
+
+(defun beginning-of-stanza ()
+ "Find the beginning of a stanza, indicated by non-whitespace at the beginning of a line."
+ (re-search-backward "^\\S-" (point-min) t))
+
+(defun ttl-in-string-p ()
+ "Is point inside a string or a long-string?"
+ (save-excursion
+ (let ((here (point))
+ (in-p nil))
+ (beginning-of-stanza)
+ (condition-case nil
+ (progn
+ (while (<= (point) here)
+ (if in-p
+ (progn
+ (search-forward in-p (point-max) nil)
+ (setq in-p nil))
+ (re-search-forward "\"\\(\"\"\\)?" (point-max) nil)
+ (if (char-equal (char-before (- (point) 1)) ?\")
+ (setq in-p "\"\"\"")
+ (setq in-p "\""))))
+ (not in-p))
+ (search-failed ;reached EOF
+ (if in-p ;this indicates that we're inside a string
+ (message "Unbalanced quotes -- reached EOF inside string")
+ nil))))))
+
+(defun *ttl-search-in-line-for-comment (limit)
+ "Search for a comment character from the current position, before point LIMIT; changes current position. Return location of comment, or nil if none can be found"
+ (let ((new-point (re-search-forward "[#<]" limit t)))
+ (cond ((not new-point) nil)
+ ((looking-back "#") new-point) ;found comment
+ (t ;looking-back "<"
+ (if (not (search-forward ">" limit t))
+ nil ;starting point is within resource
+ (*ttl-search-in-line-for-comment limit)))))) ;recurse
+
+(defun ttl-in-comment-p ()
+ "Is point inside a comment?"
+ (save-excursion
+ (let ((here (point)))
+ (beginning-of-line)
+ (*ttl-search-in-line-for-comment here))))
+
+(defun ttl-in-resource-p ()
+ "Is point within a resource, marked by <...>?"
+ (save-excursion
+ (and (re-search-backward "[<> ]" nil t)
+ (looking-at "<"))))
+
+(defun ttl-skip-ws-backwards () ;adapted from cc-mode
+ "Move backwards across whitespace."
+ (while (progn
+ (skip-chars-backward " \t\n\r\f\v")
+ (and (eolp)
+ (eq (char-before) ?\\)))
+ (backward-char)))
+
+(defun ttl-hungry-delete-backwards ()
+ "Delete backwards, either all of the preceding whitespace,
+or a single non-whitespace character if there is no whitespace before point."
+ (interactive)
+ (let ((here (point)))
+ (ttl-skip-ws-backwards)
+ (if (/= (point) here)
+ (delete-region (point) here)
+ (backward-delete-char-untabify 1))))
+
+(defun ttl-insulate ()
+ "Return true if this location should not be electrified"
+ (or (ttl-in-string-p)
+ (ttl-in-comment-p)
+ (ttl-in-resource-p)))
+
+(defun ttl-electric-semi ()
+ "Insert a \;.
+If variable `ttl-electric-semi-mode' is t, indent the current line, insert
+a newline, and indent."
+ (interactive)
+ (insert "\;")
+ (if (and ttl-electric-semi-mode
+ (not (ttl-insulate)))
+ (reindent-then-newline-and-indent)))
+
+(defun ttl-electric-dot ()
+ "Insert a \..
+If variable `ttl-electric-semi-mode' is t, indent the current line, insert
+a newline, and indent."
+ (interactive)
+ (insert "\.")
+ (if (and ttl-electric-semi-mode
+ (not (ttl-insulate)))
+ (reindent-then-newline-and-indent)))
+
+(defun ttl-mode-variables ()
+ (set (make-local-variable 'indent-line-function) 'ttl-indent-line))