optimize startup
[dot-emacs] / misc-disabled.el
index 90b63d48e0d93ba9d94068b1e2ef469bcd6c6fe8..2804aa639e505495b120ad1d107bc0a89e85491d 100644 (file)
 (global-set-key (kbd "<kp-begin>") 'mark-defun)
 (global-set-key (kbd "<kp-right>") 'ibuffer)
 (global-set-key (kbd "<kp-prior>") 'delete-horizontal-space)
+
+
+;; give us a shell to start instead of scratch
+;;(setq initial-buffer-choice (lambda () (new-shell)))
+
+
+;;; smartparens
+;; the melpa git version had a catastrophic bug I reported.
+;; downgraded to marmalade version and everything is working fine.
+(require 'smartparens-config)
+
+(defun gp/sp/pair-on-newline-and-indent (id action context)
+  "Open a new brace or bracket expression, with relevant newlines and indent. "
+  (save-excursion
+    (newline)
+    (indent-according-to-mode))
+  (indent-according-to-mode))
+
+;; when opening a pair, and then inserting a newline, push the closing pair to another newline
+(sp-pair "{" nil :post-handlers
+         '(:add ((lambda (id action context)
+                   (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
+(sp-pair "[" nil :post-handlers
+         '(:add ((lambda (id action context)
+                   (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
+
+
+;; in my version, this is not a pairing.
+;; not sure if it is in a future version since I reverted to marmalade
+;; Don't need c-comments in strings -- they frustrate filename globs
+;; (sp-pair "/*" nil :unless '(sp-in-string-p))
+
+;; Don't need quotes to pair next to words
+(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
+(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
+
+
+;; todo, testout these mode specific settings from graphene.
+;; Ruby-specific pairs and handlers
+
+(eval-after-load "ruby"
+  '(require 'smartparens-ruby))
+
+;; Markdown
+(sp-local-pair '(markdown-mode gfm-mode) "*" "*"
+               :unless '(sp-in-string-p)
+               :actions '(insert wrap))
+
+;; Except in HTML
+(sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p))