|
|
- ;;; -*- lexical-binding: t -*-
- ;;; DO NOT EDIT THIS FILE DIRECTLY
- ;;; EDIT ~init.org~ instead
-
- ;; (setq byte-compile-warnings nil)
- (defun tangle-init ()
- "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled."
- (when (equal (buffer-file-name)
- (expand-file-name (concat user-emacs-directory "init.org")))
- ;; Avoid running hooks when tangling.
- (let ((prog-mode-hook nil))
- (org-babel-tangle)
- (byte-compile-file (concat user-emacs-directory "init.el")))))
-
- (add-hook 'after-save-hook 'tangle-init)
-
- (require 'package)
-
- (defvar my-packages
- '(all-the-icons
- anzu
- base16-theme
- bbdb
- better-defaults
- company
- company-go
- counsel
- counsel-projectile
- dash-at-point
- diminish
- dockerfile-mode
- doom-modeline
- doom-themes
- ein
- eldoc-eval
- elfeed
- elfeed-org
- elpy
- expand-region
- fic-mode
- flycheck
- gitignore-mode
- go-mode
- go-playground
- gorepl-mode
- iedit
- ivy
- ivy-hydra
- jabber
- json-mode
- magit
- material-theme
- multiple-cursors
- projectile
- rainbow-delimiters
- shrink-path
- tide
- typescript-mode
- ;; use-package
- web-mode
- which-key))
-
- (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
- (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
-
- (when (not package-archive-contents)
- (package-refresh-contents))
- (package-initialize)
-
- (dolist (p my-packages)
- (when (not (package-installed-p p))
- (package-install p)))
-
- (require 'edit-server)
-
- (edit-server-start)
-
- (require 'better-defaults)
-
- ;; Instead of the annoying giant warning icon, just flash the modeline.
- ;; (this happens when you do something like C-g)
- (setq ring-bell-function
- (lambda ()
- (let ((orig-fg (face-foreground 'mode-line)))
- (set-face-foreground 'mode-line "#F2804F")
- (run-with-idle-timer 0.1 nil
- (lambda (fg) (set-face-foreground 'mode-line fg))
- orig-fg))))
-
- (defun set-frame-size-according-to-resolution ()
- "Set the Emacs window size on startup."
- (interactive)
- (if window-system
- (progn
- ;; WIDTH
- (if (> (x-display-pixel-width) 1280)
- ;; Large Screen (only show 120 cols)
- (add-to-list 'default-frame-alist (cons 'width 240))
- ;; Small Screen (fill window)
- (add-to-list 'default-frame-alist (cons 'width (/ (x-display-pixel-width) (frame-char-width)))))
-
- ;; HEIGHT
- (if (> (x-display-pixel-height) 1080)
- ;; Large Screen (only fill half screen)
- (add-to-list 'default-frame-alist (cons 'height (/ (/ (x-display-pixel-height) 2)
- (frame-char-height))))
- ;; Small Screen (fill window)
- (add-to-list 'default-frame-alist (cons 'height (/ (x-display-pixel-height) (frame-char-height)))))
- )))
-
- (set-frame-size-according-to-resolution)
-
- (defun window-px-width ()
- "Get the width of the Emacs window in pixels."
- (interactive)
- (* (* (window-total-width) 2.874) (frame-char-width)))
-
- (defun window-px-left-pos ()
- "Calculate the left position of the Emacs window."
- (interactive)
- (/ (- (x-display-pixel-width) (window-px-width)) 2))
-
-
- (add-to-list 'default-frame-alist (cons 'top 0))
- (add-to-list 'default-frame-alist (cons 'left 1000))
-
- (put 'narrow-to-region 'disabled nil)
- (put 'upcase-region 'disabled nil)
- (put 'downcase-region 'disabled nil)
-
- (setq inhibit-splash-screen t
- fancy-splash-image "~/.emacs.d/public/emacs-logo.png"
- fancy-splash-image-file "~/.emacs.d/public/emacs-logo.png")
-
- (defvar backup-dir (expand-file-name "~/.emacs.d/backup/"))
- (defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/"))
-
- (setq initial-scratch-message nil
- backup-directory-alist (list (cons ".*" backup-dir))
- auto-save-list-file-prefix autosave-dir
- auto-save-file-name-transforms `((".*" ,autosave-dir t)))
-
- (menu-bar-mode 0)
- (scroll-bar-mode 0)
- (tool-bar-mode 0)
- (setq auth-sources '("~/.authinfo.gpg"))
- (set-default 'truncate-lines t)
-
- ;; (load-theme 'doom-city-lights t)
- ;; (load-theme 'doom-dracula t)
- ;; (load-theme 'doom-nord t)
- (load-theme 'doom-one t)
- ;; (load-theme 'doom-spacegrey t)
- ;; (load-theme 'base16-ocean t)
- (load-theme 'base16-onedark t)
- (global-linum-mode t)
- (global-auto-revert-mode t)
-
- (defalias 'yes-or-no-p 'y-or-n-p)
-
- (require 'font-lock)
-
- (defvar openhab-mode-hook nil)
-
- (defvar openhab-mode-map
- (let ((map (make-keymap)))
- (define-key map "\C-j" 'newline-and-indent)
- map)
- "Keymap for OPENHAB major mode.")
-
- (add-to-list 'auto-mode-alist '("\\.sitemap\\'" . openhab-mode))
- (add-to-list 'auto-mode-alist '("\\.items\\'" . openhab-mode))
- (add-to-list 'auto-mode-alist '("\\.rules\\'" . openhab-mode))
- (add-to-list 'auto-mode-alist '("\\.things\\'" . openhab-mode))
-
- (defconst openhab-font-lock-keywords
- `(
- ("\<.*\>" . font-lock-constant-face)
- (,(regexp-opt
- '(
- ;; KEYWORDS
- "Selection" "Slider" "List" "Setpoint" "Video" "Chart" "Webview" "Colorpicker"
- "Timer" "Number" "String"
- "Switch" "Rollershutter" "Number" "String" "Dimmer" "Contact" "DateTime" "Color"
- "Text" "Group" "Image" "Frame"
- "Thing" "Bridge"
- "Time" "System"
- "sitemap"
-
- "rule" "when" "then" "end"
- "if" "val"
- "import" "var" "say" "postUpdate" "switch" "println" "case" "or" "sendCommand"
- )
- 'words)
- (1 font-lock-keyword-face))
- (,(regexp-opt
- '(
- "ON" "OFF" "on" "off"
- "AND" "OR" "NAND" "NOR" "AVG" "SUM" "MAX" "MIN"
- "true" "false"
- )
- 'words)
- (1 font-lock-constant-face))
- (,(regexp-opt
- '(
- "name" "label" "item" "period" "refresh" "icon" "mappings" "minValue" "maxValue" "step" "switchsupport" "url" "height" "refresh" "visibility" "valuecolor"
- )
- 'words)
- (1 font-lock-type-face))
- ("\(.*\)" . font-lock-variable-name-face)
- ("[^a-zA-Z0-9_:]\\([0-9]*\\)[^a-zA-Z0-9_:]" . (1 font-lock-variable-name-face))
- ("\s@\s" . font-lock-variable-name-face)
- ("\s\\([a-zA-Z0-9_:]*\\)\\(\s\\|$\\)" . (1 font-lock-type-face))
- ("=\\([a-zA-Z_]*\\)" . (1 font-lock-string-face))
- ("\\([a-zA-Z]*\\)=" . (1 font-lock-type-face))
- )
- "The regexps to highlight in openHAB mode.")
-
- (defvar openhab-mode-syntax-table
- (let ((st (make-syntax-table)))
- (modify-syntax-entry ?/ ". 12b" st) ;; C-style comments // ...
- (modify-syntax-entry ?\n "> b" st) ;; \n ends comment
- ;; Block comments /*...*/
- (modify-syntax-entry ?\/ ". 14" st)
- (modify-syntax-entry ?* ". 23" st)
- st)
- "Syntax table for openhab-mode.")
-
- (defun openhab-mode ()
- "Major mode for editing OPENHAB config files."
- (interactive)
- (kill-all-local-variables)
- (set-syntax-table openhab-mode-syntax-table)
- (use-local-map openhab-mode-map)
- (set (make-local-variable 'font-lock-defaults) '(openhab-font-lock-keywords nil t))
- (electric-pair-mode -1)
- (flycheck-mode -1)
- (setq major-mode 'openhab-mode)
- (setq mode-name "OpenHAB")
- (run-hooks 'openhab-mode-hook))
-
- (provide 'openhab-mode)
-
- ;;; hyperspace.el --- Get there from here -*- lexical-binding: t; -*-
-
- ;; Copyright (C) 2017-2019 Ian Eure
-
- ;; Author: Ian Eure <ian@retrospec.tv>
- ;; URL: https://github.com/ieure/hyperspace-el
- ;; Version: 0.8.4
- ;; Package-Requires: ((emacs "25") (s "1.12.0"))
- ;; Keywords: tools, convenience
-
- ;; This program is free software; you can redistribute it and/or modify
- ;; it under the terms of the GNU General Public License as published by
- ;; the Free Software Foundation, either version 3 of the License, or
- ;; (at your option) any later version.
-
- ;; This program is distributed in the hope that it will be useful,
- ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;; GNU General Public License for more details.
-
- ;; You should have received a copy of the GNU General Public License
- ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- ;;; Commentary:
-
- ;; Hyperspace is a way to get nearly anywhere from wherever you are,
- ;; whether that's within Emacs or on the web. It's somewhere in
- ;; between Quicksilver and keyword URLs, giving you a single,
- ;; consistent interface to get directly where you want to go. It’s
- ;; for things that you use often, but not often enough to justify a
- ;; dedicated binding.
- ;;
- ;; When you enter Hyperspace, it prompts you where to go:
- ;;
- ;; HS:
- ;;
- ;; This prompt expects a keyword and a query. The keyword picks where
- ;; you want to go, and the remainder of the input is an optional
- ;; argument which can be used to further search or direct you within
- ;; that space.
- ;;
- ;; Some concrete examples:
- ;;
- ;; | *If you enter* | *then Hyperspace* |
- ;; |------------------+----------------------------------------------------------|
- ;; | "el" | opens info node "(elisp)Top" |
- ;; | "el eval-region" | searches for "eval-region" in the elisp Info index |
- ;; | "bb" | shows all BBDB entries |
- ;; | "bb kenneth" | shows all BBDB entries with a name matching "kenneth" |
- ;; | "ddg foo" | searches DuckDuckGo for "foo" using browse-url |
- ;; | "wp foo" | searches Wikipedia for "foo" using browse-url |
- ;;
-
- ;;; Code:
-
- (require 'subr-x)
- (require 's)
-
- ;; Action helpers
-
- (defun hyperspace-action->browse-url-pattern (pattern query)
- "Browse a URL former from PATTERN and QUERY."
- (browse-url (format pattern query)))
-
- (defun hyperspace-action->info (node &optional query)
- "Open an Info buffer for NODE.
-
- If QUERY is present, look it up in the index."
- (info node)
- (when query
- (Info-index query)))
-
- ;; Package definitions
-
- (defvar hyperspace-history nil
- "History of Hyperspace actions.")
-
- (defgroup hyperspace nil
- "Getting there from here"
- :prefix "hyperspace-"
- :group 'applications)
-
- (defcustom hyperspace-actions
- '(("ddg" . "https://duckduckgo.com/?q=%s")
- ("dis" . "https://duckduckgo.com/?q=%s&iax=images&ia=images")
- ("wp" . "https://en.wikipedia.org/wiki/%s")
- ("g" . "https://www.google.com/search?q=%s")
- ("gi" . "https://www.google.com/search?tbm=isch&q=%s")
- ("gm" . "https://www.google.com/maps/search/%s")
- ("yt" . "https://www.youtube.com/results?search_query=%s")
- ("clp" . "https://portland.craigslist.org/search/sss?query=%s")
- ("eb" . "https://www.ebay.com/sch/i.html?_nkw=%s")
- ("nf" . "https://www.netflix.com/search?q=%s")
- ("sh" . (lambda (query) (interactive) (shell-command query)))
- ("imdb" . "https://www.imdb.com/find?q=peter+jackson&s=all")
- ("bb" . bbdb-search-name)
- ("el" . (apply-partially #'hyperspace-action->info "(elisp)Top"))
- ("av" . apropos-variable)
- ("ac" . apropos-command)
- ("af" . (lambda (query) (apropos-command query t))))
-
- "Where Hyperspace should send you.
-
- Hyperspace actions are a cons of (KEYWORD . DISPATCHER). When
- Hyperspace is invoked, the keyword is extracted from the user
- input and looked up in this alist. The remainder of the
- string is passed to the dispatcher as its QUERY argument.
-
- DISPATCHER can be a function which performs the action.
-
- DISPATCHER can also be an expression which returns a function
- to perform the action.
-
- Finally, DISPATCHER can be a string with a URL pattern containing
- '%s'. The '%s' will be replaced with the query, and the URL browsed."
-
- :group 'hyperspace
- :type '(alist :key-type (string :tag "Keyword")
- :value-type (choice
- (function :tag "Function")
- (string :tag "URL Pattern")
- (sexp :tag "Expression"))))
-
- (defcustom hyperspace-default-action
- (caar hyperspace-actions)
- "A place to go if you don't specify one."
- :group 'hyperspace
- :type `(radio
- ,@(mapcar (lambda (action) (list 'const (car action))) hyperspace-actions)))
-
- (defcustom hyperspace-max-region-size 256
- "Maximum size of a region to consider for a Hyperspace query.
-
- If the region is active when Hyperspace is invoked, it's used
- as the default query, unless it's more than this number of
- characters."
- :group 'hyperspace
- :type 'integer)
-
-
-
- (defun hyperspace--cleanup (text)
- "Clean TEXT so it can be used for a Hyperspace query."
- (save-match-data
- (string-trim
- (replace-regexp-in-string (rx (1+ (or blank "\n"))) " " text))))
-
- (defun hyperspace--initial-text ()
- "Return the initial text.
-
- This is whatever's in the active region, but cleaned up."
- (when (use-region-p)
- (let* ((start (region-beginning))
- (end (region-end))
- (size (- end start)))
- (when (<= size hyperspace-max-region-size)
- (hyperspace--cleanup
- (buffer-substring-no-properties start end))))))
-
- (defun hyperspace--initial (initial-text)
- "Turn INITIAL-TEXT into INITIAL-CONTENTS for reading."
- (when initial-text (cons (concat " " initial-text) 1)))
-
- (defun hyperspace--process-input (text)
- "Process TEXT into an actionable keyword and query."
- (let ((kw-text (s-split-up-to "\\s-+" text 1)))
- (if (assoc (car kw-text) hyperspace-actions)
- kw-text
- (list hyperspace-default-action text))))
-
- (defun hyperspace--query ()
- "Ask the user for the Hyperspace action and query.
-
- Returns (KEYWORD . QUERY).
-
- If the region isn't active, the user is prompted for the
- action and query.
-
- If the region is active, its text is used as the initial value
- for the query, and the user enters the action.
-
- If a prefix argument is specified and the region is active,
- `HYPERSPACE-DEFAULT-ACTION' is chosen without prompting."
-
- (let ((initial (hyperspace--initial-text)))
- (if (and initial current-prefix-arg)
- (list hyperspace-default-action initial)
- (hyperspace--process-input
- (read-from-minibuffer "HS: " (hyperspace--initial initial) nil nil
- 'hyperspace-history)))))
-
- (defun hyperspace--evalable-p (form)
- "Can FORM be evaluated?"
- (and (listp form)
- (or (functionp (car form))
- (subrp (car form)))))
-
- (defun hyperspace--dispatch (action &optional query)
- "Execute ACTION, with optional QUERY argument."
- (pcase action
- ((pred functionp) (funcall action query))
- ((pred hyperspace--evalable-p) (funcall (eval action) query))
- ((pred stringp) (hyperspace-action->browse-url-pattern action query))
- (_ (error "Unknown action"))))
-
- ;;;###autoload
- (defun hyperspace (keyword &optional query)
- "Execute action for keyword KEYWORD, with optional QUERY."
- (interactive (hyperspace--query))
- (let ((action (cdr (assoc keyword hyperspace-actions))))
- (hyperspace--dispatch (or action hyperspace-default-action) query)))
-
- ;;;###autoload
- (defun hyperspace-enter (&optional query)
- "Enter Hyperspace, sending QUERY to the default action.
-
- If the region is active, use that as the query for
- ‘hyperspace-default-action’. Otherwise, prompt the user."
- (interactive (list (hyperspace--initial-text)))
- (hyperspace
- hyperspace-default-action
- (or query
- (read-from-minibuffer
- (format "HS: %s " hyperspace-default-action) nil nil
- 'hyperspace-history))))
-
- ;; Minor mode
-
- (defvar hyperspace-minor-mode-map
- (let ((kmap (make-sparse-keymap)))
- (define-key kmap (kbd "H-SPC") #'hyperspace)
- (define-key kmap (kbd "<H-return>") #'hyperspace-enter)
- kmap))
-
- ;;;###autoload
- (define-minor-mode hyperspace-minor-mode
- "Global (universal) minor mode to jump from here to there."
- nil nil hyperspace-minor-mode-map
- :group 'hyperspace
- :global t)
-
- (provide 'hyperspace)
-
- ;;; hyperspace.el ends here
-
- (require 'which-key)
- (which-key-setup-minibuffer)
- (which-key-mode)
-
- (require 'fic-mode)
- (add-hook 'js-mode-hook 'fic-mode)
-
- (require 'company)
- (add-hook 'after-init-hook 'global-company-mode)
-
- (setq company-dabbrev-downcase nil)
- (setq company-idle-delay 0.1)
-
- (require 'diminish)
- (diminish 'auto-revert-mode)
- (eval-after-load "company" '(diminish 'company-mode))
- (eval-after-load "counsel" '(diminish 'counsel-mode))
- (eval-after-load "elpy" '(diminish 'elpy-mode))
- (eval-after-load "go-mode" '(diminish 'go-mode))
- (eval-after-load "go-playground" '(diminish 'go-playground-mode))
- (eval-after-load "gorepl-mode" '(diminish 'gorepl-mode))
- (eval-after-load "flycheck" '(diminish 'flycheck-mode))
- (eval-after-load "ivy" '(diminish 'ivy-mode))
- (eval-after-load "projectile" '(diminish 'projectile-mode))
- (eval-after-load "which-key" '(diminish 'which-key-mode))
-
- (defun dired-mode-setup ()
- "Will run as hook for `dired-mode'."
- (dired-hide-details-mode nil))
- (add-hook 'dired-mode-hook 'dired-mode-setup)
-
- (require 'ivy-hydra)
- (require 'ivy)
- (require 'swiper)
-
- (ivy-mode 1)
- (counsel-mode)
- (setq ivy-use-virtual-buffers t
- enable-recursive-minibuffers t
- ivy-height 25
- ivy-initial-inputs-alist nil
- ivy-extra-directories nil)
-
- (global-set-key (kbd "C-s") 'swiper)
- (global-set-key (kbd "C-c C-r") 'ivy-resume)
- (global-set-key (kbd "M-x") 'counsel-M-x)
- (global-set-key (kbd "C-x C-f") 'counsel-find-file)
- (global-set-key (kbd "C-c g") 'counsel-git)
- (global-set-key (kbd "C-c j") 'counsel-git-grep)
- (global-set-key (kbd "C-c k") 'counsel-ag)
- (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
-
- (defun ivy-open-current-typed-path ()
- (interactive)
- (when ivy--directory
- (let* ((dir ivy--directory)
- (text-typed ivy-text)
- (path (concat dir text-typed)))
- (delete-minibuffer-contents)
- (ivy--done path))))
-
- (define-key ivy-minibuffer-map (kbd "<return>") 'ivy-alt-done)
- (define-key ivy-minibuffer-map (kbd "C-f") 'ivy-open-current-typed-path)
-
- (require 'magit)
- (global-set-key (kbd "C-x g") 'magit-status)
- (global-set-key (kbd "C-c g") 'magit-status)
- (setq magit-completing-read-function 'ivy-completing-read)
-
- (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
- (require 'mu4e)
-
- ;; default
- (setq mu4e-maildir "~/Mail"
- mu4e-mu-binary "/usr/local/bin/mu"
- mu4e-change-filenames-when-moving t ;; Rename files when moving (required by mbsync)
- mu4e-compose-in-new-frame t ;; New compose gets new frame
- mu4e-context-policy 'pick-first
- mu4e-get-mail-command "mbsync -a" ;; MBSYNC is the mail cmd
- mu4e-html2text-command "/usr/local/bin/w3m -T text/html" ;; HTML to text command
- mu4e-sent-messages-behavior 'delete ;; Delete sent messages
- mu4e-update-interval 300 ;; 5 mins
- mu4e-use-fancy-chars t ;; use 'fancy' chars
- mu4e-user-mail-address-list '("lolson@eaglecrk.com"
- "lolson@vlocity.com"
- "olson.levi@gmail.com")
- mu4e-view-show-images t ;; attempt to show images
- mu4e-view-image-max-width 400 ;; max image size
-
- message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n" ;; customize the reply-quote-string
- message-citation-line-function 'message-insert-formatted-citation-line ;; choose to use the formatted string
- message-kill-buffer-on-exit t ;; don't keep messages around
-
- send-mail-function 'smtpmail-send-it ;; Default email send function
- smtpmail-default-smtp-server "smtp.gmail.com"
- smtpmail-smtp-service 587
- )
-
- (defun mdmail-send-buffer ()
- (interactive)
- (shell-command-on-region (point-min) (point-max) "mdmail"))
-
- (setq mu4e-contexts
- `(
- ;; ,(make-mu4e-context
- ;; :name "Vlocity"
- ;; :enter-func (lambda () (mu4e-message "Entering Vlocity"))
- ;; :leave-func (lambda () (mu4e-message "Leaving Vlocity"))
- ;; ;; we match based on the contact-fields of the message
- ;; :match-func (lambda (msg)
- ;; (when msg
- ;; (string= (mu4e-message-field msg :maildir) "/Vlocity")))
- ;; :vars '( ( user-mail-address . "lolson@vlocity.com" )
- ;; ( smtpmail-mail-address . "lolson@vlocity.com" )
- ;; ( smtpmail-smtp-user . "lolson@vlocity.com" )
- ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
- ;; ( user-full-name . "Levi Olson" )
- ;; ( mu4e-compose-signature .
- ;; (concat
- ;; "Levi Olson\n"
- ;; "Senior UI Developer"))
- ;; ( mu4e-sent-folder . "/Vlocity/[Gmail].Sent Mail" )
- ;; ( mu4e-drafts-folder . "/Vlocity/[Gmail].Drafts" )
- ;; ( mu4e-trash-folder . "/Vlocity/[Gmail].Trash" )
- ;; ( mu4e-maildir-shortcuts . (("/Vlocity/INBOX" . ?i)
- ;; ("/Vlocity/[Gmail].Sent Mail" . ?s)
- ;; ("/Vlocity/[Gmail].Trash" . ?t)
- ;; ("/Vlocity/[Gmail].All Mail" . ?a)))))
- ,(make-mu4e-context
- :name "EagleCreek"
- :enter-func (lambda () (mu4e-message "Entering EagleCreek"))
- :leave-func (lambda () (mu4e-message "Leaving EagleCreek"))
- ;; we match based on the contact-fields of the message
- :match-func (lambda (msg)
- (when msg
- (string= (mu4e-message-field msg :maildir) "/eaglecrk")))
- :vars '( ( user-mail-address . "lolson@eaglecrk.com" )
- ( smtpmail-mail-address . "lolson@eaglecrk.com" )
- ( smtpmail-smtp-user . "lolson@eaglecrk.com" )
- ( smtpmail-smtp-server . "smtp.office365.com" )
- ( user-full-name . "Levi Olson" )
- ;; ( mu4e-compose-signature .
- ;; (concat
- ;; "Levi Olson\n"
- ;; "Eagle Creek Software Services\n"
- ;; "Senior Application Developer Consultant\n"))
- ( mu4e-sent-folder . "/eaglecrk/Sent Items" )
- ( mu4e-drafts-folder . "/eaglecrk/Drafts" )
- ( mu4e-trash-folder . "/eaglecrk/Deleted Items" )
- ( mu4e-maildir-shortcuts . (("/eaglecrk/Inbox" . ?i)
- ("/eaglecrk/Sent Items" . ?s)
- ("/eaglecrk/Deleted Items" . ?t)
- ("/eaglecrk/Archive" . ?a)))))
- ;; ,(make-mu4e-context
- ;; :name "Gmail"
- ;; :enter-func (lambda () (mu4e-message "Entering Gmail"))
- ;; :leave-func (lambda () (mu4e-message "Leaving Gmail"))
- ;; ;; this matches maildir /Arkham and its sub-directories
- ;; :match-func (lambda (msg)
- ;; (when msg
- ;; (string= (mu4e-message-field msg :maildir) "/Gmail")))
- ;; :vars '( ( user-mail-address . "olson.levi@gmail.com" )
- ;; ( smtpmail-mail-address . "olson.levi@gmail.com" )
- ;; ( smtpmail-smtp-user . "olson.levi@gmail.com" )
- ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
- ;; ( user-full-name . "Levi Olson" )
- ;; ( mu4e-compose-signature .
- ;; (concat
- ;; "Levi\n"))
- ;; ( mu4e-sent-folder . "/Gmail/[Gmail].Sent Mail" )
- ;; ( mu4e-drafts-folder . "/Gmail/[Gmail].Drafts" )
- ;; ( mu4e-trash-folder . "/Gmail/[Gmail].Trash" )
- ;; ( mu4e-maildir-shortcuts . (("/Gmail/INBOX" . ?i)
- ;; ("/Gmail/[Gmail].Sent Mail" . ?s)
- ;; ("/Gmail/[Gmail].Trash" . ?t)
- ;; ("/Gmail/[Gmail].All Mail" . ?a))
- ;; )))
- ))
-
- ;; Add option to view HTML in browser
- (add-to-list 'mu4e-headers-actions
- '("in browser" . mu4e-action-view-in-browser) t)
- (add-to-list 'mu4e-view-actions
- '("in browser" . mu4e-action-view-in-browser) t)
-
-
-
- (defun my-message-current-line-cited-p ()
- "Indicate whether the line at point is a cited line."
- (save-match-data
- (string-match (concat "^" message-cite-prefix-regexp)
- (buffer-substring (line-beginning-position) (line-end-position)))))
-
- (defun my-message-says-attachment-p ()
- "Return t if the message suggests there can be an attachment."
- (save-excursion
- (goto-char (point-min))
- (save-match-data
- (let (search-result)
- (while
- (and (setq search-result (re-search-forward "\\(attach\\|pdf\\|file\\)" nil t))
- (my-message-current-line-cited-p)))
- search-result))))
-
- (defun my-message-has-attachment-p ()
- "Return t if the message has an attachment."
- (save-excursion
- (goto-char (point-min))
- (save-match-data
- (re-search-forward "<#part" nil t))))
-
- (defun my-message-pre-send-check-attachment ()
- (when (and (my-message-says-attachment-p)
- (not (my-message-has-attachment-p)))
- (unless
- (y-or-n-p "No attachment. Send anyway?")
- (error "It seems that an attachment is needed, but none was found. Aborting sending."))))
-
- (add-hook 'message-send-hook 'my-message-pre-send-check-attachment)
-
- (require 'projectile)
- (require 'counsel-projectile)
-
- (projectile-mode)
- (setq projectile-mode-line '(:eval (format " %s" (projectile-project-name)))
- projectile-remember-window-configs t
- projectile-completion-system 'ivy)
- (counsel-projectile-mode)
-
- ;;; notify.el --- notification front-end
-
- ;; Copyright (C) 2008 Mark A. Hershberger
-
- ;; Original Author: Mark A. Hershberger <mhersberger@intrahealth.org>
- ;; Modified by Andrey Kotlarski <m00naticus@gmail.com>
- ;; Modified by Andrew Gwozdziewycz <git@apgwoz.com>
- ;; Modified by Aidan Gauland <aidalgol@no8wireless.co.nz> October 2011
- ;; Modified by Olivier Sirven <the.slaa@gmail.com> November 2013
- ;; Keywords: extensions, convenience, lisp
-
- ;; This file is free software; you can redistribute it and/or modify
- ;; it under the terms of the GNU General Public License as published by
- ;; the Free Software Foundation; either version 2, or (at your option)
- ;; any later version.
-
- ;; This file is distributed in the hope that it will be useful,
- ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;; GNU General Public License for more details.
-
- ;; You should have received a copy of the GNU General Public License
- ;; along with GNU Emacs; see the file COPYING. If not, write to
- ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- ;; Boston, MA 02111-1307, USA.
-
- ;;; Commentary:
-
- ;; This provides a single function, `notify', that will produce a notify
- ;; pop-up via D-Bus, libnotify, simple message or growl.
- ;; To use, just put (autoload 'notify "notify" "Notify TITLE, BODY.")
- ;; in your init file. You may override default chosen notification
- ;; method by assigning `notify-method' to one of 'notify-via-dbus
- ;; 'notify-via-libnotify or 'notify-via-message
- ;;; Code:
-
- (defvar notify-defaults (list :app "Emacs" :icon "emacs" :timeout 5000
- :urgency "low"
- :category "emacs.message")
- "Notification settings' defaults.
- May be overridden with key-value additional arguments to `notify'.")
- (defvar notify-delay '(0 5 0)
- "Minimum time allowed between notifications in time format.")
- (defvar notify-last-notification '(0 0 0) "Time of last notification.")
- (defvar notify-method 'notify-via-growl "Notification method among
- 'notify-via-dbus, 'notify-via-libnotify, 'notify-via-message or
- 'notify-via-growl")
-
- ;; determine notification method unless already set
- ;; prefer growl > D-Bus > libnotify > message
- (cond
- ((null notify-method)
- (setq notify-method
- (cond
- ((executable-find "growlnotify") 'notify-via-growl)
- ((and (require 'dbus nil t)
- (dbus-ping :session "org.freedesktop.Notifications"))
- (defvar notify-id 0 "Current D-Bus notification id.")
- 'notify-via-dbus)
- ((executable-find "notify-send") 'notify-via-libnotify)
- (t 'notify-via-message))))
- ((eq notify-method 'notify-via-dbus) ;housekeeping for pre-chosen DBus
- (if (and (require 'dbus nil t)
- (dbus-ping :session "org.freedesktop.Notifications"))
- (defvar notify-id 0 "Current D-Bus notification id.")
- (setq notify-method (if (executable-find "notify-send")
- 'notify-via-libnotify
- 'notify-via-message))))
- ((and (eq notify-method 'notify-via-libnotify)
- (not (executable-find "notify-send"))) ;housekeeping for pre-chosen libnotify
- (setq notify-method
- (if (and (require 'dbus nil t)
- (dbus-ping :session "org.freedesktop.Notifications"))
- (progn
- (defvar notify-id 0 "Current D-Bus notification id.")
- 'notify-via-dbus)
- 'notify-via-message)))
- ((and (eq notify-method 'notify-via-growl)
- (not (executable-find "growlnotify")))
- (setq notify-method 'notify-via-message)))
-
- (defun notify-via-dbus (title body)
- "Send notification with TITLE, BODY `D-Bus'."
- (dbus-call-method :session "org.freedesktop.Notifications"
- "/org/freedesktop/Notifications"
- "org.freedesktop.Notifications" "Notify"
- (get 'notify-defaults :app)
- (setq notify-id (+ notify-id 1))
- (get 'notify-defaults :icon) title body '(:array)
- '(:array :signature "{sv}") ':int32
- (get 'notify-defaults :timeout)))
-
- (defun notify-via-libnotify (title body)
- "Notify with TITLE, BODY via `libnotify'."
- (call-process "notify-send" nil 0 nil
- title body "-t"
- (number-to-string (get 'notify-defaults :timeout))
- "-i" (get 'notify-defaults :icon)
- "-u" (get 'notify-defaults :urgency)
- "-c" (get 'notify-defaults :category)))
-
- (defun notify-via-message (title body)
- "Notify TITLE, BODY with a simple message."
- (message "%s: %s" title body))
-
- (defun notify-via-growl (title body)
- "Notify TITLE, BODY with a growl"
- (call-process "growlnotify" nil 0 nil
- "-a" (get 'notify-defaults :app)
- "-n" (get 'notify-defaults :category)
- "-t" (notify-via-growl-stringify title)
- "-m" (notify-via-growl-stringify body)))
-
- (defun notify-via-growl-stringify (thing)
- (cond ((null thing) "")
- ((stringp thing) thing)
- (t (format "%s" thing))))
-
- (defun keywords-to-properties (symbol args &optional defaults)
- "Add to SYMBOL's property list key-values from ARGS and DEFAULTS."
- (when (consp defaults)
- (keywords-to-properties symbol defaults))
- (while args
- (put symbol (car args) (cadr args))
- (setq args (cddr args))))
-
-
- ;;;###autoload
- (defun notify (title body &rest args)
- "Notify TITLE, BODY via `notify-method'.
- ARGS may be amongst :timeout, :icon, :urgency, :app and :category."
- (when (time-less-p notify-delay
- (time-since notify-last-notification))
- (or (eq notify-method 'notify-via-message)
- (keywords-to-properties 'notify-defaults args
- notify-defaults))
- (setq notify-last-notification (current-time))
- (funcall notify-method title body)))
-
- (provide 'notify)
-
- ;;; notify.el ends here
-
- (require 'jabber)
-
- (setq jabber-history-enabled t
- jabber-use-global-history nil
- jabber-backlog-number 40
- jabber-backlog-days 30
- jabber-alert-presence-message-function (lambda (_who _oldstatus _newstatus _statustext) nil)
- )
-
- (setq jabber-account-list '(
- ;; ("olson.levi@gmail.com"
- ;; (:network-server . "talk.google.com")
- ;; (:connection-type . ssl))
- ("lolson@vlocity.com"
- (:network-server . "talk.google.com")
- (:connection-type . ssl))
- ))
-
- (defvar my-chat-prompt "[%t] %n>\n" "Customized chat prompt")
- (when (featurep 'jabber)
- (setq
- jabber-chat-foreign-prompt-format my-chat-prompt
- jabber-chat-local-prompt-format my-chat-prompt
- jabber-groupchat-prompt-format my-chat-prompt
- jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n"
- )
- )
-
- (defun notify-jabber-notify (from buf text _proposed-alert)
- "(jabber.el hook) Notify of new Jabber chat messages via notify.el"
- (when (or jabber-message-alert-same-buffer
- (not (memq (selected-window) (get-buffer-window-list buf))))
- (if (jabber-muc-sender-p from)
- (notify (format "(PM) %s"
- (jabber-jid-displayname (jabber-jid-user from)))
- (format "%s: %s" (jabber-jid-resource from) text)))
- (notify (format "%s" (jabber-jid-displayname from))
- text)))
-
- ;; (add-hook 'jabber-alert-message-hooks 'notify-jabber-notify)
-
-
- ;; (require 'autosmiley)
- ;; (add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
-
-
- (defun jabber ()
- (interactive)
- (jabber-connect-all)
- (switch-to-buffer "*-jabber-roster-*"))
-
- (defun hyperspace-action->mu4e (&optional query)
- "Search mu4e with QUERY.
-
- If QUERY is unspecified, use the first bookmark in variable
- ‘mu4e-bookmarks’ and update mail and index."
-
- (mu4e-headers-search (or query (caar mu4e-bookmarks)))
- (unless query
- (mu4e-update-mail-and-index nil)))
- (add-to-list 'hyperspace-actions '("m4" . hyperspace-action->mu4e))
-
- (defun hyperspace-action->elfeed (&optional query)
- "Load elfeed, optionally searching for QUERY."
- (elfeed)
- (if query
- (elfeed-search-set-filter query)
- (elfeed-search-fetch nil)))
- (add-to-list 'hyperspace-actions '("lf" . hyperspace-action->elfeed))
-
- (require 'rainbow-delimiters)
- (global-flycheck-mode)
-
- (add-hook 'before-save-hook 'delete-trailing-whitespace)
- (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
-
- (setq-default indent-tabs-mode nil
- tab-width 4)
- (defvaralias 'c-basic-offset 'tab-width)
- (defvaralias 'cperl-indent-level 'tab-width)
-
- (electric-pair-mode 1)
- (show-paren-mode 1)
-
- (require 'dockerfile-mode)
- (add-to-list 'auto-mode-alist '("Dockerfile*\\'" . dockerfile-mode))
-
- (require 'gitignore-mode)
- (add-to-list 'auto-mode-alist '("gitignore\\'" . gitignore-mode))
-
- (require 'json-mode)
- (add-to-list 'auto-mode-alist '("\\.json\\'" . json-mode))
-
- (require 'web-mode)
- (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
-
- (elpy-enable)
- (setq python-shell-interpreter "jupyter"
- python-shell-interpreter-args "console --simple-prompt")
-
- (when (require 'flycheck nil t)
- (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
- (add-hook 'elpy-mode-hook 'flycheck-mode))
-
- (require 'py-autopep8)
- (setq py-autopep8-options '("--ignore=E501"))
- (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
-
- (require 'go-mode)
- (require 'go-playground)
- (require 'gorepl-mode)
- (require 'company-go)
-
- (add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
- (add-hook 'go-mode-hook (lambda ()
- (add-hook 'before-save-hook 'gofmt-before-save)
- (local-set-key (kbd "M-.") 'godef-jump)
- (local-set-key (kbd "M-,") 'pop-tag-mark)
- (local-set-key (kbd "C-c C-c") (lambda ()
- (interactive)
- (ansi-term)
- (comint-send-string "*ansi-term*" "make\n")))
- (set (make-local-variable 'company-backends) '(company-go))
- (setq company-tooltip-limit 20
- company-echo-delay 0
- company-begin-commands '(self-insert-command))
- (gorepl-mode)))
- (defun set-exec-path-from-shell-PATH ()
- (let ((path-from-shell (replace-regexp-in-string
- "[ \t\n]*$"
- ""
- (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
- (setenv "PATH" path-from-shell)
- (setq eshell-path-env path-from-shell)
- (setq exec-path (split-string path-from-shell path-separator))))
-
- (when window-system (set-exec-path-from-shell-PATH))
-
- (setenv "GOPATH" "/Users/leviolson/go")
- (add-to-list 'exec-path "/Users/leviolson/go/bin")
-
- (defun setup-tide-mode ()
- "Tide setup function."
- (interactive)
- (tide-setup)
- (flycheck-mode +1)
- (setq flycheck-check-syntax-automatically '(save mode-enabled))
- (eldoc-mode +1)
- (tide-hl-identifier-mode +1)
- (company-mode +1))
-
- ;; aligns annotation to the right hand side
- (setq company-tooltip-align-annotations t)
-
- ;; formats the buffer before saving
- (add-hook 'before-save-hook 'tide-format-before-save)
-
- (add-hook 'typescript-mode-hook #'setup-tide-mode)
-
- (require 'typescript-mode)
- (require 'tide)
-
- (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
- (add-hook 'typescript-mode-hook
- '(lambda ()
- (set (make-local-variable 'company-backends) '(company-tide))
- (setq company-tooltip-limit 20
- company-echo-delay 0
- company-begin-commands '(self-insert-command)
- tide-format-options '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil))
- (tide-setup)))
-
- (require 'web-mode)
- (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
- (add-hook 'web-mode-hook
- (lambda ()
- (when (string-equal "tsx" (file-name-extension buffer-file-name))
- (setup-tide-mode))))
- ;; enable typescript-tslint checker
- (flycheck-add-mode 'typescript-tslint 'web-mode)
-
- (require 'web-mode)
- (add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
- (add-hook 'web-mode-hook
- (lambda ()
- (when (string-equal "jsx" (file-name-extension buffer-file-name))
- (setup-tide-mode))))
- ;; configure jsx-tide checker to run after your default jsx checker
- (flycheck-add-mode 'javascript-eslint 'web-mode)
- (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
-
- (org-babel-do-load-languages
- 'org-babel-load-languages
- '((js . t)
- (shell . t)
- (emacs-lisp . t)))
-
- (setq org-todo-keywords
- '((sequence "TODO(t)" "|" "DONE(d)")
- (sequence "BUG(b)" "|" "INPROGRESS(i)" "FIXED(f)")
- (sequence "|" "CANCELED(c)")
- (sequence "|" "NEEDCLARIFICATION(n)")
- (sequence "|" "PROVIDEUPDATE(p)")
- (sequence "|" "WAITING(w)")
- ))
-
- (setq org-agenda-files
- '("~/Dropbox/Org/todo.org" "~/Dropbox/Org/archive.org"))
- (setq org-refile-targets
- '((nil :maxlevel . 1)
- (org-agenda-files :maxlevel . 1)))
-
- (add-hook 'focus-in-hook
- (lambda () (progn
- (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
-
- (add-hook 'focus-out-hook
- (lambda () (progn
- (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
-
- (defvar org-src-tab-acts-natively)
- (setq org-src-tab-acts-natively t)
- ;; (setenv "NODE_PATH"
- ;; (getenv "NODE_PATH"))
-
- (defvar org-confirm-babel-evaluate)
-
- (defun my-org-confirm-babel-evaluate (lang _body)
- "Execute certain languages without confirming.
- Takes LANG to allow and BODY to execute."
- (not (or (string= lang "js")
- (string= lang "restclient")
- (string= lang "emacs-lisp")
- (string= lang "shell"))))
- (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
- (add-to-list 'org-structure-template-alist
- (list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n"
- "\n"
- "#+END_SRC")))
- (add-to-list 'org-structure-template-alist
- (list "j" (concat "#+BEGIN_SRC js :cmd \"babel-node\"\n"
- "\n"
- "#+END_SRC")))
- (add-to-list 'org-structure-template-alist
- (list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
- "\n"
- "#+END_SRC")))
-
- ;;store org-mode links to messages
- (require 'org-mu4e)
- ;;store link to message if in header view, not to header query
- (setq org-mu4e-link-query-in-headers-mode nil)
-
- (setq org-capture-templates
- '(("t" "todo" entry (file+headline "~/todo.org" "Tasks")
- "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")))
-
- (elfeed-org)
- (setq rmh-elfeed-org-files (list "~/Dropbox/Org/elfeed.org"))
-
- (defun leo/elfeed-search (arg)
- "Search for ARG in feed."
- (interactive)
- (elfeed-search-set-filter arg))
-
- (define-key elfeed-search-mode-map "a" (lambda () (interactive) (leo/elfeed-search "")))
- (define-key elfeed-search-mode-map "e" (lambda () (interactive) (leo/elfeed-search "+emacs")))
- (define-key elfeed-search-mode-map "d" (lambda () (interactive) (leo/elfeed-search "+daily")))
- (define-key elfeed-search-mode-map "x" (lambda () (interactive) (leo/elfeed-search "xkcd")))
-
- (defun find-user-init-file ()
- "Edit the `~/.emacs.d/init.org' file."
- (interactive)
- (find-file "~/.emacs.d/init.org"))
-
- (defun find-todo-file ()
- "Edit the `~/todo.org' file."
- (interactive)
- (find-file "~/Dropbox/Org/todo.org"))
-
- (defun load-user-init-file ()
- "LO: Reload the `~/.emacs.d/init.elc' file."
- (interactive)
- (load-file "~/.emacs.d/init.elc"))
-
- (defun jump-to-symbol-internal (&optional backwardp)
- "Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward."
- (let* ((point (point))
- (bounds (find-tag-default-bounds))
- (beg (car bounds)) (end (cdr bounds))
- (str (isearch-symbol-regexp (find-tag-default)))
- (search (if backwardp 'search-backward-regexp
- 'search-forward-regexp)))
- (goto-char (if backwardp beg end))
- (funcall search str nil t)
- (cond ((<= beg (point) end) (goto-char point))
- (backwardp (forward-char (- point beg)))
- (t (backward-char (- end point))))))
-
- (defun jump-to-previous-like-this ()
- "Jumps to the previous occurrence of the symbol at point."
- (interactive)
- (jump-to-symbol-internal t))
-
- (defun jump-to-next-like-this ()
- "Jumps to the next occurrence of the symbol at point."
- (interactive)
- (jump-to-symbol-internal))
-
- (defun match-paren (arg)
- "Go to the matching paren if on a paren; otherwise insert ARG (a literal % sign)."
- (interactive "p")
- (cond ((looking-at "\\s(") (forward-list 1))
- ((looking-back "\\s(" 2) (backward-char 1) (forward-list 1))
- ((looking-at "\\s)") (forward-char 1) (backward-list 1))
- ((looking-back "\\s)" 2) (backward-list 1))
- (t (self-insert-command (or arg 1)))))
-
- (defun kill-this-buffer-unless-scratch ()
- "Works like `kill-this-buffer' unless the current buffer is the *scratch* buffer. In which case the buffer content is deleted and the buffer is buried."
- (interactive)
- (if (not (string= (buffer-name) "*scratch*"))
- (kill-this-buffer)
- (delete-region (point-min) (point-max))
- (switch-to-buffer (other-buffer))
- (bury-buffer "*scratch*")))
-
- (defun delete-backward-sentence ()
- "LO: Delete to the beginning of the sentence/line."
- (interactive)
- (delete-region (point) (progn (backward-sentence) (point))))
-
- (defun delete-backward-to-boundary (arg)
- "LO: Delete backward to the previous word boundary. With ARG, do this many times."
- (interactive "p")
- (let ((a (point))
- (b (progn
- (backward-word arg)
- (forward-word)
- (point))))
- (if (< a b)
- (delete-region a (progn (backward-word arg) (point)))
- (if (= a b)
- (delete-region a (progn (backward-word arg) (point)))
- (delete-region a b)))))
-
- (defun comment-or-uncomment-region-or-line ()
- "Comments or uncomments the region or the current line if there's no active region."
- (interactive)
- (let (beg end)
- (if (region-active-p)
- (setq beg (region-beginning) end (region-end))
- (setq beg (line-beginning-position) end (line-end-position)))
- (comment-or-uncomment-region beg end)))
-
- (defun fold-toggle (column)
- "Code folding by COLUMN."
- (interactive "P")
- (set-selective-display
- (or column
- (unless selective-display
- (1+ (current-column))))))
-
- (defun new-line-below ()
- "LO: Create a new line below current line."
- (interactive)
- (move-end-of-line 1)
- (newline-and-indent))
-
- (defun new-line-above ()
- "LO: Create a new line above current line."
- (interactive)
- (move-beginning-of-line 1)
- (newline)
- (forward-line -1))
-
- (defun duplicate-thing (comment)
- "LO: Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out."
- (interactive "P")
- (save-excursion
- (let ((start (if (region-active-p) (region-beginning) (point-at-bol)))
- (end (if (region-active-p) (region-end) (point-at-eol))))
- (goto-char end)
- (unless (region-active-p)
- (newline))
- (insert (buffer-substring start end))
- (when comment (comment-region start end)))))
-
- (defun tidy ()
- "LO: Ident, untabify and unwhitespacify current buffer, or region if active."
- (interactive)
- (let ((beg (if (region-active-p) (region-beginning) (point-min)))
- (end (if (region-active-p) (region-end) (point-max))))
- (let ((inhibit-message t))
- (indent-region beg end))
- (whitespace-cleanup)
- (untabify beg (if (< end (point-max)) end (point-max)))
- (if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done"))))
-
- (defun phil-columns ()
- "LO: Good 'ol Phil-Columns."
- (interactive)
- (message "Good 'ol fill-columns")
- (with-output-to-temp-buffer "*PHIL-COLUMN*"
- (shell-command "mpv --no-video 'https://www.youtube.com/watch?v=YkADj0TPrJA&t=3m16s' > /dev/null 2>&1 & sleep 8; pkill mpv"))
- (other-window 1)
- (delete-window))
-
- (declare-function first "Goto FIRST shell.")
- (declare-function goto-non-shell-buffer "Goto something other than a shell buffer.")
- (declare-function switch-shell "Switch shell.")
-
- (let ((last-shell ""))
- (defun toggle-shell ()
- (interactive)
- (cond ((string-match-p "^\\*shell<[1-9][0-9]*>\\*$" (buffer-name))
- (goto-non-shell-buffer))
- ((get-buffer last-shell) (switch-to-buffer last-shell))
- (t (shell (setq last-shell "*shell<1>*")))))
-
- (defun switch-shell (n)
- (let ((buffer-name (format "*shell<%d>*" n)))
- (setq last-shell buffer-name)
- (cond ((get-buffer buffer-name)
- (switch-to-buffer buffer-name))
- (t (shell buffer-name)
- (rename-buffer buffer-name)))))
-
- (defun goto-non-shell-buffer ()
- (let* ((r "^\\*shell<[1-9][0-9]*>\\*$")
- (shell-buffer-p (lambda (b) (string-match-p r (buffer-name b))))
- (non-shells (cl-remove-if shell-buffer-p (buffer-list))))
- (when non-shells
- (switch-to-buffer (first non-shells))))))
-
-
- (defadvice shell (after kill-with-no-query nil activate)
- "."
- (set-process-query-on-exit-flag (get-buffer-process ad-return-value) nil))
-
- (declare-function comint-truncate-buffer ".")
- (defun clear-comint ()
- "Run `comint-truncate-buffer' with the `comint-buffer-maximum-size' set to zero."
- (interactive)
- (let ((comint-buffer-maximum-size 0))
- (comint-truncate-buffer)))
-
- (defun c-setup ()
- "Compile."
- (local-set-key (kbd "C-c C-c") 'compile))
-
- (require 'company)
- (add-hook 'comint-mode-hook (lambda () (local-set-key (kbd "c-l") 'clear-comint)))
- (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
- (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
- (add-hook 'c-mode-common-hook 'c-setup)
- (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
-
- (defvar company-active-map (make-keymap)
- "company mode keymap.")
- (defvar custom-bindings (make-keymap)
- "a keymap of custom bindings.")
-
- (define-key custom-bindings (kbd "M-p") 'jump-to-previous-like-this)
- (define-key custom-bindings (kbd "M-n") 'jump-to-next-like-this)
- (define-key custom-bindings (kbd "M-<tab>") 'switch-to-next-buffer)
- (define-key custom-bindings (kbd "M-<backspace>")'delete-backward-to-boundary)
- (define-key custom-bindings (kbd "C-<backspace>")'delete-backward-to-boundary)
- (define-key custom-bindings (kbd "C-}") 'mc/mark-next-like-this)
- (define-key custom-bindings (kbd "C-)") 'mc/unmark-next-like-this)
- (define-key custom-bindings (kbd "C-{") 'mc/mark-previous-like-this)
- (define-key custom-bindings (kbd "C-(") 'mc/unmark-previous-like-this)
- (define-key custom-bindings (kbd "C-'") 'mc-hide-unmatched-lines-mode)
- (define-key custom-bindings (kbd "C-c 1") 'mc/insert-numbers)
- (define-key custom-bindings (kbd "C-c s") 'mc/sort-regions)
- (define-key custom-bindings "%" 'match-paren)
- (define-key custom-bindings (kbd "C-x .") 'dash-at-point)
- (define-key custom-bindings (kbd "C-x ,") 'dash-at-point-with-docset)
- (define-key custom-bindings (kbd "C-s") (lambda () (interactive) (swiper (format "%s" (thing-at-point 'symbol)))))
- (define-key custom-bindings (kbd "C-x C-l m") 'mu4e)
- (define-key custom-bindings (kbd "C-x C-o t") 'find-todo-file)
- (define-key custom-bindings (kbd "C-x C-l j") 'jabber)
- (define-key custom-bindings (kbd "C-x C-l f") 'elfeed)
- (define-key custom-bindings (kbd "C-x C-l a") 'org-agenda)
- (define-key custom-bindings (kbd "M-SPC") #'hyperspace)
- ;; (dolist (n (number-sequence 1 9))
- ;; (global-set-key (kbd (concat "M-" (int-to-string n)))
- ;; (lambda () (interactive) (switch-shell n))))
-
- (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
- (define-key company-active-map (kbd "C-n") 'company-select-next)
- (define-key company-active-map (kbd "C-p") 'company-select-previous)
- (define-key company-active-map (kbd "<tab>") 'company-complete)
-
- (define-key custom-bindings (kbd "C-c p") 'counsel-projectile-switch-project)
- (define-key custom-bindings (kbd "C-c f") 'counsel-projectile-find-file)
- (define-key custom-bindings (kbd "C-c m") 'magit-status)
- (define-key custom-bindings (kbd "C-c D") 'define-word-at-point)
- (define-key custom-bindings (kbd "C-@") 'er/expand-region)
- (define-key custom-bindings (kbd "C-#") 'er/contract-region)
- (define-key custom-bindings (kbd "C-S-c C-S-c") 'mc/edit-lines)
- (define-key custom-bindings (kbd "C-c b") 'ivy-switch-buffer)
- (define-key custom-bindings (kbd "C-c l") 'org-store-link)
- (define-key custom-bindings (kbd "C-c t") 'org-set-tags)
- (define-key custom-bindings (kbd "M-u") 'upcase-dwim)
- (define-key custom-bindings (kbd "M-c") 'capitalize-dwim)
- (define-key custom-bindings (kbd "M-l") 'downcase-dwim)
- (define-key custom-bindings (kbd "M-o") 'other-window)
- (define-key custom-bindings (kbd "C-c s") 'ispell-word)
- (define-key custom-bindings (kbd "C-c C-d") 'org-capture)
- (define-key custom-bindings (kbd "C-c <up>") 'windmove-up)
- (define-key custom-bindings (kbd "C-c <down>") 'windmove-down)
- (define-key custom-bindings (kbd "C-c <left>") 'windmove-left)
- (define-key custom-bindings (kbd "C-c <right>") 'windmove-right)
- (define-key custom-bindings (kbd "C-c a") (lambda () (interactive) (org-agenda nil "n")))
- (define-key custom-bindings (kbd "C-c e") 'find-user-init-file)
- (define-key custom-bindings (kbd "C-x f") 'phil-columns)
- (define-key custom-bindings (kbd "C-x k") 'kill-this-buffer-unless-scratch)
- (define-key custom-bindings (kbd "C-c d") 'duplicate-thing)
- (define-key custom-bindings (kbd "C-c c") 'comment-or-uncomment-region-or-line)
- (define-key custom-bindings (kbd "C-;") 'comment-or-uncomment-region-or-line)
- (define-key custom-bindings (kbd "C-o") 'new-line-below)
- (define-key custom-bindings (kbd "C-S-o") 'new-line-above)
- (define-key custom-bindings (kbd "<C-tab>") 'tidy)
- (define-key custom-bindings (kbd "M-q") 'kill-this-buffer)
- (define-key custom-bindings (kbd "M-RET") '(lambda () (interactive) (term (getenv "SHELL"))))
-
-
- (define-minor-mode custom-bindings-mode
- "A mode that activates custom-bindings."
- t nil custom-bindings)
-
- (cond ((member "PragmataPro" (font-family-list))
- (set-face-attribute 'default nil :font "PragmataPro-14")))
-
- (require 'doom-modeline)
- (doom-modeline-mode 1)
-
-
- ;; How tall the mode-line should be (only respected in GUI Emacs).
- (setq doom-modeline-height 30)
-
- ;; How wide the mode-line bar should be (only respected in GUI Emacs).
- (setq doom-modeline-bar-width 4)
-
- ;; Determines the style used by `doom-modeline-buffer-file-name'.
- ;;
- ;; Given ~/Projects/FOSS/emacs/lisp/comint.el
- ;; truncate-upto-project => ~/P/F/emacs/lisp/comint.el
- ;; truncate-from-project => ~/Projects/FOSS/emacs/l/comint.el
- ;; truncate-with-project => emacs/l/comint.el
- ;; truncate-except-project => ~/P/F/emacs/l/comint.el
- ;; truncate-upto-root => ~/P/F/e/lisp/comint.el
- ;; truncate-all => ~/P/F/e/l/comint.el
- ;; relative-from-project => emacs/lisp/comint.el
- ;; relative-to-project => lisp/comint.el
- ;; file-name => comint.el
- ;; buffer-name => comint.el<2> (uniquify buffer name)
- ;;
- ;; If you are expereicing the laggy issue, especially while editing remote files
- ;; with tramp, please try `file-name' style.
- ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
- (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
-
- ;; What executable of Python will be used (if nil nothing will be showed).
- (setq doom-modeline-python-executable "python")
-
- ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
- (setq doom-modeline-icon t)
-
- ;; Whether show the icon for major mode. It respects `doom-modeline-icon'.
- (setq doom-modeline-major-mode-icon t)
-
- ;; Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.
- (setq doom-modeline-major-mode-color-icon nil)
-
- ;; Whether display minor modes or not. Non-nil to display in mode-line.
- (setq doom-modeline-minor-modes nil)
-
- ;; If non-nil, a word count will be added to the selection-info modeline segment.
- (setq doom-modeline-enable-word-count nil)
-
- ;; If non-nil, only display one number for checker information if applicable.
- (setq doom-modeline-checker-simple-format t)
-
- ;; Whether display perspective name or not. Non-nil to display in mode-line.
- (setq doom-modeline-persp-name t)
-
- ;; Whether display `lsp' state or not. Non-nil to display in mode-line.
- (setq doom-modeline-lsp t)
-
- ;; Whether display github notifications or not. Requires `ghub` package.
- (setq doom-modeline-github nil)
-
- ;; The interval of checking github.
- (setq doom-modeline-github-interval (* 30 60))
-
- ;; Whether display environment version or not.
- (setq doom-modeline-env-version t)
-
- ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
- (setq doom-modeline-mu4e t)
|