;;; -*- 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)
|
|
(package-initialize)
|
|
|
|
(defvar my-packages
|
|
'(all-the-icons
|
|
amx
|
|
anzu
|
|
base16-theme
|
|
bbdb
|
|
better-defaults
|
|
company
|
|
company-go
|
|
counsel
|
|
counsel-projectile
|
|
dash-at-point
|
|
dashboard
|
|
diminish
|
|
dockerfile-mode
|
|
doom-modeline
|
|
doom-themes
|
|
ein
|
|
eldoc-eval
|
|
elfeed
|
|
elfeed-org
|
|
elpy
|
|
emmet-mode
|
|
excorporate
|
|
expand-region
|
|
fic-mode
|
|
flycheck
|
|
gitignore-mode
|
|
go-mode
|
|
go-playground
|
|
gorepl-mode
|
|
iedit
|
|
indium
|
|
ivy
|
|
ivy-hydra
|
|
jabber
|
|
json-mode
|
|
ledger-mode
|
|
magit
|
|
markdown-mode
|
|
material-theme
|
|
multiple-cursors
|
|
org-bullets
|
|
org-link-minor-mode
|
|
ox-reveal
|
|
poporg
|
|
projectile
|
|
rainbow-delimiters
|
|
rainbow-mode
|
|
rust-mode
|
|
shrink-path
|
|
tide
|
|
typescript-mode
|
|
;; use-package
|
|
web-mode
|
|
which-key))
|
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
|
(add-to-list 'package-archives '("melpa-stable" . "https://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)))
|
|
|
|
(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)
|
|
|
|
(require 'dashboard)
|
|
|
|
(dashboard-setup-startup-hook)
|
|
|
|
;; Set the title
|
|
(setq dashboard-banner-logo-title "Let's begin...")
|
|
;; Set the banner
|
|
(setq dashboard-startup-banner "~/.emacs.d/public/emacs-logo-350.png")
|
|
;; Value can be
|
|
;; 'official which displays the official emacs logo
|
|
;; 'logo which displays an alternative emacs logo
|
|
;; 1, 2 or 3 which displays one of the text banners
|
|
;; "path/to/your/image.png" which displays whatever image you would prefer
|
|
|
|
;; Content is not centered by default. To center, set
|
|
(setq dashboard-center-content t)
|
|
|
|
;; To enable shortcut "jump" indicators for each section, set
|
|
(setq dashboard-show-shortcuts t)
|
|
|
|
(setq show-week-agenda-p t)
|
|
(setq dashboard-org-agenda-categories '("work" "tasks"))
|
|
(setq dashboard-items '((recents . 10)
|
|
(bookmarks . 5)
|
|
(projects . 5)
|
|
;; (agenda . 5)
|
|
;; (registers . 5)
|
|
))
|
|
|
|
(add-to-list 'dashboard-items '(agenda) t)
|
|
|
|
(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)
|
|
(setq fill-column 80)
|
|
|
|
;; (add-hook 'text-mode-hook
|
|
;; (lambda ()
|
|
;; (when (y-or-n-p "Auto Fill mode? ")
|
|
;; (turn-on-auto-fill))))
|
|
|
|
(setq whitespace-style '(face empty tabs lines-tail trailing))
|
|
(global-whitespace-mode 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)
|
|
|
|
(defvar diary-file (expand-file-name "~/.emacs.d/diary/main"))
|
|
|
|
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)
|
|
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
|
|
(add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
|
|
(add-hook 'calendar-today-visible-hook 'calendar-mark-today)
|
|
|
|
(setq calendar-latitude 44
|
|
calendar-longitude -97
|
|
calendar-location-name "Hayti, SD")
|
|
|
|
(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)
|
|
|
|
(add-hook 'artist-mode-hook
|
|
(lambda ()
|
|
(setq compilation-read-command nil)
|
|
(set
|
|
(make-local-variable 'compile-command)
|
|
(format "java -jar /home/locust/scripts/java/ditaa0_9.jar -E %s | awk -F': ' '{print $2}' | awk NF | tail -n1 | xargs -I{} feh {}"
|
|
(buffer-file-name)))))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.uml\\'" . artist-mode))
|
|
|
|
(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)
|
|
|
|
(autoload 'ledger-mode "ledger-mode" "A major mode for Ledger" t)
|
|
(add-to-list 'load-path
|
|
(expand-file-name "/path/to/ledger/source/lisp/"))
|
|
(add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))
|
|
|
|
(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 'exec-path "/home/locust/.local/bin")
|
|
|
|
;; (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
|
|
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
|
|
|
|
(require 'mu4e)
|
|
|
|
(setq mu4e-maildir "/home/locust/Mail"
|
|
mu4e-mu-binary "/usr/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/bin/w3m -T text/html" ;; HTML to text command
|
|
mu4e-headers-include-related nil ;; Stop threading in INBOX
|
|
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"
|
|
"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 leo/convert-message-set-point ()
|
|
;; "Set the point to the start of the message body."
|
|
;; (interactive)
|
|
;; (beginning-of-buffer)
|
|
;; (search-forward "--text follows this line--")
|
|
;; (forward-char)
|
|
;; )
|
|
;; (defun leo/convert-message-from-markdown ()
|
|
;; "Convert a markdown flavored mail buffer to html w/mime support."
|
|
;; (interactive)
|
|
;; (if (y-or-n-p "Convert to HTML? ")
|
|
;; ((leo/convert-message-set-point)
|
|
;; (save-excursion
|
|
;; (message-goto-body)
|
|
;; (shell-command-on-region (point) (point-max) "~/.emacs.d/scripts/expand-mime.sh" nil t)))
|
|
;; (message "Aborting."))
|
|
;; )
|
|
|
|
(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-refile-folder . "/eaglecrk/Archive" )
|
|
( 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-refile-folder . "/gmail/[Gmail]/All 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)
|
|
|
|
(autoload 'poporg-dwim "poporg" nil t)
|
|
(global-set-key (kbd "C-c \"") 'poporg-dwim)
|
|
|
|
;;; 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))
|
|
|
|
(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 leo-swiper ()
|
|
"LO: Custom swiper."
|
|
(interactive)
|
|
(let ((word (thing-at-point 'symbol)))
|
|
(if word (swiper (format "%s" word)))
|
|
(unless word (swiper (format ""))))
|
|
)
|
|
|
|
(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 artist-mode-map (make-keymap)
|
|
"artist 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-r") 'fill-paragraph)
|
|
(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") 'leo-swiper)
|
|
(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 "C-,") 'org-cycle-agenda-files)
|
|
(define-key custom-bindings (kbd "C-x C-l c") 'calendar)
|
|
(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 c") 'ivy-resume)
|
|
(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-;") '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")
|
|
(lambda ()
|
|
(interactive)
|
|
(kill-this-buffer)
|
|
(delete-window)
|
|
(message nil)
|
|
(message "Done")
|
|
))
|
|
;; (define-key custom-bindings (kbd "M-RET") '(lambda () (interactive) (term (getenv "SHELL"))))
|
|
|
|
(define-key artist-mode-map (kbd "C-c C-c") 'compile)
|
|
|
|
|
|
(define-minor-mode custom-bindings-mode
|
|
"A mode that activates custom-bindings."
|
|
t nil custom-bindings)
|
|
|
|
(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))
|
|
|
|
;; Workaround to get Projectile to work again
|
|
(setq projectile-git-submodule-command nil)
|
|
|
|
(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" "/home/locust/go")
|
|
(add-to-list 'exec-path "/home/locust/go/bin")
|
|
|
|
(add-to-list 'exec-path "/usr/local/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 "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)")
|
|
(sequence "|" "CANCELED(c)")
|
|
(sequence "|" "NEEDCLARIFICATION(n)")
|
|
(sequence "|" "PROVIDEUPDATE(p)")
|
|
(sequence "|" "WAITING(w)")
|
|
))
|
|
|
|
(setq org-agenda-files
|
|
'("~/Dropbox/Org/todo.org"
|
|
"~/Dropbox/Org/archive.org"
|
|
"~/Dropbox/Org/diary/eaglecrk.org"))
|
|
(setq org-refile-targets
|
|
'((nil :maxlevel . 3)
|
|
(org-agenda-files :maxlevel . 3)))
|
|
|
|
;; (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)
|
|
|
|
(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 "elisp")
|
|
(string= lang "sh")
|
|
(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 \"/usr/local/bin/babel-node\" :results output code\n"
|
|
"\n"
|
|
"#+END_SRC")))
|
|
(add-to-list 'org-structure-template-alist
|
|
(list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
|
|
"\n"
|
|
"#+END_SRC")))
|
|
(setq org-directory "~/Dropbox/Org"
|
|
org-default-notes-file (concat org-directory "/todo.org")
|
|
org-startup-folded t
|
|
org-startup-indented t
|
|
org-startup-align-all-tables t
|
|
org-startup-with-inline-images t
|
|
org-startup-with-latex-preview t
|
|
org-log-done t
|
|
org-log-done-with-time t
|
|
org-log-into-drawer t
|
|
org-hide-leading-stars t
|
|
org-pretty-entities t
|
|
org-use-property-inheritance t
|
|
org-html-validation-link nil
|
|
org-html-text-markup-alist '((bold . "<b>%s</b>")
|
|
(code . "<code>%s</code>")
|
|
(italic . "<i>%s</i>")
|
|
(strike-through . "<del>%s</del>")
|
|
(underline . "<span class=\"underline\">%s</span>")
|
|
(verbatim . "<code class=\"verbatim\">%s</code>"))
|
|
)
|
|
|
|
(require 'org-protocol)
|
|
;; Ensure the following is in ~/.config/mimeapps.list
|
|
;;
|
|
;; [Default Applications]
|
|
;; x-scheme-handler/org-protocol=userapp-emacsclient.desktop
|
|
(setq org-capture-templates
|
|
'(("t" "new task" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks")
|
|
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
|
|
("n" "new note" entry (file+headline org-default-notes-file "Notes")
|
|
"* %?\n%i\n")
|
|
("l" "store link" entry (file+olp org-default-notes-file "Links" "Unfiled")
|
|
"* %a\n%?\n")
|
|
("d" "store link w/drawer" entry (file+olp org-default-notes-file "Links" "Unfiled")
|
|
"* %?\n%l\n:COPIED_TEXT:\n %i\n:END:\n")
|
|
("f" "dotfile" entry (file+headline "~/Dropbox/Org/dotfiles.org" "Other")
|
|
"* %?\n:PROPERTIES:\n:CUSTOM_ID: %(org-id-get-create)\n:END:\n")
|
|
))
|
|
|
|
|
|
(defun my-org-config ()
|
|
"Activate org and yas in 'org-mode' buffers."
|
|
(yas-minor-mode)
|
|
(lambda ()
|
|
(local-set-key (kbd "M-RET") 'org-insert-todo-heading)
|
|
(global-set-key (kbd "C-c c") nil)
|
|
(local-set-key (kbd "C-c c i") 'org-clock-in)
|
|
(local-set-key (kbd "C-c c o") 'org-clock-out)
|
|
)
|
|
)
|
|
(add-hook 'org-mode-hook #'my-org-config)
|
|
|
|
(require 'ox-reveal)
|
|
|
|
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"
|
|
org-reveal-klipsify-src t)
|
|
|
|
;;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)
|
|
|
|
(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")))
|
|
|
|
;; Enable ligatures without prettify-symbols
|
|
|
|
(provide 'add-pragmatapro-symbol-keywords)
|
|
|
|
(defconst pragmatapro-fontlock-keywords-alist
|
|
(mapcar (lambda (regex-char-pair)
|
|
`(,(car regex-char-pair)
|
|
(0 (prog1 ()
|
|
(compose-region (match-beginning 1)
|
|
(match-end 1)
|
|
,(concat (list ?\C-i)
|
|
(list (decode-char 'ucs (cadr regex-char-pair)))))))))
|
|
'(("\\(\\[ERROR\\]\\)" #XE380)
|
|
("\\(\\[DEBUG\\]\\)" #XE381)
|
|
("\\(\\[INFO\\]\\)" #XE382)
|
|
("\\(\\[WARN\\]\\)" #XE383)
|
|
("\\(\\[WARNING\\]\\)" #XE384)
|
|
("\\(\\[ERR\\]\\)" #XE385)
|
|
("\\(\\[FATAL\\]\\)" #XE386)
|
|
("\\(\\[TRACE\\]\\)" #XE387)
|
|
("\\(!!\\)" #XE900)
|
|
("\\(!=\\)" #XE901)
|
|
("\\(!==\\)" #XE902)
|
|
("\\(!!!\\)" #XE903)
|
|
("\\(!≡\\)" #XE904)
|
|
("\\(!≡≡\\)" #XE905)
|
|
("[^<]\\(!>\\)" #XE906)
|
|
("\\(#(\\)" #XE920)
|
|
("\\(#_\\)" #XE921)
|
|
("\\(#{\\)" #XE922)
|
|
("\\(#\\?\\)" #XE923)
|
|
("[^<]\\(#>\\)" #XE924)
|
|
("\\(##\\)" #XE925)
|
|
("\\(%=\\)" #XE930)
|
|
("[^<]\\(%>\\)" #XE931)
|
|
("\\(&%\\)" #XE940)
|
|
("\\(&&\\)" #XE941)
|
|
("\\(&\\*\\)" #XE942)
|
|
("\\(&\\+\\)" #XE943)
|
|
("\\(&-\\)" #XE944)
|
|
("\\(&/\\)" #XE945)
|
|
("\\(&=\\)" #XE946)
|
|
("\\(&&&\\)" #XE947)
|
|
("[^<]\\(&>\\)" #XE948)
|
|
("\\(\\*\\*\\*\\)" #XE960)
|
|
("\\(\\*=\\)" #XE961)
|
|
("\\(\\*/\\)" #XE962)
|
|
("[^<]\\(\\*>\\)" #XE963)
|
|
("\\(\\+\\+\\)" #XE970)
|
|
("\\(\\+\\+\\+\\)" #XE971)
|
|
("[^\\+]\\(\\+=\\)" #XE972)
|
|
("[^<]\\(\\+>\\)" #XE973)
|
|
("\\(\\+\\+=\\)" #XE974)
|
|
("\\(--\\)" #XE980)
|
|
("[^-]\\(-<\\)" #XE981)
|
|
("\\(-<<\\)" #XE982)
|
|
("\\(-=\\)" #XE983)
|
|
("[^|]\\(->\\)" #XE984)
|
|
("[^|]\\(->>\\)" #XE985)
|
|
("\\(---\\)" #XE986)
|
|
("\\(-->\\)" #XE987)
|
|
("\\(-\\+-\\)" #XE988)
|
|
("\\(-\\\\/\\)" #XE989)
|
|
("[^\\^]\\(\\.\\.\\)" #XE990)
|
|
("\\(\\.\\.\\.\\)" #XE991)
|
|
("\\(\\.\\.<\\)" #XE992)
|
|
("\\(\\.>\\)" #XE993)
|
|
("\\(\\.~\\)" #XE994)
|
|
("\\(\\.=\\)" #XE995)
|
|
("\\(/\\*\\)" #XE9A0)
|
|
("\\(//\\)" #XE9A1)
|
|
("[^<]\\(/>\\)" #XE9A2)
|
|
("[^=]\\(/=\\)" #XE9A3)
|
|
("\\(/==\\)" #XE9A4)
|
|
("\\(///\\)" #XE9A5)
|
|
("\\(/\\*\\*\\)" #XE9A6)
|
|
("\\(::\\)" #XE9B0)
|
|
("\\(:=\\)" #XE9B1)
|
|
("[^≡]\\(:≡\\)" #XE9B2)
|
|
("\\(:>\\)" #XE9B3)
|
|
("\\(:=>\\)" #XE9B4)
|
|
("\\(<\\*\\)" #XE9C1)
|
|
("\\(<\\*>\\)" #XE9C2)
|
|
("[^<]\\(<-\\)" #XE9C4)
|
|
("[^-]\\(<<\\)" #XE9C5)
|
|
("\\(<<<\\)" #XE9C6)
|
|
("\\(<<=\\)" #XE9C7)
|
|
("[^<]\\(<=\\)" #XE9C8)
|
|
("\\(<=>\\)" #XE9C9)
|
|
("\\(<>\\)" #XE9CA)
|
|
("\\(<<-\\)" #XE9CC)
|
|
("\\(<|\\)" #XE9CD)
|
|
("\\(<|>\\)" #XE9CB)
|
|
("\\(<=<\\)" #XE9CE)
|
|
("[^<]\\(<~\\)" #XE9CF)
|
|
("\\(<~~\\)" #XE9D0)
|
|
("\\(<<~\\)" #XE9D1)
|
|
("\\(<\\$\\)" #XE9D2)
|
|
("\\(<\\$>\\)" #XE9C0)
|
|
("\\(<\\+\\)" #XE9D3)
|
|
("\\(<\\+>\\)" #XE9C3)
|
|
("\\(<~>\\)" #XE9E0)
|
|
("\\(<\\*\\*>\\)" #XE9E1)
|
|
("\\(<<\\^\\)" #XE9E2)
|
|
("\\(<!\\)" #XE9E3)
|
|
("\\(<!>\\)" #XE9D4)
|
|
("\\(<@\\)" #XE9E4)
|
|
("\\(<#\\)" #XE9E5)
|
|
("\\(<#>\\)" #XE9D6)
|
|
("\\(<%\\)" #XE9E6)
|
|
("\\(<%>\\)" #XE9D7)
|
|
("[^<]\\(<\\^\\)" #XE9E7)
|
|
("\\(<&\\)" #XE9E8)
|
|
("\\(<&>\\)" #XE9D9)
|
|
("\\(<\\?\\)" #XE9E9)
|
|
("\\(<\\.\\)" #XE9EA)
|
|
("\\(<\\.>\\)" #XE9DB)
|
|
("\\(</\\)" #XE9EB)
|
|
("\\(</>\\)" #XE9DC)
|
|
("\\(<\\\\\\)" #XE9EC)
|
|
("\\(<\"\\)" #XE9ED)
|
|
("\\(<\">\\)" #XE9DE)
|
|
("\\(<:\\)" #XE9EE)
|
|
("\\(<:>\\)" #XE9DF)
|
|
("\\(<->\\)" #XE9EF)
|
|
("\\(<!--\\)" #XE9F0)
|
|
("\\(<--\\)" #XE9F1)
|
|
("\\(<~<\\)" #XE9F2)
|
|
("\\(<==>\\)" #XE9F3)
|
|
("\\(==<\\)" #XEA00)
|
|
("[^/!<=>]\\(==\\)[^><=]" #XEA01)
|
|
("\\(===\\)" #XEA02)
|
|
("[^<]\\(==>\\)" #XEA03)
|
|
("[^=:<]\\(=>\\)" #XEA04)
|
|
("\\(=~\\)" #XEA05)
|
|
("\\(=>>\\)" #XEA06)
|
|
("\\(=/=\\)" #XEA07)
|
|
("[^!]\\(≡≡\\)" #XEA10)
|
|
("\\(≡≡≡\\)" #XEA11)
|
|
("\\(≡:≡\\)" #XEA12)
|
|
("[^>]\\(>-\\)" #XEA20)
|
|
("\\(>=\\)" #XEA21)
|
|
("[^=-]\\(>>\\)" #XEA22)
|
|
("\\(>>-\\)" #XEA23)
|
|
("\\(>==\\)" #XEA24)
|
|
("\\(>>>\\)" #XEA25)
|
|
("\\(>=>\\)" #XEA26)
|
|
("\\(>>\\^\\)" #XEA27)
|
|
("\\(\\?\\?\\)" #XEA40)
|
|
("\\(\\?~\\)" #XEA41)
|
|
("\\(\\?=\\)" #XEA42)
|
|
("\\(\\?>\\)" #XEA43)
|
|
("\\(<\\?>\\)" #XE9DA)
|
|
("\\(\\?\\?\\?\\)" #XEA44)
|
|
("\\(\\^=\\)" #XEA48)
|
|
("\\(\\^\\.\\)" #XEA49)
|
|
("\\(\\^\\?\\)" #XEA4A)
|
|
("\\(\\^\\.\\.\\)" #XEA4B)
|
|
("\\(\\^<<\\)" #XEA4C)
|
|
("\\(\\^>\\)" #XEA4E)
|
|
("\\(\\^>>\\)" #XEA4D)
|
|
("\\(<\\^>\\)" #XE9D8)
|
|
("[^\\\\]\\(\\\\\\\\\\)" #XEA50)
|
|
("[^<]\\(\\\\>\\)" #XEA51)
|
|
("\\(<\\\\>\\)" #XE9DD)
|
|
("\\(\\\\/-\\)" #XEA52)
|
|
("\\(@>\\)" #XEA57)
|
|
("\\(<@>\\)" #XE9D5)
|
|
("\\(|=\\)" #XEA60)
|
|
("\\(||\\)" #XEA61)
|
|
("[^<]\\(|>\\)" #XEA62)
|
|
("\\(|||\\)" #XEA63)
|
|
("\\(|\\+|\\)" #XEA64)
|
|
("\\(|->\\)" #XEA65)
|
|
("\\(|-->\\)" #XEA66)
|
|
("\\(|=>\\)" #XEA67)
|
|
("\\(|==>\\)" #XEA68)
|
|
("\\(~=\\)" #XEA70)
|
|
("[^~<]\\(~>\\)" #XEA71)
|
|
("\\(~~>\\)" #XEA72)
|
|
("\\(~>>\\)" #XEA73)
|
|
("[^<]\\(\">\\)" #XEA90))))
|
|
|
|
(defun add-pragmatapro-symbol-keywords ()
|
|
(font-lock-add-keywords nil pragmatapro-fontlock-keywords-alist))
|
|
|
|
(add-hook 'prog-mode-hook
|
|
#'add-pragmatapro-symbol-keywords)
|
|
|
|
;; Enable Org mode checkbox ligatures without prettify-symbols
|
|
|
|
(provide 'add-checkbox-symbol-keywords)
|
|
|
|
(defconst checkbox-fontlock-keywords-alist
|
|
(mapcar (lambda (regex-char-pair)
|
|
`(,(car regex-char-pair)
|
|
(0 (prog1 ()
|
|
(compose-region (match-beginning 1)
|
|
(match-end 1)
|
|
,(concat (list ?\C-i)
|
|
(list (decode-char 'ucs (cadr regex-char-pair)))))))))
|
|
'(("\\(\\[ \\]\\)" #XF096);2B1C
|
|
("\\(\\[-\\]\\)" #XF147);29C7;F458
|
|
("\\(\\[X\\]\\)" #XF046);2BBD
|
|
)))
|
|
|
|
(defun add-checkbox-symbol-keywords ()
|
|
(font-lock-add-keywords nil checkbox-fontlock-keywords-alist))
|
|
|
|
(add-hook 'org-mode-hook
|
|
#'add-checkbox-symbol-keywords)
|
|
|
|
;; All ligatures (for testing)
|
|
|
|
;; [ERROR]
|
|
;; [DEBUG]
|
|
;; [INFO]
|
|
;; [WARN]
|
|
;; [WARNING]
|
|
;; [ERR]
|
|
;; [FATAL]
|
|
;; [TRACE]
|
|
;; !!
|
|
;; !=
|
|
;; !==
|
|
;; !!!
|
|
;; !≡
|
|
;; !≡≡
|
|
;; !>
|
|
;; #(
|
|
;; #_
|
|
;; #{
|
|
;; #?
|
|
;; #>
|
|
;; ##
|
|
;; %=
|
|
;; %>
|
|
;; &%
|
|
;; &&
|
|
;; &*
|
|
;; &+
|
|
;; &-
|
|
;; &/
|
|
;; &=
|
|
;; &&&
|
|
;; &>
|
|
;; ***
|
|
;; *=
|
|
;; */
|
|
;; *>
|
|
;; ++
|
|
;; +++
|
|
;; +=
|
|
;; +>
|
|
;; ++=
|
|
;; --
|
|
;; -<
|
|
;; -<<
|
|
;; -=
|
|
;; ->
|
|
;; ->>
|
|
;; ---
|
|
;; -->
|
|
;; -+-
|
|
;; -\/
|
|
;; ..
|
|
;; ...
|
|
;; ..<
|
|
;; .>
|
|
;; .~
|
|
;; .=
|
|
;; /*
|
|
;; //
|
|
;; />
|
|
;; /=
|
|
;; /==
|
|
;; ///
|
|
;; /**
|
|
;; ::
|
|
;; :=
|
|
;; :≡
|
|
;; :>
|
|
;; :=>
|
|
;; <$>
|
|
;; <*
|
|
;; <*>
|
|
;; <+>
|
|
;; <-
|
|
;; <<
|
|
;; <<<
|
|
;; <<=
|
|
;; <=
|
|
;; <=>
|
|
;; <>
|
|
;; <|>
|
|
;; <<-
|
|
;; <|
|
|
;; <=<
|
|
;; <~
|
|
;; <~~
|
|
;; <<~
|
|
;; <$
|
|
;; <+
|
|
;; <!>
|
|
;; <@>
|
|
;; <#>
|
|
;; <%>
|
|
;; <^>
|
|
;; <&>
|
|
;; <?>
|
|
;; <.>
|
|
;; </>
|
|
;; <\>
|
|
;; <">
|
|
;; <:>
|
|
;; <~>
|
|
;; <**>
|
|
;; <<^
|
|
;; <!
|
|
;; <@
|
|
;; <#
|
|
;; <%
|
|
;; <^
|
|
;; <&
|
|
;; <?
|
|
;; <.
|
|
;; </
|
|
;; <\
|
|
;; <"
|
|
;; <:
|
|
;; <->
|
|
;; <!--
|
|
;; <--
|
|
;; <~<
|
|
;; <==>
|
|
;; ==<
|
|
;; ==
|
|
;; ===
|
|
;; ==>
|
|
;; =>
|
|
;; =~
|
|
;; =>>
|
|
;; =/=
|
|
;; ≡≡
|
|
;; ≡≡≡
|
|
;; ≡:≡
|
|
;; >-
|
|
;; >=
|
|
;; >>
|
|
;; >>-
|
|
;; >==
|
|
;; >>>
|
|
;; >=>
|
|
;; >>^
|
|
;; ??
|
|
;; ?~
|
|
;; ?=
|
|
;; ?>
|
|
;; ???
|
|
;; ^=
|
|
;; ^.
|
|
;; ^?
|
|
;; ^..
|
|
;; ^<<
|
|
;; ^>>
|
|
;; ^>
|
|
;; \\
|
|
;; \>
|
|
;; \/-
|
|
;; @>
|
|
;; |=
|
|
;; ||
|
|
;; |>
|
|
;; |||
|
|
;; |+|
|
|
;; |->
|
|
;; |-->
|
|
;; |=>
|
|
;; |==>
|
|
;; ~=
|
|
;; ~>
|
|
;; ~~>
|
|
;; ~>>
|
|
;; ">
|
|
|
|
(cond ((member "PragmataPro Liga" (font-family-list))
|
|
(set-face-attribute 'default nil :font "PragmataPro Liga-13")))
|
|
;; (cond ((member "IBM Plex Mono Thin" (font-family-list))
|
|
;; (set-face-attribute 'default nil :font "IBM Plex Mono Thin-13")))
|
|
;; (cond ((member "IBM Plex Mono" (font-family-list))
|
|
;; (set-face-attribute 'default nil :font "IBM Plex Mono-12")))
|
|
|
|
(add-hook 'org-mode-hook 'org-bullets-mode)
|
|
|
|
(set-face-attribute 'org-level-1 nil :height 1.3)
|
|
(set-face-attribute 'org-level-2 nil :height 1.1)
|
|
(set-face-attribute 'org-level-3 nil :height 1.05)
|
|
(set-face-attribute 'org-level-4 nil :height 1.05)
|
|
(set-face-attribute 'org-scheduled-today nil :height 1.0)
|
|
(set-face-attribute 'org-agenda-date-today nil :height 1.1)
|
|
;; (set-face-attribute 'org-table nil :foreground "#008787")
|
|
|
|
(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)
|