X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=misc-disabled.el;h=0a7c5b3edea7fa25a3850ac02287a855e90ed2dd;hb=HEAD;hp=90b63d48e0d93ba9d94068b1e2ef469bcd6c6fe8;hpb=39d4ad692d933ff9d430ac98527cb429aee134e4;p=dot-emacs diff --git a/misc-disabled.el b/misc-disabled.el index 90b63d4..0a7c5b3 100644 --- a/misc-disabled.el +++ b/misc-disabled.el @@ -389,3 +389,103 @@ (global-set-key (kbd "") 'mark-defun) (global-set-key (kbd "") 'ibuffer) (global-set-key (kbd "") '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)) + + + + +;; alias the new `flymake-report-status-slim' to +;; `flymake-report-status' +(defalias 'flymake-report-status 'flymake-report-status-slim) +(defun flymake-report-status-slim (e-w &optional status) + "Show \"slim\" flymake status in mode line." + (when e-w + (setq flymake-mode-line-e-w e-w)) + (when status + (setq flymake-mode-line-status status)) + (let* ((mode-line " Φ")) + (when (> (length flymake-mode-line-e-w) 0) + (setq mode-line (concat mode-line ":" flymake-mode-line-e-w))) + (setq mode-line (concat mode-line flymake-mode-line-status)) + (setq flymake-mode-line mode-line) + (force-mode-line-update))) + + + + +;; this seems like it could be useful, but I havent been using it, so disabled +;; from http://www.emacswiki.org/emacs/TransposeWindows +(setq swapping-buffer nil) +(setq swapping-window nil) +(defun swap-buffers-in-windows () + "Swap buffers between two windows" + (interactive) + (if (and swapping-window + swapping-buffer) + (let ((this-buffer (current-buffer)) + (this-window (selected-window))) + (if (and (window-live-p swapping-window) + (buffer-live-p swapping-buffer)) + (progn (switch-to-buffer swapping-buffer) + (select-window swapping-window) + (switch-to-buffer this-buffer) + (select-window this-window) + (message "Swapped buffers.")) + (message "Old buffer/window killed. Aborting.")) + (setq swapping-buffer nil) + (setq swapping-window nil)) + (progn + (setq swapping-buffer (current-buffer)) + (setq swapping-window (selected-window)) + (message "Buffer and window marked for swapping.")))) + +(global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)