X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=misc-disabled.el;fp=misc-disabled.el;h=2804aa639e505495b120ad1d107bc0a89e85491d;hb=318f10aac932014c2ec2531bc49ccc26d7510edc;hp=59a88510bfca3fd0d771e9dabc7e1ee9ebb63907;hpb=4df1d80f914620d6cf599f993894fe539e90354b;p=dot-emacs diff --git a/misc-disabled.el b/misc-disabled.el index 59a8851..2804aa6 100644 --- a/misc-disabled.el +++ b/misc-disabled.el @@ -393,3 +393,49 @@ ;; 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))