forked from colonelpanic/dotfiles
sauron and flyspell. Rudimentary alerting for erc.
This commit is contained in:
parent
465abf6de2
commit
0e8a2d65bf
143
init.el
143
init.el
@ -121,6 +121,10 @@
|
|||||||
(setq split-height-threshold nil)
|
(setq split-height-threshold nil)
|
||||||
(setq split-width-threshold 160)
|
(setq split-width-threshold 160)
|
||||||
|
|
||||||
|
;; No popup frames.
|
||||||
|
(setq ns-pop-up-frames nil)
|
||||||
|
(setq pop-up-frames nil)
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
;; functions
|
;; functions
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
@ -217,6 +221,16 @@ buffer is not visiting a file."
|
|||||||
(setq imenu-create-index-function
|
(setq imenu-create-index-function
|
||||||
(flatten-imenu-index-function imenu-create-index-function)))
|
(flatten-imenu-index-function imenu-create-index-function)))
|
||||||
|
|
||||||
|
(defun notification-center (title message)
|
||||||
|
(flet ((encfn (s) (encode-coding-string s (keyboard-coding-system))))
|
||||||
|
(shell-command
|
||||||
|
(format "osascript -e 'display notification \"%s\" with title \"%s\"'"
|
||||||
|
(encfn message) (encfn title)))))
|
||||||
|
|
||||||
|
(defun growl-notify (title message)
|
||||||
|
(shell-command (format "grownotify -t %s -m %s" title message)))
|
||||||
|
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
;; General Emacs Options
|
;; General Emacs Options
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
@ -232,7 +246,7 @@ buffer is not visiting a file."
|
|||||||
(line-number-mode t)
|
(line-number-mode t)
|
||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
(global-linum-mode t)
|
(global-linum-mode t)
|
||||||
(setq visible-bell nil)
|
(setq visible-bell t)
|
||||||
(show-paren-mode 1)
|
(show-paren-mode 1)
|
||||||
|
|
||||||
;; Make buffer names unique.
|
;; Make buffer names unique.
|
||||||
@ -250,12 +264,11 @@ buffer is not visiting a file."
|
|||||||
|
|
||||||
(add-hook 'after-init-hook '(lambda () (setq debug-on-error t)))
|
(add-hook 'after-init-hook '(lambda () (setq debug-on-error t)))
|
||||||
|
|
||||||
;; Don't popup frames in OSX.
|
|
||||||
(setq ns-pop-up-frames nil)
|
|
||||||
|
|
||||||
;; 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)))
|
||||||
|
|
||||||
|
(eval-after-load 'subword-mode '(diminish 'subword-mode))
|
||||||
|
|
||||||
(use-package load-dir
|
(use-package load-dir
|
||||||
:ensure t
|
:ensure t
|
||||||
:config
|
:config
|
||||||
@ -280,6 +293,7 @@ buffer is not visiting a file."
|
|||||||
(progn
|
(progn
|
||||||
(setq guide-key/guide-key-sequence '("C-c" "C-c p" "C-x C-k" "C-x r" "C-x c"))
|
(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)
|
||||||
|
(diminish 'guide-key-mode)
|
||||||
(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)
|
||||||
(setq guide-key/popup-window-position 'bottom)))
|
(setq guide-key/popup-window-position 'bottom)))
|
||||||
@ -296,8 +310,7 @@ buffer is not visiting a file."
|
|||||||
(progn
|
(progn
|
||||||
(setq ace-jump-mode-scope 'window))
|
(setq ace-jump-mode-scope 'window))
|
||||||
:bind (("C-;" . ace-jump-mode)
|
:bind (("C-;" . ace-jump-mode)
|
||||||
;; This is needed for terminal emacs.
|
("C-c j" . ace-jump-mode)))
|
||||||
("C-c j" . ace-jump-mode)))
|
|
||||||
|
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
:ensure t
|
:ensure t
|
||||||
@ -379,9 +392,9 @@ buffer is not visiting a file."
|
|||||||
(diminish 'undo-tree-mode)
|
(diminish 'undo-tree-mode)
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
;;(setq undo-tree-visualizer-diff t) ;; This causes performance problems
|
||||||
(global-undo-tree-mode)
|
(global-undo-tree-mode)
|
||||||
(setq undo-tree-visualizer-timestamps t)
|
(setq undo-tree-visualizer-timestamps t)))
|
||||||
(setq undo-tree-visualizer-diff t)))
|
|
||||||
|
|
||||||
(use-package smooth-scrolling
|
(use-package smooth-scrolling
|
||||||
:ensure t
|
:ensure t
|
||||||
@ -407,17 +420,21 @@ buffer is not visiting a file."
|
|||||||
|
|
||||||
(use-package org
|
(use-package org
|
||||||
:ensure t
|
:ensure t
|
||||||
:commands org-mode
|
:commands (org-mode org)
|
||||||
:mode "\\.org\\'"
|
:mode ("\\.org\\'" . org-mode)
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
(setq org-directory "~/Dropbox/org")
|
||||||
|
(setq org-mobile-inbox-for-pull "~/Dropbox/org/flagged.org")
|
||||||
|
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
|
||||||
(defun guide-key/my-hook-function-for-org-mode ()
|
(defun guide-key/my-hook-function-for-org-mode ()
|
||||||
(guide-key/add-local-guide-key-sequence "C-c")
|
(guide-key/add-local-guide-key-sequence "C-c")
|
||||||
(guide-key/add-local-guide-key-sequence "C-c C-x")
|
(guide-key/add-local-guide-key-sequence "C-c C-x")
|
||||||
(guide-key/add-local-highlight-command-regexp "org-"))
|
(guide-key/add-local-highlight-command-regexp "org-"))
|
||||||
(add-hook 'org-mode-hook 'guide-key/my-hook-function-for-org-mode)
|
(add-hook 'org-mode-hook 'guide-key/my-hook-function-for-org-mode)
|
||||||
(add-hook 'org-mode-hook (lambda () (linum-mode 0)))
|
(add-hook 'org-mode-hook (lambda () (linum-mode 0)))
|
||||||
(define-key mode-specific-map [?a] 'org-agenda)))
|
(define-key mode-specific-map [?a] 'org-agenda)
|
||||||
|
(local-set-key (kbd "C-j") 'ace-jump-mode)))
|
||||||
|
|
||||||
(use-package epg
|
(use-package epg
|
||||||
:ensure t
|
:ensure t
|
||||||
@ -427,7 +444,57 @@ buffer is not visiting a file."
|
|||||||
(use-package erc
|
(use-package erc
|
||||||
:ensure t
|
:ensure t
|
||||||
:commands erc
|
:commands erc
|
||||||
:config (progn (use-package erc-colorize :ensure t) (erc-colorize-mode 1)))
|
:config
|
||||||
|
(progn
|
||||||
|
(setq sauron-nick-insensitivity 1)
|
||||||
|
(use-package erc-colorize :ensure t) (erc-colorize-mode 1)
|
||||||
|
(add-hook 'sauron-event-added-functions
|
||||||
|
(lambda (origin priority message &optional properties)
|
||||||
|
(message "triggered...XXX")
|
||||||
|
(notification-center "test" message)))))
|
||||||
|
|
||||||
|
(use-package sauron
|
||||||
|
:ensure t
|
||||||
|
:commands (sauron-start sauron-start-hidden)
|
||||||
|
:config (progn (setq sauron-separate-frame nil))
|
||||||
|
:idle (sauron-start-hidden)
|
||||||
|
:idle-priority 3)
|
||||||
|
|
||||||
|
(use-package flyspell
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(bind-key "M-s" 'flyspell-correct-word-before-point flyspell-mode-map)
|
||||||
|
(unbind-key "C-;" flyspell-mode-map)
|
||||||
|
(defun flyspell-emacs-popup-textual (event poss word)
|
||||||
|
"A textual flyspell popup menu."
|
||||||
|
(let* ((corrects (if flyspell-sort-corrections
|
||||||
|
(sort (car (cdr (cdr poss))) 'string<)
|
||||||
|
(car (cdr (cdr poss)))))
|
||||||
|
(cor-menu (if (consp corrects)
|
||||||
|
(mapcar (lambda (correct)
|
||||||
|
(list correct correct))
|
||||||
|
corrects)
|
||||||
|
'()))
|
||||||
|
(affix (car (cdr (cdr (cdr poss)))))
|
||||||
|
show-affix-info
|
||||||
|
(base-menu (let ((save (if (and (consp affix) show-affix-info)
|
||||||
|
(list
|
||||||
|
(list (concat "Save affix: " (car affix))
|
||||||
|
'save)
|
||||||
|
'("Accept (session)" session)
|
||||||
|
'("Accept (buffer)" buffer))
|
||||||
|
'(("Save word" save)
|
||||||
|
("Accept (session)" session)
|
||||||
|
("Accept (buffer)" buffer)))))
|
||||||
|
(if (consp cor-menu)
|
||||||
|
(append cor-menu (cons "" save))
|
||||||
|
save)))
|
||||||
|
(menu (mapcar
|
||||||
|
(lambda (arg) (if (consp arg) (car arg) arg))
|
||||||
|
base-menu)))
|
||||||
|
(cadr (assoc (popup-menu* menu :scroll-bar t) base-menu))))
|
||||||
|
(fset 'flyspell-emacs-popup 'flyspell-emacs-popup-textual)))
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
;; Programming Mode Hooks
|
;; Programming Mode Hooks
|
||||||
@ -435,6 +502,8 @@ buffer is not visiting a file."
|
|||||||
|
|
||||||
(add-hook 'prog-mode-hook (lambda () (auto-fill-mode -1)))
|
(add-hook 'prog-mode-hook (lambda () (auto-fill-mode -1)))
|
||||||
(add-hook 'prog-mode-hook (lambda () (subword-mode t)))
|
(add-hook 'prog-mode-hook (lambda () (subword-mode t)))
|
||||||
|
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
|
||||||
|
|
||||||
;; (add-hook 'prog-mode-hook (lambda () (highlight-lines-matching-regexp
|
;; (add-hook 'prog-mode-hook (lambda () (highlight-lines-matching-regexp
|
||||||
;; ".\\{81\\}" 'hi-blue)))
|
;; ".\\{81\\}" 'hi-blue)))
|
||||||
|
|
||||||
@ -446,9 +515,8 @@ buffer is not visiting a file."
|
|||||||
:ensure t
|
:ensure t
|
||||||
:commands helm-mode
|
:commands helm-mode
|
||||||
:bind (("M-y" . helm-show-kill-ring)
|
:bind (("M-y" . helm-show-kill-ring)
|
||||||
("M-x" . helm-M-x))
|
("M-x" . helm-M-x)
|
||||||
;; :idle (helm-mode)
|
("C-h a" . helm-apropos))
|
||||||
;; :idle-priority 1
|
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(use-package helm-ag :ensure t :defer t))
|
(use-package helm-ag :ensure t :defer t))
|
||||||
@ -547,6 +615,7 @@ buffer is not visiting a file."
|
|||||||
(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)
|
(define-key lisp-mode-shared-map (kbd "C-c C-f") 'find-function)
|
||||||
|
(define-key lisp-mode-shared-map (kbd "C-c C-v") 'find-variable)
|
||||||
(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)
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
@ -618,8 +687,6 @@ buffer is not visiting a file."
|
|||||||
;; Scala
|
;; Scala
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
|
|
||||||
;; (load "~/.emacs.d/lisp/ensime-imenu.el")
|
|
||||||
|
|
||||||
(use-package scala-mode2
|
(use-package scala-mode2
|
||||||
:init
|
:init
|
||||||
(progn (add-hook 'scala-mode-hook
|
(progn (add-hook 'scala-mode-hook
|
||||||
@ -635,8 +702,8 @@ buffer is not visiting a file."
|
|||||||
(progn
|
(progn
|
||||||
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
|
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
|
||||||
(defun guide-key/scala-mode-hook ()
|
(defun guide-key/scala-mode-hook ()
|
||||||
(guide-key/add-local-guide-key-sequence "C-c C-v")
|
(guide-key/add-local-guide-key-sequence "C-c C-v"))
|
||||||
(add-hook 'scala-mode-hook 'guide-key/scala-mode-hook))
|
(add-hook 'scala-mode-hook 'guide-key/scala-mode-hook)
|
||||||
:ensure t))
|
:ensure t))
|
||||||
(setq scala-indent:align-parameters t))
|
(setq scala-indent:align-parameters t))
|
||||||
:mode (("\\.scala\\'" . scala-mode)
|
:mode (("\\.scala\\'" . scala-mode)
|
||||||
@ -800,11 +867,40 @@ buffer is not visiting a file."
|
|||||||
|
|
||||||
(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))
|
|
||||||
|
|
||||||
(ensure-packages-installed packages-appearance)
|
(ensure-packages-installed packages-appearance)
|
||||||
|
|
||||||
|
(use-package smart-mode-line
|
||||||
|
:ensure t
|
||||||
|
:disabled use-powerline)
|
||||||
|
|
||||||
|
(defun powerline-simple-theme ()
|
||||||
|
(interactive)
|
||||||
|
(setq mode-line-format
|
||||||
|
'("%e"
|
||||||
|
(:eval
|
||||||
|
(let* ((lhs (list (powerline-raw
|
||||||
|
(format " %s (%%l/%d) %%c " (downcase mode-name)
|
||||||
|
(line-number-at-pos (point-max))) nil 'l)))
|
||||||
|
(rhs (list (powerline-raw
|
||||||
|
(cond
|
||||||
|
((not (buffer-file-name)) "_ ")
|
||||||
|
((buffer-modified-p) "! ")
|
||||||
|
(t " ")) nil 'r)))
|
||||||
|
(center (list (powerline-raw "%b" nil))))
|
||||||
|
(concat (powerline-render lhs)
|
||||||
|
(powerline-fill-center nil (/ (powerline-width center) 2.0))
|
||||||
|
(powerline-render center)
|
||||||
|
(powerline-fill nil (powerline-width rhs))
|
||||||
|
(powerline-render rhs)))))))
|
||||||
|
|
||||||
|
(use-package powerline
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
:disabled (not use-powerline)
|
||||||
|
(powerline-simple-theme))
|
||||||
|
|
||||||
;; No splash screen please... jeez
|
;; No splash screen please... jeez
|
||||||
(setq inhibit-startup-screen t)
|
(setq inhibit-startup-screen t)
|
||||||
(blink-cursor-mode -1)
|
(blink-cursor-mode -1)
|
||||||
@ -823,8 +919,7 @@ buffer is not visiting a file."
|
|||||||
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
|
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
|
||||||
|
|
||||||
(defun modeline-setup ()
|
(defun modeline-setup ()
|
||||||
(if (and (boundp 'use-powerline) use-powerline)
|
(unless (and (boundp 'use-powerline) use-powerline)
|
||||||
(powerline-default-theme)
|
|
||||||
(progn
|
(progn
|
||||||
(sml/setup)
|
(sml/setup)
|
||||||
(sml/apply-theme 'automatic))))
|
(sml/apply-theme 'automatic))))
|
||||||
@ -884,7 +979,7 @@ buffer is not visiting a file."
|
|||||||
(condition-case exp
|
(condition-case exp
|
||||||
(set-frame-font (random-choice fonts) nil t)
|
(set-frame-font (random-choice fonts) nil t)
|
||||||
('error (package-refresh-contents)
|
('error (package-refresh-contents)
|
||||||
(set-frame-font "monaco-11" nil t) nil)))
|
(set-frame-font "Monaco for Powerline-11" nil t) nil)))
|
||||||
|
|
||||||
(defun remove-fringe-and-hl-line-mode (&rest stuff)
|
(defun remove-fringe-and-hl-line-mode (&rest stuff)
|
||||||
(modeline-setup)
|
(modeline-setup)
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
;;; Notify me when a keyword is matched (someone wants to reach me)
|
|
||||||
|
|
||||||
(defvar my-erc-page-message "%s is calling your name."
|
|
||||||
"Format of message to display in dialog box")
|
|
||||||
|
|
||||||
(defvar my-erc-page-nick-alist nil
|
|
||||||
"Alist of nicks and the last time they tried to trigger a
|
|
||||||
notification")
|
|
||||||
|
|
||||||
(defvar my-erc-page-timeout 30
|
|
||||||
"Number of seconds that must elapse between notifications from
|
|
||||||
the same person.")
|
|
||||||
|
|
||||||
(defun my-erc-page-popup-notification (nick msg)
|
|
||||||
(notification-center-command (format "%s says:" nick) msg))
|
|
||||||
|
|
||||||
(defun my-erc-page-allowed (nick &optional delay)
|
|
||||||
"Return non-nil if a notification should be made for NICK.
|
|
||||||
If DELAY is specified, it will be the minimum time in seconds
|
|
||||||
that can occur between two notifications. The default is
|
|
||||||
`my-erc-page-timeout'."
|
|
||||||
(unless delay (setq delay my-erc-page-timeout))
|
|
||||||
(let ((cur-time (time-to-seconds (current-time)))
|
|
||||||
(cur-assoc (assoc nick my-erc-page-nick-alist))
|
|
||||||
(last-time))
|
|
||||||
(if cur-assoc
|
|
||||||
(progn
|
|
||||||
(setq last-time (cdr cur-assoc))
|
|
||||||
(setcdr cur-assoc cur-time)
|
|
||||||
(> (abs (- cur-time last-time)) delay))
|
|
||||||
(push (cons nick cur-time) my-erc-page-nick-alist)
|
|
||||||
t)))
|
|
||||||
|
|
||||||
(defun my-erc-page-me (match-type nick message)
|
|
||||||
"Notify the current user when someone sends a message that
|
|
||||||
matches a regexp in `erc-keywords'."
|
|
||||||
(interactive)
|
|
||||||
(when (and (eq match-type 'keyword)
|
|
||||||
;; I don't want to see anything from the erc server
|
|
||||||
(null (string-match "\\`\\([sS]erver\\|localhost\\)" nick))
|
|
||||||
;; or bots
|
|
||||||
(null (string-match "\\(bot\\|serv\\)!" nick))
|
|
||||||
;; or from those who abuse the system
|
|
||||||
(my-erc-page-allowed nick))
|
|
||||||
(my-erc-page-popup-notification nick)))
|
|
||||||
|
|
||||||
(defun my-erc-page-me-PRIVMSG (proc parsed)
|
|
||||||
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
|
|
||||||
(target (car (erc-response.command-args parsed)))
|
|
||||||
(msg (erc-response.contents parsed)))
|
|
||||||
(when (and (erc-current-nick-p target)
|
|
||||||
(not (erc-is-message-ctcp-and-not-action-p msg))
|
|
||||||
(my-erc-page-allowed nick))
|
|
||||||
(my-erc-page-popup-notification nick msg)
|
|
||||||
nil)))
|
|
||||||
|
|
||||||
(add-hook 'erc-text-matched-hook 'my-erc-page-me)
|
|
||||||
(add-hook 'erc-server-PRIVMSG-functions 'my-erc-page-me-PRIVMSG)
|
|
||||||
|
|
||||||
(defvar notify-function #'notification-center)
|
|
||||||
|
|
||||||
(defun notification-center-command (title message)
|
|
||||||
(flet ((encfn (s) (encode-coding-string s (keyboard-coding-system))))
|
|
||||||
(shell-command (format "osascript -e 'display notification \"%s\" with title \"%s\"'"
|
|
||||||
(encfn message) (encfn title)))))
|
|
@ -4,6 +4,7 @@
|
|||||||
(use-package mu4e
|
(use-package mu4e
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
(setq mu4e-compose-complete-only-after nil)
|
||||||
(setq mu4e-maildir "~/Mail")
|
(setq mu4e-maildir "~/Mail")
|
||||||
|
|
||||||
(setq mu4e-drafts-folder "/[Gmail].Drafts")
|
(setq mu4e-drafts-folder "/[Gmail].Drafts")
|
||||||
@ -26,6 +27,11 @@
|
|||||||
|
|
||||||
;; allow for updating mail using 'U' in the main view:
|
;; allow for updating mail using 'U' in the main view:
|
||||||
(setq mu4e-get-mail-command "offlineimap")
|
(setq mu4e-get-mail-command "offlineimap")
|
||||||
|
;; show images
|
||||||
|
(setq mu4e-show-images t)
|
||||||
|
(add-hook 'mu4e-compose-mode-hook
|
||||||
|
(defun my-do-compose-stuff () (flyspell-mode)))
|
||||||
|
(setq mu4e-update-interval 15)
|
||||||
|
|
||||||
;; ;; something about ourselves
|
;; ;; something about ourselves
|
||||||
;; (setq
|
;; (setq
|
||||||
|
Loading…
Reference in New Issue
Block a user