mu4e and load-dir.
This commit is contained in:
parent
6a76743ad5
commit
465abf6de2
18
init.el
18
init.el
@ -86,7 +86,7 @@
|
|||||||
(defvar packages-eager
|
(defvar packages-eager
|
||||||
'(popup auto-complete yasnippet cl-lib exec-path-from-shell paradox slime
|
'(popup auto-complete yasnippet cl-lib exec-path-from-shell paradox slime
|
||||||
xclip dired+ ctags ctags-update aggressive-indent imenu+ neotree diminish
|
xclip dired+ ctags ctags-update aggressive-indent imenu+ neotree diminish
|
||||||
gist load-dir))
|
gist))
|
||||||
|
|
||||||
(use-packages packages-eager)
|
(use-packages packages-eager)
|
||||||
|
|
||||||
@ -233,6 +233,7 @@ buffer is not visiting a file."
|
|||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
(global-linum-mode t)
|
(global-linum-mode t)
|
||||||
(setq visible-bell nil)
|
(setq visible-bell nil)
|
||||||
|
(show-paren-mode 1)
|
||||||
|
|
||||||
;; Make buffer names unique.
|
;; Make buffer names unique.
|
||||||
(setq uniquify-buffer-name-style 'forward)
|
(setq uniquify-buffer-name-style 'forward)
|
||||||
@ -255,6 +256,11 @@ buffer is not visiting a file."
|
|||||||
;; Make mouse scrolling less jumpy.
|
;; Make mouse scrolling less jumpy.
|
||||||
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
|
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
|
||||||
|
|
||||||
|
(use-package load-dir
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(progn (add-to-list 'load-dirs "~/.emacs.d/load.d")))
|
||||||
|
|
||||||
(use-package tramp
|
(use-package tramp
|
||||||
:commands tramp
|
:commands tramp
|
||||||
:config
|
:config
|
||||||
@ -272,7 +278,7 @@ buffer is not visiting a file."
|
|||||||
:ensure t
|
:ensure t
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq guide-key/guide-key-sequence '("C-c" "C-c p" "C-x C-k" "C-x r"))
|
(setq guide-key/guide-key-sequence '("C-c" "C-c p" "C-x C-k" "C-x r" "C-x c"))
|
||||||
(guide-key-mode 1)
|
(guide-key-mode 1)
|
||||||
(setq guide-key/idle-delay 0.25)
|
(setq guide-key/idle-delay 0.25)
|
||||||
(setq guide-key/recursive-key-sequence-flag t)
|
(setq guide-key/recursive-key-sequence-flag t)
|
||||||
@ -324,7 +330,8 @@ buffer is not visiting a file."
|
|||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(diminish 'magit-auto-revert-mode)
|
(diminish 'magit-auto-revert-mode)
|
||||||
(use-package magit-filenotify ;; Seems like OSX does not properly supoort this.
|
(use-package magit-filenotify
|
||||||
|
;; Seems like OSX does not properly this.
|
||||||
:disabled t
|
:disabled t
|
||||||
:ensure t
|
:ensure t
|
||||||
:if (emacs24_4-p)
|
:if (emacs24_4-p)
|
||||||
@ -400,8 +407,7 @@ buffer is not visiting a file."
|
|||||||
|
|
||||||
(use-package org
|
(use-package org
|
||||||
:ensure t
|
:ensure t
|
||||||
:defer t
|
:commands org-mode
|
||||||
:commands org
|
|
||||||
:mode "\\.org\\'"
|
:mode "\\.org\\'"
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
@ -540,7 +546,7 @@ buffer is not visiting a file."
|
|||||||
(add-hook 'emacs-lisp-mode-hook 'flatten-current-imenu-index-function)
|
(add-hook 'emacs-lisp-mode-hook 'flatten-current-imenu-index-function)
|
||||||
(add-hook 'emacs-lisp-mode-hook (lambda () (setq indent-tabs-mode nil)))
|
(add-hook 'emacs-lisp-mode-hook (lambda () (setq indent-tabs-mode nil)))
|
||||||
(define-key lisp-mode-shared-map (kbd "C-c C-c") 'eval-defun)
|
(define-key lisp-mode-shared-map (kbd "C-c C-c") 'eval-defun)
|
||||||
(define-key lisp-mode-shared-map (kbd "C-c C-f") 'find-function-at-point)
|
(define-key lisp-mode-shared-map (kbd "C-c C-f") 'find-function)
|
||||||
(define-key lisp-mode-shared-map (kbd "C-c C-r") 'eval-and-replace)
|
(define-key lisp-mode-shared-map (kbd "C-c C-r") 'eval-and-replace)
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
|
@ -1,92 +1,87 @@
|
|||||||
;;; package -- Summary
|
;; (setq imenu-max-item-length 2000)
|
||||||
|
;; (setq imenu-space-replacement nil)
|
||||||
;;; Commentary:
|
;; (setq scala-imenu:build-imenu-candidate 'ensime-imenu)
|
||||||
|
;; (setq scala-imenu:should-flatten-index t)
|
||||||
;;; Code:
|
;; (defvar ensime-imenu-cache nil)
|
||||||
(setq imenu-max-item-length 2000)
|
;; (add-to-list 'scala-imenu:cleanup-hooks (lambda () (setq ensime-imenu-cache nil)))
|
||||||
(setq imenu-space-replacement nil)
|
|
||||||
(setq scala-imenu:build-imenu-candidate 'ensime-imenu)
|
|
||||||
(setq scala-imenu:should-flatten-index t)
|
|
||||||
(defvar ensime-imenu-cache nil)
|
|
||||||
(add-to-list 'scala-imenu:cleanup-hooks (lambda () (setq ensime-imenu-cache nil)))
|
|
||||||
|
|
||||||
|
|
||||||
(defun ensime-imenu (member-name definition-type marker parents)
|
;; (defun ensime-imenu (member-name definition-type marker parents)
|
||||||
`(,(ensime-imenu-string member-name definition-type marker parents) .
|
;; `(,(ensime-imenu-string member-name definition-type marker parents) .
|
||||||
,marker))
|
;; ,marker))
|
||||||
|
|
||||||
(defun ensime-imenu-string (member-name definition-type marker parents)
|
;; (defun ensime-imenu-string (member-name definition-type marker parents)
|
||||||
(let ((scala-imenu-string (car (scala-imenu:default-build-imenu-candidate
|
;; (let ((scala-imenu-string (car (scala-imenu:default-build-imenu-candidate
|
||||||
member-name definition-type marker parents))))
|
;; member-name definition-type marker parents))))
|
||||||
(if (equal definition-type "def")
|
;; (if (equal definition-type "def")
|
||||||
(let ((ensime-type-string
|
;; (let ((ensime-type-string
|
||||||
(get-ensime-type member-name definition-type marker parents)))
|
;; (get-ensime-type member-name definition-type marker parents)))
|
||||||
(message ensime-type-string)
|
;; (message ensime-type-string)
|
||||||
(format "%s%s" scala-imenu-string ensime-type-string))
|
;; (format "%s%s" scala-imenu-string ensime-type-string))
|
||||||
scala-imenu-string)))
|
;; scala-imenu-string)))
|
||||||
|
|
||||||
(defun get-ensime-type (member-name definition-type marker parents)
|
;; (defun get-ensime-type (member-name definition-type marker parents)
|
||||||
(let ((parent-name (caar parents))
|
;; (let ((parent-name (caar parents))
|
||||||
(parent-marker (caddar parents)))
|
;; (parent-marker (caddar parents)))
|
||||||
(build-method-type
|
;; (build-method-type
|
||||||
(plist-get (type-info member-name parent-name parent-marker) :type))))
|
;; (plist-get (type-info member-name parent-name parent-marker) :type))))
|
||||||
|
|
||||||
(defun build-method-type (type-info)
|
;; (defun build-method-type (type-info)
|
||||||
(format "%s: %s"
|
;; (format "%s: %s"
|
||||||
(build-argument-lists (plist-get type-info :param-sections))
|
;; (build-argument-lists (plist-get type-info :param-sections))
|
||||||
(build-type-string (plist-get type-info :result-type))))
|
;; (build-type-string (plist-get type-info :result-type))))
|
||||||
|
|
||||||
(defun build-argument-lists (param-list-infos)
|
;; (defun build-argument-lists (param-list-infos)
|
||||||
(mapconcat 'build-argument-list param-list-infos ""))
|
;; (mapconcat 'build-argument-list param-list-infos ""))
|
||||||
|
|
||||||
(defun build-argument-list (param-list-info)
|
;; (defun build-argument-list (param-list-info)
|
||||||
(format "(%s)" (mapconcat 'build-argument-string
|
;; (format "(%s)" (mapconcat 'build-argument-string
|
||||||
(plist-get param-list-info :params) ", ")))
|
;; (plist-get param-list-info :params) ", ")))
|
||||||
|
|
||||||
(defun build-argument-string (param-info)
|
;; (defun build-argument-string (param-info)
|
||||||
(format "%s: %s" (car param-info)
|
;; (format "%s: %s" (car param-info)
|
||||||
(build-type-string (cadr param-info))))
|
;; (build-type-string (cadr param-info))))
|
||||||
|
|
||||||
(defun build-type-string (type-info)
|
;; (defun build-type-string (type-info)
|
||||||
(let ((name (plist-get type-info :name))
|
;; (let ((name (plist-get type-info :name))
|
||||||
(type-args (plist-get type-info :type-args)))
|
;; (type-args (plist-get type-info :type-args)))
|
||||||
(format "%s%s" name
|
;; (format "%s%s" name
|
||||||
(if type-args
|
;; (if type-args
|
||||||
(format "[%s]" (mapconcat
|
;; (format "[%s]" (mapconcat
|
||||||
'build-type-string type-args ", ")) ""))))
|
;; 'build-type-string type-args ", ")) ""))))
|
||||||
|
|
||||||
(defun type-info (member-name type-name marker)
|
;; (defun type-info (member-name type-name marker)
|
||||||
(get-plist-by-keys '(:name) member-name
|
;; (get-plist-by-keys '(:name) member-name
|
||||||
(get-members type-name
|
;; (get-members type-name
|
||||||
(get-ensime-type-info-from-mark marker))))
|
;; (get-ensime-type-info-from-mark marker))))
|
||||||
|
|
||||||
(defun get-members (type-name type-info-plist)
|
;; (defun get-members (type-name type-info-plist)
|
||||||
(plist-get-deep (get-plist-by-keys
|
;; (plist-get-deep (get-plist-by-keys
|
||||||
'(:type :name) type-name
|
;; '(:type :name) type-name
|
||||||
(plist-get type-info-plist :interfaces)) '(:type :members)))
|
;; (plist-get type-info-plist :interfaces)) '(:type :members)))
|
||||||
|
|
||||||
(defun plist-get-deep (plist keys)
|
;; (defun plist-get-deep (plist keys)
|
||||||
(cl-reduce 'plist-get keys :initial-value plist))
|
;; (cl-reduce 'plist-get keys :initial-value plist))
|
||||||
|
|
||||||
(defun get-plist-by-keys (keys value plist)
|
;; (defun get-plist-by-keys (keys value plist)
|
||||||
(cl-find value plist :test 'equal
|
;; (cl-find value plist :test 'equal
|
||||||
:key (lambda (member)
|
;; :key (lambda (member)
|
||||||
(plist-get-deep member keys))))
|
;; (plist-get-deep member keys))))
|
||||||
|
|
||||||
(defun get-ensime-type-info-from-mark (marker)
|
;; (defun get-ensime-type-info-from-mark (marker)
|
||||||
(let ((cached-value (assoc marker ensime-imenu-cache)))
|
;; (let ((cached-value (assoc marker ensime-imenu-cache)))
|
||||||
(when (not cached-value)
|
;; (when (not cached-value)
|
||||||
(progn (setq cached-value
|
;; (progn (setq cached-value
|
||||||
`(,marker . ,(ensime-rpc-inspect-type-at-range (get-eol-range marker))))
|
;; `(,marker . ,(ensime-rpc-inspect-type-at-range (get-eol-range marker))))
|
||||||
(setq ensime-imenu-cache (cons cached-value ensime-imenu-cache))))
|
;; (setq ensime-imenu-cache (cons cached-value ensime-imenu-cache))))
|
||||||
(cdr cached-value)))
|
;; (cdr cached-value)))
|
||||||
|
|
||||||
(defun get-eol-range (marker)
|
;; (defun get-eol-range (marker)
|
||||||
(interactive)
|
;; (interactive)
|
||||||
`(,(marker-position marker)
|
;; `(,(marker-position marker)
|
||||||
,(save-excursion (goto-char marker) (end-of-line) (point))))
|
;; ,(save-excursion (goto-char marker) (end-of-line) (point))))
|
||||||
|
|
||||||
(defun msg-type-info ()
|
;; (defun msg-type-info ()
|
||||||
(interactive)
|
;; (interactive)
|
||||||
(message "%s" (build-method-type
|
;; (message "%s" (build-method-type
|
||||||
(plist-get (type-info "testFunction" "DFA" (point-marker)) :type))))
|
;; (plist-get (type-info "testFunction" "DFA" (point-marker)) :type))))
|
||||||
|
59
load.d/mu4e.el
Normal file
59
load.d/mu4e.el
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
(use-package s :ensure t)
|
||||||
|
(add-to-list 'load-path (s-trim (shell-command-to-string "mu4e_directory")))
|
||||||
|
|
||||||
|
(use-package mu4e
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setq mu4e-maildir "~/Mail")
|
||||||
|
|
||||||
|
(setq mu4e-drafts-folder "/[Gmail].Drafts")
|
||||||
|
(setq mu4e-sent-folder "/[Gmail].Sent Mail")
|
||||||
|
(setq mu4e-trash-folder "/[Gmail].Trash")
|
||||||
|
|
||||||
|
;; don't save message to Sent Messages, Gmail/IMAP takes care of this
|
||||||
|
(setq mu4e-sent-messages-behavior 'delete)
|
||||||
|
|
||||||
|
;; setup some handy shortcuts
|
||||||
|
;; you can quickly switch to your Inbox -- press ``ji''
|
||||||
|
;; then, when you want archive some messages, move them to
|
||||||
|
;; the 'All Mail' folder by pressing ``ma''.
|
||||||
|
|
||||||
|
(setq mu4e-maildir-shortcuts
|
||||||
|
'( ("/INBOX" . ?i)
|
||||||
|
("/[Gmail].Sent Mail" . ?s)
|
||||||
|
("/[Gmail].Trash" . ?t)
|
||||||
|
("/[Gmail].All Mail" . ?a)))
|
||||||
|
|
||||||
|
;; allow for updating mail using 'U' in the main view:
|
||||||
|
(setq mu4e-get-mail-command "offlineimap")
|
||||||
|
|
||||||
|
;; ;; something about ourselves
|
||||||
|
;; (setq
|
||||||
|
;; mu4e-compose-signature
|
||||||
|
;; (concat
|
||||||
|
;; "Foo X. Bar\n"
|
||||||
|
;; "http://www.example.com\n"))
|
||||||
|
|
||||||
|
;; sending mail -- replace USERNAME with your gmail username
|
||||||
|
;; also, make sure the gnutls command line utils are installed
|
||||||
|
;; package 'gnutls-bin' in Debian/Ubuntu
|
||||||
|
|
||||||
|
(require 'smtpmail)
|
||||||
|
;; (setq message-send-mail-function 'smtpmail-send-it
|
||||||
|
;; starttls-use-gnutls t
|
||||||
|
;; smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
|
||||||
|
;; smtpmail-auth-credentials
|
||||||
|
;; '(("smtp.gmail.com" 587 "USERNAME@gmail.com" nil))
|
||||||
|
;; smtpmail-default-smtp-server "smtp.gmail.com"
|
||||||
|
;; smtpmail-smtp-server "smtp.gmail.com"
|
||||||
|
;; smtpmail-smtp-service 587)
|
||||||
|
|
||||||
|
;; alternatively, for emacs-24 you can use:
|
||||||
|
(setq message-send-mail-function 'smtpmail-send-it
|
||||||
|
smtpmail-stream-type 'starttls
|
||||||
|
smtpmail-default-smtp-server "smtp.gmail.com"
|
||||||
|
smtpmail-smtp-server "smtp.gmail.com"
|
||||||
|
smtpmail-smtp-service 587)
|
||||||
|
|
||||||
|
;; don't keep message buffers around
|
||||||
|
(setq message-kill-buffer-on-exit t)))
|
@ -1,124 +0,0 @@
|
|||||||
;; Taken from https://github.com/magnars/.emacs.d/blob/master/setup-slime-js.el
|
|
||||||
;; js2-refactor is commented out
|
|
||||||
|
|
||||||
;; Set up slime-js
|
|
||||||
;;
|
|
||||||
;; To install, see https://github.com/swank-js/swank-js/wiki/Installation
|
|
||||||
;;
|
|
||||||
;; This is what I did:
|
|
||||||
;;
|
|
||||||
;; npm install swank-js -g
|
|
||||||
;; M-x package-install slime-js
|
|
||||||
;;
|
|
||||||
;; The slime-js version in marmalade requires swank 2010.04.04, or at least
|
|
||||||
;; one prior to the breaking change in 2011.
|
|
||||||
;;
|
|
||||||
;; It also requires js2-mode, which is a good choice in either case. I highly
|
|
||||||
;; recommend this fork:
|
|
||||||
;;
|
|
||||||
;; https://github.com/mooz/js2-mode
|
|
||||||
;;
|
|
||||||
;; My settings found in this file also requires js2-refactor:
|
|
||||||
;;
|
|
||||||
;; https://github.com/magnars/js2-refactor.el
|
|
||||||
;;
|
|
||||||
;; I have included this file in init.el like so:
|
|
||||||
;;
|
|
||||||
;; (add-hook 'after-init-hook
|
|
||||||
;; #'(lambda ()
|
|
||||||
;; (when (locate-library "slime-js")
|
|
||||||
;; (require 'setup-slime-js))))
|
|
||||||
;;
|
|
||||||
|
|
||||||
(require 'slime)
|
|
||||||
(require 'slime-js)
|
|
||||||
;(require 'js2-refactor)
|
|
||||||
|
|
||||||
(set-default 'slime-js-target-url "http://localhost:3000")
|
|
||||||
(set-default 'slime-js-connect-url "http://localhost:8009")
|
|
||||||
(set-default 'slime-js-starting-url "/")
|
|
||||||
(set-default 'slime-js-swank-command "swank-js")
|
|
||||||
(set-default 'slime-js-swank-args '())
|
|
||||||
(set-default 'slime-js-browser-command "open -v \"Google Chrome\"")
|
|
||||||
(set-default 'slime-js-browser-jacked-in-p nil)
|
|
||||||
|
|
||||||
(add-hook 'js2-mode-hook (lambda () (slime-js-minor-mode 1)))
|
|
||||||
|
|
||||||
(defun slime-js-run-swank ()
|
|
||||||
"Runs the swank side of the equation."
|
|
||||||
(interactive)
|
|
||||||
(apply #'make-comint "swank-js" slime-js-swank-command nil slime-js-swank-args))
|
|
||||||
|
|
||||||
(defun slime-js-jack-in-node ()
|
|
||||||
"Start a swank-js server and connect to it, opening a repl."
|
|
||||||
(interactive)
|
|
||||||
(slime-js-run-swank)
|
|
||||||
(sleep-for 1)
|
|
||||||
(setq slime-protocol-version 'ignore)
|
|
||||||
(slime-connect "localhost" 4005))
|
|
||||||
|
|
||||||
(defun slime-js-jack-in-browser ()
|
|
||||||
"Start a swank-js server, connect to it, open a repl, open a browser, connect to that."
|
|
||||||
(interactive)
|
|
||||||
(slime-js-jack-in-node)
|
|
||||||
(sleep-for 2)
|
|
||||||
(slime-js-set-target-url slime-js-target-url)
|
|
||||||
(shell-command (concat slime-js-browser-command " " slime-js-connect-url slime-js-starting-url))
|
|
||||||
(sleep-for 3)
|
|
||||||
(setq slime-remote-history nil)
|
|
||||||
(slime-js-sticky-select-remote (caadr (slime-eval '(js:list-remotes))))
|
|
||||||
(setq slime-js-browser-jacked-in-p t)
|
|
||||||
(global-set-key [f5] 'slime-js-reload))
|
|
||||||
|
|
||||||
(defadvice save-buffer (after save-css-buffer activate)
|
|
||||||
(when (and slime-js-browser-jacked-in-p (eq major-mode 'css-mode))
|
|
||||||
(slime-js-refresh-css)))
|
|
||||||
|
|
||||||
(defun js2-eval-friendly-node-p (n)
|
|
||||||
(or (and (js2-stmt-node-p n) (not (js2-block-node-p n)))
|
|
||||||
(and (js2-function-node-p n) (js2-function-node-name n))))
|
|
||||||
|
|
||||||
(defun slime-js--echo-result (result &rest _)
|
|
||||||
(message result))
|
|
||||||
|
|
||||||
(defun slime-js--replace-with-result (replacement beg end)
|
|
||||||
(save-excursion
|
|
||||||
(goto-char beg)
|
|
||||||
(delete-char (- end beg))
|
|
||||||
(insert replacement)))
|
|
||||||
|
|
||||||
(defun slime-js-eval-region (beg end &optional func)
|
|
||||||
(lexical-let ((func (or func 'slime-js--echo-result))
|
|
||||||
(beg beg)
|
|
||||||
(end end))
|
|
||||||
(slime-flash-region beg end)
|
|
||||||
(slime-js-eval
|
|
||||||
(buffer-substring-no-properties beg end)
|
|
||||||
#'(lambda (s) (funcall func (cadr s) beg end)))))
|
|
||||||
|
|
||||||
(defun slime-js-eval-statement (&optional func)
|
|
||||||
(let ((node (js2r--closest 'js2-eval-friendly-node-p)))
|
|
||||||
(slime-js-eval-region (js2-node-abs-pos node)
|
|
||||||
(js2-node-abs-end node)
|
|
||||||
func)))
|
|
||||||
|
|
||||||
(defun slime-js-eval-current ()
|
|
||||||
(interactive)
|
|
||||||
(if (use-region-p)
|
|
||||||
(slime-js-eval-region (point) (mark))
|
|
||||||
(slime-js-eval-statement)))
|
|
||||||
|
|
||||||
(defun slime-js-eval-and-replace-current ()
|
|
||||||
(interactive)
|
|
||||||
(if (use-region-p)
|
|
||||||
(slime-js-eval-region (point) (mark) 'slime-js--replace-with-result)
|
|
||||||
(slime-js-eval-statement 'slime-js--replace-with-result)))
|
|
||||||
|
|
||||||
(define-key slime-js-minor-mode-map (kbd "C-x C-e") 'slime-js-eval-current)
|
|
||||||
(define-key slime-js-minor-mode-map (kbd "C-c C-e") 'slime-js-eval-and-replace-current)
|
|
||||||
|
|
||||||
;; Remove slime-minor-mode from mode line if diminish.el is installed
|
|
||||||
(when (boundp 'diminish)
|
|
||||||
(diminish 'slime-js-minor-mode))
|
|
||||||
|
|
||||||
(provide 'setup-slime-js)
|
|
Loading…
Reference in New Issue
Block a user