This commit is contained in:
Ivan Malison 2014-11-21 06:25:11 -08:00
parent 5759aa7ec6
commit 5d386c4b76

54
init.el
View File

@ -103,15 +103,15 @@
(defvar packages-other (defvar packages-other
'(thingatpt+ latex-preview-pane paredit inf-ruby rust-mode paradox '(thingatpt+ latex-preview-pane paredit inf-ruby rust-mode paradox
exec-path-from-shell slime yaml-mode sgml-mode exec-path-from-shell slime yaml-mode sgml-mode
dired+ ctags ctags-update helm-gtags hackernews gitconfig-mode dired+ ctags ctags-update helm-gtags hackernews gitconfig-mode
aggressive-indent imenu+ weechat evil helm-ag xclip neotree aggressive-indent imenu+ weechat evil helm-ag xclip neotree
magit-gh-pulls diminish gist spotify ghc)) magit-gh-pulls diminish gist spotify ghc))
(defvar packages-appearance (defvar packages-appearance
'(monokai-theme solarized-theme zenburn-theme base16-theme molokai-theme '(monokai-theme solarized-theme zenburn-theme base16-theme molokai-theme
tango-2-theme gotham-theme sublime-themes ansi-color rainbow-delimiters tango-2-theme gotham-theme sublime-themes ansi-color rainbow-delimiters
smart-mode-line powerline)) smart-mode-line powerline))
(ensure-packages-installed packages-essential) (ensure-packages-installed packages-essential)
(ensure-packages-installed packages-other) (ensure-packages-installed packages-other)
@ -145,8 +145,8 @@ buffer is not visiting a file."
(defun frame-exists () (defun frame-exists ()
(cl-find-if (lambda (frame) (cl-find-if (lambda (frame)
(assoc 'display (frame-parameters frame))) (assoc 'display (frame-parameters frame)))
(frame-list))) (frame-list)))
(defun make-frame-if-none-exists () (defun make-frame-if-none-exists ()
(let* ((existing-frame (frame-exists))) (let* ((existing-frame (frame-exists)))
@ -173,7 +173,8 @@ buffer is not visiting a file."
(defun open-pdf () (defun open-pdf ()
(interactive) (interactive)
(let ( (pdf-file (replace-regexp-in-string "\.tex$" ".pdf" buffer-file-name))) (let ( (pdf-file (replace-regexp-in-string
"\.tex$" ".pdf" buffer-file-name)))
(shell-command (concat "open " pdf-file)))) (shell-command (concat "open " pdf-file))))
(defun tmux-copy (&optional b e) (defun tmux-copy (&optional b e)
@ -190,17 +191,20 @@ buffer is not visiting a file."
(insert (current-kill 0))))) (insert (current-kill 0)))))
(defun flatten-imenu-index (index) (defun flatten-imenu-index (index)
(cl-mapcan (lambda (x) (if (listp (cdr x)) (cl-mapcan
(cl-mapcar (lambda (item) (lambda (x)
`(,(concat (car x) "/" (car item)) . ,(cdr item))) (if (listp (cdr x))
(flatten-imenu-index (cdr x))) (cl-mapcar (lambda (item)
(list x))) index)) `(,(concat (car x) "/" (car item)) . ,(cdr item)))
(flatten-imenu-index (cdr x)))
(list x))) index))
(defun flatten-imenu-index-function (function) (defun flatten-imenu-index-function (function)
(lambda () (flatten-imenu-index (funcall function)))) (lambda () (flatten-imenu-index (funcall function))))
(defun flatten-current-imenu-index-function () (defun flatten-current-imenu-index-function ()
(setq imenu-create-index-function (flatten-imenu-index-function imenu-create-index-function))) (setq imenu-create-index-function
(flatten-imenu-index-function imenu-create-index-function)))
;; ============================================================================= ;; =============================================================================
;; General Emacs Options ;; General Emacs Options
@ -350,12 +354,14 @@ buffer is not visiting a file."
(use-package org (use-package org
:ensure t :ensure t
:init :init
(defun guide-key/my-hook-function-for-org-mode () (progn
(guide-key/add-local-guide-key-sequence "C-c") (defun guide-key/my-hook-function-for-org-mode ()
(guide-key/add-local-guide-key-sequence "C-c C-x") (guide-key/add-local-guide-key-sequence "C-c")
(guide-key/add-local-highlight-command-regexp "org-")) (guide-key/add-local-guide-key-sequence "C-c C-x")
(add-hook 'org-mode-hook 'guide-key/my-hook-function-for-org-mode) (guide-key/add-local-highlight-command-regexp "org-"))
(add-hook 'org-mode-hook (lambda () (linum-mode 0)))) (add-hook 'org-mode-hook 'guide-key/my-hook-function-for-org-mode)
(add-hook 'org-mode-hook (lambda () (linum-mode 0)))
(define-key mode-specific-map [?a] 'org-agenda)))
(use-package epg (use-package epg
:ensure t :ensure t
@ -421,6 +427,7 @@ buffer is not visiting a file."
(progn (helm-projectile-on))))) (progn (helm-projectile-on)))))
(ido-mode t) (ido-mode t)
(ido-ubiquitous-mode)
(ido-everywhere 1) (ido-everywhere 1)
(setq ido-enable-flex-matching t) (setq ido-enable-flex-matching t)
@ -443,7 +450,10 @@ buffer is not visiting a file."
(setq imenu-prev-index-position-function nil) (setq imenu-prev-index-position-function nil)
(setq imenu-space-replacement nil) (setq imenu-space-replacement nil)
(add-to-list 'imenu-generic-expression (add-to-list 'imenu-generic-expression
`("Sections" `("Package"
,"(use-package \\(.+\\)$" 1))
(add-to-list 'imenu-generic-expression
`("Section"
,(concat ";\\{1,4\\} =\\{10,80\\}\n;\\{1,4\\} \\{10,80\\}" ,(concat ";\\{1,4\\} =\\{10,80\\}\n;\\{1,4\\} \\{10,80\\}"
"\\(.+\\)$") 1) t)) "\\(.+\\)$") 1) t))