conf

changeset 373:ffe4e1596fa9

more emacs goodness
author Alexander Solovyov <alexander@solovyov.net>
date Mon Nov 07 16:27:53 2011 +0200
parents 8d3fc57e99ac
children 9457c5368e4d
files .emacs.d/load/funs_init.el .emacs.d/load/keys_init.el .emacs.d/load/modes_init.el
diffstat 3 files changed, 120 insertions(+), 30 deletions(-) [+]
line diff
     1.1 --- a/.emacs.d/load/funs_init.el	Tue Oct 18 18:50:35 2011 +0300
     1.2 +++ b/.emacs.d/load/funs_init.el	Mon Nov 07 16:27:53 2011 +0200
     1.3 @@ -253,3 +253,52 @@
     1.4    (let ((path (file-truename (or (buffer-file-name) default-directory))))
     1.5      (kill-new path)
     1.6      (message "%s" path)))
     1.7 +
     1.8 +(defun prh:isearch-word-at-point ()
     1.9 +  (interactive)
    1.10 +  (call-interactively 'isearch-forward-regexp))
    1.11 +
    1.12 +(defun prh:isearch-yank-word-hook ()
    1.13 +  (when (equal this-command 'prh:isearch-word-at-point)
    1.14 +    (let ((string (concat "\\_<"
    1.15 +                          (buffer-substring-no-properties
    1.16 +                           (progn (skip-syntax-backward "w_") (point))
    1.17 +                           (progn (skip-syntax-forward "w_") (point)))
    1.18 +                          "\\_>")))
    1.19 +      (if (and isearch-case-fold-search
    1.20 +               (eq 'not-yanks search-upper-case))
    1.21 +          (setq string (downcase string)))
    1.22 +      (setq isearch-string string
    1.23 +            isearch-message
    1.24 +            (concat isearch-message
    1.25 +                    (mapconcat 'isearch-text-char-description
    1.26 +                               string ""))
    1.27 +            isearch-yank-flag t)
    1.28 +      (isearch-search-and-update))))
    1.29 +
    1.30 +(add-hook 'isearch-mode-hook 'prh:isearch-yank-word-hook)
    1.31 +
    1.32 +(defun reverse-input-method (input-method)
    1.33 +  "Build the reverse mapping of single letters from INPUT-METHOD."
    1.34 +  (interactive
    1.35 +   (list (read-input-method-name "Use input method (default current): ")))
    1.36 +  (if (and input-method (symbolp input-method))
    1.37 +      (setq input-method (symbol-name input-method)))
    1.38 +  (let ((current current-input-method)
    1.39 +        (modifiers '(nil (control) (meta) (control meta))))
    1.40 +    (when input-method
    1.41 +      (activate-input-method input-method))
    1.42 +    (when (and current-input-method quail-keyboard-layout)
    1.43 +      (dolist (map (cdr (quail-map)))
    1.44 +        (let* ((to (car map))
    1.45 +               (from (quail-get-translation
    1.46 +                      (cadr map) (char-to-string to) 1)))
    1.47 +          (when (and (characterp from) (characterp to))
    1.48 +            (dolist (mod modifiers)
    1.49 +              (define-key function-key-map
    1.50 +                (vector (append mod (list from)))
    1.51 +                (vector (append mod (list to)))))))))
    1.52 +    (when input-method
    1.53 +      (activate-input-method current))))
    1.54 +
    1.55 +(reverse-input-method 'cyrillic-jcuken)
     2.1 --- a/.emacs.d/load/keys_init.el	Tue Oct 18 18:50:35 2011 +0300
     2.2 +++ b/.emacs.d/load/keys_init.el	Mon Nov 07 16:27:53 2011 +0200
     2.3 @@ -51,6 +51,7 @@
     2.4  ;; windows
     2.5  (global-set-key (kbd "M-`") 'other-frame)
     2.6  (global-set-key (kbd "M-o") 'other-window)
     2.7 +(define-key dired-mode-map (kbd "M-o") 'other-window)
     2.8  (global-set-key (kbd "M-1") 'delete-other-windows)
     2.9  (global-set-key (kbd "M-2") 'split-window-vertically)
    2.10  (global-set-key (kbd "M-3") 'split-window-horizontally)
     3.1 --- a/.emacs.d/load/modes_init.el	Tue Oct 18 18:50:35 2011 +0300
     3.2 +++ b/.emacs.d/load/modes_init.el	Mon Nov 07 16:27:53 2011 +0200
     3.3 @@ -102,7 +102,8 @@
     3.4          python-mode-hook
     3.5          lua-mode-hook
     3.6          coffee-mode-hook
     3.7 -        js-mode-hook))
     3.8 +        js-mode-hook
     3.9 +        go-mode-hook))
    3.10  (dolist (hook hooks-with-whitespaces) (add-hook hook 'whitespace-mode))
    3.11  
    3.12  (setq hooks-want-short-lines
    3.13 @@ -120,13 +121,16 @@
    3.14             (setq fic-highlighted-words '("FIXME" "TODO" "BUG" "NOTE"))
    3.15             (dolist (hook '(python-mode-hook
    3.16                             emacs-lisp-mode-hook
    3.17 -                           coffee-mode))
    3.18 +                           coffee-mode-hook))
    3.19               (add-hook hook 'fic-ext-mode)))))
    3.20  
    3.21  ;; major modes
    3.22  
    3.23  (el-get-add
    3.24 - (:name markdown-mode))
    3.25 + (:name markdown-mode
    3.26 +  :after (lambda ()
    3.27 +           (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
    3.28 +           (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)))))
    3.29  
    3.30  (el-get-add
    3.31   (:name wikipedia-mode))
    3.32 @@ -150,6 +154,14 @@
    3.33  (el-get-add
    3.34   (:name go-mode))
    3.35  
    3.36 +(el-get-add
    3.37 + (:name haml-mode))
    3.38 +
    3.39 +(el-get-add
    3.40 + (:name sass-mode
    3.41 +  :after (lambda ()
    3.42 +           (add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode)))))
    3.43 +
    3.44  ;;;;;;;;;
    3.45  ;; Python
    3.46  ;;;;;;;;;
    3.47 @@ -170,12 +182,6 @@
    3.48  (add-hook 'python-mode-hook (lambda () (setq imenu-create-index-function
    3.49                                          'python-imenu-create-index)))
    3.50  
    3.51 -(add-hook 'python-mode-hook
    3.52 -          (lambda ()
    3.53 -            (if (or (string-prefix-p "/Users/piranha/dev/work" (buffer-file-name))
    3.54 -                    (string-prefix-p "/Volumes/paylogic" (buffer-file-name)))
    3.55 -                (set (make-local-variable 'whitespace-line-column) 120))))
    3.56 -
    3.57  ;;;;;;;;;;
    3.58  ;; Flymake
    3.59  ;;;;;;;;;;
    3.60 @@ -196,25 +202,10 @@
    3.61                            (file-name-directory buffer-file-name))))
    3.62          (list "pyflakes" (list local-file)))))
    3.63  
    3.64 -  (defun flymake-lua-init ()
    3.65 -    "Invoke luac with '-p' to get syntax checking"
    3.66 -    (when (buffer-is-local)
    3.67 -      (let* ((temp-file (flymake-init-create-temp-buffer-copy
    3.68 -                         'flymake-create-temp-inplace))
    3.69 -             (local-file (file-relative-name
    3.70 -                          temp-file
    3.71 -                          (file-name-directory buffer-file-name))))
    3.72 -        (list "luac" (list "-p" local-file)))))
    3.73 -
    3.74    (add-to-list 'flymake-allowed-file-name-masks
    3.75 -               '("\\.py\\'" flymake-pyflakes-init))
    3.76 -  (add-to-list 'flymake-allowed-file-name-masks
    3.77 -               '("\\.lua\\'" flymake-lua-init))
    3.78 -  (push '("^.*luac[0-9.]*\\(.exe\\)?: *\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 2 3 nil 4)
    3.79 -        flymake-err-line-patterns))
    3.80 +               '("\\.py\\'" flymake-pyflakes-init)))
    3.81  
    3.82  (add-hook 'python-mode-hook '(lambda () (flymake-mode 1)))
    3.83 -(add-hook 'lua-mode-hook '(lambda () (flymake-mode 1)))
    3.84  
    3.85  (push '("\\([^:]+\\):\\([0-9]+\\)\\(([0-9]+)\\)?: \\[.\\] \\(.*\\)"
    3.86          1 2 3 4)
    3.87 @@ -225,6 +216,9 @@
    3.88                      :underline "orange")
    3.89  
    3.90  (el-get-add
    3.91 + (:name flymake-lua))
    3.92 +
    3.93 +(el-get-add
    3.94   (:name flymake-point
    3.95    :features flymake-point))
    3.96  
    3.97 @@ -244,6 +238,11 @@
    3.98    '(progn
    3.99       (define-key js-mode-map (kbd "RET") 'newline-maybe-indent)))
   3.100  
   3.101 +(add-hook 'js-mode-hook
   3.102 +          (lambda ()
   3.103 +            (if (string-prefix-p "/Users/piranha/dev/work" (buffer-file-name))
   3.104 +                (set (make-local-variable 'js-indent-level) 2))))
   3.105 +
   3.106  ;; argh, this one wants 'npm install formidable'
   3.107  (el-get-add
   3.108   (:name jshint-mode
   3.109 @@ -255,11 +254,16 @@
   3.110  ;; Coffee
   3.111  
   3.112  (el-get-add
   3.113 - (:name coffee-mode))
   3.114 -
   3.115 -(eval-after-load "coffee-mode"
   3.116 -  '(progn
   3.117 -     (define-key coffee-mode-map (kbd "C-]") "@$.")))
   3.118 + (:name coffee-mode
   3.119 +  :after (lambda ()
   3.120 +           (add-hook 'coffee-mode-hook
   3.121 +                     (lambda ()
   3.122 +                       (define-key coffee-mode-map (kbd "C-]") "@$.")
   3.123 +                       (if (string-prefix-p "/Users/piranha/dev/work"
   3.124 +                                            (buffer-file-name))
   3.125 +                           (progn
   3.126 +                             (set (make-local-variable 'tab-width) 2)
   3.127 +                             (set (make-local-variable 'coffee-tab-width) 2))))))))
   3.128  
   3.129  ;; Snippets
   3.130  
   3.131 @@ -336,6 +340,10 @@
   3.132                      :root-contains-files ("index.html" "settings.cfg")
   3.133                      :filename-regex ,(regexify-ext-list '(html js css cfg))
   3.134                      :exlude-paths '("_build"))
   3.135 +                   ("webfs"
   3.136 +                    :root-contains-files ("Cakefile" "config.yaml")
   3.137 +                    :filename-regex ,(regexify-ext-list '(coffee eco sass yaml json html))
   3.138 +                    :exclude-paths '(".sass-cache"))
   3.139                     ("Generic Mercurial project"
   3.140                      :root-contains-files (".hg"))
   3.141                     ("Generic git project"
   3.142 @@ -461,3 +469,35 @@
   3.143  
   3.144             (delete '("\\.html?\\'" flymake-xml-init)
   3.145                     flymake-allowed-file-name-masks))))
   3.146 +
   3.147 +;; go
   3.148 +(add-hook 'go-mode-hook
   3.149 +          (lambda ()
   3.150 +            (set (make-local-variable 'whitespace-style)
   3.151 +                 '(face trailing lines-tail))))
   3.152 +
   3.153 +(el-get-add
   3.154 + (:name highlight-symbol
   3.155 +  :after (lambda ()
   3.156 +           (global-set-key (kbd "C-=") 'highlight-symbol-at-point)
   3.157 +           (global-set-key (kbd "C-c ]") 'highlight-symbol-next)
   3.158 +           (global-set-key (kbd "C-c [") 'highlight-symbol-prev))))
   3.159 +
   3.160 +(el-get-add
   3.161 + (:name less-css-mode
   3.162 +  :type http
   3.163 +  :url "http://jdhuntington.com/emacs/less-css-mode.el"
   3.164 +  :load "less-css-mode.el"))
   3.165 +
   3.166 +(el-get-add
   3.167 + (:name deft
   3.168 +  :type http
   3.169 +  :url "http://jblevins.org/projects/deft/deft.el"
   3.170 +  :features deft
   3.171 +  :after (lambda ()
   3.172 +           (setq deft-directory "~/Dropbox/PlainText/")
   3.173 +           (setq deft-text-mode 'markdown-mode))))
   3.174 +
   3.175 +
   3.176 +(el-get-add
   3.177 + (:name htmlize))
Repositories maintained by Alexander Solovyov