No NARF, only DOOM

This commit is contained in:
Henrik Lissner 2016-05-20 22:37:30 -04:00
parent a984bf4f26
commit ad225d2591
104 changed files with 1404 additions and 1409 deletions

View file

@ -4,7 +4,7 @@ REPO_URL="https://github.com/hlissner"
all: install autoloads bootstrap.elc all: install autoloads bootstrap.elc
# If you keep emacs open while running either of these, run narf/reload afterwards # If you keep emacs open while running either of these, run doom-reload afterwards
install: autoloads _install bootstrap.elc install: autoloads _install bootstrap.elc
update: autoloads _update bootstrap.elc update: autoloads _update bootstrap.elc
@ -12,7 +12,7 @@ autoloads:
@$(EMACS) --batch \ @$(EMACS) --batch \
-l bootstrap.el \ -l bootstrap.el \
-l core/core-defuns.el \ -l core/core-defuns.el \
--eval '(narf-reload-autoloads)' 2>&1 --eval '(doom-reload-autoloads)' 2>&1
compile: autoloads bootstrap.elc compile: autoloads bootstrap.elc
@$(EMACS) --batch -f batch-byte-compile 2>&1 \ @$(EMACS) --batch -f batch-byte-compile 2>&1 \

View file

@ -1,4 +1,4 @@
# NARF Emacs # DOOM Emacs
![Screenshot](/../screenshots/main.png?raw=true) ![Screenshot](/../screenshots/main.png?raw=true)
> What we do every night, Pinky... > What we do every night, Pinky...
@ -27,11 +27,11 @@ make snippets # install hlissner/emacs-snippets into private/snippets
To get a picture of what's in here, check out: To get a picture of what's in here, check out:
* [The Caskfile](Cask): lists installed plugins and where they're configured. * **[The Caskfile](Cask)**: lists installed plugins and where they're configured.
* [init.el](init.el): lists all loaded modules * **[init.el](init.el)**: lists all loaded modules
* [private/my-bindings.el](private/my-bindings.el): most of the custom keybinds * **[private/my-bindings.el](private/my-bindings.el)**: most of the custom keybinds
* [private/my-commands.el](private/my-commands.el): available custom ex commands * **[private/my-commands.el](private/my-commands.el)**: available custom ex commands
* [ext/Makefile](ext/Makefile): lists external dependencies * **[ext/Makefile](ext/Makefile)**: lists external dependencies
### Highlights ### Highlights

View file

@ -1,27 +1,28 @@
;;; bootstrap.el ;;; bootstrap.el
(eval-when-compile (eval-when-compile (require 'cl-lib))
(defconst emacs-start-time (current-time))
(require 'cl-lib))
;; Global constants ;; Global constants
(eval-and-compile (eval-and-compile
(defconst narf-default-theme 'wombat) (defconst emacs-start-time (current-time))
(defconst narf-terminal-theme 'wombat) (defconst emacs-end-time nil)
(defconst narf-default-font nil)
(defconst narf-emacs-dir (expand-file-name "." user-emacs-directory)) (defconst doom-default-theme 'wombat)
(defconst narf-core-dir (concat narf-emacs-dir "/core")) (defconst doom-terminal-theme 'wombat)
(defconst narf-modules-dir (concat narf-emacs-dir "/modules")) (defconst doom-default-font nil)
(defconst narf-private-dir (concat narf-emacs-dir "/private"))
(defconst narf-packages-dir (concat narf-emacs-dir "/.cask/" emacs-version "/elpa")) (defconst doom-emacs-dir (expand-file-name "." user-emacs-directory))
(defconst narf-script-dir (concat narf-emacs-dir "/scripts")) (defconst doom-core-dir (concat doom-emacs-dir "/core"))
(defconst narf-ext-dir (concat narf-emacs-dir "/ext")) (defconst doom-modules-dir (concat doom-emacs-dir "/modules"))
(defconst narf-snippet-dirs (list (concat narf-private-dir "/snippets") (defconst doom-private-dir (concat doom-emacs-dir "/private"))
(concat narf-private-dir "/templates"))) (defconst doom-packages-dir (concat doom-emacs-dir "/.cask/" emacs-version "/elpa"))
(defconst doom-script-dir (concat doom-emacs-dir "/scripts"))
(defconst doom-ext-dir (concat doom-emacs-dir "/ext"))
(defconst doom-snippet-dirs (list (concat doom-private-dir "/snippets")
(concat doom-private-dir "/templates")))
;; Hostname and emacs version-based elisp temp directories ;; Hostname and emacs version-based elisp temp directories
(defconst narf-temp-dir (format "%s/cache/%s/%s.%s" (defconst doom-temp-dir (format "%s/cache/%s/%s.%s"
narf-private-dir (system-name) doom-private-dir (system-name)
emacs-major-version emacs-minor-version)) emacs-major-version emacs-minor-version))
(defconst IS-MAC (eq system-type 'darwin)) (defconst IS-MAC (eq system-type 'darwin))
@ -29,7 +30,7 @@
(defconst IS-WINDOWS (eq system-type 'windows-nt))) (defconst IS-WINDOWS (eq system-type 'windows-nt)))
(eval-when-compile (eval-when-compile
(defvar narf--load-path load-path) (defvar doom--load-path load-path)
;; Helper for traversing subdirectories recursively ;; Helper for traversing subdirectories recursively
(defun --subdirs (path &optional include-self) (defun --subdirs (path &optional include-self)
@ -45,11 +46,11 @@
;; ;;
;; Shut up byte-compiler! ;; Shut up byte-compiler!
(defvar narf-current-theme) (defvar doom-current-theme)
(defvar narf-current-font) (defvar doom-current-font)
(defun narf (packages) (defun doom (packages)
"Bootstrap NARF emacs and initialize PACKAGES" "Bootstrap DOOM emacs and initialize PACKAGES"
(setq-default gc-cons-threshold 4388608 (setq-default gc-cons-threshold 4388608
gc-cons-percentage 0.4) gc-cons-percentage 0.4)
@ -61,23 +62,20 @@
;; Scan various folders to populate the load-paths ;; Scan various folders to populate the load-paths
(setq load-path (setq load-path
(eval-when-compile (eval-when-compile
(append (list narf-private-dir) (append (list doom-private-dir)
(--subdirs narf-core-dir t) (--subdirs doom-core-dir t)
(--subdirs narf-modules-dir t) (--subdirs doom-modules-dir t)
(--subdirs narf-packages-dir) (--subdirs doom-packages-dir)
(--subdirs (expand-file-name "../bootstrap" narf-packages-dir)) (--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
narf--load-path)) doom--load-path))
custom-theme-load-path custom-theme-load-path
(append (list (expand-file-name "themes/" narf-private-dir)) (append (list (expand-file-name "themes/" doom-private-dir))
custom-theme-load-path)) custom-theme-load-path))
;; Local settings
(load "~/.emacs.local.el" t t) (load "~/.emacs.local.el" t t)
(setq narf-current-theme (if (display-graphic-p) narf-default-theme narf-terminal-theme) (setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
narf-current-font narf-default-font) doom-current-font doom-default-font)
;; Here we a'go!
(mapc 'require packages) (mapc 'require packages)
(when (display-graphic-p) (when (display-graphic-p)
(require 'server) (require 'server)
(unless (server-running-p) (unless (server-running-p)

View file

@ -10,7 +10,7 @@
(mapc (lambda (rule) (mapc (lambda (rule)
(define-auto-insert (define-auto-insert
(nth 0 rule) (nth 0 rule)
(vector `(lambda () (narf/auto-insert-snippet ,(nth 1 rule) ',(nth 2 rule) ,(nth 3 rule)))))) (vector `(lambda () (doom/auto-insert-snippet ,(nth 1 rule) ',(nth 2 rule) ,(nth 3 rule))))))
`(;; General `(;; General
("/\\.gitignore$" "__" gitignore-mode) ("/\\.gitignore$" "__" gitignore-mode)
("/Dockerfile$" "__" dockerfile-mode) ("/Dockerfile$" "__" dockerfile-mode)
@ -34,7 +34,7 @@
;; Elisp ;; Elisp
("-test\\.el$" "__" emacs-ert-mode) ("-test\\.el$" "__" emacs-ert-mode)
("/.+\\.el$" "__initfile" emacs-lisp-mode) ("/.+\\.el$" "__initfile" emacs-lisp-mode)
("\\(\\.emacs\\.d\\|narf-emacs\\)/private/\\(snippets\\|templates\\)/.+$" ("\\(\\.emacs\\.d\\|doom-emacs\\)/private/\\(snippets\\|templates\\)/.+$"
"__" snippet-mode) "__" snippet-mode)
;; Go ;; Go

View file

@ -15,12 +15,12 @@
company-backends '((company-capf company-keywords)) company-backends '((company-capf company-keywords))
company-quickhelp-delay nil company-quickhelp-delay nil
company-statistics-file (concat narf-temp-dir "/company-stats-cache.el")) company-statistics-file (concat doom-temp-dir "/company-stats-cache.el"))
:config :config
;; Rewrites evil-complete to use company-dabbrev ;; Rewrites evil-complete to use company-dabbrev
(setq evil-complete-next-func 'narf/company-evil-complete-next (setq evil-complete-next-func 'doom/company-evil-complete-next
evil-complete-previous-func 'narf/company-evil-complete-previous) evil-complete-previous-func 'doom/company-evil-complete-previous)
(push 'company-sort-by-occurrence company-transformers) (push 'company-sort-by-occurrence company-transformers)
(global-company-mode +1) (global-company-mode +1)
@ -45,7 +45,7 @@
(use-package company-dict (use-package company-dict
:commands company-dict :commands company-dict
:config (setq company-dict-dir (concat narf-private-dir "/dict"))) :config (setq company-dict-dir (concat doom-private-dir "/dict")))
(use-package company-template (use-package company-template
:after ac-php-company) :after ac-php-company)

View file

@ -80,14 +80,14 @@ Examples:
(,@(cond ((or files in pred) (,@(cond ((or files in pred)
(when (and files (not (or (listp files) (stringp files)))) (when (and files (not (or (listp files) (stringp files))))
(user-error "associate! :files expects a string or list of strings")) (user-error "associate! :files expects a string or list of strings"))
(let ((hook-name (intern (format "narf--init-mode-%s" mode)))) (let ((hook-name (intern (format "doom--init-mode-%s" mode))))
`(progn `(progn
(defun ,hook-name () (defun ,hook-name ()
(when (and ,(if match `(if buffer-file-name (string-match-p ,match buffer-file-name)) t) (when (and ,(if match `(if buffer-file-name (string-match-p ,match buffer-file-name)) t)
(or ,(not files) (or ,(not files)
(and (boundp ',mode) (and (boundp ',mode)
(not ,mode) (not ,mode)
(narf/project-has-files ,@(-list files)))) (doom/project-has-files ,@(-list files))))
(or (not ,pred) (or (not ,pred)
(funcall ,pred buffer-file-name))) (funcall ,pred buffer-file-name)))
(,mode 1))) (,mode 1)))
@ -96,7 +96,7 @@ Examples:
(mapcar (lambda (m) (intern (format "%s-hook" m))) in)) (mapcar (lambda (m) (intern (format "%s-hook" m))) in))
`((add-hook 'find-file-hook ',hook-name)))))) `((add-hook 'find-file-hook ',hook-name))))))
(match (match
`(add-to-list ',(if minor 'narf-auto-minor-mode-alist 'auto-mode-alist) `(add-to-list ',(if minor 'doom-auto-minor-mode-alist 'auto-mode-alist)
(cons ,match ',mode))) (cons ,match ',mode)))
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)" (t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)"
mode in match files))))))) mode in match files)))))))
@ -108,7 +108,7 @@ Examples:
(mode (intern mode-name)) (mode (intern mode-name))
(mode-map (intern (format "%s-map" mode-name))) (mode-map (intern (format "%s-map" mode-name)))
(mode-hook-sym (intern (format "%s-hook" mode-name))) (mode-hook-sym (intern (format "%s-hook" mode-name)))
(mode-init-sym (intern (format "narf--init-project-%s" mode-name)))) (mode-init-sym (intern (format "doom--init-project-%s" mode-name))))
(let ((modes (plist-get body :modes)) (let ((modes (plist-get body :modes))
(pred (plist-get body :when)) (pred (plist-get body :when))
(match (plist-get body :match)) (match (plist-get body :match))
@ -200,9 +200,9 @@ Examples:
((keywordp key) ((keywordp key)
(when (memq key '(:leader :localleader)) (when (memq key '(:leader :localleader))
(push (cond ((eq key :leader) (push (cond ((eq key :leader)
narf-leader-prefix) doom-leader)
((eq key :localleader) ((eq key :localleader)
narf-localleader-prefix)) doom-localleader))
rest) rest)
(setq key :prefix)) (setq key :prefix))
(pcase key (pcase key
@ -249,21 +249,20 @@ Examples:
(defmacro def-repeat! (command next-func prev-func) (defmacro def-repeat! (command next-func prev-func)
"Repeat motions with SPC/S-SPC" "Repeat motions with SPC/S-SPC"
`(defadvice ,command `(defadvice ,command
(before ,(intern (format "narf-space--%s" (symbol-name command))) activate) (before ,(intern (format "doom-space--%s" (symbol-name command))) activate)
(define-key evil-motion-state-map (kbd "SPC") ',next-func) (define-key evil-motion-state-map (kbd "SPC") ',next-func)
(define-key evil-motion-state-map (kbd "S-SPC") ',prev-func))) (define-key evil-motion-state-map (kbd "S-SPC") ',prev-func)))
;; ;;
(defun narf|update-scratch-buffer-cwd (&optional dir) (defun doom|update-scratch-buffer-cwd (&optional dir)
"Make sure scratch buffer is always 'in a project', and looks good." "Make sure scratch buffer is always 'in a project', and looks good."
(let ((dir (or dir (narf/project-root))) (let ((dir (or dir (doom/project-root))))
(scratchbuf (get-buffer-create "*scratch*"))) (with-current-buffer doom-buffer
(with-current-buffer scratchbuf ;; Reset scratch buffer if it wasn't visible
;; Darken the window if it's the only one left (unless (or (eq (current-buffer) doom-buffer)
(if (one-window-p t) (--any? (eq doom-buffer it) (doom/get-visible-windows)))
(kill-local-variable 'face-remapping-alist) (and (one-window-p t) (doom-mode-init))
(set (make-local-variable 'face-remapping-alist) (setq-local indicate-empty-lines nil))
'((default narf-default))))
(setq default-directory dir) (setq default-directory dir)
(setq mode-line-format '(:eval (spaceline-ml-scratch)))))) (setq mode-line-format '(:eval (spaceline-ml-scratch))))))
@ -272,34 +271,34 @@ Examples:
;; Global Defuns ;; Global Defuns
;; ;;
(defun narf-reload () (defun doom-reload ()
"Reload `load-path', in case you updated cask while emacs was open!" "Reload `load-path', in case you updated cask while emacs was open!"
(interactive) (interactive)
(setq load-path (append (list narf-private-dir narf-core-dir narf-modules-dir narf-packages-dir) (setq load-path (append (list doom-private-dir doom-core-dir doom-modules-dir doom-packages-dir)
(f-directories narf-core-dir nil t) (f-directories doom-core-dir nil t)
(f-directories narf-modules-dir nil t) (f-directories doom-modules-dir nil t)
(f-directories narf-packages-dir) (f-directories doom-packages-dir)
(f-directories (f-expand "../bootstrap" narf-packages-dir)) (f-directories (f-expand "../bootstrap" doom-packages-dir))
narf--load-path))) doom--load-path)))
(defun narf-reload-autoloads () (defun doom-reload-autoloads ()
"Regenerate autoloads for NARF emacs." "Regenerate autoloads for DOOM emacs."
(interactive) (interactive)
(let ((generated-autoload-file (concat narf-core-dir "/autoloads.el"))) (let ((generated-autoload-file (concat doom-core-dir "/autoloads.el")))
(when (file-exists-p generated-autoload-file) (when (file-exists-p generated-autoload-file)
(delete-file generated-autoload-file)) (delete-file generated-autoload-file))
(mapc (lambda (dir) (mapc (lambda (dir)
(update-directory-autoloads (concat dir "/defuns")) (update-directory-autoloads (concat dir "/defuns"))
(message "Scanned: %s" dir)) (message "Scanned: %s" dir))
(list narf-core-dir narf-modules-dir)) (list doom-core-dir doom-modules-dir))
(when (called-interactively-p 'interactive) (when (called-interactively-p 'interactive)
(require 'autoloads)) (require 'autoloads))
(message "Done!"))) (message "Done!")))
(defun narf-fix-unicode (font chars &optional size) (defun doom-fix-unicode (font chars &optional size)
"Display certain unicode characters in a specific font. "Display certain unicode characters in a specific font.
e.g. (narf-fix-unicode \"DejaVu Sans\" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))" e.g. (doom-fix-unicode \"DejaVu Sans\" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))"
(mapc (lambda (x) (set-fontset-font (mapc (lambda (x) (set-fontset-font
"fontset-default" `(,x . ,x) "fontset-default" `(,x . ,x)
(font-spec :name font :size size) nil 'prepend)) (font-spec :name font :size size) nil 'prepend))

View file

@ -38,14 +38,14 @@
;; Save point across sessions ;; Save point across sessions
(require 'saveplace) (require 'saveplace)
(setq-default (setq-default
save-place-file (concat narf-temp-dir "/saveplace") save-place-file (concat doom-temp-dir "/saveplace")
save-place t) save-place t)
(when (>= emacs-major-version 25) (when (>= emacs-major-version 25)
(save-place-mode +1)) (save-place-mode +1))
;; Save history across sessions ;; Save history across sessions
(require 'savehist) (require 'savehist)
(setq savehist-file (concat narf-temp-dir "/savehist") (setq savehist-file (concat doom-temp-dir "/savehist")
savehist-save-minibuffer-history t savehist-save-minibuffer-history t
savehist-additional-variables savehist-additional-variables
'(kill-ring search-ring regexp-search-ring)) '(kill-ring search-ring regexp-search-ring))
@ -64,7 +64,7 @@
;; Keep track of recently opened files ;; Keep track of recently opened files
(require 'recentf) (require 'recentf)
(setq recentf-save-file (concat narf-temp-dir "/recentf") (setq recentf-save-file (concat doom-temp-dir "/recentf")
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$" recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$" "emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
"wg-default" "/company-statistics-cache.el$") "wg-default" "/company-statistics-cache.el$")
@ -78,7 +78,7 @@
(setq winner-dont-bind-my-keys t) (setq winner-dont-bind-my-keys t)
(winner-mode 1) (winner-mode 1)
(add-hook! after-init (add-hook! after-init
(setq winner-boring-buffers narf-ignore-buffers)) (setq winner-boring-buffers doom-ignore-buffers))
;; Let editorconfig handle global whitespace settings ;; Let editorconfig handle global whitespace settings
(use-package editorconfig :demand t (use-package editorconfig :demand t
@ -118,15 +118,15 @@
;; Disable by default, please ;; Disable by default, please
(electric-indent-mode -1) (electric-indent-mode -1)
;; Smarter, keyword-based electric-indent (see `def-electric!') ;; Smarter, keyword-based electric-indent (see `def-electric!')
(defvar narf-electric-indent-p nil) (defvar doom-electric-indent-p nil)
(defvar-local narf-electric-indent-words '()) (defvar-local doom-electric-indent-words '())
(setq electric-indent-chars '(?\n ?\^?)) (setq electric-indent-chars '(?\n ?\^?))
(push (lambda (c) (push (lambda (c)
(when (and (eolp) narf-electric-indent-words) (when (and (eolp) doom-electric-indent-words)
(save-excursion (save-excursion
(backward-word) (backward-word)
(looking-at-p (looking-at-p
(concat "\\<" (regexp-opt narf-electric-indent-words)))))) (concat "\\<" (regexp-opt doom-electric-indent-words))))))
electric-indent-functions) electric-indent-functions)
@ -148,7 +148,7 @@
(use-package dumb-jump (use-package dumb-jump
:commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back) :commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back)
:config :config
(setq dumb-jump-default-project narf-emacs-dir) (setq dumb-jump-default-project doom-emacs-dir)
(dumb-jump-mode +1)) (dumb-jump-mode +1))
(use-package emr (use-package emr
@ -166,7 +166,7 @@
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p) :commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
:config (setq hs-isearch-open t) :config (setq hs-isearch-open t)
:init :init
(advice-add 'evil-toggle-fold :before 'narf*load-hs-minor-mode) (advice-add 'evil-toggle-fold :before 'doom*load-hs-minor-mode)
;; Prettify code folding in emacs ;; Prettify code folding in emacs
(define-fringe-bitmap 'hs-marker [16 48 112 240 112 48 16] nil nil 'center) (define-fringe-bitmap 'hs-marker [16 48 112 240 112 48 16] nil nil 'center)
(defface hs-face '((t (:background "#ff8"))) (defface hs-face '((t (:background "#ff8")))
@ -196,14 +196,14 @@
imenu-list-position 'right imenu-list-position 'right
imenu-list-size 32) imenu-list-size 32)
(map! :map imenu-list-major-mode-map (map! :map imenu-list-major-mode-map
:n [escape] 'narf/imenu-list-quit :n [escape] 'doom/imenu-list-quit
:n "RET" 'imenu-list-goto-entry :n "RET" 'imenu-list-goto-entry
:n "SPC" 'imenu-list-display-entry :n "SPC" 'imenu-list-display-entry
:n [tab] 'hs-toggle-hiding)) :n [tab] 'hs-toggle-hiding))
(use-package re-builder (use-package re-builder
:commands (re-builder reb-mode-buffer-p) :commands (re-builder reb-mode-buffer-p)
:init (add-hook 'reb-mode-hook 'narf|reb-cleanup) :init (add-hook 'reb-mode-hook 'doom|reb-cleanup)
:config :config
(evil-set-initial-state 'reb-mode 'insert) (evil-set-initial-state 'reb-mode 'insert)
(setq reb-re-syntax 'string) (setq reb-re-syntax 'string)
@ -262,35 +262,35 @@
;; behave more like vim (or how I like it). ;; behave more like vim (or how I like it).
;; Line-wise mouse selection on margin ;; Line-wise mouse selection on margin
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'narf/mouse-drag-line) (global-set-key (kbd "<left-margin> <down-mouse-1>") 'doom/mouse-drag-line)
(global-set-key (kbd "<left-margin> <mouse-1>") 'narf/mouse-select-line) (global-set-key (kbd "<left-margin> <mouse-1>") 'doom/mouse-select-line)
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'narf/mouse-select-line) (global-set-key (kbd "<left-margin> <drag-mouse-1>") 'doom/mouse-select-line)
;; Restores "dumb" indentation to the tab key. This rustles a lot of peoples' ;; Restores "dumb" indentation to the tab key. This rustles a lot of peoples'
;; jimmies, apparently, but it's how I like it. ;; jimmies, apparently, but it's how I like it.
(map! :i "<tab>" 'narf/dumb-indent (map! :i "<tab>" 'doom/dumb-indent
:i "<backtab>" 'narf/dumb-dedent :i "<backtab>" 'doom/dumb-dedent
:i "<C-tab>" 'indent-for-tab-command :i "<C-tab>" 'indent-for-tab-command
;; No dumb-tab for lisp ;; No dumb-tab for lisp
(:map lisp-mode-map :i [remap narf/dumb-indent] 'indent-for-tab-command) (:map lisp-mode-map :i [remap doom/dumb-indent] 'indent-for-tab-command)
(:map emacs-lisp-mode-map :i [remap narf/dumb-indent] 'indent-for-tab-command) (:map emacs-lisp-mode-map :i [remap doom/dumb-indent] 'indent-for-tab-command)
;; Highjacks space/backspace to: ;; Highjacks space/backspace to:
;; a) eat spaces on either side of the cursor, if present ( | ) -> (|) ;; a) eat spaces on either side of the cursor, if present ( | ) -> (|)
;; b) allow backspace to delete space-indented blocks intelligently ;; b) allow backspace to delete space-indented blocks intelligently
;; c) but do none of this when inside a string ;; c) but do none of this when inside a string
:i "SPC" 'narf/inflate-space-maybe :i "SPC" 'doom/inflate-space-maybe
:i [remap backward-delete-char-untabify] 'narf/deflate-space-maybe :i [remap backward-delete-char-untabify] 'doom/deflate-space-maybe
:i [remap newline] 'narf/newline-and-indent :i [remap newline] 'doom/newline-and-indent
;; Smarter move-to-beginning-of-line ;; Smarter move-to-beginning-of-line
:i [remap move-beginning-of-line] 'narf/move-to-bol :i [remap move-beginning-of-line] 'doom/move-to-bol
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist ;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
:i "C-e" 'narf/move-to-eol :i "C-e" 'doom/move-to-eol
:i "C-u" 'narf/backward-kill-to-bol-and-indent :i "C-u" 'doom/backward-kill-to-bol-and-indent
;; Fixes delete ;; Fixes delete
:i "<kp-delete>" 'delete-char :i "<kp-delete>" 'delete-char
;; Fix osx keymappings and then some ;; Fix osx keymappings and then some
:i "<M-left>" 'narf/move-to-bol :i "<M-left>" 'doom/move-to-bol
:i "<M-right>" 'narf/move-to-eol :i "<M-right>" 'doom/move-to-eol
:i "<M-up>" 'beginning-of-buffer :i "<M-up>" 'beginning-of-buffer
:i "<M-down>" 'end-of-buffer :i "<M-down>" 'end-of-buffer
:i "<C-up>" 'smart-up :i "<C-up>" 'smart-up

View file

@ -23,7 +23,7 @@
(use-package repl-toggle (use-package repl-toggle
:commands (rtog/toggle-repl rtog/add-repl) :commands (rtog/toggle-repl rtog/add-repl)
:init :init
(defvar narf--repl-buffer nil) (defvar doom--repl-buffer nil)
(defvar-local repl-p nil) (defvar-local repl-p nil)
(setq rtog/mode-repl-alist '()) (setq rtog/mode-repl-alist '())
@ -61,14 +61,14 @@
:n "c" 'realgud:cmd-continue) :n "c" 'realgud:cmd-continue)
;; Temporary Ex commands for the debugger ;; Temporary Ex commands for the debugger
(def-tmp-excmd! narf:def-debug-on narf:def-debug-off (def-tmp-excmd! doom:def-debug-on doom:def-debug-off
("n[ext]" . realgud:cmd-next) ("n[ext]" . realgud:cmd-next)
("s[tep]" . realgud:cmd-step) ("s[tep]" . realgud:cmd-step)
("b[reak]" . narf:debug-toggle-breakpoint) ("b[reak]" . doom:debug-toggle-breakpoint)
("c[ontinue]" . realgud:cmd-continue)) ("c[ontinue]" . realgud:cmd-continue))
(advice-add 'realgud-cmdbuf-init :after 'narf:def-debug-on) (advice-add 'realgud-cmdbuf-init :after 'doom:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'narf:def-debug-off)) (advice-add 'realgud:cmd-quit :after 'doom:def-debug-off))
(provide 'core-eval) (provide 'core-eval)
;;; core-eval.el ends here ;;; core-eval.el ends here

View file

@ -67,25 +67,25 @@
(map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window) (map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window)
(progn ; evil hacks (progn ; evil hacks
(advice-add 'evil-force-normal-state :after 'narf*evil-esc-quit) (advice-add 'evil-force-normal-state :after 'doom*evil-esc-quit)
(defun narf*evil-esc-quit () (defun doom*evil-esc-quit ()
"Close popups, disable search highlights and quit the minibuffer if open." "Close popups, disable search highlights and quit the minibuffer if open."
(if (eq major-mode 'help-mode) (if (eq major-mode 'help-mode)
(narf/popup-close) (doom/popup-close)
(let ((minib-p (minibuffer-window-active-p (minibuffer-window))) (let ((minib-p (minibuffer-window-active-p (minibuffer-window)))
(evil-hl-p (evil-ex-hl-active-p 'evil-ex-search))) (evil-hl-p (evil-ex-hl-active-p 'evil-ex-search)))
(when minib-p (abort-recursive-edit)) (when minib-p (abort-recursive-edit))
(when evil-hl-p (evil-ex-nohighlight)) (when evil-hl-p (evil-ex-nohighlight))
;; Close non-repl popups and clean up `narf-popup-windows' ;; Close non-repl popups and clean up `doom-popup-windows'
(unless (or minib-p evil-hl-p (unless (or minib-p evil-hl-p
(memq (get-buffer-window) narf-popup-windows)) (memq (get-buffer-window) doom-popup-windows))
(mapc (lambda (w) (mapc (lambda (w)
(if (window-live-p w) (if (window-live-p w)
(with-selected-window w (with-selected-window w
(unless (derived-mode-p 'comint-mode) (unless (derived-mode-p 'comint-mode)
(narf/popup-close w))) (doom/popup-close w)))
(narf/popup-remove w))) (doom/popup-remove w)))
narf-popup-windows))))) doom-popup-windows)))))
;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by ;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by
;; workgroups killing windows ;; workgroups killing windows
@ -130,7 +130,7 @@
(let ((flags (split-string (caddr match) ":" t)) (let ((flags (split-string (caddr match) ":" t))
(path (file-relative-name (path (file-relative-name
(pcase (cadr match) (pcase (cadr match)
("@" (narf/project-root)) ("@" (doom/project-root))
("%" (buffer-file-name)) ("%" (buffer-file-name))
("#" (and (other-buffer) (buffer-file-name (other-buffer))))) ("#" (and (other-buffer) (buffer-file-name (other-buffer)))))
default-directory)) default-directory))
@ -169,8 +169,8 @@
(setq file-name (replace-regexp-in-string regexp "\\1" file-name t))))) (setq file-name (replace-regexp-in-string regexp "\\1" file-name t)))))
;; Extra argument types for highlight buffer (or global) regexp matches ;; Extra argument types for highlight buffer (or global) regexp matches
(evil-ex-define-argument-type buffer-match :runner narf/evil-ex-buffer-match) (evil-ex-define-argument-type buffer-match :runner doom/evil-ex-buffer-match)
(evil-ex-define-argument-type global-match :runner narf/evil-ex-global-match) (evil-ex-define-argument-type global-match :runner doom/evil-ex-global-match)
(evil-define-interactive-code "<//>" (evil-define-interactive-code "<//>"
:ex-arg buffer-match :ex-arg buffer-match
@ -199,7 +199,7 @@
(use-package evil-exchange (use-package evil-exchange
:commands evil-exchange :commands evil-exchange
:config (advice-add 'evil-force-normal-state :after 'narf*evil-exchange-off)) :config (advice-add 'evil-force-normal-state :after 'doom*evil-exchange-off))
(use-package evil-multiedit (use-package evil-multiedit
:commands (evil-multiedit-match-all :commands (evil-multiedit-match-all
@ -247,7 +247,7 @@
(use-package evil-easymotion (use-package evil-easymotion
:defer 1 :defer 1
:init (defvar narf--evil-snipe-repeat-fn) :init (defvar doom--evil-snipe-repeat-fn)
:config :config
(evilem-default-keybindings "g SPC") (evilem-default-keybindings "g SPC")
(evilem-define (kbd "g SPC n") 'evil-ex-search-next) (evilem-define (kbd "g SPC n") 'evil-ex-search-next)
@ -263,7 +263,7 @@
(evil-snipe-enable-highlight) (evil-snipe-enable-highlight)
(evil-snipe-enable-incremental-highlight))) (evil-snipe-enable-incremental-highlight)))
(setq narf--evil-snipe-repeat-fn (setq doom--evil-snipe-repeat-fn
(evilem-create 'evil-snipe-repeat (evilem-create 'evil-snipe-repeat
:bind ((evil-snipe-scope 'whole-buffer) :bind ((evil-snipe-scope 'whole-buffer)
(evil-snipe-enable-highlight) (evil-snipe-enable-highlight)
@ -283,7 +283,7 @@
:config :config
(evil-snipe-mode 1) (evil-snipe-mode 1)
(evil-snipe-override-mode 1) (evil-snipe-override-mode 1)
(define-key evil-snipe-parent-transient-map (kbd "C-;") 'narf/evil-snipe-easymotion)) (define-key evil-snipe-parent-transient-map (kbd "C-;") 'doom/evil-snipe-easymotion))
(use-package evil-surround (use-package evil-surround
:commands (global-evil-surround-mode :commands (global-evil-surround-mode
@ -302,13 +302,13 @@
(add-hook 'org-mode-hook 'embrace-org-mode-hook) (add-hook 'org-mode-hook 'embrace-org-mode-hook)
(add-hook! (text-mode prog-mode) (add-hook! (text-mode prog-mode)
;; Escaped surround characters ;; Escaped surround characters
(embrace-add-pair-regexp ?\\ "\\[[{(]" "\\[]})]" 'narf/embrace-escaped)) (embrace-add-pair-regexp ?\\ "\\[[{(]" "\\[]})]" 'doom/embrace-escaped))
(add-hook! emacs-lisp-mode (add-hook! emacs-lisp-mode
(embrace-add-pair ?\` "`" "'")) (embrace-add-pair ?\` "`" "'"))
(add-hook! (emacs-lisp-mode lisp-mode) (add-hook! (emacs-lisp-mode lisp-mode)
(embrace-add-pair-regexp ?f "([^ ]+ " ")" 'narf/embrace-elisp-fn)) (embrace-add-pair-regexp ?f "([^ ]+ " ")" 'doom/embrace-elisp-fn))
(add-hook! (org-mode latex-mode) (add-hook! (org-mode latex-mode)
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" 'narf/embrace-latex))) (embrace-add-pair-regexp ?l "\\[a-z]+{" "}" 'doom/embrace-latex)))
(use-package evil-visualstar (use-package evil-visualstar
:commands (global-evil-visualstar-mode :commands (global-evil-visualstar-mode
@ -326,11 +326,11 @@
;; evil-escape causes noticable lag in linewise motions in visual mode, so disable it in ;; evil-escape causes noticable lag in linewise motions in visual mode, so disable it in
;; visual mode ;; visual mode
(defun narf|evil-escape-disable () (evil-escape-mode -1)) (defun doom|evil-escape-disable () (evil-escape-mode -1))
(defun narf|evil-escape-enable () (evil-escape-mode +1)) (defun doom|evil-escape-enable () (evil-escape-mode +1))
(add-hook 'evil-visual-state-entry-hook 'narf|evil-escape-disable) (add-hook 'evil-visual-state-entry-hook 'doom|evil-escape-disable)
(add-hook 'evil-visual-state-exit-hook 'narf|evil-escape-enable) (add-hook 'evil-visual-state-exit-hook 'doom|evil-escape-enable)
(add-hook 'evil-insert-state-exit-hook 'narf|evil-escape-enable) (add-hook 'evil-insert-state-exit-hook 'doom|evil-escape-enable)
(push 'neotree-mode evil-escape-excluded-major-modes)) (push 'neotree-mode evil-escape-excluded-major-modes))

View file

@ -24,7 +24,7 @@
:n "RET" 'flycheck-error-list-goto-error) :n "RET" 'flycheck-error-list-goto-error)
;; Flycheck buffer on ESC in normal mode. ;; Flycheck buffer on ESC in normal mode.
(advice-add 'evil-force-normal-state :after 'narf*flycheck-buffer) (advice-add 'evil-force-normal-state :after 'doom*flycheck-buffer)
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow (define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
[0 0 0 8 24 56 120 248 120 56 24 8 0 0 0] [0 0 0 8 24 56 120 248 120 56 24 8 0 0 0]

View file

@ -46,14 +46,14 @@
:e "ESC" 'helm-keyboard-quit) :e "ESC" 'helm-keyboard-quit)
;;; Helm hacks ;;; Helm hacks
(defvar narf-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring") (defvar doom-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring")
;; Shrink source headers if there is only one source ;; Shrink source headers if there is only one source
(add-hook 'helm-after-initialize-hook 'narf*helm-hide-source-header-maybe) (add-hook 'helm-after-initialize-hook 'doom*helm-hide-source-header-maybe)
;; A simpler prompt: see `helm-global-prompt' ;; A simpler prompt: see `helm-global-prompt'
(advice-add 'helm :filter-args 'narf*helm-replace-prompt) (advice-add 'helm :filter-args 'doom*helm-replace-prompt)
;; Hide mode-line in helm windows ;; Hide mode-line in helm windows
(advice-add 'helm-display-mode-line :override 'narf*helm-hide-header) (advice-add 'helm-display-mode-line :override 'doom*helm-hide-header)
(after! yasnippet (push 'helm-alive-p yas-dont-activate))) (after! yasnippet (push 'helm-alive-p yas-dont-activate)))
@ -71,8 +71,8 @@
(use-package helm-buffers (use-package helm-buffers
:commands (helm-buffers-list helm-mini) :commands (helm-buffers-list helm-mini)
:config :config
(defvar narf-helm-force-project-buffers nil) (defvar doom-helm-force-project-buffers nil)
(defun helm*buffer-list (&rest _) (narf/get-buffer-names narf-helm-force-project-buffers)) (defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
(advice-add 'helm-buffer-list :override 'helm*buffer-list)) (advice-add 'helm-buffer-list :override 'helm*buffer-list))
(use-package helm-tags (use-package helm-tags

View file

@ -1,6 +1,6 @@
;;; core-os-linux.el --- Debian-specific settings ;;; core-os-linux.el --- Debian-specific settings
(defun narf-open-with (&optional app-name path) (defun doom-open-with (&optional app-name path)
(interactive) (interactive)
(error "Not yet implemented")) (error "Not yet implemented"))

View file

@ -68,7 +68,7 @@
;; OS-integration ;; OS-integration
;; ;;
(defun narf-open-with (&optional app-name path) (defun doom-open-with (&optional app-name path)
"Send PATH to APP-NAME on OSX." "Send PATH to APP-NAME on OSX."
(interactive) (interactive)
(let* ((path (f-full (s-replace "'" "\\'" (let* ((path (f-full (s-replace "'" "\\'"
@ -85,16 +85,16 @@
(defmacro def-open-with! (id &optional app dir) (defmacro def-open-with! (id &optional app dir)
`(defun ,(intern (format "os-%s" id)) () `(defun ,(intern (format "os-%s" id)) ()
(interactive) (interactive)
(narf-open-with ,app ,dir))) (doom-open-with ,app ,dir)))
(def-open-with! open-in-default-program) (def-open-with! open-in-default-program)
(def-open-with! open-in-browser "Google Chrome") (def-open-with! open-in-browser "Google Chrome")
(def-open-with! reveal "Finder" default-directory) (def-open-with! reveal "Finder" default-directory)
(def-open-with! reveal-project "Finder" (narf/project-root)) (def-open-with! reveal-project "Finder" (doom/project-root))
(def-open-with! upload "Transmit") (def-open-with! upload "Transmit")
(def-open-with! upload-folder "Transmit" default-directory) (def-open-with! upload-folder "Transmit" default-directory)
(def-open-with! send-to-launchbar "LaunchBar") (def-open-with! send-to-launchbar "LaunchBar")
(def-open-with! send-project-to-launchbar "LaunchBar" (narf/project-root)) (def-open-with! send-project-to-launchbar "LaunchBar" (doom/project-root))
(defun os-switch-to-term () (defun os-switch-to-term ()
(interactive) (interactive)
@ -102,8 +102,8 @@
(defun os-switch-to-term-and-cd () (defun os-switch-to-term-and-cd ()
(interactive) (interactive)
(narf:send-to-tmux (format "cd %s" (shell-quote-argument default-directory))) (doom:send-to-tmux (format "cd %s" (shell-quote-argument default-directory)))
(narf-switch-to-iterm)) (doom-switch-to-iterm))
;; Open with external programs ;; Open with external programs
(use-package openwith (use-package openwith

View file

@ -1,6 +1,6 @@
;;; core-os-win32.el --- Windows-specific settings ;;; core-os-win32.el --- Windows-specific settings
(defun narf-open-with (&optional app-name path) (defun doom-open-with (&optional app-name path)
(interactive) (interactive)
(error "Not yet implemented")) (error "Not yet implemented"))

View file

@ -10,7 +10,7 @@
:config :config
(shackle-mode 1) (shackle-mode 1)
(setq shackle-rules (setq shackle-rules
'(;; Debuggers `(;; Debuggers
("\\`\\*\\(g\\|zsh\\|bash\\)db.*?\\*\\'" :align below :size 20 :regexp t) ("\\`\\*\\(g\\|zsh\\|bash\\)db.*?\\*\\'" :align below :size 20 :regexp t)
("\\`\\*trepanjs.*?\\*\\'" :align below :size 20 :regexp t) ("\\`\\*trepanjs.*?\\*\\'" :align below :size 20 :regexp t)
("\\`\\*\\(debug:\\)haskell\\*\\'" :align below :size 20 :regexp t) ("\\`\\*\\(debug:\\)haskell\\*\\'" :align below :size 20 :regexp t)
@ -47,7 +47,7 @@
("^\\*.+-Profiler-Report .+\\*$" :align below :size 0.3 :regexp t) ("^\\*.+-Profiler-Report .+\\*$" :align below :size 0.3 :regexp t)
("*processing-compilation*" :align below :size 10 :noselect t) ("*processing-compilation*" :align below :size 10 :noselect t)
("*Backtrace*" :align below :size 0.25 :noselect t) ("*Backtrace*" :align below :size 0.25 :noselect t)
("*scratch*" :align below :size 0.3 :select t) (,doom-buffer-name :align below :size 0.3 :select t)
("*Help*" :align below :size 16 :select t) ("*Help*" :align below :size 16 :select t)
("*Messages*" :align below :size 15 :select t) ("*Messages*" :align below :size 15 :select t)
("*Warnings*" :align below :size 10 :noselect t) ("*Warnings*" :align below :size 10 :noselect t)
@ -57,26 +57,26 @@
;; Custom + REPLs ;; Custom + REPLs
("*eval*" :align below :size 12) ("*eval*" :align below :size 12)
("^\\*narf.+\\*$" :regexp t :align below :size 12 :noselect t) ("^\\*doom.+\\*$" :regexp t :align below :size 12 :noselect t)
((:custom (lambda (b &rest _) ((:custom (lambda (b &rest _)
(when (featurep 'repl-toggle) (when (featurep 'repl-toggle)
(when (string-prefix-p "*" (buffer-name (get-buffer b))) (when (string-prefix-p "*" (buffer-name (get-buffer b)))
(with-current-buffer b repl-p))))) (with-current-buffer b repl-p)))))
:popup t :align below :size 16))) :popup t :align below :size 16)))
(defvar narf-popup-windows '() (defvar doom-popup-windows '()
"A list of windows that have been opened via shackle. Do not touch this!") "A list of windows that have been opened via shackle. Do not touch this!")
;; There is no shackle-popup hook, so I hacked one in ;; There is no shackle-popup hook, so I hacked one in
(advice-add 'shackle-display-buffer :after 'narf|run-popup-hooks) (advice-add 'shackle-display-buffer :after 'doom|run-popup-hooks)
(add-hook 'shackle-popup-hook 'narf|popup-init) ; Keep track of popups (add-hook 'shackle-popup-hook 'doom|popup-init) ; Keep track of popups
(add-hook 'shackle-popup-hook 'narf|hide-mode-line) ; No mode line in popups (add-hook 'shackle-popup-hook 'doom|hide-mode-line) ; No mode line in popups
;; Prevents popups from messaging with windows-moving functions ;; Prevents popups from messaging with windows-moving functions
(defun narf*save-popups (orig-fun &rest args) (defun doom*save-popups (orig-fun &rest args)
(narf/popup-save (apply orig-fun args))) (doom/popup-save (apply orig-fun args)))
(advice-add 'narf/evil-window-move :around 'narf*save-popups)) (advice-add 'doom/evil-window-move :around 'doom*save-popups))
;; ;;
@ -143,41 +143,41 @@
helm-split-window-in-side-p t)) helm-split-window-in-side-p t))
(after! helm-swoop (after! helm-swoop
(setq helm-swoop-split-window-function (lambda ($buf) (narf/popup-buffer $buf)))) (setq helm-swoop-split-window-function (lambda ($buf) (doom/popup-buffer $buf))))
(after! helm-ag (after! helm-ag
;; Helm-ag needs a little coaxing for it to cooperate with shackle. Mostly to prevent ;; Helm-ag needs a little coaxing for it to cooperate with shackle. Mostly to prevent
;; it from switching between windows and buffers. ;; it from switching between windows and buffers.
(defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popup-compat activate) (defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popup-compat activate)
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it) (cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)
(narf/popup-close nil t t)) (doom/popup-close nil t t))
(defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popup-compat activate) (defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popup-compat activate)
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it) (cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)
(narf/popup-close nil t t)) (doom/popup-close nil t t))
(defadvice helm-ag--edit (around helm-ag-edit-popup-compat activate) (defadvice helm-ag--edit (around helm-ag-edit-popup-compat activate)
(cl-letf (((symbol-function 'other-window) 'ignore) (cl-letf (((symbol-function 'other-window) 'ignore)
((symbol-function 'switch-to-buffer) 'narf/popup-buffer)) ((symbol-function 'switch-to-buffer) 'doom/popup-buffer))
ad-do-it))) ad-do-it)))
(after! quickrun (after! quickrun
;; This allows us to run code several times in a row without having to close the popup ;; This allows us to run code several times in a row without having to close the popup
;; window and move back to the code buffer. ;; window and move back to the code buffer.
(defun narf*quickrun-close-popup (&optional _ _ _ _) (defun doom*quickrun-close-popup (&optional _ _ _ _)
(let* ((buffer (get-buffer quickrun/buffer-name)) (let* ((buffer (get-buffer quickrun/buffer-name))
(window (and buffer (get-buffer-window buffer)))) (window (and buffer (get-buffer-window buffer))))
(when buffer (when buffer
(shut-up! (quickrun/kill-running-process)) (shut-up! (quickrun/kill-running-process))
(narf/popup-close window nil t)))) (doom/popup-close window nil t))))
(advice-add 'quickrun :before 'narf*quickrun-close-popup) (advice-add 'quickrun :before 'doom*quickrun-close-popup)
(advice-add 'quickrun-region :before 'narf*quickrun-close-popup) (advice-add 'quickrun-region :before 'doom*quickrun-close-popup)
;; Turns on `nlinum-mode', and ensures window is scrolled to EOF ;; Turns on `nlinum-mode', and ensures window is scrolled to EOF
(defun narf|quickrun-after-run () (defun doom|quickrun-after-run ()
(let ((window (get-buffer-window quickrun/buffer-name))) (let ((window (get-buffer-window quickrun/buffer-name)))
(with-selected-window window (with-selected-window window
(goto-char (point-min))))) (goto-char (point-min)))))
(add-hook 'quickrun-after-run-hook 'narf|quickrun-after-run) (add-hook 'quickrun-after-run-hook 'doom|quickrun-after-run)
(add-hook 'quickrun/mode-hook 'narf|hide-mode-line)) (add-hook 'quickrun/mode-hook 'doom|hide-mode-line))
(add-hook! org-load (add-hook! org-load
;; This ensures org-src-edit yields control of its buffer to shackle. ;; This ensures org-src-edit yields control of its buffer to shackle.
@ -196,7 +196,7 @@
args)) args))
;; Taming Org-agenda! ;; Taming Org-agenda!
(defun narf/org-agenda-quit () (defun doom/org-agenda-quit ()
"Necessary to finagle org-agenda into shackle popups and behave properly on quit." "Necessary to finagle org-agenda into shackle popups and behave properly on quit."
(interactive) (interactive)
(if org-agenda-columns-active (if org-agenda-columns-active
@ -210,11 +210,11 @@
org-agenda-buffer nil)))) org-agenda-buffer nil))))
(map! :map org-agenda-mode-map (map! :map org-agenda-mode-map
:e "<escape>" 'narf/org-agenda-quit :e "<escape>" 'doom/org-agenda-quit
:e "ESC" 'narf/org-agenda-quit :e "ESC" 'doom/org-agenda-quit
:e [escape] 'narf/org-agenda-quit :e [escape] 'doom/org-agenda-quit
"q" 'narf/org-agenda-quit "q" 'doom/org-agenda-quit
"Q" 'narf/org-agenda-quit)) "Q" 'doom/org-agenda-quit))
(after! realgud (after! realgud
;; This allows realgud debuggers to run in a popup. ;; This allows realgud debuggers to run in a popup.
@ -229,7 +229,7 @@
(if (and process (eq 'run (process-status process))) (if (and process (eq 'run (process-status process)))
(progn (progn
(pop-to-buffer cmd-buf) (pop-to-buffer cmd-buf)
(define-key evil-emacs-state-local-map (kbd "ESC ESC") 'narf/debug-quit) (define-key evil-emacs-state-local-map (kbd "ESC ESC") 'doom/debug-quit)
(realgud:track-set-debugger debugger-name) (realgud:track-set-debugger debugger-name)
(realgud-cmdbuf-info-in-debugger?= 't) (realgud-cmdbuf-info-in-debugger?= 't)
(realgud-cmdbuf-info-cmd-args= cmd-args) (realgud-cmdbuf-info-cmd-args= cmd-args)

View file

@ -13,7 +13,7 @@
(add-hook 'dired-mode-hook 'dired-omit-mode) (add-hook 'dired-mode-hook 'dired-omit-mode)
;; List directories first ;; List directories first
(defun narf|dired-sort () (defun doom|dired-sort ()
"Dired sort hook to list directories first." "Dired sort hook to list directories first."
(save-excursion (save-excursion
(let (buffer-read-only) (let (buffer-read-only)
@ -23,15 +23,15 @@
(fboundp 'dired-insert-set-properties) (fboundp 'dired-insert-set-properties)
(dired-insert-set-properties (point-min) (point-max))) (dired-insert-set-properties (point-min) (point-max)))
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
(add-hook 'dired-after-readin-hook 'narf|dired-sort) (add-hook 'dired-after-readin-hook 'doom|dired-sort)
;; Automatically create missing directories when creating new files ;; Automatically create missing directories when creating new files
(defun narf|create-non-existent-directory () (defun doom|create-non-existent-directory ()
(let ((parent-directory (file-name-directory buffer-file-name))) (let ((parent-directory (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p parent-directory)) (when (and (not (file-exists-p parent-directory))
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
(make-directory parent-directory t)))) (make-directory parent-directory t))))
(push 'narf|create-non-existent-directory find-file-not-found-functions) (push 'doom|create-non-existent-directory find-file-not-found-functions)
;; ;;
(use-package ido (use-package ido
@ -50,13 +50,13 @@
ido-enable-tramp-completion nil ido-enable-tramp-completion nil
ido-enable-tramp-completion t ido-enable-tramp-completion t
ido-cr+-max-items 10000 ido-cr+-max-items 10000
ido-save-directory-list-file (concat narf-temp-dir "/ido.last")) ido-save-directory-list-file (concat doom-temp-dir "/ido.last"))
(add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind) (add-hook 'ido-setup-hook 'doom|ido-setup-home-keybind)
:config :config
(add-hook! ido-setup (add-hook! ido-setup
(push "\\`.DS_Store$" ido-ignore-files) (push "\\`.DS_Store$" ido-ignore-files)
(push "Icon\\?$" ido-ignore-files) (push "Icon\\?$" ido-ignore-files)
(advice-add 'ido-sort-mtime :override 'narf*ido-sort-mtime) (advice-add 'ido-sort-mtime :override 'doom*ido-sort-mtime)
(require 'ido-vertical-mode) (require 'ido-vertical-mode)
(ido-vertical-mode 1) (ido-vertical-mode 1)
@ -70,7 +70,7 @@
"C-w" 'ido-delete-backward-word-updir "C-w" 'ido-delete-backward-word-updir
"C-u" 'ido-up-directory)) "C-u" 'ido-up-directory))
(add-hook! (ido-make-file-list ido-make-dir-list) 'narf*ido-sort-mtime)) (add-hook! (ido-make-file-list ido-make-dir-list) 'doom*ido-sort-mtime))
;; ;;
(use-package neotree (use-package neotree
@ -92,19 +92,19 @@
neo-banner-message nil) neo-banner-message nil)
:config :config
(evil-set-initial-state 'neotree-mode 'motion) (evil-set-initial-state 'neotree-mode 'motion)
(add-hook 'neo-after-create-hook 'narf|hide-mode-line) (add-hook 'neo-after-create-hook 'doom|hide-mode-line)
;; A custom and simple theme for neotree ;; A custom and simple theme for neotree
(advice-add 'neo-buffer--insert-fold-symbol :override 'narf*neo-theme) (advice-add 'neo-buffer--insert-fold-symbol :override 'doom*neo-theme)
;; Shorter pwd in neotree ;; Shorter pwd in neotree
(advice-add 'neo-buffer--insert-root-entry :filter-args 'narf*neotree-shorten-pwd) (advice-add 'neo-buffer--insert-root-entry :filter-args 'doom*neotree-shorten-pwd)
;; Don't ask for confirmation when creating files ;; Don't ask for confirmation when creating files
(advice-add 'neotree-create-node :around 'narf*neotree-create-node) (advice-add 'neotree-create-node :around 'doom*neotree-create-node)
;; Prevents messing up the neotree buffer on window changes ;; Prevents messing up the neotree buffer on window changes
(advice-add 'narf/evil-window-move :around 'narf*save-neotree) (advice-add 'doom/evil-window-move :around 'doom*save-neotree)
(add-hook 'neotree-mode-hook 'narf|neotree-init-keymap) (add-hook 'neotree-mode-hook 'doom|neotree-init-keymap)
(defun narf|neotree-init-keymap () (defun doom|neotree-init-keymap ()
(setq line-spacing 1) (setq line-spacing 1)
(map! :map evil-motion-state-local-map (map! :map evil-motion-state-local-map
"ESC ESC" 'neotree-hide "ESC ESC" 'neotree-hide
@ -127,17 +127,17 @@
:config :config
(setq projectile-require-project-root nil (setq projectile-require-project-root nil
projectile-enable-caching t projectile-enable-caching t
projectile-cache-file (concat narf-temp-dir "/projectile.cache") projectile-cache-file (concat doom-temp-dir "/projectile.cache")
projectile-known-projects-file (concat narf-temp-dir "/projectile.projects") projectile-known-projects-file (concat doom-temp-dir "/projectile.projects")
projectile-indexing-method 'alien projectile-indexing-method 'alien
projectile-project-root-files narf-project-root-files projectile-project-root-files doom-project-root-files
projectile-file-exists-remote-cache-expire nil) projectile-file-exists-remote-cache-expire nil)
;; Don't cache ignored files! ;; Don't cache ignored files!
(defun narf*projectile-cache-current-file (orig-fun &rest args) (defun doom*projectile-cache-current-file (orig-fun &rest args)
(unless (--any (f-descendant-of? buffer-file-name it) (projectile-ignored-directories)) (unless (--any (f-descendant-of? buffer-file-name it) (projectile-ignored-directories))
(apply orig-fun args))) (apply orig-fun args)))
(advice-add 'projectile-cache-current-file :around 'narf*projectile-cache-current-file) (advice-add 'projectile-cache-current-file :around 'doom*projectile-cache-current-file)
(push "ido.last" projectile-globally-ignored-files) (push "ido.last" projectile-globally-ignored-files)
(push "assets" projectile-globally-ignored-directories) (push "assets" projectile-globally-ignored-directories)

View file

@ -3,7 +3,7 @@
;; y/n instead of yes/no ;; y/n instead of yes/no
(fset 'yes-or-no-p 'y-or-n-p) (fset 'yes-or-no-p 'y-or-n-p)
(defvar narf-fringe-size 3 "Default fringe width") (defvar doom-fringe-size 3 "Default fringe width")
(setq-default (setq-default
blink-matching-paren nil ; don't blink--too distracting blink-matching-paren nil ; don't blink--too distracting
@ -45,12 +45,13 @@
(when window-system (when window-system
(setq confirm-kill-emacs (setq confirm-kill-emacs
(lambda (_) (lambda (_)
(if (narf/get-real-buffers) (if (doom/get-real-buffers)
(y-or-n-p ">> Gee, I dunno Brain... Are you sure?") (y-or-n-p ">> Gee, I dunno Brain... Are you sure?")
t)))) t))))
(load-theme narf-current-theme t) (load-theme doom-current-theme t)
(tooltip-mode -1) ; show tooltips in echo area (tooltip-mode -1) ; show tooltips in echo area
;; set up minibuffer and fringe ;; set up minibuffer and fringe
(if (not window-system) (if (not window-system)
(menu-bar-mode -1) (menu-bar-mode -1)
@ -59,44 +60,44 @@
;; full filename in frame title ;; full filename in frame title
(setq frame-title-format '(buffer-file-name "%f" ("%b"))) (setq frame-title-format '(buffer-file-name "%f" ("%b")))
;; set fonts ;; set fonts
(set-frame-font narf-default-font t) (set-frame-font doom-default-font t)
(set-face-attribute 'default t :font narf-current-font) (set-face-attribute 'default t :font doom-current-font)
;; standardize fringe width ;; standardize fringe width
(push `(left-fringe . ,narf-fringe-size) default-frame-alist) (push `(left-fringe . ,doom-fringe-size) default-frame-alist)
(push `(right-fringe . ,narf-fringe-size) default-frame-alist) (push `(right-fringe . ,doom-fringe-size) default-frame-alist)
;; Default frame size on startup
(push '(width . 120) default-frame-alist)
(push '(height . 32) default-frame-alist)
;; no fringe in the minibuffer ;; no fringe in the minibuffer
(add-hook! after-init (set-window-fringes (minibuffer-window) 0 0 nil)) (add-hook! after-init (set-window-fringes (minibuffer-window) 0 0 nil))
;; Show tilde in margin on empty lines ;; Show tilde in margin on empty lines
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center) (define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
(set-fringe-bitmap-face 'tilde 'fringe) (set-fringe-bitmap-face 'tilde 'fringe)
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde) (setcdr (assq 'empty-line fringe-indicator-alist) 'tilde))
;; Default frame size on startup
(push '(width . 120) default-frame-alist)
(push '(height . 32) default-frame-alist))
;; Try to display unicode characters without upsetting line-hieght (as much as possible) ;; Try to display unicode characters without upsetting line-hieght (as much as possible)
(narf-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓)) (doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))
;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it ;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it
(when (and (> emacs-major-version 24) (featurep 'eldoc)) (when (and (> emacs-major-version 24) (featurep 'eldoc))
(global-eldoc-mode -1)) (global-eldoc-mode -1))
;; Highlight TODO/FIXME/NOTE tags ;; Highlight TODO/FIXME/NOTE tags
(defface narf-todo-face '((t (:inherit font-lock-warning-face))) (defface doom-todo-face '((t (:inherit font-lock-warning-face)))
"Face for TODOs") "Face for TODOs")
(defface narf-fixme-face '((t (:inherit font-lock-warning-face))) (defface doom-fixme-face '((t (:inherit font-lock-warning-face)))
"Face for FIXMEs") "Face for FIXMEs")
(defface narf-note-face '((t (:inherit font-lock-warning-face))) (defface doom-note-face '((t (:inherit font-lock-warning-face)))
"Face for NOTEs") "Face for NOTEs")
(add-hook! (prog-mode emacs-lisp-mode css-mode) (add-hook! (prog-mode emacs-lisp-mode css-mode)
(font-lock-add-keywords (font-lock-add-keywords
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'narf-todo-face prepend) nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'doom-todo-face prepend)
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'narf-fixme-face prepend) ("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'doom-fixme-face prepend)
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'narf-note-face prepend)))) ("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'doom-note-face prepend))))
;; Hide mode-line in help/compile window ;; Hide mode-line in help/compile window
(add-hook 'help-mode-hook 'narf|hide-mode-line) (add-hook 'help-mode-hook 'doom|hide-mode-line)
(add-hook 'compilation-mode-hook 'narf|hide-mode-line) (add-hook 'compilation-mode-hook 'doom|hide-mode-line)
;; ;;
@ -107,17 +108,17 @@
:init :init
(add-hook! (prog-mode markdown-mode) 'hl-line-mode) (add-hook! (prog-mode markdown-mode) 'hl-line-mode)
:config :config
(defvar-local narf--hl-line-mode nil) (defvar-local doom--hl-line-mode nil)
(setq hl-line-sticky-flag nil (setq hl-line-sticky-flag nil
global-hl-line-sticky-flag nil) global-hl-line-sticky-flag nil)
(defun narf|hl-line-on () (if narf--hl-line-mode (hl-line-mode +1))) (defun doom|hl-line-on () (if doom--hl-line-mode (hl-line-mode +1)))
(defun narf|hl-line-off () (if narf--hl-line-mode (hl-line-mode -1))) (defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1)))
(add-hook! hl-line-mode (if hl-line-mode (setq narf--hl-line-mode t))) (add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t)))
;; Disable line highlight in visual mode ;; Disable line highlight in visual mode
(add-hook 'evil-visual-state-entry-hook 'narf|hl-line-off) (add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off)
(add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on)) (add-hook 'evil-visual-state-exit-hook 'doom|hl-line-on))
(use-package visual-fill-column :defer t (use-package visual-fill-column :defer t
:config :config
@ -134,17 +135,17 @@
(after! editorconfig (after! editorconfig
(advice-add 'highlight-indentation-guess-offset (advice-add 'highlight-indentation-guess-offset
:override 'narf*hl-indent-guess-offset)) :override 'doom*hl-indent-guess-offset))
;; A long-winded method for ensuring whitespace is maintained (so that ;; A long-winded method for ensuring whitespace is maintained (so that
;; highlight-indentation-mode can display them consistently) ;; highlight-indentation-mode can display them consistently)
(add-hook! highlight-indentation-mode (add-hook! highlight-indentation-mode
(if highlight-indentation-mode (if highlight-indentation-mode
(progn (progn
(narf/add-whitespace) (doom/add-whitespace)
(add-hook 'after-save-hook 'narf/add-whitespace nil t) (add-hook 'after-save-hook 'doom/add-whitespace nil t)
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t))
(remove-hook 'after-save-hook 'narf/add-whitespace t) (remove-hook 'after-save-hook 'doom/add-whitespace t)
(remove-hook 'before-save-hook 'delete-trailing-whitespace t)))) (remove-hook 'before-save-hook 'delete-trailing-whitespace t))))
(use-package highlight-numbers :commands (highlight-numbers-mode)) (use-package highlight-numbers :commands (highlight-numbers-mode))
@ -161,16 +162,16 @@
:commands (rainbow-mode) :commands (rainbow-mode)
:init :init
;; hl-line-mode and rainbow-mode don't play well together ;; hl-line-mode and rainbow-mode don't play well together
(add-hook 'rainbow-mode-hook 'narf|hl-line-off)) (add-hook 'rainbow-mode-hook 'doom|hl-line-off))
(use-package nlinum (use-package nlinum
:commands nlinum-mode :commands nlinum-mode
:preface :preface
(setq linum-format "%3d ") (setq linum-format "%3d ")
(defvar nlinum-format "%4d ") (defvar nlinum-format "%4d ")
(defvar narf--hl-nlinum-overlay nil) (defvar doom--hl-nlinum-overlay nil)
(defvar narf--hl-nlinum-line nil) (defvar doom--hl-nlinum-line nil)
(defface narf-linum '((t (:inherit linum))) (defface doom-linum '((t (:inherit linum)))
"Face for line in popups") "Face for line in popups")
(defface linum-highlight-face '((t (:inherit linum))) (defface linum-highlight-face '((t (:inherit linum)))
"Face for line highlights") "Face for line highlights")
@ -179,7 +180,7 @@
(markdown-mode prog-mode scss-mode web-mode conf-mode) (markdown-mode prog-mode scss-mode web-mode conf-mode)
'nlinum-mode) 'nlinum-mode)
(add-hook! 'nlinum-mode-hook (add-hook! 'nlinum-mode-hook
(add-hook 'post-command-hook 'narf|nlinum-hl-line nil t)) (add-hook 'post-command-hook 'doom|nlinum-hl-line nil t))
:config :config
(add-hook! nlinum-mode (add-hook! nlinum-mode
(setq nlinum--width (setq nlinum--width
@ -193,8 +194,8 @@
(use-package spaceline (use-package spaceline
:init :init
(defvar-local narf--env-version nil) (defvar-local doom--env-version nil)
(defvar-local narf--env-command nil) (defvar-local doom--env-command nil)
(defvar powerline-height 26) (defvar powerline-height 26)
(defvar powerline-default-separator nil) (defvar powerline-default-separator nil)
@ -209,7 +210,7 @@
(when buffer-file-name (when buffer-file-name
(powerline-raw (powerline-raw
(f-dirname (f-dirname
(let ((buffer-path (f-relative buffer-file-name (narf/project-root))) (let ((buffer-path (f-relative buffer-file-name (doom/project-root)))
(max-length (truncate (/ (window-body-width) 1.75)))) (max-length (truncate (/ (window-body-width) 1.75))))
(concat (projectile-project-name) "/" (concat (projectile-project-name) "/"
(if (> (length buffer-path) max-length) (if (> (length buffer-path) max-length)
@ -329,7 +330,7 @@ anzu to be enabled."
"The major mode, including process, environment and text-scale info." "The major mode, including process, environment and text-scale info."
(concat (format "%s" mode-name) (concat (format "%s" mode-name)
(if (stringp mode-line-process) mode-line-process) (if (stringp mode-line-process) mode-line-process)
(if narf--env-version (concat " " narf--env-version)) (if doom--env-version (concat " " doom--env-version))
(and (featurep 'face-remap) (and (featurep 'face-remap)
(/= text-scale-mode-amount 0) (/= text-scale-mode-amount 0)
(format " (%+d)" text-scale-mode-amount)))) (format " (%+d)" text-scale-mode-amount))))
@ -370,20 +371,20 @@ anzu to be enabled."
'((t (:foreground "#8DE6F7" :distant-foreground "#21889B"))) '((t (:foreground "#8DE6F7" :distant-foreground "#21889B")))
"Face for flycheck info feedback in the modeline.") "Face for flycheck info feedback in the modeline.")
(defvar-local narf--flycheck-err-cache nil "") (defvar-local doom--flycheck-err-cache nil "")
(defvar-local narf--flycheck-cache nil "") (defvar-local doom--flycheck-cache nil "")
(spaceline-define-segment *flycheck (spaceline-define-segment *flycheck
"Persistent and cached flycheck indicators in the mode-line." "Persistent and cached flycheck indicators in the mode-line."
(when (and (bound-and-true-p flycheck-mode) (when (and (bound-and-true-p flycheck-mode)
(or flycheck-current-errors (or flycheck-current-errors
(eq 'running flycheck-last-status-change))) (eq 'running flycheck-last-status-change)))
(or (and (or (eq narf--flycheck-err-cache narf--flycheck-cache) (or (and (or (eq doom--flycheck-err-cache doom--flycheck-cache)
(memq flycheck-last-status-change '(running not-checked))) (memq flycheck-last-status-change '(running not-checked)))
narf--flycheck-cache) doom--flycheck-cache)
(and (setq narf--flycheck-err-cache flycheck-current-errors) (and (setq doom--flycheck-err-cache flycheck-current-errors)
(setq narf--flycheck-cache (setq doom--flycheck-cache
(let ((fe (narf/-flycheck-count 'error)) (let ((fe (doom/-flycheck-count 'error))
(fw (narf/-flycheck-count 'warning))) (fw (doom/-flycheck-count 'warning)))
(concat (concat
(if fe (propertize (format " ⚠%s " fe) (if fe (propertize (format " ⚠%s " fe)
'face (if active 'face (if active

View file

@ -10,8 +10,8 @@
"/git/ignore$")) "/git/ignore$"))
(use-package git-gutter (use-package git-gutter
:commands (git-gutter-mode narf/vcs-next-hunk narf/vcs-prev-hunk :commands (git-gutter-mode doom/vcs-next-hunk doom/vcs-prev-hunk
narf/vcs-show-hunk narf/vcs-stage-hunk narf/vcs-revert-hunk) doom/vcs-show-hunk doom/vcs-stage-hunk doom/vcs-revert-hunk)
:init :init
(add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode) (add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode)
:config :config
@ -31,11 +31,11 @@
(advice-add 'evil-force-normal-state :after 'git-gutter) (advice-add 'evil-force-normal-state :after 'git-gutter)
(add-hook 'focus-in-hook 'git-gutter:update-all-windows) (add-hook 'focus-in-hook 'git-gutter:update-all-windows)
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk) (defalias 'doom/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk) (defalias 'doom/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk) (defalias 'doom/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk) (defalias 'doom/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk)) (defalias 'doom/vcs-revert-hunk 'git-gutter:revert-hunk))
(after! vc-annotate (after! vc-annotate
(evil-set-initial-state 'vc-annotate-mode 'normal) (evil-set-initial-state 'vc-annotate-mode 'normal)

View file

@ -5,21 +5,20 @@
;; code to make a permanent frame header to display these some day) ;; code to make a permanent frame header to display these some day)
;; 2. Session persistence (with :ss and :sl) ;; 2. Session persistence (with :ss and :sl)
(defvar narf-wg-frames '() (defvar doom-wg-frames '()
"A list of all the frames opened as separate workgroups. See "A list of all the frames opened as separate workgroups. See
defuns/defuns-workgroups.el.") defuns/defuns-workgroups.el.")
(defvar narf-wg-names '() (defvar doom-wg-names '()
"A list of fixed names for workgroups. If a name is set, workgroup names aren't "A list of fixed names for workgroups. If a name is set, workgroup names aren't
automatically renamed to the project name.") automatically renamed to the project name.")
(use-package workgroups2 (use-package workgroups2
:when (display-graphic-p) :when (display-graphic-p)
:init :init
(add-hook 'emacs-startup-hook 'workgroups-mode)
(setq-default (setq-default
wg-session-file (concat narf-temp-dir "/workgroups/last") wg-session-file (concat doom-temp-dir "/workgroups/last")
wg-workgroup-directory (concat narf-temp-dir "/workgroups/") wg-workgroup-directory (concat doom-temp-dir "/workgroups/")
wg-first-wg-name "*untitled*" wg-first-wg-name "*untitled*"
wg-session-load-on-start nil wg-session-load-on-start nil
wg-mode-line-display-on nil wg-mode-line-display-on nil
@ -45,33 +44,35 @@ automatically renamed to the project name.")
wg-list-display-decor-previous-left "" wg-list-display-decor-previous-left ""
wg-list-display-decor-previous-right "") wg-list-display-decor-previous-right "")
(add-hook 'emacs-startup-hook 'workgroups-mode)
:config :config
;; Remember fixed workgroup names between sessions ;; Remember fixed workgroup names between sessions
(push 'narf-wg-names savehist-additional-variables) (push 'doom-wg-names savehist-additional-variables)
;; `wg-mode-line-display-on' wasn't enough ;; `wg-mode-line-display-on' wasn't enough
(advice-add 'wg-change-modeline :override 'ignore) (advice-add 'wg-change-modeline :override 'ignore)
;; Don't remember popup and neotree windows ;; Don't remember popup and neotree windows
(add-hook 'kill-emacs-hook 'narf|wg-cleanup) (add-hook 'kill-emacs-hook 'doom|wg-cleanup)
(after! projectile (after! projectile
;; Create a new workgroup on switch-project ;; Create a new workgroup on switch-project
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project)) (setq projectile-switch-project-action 'doom/wg-projectile-switch-project))
;; This helps abstract some of the underlying functions away, just in case I want to ;; This helps abstract some of the underlying functions away, just in case I want to
;; switch to a different package in the future, like persp-mode, eyebrowse or wconf. ;; switch to a different package in the future, like persp-mode, eyebrowse or wconf.
(defalias 'narf/tab-display 'narf/workgroup-display) (defalias 'doom/tab-display 'doom/workgroup-display)
(defalias 'narf/helm-tabs 'narf:helm-wg) (defalias 'doom/helm-tabs 'doom:helm-wg)
(defalias 'narf/close-window-or-tab 'narf/close-window-or-workgroup) (defalias 'doom/close-window-or-tab 'doom/close-window-or-workgroup)
(defalias 'narf:tab-create 'narf:workgroup-new) (defalias 'doom:tab-create 'doom:workgroup-new)
(defalias 'narf:tab-rename 'narf:workgroup-rename) (defalias 'doom:tab-rename 'doom:workgroup-rename)
(defalias 'narf:kill-tab 'narf:workgroup-delete) (defalias 'doom:kill-tab 'doom:workgroup-delete)
(defalias 'narf:kill-other-tabs 'narf:kill-other-workgroups) (defalias 'doom:kill-other-tabs 'doom:kill-other-workgroups)
(defalias 'narf:switch-to-tab 'narf:switch-to-workgroup-at-index) (defalias 'doom:switch-to-tab 'doom:switch-to-workgroup-at-index)
(defalias 'narf:switch-to-tab-left 'wg-switch-to-workgroup-left) (defalias 'doom:switch-to-tab-left 'wg-switch-to-workgroup-left)
(defalias 'narf:switch-to-tab-right 'wg-switch-to-workgroup-right) (defalias 'doom:switch-to-tab-right 'wg-switch-to-workgroup-right)
(defalias 'narf:switch-to-tab-last 'wg-switch-to-previous-workgroup)) (defalias 'doom:switch-to-tab-last 'wg-switch-to-previous-workgroup))
(provide 'core-workgroups) (provide 'core-workgroups)
;;; core-workgroups.el ends here ;;; core-workgroups.el ends here

View file

@ -15,7 +15,7 @@
yas-also-auto-indent-first-line t yas-also-auto-indent-first-line t
yas-wrap-around-region nil yas-wrap-around-region nil
;; Only load personal snippets ;; Only load personal snippets
yas-snippet-dirs narf-snippet-dirs yas-snippet-dirs doom-snippet-dirs
yas-prompt-functions '(yas-ido-prompt yas-no-prompt)) yas-prompt-functions '(yas-ido-prompt yas-no-prompt))
(add-hook! (text-mode prog-mode snippet-mode markdown-mode org-mode) (add-hook! (text-mode prog-mode snippet-mode markdown-mode org-mode)
@ -24,15 +24,15 @@
:config :config
(yas-reload-all) (yas-reload-all)
(map! :map yas-keymap (map! :map yas-keymap
"C-e" 'narf/yas-goto-end-of-field "C-e" 'doom/yas-goto-end-of-field
"C-a" 'narf/yas-goto-start-of-field "C-a" 'doom/yas-goto-start-of-field
"<M-right>" 'narf/yas-goto-end-of-field "<M-right>" 'doom/yas-goto-end-of-field
"<M-left>" 'narf/yas-goto-start-of-field "<M-left>" 'doom/yas-goto-start-of-field
"<S-tab>" 'yas-prev-field "<S-tab>" 'yas-prev-field
"<M-backspace>" 'narf/yas-clear-to-sof "<M-backspace>" 'doom/yas-clear-to-sof
"<escape>" 'evil-normal-state "<escape>" 'evil-normal-state
[backspace] 'narf/yas-backspace [backspace] 'doom/yas-backspace
"<delete>" 'narf/yas-delete) "<delete>" 'doom/yas-delete)
;; Exit snippets on ESC in normal mode ;; Exit snippets on ESC in normal mode
(advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets) (advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets)
@ -41,14 +41,14 @@
;; Once you're in normal mode, you're out ;; Once you're in normal mode, you're out
(add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet) (add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet)
;; Strip out whitespace before a line selection ;; Strip out whitespace before a line selection
(add-hook 'yas-before-expand-snippet-hook 'narf|yas-before-expand) (add-hook 'yas-before-expand-snippet-hook 'doom|yas-before-expand)
;; Fix previous hook persisting yas-selected-text between expansions ;; Fix previous hook persisting yas-selected-text between expansions
(add-hook 'yas-after-exit-snippet-hook 'narf|yas-after-expand)) (add-hook 'yas-after-exit-snippet-hook 'doom|yas-after-expand))
(use-package auto-yasnippet (use-package auto-yasnippet
:commands (aya-create aya-expand aya-open-line aya-persist-snippet) :commands (aya-create aya-expand aya-open-line aya-persist-snippet)
:config :config
(setq aya-persist-snippets-dir (concat narf-private-dir "auto-snippets/"))) (setq aya-persist-snippets-dir (concat doom-private-dir "auto-snippets/")))
(provide 'core-yasnippet) (provide 'core-yasnippet)
;;; core-yasnippet.el ends here ;;; core-yasnippet.el ends here

View file

@ -2,14 +2,14 @@
;; ;;
;;; Naming conventions: ;;; Naming conventions:
;; ;;
;; narf-… A public variable/constant or function ;; doom-... A public variable/constant or function
;; narf--… An internal variable or function (non-interactive) ;; doom--... An internal variable or function (non-interactive)
;; narf/… An autoloaded interactive function ;; doom/... An autoloaded interactive function
;; narf:… An ex command ;; doom:... An ex command
;; narf|… A hook ;; doom|... A hook
;; narf*… An advising function ;; doom*... An advising function
;; narf.… Custom prefix commands ;; doom.... Custom prefix commands
;; ! Macro or shortcut alias ;; ...! Macro or shortcut alias
;; ;;
;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el ;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
;; ;;
@ -36,34 +36,31 @@
enable-recursive-minibuffers nil ; no minibufferception enable-recursive-minibuffers nil ; no minibufferception
idle-update-delay 2 ; update a little less often idle-update-delay 2 ; update a little less often
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
inhibit-startup-screen t ; don't show emacs start screen
initial-major-mode 'text-mode ; initial scratch buffer mode
initial-scratch-message nil
major-mode 'text-mode major-mode 'text-mode
ring-bell-function 'ignore ; silence of the bells! ring-bell-function 'ignore ; silence of the bells!
save-interprogram-paste-before-kill nil save-interprogram-paste-before-kill nil
sentence-end-double-space nil sentence-end-double-space nil
confirm-nonexistent-file-or-buffer nil confirm-nonexistent-file-or-buffer t
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html ;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
minibuffer-prompt-properties minibuffer-prompt-properties
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt) '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
bookmark-save-flag t bookmark-save-flag t
bookmark-default-file (concat narf-temp-dir "/bookmarks") bookmark-default-file (concat doom-temp-dir "/bookmarks")
;; Disable all backups (that's what git/dropbox are for) ;; Disable all backups (that's what git/dropbox are for)
history-length 1000 history-length 1000
vc-make-backup-files nil vc-make-backup-files nil
auto-save-default nil auto-save-default nil
auto-save-list-file-name (concat narf-temp-dir "/autosave") auto-save-list-file-name (concat doom-temp-dir "/autosave")
make-backup-files nil make-backup-files nil
create-lockfiles nil create-lockfiles nil
backup-directory-alist `((".*" . ,(concat narf-temp-dir "/backup/"))) backup-directory-alist `((".*" . ,(concat doom-temp-dir "/backup/")))
;; Remember undo history ;; Remember undo history
undo-tree-auto-save-history nil undo-tree-auto-save-history nil
undo-tree-history-directory-alist `(("." . ,(concat narf-temp-dir "/undo/")))) undo-tree-history-directory-alist `(("." . ,(concat doom-temp-dir "/undo/"))))
;; UTF-8 please ;; UTF-8 please
(setq locale-coding-system 'utf-8) ; pretty (setq locale-coding-system 'utf-8) ; pretty
@ -79,16 +76,16 @@
;; Variables ;; Variables
;; ;;
(defvar narf-unreal-buffers '("^ ?\\*.+\\*" (defvar doom-unreal-buffers '("^ ?\\*.+\\*"
image-mode image-mode
dired-mode dired-mode
reb-mode reb-mode
messages-buffer-mode) messages-buffer-mode)
"A list of regexps or modes whose buffers are considered unreal, and will be "A list of regexps or modes whose buffers are considered unreal, and will be
ignored when using `narf:next-real-buffer' and `narf:previous-real-buffer' (or ignored when using `doom:next-real-buffer' and `doom:previous-real-buffer' (or
killed by `narf/kill-unreal-buffers', or after `narf/kill-real-buffer').") killed by `doom/kill-unreal-buffers', or after `doom/kill-real-buffer').")
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*" (defvar doom-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*" "*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
"*Buffer List*" "*Ibuffer*" "*NeoTree*" " "*Buffer List*" "*Ibuffer*" "*NeoTree*" "
*NeoTree*" "*esh command on file*" "*WoMan-Log*" *NeoTree*" "*esh command on file*" "*WoMan-Log*"
@ -108,14 +105,14 @@ killed by `narf/kill-unreal-buffers', or after `narf/kill-real-buffer').")
"*Org todo*" "*Org Links*" "*Agenda Commands*") "*Org todo*" "*Org Links*" "*Agenda Commands*")
"List of buffer names to ignore when using `winner-undo', or `winner-redo'") "List of buffer names to ignore when using `winner-undo', or `winner-redo'")
(defvar narf-cleanup-processes-alist '(("pry" . ruby-mode) (defvar doom-cleanup-processes-alist '(("pry" . ruby-mode)
("irb" . ruby-mode) ("irb" . ruby-mode)
("ipython" . python-mode)) ("ipython" . python-mode))
"An alist of (process-name . major-mode), that `narf:cleanup-processes' checks "An alist of (process-name . major-mode), that `doom:cleanup-processes' checks
before killing processes. If there are no buffers with matching major-modes, it before killing processes. If there are no buffers with matching major-modes, it
gets killed.") gets killed.")
(defvar narf-project-root-files (defvar doom-project-root-files
'(".git" ".hg" ".svn" ".project" "local.properties" "project.properties" '(".git" ".hg" ".svn" ".project" "local.properties" "project.properties"
"rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt" "rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt"
"build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json" "build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json"
@ -130,10 +127,14 @@ folder is the root of a project or not.")
;; ;;
(require 'f) (require 'f)
(unless (require 'autoloads nil t) (require 'dash)
(load (concat narf-emacs-dir "/scripts/generate-autoloads.el")) (require 's)
(require 'autoloads))
(require 'core-defuns) (require 'core-defuns)
(unless (require 'autoloads nil t)
(doom-reload-autoloads)
(unless (require 'autoloads nil t)
(error "Autoloads couldn't be loaded or generated!")))
(autoload 'use-package "use-package" "" nil 'macro) (autoload 'use-package "use-package" "" nil 'macro)
@ -147,7 +148,7 @@ folder is the root of a project or not.")
persistent-soft-flush persistent-soft-flush
persistent-soft-location-readable persistent-soft-location-readable
persistent-soft-location-destroy) persistent-soft-location-destroy)
:init (defvar pcache-directory (concat narf-temp-dir "/pcache/"))) :init (defvar pcache-directory (concat doom-temp-dir "/pcache/")))
(use-package async (use-package async
:commands (async-start :commands (async-start
@ -168,17 +169,17 @@ folder is the root of a project or not.")
;; Automatic minor modes ;; Automatic minor modes
;; ;;
(defvar narf-auto-minor-mode-alist '() (defvar doom-auto-minor-mode-alist '()
"Alist of filename patterns vs corresponding minor mode functions, see "Alist of filename patterns vs corresponding minor mode functions, see
`auto-mode-alist'. All elements of this alist are checked, meaning you can `auto-mode-alist'. All elements of this alist are checked, meaning you can
enable multiple minor modes for the same regexp.") enable multiple minor modes for the same regexp.")
(defun narf|enable-minor-mode-maybe () (defun doom|enable-minor-mode-maybe ()
"Check file name against `narf-auto-minor-mode-alist'." "Check file name against `doom-auto-minor-mode-alist'."
(when buffer-file-name (when buffer-file-name
(let ((name buffer-file-name) (let ((name buffer-file-name)
(remote-id (file-remote-p buffer-file-name)) (remote-id (file-remote-p buffer-file-name))
(alist narf-auto-minor-mode-alist)) (alist doom-auto-minor-mode-alist))
;; Remove backup-suffixes from file name. ;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name)) (setq name (file-name-sans-versions name))
;; Remove remote file name identification. ;; Remove remote file name identification.
@ -190,7 +191,7 @@ enable multiple minor modes for the same regexp.")
(funcall (cdar alist) 1)) (funcall (cdar alist) 1))
(setq alist (cdr alist)))))) (setq alist (cdr alist))))))
(add-hook 'find-file-hook 'narf|enable-minor-mode-maybe) (add-hook 'find-file-hook 'doom|enable-minor-mode-maybe)
;; ;;
@ -203,8 +204,8 @@ enable multiple minor modes for the same regexp.")
;; Prevent any auto-displayed text... ;; Prevent any auto-displayed text...
(advice-add 'display-startup-echo-area-message :override 'ignore) (advice-add 'display-startup-echo-area-message :override 'ignore)
;; ...so we can display our own ;; ...so we can display our own
(message ":: Loaded in %.3fs" (setq emacs-end-time (float-time (time-subtract (current-time) emacs-start-time)))
(float-time (time-subtract (current-time) emacs-start-time)))) (message ":: Loaded in %.3fs" emacs-end-time))
(provide 'core) (provide 'core)
;;; core.el ends here ;;; core.el ends here

View file

@ -2,10 +2,10 @@
;; for ../core-auto-insert.el ;; for ../core-auto-insert.el
;;;###autoload ;;;###autoload
(defun narf/auto-insert-snippet (key &optional mode project-only) (defun doom/auto-insert-snippet (key &optional mode project-only)
"Auto insert a snippet of yasnippet into new file." "Auto insert a snippet of yasnippet into new file."
(interactive) (interactive)
(when (if project-only (narf/project-p) t) (when (if project-only (doom/project-p) t)
(let ((is-yasnippet-on (not (cond ((functionp yas-dont-activate) (let ((is-yasnippet-on (not (cond ((functionp yas-dont-activate)
(funcall yas-dont-activate)) (funcall yas-dont-activate))
((consp yas-dont-activate) ((consp yas-dont-activate)

View file

@ -1,7 +1,7 @@
;;; defuns-buffers.el ;;; defuns-buffers.el
;;;###autoload (autoload 'narf:narrow "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:narrow "defuns-buffers" nil t)
(evil-define-operator narf:narrow (&optional beg end bang) (evil-define-operator doom:narrow (&optional beg end bang)
"Restrict editing in this buffer to the current region, indirectly. With BANG, "Restrict editing in this buffer to the current region, indirectly. With BANG,
clone the buffer and hard-narrow the selection. Otherwise use fancy-narrow. If clone the buffer and hard-narrow the selection. Otherwise use fancy-narrow. If
mark isn't active, then widen the buffer (if narrowed). mark isn't active, then widen the buffer (if narrowed).
@ -18,14 +18,14 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
(widen))) (widen)))
;;;###autoload ;;;###autoload
(defun narf/set-read-only-region (begin end) (defun doom/set-read-only-region (begin end)
"See http://stackoverflow.com/questions/7410125" "See http://stackoverflow.com/questions/7410125"
(let ((modified (buffer-modified-p))) (let ((modified (buffer-modified-p)))
(add-text-properties begin end '(read-only t)) (add-text-properties begin end '(read-only t))
(set-buffer-modified-p modified))) (set-buffer-modified-p modified)))
;;;###autoload ;;;###autoload
(defun narf/set-region-writeable (begin end) (defun doom/set-region-writeable (begin end)
"See http://stackoverflow.com/questions/7410125" "See http://stackoverflow.com/questions/7410125"
(let ((modified (buffer-modified-p)) (let ((modified (buffer-modified-p))
(inhibit-read-only t)) (inhibit-read-only t))
@ -41,7 +41,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
(defalias 'wg-save-session 'ignore)) (defalias 'wg-save-session 'ignore))
;;;###autoload ;;;###autoload
(defun narf/get-buffers (&optional project-p) (defun doom/get-buffers (&optional project-p)
"Get all buffers in the current workgroup. "Get all buffers in the current workgroup.
If PROJECT-P is non-nil, get all buffers in current workgroup If PROJECT-P is non-nil, get all buffers in current workgroup
@ -51,89 +51,91 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
(--filter (memq it assocbuf) (buffer-list)) (--filter (memq it assocbuf) (buffer-list))
(buffer-list))) (buffer-list)))
project-root) project-root)
(aif (and project-p (narf/project-root t)) (aif (and project-p (doom/project-root t))
(funcall (if (eq project-p 'not) '-remove '-filter) (funcall (if (eq project-p 'not) '-remove '-filter)
(lambda (b) (projectile-project-buffer-p b it)) (lambda (b) (projectile-project-buffer-p b it))
buffers) buffers)
buffers))) buffers)))
;;;###autoload ;;;###autoload
(defun narf/get-buffer-names (&optional project-p) (defun doom/get-buffer-names (&optional project-p)
(mapcar (lambda (b) (buffer-name b)) (mapcar (lambda (b) (buffer-name b))
(narf/get-buffers project-p))) (doom/get-buffers project-p)))
;;;###autoload ;;;###autoload
(defun narf/get-visible-windows (&optional buffer-list) (defun doom/get-visible-windows (&optional buffer-list)
(-map #'get-buffer-window (-map #'get-buffer-window
(narf/get-visible-buffers (or buffer-list (narf/get-buffers))))) (doom/get-visible-buffers (or buffer-list (doom/get-buffers)))))
;;;###autoload ;;;###autoload
(defun narf/get-visible-buffers (&optional buffer-list) (defun doom/get-visible-buffers (&optional buffer-list)
"Get a list of buffers that are not buried (i.e. visible)" "Get a list of buffers that are not buried (i.e. visible)"
(-filter #'get-buffer-window (or buffer-list (narf/get-buffers)))) (-filter #'get-buffer-window (or buffer-list (doom/get-buffers))))
;;;###autoload ;;;###autoload
(defun narf/get-buried-buffers (&optional buffer-list) (defun doom/get-buried-buffers (&optional buffer-list)
"Get a list of buffers that are buried (i.e. not visible)" "Get a list of buffers that are buried (i.e. not visible)"
(let* ((buffers (or buffer-list (narf/get-buffers))) (let* ((buffers (or buffer-list (doom/get-buffers)))
(old-len (length buffers))) (old-len (length buffers)))
(-remove 'get-buffer-window buffers))) (-remove 'get-buffer-window buffers)))
;;;###autoload ;;;###autoload
(defun narf/get-matching-buffers (pattern &optional buffer-list) (defun doom/get-matching-buffers (pattern &optional buffer-list)
"Get a list of buffers that match the pattern" "Get a list of buffers that match the pattern"
(--filter (string-match-p pattern (buffer-name it)) (--filter (string-match-p pattern (buffer-name it))
(or buffer-list (narf/get-buffers)))) (or buffer-list (doom/get-buffers))))
;;;###autoload ;;;###autoload
(defun narf/get-buffers-in-modes (modes &optional buffer-list) (defun doom/get-buffers-in-modes (modes &optional buffer-list)
"Get a list of buffers whose major-mode is one of MODES" "Get a list of buffers whose major-mode is one of MODES"
(--filter (with-current-buffer it (memq major-mode modes)) (--filter (with-current-buffer it (memq major-mode modes))
(or buffer-list (narf/get-buffers)))) (or buffer-list (doom/get-buffers))))
;;;###autoload ;;;###autoload
(defun narf/get-real-buffers (&optional buffer-list) (defun doom/get-real-buffers (&optional buffer-list)
(-filter #'narf/real-buffer-p (or buffer-list (narf/get-buffers)))) (-filter #'doom/real-buffer-p (or buffer-list (doom/get-buffers))))
;;;###autoload ;;;###autoload
(defun narf/kill-real-buffer () (defun doom/kill-real-buffer ()
"Kill buffer (but only bury scratch buffer), then switch to a real buffer. Only buries "Kill buffer (but only bury scratch buffer), then switch to a real buffer. Only buries
the buffer if it is being displayed in another window." the buffer if it is being displayed in another window."
(interactive) (interactive)
(let (new-dir) (let (new-dir)
(if (string-match-p "^\\*scratch\\*" (or (buffer-name) "")) (if (string-match-p doom-buffer-name (or (buffer-name) ""))
(message "Already in the scratch buffer") (progn
(setq new-dir (narf/project-root)) (doom-mode-init t)
(message "Already in the scratch buffer"))
(setq new-dir (doom/project-root))
(if (> (length (get-buffer-window-list (current-buffer) nil t)) 1) (if (> (length (get-buffer-window-list (current-buffer) nil t)) 1)
(bury-buffer) (bury-buffer)
(kill-this-buffer))) (kill-this-buffer))
(if (narf/popup-p (selected-window)) (if (doom/popup-p (selected-window))
(narf/popup-close) (doom/popup-close)
(unless (narf/real-buffer-p (current-buffer)) (unless (doom/real-buffer-p (current-buffer))
(narf/previous-real-buffer) (doom/previous-real-buffer)
(narf|update-scratch-buffer-cwd new-dir))))) (doom|update-scratch-buffer-cwd new-dir))))))
;;;###autoload ;;;###autoload
(defun narf/kill-unreal-buffers () (defun doom/kill-unreal-buffers ()
"Kill all buried, unreal buffers in current frame. See `narf-unreal-buffers'" "Kill all buried, unreal buffers in current frame. See `doom-unreal-buffers'"
(interactive) (interactive)
(let* ((all-buffers (narf/get-buffers)) (let* ((all-buffers (doom/get-buffers))
(real-buffers (narf/get-real-buffers all-buffers)) (real-buffers (doom/get-real-buffers all-buffers))
(kill-list (--filter (not (memq it real-buffers)) (kill-list (--filter (not (memq it real-buffers))
(narf/get-buried-buffers all-buffers)))) (doom/get-buried-buffers all-buffers))))
(mapc 'kill-buffer kill-list) (mapc 'kill-buffer kill-list)
(narf/kill-process-buffers) (doom/kill-process-buffers)
(message "Cleaned up %s buffers" (length kill-list)))) (message "Cleaned up %s buffers" (length kill-list))))
;;;###autoload ;;;###autoload
(defun narf/kill-process-buffers () (defun doom/kill-process-buffers ()
"Kill all buffers that represent running processes and aren't visible." "Kill all buffers that represent running processes and aren't visible."
(interactive) (interactive)
(let ((buffer-list (narf/get-buffers)) (let ((buffer-list (doom/get-buffers))
(killed-processes 0)) (killed-processes 0))
(dolist (p (process-list)) (dolist (p (process-list))
(let* ((process-name (process-name p)) (let* ((process-name (process-name p))
(assoc (assoc process-name narf-cleanup-processes-alist))) (assoc (assoc process-name doom-cleanup-processes-alist)))
(when (and assoc (when (and assoc
(not (string= process-name "server")) (not (string= process-name "server"))
(process-live-p p) (process-live-p p)
@ -145,23 +147,23 @@ the buffer if it is being displayed in another window."
(message "Cleaned up %s processes" killed-processes))) (message "Cleaned up %s processes" killed-processes)))
;;;###autoload ;;;###autoload
(defun narf/kill-matching-buffers (regexp &optional buffer-list) (defun doom/kill-matching-buffers (regexp &optional buffer-list)
(interactive) (interactive)
(let ((i 0)) (let ((i 0))
(mapc (lambda (b) (mapc (lambda (b)
(when (string-match-p regexp (buffer-name b)) (when (string-match-p regexp (buffer-name b))
(kill-buffer b) (kill-buffer b)
(setq i (1+ i)))) (setq i (1+ i))))
(if buffer-list buffer-list (narf/get-buffers))) (if buffer-list buffer-list (doom/get-buffers)))
(message "Killed %s matches" i))) (message "Killed %s matches" i)))
;;;###autoload ;;;###autoload
(defun narf/cycle-real-buffers (&optional n) (defun doom/cycle-real-buffers (&optional n)
"Switch to the previous buffer and avoid special buffers. If there's nothing "Switch to the previous buffer and avoid special buffers. If there's nothing
left, create a scratch buffer." left, create a scratch buffer."
(let* ((start-buffer (current-buffer)) (let* ((start-buffer (current-buffer))
(move-func (if (< n 0) 'switch-to-next-buffer 'switch-to-prev-buffer)) (move-func (if (< n 0) 'switch-to-next-buffer 'switch-to-prev-buffer))
(real-buffers (narf/get-real-buffers)) (real-buffers (doom/get-real-buffers))
(realc (length real-buffers)) (realc (length real-buffers))
(max 25) (max 25)
(i 0) (i 0)
@ -169,16 +171,16 @@ left, create a scratch buffer."
(if (or (= realc 0) (if (or (= realc 0)
(and (= realc 1) (eq (car real-buffers) (current-buffer)))) (and (= realc 1) (eq (car real-buffers) (current-buffer))))
(progn (progn
(narf|update-scratch-buffer-cwd) (doom|update-scratch-buffer-cwd)
(switch-to-buffer "*scratch*") (switch-to-buffer doom-buffer-name)
(message "Nowhere to go")) (message "Nowhere to go"))
(funcall move-func) (funcall move-func)
(while (and continue) (while (and continue)
(let ((current-buffer (current-buffer))) (let ((current-buffer (current-buffer)))
(cond ((or (eq current-buffer start-buffer) (cond ((or (eq current-buffer start-buffer)
(>= i max)) (>= i max))
(narf|update-scratch-buffer-cwd) (doom|update-scratch-buffer-cwd)
(switch-to-buffer "*scratch*") (switch-to-buffer doom-buffer-name)
(setq continue nil)) (setq continue nil))
((not (memq current-buffer real-buffers)) ((not (memq current-buffer real-buffers))
(funcall move-func)) (funcall move-func))
@ -187,70 +189,70 @@ left, create a scratch buffer."
(cl-incf i))))) (cl-incf i)))))
;;;###autoload ;;;###autoload
(defun narf/real-buffer-p (&optional buffer-or-name) (defun doom/real-buffer-p (&optional buffer-or-name)
(let ((buffer (if buffer-or-name (get-buffer buffer-or-name) (current-buffer)))) (let ((buffer (if buffer-or-name (get-buffer buffer-or-name) (current-buffer))))
(when (buffer-live-p buffer) (when (buffer-live-p buffer)
(not (--any? (if (stringp it) (not (--any? (if (stringp it)
(string-match-p it (buffer-name buffer)) (string-match-p it (buffer-name buffer))
(eq (buffer-local-value 'major-mode buffer) it)) (eq (buffer-local-value 'major-mode buffer) it))
narf-unreal-buffers))))) doom-unreal-buffers)))))
;; Inspired by spacemacs <https://github.com/syl20bnr/spacemacs/blob/master/spacemacs/funcs.el> ;; Inspired by spacemacs <https://github.com/syl20bnr/spacemacs/blob/master/spacemacs/funcs.el>
;;;###autoload ;;;###autoload
(defun narf/next-real-buffer () (defun doom/next-real-buffer ()
"Switch to the next buffer and avoid special buffers." "Switch to the next buffer and avoid special buffers."
(interactive) (interactive)
(narf/cycle-real-buffers +1)) (doom/cycle-real-buffers +1))
;;;###autoload ;;;###autoload
(defun narf/previous-real-buffer () (defun doom/previous-real-buffer ()
"Switch to the previous buffer and avoid special buffers." "Switch to the previous buffer and avoid special buffers."
(interactive) (interactive)
(narf/cycle-real-buffers -1)) (doom/cycle-real-buffers -1))
(defun narf--kill-buffers (buffers &optional filter-func) (defun doom--kill-buffers (buffers &optional filter-func)
(let ((buffers (if filter-func (-filter filter-func buffers) buffers)) (let ((buffers (if filter-func (-filter filter-func buffers) buffers))
(affected 0)) (affected 0))
(mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers) (mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers)
(unless (narf/real-buffer-p) (unless (doom/real-buffer-p)
(narf/previous-real-buffer)) (doom/previous-real-buffer))
(message "Killed %s buffers" affected))) (message "Killed %s buffers" affected)))
;;;###autoload (autoload 'narf:kill-all-buffers "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:kill-all-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-all-buffers (&optional bang) (evil-define-command doom:kill-all-buffers (&optional bang)
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)." "Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
(interactive "<!>") (interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang))) (doom--kill-buffers (doom/get-buffers (not bang)))
(mapc (lambda (w) (when (eq (window-buffer w) (get-buffer "*scratch*")) (mapc (lambda (w) (when (eq (window-buffer w) doom-buffer)
(delete-window w))) (delete-window w)))
(narf/get-visible-windows))) (doom/get-visible-windows)))
;;;###autoload (autoload 'narf:kill-other-buffers "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:kill-other-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-other-buffers (&optional bang) (evil-define-command doom:kill-other-buffers (&optional bang)
"Kill all other project buffers. If BANG, kill *all* other buffers (in workgroup)." "Kill all other project buffers. If BANG, kill *all* other buffers (in workgroup)."
(interactive "<!>") (interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang)) (doom--kill-buffers (doom/get-buffers (not bang))
(lambda (b) (not (eq b (current-buffer))))) (lambda (b) (not (eq b (current-buffer)))))
(when bang (when bang
(delete-other-windows))) (delete-other-windows)))
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-buried-buffers (&optional bang) (evil-define-command doom:kill-buried-buffers (&optional bang)
"Kill buried project buffers (in workgroup) and report how many it found. BANG = get all "Kill buried project buffers (in workgroup) and report how many it found. BANG = get all
buffers regardless of project." buffers regardless of project."
(interactive "<!>") (interactive "<!>")
(narf--kill-buffers (narf/get-buried-buffers (narf/get-buffers (not bang))))) (doom--kill-buffers (doom/get-buried-buffers (doom/get-buffers (not bang)))))
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-matching-buffers (&optional bang pattern) (evil-define-command doom:kill-matching-buffers (&optional bang pattern)
"Kill project buffers matching regex pattern PATTERN. If BANG, then extend search to "Kill project buffers matching regex pattern PATTERN. If BANG, then extend search to
buffers regardless of project." buffers regardless of project."
:repeat nil :repeat nil
(interactive "<!><a>") (interactive "<!><a>")
(narf-kill-buffers (narf/get-matching-buffers pattern (narf/get-buffers (not bang))))) (doom-kill-buffers (doom/get-matching-buffers pattern (doom/get-buffers (not bang)))))
;;;###autoload (autoload 'narf:send-to-scratch-or-org "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:send-to-scratch-or-org "defuns-buffers" nil t)
(evil-define-operator narf:send-to-scratch-or-org (&optional beg end bang) (evil-define-operator doom:send-to-scratch-or-org (&optional beg end bang)
"Send a selection to the scratch buffer. If BANG, then send it to org-capture instead." "Send a selection to the scratch buffer. If BANG, then send it to org-capture instead."
:move-point nil :move-point nil
:type inclusive :type inclusive
@ -261,9 +263,9 @@ buffers regardless of project."
(if bang (if bang
(org-capture-string text) (org-capture-string text)
;; or scratch buffer by default ;; or scratch buffer by default
(let* ((project-dir (narf/project-root t)) (let* ((project-dir (doom/project-root t))
(buffer-name "*scratch*")) (buffer-name doom-buffer-name))
(narf/popup-buffer buffer-name) (doom/popup-buffer buffer-name)
(with-current-buffer buffer-name (with-current-buffer buffer-name
(when project-dir (when project-dir
(cd project-dir)) (cd project-dir))
@ -271,19 +273,19 @@ buffers regardless of project."
(funcall mode)) (funcall mode))
)))) ))))
;;;###autoload (autoload 'narf:cd "defuns-buffers" nil t) ;;;###autoload (autoload 'doom:cd "defuns-buffers" nil t)
(evil-define-command narf:cd (dir) (evil-define-command doom:cd (dir)
"Ex-command alias for `cd'" "Ex-command alias for `cd'"
:repeat nil :repeat nil
(interactive "<f>") (interactive "<f>")
(cd (if (zerop (length dir)) "~" dir))) (cd (if (zerop (length dir)) "~" dir)))
;;;###autoload ;;;###autoload
(defun narf/kill-all-buffers-do-not-remember () (defun doom/kill-all-buffers-do-not-remember ()
"Kill all buffers so that workgroups2 will wipe its current session." "Kill all buffers so that workgroups2 will wipe its current session."
(interactive) (interactive)
(let ((confirm-kill-emacs nil)) (let ((confirm-kill-emacs nil))
(mapc 'kill-buffer (narf/get-buffers)) (mapc 'kill-buffer (doom/get-buffers))
(kill-this-buffer) (kill-this-buffer)
(delete-other-windows) (delete-other-windows)
(wg-save-session t) (wg-save-session t)

View file

@ -1,13 +1,13 @@
;;; defuns-company.el ;;; defuns-company.el
;;;###autoload ;;;###autoload
(defun narf/company-evil-complete-next (&optional arg) (defun doom/company-evil-complete-next (&optional arg)
(call-interactively 'company-dabbrev) (call-interactively 'company-dabbrev)
(if (eq company-candidates-length 1) (if (eq company-candidates-length 1)
(company-complete))) (company-complete)))
;;;###autoload ;;;###autoload
(defun narf/company-evil-complete-previous (&optional arg) (defun doom/company-evil-complete-previous (&optional arg)
(let ((company-selection-wrap-around t)) (let ((company-selection-wrap-around t))
(call-interactively 'company-dabbrev) (call-interactively 'company-dabbrev)
(if (eq company-candidates-length 1) (if (eq company-candidates-length 1)
@ -15,7 +15,7 @@
(call-interactively 'company-select-previous)))) (call-interactively 'company-select-previous))))
;;;###autoload ;;;###autoload
(defun narf/company-complete-common-or-complete-full () (defun doom/company-complete-common-or-complete-full ()
(interactive) (interactive)
(when (company-manual-begin) (when (company-manual-begin)
(if (eq last-command #'company-complete-common-or-cycle) (if (eq last-command #'company-complete-common-or-cycle)
@ -27,7 +27,7 @@
(call-interactively #'company-complete-selection) (call-interactively #'company-complete-selection)
(call-interactively #'company-complete)))))) (call-interactively #'company-complete))))))
(defun narf--company-whole-lines () (defun doom--company-whole-lines ()
(split-string (split-string
(replace-regexp-in-string (replace-regexp-in-string
"^[\t\s]+" "" "^[\t\s]+" ""
@ -36,22 +36,22 @@
"\\(\r\n\\|[\n\r]\\)" t)) "\\(\r\n\\|[\n\r]\\)" t))
;;;###autoload ;;;###autoload
(defun narf/company-whole-lines (command &optional arg &rest ignored) (defun doom/company-whole-lines (command &optional arg &rest ignored)
(interactive (list 'interactive)) (interactive (list 'interactive))
(let ((lines (narf--company-whole-lines))) (let ((lines (doom--company-whole-lines)))
(cl-case command (cl-case command
(interactive (company-begin-backend 'narf/company-whole-lines)) (interactive (company-begin-backend 'doom/company-whole-lines))
(prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1)) (prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1))
(candidates (all-completions arg lines))))) (candidates (all-completions arg lines)))))
;;;###autoload ;;;###autoload
(defun narf/company-dict-or-keywords () (defun doom/company-dict-or-keywords ()
(interactive) (interactive)
(let ((company-backends '((company-keywords company-dict)))) (let ((company-backends '((company-keywords company-dict))))
(call-interactively 'company-complete))) (call-interactively 'company-complete)))
;;;###autoload ;;;###autoload
(defun narf/company-complete () (defun doom/company-complete ()
"Bring up the completion popup. If there is only one result, auto-complete it." "Bring up the completion popup. If there is only one result, auto-complete it."
(interactive) (interactive)
(when (and (company-manual-begin) (when (and (company-manual-begin)

View file

@ -1,15 +1,15 @@
;;; defuns-dash.el --- Dash.app integration ;;; defuns-dash.el --- Dash.app integration
;;;###autoload ;;;###autoload
(defun narf/dash-at-pt () (defun doom/dash-at-pt ()
(interactive) (interactive)
(if (evil-visual-state-p) (if (evil-visual-state-p)
(dash-at-point-run-search (buffer-substring-no-properties (region-beginning) (region-end)) (dash-at-point-run-search (buffer-substring-no-properties (region-beginning) (region-end))
(dash-at-point-guess-docset)) (dash-at-point-guess-docset))
(dash-at-point))) (dash-at-point)))
;;;###autoload (autoload 'narf:dash "defuns-dash" nil t) ;;;###autoload (autoload 'doom:dash "defuns-dash" nil t)
(evil-define-command narf:dash (bang input) (evil-define-command doom:dash (bang input)
(interactive "<!><a>") (interactive "<!><a>")
(let ((docset (unless bang (dash-at-point-guess-docset))) (let ((docset (unless bang (dash-at-point-guess-docset)))
(query input)) (query input))

View file

@ -28,22 +28,22 @@
(interactive) (interactive)
(message "Mode: %s" major-mode)) (message "Mode: %s" major-mode))
;;;###autoload (autoload 'narf:echo "defuns-debug" nil t) ;;;###autoload (autoload 'doom:echo "defuns-debug" nil t)
(evil-define-command narf:echo (bang message) (evil-define-command doom:echo (bang message)
"Display MSG in echo-area without logging it in *Messages* buffer." "Display MSG in echo-area without logging it in *Messages* buffer."
(interactive "<!><a>") (interactive "<!><a>")
(let (message-log-max) (let (message-log-max)
(message "%s%s" (if bang ">> " "") message))) (message "%s%s" (if bang ">> " "") message)))
;;;###autoload (autoload 'narf:debug "defuns-debug" nil t) ;;;###autoload (autoload 'doom:debug "defuns-debug" nil t)
(evil-define-command narf:debug (&optional path) (evil-define-command doom:debug (&optional path)
"Initiate debugger for current major mode" "Initiate debugger for current major mode"
(interactive "<f>") (interactive "<f>")
(let ((default-directory (narf/project-root))) (let ((default-directory (doom/project-root)))
(cond ((memq major-mode '(c-mode c++-mode)) (cond ((memq major-mode '(c-mode c++-mode))
(realgud:gdb (if path (concat "gdb " path)))) (realgud:gdb (if path (concat "gdb " path))))
((memq major-mode '(ruby-mode enh-ruby-mode)) ((memq major-mode '(ruby-mode enh-ruby-mode))
(narf:repl nil (format "run '%s'" (f-filename (or path buffer-file-name))))) (doom:repl nil (format "run '%s'" (f-filename (or path buffer-file-name)))))
((eq major-mode 'sh-mode) ((eq major-mode 'sh-mode)
(let ((shell sh-shell)) (let ((shell sh-shell))
(when (string= shell "sh") (when (string= shell "sh")
@ -60,16 +60,16 @@
(haskell-debug)) (haskell-debug))
(t (user-error "No debugger for %s" major-mode))))) (t (user-error "No debugger for %s" major-mode)))))
;;;###autoload (autoload 'narf:debug-toggle-breakpoint "defuns-debug" nil t) ;;;###autoload (autoload 'doom:debug-toggle-breakpoint "defuns-debug" nil t)
(evil-define-command narf:debug-toggle-breakpoint (&optional bang) (evil-define-command doom:debug-toggle-breakpoint (&optional bang)
(interactive "<!>") (interactive "<!>")
(call-interactively (if bang 'realgud:cmd-clear 'realgud:cmd-break))) (call-interactively (if bang 'realgud:cmd-clear 'realgud:cmd-break)))
;;;###autoload ;;;###autoload
(defun narf/debug-quit () (defun doom/debug-quit ()
(interactive) (interactive)
(ignore-errors (call-interactively 'realgud:cmd-quit)) (ignore-errors (call-interactively 'realgud:cmd-quit))
(narf/popup-close) (doom/popup-close)
(evil-normal-state)) (evil-normal-state))
(provide 'defuns-debug) (provide 'defuns-debug)

View file

@ -3,7 +3,7 @@
(defvar *linum-mdown-line* nil) (defvar *linum-mdown-line* nil)
(defun narf--line-at-click () (defun doom--line-at-click ()
(save-excursion (save-excursion
(let ((click-y (cdr (cdr (mouse-position)))) (let ((click-y (cdr (cdr (mouse-position))))
(line-move-visual-store line-move-visual)) (line-move-visual-store line-move-visual))
@ -16,18 +16,18 @@
(1+ (line-number-at-pos))))) (1+ (line-number-at-pos)))))
;;;###autoload ;;;###autoload
(defun narf/mouse-drag-line () (defun doom/mouse-drag-line ()
(interactive) (interactive)
(goto-line (narf--line-at-click)) (goto-line (doom--line-at-click))
(set-mark (point)) (set-mark (point))
(setq *linum-mdown-line* (line-number-at-pos))) (setq *linum-mdown-line* (line-number-at-pos)))
;;;###autoload ;;;###autoload
(defun narf/mouse-select-line () (defun doom/mouse-select-line ()
(interactive) (interactive)
(when *linum-mdown-line* (when *linum-mdown-line*
(let (mu-line) (let (mu-line)
(setq mu-line (narf--line-at-click)) (setq mu-line (doom--line-at-click))
(goto-line *linum-mdown-line*) (goto-line *linum-mdown-line*)
(if (> mu-line *linum-mdown-line*) (if (> mu-line *linum-mdown-line*)
(progn (progn
@ -40,12 +40,12 @@
(setq *linum-mdown-line* nil)))) (setq *linum-mdown-line* nil))))
;;;###autoload ;;;###autoload
(defun narf*load-hs-minor-mode () (defun doom*load-hs-minor-mode ()
(hs-minor-mode 1) (hs-minor-mode 1)
(advice-remove 'evil-toggle-fold 'narf-load-hs-minor-mode)) (advice-remove 'evil-toggle-fold 'doom-load-hs-minor-mode))
;;;###autoload ;;;###autoload
(defun narf/reselect-paste () (defun doom/reselect-paste ()
(interactive) (interactive)
(evil-goto-mark ?\[) (evil-goto-mark ?\[)
(evil-visual-state) (evil-visual-state)

View file

@ -1,6 +1,6 @@
;;; defuns-embrace.el ;;; defuns-embrace.el
(defun narf--embrace-get-pair (char) (defun doom--embrace-get-pair (char)
(acond ((cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist)) (acond ((cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))
`(,(car it) . ,(cdr it))) `(,(car it) . ,(cdr it)))
((assoc-default char embrace--pairs-list) ((assoc-default char embrace--pairs-list)
@ -11,23 +11,23 @@
(t `(,char . ,char)))) (t `(,char . ,char))))
;;;###autoload ;;;###autoload
(defun narf/embrace-escaped () (defun doom/embrace-escaped ()
"Escaped surround characters." "Escaped surround characters."
(let ((char (read-char "\\"))) (let ((char (read-char "\\")))
(if (eq char 27) (if (eq char 27)
(cons "" "") (cons "" "")
(let ((pair (narf--embrace-get-pair (string char))) (let ((pair (doom--embrace-get-pair (string char)))
(text (if (sp-point-in-string) "\\\\%s" "\\%s"))) (text (if (sp-point-in-string) "\\\\%s" "\\%s")))
(cons (format text (car pair)) (cons (format text (car pair))
(format text (cdr pair))))))) (format text (cdr pair)))))))
;;;###autoload ;;;###autoload
(defun narf/embrace-latex () (defun doom/embrace-latex ()
"LaTeX commands" "LaTeX commands"
(cons (format "\\%s{" (read-string "\\")) "}")) (cons (format "\\%s{" (read-string "\\")) "}"))
;;;###autoload ;;;###autoload
(defun narf/embrace-elisp-fn () (defun doom/embrace-elisp-fn ()
(cons (format "(%s " (or (read-string "(") "")) ")")) (cons (format "(%s " (or (read-string "(") "")) ")"))
(provide 'defuns-embrace) (provide 'defuns-embrace)

View file

@ -1,49 +1,48 @@
;;; defuns-evil.el ;;; defuns-evil.el
;; for ../core-evil.el
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil" nil t) ;;;###autoload (autoload 'doom:evil-open-folds "defuns-evil" nil t)
(evil-define-command narf/evil-open-folds (count) (evil-define-command doom/evil-open-folds (count)
"Instead of `evil-open-folds'. Accepts COUNT for dictating fold level." "Instead of `evil-open-folds'. Accepts COUNT for dictating fold level."
(interactive "P") (interactive "P")
(unless (bound-and-true-p hs-minor-mode) (unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode 1)) (hs-minor-mode 1))
(if count (hs-hide-level count) (evil-open-folds))) (if count (hs-hide-level count) (evil-open-folds)))
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil" nil t) ;;;###autoload (autoload 'doom:evil-open-folds "defuns-evil" nil t)
(evil-define-command narf/evil-close-folds (count) (evil-define-command doom/evil-close-folds (count)
"Instead of `evil-close-folds'. Accepts COUNT for dictating fold level." "Instead of `evil-close-folds'. Accepts COUNT for dictating fold level."
(interactive "P") (interactive "P")
(unless (bound-and-true-p hs-minor-mode) (unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode 1)) (hs-minor-mode 1))
(if count (hs-hide-level count) (evil-close-folds))) (if count (hs-hide-level count) (evil-close-folds)))
;;;###autoload (autoload 'narf/multi-next-line "defuns-evil" nil t) ;;;###autoload (autoload 'doom/multi-next-line "defuns-evil" nil t)
(evil-define-motion narf/multi-next-line (count) (evil-define-motion doom/multi-next-line (count)
"Move down 6 lines" "Move down 6 lines"
:type line :type line
(let ((line-move-visual visual-line-mode)) (let ((line-move-visual visual-line-mode))
(evil-line-move (* 6 (or count 1))))) (evil-line-move (* 6 (or count 1)))))
;;;###autoload (autoload 'narf/multi-previous-line "defuns-evil" nil t) ;;;###autoload (autoload 'doom/multi-previous-line "defuns-evil" nil t)
(evil-define-motion narf/multi-previous-line (count) (evil-define-motion doom/multi-previous-line (count)
"Move up 6 lines" "Move up 6 lines"
:type line :type line
(let ((line-move-visual visual-line-mode)) (let ((line-move-visual visual-line-mode))
(evil-line-move (- (* 6 (or count 1)))))) (evil-line-move (- (* 6 (or count 1))))))
;;;###autoload ;;;###autoload
(defun narf/evil-visual-line-state-p () (defun doom/evil-visual-line-state-p ()
"Returns non-nil if in visual-line mode, nil otherwise." "Returns non-nil if in visual-line mode, nil otherwise."
(and (evil-visual-state-p) (and (evil-visual-state-p)
(eq (evil-visual-type) 'line))) (eq (evil-visual-type) 'line)))
;;;###autoload ;;;###autoload
(defun narf*evil-exchange-off () (defun doom*evil-exchange-off ()
(when evil-exchange--overlays (when evil-exchange--overlays
(evil-exchange-cancel))) (evil-exchange-cancel)))
;;;###autoload (autoload 'narf/evil-macro-on-all-lines "defuns-evil" nil t) ;;;###autoload (autoload 'doom/evil-macro-on-all-lines "defuns-evil" nil t)
(evil-define-operator narf/evil-macro-on-all-lines (beg end &optional macro) (evil-define-operator doom/evil-macro-on-all-lines (beg end &optional macro)
"Apply macro to each line." "Apply macro to each line."
:motion nil :motion nil
:move-point nil :move-point nil
@ -57,8 +56,8 @@
(or macro (read-char "@-")))))) (or macro (read-char "@-"))))))
;;; Custom argument handlers ;;; Custom argument handlers
(defvar narf-buffer-match-global evil-ex-substitute-global "") (defvar doom-buffer-match-global evil-ex-substitute-global "")
(defun narf--evil-ex-match-init (name &optional face update-hook) (defun doom--evil-ex-match-init (name &optional face update-hook)
(with-current-buffer evil-ex-current-buffer (with-current-buffer evil-ex-current-buffer
(cond (cond
((eq flag 'start) ((eq flag 'start)
@ -70,7 +69,7 @@
((eq flag 'stop) ((eq flag 'stop)
(evil-ex-delete-hl name))))) (evil-ex-delete-hl name)))))
(defun narf--evil-ex-buffer-match (arg &optional hl-name flags beg end) (defun doom--evil-ex-buffer-match (arg &optional hl-name flags beg end)
(when (and (eq flag 'update) (when (and (eq flag 'update)
evil-ex-substitute-highlight-all evil-ex-substitute-highlight-all
(not (zerop (length arg)))) (not (zerop (length arg))))
@ -94,22 +93,22 @@
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage)))))) (evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
;;;###autoload ;;;###autoload
(defun narf/evil-ex-buffer-match (flag &optional arg) (defun doom/evil-ex-buffer-match (flag &optional arg)
(let ((hl-name 'evil-ex-buffer-match)) (let ((hl-name 'evil-ex-buffer-match))
(with-selected-window (minibuffer-selected-window) (with-selected-window (minibuffer-selected-window)
(narf--evil-ex-match-init hl-name) (doom--evil-ex-match-init hl-name)
(narf--evil-ex-buffer-match arg hl-name (list (if narf-buffer-match-global ?g)))))) (doom--evil-ex-buffer-match arg hl-name (list (if doom-buffer-match-global ?g))))))
;;;###autoload ;;;###autoload
(defun narf/evil-ex-global-match (flag &optional arg) (defun doom/evil-ex-global-match (flag &optional arg)
(let ((hl-name 'evil-ex-global-match)) (let ((hl-name 'evil-ex-global-match))
(with-selected-window (minibuffer-selected-window) (with-selected-window (minibuffer-selected-window)
(narf--evil-ex-match-init hl-name) (doom--evil-ex-match-init hl-name)
(let ((result (car-safe (evil-ex-parse-global arg)))) (let ((result (car-safe (evil-ex-parse-global arg))))
(narf--evil-ex-buffer-match result hl-name nil (point-min) (point-max)))))) (doom--evil-ex-buffer-match result hl-name nil (point-min) (point-max))))))
;;;###autoload ;;;###autoload
(defun narf/evil-ex-undefine-cmd (cmd) (defun doom/evil-ex-undefine-cmd (cmd)
(if (string-match "^[^][]*\\(\\[\\(.*\\)\\]\\)[^][]*$" cmd) (if (string-match "^[^][]*\\(\\[\\(.*\\)\\]\\)[^][]*$" cmd)
(let ((abbrev (replace-match "" nil t cmd 1)) (let ((abbrev (replace-match "" nil t cmd 1))
(full (replace-match "\\2" nil nil cmd 1))) (full (replace-match "\\2" nil nil cmd 1)))
@ -117,10 +116,10 @@
(setq evil-ex-commands (delq (assoc abbrev evil-ex-commands) evil-ex-commands))) (setq evil-ex-commands (delq (assoc abbrev evil-ex-commands) evil-ex-commands)))
(setq evil-ex-commands (delq (assoc cmd evil-ex-commands) evil-ex-commands)))) (setq evil-ex-commands (delq (assoc cmd evil-ex-commands) evil-ex-commands))))
(defvar narf:map-maps '()) (defvar doom:map-maps '())
;;;###autoload (autoload 'narf:map "defuns-evil" nil t) ;;;###autoload (autoload 'doom:map "defuns-evil" nil t)
(evil-define-command narf:map (bang input &optional mode) (evil-define-command doom:map (bang input &optional mode)
"Map ex commands to keybindings. INPUT should be in the format [KEY] [EX COMMAND]." "Map ex commands to keybindings. INPUT should be in the format [KEY] [EX COMMAND]."
(interactive "<!><a>") (interactive "<!><a>")
(let* ((parts (s-split-up-to " " input 2 t)) (let* ((parts (s-split-up-to " " input 2 t))
@ -138,31 +137,31 @@
(evil-define-key mode nil key fn) (evil-define-key mode nil key fn)
(define-key map key fn)))) (define-key map key fn))))
;;;###autoload (autoload 'narf:nmap "defuns-evil" nil t) ;;;###autoload (autoload 'doom:nmap "defuns-evil" nil t)
(evil-define-command narf:nmap (bang input &optional mode) (evil-define-command doom:nmap (bang input &optional mode)
(interactive "<!><a>") (narf:map bang input 'normal)) (interactive "<!><a>") (doom:map bang input 'normal))
;;;###autoload (autoload 'narf:imap "defuns-evil" nil t) ;;;###autoload (autoload 'doom:imap "defuns-evil" nil t)
(evil-define-command narf:imap (bang input &optional mode) (evil-define-command doom:imap (bang input &optional mode)
(interactive "<!><a>") (narf:map bang input 'insert)) (interactive "<!><a>") (doom:map bang input 'insert))
;;;###autoload (autoload 'narf:vmap "defuns-evil" nil t) ;;;###autoload (autoload 'doom:vmap "defuns-evil" nil t)
(evil-define-command narf:vmap (bang input &optional mode) (evil-define-command doom:vmap (bang input &optional mode)
(interactive "<!><a>") (narf:map bang input 'visual)) (interactive "<!><a>") (doom:map bang input 'visual))
;;;###autoload (autoload 'narf:mmap "defuns-evil" nil t) ;;;###autoload (autoload 'doom:mmap "defuns-evil" nil t)
(evil-define-command narf:mmap (bang input &optional mode) (evil-define-command doom:mmap (bang input &optional mode)
(interactive "<!><a>") (narf:map bang input 'motion)) (interactive "<!><a>") (doom:map bang input 'motion))
;;;###autoload (autoload 'narf:omap "defuns-evil" nil t) ;;;###autoload (autoload 'doom:omap "defuns-evil" nil t)
(evil-define-command narf:omap (bang input &optional mode) (evil-define-command doom:omap (bang input &optional mode)
(interactive "<!><a>") (narf:map bang input 'operator)) (interactive "<!><a>") (doom:map bang input 'operator))
;;;###autoload ;;;###autoload
(defun narf/evil-snipe-easymotion () (defun doom/evil-snipe-easymotion ()
(interactive) (interactive)
(require 'evil-easymotion) (require 'evil-easymotion)
(call-interactively narf--evil-snipe-repeat-fn)) (call-interactively doom--evil-snipe-repeat-fn))
(provide 'defuns-evil) (provide 'defuns-evil)
;;; defuns-evil.el ends here ;;; defuns-evil.el ends here

View file

@ -1,7 +1,7 @@
;;; defuns-file.el ;;; defuns-file.el
;;;###autoload (autoload 'narf:file-delete "defuns-file" nil t) ;;;###autoload (autoload 'doom:file-delete "defuns-file" nil t)
(evil-define-command narf:file-delete (&optional bang filename) (evil-define-command doom:file-delete (&optional bang filename)
"Delete current buffer's file. If bang, then kill the buffer afterwards as well." "Delete current buffer's file. If bang, then kill the buffer afterwards as well."
:repeat nil :repeat nil
(interactive "<!><f>") (interactive "<!><f>")
@ -14,18 +14,18 @@
(mapc (lambda (file) (mapc (lambda (file)
(when (file-exists-p file) (when (file-exists-p file)
(delete-file file t))) (delete-file file t)))
(narf/org-attachments))) (doom/org-attachments)))
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(delete-file filename) (delete-file filename)
(kill-this-buffer) (kill-this-buffer)
(unless (narf/real-buffer-p) (unless (doom/real-buffer-p)
(narf/previous-real-buffer)) (doom/previous-real-buffer))
(save-place-forget-unreadable-files) (save-place-forget-unreadable-files)
(message "File successfully deleted: %s" filename))))) (message "File successfully deleted: %s" filename)))))
(defun narf--save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit)) (defun doom--save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit))
;;;###autoload (autoload 'narf:file-create "defuns-file" nil t) ;;;###autoload (autoload 'doom:file-create "defuns-file" nil t)
(evil-define-command narf:file-create (path &optional bang) (evil-define-command doom:file-create (path &optional bang)
"Deploy files (and their associated templates) quickly. Will prompt "Deploy files (and their associated templates) quickly. Will prompt
you to fill in each snippet field before buffer closes unless BANG is you to fill in each snippet field before buffer closes unless BANG is
provided." provided."
@ -40,12 +40,12 @@ provided."
(if (f-exists? fullpath) (if (f-exists? fullpath)
(error "File already exists: %s" path) (error "File already exists: %s" path)
(find-file fullpath) (find-file fullpath)
(add-hook 'yas-after-exit-snippet-hook 'narf--save-exit) (add-hook 'yas-after-exit-snippet-hook 'doom--save-exit)
(if bang (narf--save-exit))) (if bang (doom--save-exit)))
(error "Directory doesn't exist: %s" dir)))) (error "Directory doesn't exist: %s" dir))))
;;;###autoload (autoload 'narf:file-move "defuns-file" nil t) ;;;###autoload (autoload 'doom:file-move "defuns-file" nil t)
(evil-define-command narf:file-move (path) (evil-define-command doom:file-move (path)
"Move current buffer's file to PATH. Replaces %, # and other variables (see "Move current buffer's file to PATH. Replaces %, # and other variables (see
`evil-ex-replace-special-filenames')" `evil-ex-replace-special-filenames')"
:repeat nil :repeat nil
@ -56,13 +56,13 @@ provided."
((f-dir? (f-dirname path)) ((f-dir? (f-dirname path))
(f-full path)) (f-full path))
(t (user-error "Not a valid destination: %s" path)))) (t (user-error "Not a valid destination: %s" path))))
(project-root (narf/project-root))) (project-root (doom/project-root)))
;; Move all attachments if in org-mode ;; Move all attachments if in org-mode
(when (eq major-mode 'org-mode) (when (eq major-mode 'org-mode)
(mapc (lambda (file) (mapc (lambda (file)
(when (and (file-exists-p file) (not (f-same? old-path new-path))) (when (and (file-exists-p file) (not (f-same? old-path new-path)))
(rename-file file (f-expand (f-filename old-path) (f-dirname new-path)) t))) (rename-file file (f-expand (f-filename old-path) (f-dirname new-path)) t)))
(narf/org-attachments))) (doom/org-attachments)))
(when (buffer-modified-p) (when (buffer-modified-p)
(save-buffer)) (save-buffer))
(rename-file old-path new-path 1) (rename-file old-path new-path 1)
@ -70,7 +70,7 @@ provided."
(set-visited-file-name new-path) (set-visited-file-name new-path)
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(save-place-forget-unreadable-files) (save-place-forget-unreadable-files)
(setq narf--spaceline-file-path nil) (setq doom--spaceline-file-path nil)
(message "File '%s' successfully renamed to '%s'" (message "File '%s' successfully renamed to '%s'"
(f-relative old-path project-root) (f-relative new-path project-root)))) (f-relative old-path project-root) (f-relative new-path project-root))))

View file

@ -2,12 +2,12 @@
;; for ../core-flycheck.el ;; for ../core-flycheck.el
;;;###autoload ;;;###autoload
(defun narf*flycheck-buffer () (defun doom*flycheck-buffer ()
(when (bound-and-true-p flycheck-mode) (when (bound-and-true-p flycheck-mode)
(flycheck-buffer))) (flycheck-buffer)))
;;;###autoload ;;;###autoload
(defun narf/flycheck-next-error () (defun doom/flycheck-next-error ()
(interactive) (interactive)
(call-interactively (call-interactively
(if (bound-and-true-p flycheck-mode) (if (bound-and-true-p flycheck-mode)
@ -15,7 +15,7 @@
'next-error))) 'next-error)))
;;;###autoload ;;;###autoload
(defun narf/flycheck-previous-error () (defun doom/flycheck-previous-error ()
(interactive) (interactive)
(call-interactively (call-interactively
(if (bound-and-true-p flycheck-mode) (if (bound-and-true-p flycheck-mode)
@ -23,7 +23,7 @@
'previous-error))) 'previous-error)))
;;;###autoload ;;;###autoload
(defun narf/flycheck-errors () (defun doom/flycheck-errors ()
(interactive) (interactive)
(when (bound-and-true-p flycheck-mode) (when (bound-and-true-p flycheck-mode)
(flycheck-buffer) (flycheck-buffer)

View file

@ -1,7 +1,7 @@
;;; defuns-git.el ;;; defuns-git.el
;;;### (autoload 'narf/git-remote-browse "defuns-git" nil t) ;;;### (autoload 'doom:git-remote-browse "defuns-git" nil t)
(evil-define-command narf:git-remote-browse (&optional bang) (evil-define-command doom:git-remote-browse (&optional bang)
"Open the website for the current (or specified) version controlled FILE. If BANG, "Open the website for the current (or specified) version controlled FILE. If BANG,
then use hub to do it." then use hub to do it."
(interactive "<!>") (interactive "<!>")
@ -11,7 +11,7 @@ then use hub to do it."
(error (error
(setq url (shell-command-to-string "hub browse -u --")) (setq url (shell-command-to-string "hub browse -u --"))
(setq url (if url (setq url (if url
(concat (s-trim url) "/" (f-relative (buffer-file-name) (narf/project-root)) (concat (s-trim url) "/" (f-relative (buffer-file-name) (doom/project-root))
(when (use-region-p) (format "#L%s-L%s" (when (use-region-p) (format "#L%s-L%s"
(line-number-at-pos (region-beginning)) (line-number-at-pos (region-beginning))
(line-number-at-pos (region-end))))))))) (line-number-at-pos (region-end)))))))))

View file

@ -1,8 +1,7 @@
;;; defuns-helm.el ;;; defuns-helm.el
;; see ../core-helm.el
;;;###autoload (autoload 'narf:helm-recentf "defuns-helm" nil t) ;;;###autoload (autoload 'doom:helm-recentf "defuns-helm" nil t)
(evil-define-command narf:helm-recentf (&optional bang) (evil-define-command doom:helm-recentf (&optional bang)
"Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If "Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
`bang', then `search' is interpreted as regexp." `bang', then `search' is interpreted as regexp."
:repeat nil :repeat nil
@ -11,8 +10,8 @@
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as ;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp. ;; regexp.
;;;###autoload (autoload 'narf:helm-ag-search "defuns-helm" nil t) ;;;###autoload (autoload 'doom:helm-ag-search "defuns-helm" nil t)
(evil-define-operator narf:helm-ag-search (beg end search regex-p &optional dir) (evil-define-operator doom:helm-ag-search (beg end search regex-p &optional dir)
"Preform an helm-ag search with SEARCH. If SEARCH is nil and in visual mode, use the "Preform an helm-ag search with SEARCH. If SEARCH is nil and in visual mode, use the
selection, otherwise activate live ag searching in helm. selection, otherwise activate live ag searching in helm.
@ -22,7 +21,7 @@ DIR specifies the default-directory from which ag is run."
:repeat nil :repeat nil
(interactive "<r><a><!>") (interactive "<r><a><!>")
(require 'helm-ag) (require 'helm-ag)
(let* ((helm-ag--default-directory (or dir (f-slash (narf/project-root)))) (let* ((helm-ag--default-directory (or dir (f-slash (doom/project-root))))
(helm-ag-command-option (unless regex-p "-Q ")) (helm-ag-command-option (unless regex-p "-Q "))
(input "") (input "")
(header-name (format "Search in %s" helm-ag--default-directory))) (header-name (format "Search in %s" helm-ag--default-directory)))
@ -40,56 +39,56 @@ DIR specifies the default-directory from which ag is run."
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted ;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
;; as regexp ;; as regexp
;;;###autoload (autoload 'narf:helm-ag-search-cwd "defuns-helm" nil t) ;;;###autoload (autoload 'doom:helm-ag-search-cwd "defuns-helm" nil t)
(evil-define-operator narf:helm-ag-search-cwd (beg end &optional search bang) (evil-define-operator doom:helm-ag-search-cwd (beg end &optional search bang)
:type inclusive :repeat nil :type inclusive :repeat nil
(interactive "<r><a><!>") (interactive "<r><a><!>")
(narf:helm-ag-search beg end search bang default-directory)) (doom:helm-ag-search beg end search bang default-directory))
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or ;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is ;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
;; `scss-mode' ;; `scss-mode'
;;;###autoload (autoload 'narf:helm-swoop "defuns-helm" nil t) ;;;###autoload (autoload 'doom:helm-swoop "defuns-helm" nil t)
(evil-define-command narf:helm-swoop (&optional search bang) (evil-define-command doom:helm-swoop (&optional search bang)
:repeat nil :repeat nil
(interactive "<a><!>") (interactive "<a><!>")
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search))) (if bang (helm-multi-swoop-all search) (helm-swoop :$query search)))
;;;###autoload ;;;###autoload
(defun narf/helm-find-in-emacsd () (defun doom/helm-find-in-emacsd ()
(interactive) (interactive)
(in! narf-emacs-dir (helm-projectile-find-file))) (in! doom-emacs-dir (helm-projectile-find-file)))
;;;###autoload ;;;###autoload
(defun narf/helm-find-in-dotfiles () (defun doom/helm-find-in-dotfiles ()
(interactive) (interactive)
(in! (expand-file-name ".dotfiles" "~") (helm-projectile-find-file))) (in! (expand-file-name ".dotfiles" "~") (helm-projectile-find-file)))
;;;###autoload ;;;###autoload
(defun narf/helm-buffers-dwim (&optional all-p) (defun doom/helm-buffers-dwim (&optional all-p)
"Displays open buffers in current project. If ALL-P, then show all open "Displays open buffers in current project. If ALL-P, then show all open
buffers." buffers."
(interactive) (interactive)
(let ((narf-helm-force-project-buffers (and (not all-p) (narf/project-p)))) (let ((doom-helm-force-project-buffers (and (not all-p) (doom/project-p))))
(helm-buffers-list))) (helm-buffers-list)))
;;;###autoload ;;;###autoload
(defun narf*helm-replace-prompt (plist) (defun doom*helm-replace-prompt (plist)
(if (keywordp (car plist)) (if (keywordp (car plist))
(setq plist (plist-put plist :prompt helm-global-prompt)) (setq plist (plist-put plist :prompt helm-global-prompt))
(setcar (nthcdr 2 plist) helm-global-prompt)) (setcar (nthcdr 2 plist) helm-global-prompt))
plist) plist)
;;;###autoload ;;;###autoload
(defun narf*helm-hide-header (source &optional force) (defun doom*helm-hide-header (source &optional force)
(setq header-line-format nil) (setq header-line-format nil)
(narf|hide-mode-line)) (doom|hide-mode-line))
;;;###autoload ;;;###autoload
(defun narf*helm-hide-source-header-maybe () (defun doom*helm-hide-source-header-maybe ()
(if (<= (length helm-sources) 1) (if (<= (length helm-sources) 1)
(set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111") (set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111")
(set-face-attribute 'helm-source-header nil :height 1.0 :foreground narf-helm-header-fg))) (set-face-attribute 'helm-source-header nil :height 1.0 :foreground doom-helm-header-fg)))
(provide 'defuns-helm) (provide 'defuns-helm)
;;; defuns-helm.el ends here ;;; defuns-helm.el ends here

View file

@ -1,7 +1,7 @@
;;; defuns-highlight-indentation.el ;;; defuns-highlight-indentation.el
;;;###autoload ;;;###autoload
(defun narf/add-whitespace (&optional start end) (defun doom/add-whitespace (&optional start end)
"Maintain indentation whitespace in buffer. Used so that highlight-indentation will "Maintain indentation whitespace in buffer. Used so that highlight-indentation will
display consistent guides. Whitespace is stripped out on save, so this doesn't affect the display consistent guides. Whitespace is stripped out on save, so this doesn't affect the
end file." end file."
@ -38,7 +38,7 @@ end file."
nil) nil)
;;;###autoload ;;;###autoload
(defun narf*hl-indent-guess-offset () (defun doom*hl-indent-guess-offset ()
(string-to-int (gethash 'indent_size (editorconfig-get-properties)))) (string-to-int (gethash 'indent_size (editorconfig-get-properties))))
(provide 'defuns-highlight-indentation) (provide 'defuns-highlight-indentation)

View file

@ -1,7 +1,7 @@
;;; defuns-ido.el ;;; defuns-ido.el
;;;###autoload ;;;###autoload
(defun narf*ido-sort-mtime () (defun doom*ido-sort-mtime ()
"Sort ido filelist by mtime instead of alphabetically." "Sort ido filelist by mtime instead of alphabetically."
(setq ido-temp-list (setq ido-temp-list
(sort ido-temp-list (sort ido-temp-list
@ -16,7 +16,7 @@
ido-temp-list)))) ido-temp-list))))
;;;###autoload ;;;###autoload
(defun narf|ido-setup-home-keybind () (defun doom|ido-setup-home-keybind ()
"Go to $HOME with ~" "Go to $HOME with ~"
(define-key ido-file-completion-map (kbd "~") (define-key ido-file-completion-map (kbd "~")
(λ! (if (looking-back "/") (λ! (if (looking-back "/")
@ -24,37 +24,37 @@
(call-interactively 'self-insert-command))))) (call-interactively 'self-insert-command)))))
;;;###autoload ;;;###autoload
(defun narf/ido-find-file (&optional dir) (defun doom/ido-find-file (&optional dir)
(interactive) (interactive)
(let ((default-directory (or dir default-directory))) (let ((default-directory (or dir default-directory)))
(ido-find-file))) (ido-find-file)))
;;;###autoload ;;;###autoload
(defun narf/ido-find-file-other-window (&optional dir) (defun doom/ido-find-file-other-window (&optional dir)
(interactive) (interactive)
(let ((default-directory (or dir default-directory))) (let ((default-directory (or dir default-directory)))
(ido-find-file-other-window))) (ido-find-file-other-window)))
;;;###autoload ;;;###autoload
(defun narf/ido-find-project-file () (defun doom/ido-find-project-file ()
(interactive) (interactive)
(let ((default-directory (narf/project-root))) (let ((default-directory (doom/project-root)))
(ido-find-file))) (ido-find-file)))
;;;###autoload ;;;###autoload
(defun narf/ido-recentf () (defun doom/ido-recentf ()
"Use `ido-completing-read' to \\[find-file] a recent file" "Use `ido-completing-read' to \\[find-file] a recent file"
(interactive) (interactive)
(if (find-file (ido-completing-read "Find recent file: " recentf-list)) (if (find-file (ido-completing-read "Find recent file: " recentf-list))
(message "Opening file...") (message "Opening file...")
(message "Aborting"))) (message "Aborting")))
;;;###autoload (autoload 'narf:ido-find-file-in-emacsd "defuns-ido" nil t) ;;;###autoload (autoload 'doom:ido-find-file-in-emacsd "defuns-ido" nil t)
(evil-define-command narf:ido-find-file-in-emacsd (&optional bang) :repeat nil (evil-define-command doom:ido-find-file-in-emacsd (&optional bang) :repeat nil
(interactive "<!>") (interactive "<!>")
(if bang (if bang
(ido-find-file-in-dir narf-modules-dir) (ido-find-file-in-dir doom-modules-dir)
(ido-find-file-in-dir narf-emacs-dir))) (ido-find-file-in-dir doom-emacs-dir)))
(provide 'defuns-ido) (provide 'defuns-ido)
;;; defuns-ido.el ends here ;;; defuns-ido.el ends here

View file

@ -2,7 +2,7 @@
;; for ../core-project.el ;; for ../core-project.el
;;;###autoload ;;;###autoload
(defun narf/neotree () (defun doom/neotree ()
"Toggle the neotree window" "Toggle the neotree window"
(interactive) (interactive)
(let ((in-neotree (and (neo-global--window-exists-p) (let ((in-neotree (and (neo-global--window-exists-p)
@ -11,14 +11,14 @@
(path buffer-file-name)) (path buffer-file-name))
(if in-neotree (if in-neotree
(neotree-hide) (neotree-hide)
(let ((project-root (narf/project-root))) (let ((project-root (doom/project-root)))
(unless (and (neo-global--window-exists-p) (unless (and (neo-global--window-exists-p)
(f-same? (neo-global--with-window neo-buffer--start-node) project-root)) (f-same? (neo-global--with-window neo-buffer--start-node) project-root))
(neotree-dir project-root)) (neotree-dir project-root))
(neotree-find path project-root))))) (neotree-find path project-root)))))
;;;###autoload ;;;###autoload
(defmacro narf/neotree-save (&rest body) (defmacro doom/neotree-save (&rest body)
`(let ((neo-p (neo-global--window-exists-p))) `(let ((neo-p (neo-global--window-exists-p)))
(when neo-p (neotree-hide)) (when neo-p (neotree-hide))
,@body ,@body
@ -27,30 +27,30 @@
(neotree-show))))) (neotree-show)))))
;;;###autoload ;;;###autoload
(defun narf|neotree-close-on-window-change (&rest _) (defun doom|neotree-close-on-window-change (&rest _)
"Close neotree to prevent ensuing mindow buggery." "Close neotree to prevent ensuing mindow buggery."
(unless (and (neo-global--window-exists-p) (unless (and (neo-global--window-exists-p)
(eq (current-buffer) (neo-global--get-buffer))) (eq (current-buffer) (neo-global--get-buffer)))
(neotree-hide))) (neotree-hide)))
;;;###autoload ;;;###autoload
(defun narf*save-neotree (orig-fun &rest args) (defun doom*save-neotree (orig-fun &rest args)
"Prevents messing up the neotree buffer on window changes" "Prevents messing up the neotree buffer on window changes"
(narf/neotree-save (apply orig-fun args))) (doom/neotree-save (apply orig-fun args)))
;;;###autoload ;;;###autoload
(defun narf*neotree-create-node (orig-fun &rest args) (defun doom*neotree-create-node (orig-fun &rest args)
"Don't ask for confirmation when creating files" "Don't ask for confirmation when creating files"
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t))) (cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t)))
(apply orig-fun args))) (apply orig-fun args)))
;;;###autoload ;;;###autoload
(defun narf*neotree-shorten-pwd (node) (defun doom*neotree-shorten-pwd (node)
"Shorter pwd in neotree" "Shorter pwd in neotree"
(list (concat "" (projectile-project-name)))) (list (concat "" (projectile-project-name))))
;;;###autoload ;;;###autoload
(defun narf*neo-theme (name) (defun doom*neo-theme (name)
"Custom hybrid ascii theme with leading whitespace." "Custom hybrid ascii theme with leading whitespace."
(let ((n-insert-symbol (lambda (n) (let ((n-insert-symbol (lambda (n)
(neo-buffer--insert-with-face (neo-buffer--insert-with-face

View file

@ -1,41 +1,41 @@
;;; defuns-nlinum.el ;;; defuns-nlinum.el
;;;###autoload ;;;###autoload
(defun narf/nlinum-toggle () (defun doom/nlinum-toggle ()
(interactive) (interactive)
(if (bound-and-true-p nlinum-mode) (if (bound-and-true-p nlinum-mode)
(narf|nlinum-disable) (doom|nlinum-disable)
(narf|nlinum-enable))) (doom|nlinum-enable)))
;;;###autoload ;;;###autoload
(defun narf|nlinum-enable () (defun doom|nlinum-enable ()
(nlinum-mode +1) (nlinum-mode +1)
(add-hook 'post-command-hook 'narf|nlinum-hl-line nil t) (add-hook 'post-command-hook 'doom|nlinum-hl-line nil t)
(narf|nlinum-unhl-line)) (doom|nlinum-unhl-line))
;;;###autoload ;;;###autoload
(defun narf|nlinum-disable () (defun doom|nlinum-disable ()
(nlinum-mode -1) (nlinum-mode -1)
(remove-hook 'post-command-hook 'narf|nlinum-hl-line t) (remove-hook 'post-command-hook 'doom|nlinum-hl-line t)
(narf|nlinum-unhl-line)) (doom|nlinum-unhl-line))
;;;###autoload ;;;###autoload
(defun narf|nlinum-unhl-line () (defun doom|nlinum-unhl-line ()
"Unhighlight line number" "Unhighlight line number"
(when narf--hl-nlinum-overlay (when doom--hl-nlinum-overlay
(let* ((disp (get-text-property (let* ((disp (get-text-property
0 'display (overlay-get narf--hl-nlinum-overlay 'before-string))) 0 'display (overlay-get doom--hl-nlinum-overlay 'before-string)))
(str (nth 1 disp))) (str (nth 1 disp)))
(put-text-property 0 (length str) 'face 'linum str) (put-text-property 0 (length str) 'face 'linum str)
(setq narf--hl-nlinum-overlay nil (setq doom--hl-nlinum-overlay nil
narf--hl-nlinum-line nil) doom--hl-nlinum-line nil)
disp))) disp)))
;;;###autoload ;;;###autoload
(defun narf|nlinum-hl-line (&optional line) (defun doom|nlinum-hl-line (&optional line)
"Highlight line number" "Highlight line number"
(let ((line-no (or line (string-to-number (format-mode-line "%l"))))) (let ((line-no (or line (string-to-number (format-mode-line "%l")))))
(if (and nlinum-mode (not (eq line-no narf--hl-nlinum-line))) (if (and nlinum-mode (not (eq line-no doom--hl-nlinum-line)))
(let* ((pbol (if line (let* ((pbol (if line
(save-excursion (goto-char 1) (save-excursion (goto-char 1)
(forward-line line-no) (forward-line line-no)
@ -49,11 +49,11 @@
(jit-lock-fontify-now pbol peol) (jit-lock-fontify-now pbol peol)
(let ((ov (--first (overlay-get it 'nlinum) (overlays-in pbol peol)))) (let ((ov (--first (overlay-get it 'nlinum) (overlays-in pbol peol))))
(when ov (when ov
(narf|nlinum-unhl-line) (doom|nlinum-unhl-line)
(let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string))))) (let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string)))))
(put-text-property 0 (length str) 'face 'linum-highlight-face str) (put-text-property 0 (length str) 'face 'linum-highlight-face str)
(setq narf--hl-nlinum-overlay ov (setq doom--hl-nlinum-overlay ov
narf--hl-nlinum-line line-no)))))))) doom--hl-nlinum-line line-no))))))))
(provide 'defuns-nlinum) (provide 'defuns-nlinum)
;;; defuns-nlinum.el ends here ;;; defuns-nlinum.el ends here

View file

@ -1,45 +1,45 @@
;;; defuns-popups.el ;;; defuns-popups.el
;;;###autoload ;;;###autoload
(defun narf/popup-remove (window) (defun doom/popup-remove (window)
(setq narf-popup-windows (delete window narf-popup-windows))) (setq doom-popup-windows (delete window doom-popup-windows)))
;;;###autoload ;;;###autoload
(defun narf/popup-p (&optional window) (defun doom/popup-p (&optional window)
"Whether WINDOW is a shackle popup window or not." "Whether WINDOW is a shackle popup window or not."
(and narf-popup-windows (and doom-popup-windows
(-any? (lambda (w) (-any? (lambda (w)
(if (window-live-p w) t (narf/popup-remove w) nil)) (if (window-live-p w) t (doom/popup-remove w) nil))
narf-popup-windows) doom-popup-windows)
(if window (if window
(-any? (lambda (w) (eq window w)) narf-popup-windows) (-any? (lambda (w) (eq window w)) doom-popup-windows)
t))) t)))
;;;###autoload ;;;###autoload
(defmacro narf/popup-save (&rest body) (defmacro doom/popup-save (&rest body)
`(let ((popup-p (narf/popup-p))) `(let ((popup-p (doom/popup-p)))
(when popup-p (narf/popup-close-all t)) (when popup-p (doom/popup-close-all t))
,@body ,@body
(when popup-p (when popup-p
(save-selected-window (save-selected-window
(narf/popup-last-buffer))))) (doom/popup-last-buffer)))))
;;;###autoload ;;;###autoload
(defun narf/popup-buffer (buffer &optional plist) (defun doom/popup-buffer (buffer &optional plist)
"Display BUFFER in a shackle popup." "Display BUFFER in a shackle popup."
(let ((buffer-name (if (stringp buffer) buffer (buffer-name buffer)))) (let ((buffer-name (if (stringp buffer) buffer (buffer-name buffer))))
(shackle-display-buffer (get-buffer-create buffer-name) (shackle-display-buffer (get-buffer-create buffer-name)
nil (or plist (shackle-match buffer-name))))) nil (or plist (shackle-match buffer-name)))))
;;;###autoload ;;;###autoload
(defun narf/popup-close (&optional window dont-kill dont-close-all) (defun doom/popup-close (&optional window dont-kill dont-close-all)
"Find and close the currently active popup (if available)." "Find and close the currently active popup (if available)."
(interactive) (interactive)
(when (not window) (when (not window)
(if (narf/popup-p (selected-window)) (if (doom/popup-p (selected-window))
(setq window (selected-window)) (setq window (selected-window))
(unless dont-close-all (unless dont-close-all
(narf/popup-close-all dont-kill)))) (doom/popup-close-all dont-kill))))
(when (and window (window-live-p window)) (when (and window (window-live-p window))
;; REPL buffer ;; REPL buffer
(cond ((and (derived-mode-p 'comint-mode) (cond ((and (derived-mode-p 'comint-mode)
@ -49,59 +49,59 @@
((eq major-mode 'messages-buffer-mode) ((eq major-mode 'messages-buffer-mode)
(bury-buffer) (bury-buffer)
(setq dont-kill t))) (setq dont-kill t)))
(narf/popup-remove window) (doom/popup-remove window)
(unless dont-kill (unless dont-kill
(let ((kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))) (let ((kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions)))
(kill-buffer (window-buffer window)))) (kill-buffer (window-buffer window))))
(delete-window window))) (delete-window window)))
;;;###autoload ;;;###autoload
(defun narf/popup-close-all (&optional dont-kill-buffers) (defun doom/popup-close-all (&optional dont-kill-buffers)
"Closes all popup windows (and kills the buffers if DONT-KILL-BUFFERS is non-nil)" "Closes all popup windows (and kills the buffers if DONT-KILL-BUFFERS is non-nil)"
(interactive) (interactive)
(mapc (lambda (w) (narf/popup-close w dont-kill-buffers)) (mapc (lambda (w) (doom/popup-close w dont-kill-buffers))
narf-popup-windows) doom-popup-windows)
(setq narf-popup-windows nil)) (setq doom-popup-windows nil))
;;;###autoload ;;;###autoload
(defun narf/popup-toggle () (defun doom/popup-toggle ()
"Toggles the popup window, reopening the last popup (if available)." "Toggles the popup window, reopening the last popup (if available)."
(interactive) (interactive)
(if (narf/popup-p) (if (doom/popup-p)
(narf/popup-close t) (doom/popup-close t)
(narf/popup-last-buffer))) (doom/popup-last-buffer)))
;;;###autoload ;;;###autoload
(defun narf/popup-last-buffer () (defun doom/popup-last-buffer ()
"Pop up the last popup buffer." "Pop up the last popup buffer."
(interactive) (interactive)
(unless shackle-last-buffer (unless shackle-last-buffer
(error "No popup to restore")) (error "No popup to restore"))
(narf/popup-buffer shackle-last-buffer)) (doom/popup-buffer shackle-last-buffer))
;;;###autoload ;;;###autoload
(defun narf/popup-messages () (defun doom/popup-messages ()
"Pop up the *Messages* buffer." "Pop up the *Messages* buffer."
(interactive) (interactive)
(narf/popup-buffer "*Messages*") (doom/popup-buffer "*Messages*")
(with-current-buffer "*Messages*" (with-current-buffer "*Messages*"
(narf|hide-mode-line) (doom|hide-mode-line)
(goto-char (point-max)))) (goto-char (point-max))))
;;;###autoload ;;;###autoload
(defun narf|popup-init () (defun doom|popup-init ()
(add-to-list 'narf-popup-windows (get-buffer-window)) (add-to-list 'doom-popup-windows (get-buffer-window))
(local-set-key [escape escape] 'narf/popup-close) (local-set-key [escape escape] 'doom/popup-close)
(when (or (bound-and-true-p repl-toggle-mode) (when (or (bound-and-true-p repl-toggle-mode)
(derived-mode-p 'tabulated-list-mode) (derived-mode-p 'tabulated-list-mode)
(memq major-mode '(messages-buffer-mode flycheck-error-list-mode-hook esup-mode))) (memq major-mode '(messages-buffer-mode flycheck-error-list-mode-hook esup-mode)))
(let ((map evil-normal-state-local-map)) (let ((map evil-normal-state-local-map))
(define-key map [escape] 'narf/popup-close) (define-key map [escape] 'doom/popup-close)
(define-key map (kbd "ESC") 'narf/popup-close)))) (define-key map (kbd "ESC") 'doom/popup-close))))
(defvar shackle-popup-hook '() "Hook run whenever a popup is opened.") (defvar shackle-popup-hook '() "Hook run whenever a popup is opened.")
;;;###autoload ;;;###autoload
(defun narf|run-popup-hooks (&rest _) (defun doom|run-popup-hooks (&rest _)
(with-current-buffer shackle-last-buffer (with-current-buffer shackle-last-buffer
(run-hooks 'shackle-popup-hook))) (run-hooks 'shackle-popup-hook)))

View file

@ -1,16 +1,16 @@
;;; defuns-project.el ;;; defuns-project.el
;;;###autoload ;;;###autoload
(defun narf/project-root (&optional strict-p) (defun doom/project-root (&optional strict-p)
"Get the path to the root of your project. Uses `narf-project-root-files' to "Get the path to the root of your project. Uses `doom-project-root-files' to
determine if a directory is a project." determine if a directory is a project."
(let (projectile-require-project-root strict-p) (let (projectile-require-project-root strict-p)
(projectile-project-root))) (projectile-project-root)))
;;;###autoload ;;;###autoload
(defun narf/project-has-files (files &optional root) (defun doom/project-has-files (files &optional root)
"Return non-nil if FILES exist in the project root." "Return non-nil if FILES exist in the project root."
(let ((root (or root (narf/project-root))) (let ((root (or root (doom/project-root)))
(files (if (listp files) files (list files))) (files (if (listp files) files (list files)))
(found-p (if files t))) (found-p (if files t)))
(while (and found-p files) (while (and found-p files)
@ -21,7 +21,10 @@ determine if a directory is a project."
found-p)) found-p))
;;;###autoload ;;;###autoload
(defalias 'narf/project-p 'projectile-project-p) (defalias 'doom/project-p 'projectile-project-p)
;;;###autoload
(defalias 'doom/project-name 'projectile-project-name)
(provide 'defuns-project) (provide 'defuns-project)
;;; defuns-project.el ends here ;;; defuns-project.el ends here

View file

@ -2,25 +2,25 @@
;;;; Code building ;;;;;;;;;;;;;;;;;;;;;; ;;;; Code building ;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload ;;;###autoload
(defvar narf--build-command '("make %s" . "Makefile")) (defvar doom--build-command '("make %s" . "Makefile"))
(make-variable-buffer-local 'narf--build-command) (make-variable-buffer-local 'doom--build-command)
;;;###autoload ;;;###autoload
(defun narf/set-build-command (command &optional file) (defun doom/set-build-command (command &optional file)
(when (or (null file) (when (or (null file)
(narf/project-has-files file)) (doom/project-has-files file))
(setq narf--build-command `(,command . ,file)))) (setq doom--build-command `(,command . ,file))))
;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t) ;;;###autoload (autoload 'doom:build "defuns-quickrun" nil t)
(evil-define-command narf:build (arg) (evil-define-command doom:build (arg)
"Call a build command in the current directory. If ARG is nil this function calls "Call a build command in the current directory. If ARG is nil this function calls
`recompile', otherwise it calls `compile' passing ARG as build command." `recompile', otherwise it calls `compile' passing ARG as build command."
(interactive "<sh>") (interactive "<sh>")
(when (null narf--build-command) (when (null doom--build-command)
(user-error "No build command was set")) (user-error "No build command was set"))
(let ((build-file (cdr narf--build-command)) (let ((build-file (cdr doom--build-command))
(build-cmd (car narf--build-command)) (build-cmd (car doom--build-command))
(project-dir (narf/project-root))) (project-dir (doom/project-root)))
(if (or (null build-file) (f-exists? (f-expand build-file project-dir))) (if (or (null build-file) (f-exists? (f-expand build-file project-dir)))
(if (or (symbolp build-cmd) (functionp build-cmd)) (if (or (symbolp build-cmd) (functionp build-cmd))
(if (commandp build-cmd) (if (commandp build-cmd)
@ -31,17 +31,17 @@
(error "Could not build!")))) (error "Could not build!"))))
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;; ;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t) ;;;###autoload (autoload 'doom:eval-buffer "defuns-quickrun" nil t)
(evil-define-command narf:eval-buffer () (evil-define-command doom:eval-buffer ()
"Evaluate the whole buffer." "Evaluate the whole buffer."
:move-point nil :repeat nil :move-point nil :repeat nil
(interactive) (interactive)
(cond ((eq major-mode 'emacs-lisp-mode) (cond ((eq major-mode 'emacs-lisp-mode)
(narf:eval-region (point-min) (point-max))) (doom:eval-region (point-min) (point-max)))
(t (quickrun)))) (t (quickrun))))
;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t) ;;;###autoload (autoload 'doom:eval-region "defuns-quickrun" nil t)
(evil-define-operator narf:eval-region (beg end) (evil-define-operator doom:eval-region (beg end)
"Evaluate a region and, if large enough, prints its output to a popup buffer (if an "Evaluate a region and, if large enough, prints its output to a popup buffer (if an
elisp buffer). Otherwise forward the region to Quickrun." elisp buffer). Otherwise forward the region to Quickrun."
:move-point nil :repeat nil :move-point nil :repeat nil
@ -62,11 +62,11 @@ elisp buffer). Otherwise forward the region to Quickrun."
(insert out) (insert out)
(read-only-mode 1) (read-only-mode 1)
(goto-char (point-min)) (goto-char (point-min))
(narf/popup-buffer (current-buffer)))))) (doom/popup-buffer (current-buffer))))))
(t (quickrun-region beg end)))) (t (quickrun-region beg end))))
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t) ;;;###autoload (autoload 'doom:eval-region-and-replace "defuns-quickrun" nil t)
(evil-define-operator narf:eval-region-and-replace (beg end) (evil-define-operator doom:eval-region-and-replace (beg end)
(interactive "<r>") (interactive "<r>")
(cond ((eq major-mode 'emacs-lisp-mode) (cond ((eq major-mode 'emacs-lisp-mode)
(kill-region beg end) (kill-region beg end)

View file

@ -1,36 +1,35 @@
;;; defuns-repl.el ;;; defuns-repl.el
;;;###autoload (autoload 'narf:repl "defuns-repl" nil t) ;;;###autoload (autoload 'doom:repl "defuns-repl" nil t)
(evil-define-command narf:repl (&optional bang command) (evil-define-command doom:repl (&optional bang command)
:repeat nil :repeat nil
(interactive "<!><a>") (interactive "<!><a>")
(if (and narf--repl-buffer (buffer-live-p narf--repl-buffer)) (if (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
(narf/popup-buffer narf--repl-buffer) (doom/popup-buffer doom--repl-buffer)
(rtog/toggle-repl (if (use-region-p) 4)) (rtog/toggle-repl (if (use-region-p) 4))
(setq narf--repl-buffer (current-buffer)) (setq doom--repl-buffer (current-buffer))
(when command (when command
(with-current-buffer narf--repl-buffer (with-current-buffer doom--repl-buffer
(insert command) (insert command)
(unless bang (comint-send-input)))))) (unless bang (comint-send-input))))))
;;;###autoload (autoload 'narf:repl-eval "defuns-repl" nil t) ;;;###autoload (autoload 'doom:repl-eval "defuns-repl" nil t)
(evil-define-operator narf:repl-eval (&optional beg end bang) (evil-define-operator doom:repl-eval (&optional beg end bang)
:type inclusive :type inclusive
:repeat nil :repeat nil
(interactive "<r><!>") (interactive "<r><!>")
(let ((region-p (use-region-p)) (let ((region-p (use-region-p))
(selection (s-trim (buffer-substring-no-properties beg end)))) (selection (s-trim (buffer-substring-no-properties beg end))))
(narf:repl bang) (doom:repl bang)
(when (and region-p beg end) (when (and region-p beg end)
(let* ((buf narf--repl-buffer) (let* ((buf doom--repl-buffer)
(win (get-buffer-window buf))) (win (get-buffer-window buf)))
(unless (eq buf (narf/popup-p (get-buffer-window buf))) (unless (eq buf (doom/popup-p (get-buffer-window buf)))
(narf/popup-buffer buf)) (doom/popup-buffer buf))
(when (and narf--repl-buffer (buffer-live-p narf--repl-buffer)) (when (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
(with-current-buffer narf--repl-buffer (with-current-buffer doom--repl-buffer
(goto-char (point-max)) (goto-char (point-max))
(insert selection))))))) (insert selection)))))))
(provide 'defuns-repl) (provide 'defuns-repl)
;;; defuns-repl.el ends here ;;; defuns-repl.el ends here

View file

@ -1,7 +1,7 @@
;;; defuns-smartparens.el ;;; defuns-smartparens.el
;;;###autoload ;;;###autoload
(defun narf/sp-insert-yasnippet (id action context) (defun doom/sp-insert-yasnippet (id action context)
(forward-char -1) (forward-char -1)
(if (sp-point-after-bol-p id action context) (if (sp-point-after-bol-p id action context)
(yas-expand-from-trigger-key) (yas-expand-from-trigger-key)

View file

@ -1,16 +1,16 @@
;;; defuns-spaceline.el ;;; defuns-spaceline.el
;;;###autoload ;;;###autoload
(defun narf|spaceline-env-update () (defun doom|spaceline-env-update ()
(when narf--env-command (when doom--env-command
(let ((default-directory (narf/project-root))) (let ((default-directory (doom/project-root)))
(let ((s (shell-command-to-string narf--env-command))) (let ((s (shell-command-to-string doom--env-command)))
(setq narf--env-version (if (string-match "[ \t\n\r]+\\'" s) (setq doom--env-version (if (string-match "[ \t\n\r]+\\'" s)
(replace-match "" t t s) (replace-match "" t t s)
s)))))) s))))))
;;;###autoload ;;;###autoload
(defun narf/-flycheck-count (state) (defun doom/-flycheck-count (state)
"Return flycheck information for the given error type STATE." "Return flycheck information for the given error type STATE."
(when (flycheck-has-current-errors-p state) (when (flycheck-has-current-errors-p state)
(if (eq 'running flycheck-last-status-change) (if (eq 'running flycheck-last-status-change)

View file

@ -1,10 +1,9 @@
;;; defuns-ui.el ;;; defuns-ui.el
;; for ../core-ui.el
;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t) ;;;###autoload (autoload 'doom:toggle-fullscreen "defuns-ui" nil t)
;;;###autoload (autoload 'narf:set-columns "defuns-ui" nil t) ;;;###autoload (autoload 'doom:set-columns "defuns-ui" nil t)
(after! evil (after! evil
(evil-define-command narf:set-columns (&optional bang columns) (evil-define-command doom:set-columns (&optional bang columns)
"Adjusts visual-fill-column-width on the fly." "Adjusts visual-fill-column-width on the fly."
(interactive "<!><a>") (interactive "<!><a>")
(if (or (= (length columns) 0) bang) (if (or (= (length columns) 0) bang)
@ -19,33 +18,33 @@
(visual-fill-column--adjust-window) (visual-fill-column--adjust-window)
(visual-fill-column-mode 1))) (visual-fill-column-mode 1)))
(evil-define-command narf:toggle-fullscreen () (evil-define-command doom:toggle-fullscreen ()
(interactive) (interactive)
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth)))) (set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth))))
;;;###autoload ;;;###autoload
(defun narf/reset-theme () (defun doom/reset-theme ()
(interactive) (interactive)
(narf/load-theme (or narf-current-theme narf-default-theme))) (doom/load-theme (or doom-current-theme doom-default-theme)))
;;;###autoload ;;;###autoload
(defun narf/load-font (font) (defun doom/load-font (font)
(interactive) (interactive)
(set-frame-font font t) (set-frame-font font t)
(setq narf-current-font font)) (setq doom-current-font font))
;;;###autoload ;;;###autoload
(defun narf/load-theme (theme &optional suppress-font) (defun doom/load-theme (theme &optional suppress-font)
(interactive) (interactive)
(when narf-current-theme (when doom-current-theme
(disable-theme narf-current-theme)) (disable-theme doom-current-theme))
(load-theme theme t) (load-theme theme t)
(unless suppress-font (unless suppress-font
(narf/load-font narf-current-font)) (doom/load-font doom-current-font))
(setq narf-current-theme theme)) (setq doom-current-theme theme))
;;;###autoload ;;;###autoload
(defun narf/show-as (how &optional pred) (defun doom/show-as (how &optional pred)
(let* ((beg (match-beginning 1)) (let* ((beg (match-beginning 1))
(end (match-end 1)) (end (match-end 1))
(ok (or (not pred) (funcall pred beg end)))) (ok (or (not pred) (funcall pred beg end))))
@ -54,16 +53,17 @@
nil)) nil))
;;;###autoload ;;;###autoload
(defun narf/imenu-list-quit () (defun doom/imenu-list-quit ()
(interactive) (interactive)
(quit-window) (quit-window)
(mapc (lambda (b) (with-current-buffer b (mapc (lambda (b) (with-current-buffer b
(when imenu-list-minor-mode (when imenu-list-minor-mode
(imenu-list-minor-mode -1)))) (imenu-list-minor-mode -1))))
(narf/get-visible-buffers (narf/get-real-buffers)))) (doom/get-visible-buffers (doom/get-real-buffers))))
;;;###autoload ;;;###autoload
(defun narf|hide-mode-line (&rest _) (defun doom|hide-mode-line (&rest _)
(set-window-fringes (selected-window) 0 0 nil)
(setq mode-line-format nil)) (setq mode-line-format nil))
(provide 'defuns-ui) (provide 'defuns-ui)

View file

@ -1,18 +1,18 @@
;;; defuns-whitespace.el ;;; defuns-whitespace.el
;;;###autoload ;;;###autoload
(defun narf--point-at-bol-non-blank() (defun doom--point-at-bol-non-blank()
(save-excursion (evil-first-non-blank) (point))) (save-excursion (evil-first-non-blank) (point)))
;;;###autoload ;;;###autoload
(defun narf/surrounded-p () (defun doom/surrounded-p ()
(and (looking-back "[[{(]\\(\s+\\|\n\\)?\\(\s\\|\t\\)*") (and (looking-back "[[{(]\\(\s+\\|\n\\)?\\(\s\\|\t\\)*")
(let* ((whitespace (match-string 1)) (let* ((whitespace (match-string 1))
(match-str (concat whitespace (match-string 2) "[])}]"))) (match-str (concat whitespace (match-string 2) "[])}]")))
(looking-at-p match-str)))) (looking-at-p match-str))))
;;;###autoload ;;;###autoload
(defun narf/backward-kill-to-bol-and-indent () (defun doom/backward-kill-to-bol-and-indent ()
"Kill line to the first non-blank character. If invoked again "Kill line to the first non-blank character. If invoked again
afterwards, kill line to column 1." afterwards, kill line to column 1."
(interactive) (interactive)
@ -22,12 +22,12 @@ afterwards, kill line to column 1."
(indent-according-to-mode)))) (indent-according-to-mode))))
;;;###autoload ;;;###autoload
(defun narf/move-to-bol () (defun doom/move-to-bol ()
"Moves cursor to the first non-blank character on the line. If "Moves cursor to the first non-blank character on the line. If
already there, move it to the true bol." already there, move it to the true bol."
(interactive) (interactive)
(evil-save-goal-column (evil-save-goal-column
(let ((point-at-bol (narf--point-at-bol-non-blank)) (let ((point-at-bol (doom--point-at-bol-non-blank))
(point (point))) (point (point)))
(if (= point-at-bol point) (if (= point-at-bol point)
(evil-move-beginning-of-line) (evil-move-beginning-of-line)
@ -35,20 +35,20 @@ already there, move it to the true bol."
(evil-first-non-blank)))))) (evil-first-non-blank))))))
;;;###autoload ;;;###autoload
(defun narf/move-to-eol () (defun doom/move-to-eol ()
(interactive) (interactive)
(evil-save-goal-column (evil-save-goal-column
(let ((old-point (point))) (let ((old-point (point)))
(when (comment-search-forward (point-at-eol) t) (when (comment-search-forward (point-at-eol) t)
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(skip-syntax-backward " ^<*" (narf--point-at-bol-non-blank)) (skip-syntax-backward " ^<*" (doom--point-at-bol-non-blank))
(if (eq old-point (point)) ; (if (eq old-point (point)) ;
(evil-move-end-of-line)))))) (evil-move-end-of-line))))))
;; Mimic expandtab in vim ;; Mimic expandtab in vim
;;;###autoload ;;;###autoload
(defun narf/backward-delete-whitespace-to-column () (defun doom/backward-delete-whitespace-to-column ()
"Delete back to the previous column of whitespace, or as much "Delete back to the previous column of whitespace, or as much
whitespace as possible, or just one char if that's not possible." whitespace as possible, or just one char if that's not possible."
(interactive) (interactive)
@ -75,7 +75,7 @@ whitespace as possible, or just one char if that's not possible."
(t (backward-delete-char-untabify 1)))) (t (backward-delete-char-untabify 1))))
;;;###autoload ;;;###autoload
(defun narf/dumb-indent (&optional smart) (defun doom/dumb-indent (&optional smart)
"Inserts a tab character (or spaces x tab-width). Checks if the "Inserts a tab character (or spaces x tab-width). Checks if the
auto-complete window is open." auto-complete window is open."
(interactive) (interactive)
@ -86,14 +86,14 @@ auto-complete window is open."
(insert (s-repeat spaces " "))))) (insert (s-repeat spaces " ")))))
;;;###autoload ;;;###autoload
(defun narf/smart-indent () (defun doom/smart-indent ()
(interactive) (interactive)
(save-excursion (save-excursion
(back-to-indentation) (back-to-indentation)
(narf/dumb-indent))) (doom/dumb-indent)))
;;;###autoload ;;;###autoload
(defun narf/dumb-dedent () (defun doom/dumb-dedent ()
(interactive) (interactive)
(if indent-tabs-mode (if indent-tabs-mode
(delete-char -1) (delete-char -1)
@ -105,23 +105,23 @@ auto-complete window is open."
(delete-char (- spaces)))))) (delete-char (- spaces))))))
;;;###autoload ;;;###autoload
(defun narf/inflate-space-maybe () (defun doom/inflate-space-maybe ()
"Checks if point is surrounded by {} [] () delimiters and adds a "Checks if point is surrounded by {} [] () delimiters and adds a
space on either side of the point if so." space on either side of the point if so."
(interactive) (interactive)
(if (narf/surrounded-p) (if (doom/surrounded-p)
(progn (call-interactively 'self-insert-command) (progn (call-interactively 'self-insert-command)
(save-excursion (call-interactively 'self-insert-command))) (save-excursion (call-interactively 'self-insert-command)))
(call-interactively 'self-insert-command))) (call-interactively 'self-insert-command)))
;;;###autoload ;;;###autoload
(defun narf/deflate-space-maybe () (defun doom/deflate-space-maybe ()
"Checks if point is surrounded by {} [] () delimiters, and deletes "Checks if point is surrounded by {} [] () delimiters, and deletes
spaces on either side of the point if so. Resorts to spaces on either side of the point if so. Resorts to
`narf/backward-delete-whitespace-to-column' otherwise." `doom/backward-delete-whitespace-to-column' otherwise."
(interactive) (interactive)
(save-match-data (save-match-data
(if (narf/surrounded-p) (if (doom/surrounded-p)
(let ((whitespace-match (match-string 1))) (let ((whitespace-match (match-string 1)))
(cond ((not whitespace-match) (cond ((not whitespace-match)
(call-interactively 'sp-backward-delete-char)) (call-interactively 'sp-backward-delete-char))
@ -131,10 +131,10 @@ spaces on either side of the point if so. Resorts to
(save-excursion (delete-char 1))) (save-excursion (delete-char 1)))
(t (t
(just-one-space 0)))) (just-one-space 0))))
(narf/backward-delete-whitespace-to-column)))) (doom/backward-delete-whitespace-to-column))))
;;;###autoload ;;;###autoload
(defun narf/newline-and-indent () (defun doom/newline-and-indent ()
(interactive) (interactive)
(cond ((sp-point-in-string) (cond ((sp-point-in-string)
(newline)) (newline))
@ -158,8 +158,8 @@ spaces on either side of the point if so. Resorts to
(newline nil t) (newline nil t)
(indent-according-to-mode)))) (indent-according-to-mode))))
;;;###autoload (autoload 'narf:whitespace-retab "defuns-whitespace" nil t) ;;;###autoload (autoload 'doom:whitespace-retab "defuns-whitespace" nil t)
(evil-define-operator narf:whitespace-retab (beg end) (evil-define-operator doom:whitespace-retab (beg end)
"Akin to vim's retab, this changes all tabs-to-spaces or spaces-to-tabs, "Akin to vim's retab, this changes all tabs-to-spaces or spaces-to-tabs,
depending on `indent-tab-mode'. Untested." depending on `indent-tab-mode'. Untested."
:motion nil :motion nil
@ -173,8 +173,8 @@ spaces on either side of the point if so. Resorts to
(tabify beg end) (tabify beg end)
(untabify beg end))) (untabify beg end)))
;;;###autoload (autoload 'narf:whitespace-align "defuns-whitespace" nil t) ;;;###autoload (autoload 'doom:whitespace-align "defuns-whitespace" nil t)
(evil-define-command narf:whitespace-align (beg end &optional regexp bang) (evil-define-command doom:whitespace-align (beg end &optional regexp bang)
:repeat nil :repeat nil
(interactive "<r><a><!>") (interactive "<r><a><!>")
(when regexp (when regexp

View file

@ -1,19 +1,21 @@
;;; defuns-window.el --- library for acting on windows ;;; defuns-window.el --- library for acting on windows
;;;###autoload ;;;###autoload
(defun narf/evil-window-split () (defun doom/evil-window-split ()
(interactive) (interactive)
(doom/neotree-save
(call-interactively 'evil-window-split) (call-interactively 'evil-window-split)
(evil-window-down 1)) (evil-window-down 1)))
;;;###autoload ;;;###autoload
(defun narf/evil-window-vsplit () (defun doom/evil-window-vsplit ()
(interactive) (interactive)
(doom/neotree-save
(call-interactively 'evil-window-vsplit) (call-interactively 'evil-window-vsplit)
(evil-window-right 1)) (evil-window-right 1)))
;;;###autoload ;;;###autoload
(defun narf/evil-window-move (direction) (defun doom/evil-window-move (direction)
"Move current window to the next window in DIRECTION. If there are no windows "Move current window to the next window in DIRECTION. If there are no windows
there and there is only one window, split in that direction and place this there and there is only one window, split in that direction and place this
window there. If there are no windows and this isn't the only window, use window there. If there are no windows and this isn't the only window, use
@ -23,7 +25,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
(that-window (windmove-find-other-window direction nil this-window)) (that-window (windmove-find-other-window direction nil this-window))
(that-buffer (window-buffer that-window))) (that-buffer (window-buffer that-window)))
(when (or (minibufferp that-buffer) (when (or (minibufferp that-buffer)
(narf/popup-p that-window)) (doom/popup-p that-window))
(setq that-buffer nil that-window nil)) (setq that-buffer nil that-window nil))
(if (not (or that-window (one-window-p t))) (if (not (or that-window (one-window-p t)))
(funcall (case direction (funcall (case direction
@ -37,7 +39,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
((eq direction 'down) 'below) ((eq direction 'down) 'below)
(t direction)))) (t direction))))
(with-selected-window that-window (with-selected-window that-window
(switch-to-buffer "*scratch*")) (switch-to-buffer doom-buffer))
(setq that-buffer (window-buffer that-window))) (setq that-buffer (window-buffer that-window)))
(with-selected-window this-window (with-selected-window this-window
(switch-to-buffer that-buffer)) (switch-to-buffer that-buffer))
@ -46,61 +48,61 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
(select-window that-window)))) (select-window that-window))))
;;;###autoload ;;;###autoload
(defun narf/new-buffer () (defun doom/new-buffer ()
(interactive) (interactive)
(switch-to-buffer (generate-new-buffer "*new*"))) (switch-to-buffer (generate-new-buffer "*new*")))
;;;###autoload ;;;###autoload
(defun narf/new-frame () (defun doom/new-frame ()
(interactive) (interactive)
(let ((nlinum-p (and (featurep 'nlinum) (let ((nlinum-p (and (featurep 'nlinum)
(memq 'nlinum--setup-window window-configuration-change-hook)))) (memq 'nlinum--setup-window window-configuration-change-hook))))
;; Disable nlinum to fix elusive "invalid face linum" bug ;; Disable nlinum to fix elusive "invalid face linum" bug
(remove-hook 'window-configuration-change-hook 'nlinum--setup-window t) (remove-hook 'window-configuration-change-hook 'nlinum--setup-window t)
(let ((frame (new-frame)) (let ((frame (new-frame))
(frame-name (format "*new-%s*" (length narf-wg-frames)))) (frame-name (format "*new-%s*" (length doom-wg-frames))))
(with-selected-frame frame (with-selected-frame frame
(wg-create-workgroup frame-name t) (wg-create-workgroup frame-name t)
(add-to-list 'narf-wg-frames (cons frame frame-name)))) (add-to-list 'doom-wg-frames (cons frame frame-name))))
(when nlinum-p (when nlinum-p
(add-hook 'window-configuration-change-hook 'nlinum--setup-window nil t)))) (add-hook 'window-configuration-change-hook 'nlinum--setup-window nil t))))
;;;###autoload ;;;###autoload
(defun narf/close-frame () (defun doom/close-frame ()
(interactive) (interactive)
(aif (assq (selected-frame) narf-wg-frames) (aif (assq (selected-frame) doom-wg-frames)
(progn (wg-delete-workgroup (wg-get-workgroup (cdr it))) (progn (wg-delete-workgroup (wg-get-workgroup (cdr it)))
(delete-frame (car it))) (delete-frame (car it)))
(delete-frame))) (delete-frame)))
;;;###autoload ;;;###autoload
(defun narf/evil-window-resize (direction &optional count) (defun doom/evil-window-resize (direction &optional count)
(interactive) (interactive)
(let ((count (or count 1)) (let ((count (or count 1))
(next-window (window-in-direction direction))) (next-window (window-in-direction direction)))
(when (or (not next-window) (not (narf/real-buffer-p (window-buffer next-window)))) (when (or (not next-window) (not (doom/real-buffer-p (window-buffer next-window))))
(setq count (- count))) (setq count (- count)))
(cond ((memq direction '(left right)) (cond ((memq direction '(left right))
(evil-window-increase-width count)) (evil-window-increase-width count))
((memq direction '(above below)) ((memq direction '(above below))
(evil-window-increase-height count))))) (evil-window-increase-height count)))))
;;;###autoload (autoload 'narf/evil-window-resize-r "defuns-window" nil t) ;;;###autoload (autoload 'doom/evil-window-resize-r "defuns-window" nil t)
(evil-define-command narf/evil-window-resize-r (&optional count) (evil-define-command doom/evil-window-resize-r (&optional count)
(interactive "<c>") (narf/evil-window-resize 'right count)) (interactive "<c>") (doom/evil-window-resize 'right count))
;;;###autoload (autoload 'narf/evil-window-resize-l "defuns-window" nil t) ;;;###autoload (autoload 'doom/evil-window-resize-l "defuns-window" nil t)
(evil-define-command narf/evil-window-resize-l (&optional count) (evil-define-command doom/evil-window-resize-l (&optional count)
(interactive "<c>") (narf/evil-window-resize 'left count)) (interactive "<c>") (doom/evil-window-resize 'left count))
;;;###autoload (autoload 'narf/evil-window-resize-u "defuns-window" nil t) ;;;###autoload (autoload 'doom/evil-window-resize-u "defuns-window" nil t)
(evil-define-command narf/evil-window-resize-u (&optional count) (evil-define-command doom/evil-window-resize-u (&optional count)
:repeat nil :repeat nil
(interactive "<c>") (narf/evil-window-resize 'above count)) (interactive "<c>") (doom/evil-window-resize 'above count))
;;;###autoload (autoload 'narf/evil-window-resize-d "defuns-window" nil t) ;;;###autoload (autoload 'doom/evil-window-resize-d "defuns-window" nil t)
(evil-define-command narf/evil-window-resize-d (&optional count) (evil-define-command doom/evil-window-resize-d (&optional count)
(interactive "<c>") (narf/evil-window-resize 'below count)) (interactive "<c>") (doom/evil-window-resize 'below count))
;;;###autoload ;;;###autoload
(defun narf/window-reorient () (defun doom/window-reorient ()
"Reorient all windows that are scrolled to the right." "Reorient all windows that are scrolled to the right."
(interactive) (interactive)
(let ((i 0)) (let ((i 0))
@ -109,7 +111,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
(when (> (window-hscroll) 0) (when (> (window-hscroll) 0)
(cl-incf i) (cl-incf i)
(evil-beginning-of-line)))) (evil-beginning-of-line))))
(narf/get-visible-windows)) (doom/get-visible-windows))
(message "Reoriented %s windows" i))) (message "Reoriented %s windows" i)))
(provide 'defuns-window) (provide 'defuns-window)

View file

@ -1,37 +1,37 @@
;;; defuns-workgroup.el ;;; defuns-workgroup.el
;;;###autoload ;;;###autoload
(defun narf|wg-cleanup () (defun doom|wg-cleanup ()
(narf/popup-close-all) (doom/popup-close-all)
(when (and (featurep 'neotree) (neo-global--window-exists-p)) (when (and (featurep 'neotree) (neo-global--window-exists-p))
(neotree-hide))) (neotree-hide)))
;;;###autoload ;;;###autoload
(defun narf/wg-projectile-switch-project () (defun doom/wg-projectile-switch-project ()
(let ((project-root (narf/project-root))) (let ((project-root (doom/project-root)))
(narf:workgroup-new nil (file-name-nondirectory (directory-file-name project-root)) t) (doom:workgroup-new nil (file-name-nondirectory (directory-file-name project-root)) t)
(narf|update-scratch-buffer-cwd project-root) (doom|update-scratch-buffer-cwd project-root)
(when (featurep 'neotree) (when (featurep 'neotree)
(neotree-projectile-action)))) (neotree-projectile-action))))
;;;###autoload (autoload 'narf:save-session "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:save-session "defuns-workgroup" nil t)
(evil-define-command narf:save-session (&optional bang session-name) (evil-define-command doom:save-session (&optional bang session-name)
(interactive "<!><a>") (interactive "<!><a>")
(unless (wg-workgroup-list) (unless (wg-workgroup-list)
(wg-create-workgroup wg-first-wg-name)) (wg-create-workgroup wg-first-wg-name))
(narf|wg-cleanup) (doom|wg-cleanup)
(wg-save-session-as (if session-name (wg-save-session-as (if session-name
(concat wg-workgroup-directory session-name) (concat wg-workgroup-directory session-name)
(if bang (if bang
(concat wg-workgroup-directory (f-filename (narf/project-root))) (concat wg-workgroup-directory (f-filename (doom/project-root)))
wg-session-file)))) wg-session-file))))
;;;###autoload (autoload 'narf:load-session "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:load-session "defuns-workgroup" nil t)
(evil-define-command narf:load-session (&optional bang session-name) (evil-define-command doom:load-session (&optional bang session-name)
(interactive "<!><a>") (interactive "<!><a>")
(let ((session-file (if session-name (let ((session-file (if session-name
(concat wg-workgroup-directory session-name) (concat wg-workgroup-directory session-name)
(let ((sess (concat wg-workgroup-directory (f-filename (narf/project-root))))) (let ((sess (concat wg-workgroup-directory (f-filename (doom/project-root)))))
(if bang (if bang
(when (file-exists-p sess) (when (file-exists-p sess)
sess) sess)
@ -39,16 +39,16 @@
(unless session-file (unless session-file
(user-error "No session found")) (user-error "No session found"))
(wg-open-session session-file)) (wg-open-session session-file))
(narf/workgroup-display t)) (doom/workgroup-display t))
;;;###autoload ;;;###autoload
(defun narf/clear-sessions () (defun doom/clear-sessions ()
"Delete all session files." "Delete all session files."
(interactive) (interactive)
(mapc 'delete-file (f-glob (expand-file-name "*" wg-workgroup-directory)))) (mapc 'delete-file (f-glob (expand-file-name "*" wg-workgroup-directory))))
;;;###autoload (autoload 'narf:workgroup-new "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:workgroup-new "defuns-workgroup" nil t)
(evil-define-command narf:workgroup-new (bang name &optional silent) (evil-define-command doom:workgroup-new (bang name &optional silent)
"Create a new workgroup. If BANG, overwrite any workgroup named NAME." "Create a new workgroup. If BANG, overwrite any workgroup named NAME."
(interactive "<!><a>") (interactive "<!><a>")
(unless name (unless name
@ -58,43 +58,43 @@
(wg-delete-workgroup new-wg) (wg-delete-workgroup new-wg)
(setq new-wg nil)) (setq new-wg nil))
(setq new-wg (or new-wg (wg-make-and-add-workgroup name t))) (setq new-wg (or new-wg (wg-make-and-add-workgroup name t)))
(add-to-list 'narf-wg-names (wg-workgroup-uid new-wg)) (add-to-list 'doom-wg-names (wg-workgroup-uid new-wg))
(wg-switch-to-workgroup new-wg)) (wg-switch-to-workgroup new-wg))
(unless silent (unless silent
(narf--workgroup-display (wg-previous-workgroup t) (doom--workgroup-display (wg-previous-workgroup t)
(format "Created %s" name) (format "Created %s" name)
'success))) 'success)))
;;;###autoload (autoload 'narf:workgroup-rename "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:workgroup-rename "defuns-workgroup" nil t)
(evil-define-command narf:workgroup-rename (bang &optional new-name) (evil-define-command doom:workgroup-rename (bang &optional new-name)
(interactive "<!><a>") (interactive "<!><a>")
(let* ((wg (wg-current-workgroup)) (let* ((wg (wg-current-workgroup))
(wg-uid (wg-workgroup-uid wg)) (wg-uid (wg-workgroup-uid wg))
(old-name (wg-workgroup-name wg))) (old-name (wg-workgroup-name wg)))
(if bang (if bang
(setq narf-wg-names (delete wg-uid narf-wg-names)) (setq doom-wg-names (delete wg-uid doom-wg-names))
(unless new-name (unless new-name
(user-error "You didn't enter in a name")) (user-error "You didn't enter in a name"))
(wg-rename-workgroup new-name wg) (wg-rename-workgroup new-name wg)
(add-to-list 'narf-wg-names wg-uid) (add-to-list 'doom-wg-names wg-uid)
(narf--workgroup-display wg (format "Renamed '%s'->'%s'" old-name new-name) 'success)))) (doom--workgroup-display wg (format "Renamed '%s'->'%s'" old-name new-name) 'success))))
;;;###autoload (autoload 'narf:workgroup-delete "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:workgroup-delete "defuns-workgroup" nil t)
(evil-define-command narf:workgroup-delete (&optional bang name) (evil-define-command doom:workgroup-delete (&optional bang name)
(interactive "<!><a>") (interactive "<!><a>")
(let* ((current-wg (wg-current-workgroup)) (let* ((current-wg (wg-current-workgroup))
(wg-name (or name (wg-workgroup-name current-wg)))) (wg-name (or name (wg-workgroup-name current-wg))))
(when bang (when bang
(setq wg-name (wg-read-workgroup-name))) (setq wg-name (wg-read-workgroup-name)))
(let ((wg (wg-get-workgroup name))) (let ((wg (wg-get-workgroup name)))
(setq narf-wg-names (delete (wg-workgroup-uid wg) narf-wg-names)) (setq doom-wg-names (delete (wg-workgroup-uid wg) doom-wg-names))
(if (eq wg current-wg) (if (eq wg current-wg)
(wg-kill-workgroup) (wg-kill-workgroup)
(wg-delete-workgroup wg)) (wg-delete-workgroup wg))
(narf--workgroup-display nil (format "Deleted %s" wg-name) 'success)))) (doom--workgroup-display nil (format "Deleted %s" wg-name) 'success))))
;;;###autoload ;;;###autoload
(defun narf:kill-other-workgroups () (defun doom:kill-other-workgroups ()
"Kill all other workgroups." "Kill all other workgroups."
(interactive) (interactive)
(let (workgroup (wg-current-workgroup)) (let (workgroup (wg-current-workgroup))
@ -102,7 +102,7 @@
(unless (wg-current-workgroup-p w) (unless (wg-current-workgroup-p w)
(wg-kill-workgroup w))))) (wg-kill-workgroup w)))))
(defun narf--num-to-unicode (num) (defun doom--num-to-unicode (num)
"Return a nice unicode representation of a single-digit number STR." "Return a nice unicode representation of a single-digit number STR."
(cl-case num (cl-case num
(1 "") (1 "")
@ -116,22 +116,22 @@
(9 "") (9 "")
(0 ""))) (0 "")))
(defun narf--workgroup-display (&optional suppress-update message message-face) (defun doom--workgroup-display (&optional suppress-update message message-face)
(message "%s%s" (narf/workgroup-display suppress-update t) (message "%s%s" (doom/workgroup-display suppress-update t)
(propertize message 'face message-face))) (propertize message 'face message-face)))
;;;###autoload ;;;###autoload
(defun narf/workgroup-display (&optional suppress-update return-p message) (defun doom/workgroup-display (&optional suppress-update return-p message)
(interactive) (interactive)
(when (wg-current-session t) (when (wg-current-session t)
(unless (eq suppress-update t) (unless (eq suppress-update t)
(narf/workgroup-update-names (if (wg-workgroup-p suppress-update) suppress-update))) (doom/workgroup-update-names (if (wg-workgroup-p suppress-update) suppress-update)))
(let ((output (wg-display-internal (let ((output (wg-display-internal
(lambda (workgroup index) (lambda (workgroup index)
(if (not workgroup) wg-nowg-string (if (not workgroup) wg-nowg-string
(wg-element-display (wg-element-display
workgroup workgroup
(format " %s %s " (narf--num-to-unicode (1+ index)) (wg-workgroup-name workgroup)) (format " %s %s " (doom--num-to-unicode (1+ index)) (wg-workgroup-name workgroup))
'wg-current-workgroup-p))) 'wg-current-workgroup-p)))
(wg-workgroup-list)))) (wg-workgroup-list))))
(if return-p (if return-p
@ -139,16 +139,16 @@
(message "%s%s" output (or message "")))))) (message "%s%s" output (or message ""))))))
;;;###autoload ;;;###autoload
(defun narf/workgroup-update-names (&optional wg) (defun doom/workgroup-update-names (&optional wg)
(let ((wg (or wg (wg-current-workgroup)))) (let ((wg (or wg (wg-current-workgroup))))
(unless (member (wg-workgroup-uid wg) narf-wg-names) (unless (member (wg-workgroup-uid wg) doom-wg-names)
(ignore-errors (ignore-errors
(let ((old-name (wg-workgroup-name wg)) (let ((old-name (wg-workgroup-name wg))
(new-name (f-filename (narf/project-root)))) (new-name (f-filename (doom/project-root))))
(unless (string= new-name old-name) (unless (string= new-name old-name)
(wg-rename-workgroup new-name wg))))))) (wg-rename-workgroup new-name wg)))))))
(defun narf--switch-to-workgroup (direction &optional count) (defun doom--switch-to-workgroup (direction &optional count)
(interactive "<c>") (interactive "<c>")
(assert (memq direction '(left right))) (assert (memq direction '(left right)))
(condition-case err (condition-case err
@ -156,52 +156,52 @@
(if count (if count
(wg-switch-to-workgroup-at-index (1- count)) (wg-switch-to-workgroup-at-index (1- count))
(funcall (intern (format "wg-switch-to-workgroup-%s" direction)))) (funcall (intern (format "wg-switch-to-workgroup-%s" direction))))
(narf/workgroup-display t)) (doom/workgroup-display t))
(error (narf/workgroup-display t nil (format "Nope! %s" (cadr err)))))) (error (doom/workgroup-display t nil (format "Nope! %s" (cadr err))))))
;;;###autoload (autoload 'narf:switch-to-workgroup-left "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:switch-to-workgroup-left "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-left (count) (evil-define-command doom:switch-to-workgroup-left (count)
(interactive "<c>") (interactive "<c>")
(narf--switch-to-workgroup 'left)) (doom--switch-to-workgroup 'left))
;;;###autoload (autoload 'narf:switch-to-workgroup-right "defuns-workgroup" nil t) ;;;###autoload (autoload 'doom:switch-to-workgroup-right "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-right (count) (evil-define-command doom:switch-to-workgroup-right (count)
(interactive "<c>") (interactive "<c>")
(narf--switch-to-workgroup 'right)) (doom--switch-to-workgroup 'right))
;;;###autoload ;;;###autoload
(defun narf:switch-to-workgroup-at-index (index) (defun doom:switch-to-workgroup-at-index (index)
(interactive) (interactive)
(narf/workgroup-update-names) (doom/workgroup-update-names)
(let ((wg (nth index (wg-workgroup-list-or-error))) (let ((wg (nth index (wg-workgroup-list-or-error)))
msg) msg)
(if wg (if wg
(unless (eq wg (wg-current-workgroup t)) (unless (eq wg (wg-current-workgroup t))
(wg-switch-to-workgroup-at-index index)) (wg-switch-to-workgroup-at-index index))
(setq msg (format "No tab #%s" (1+ index)))) (setq msg (format "No tab #%s" (1+ index))))
(narf/workgroup-display t nil msg))) (doom/workgroup-display t nil msg)))
;;;###autoload ;;;###autoload
(defun narf/undo-window-change () (defun doom/undo-window-change ()
(interactive) (interactive)
(call-interactively (if (wg-current-workgroup t) 'wg-undo-wconfig-change 'winner-undo))) (call-interactively (if (wg-current-workgroup t) 'wg-undo-wconfig-change 'winner-undo)))
;;;###autoload ;;;###autoload
(defun narf/redo-window-change () (defun doom/redo-window-change ()
(interactive) (interactive)
(call-interactively (if (wg-current-workgroup t) 'wg-redo-wconfig-change 'winner-redo))) (call-interactively (if (wg-current-workgroup t) 'wg-redo-wconfig-change 'winner-redo)))
;;;###autoload ;;;###autoload
(defun narf/close-window-or-workgroup () (defun doom/close-window-or-workgroup ()
(interactive) (interactive)
(if (memq (get-buffer-window) narf-popup-windows) (if (memq (get-buffer-window) doom-popup-windows)
(narf/popup-close) (doom/popup-close)
(narf/kill-real-buffer) (doom/kill-real-buffer)
(if (and (one-window-p t) (if (and (one-window-p t)
(> (length (wg-workgroup-list)) 1)) (> (length (wg-workgroup-list)) 1))
(if (string= (wg-workgroup-name (wg-current-workgroup)) wg-first-wg-name) (if (string= (wg-workgroup-name (wg-current-workgroup)) wg-first-wg-name)
(evil-window-delete) (evil-window-delete)
(narf:workgroup-delete)) (doom:workgroup-delete))
(evil-window-delete)))) (evil-window-delete))))
(provide 'defuns-workgroup) (provide 'defuns-workgroup)

View file

@ -2,9 +2,9 @@
;; for ../core-yasnippet.el ;; for ../core-yasnippet.el
;;;###autoload ;;;###autoload
(defun narf|yas-before-expand () (defun doom|yas-before-expand ()
"Strip out the shitespace before a line selection." "Strip out the shitespace before a line selection."
(when (narf/evil-visual-line-state-p) (when (doom/evil-visual-line-state-p)
(setq-local (setq-local
yas-selected-text yas-selected-text
(replace-regexp-in-string (replace-regexp-in-string
@ -13,13 +13,13 @@
(1- (region-end))))))) (1- (region-end)))))))
;;;###autoload ;;;###autoload
(defun narf|yas-after-expand () (defun doom|yas-after-expand ()
"Switch to insert mode when expanding a template via backtab, or go back to "Switch to insert mode when expanding a template via backtab, or go back to
normal mode if there are no fields." normal mode if there are no fields."
(setq yas-selected-text nil)) (setq yas-selected-text nil))
;;;###autoload ;;;###autoload
(defun narf/yas-insert-snippet () (defun doom/yas-insert-snippet ()
"Switch to insert mode when expanding a template via backtab, or go back to "Switch to insert mode when expanding a template via backtab, or go back to
normal mode if there are no fields." normal mode if there are no fields."
(interactive) (interactive)
@ -36,7 +36,7 @@ normal mode if there are no fields."
(unless fields (evil-change-state 'normal)))) (unless fields (evil-change-state 'normal))))
;;;###autoload ;;;###autoload
(defun narf/yas-goto-start-of-field () (defun doom/yas-goto-start-of-field ()
"Go to the beginning of a field." "Go to the beginning of a field."
(interactive) (interactive)
(let* ((snippet (car (yas--snippets-at-point))) (let* ((snippet (car (yas--snippets-at-point)))
@ -46,7 +46,7 @@ normal mode if there are no fields."
(goto-char position)))) (goto-char position))))
;;;###autoload ;;;###autoload
(defun narf/yas-goto-end-of-field () (defun doom/yas-goto-end-of-field ()
(interactive) (interactive)
(let* ((snippet (car (yas--snippets-at-point))) (let* ((snippet (car (yas--snippets-at-point)))
(position (yas--field-end (yas--snippet-active-field snippet)))) (position (yas--field-end (yas--snippet-active-field snippet))))
@ -55,7 +55,7 @@ normal mode if there are no fields."
(goto-char position)))) (goto-char position))))
;;;###autoload ;;;###autoload
(defun narf/yas-backspace (&optional field) (defun doom/yas-backspace (&optional field)
"Prevents Yas from stepping on my toes when I use backspace." "Prevents Yas from stepping on my toes when I use backspace."
(interactive) (interactive)
(let ((field (or field (and yas--active-field-overlay (let ((field (or field (and yas--active-field-overlay
@ -65,7 +65,7 @@ normal mode if there are no fields."
(t (delete-char -1))))) (t (delete-char -1)))))
;;;###autoload ;;;###autoload
(defun narf/yas-delete (&optional field) (defun doom/yas-delete (&optional field)
(interactive) (interactive)
(let ((field (or field (and yas--active-field-overlay (let ((field (or field (and yas--active-field-overlay
(overlay-buffer yas--active-field-overlay) (overlay-buffer yas--active-field-overlay)
@ -79,7 +79,7 @@ normal mode if there are no fields."
(t (delete-char 1))))) (t (delete-char 1)))))
;;;###autoload ;;;###autoload
(defun narf/yas-clear-to-sof (&optional field) (defun doom/yas-clear-to-sof (&optional field)
(interactive) (interactive)
(let* ((field (or field (and yas--active-field-overlay (let* ((field (or field (and yas--active-field-overlay
(overlay-buffer yas--active-field-overlay) (overlay-buffer yas--active-field-overlay)
@ -90,10 +90,11 @@ normal mode if there are no fields."
;; Snippet helpers ;;;;;;;;;;;;;;;;;;;;; ;; Snippet helpers ;;;;;;;;;;;;;;;;;;;;;
;;;###autoload ;;;###autoload
(defun narf/yas-find-file () (defun doom/yas-find-file ()
"Browse through snippets folder" "Browse through snippets folder"
;; FIXME
(interactive) (interactive)
(narf/ido-find-file (car narf-snippet-dirs))) (doom/ido-find-file (car doom-snippet-dirs)))
(provide 'defuns-yasnippet) (provide 'defuns-yasnippet)
;;; nlinum-defuns.el ends here ;;; nlinum-defuns.el ends here

View file

@ -5,7 +5,7 @@
(defmacro def-company-backend! (hooks backends) (defmacro def-company-backend! (hooks backends)
"Register a company backend for a mode." "Register a company backend for a mode."
(let* ((hooks (if (listp hooks) hooks (list hooks))) (let* ((hooks (if (listp hooks) hooks (list hooks)))
(def-name (intern (format "narf--init-company-%s" (def-name (intern (format "doom--init-company-%s"
(mapconcat 'identity (mapcar 'symbol-name hooks) "-")))) (mapconcat 'identity (mapcar 'symbol-name hooks) "-"))))
(quoted (eq (car-safe backends) 'quote))) (quoted (eq (car-safe backends) 'quote)))
`(progn `(progn

View file

@ -7,12 +7,12 @@
(chars (plist-get rest :chars)) (chars (plist-get rest :chars))
(words (plist-get rest :words))) (words (plist-get rest :words)))
(when (or chars words) (when (or chars words)
(let ((fn-name (intern (format "narf--electric-%s" (s-join "-" (mapcar 'symbol-name modes)))))) (let ((fn-name (intern (format "doom--electric-%s" (s-join "-" (mapcar 'symbol-name modes))))))
`(progn `(progn
(defun ,fn-name () (defun ,fn-name ()
(electric-indent-local-mode +1) (electric-indent-local-mode +1)
,(if chars `(setq electric-indent-chars ',chars)) ,(if chars `(setq electric-indent-chars ',chars))
,(if words `(setq narf-electric-indent-words ',words))) ,(if words `(setq doom-electric-indent-words ',words)))
(add-hook! ,modes ',fn-name)))))) (add-hook! ,modes ',fn-name))))))
;;;###autoload ;;;###autoload
@ -23,7 +23,7 @@
(words (plist-get rest :words)) (words (plist-get rest :words))
(patterns (plist-get rest :patterns))) (patterns (plist-get rest :patterns)))
(when (or symbols words patterns) (when (or symbols words patterns)
(let ((fn-name (intern (format "narf--rotate-%s" (s-join "-" (mapcar 'symbol-name modes)))))) (let ((fn-name (intern (format "doom--rotate-%s" (s-join "-" (mapcar 'symbol-name modes))))))
`(progn `(progn
(defun ,fn-name () (defun ,fn-name ()
,(if symbols `(setq-local rotate-text-local-symbols ',symbols)) ,(if symbols `(setq-local rotate-text-local-symbols ',symbols))

View file

@ -4,12 +4,12 @@
(defmacro def-builder! (mode command &optional build-file) (defmacro def-builder! (mode command &optional build-file)
"Register major/minor MODE with build COMMAND. If FILES are provided, do an additional "Register major/minor MODE with build COMMAND. If FILES are provided, do an additional
check to make sure they exist in the project root." check to make sure they exist in the project root."
(let ((fn (intern (format "narf--init-builder-%s" mode)))) (let ((fn (intern (format "doom--init-builder-%s" mode))))
`(progn `(progn
(defun ,fn () (defun ,fn ()
(when (or (null ,build-file) (when (or (null ,build-file)
(narf/project-has-files ,build-file)) (doom/project-has-files ,build-file))
(setq narf--build-command '(,command . ,build-file)))) (setq doom--build-command '(,command . ,build-file))))
(add-hook! ,mode ',fn)))) (add-hook! ,mode ',fn))))
;;;###autoload ;;;###autoload

View file

@ -9,7 +9,7 @@
(mapc (lambda (cmd) (evil-ex-define-cmd (car cmd) (cdr cmd))) (mapc (lambda (cmd) (evil-ex-define-cmd (car cmd) (cdr cmd)))
',commands)) ',commands))
(defun ,cmd-off (&rest _) (defun ,cmd-off (&rest _)
(mapc (lambda (cmd) (narf/evil-ex-undefine-cmd (car cmd))) (mapc (lambda (cmd) (doom/evil-ex-undefine-cmd (car cmd)))
',commands)))) ',commands))))
;; Shortcuts for the evil expression register ;; Shortcuts for the evil expression register

View file

@ -8,7 +8,7 @@
(words (plist-get rest :words)) (words (plist-get rest :words))
(patterns (plist-get rest :patterns)) (patterns (plist-get rest :patterns))
fn-name) fn-name)
(setq fn-name (intern (format "narf--rotate-%s" (setq fn-name (intern (format "doom--rotate-%s"
(s-join "-" (mapcar 'symbol-name modes))))) (s-join "-" (mapcar 'symbol-name modes)))))
`(progn `(progn
(defun ,fn-name () (defun ,fn-name ()

View file

@ -2,16 +2,16 @@
;;;###autoload ;;;###autoload
(defmacro def-version-cmd! (modes command) (defmacro def-version-cmd! (modes command)
"Define a COMMAND for MODE that will set `narf--env-command' when that mode is "Define a COMMAND for MODE that will set `doom--env-command' when that mode is
activated, which should return the version number of the current environment. It is used activated, which should return the version number of the current environment. It is used
by `narf|spaceline-env-update' to display a version number in the modeline. For instance: by `doom|spaceline-env-update' to display a version number in the modeline. For instance:
(def-version-cmd! ruby-mode \"ruby --version | cut -d' ' -f2\") (def-version-cmd! ruby-mode \"ruby --version | cut -d' ' -f2\")
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
first time." first time."
(add-hook! (focus-in find-file) 'narf|spaceline-env-update) (add-hook! (focus-in find-file) 'doom|spaceline-env-update)
`(add-hook! ,modes (setq narf--env-command ,command))) `(add-hook! ,modes (setq doom--env-command ,command)))
(provide 'defuns-spaceline) (provide 'defuns-spaceline)
;;; defuns-spaceline.el ends here ;;; defuns-spaceline.el ends here

View file

@ -1,5 +1,4 @@
;;; macros-yasnippet.el ;;; macros-yasnippet.el
;; for ../core-yasnippet.el
;;;###autoload ;;;###autoload
(defmacro def-yas-mode! (mode) (defmacro def-yas-mode! (mode)

78
init.el
View file

@ -4,62 +4,47 @@
;; URL: https://github.com/hlissner/.emacs.d ;; URL: https://github.com/hlissner/.emacs.d
;; Version: 1.0.1 ;; Version: 1.0.1
;; ;;
;;; Are you pondering what I'm pondering, Pinky? ;; ================= =============== =============== ======== ========
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
;; || . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||
;; ||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||
;; || . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||
;; ||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||
;; || ||_-' || || `-_|| || || ||_-' || || | \ / | `||
;; || `' || || `' || || `' || || | \ / | ||
;; || .===' `===. .==='.`===. .===' /==. | \/ | ||
;; || .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||
;; || .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||
;; || .==' _-' '-__\._-' '-_./__-' `' |. /| | ||
;; ||.==' _-' `' | /==.||
;; ==' _-' \/ `==
;; \ _-' `-_ /
;; `'' ``'
;; ;;
;; ,,, !/:. ;; These demons are not part of GNU Emacs.
;; /::\". !!:::
;; :::::\". ," \:,::
;; ::::::\ ". ,","\::.
;; \:::::":\ "/""v' :'
;; !::::\ ! \ \ __
;; "::::\ \ ! \.&&&&,
;; ," __ ", cd,&&&&&&'
;; \ ". "" / \&&&" _,---
;; "",__\_ / _,:":::::
;; _," ,"" ,-,__,/":,_ ,",":::::::
;; _," ," `'' ::::,",__,,----,,__," /:::::::::
;; ," ,".__, \:::," " /:::":::::/
;; ," ,/"::::::\ >" (_-"/::::::
;; / ,"_!:::::::/, ," _,,--, /::::::/
;; / "" _,"\:::::::' ! ," ){:::::/
;; ! _," \ "", \,"""-,____,"__,,,"_," _/
;; ""t" \\ \ "-,_(*)&&&&(*)," \ ."
;; / \", ! , \ ! - )
;; ! \ "" ! !==!"-,__,'
;; ! \ """_""""`, ", /"_
;; \ , .l /" " ", \! ,_/
;; ), \ / \ \/ ,, /! !
;; ,::\ \," \ ! \/ ! !
;; _,::::" ) )\ ," ___ \ -,_, ,"",! !
;; __,,,::::"" ," ,":::,-:::--:" __\_!__/_""-,_!
;; ,,:::""""""" ,:_,""__...._"""::::"" /:::::" ""::::::
;; (:._ l::::::::::::\\/ "" ""
;; """"--,,,--- """"
;; ;;
;; These mice are not part of GNU Emacs. ;;; License: GPLv3
;;
;;; License: MIT
(load (concat user-emacs-directory "bootstrap.el")) (load (concat user-emacs-directory "bootstrap.el"))
;; ;;
(defconst narf-default-theme 'narf-one) (defconst doom-default-theme 'doom-one)
(defconst narf-terminal-theme 'narf-dark) (defconst doom-terminal-theme 'doom-dark)
(defconst narf-default-font (font-spec :family "Fira Mono" :size 12)) (defconst doom-default-font (font-spec :family "Fira Mono" :size 12))
(defconst narf-leader-prefix "," "Prefix for <leader> bindings") (defconst doom-leader "," "Prefix for <leader> bindings")
(defconst narf-localleader-prefix "\\" "Prefix for <localleader> bindings") (defconst doom-localleader "\\" "Prefix for <localleader> bindings")
;; Load packages (doom `(core ; core/core.el
(narf `(core ; core/core.el
;; OS-specific config
,(cond (IS-MAC 'core-os-osx) ,(cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux) (IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32)) (IS-WINDOWS 'core-os-win32))
;; The heart of NARF ;; The heart of DOOM
core-popup ; taming sudden and inevitable windows
core-ui ; draw me like one of your French editors core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies core-evil ; come to the dark side, we have cookies
core-editor ; filling the editor-shaped hole in the emacs OS core-editor ; filling the editor-shaped hole in the emacs OS
@ -72,6 +57,7 @@
core-helm ; a search engine for life and love core-helm ; a search engine for life and love
core-workgroups ; cure Emacs alzheimers + tab emulation core-workgroups ; cure Emacs alzheimers + tab emulation
core-eval ; run code, run; debug too core-eval ; run code, run; debug too
core-popup ; taming sudden and inevitable windows
;; Environments ;; Environments
module-apple ; Applescript, Swift, Launchbar & other wallet syphons module-apple ; Applescript, Swift, Launchbar & other wallet syphons
@ -108,9 +94,9 @@
extra-tmux ; close the rift between GUI & terminal extra-tmux ; close the rift between GUI & terminal
extra-write ; Emacs as a word processor extra-write ; Emacs as a word processor
;; Customization ;; Personal
my-bindings
my-commands my-commands
my-bindings
)) ))
;;; I think so Brain... ;;

View file

@ -1,6 +1,6 @@
;;; defuns-cc.el --- for module-cc.el ;;; defuns-cc.el --- for module-cc.el
(defun narf--c-lineup-inclass (langelem) (defun doom--c-lineup-inclass (langelem)
(let ((inclass (assoc 'inclass c-syntactic-context))) (let ((inclass (assoc 'inclass c-syntactic-context)))
(save-excursion (save-excursion
(goto-char (c-langelem-pos inclass)) (goto-char (c-langelem-pos inclass))
@ -10,7 +10,7 @@
'++)))) '++))))
;;;###autoload ;;;###autoload
(defun narf/c-lineup-arglist (orig-fun &rest args) (defun doom/c-lineup-arglist (orig-fun &rest args)
"Improve indentation of continued C++11 lambda function opened as argument." "Improve indentation of continued C++11 lambda function opened as argument."
(if (and (eq major-mode 'c++-mode) (if (and (eq major-mode 'c++-mode)
(ignore-errors (ignore-errors
@ -23,7 +23,7 @@
(apply orig-fun args))) (apply orig-fun args)))
;;;###autoload ;;;###autoload
(defun narf|init-c/c++-settings () (defun doom|init-c/c++-settings ()
(when (memq major-mode '(c-mode c++-mode objc-mode)) (when (memq major-mode '(c-mode c++-mode objc-mode))
(c-toggle-electric-state -1) (c-toggle-electric-state -1)
(c-toggle-auto-newline -1) (c-toggle-auto-newline -1)
@ -33,7 +33,7 @@
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level (c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too (c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
(c-set-offset 'access-label '-) (c-set-offset 'access-label '-)
(c-set-offset 'inclass 'narf--c-lineup-inclass) (c-set-offset 'inclass 'doom--c-lineup-inclass)
(c-set-offset 'arglist-intro '+) (c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close '0) (c-set-offset 'arglist-close '0)
;; Certain mappings interfere with smartparens and custom bindings ;; Certain mappings interfere with smartparens and custom bindings
@ -52,11 +52,11 @@
(define-key c++-mode-map "}" nil) (define-key c++-mode-map "}" nil)
;; FIXME: fix smartparens ;; FIXME: fix smartparens
;; (define-key c++-mode-map ">" nil) ;; (define-key c++-mode-map ">" nil)
(map! :map (c-mode-base-map c++-mode-map) :i ">" 'narf/autoclose->-maybe) (map! :map (c-mode-base-map c++-mode-map) :i ">" 'doom/autoclose->-maybe)
(define-key c++-mode-map "<" nil))) (define-key c++-mode-map "<" nil)))
;;;###autoload ;;;###autoload
(defun narf/autoclose->-maybe () (defun doom/autoclose->-maybe ()
"For some reason smartparens won't autoskip >'s, this hack does." "For some reason smartparens won't autoskip >'s, this hack does."
(interactive) (interactive)
(if (save-excursion (if (save-excursion
@ -65,22 +65,22 @@
(forward-char) (forward-char)
(call-interactively 'self-insert-command))) (call-interactively 'self-insert-command)))
(defun narf--copy-face (new-face face) (defun doom--copy-face (new-face face)
"Define NEW-FACE from existing FACE." "Define NEW-FACE from existing FACE."
(copy-face face new-face) (copy-face face new-face)
(eval `(defvar ,new-face nil)) (eval `(defvar ,new-face nil))
(set new-face new-face)) (set new-face new-face))
;;;###autoload ;;;###autoload
(defun narf|init-c++-C11-highlights () (defun doom|init-c++-C11-highlights ()
;; C++11 syntax support (until cc-mode is updated) ;; C++11 syntax support (until cc-mode is updated)
(require 'font-lock) (require 'font-lock)
;; labels, case, public, private, protected, namespace-tags ;; labels, case, public, private, protected, namespace-tags
(narf--copy-face 'font-lock-label-face 'font-lock-keyword-face) (doom--copy-face 'font-lock-label-face 'font-lock-keyword-face)
;; comment markups such as Javadoc-tags ;; comment markups such as Javadoc-tags
(narf--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face) (doom--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
;; comment markups ;; comment markups
(narf--copy-face 'font-lock-doc-string-face 'font-lock-comment-face) (doom--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
(setq font-lock-maximum-decoration t) (setq font-lock-maximum-decoration t)
;; We could place some regexes into `c-mode-common-hook', but ;; We could place some regexes into `c-mode-common-hook', but
@ -119,7 +119,7 @@
) t)) ) t))
;;;###autoload ;;;###autoload
(defun narf/append-semicolon () (defun doom/append-semicolon ()
"Append a semicolon to the end of this (or each selected) non-empty line." "Append a semicolon to the end of this (or each selected) non-empty line."
(interactive) (interactive)
(let ((beg (if (evil-visual-state-p) evil-visual-beginning (line-beginning-position))) (let ((beg (if (evil-visual-state-p) evil-visual-beginning (line-beginning-position)))
@ -137,12 +137,12 @@
(evil-normal-state)))) (evil-normal-state))))
;;;###autoload ;;;###autoload
(defun narf/sp-point-is-template-p (id action context) (defun doom/sp-point-is-template-p (id action context)
(and (sp-in-code-p id action context) (and (sp-in-code-p id action context)
(sp-point-after-word-p id action context))) (sp-point-after-word-p id action context)))
;;;###autoload ;;;###autoload
(defun narf/sp-point-after-include-p (id action context) (defun doom/sp-point-after-include-p (id action context)
(and (sp-in-code-p id action context) (and (sp-in-code-p id action context)
(save-excursion (save-excursion
(goto-char (line-beginning-position)) (goto-char (line-beginning-position))

View file

@ -1,7 +1,7 @@
;;; defuns-scss.el ;;; defuns-scss.el
;;;###autoload ;;;###autoload
(defun narf/css-toggle-inline-or-block () (defun doom/css-toggle-inline-or-block ()
"Toggles between a SCSS multiline block and one-line block." "Toggles between a SCSS multiline block and one-line block."
(interactive) (interactive)
(save-excursion (save-excursion
@ -28,10 +28,10 @@
(just-one-space))))) (just-one-space)))))
;;;###autoload ;;;###autoload
(defalias 'narf/sass-build 'narf/scss-build) (defalias 'doom/sass-build 'doom/scss-build)
;;;###autoload ;;;###autoload
(defun narf/scss-build () (defun doom/scss-build ()
"Compile all sass/scss files in project" "Compile all sass/scss files in project"
(interactive) (interactive)
(let ((scss-dir (f-slash (or (f-traverse-upwards (lambda (d) (let ((scss-dir (f-slash (or (f-traverse-upwards (lambda (d)

View file

@ -1,9 +1,9 @@
;;; defuns-eshell.el --- ;;; defuns-eshell.el
(defun narf--eshell-in-prompt-p (&optional offset) (defun doom--eshell-in-prompt-p (&optional offset)
(>= (- (point) (or offset 0)) (save-excursion (eshell-bol) (point)))) (>= (- (point) (or offset 0)) (save-excursion (eshell-bol) (point))))
(defun narf--eshell-current-git-branch () (defun doom--eshell-current-git-branch ()
(let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n") (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
when (string-match "^\*" match) when (string-match "^\*" match)
collect match)))) collect match))))
@ -12,48 +12,48 @@
""))) "")))
;;;###autoload ;;;###autoload
(defun narf/eshell-prompt () (defun doom/eshell-prompt ()
(concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt) (concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt)
(propertize (narf--eshell-current-git-branch) 'face 'font-lock-function-name-face) (propertize (doom--eshell-current-git-branch) 'face 'font-lock-function-name-face)
(propertize " $ " 'face 'font-lock-constant-face))) (propertize " $ " 'face 'font-lock-constant-face)))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-append () (defun doom/eshell-evil-append ()
(interactive) (interactive)
(goto-char (point-max)) (goto-char (point-max))
(call-interactively 'evil-append)) (call-interactively 'evil-append))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-append-maybe () (defun doom/eshell-evil-append-maybe ()
(interactive) (interactive)
(if (narf--eshell-in-prompt-p) (if (doom--eshell-in-prompt-p)
(call-interactively 'evil-insert) (call-interactively 'evil-insert)
(narf/eshell-append))) (doom/eshell-append)))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-prepend () (defun doom/eshell-evil-prepend ()
(interactive) (interactive)
(eshell-bol) (eshell-bol)
(call-interactively 'evil-insert)) (call-interactively 'evil-insert))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-prepend-maybe () (defun doom/eshell-evil-prepend-maybe ()
(interactive) (interactive)
(if (narf--eshell-in-prompt-p) (if (doom--eshell-in-prompt-p)
(call-interactively 'evil-insert) (call-interactively 'evil-insert)
(narf/eshell-prepend))) (doom/eshell-prepend)))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-replace-maybe () (defun doom/eshell-evil-replace-maybe ()
(interactive) (interactive)
(if (narf--eshell-in-prompt-p) (if (doom--eshell-in-prompt-p)
(call-interactively 'evil-replace) (call-interactively 'evil-replace)
(user-error "Cannot edit read-only region"))) (user-error "Cannot edit read-only region")))
;;;###autoload ;;;###autoload
(defun narf/eshell-evil-replace-state-maybe () (defun doom/eshell-evil-replace-state-maybe ()
(interactive) (interactive)
(if (narf--eshell-in-prompt-p) (if (doom--eshell-in-prompt-p)
(call-interactively 'evil-replace-state) (call-interactively 'evil-replace-state)
(user-error "Cannot edit read-only region"))) (user-error "Cannot edit read-only region")))

View file

@ -1,18 +1,18 @@
;;; defuns-go.el ;;; defuns-go.el
;; TODO Implement narf:go-get-package ;; TODO Implement doom:go-get-package
(defun narf--go-get-package ()) (defun doom--go-get-package ())
;;;###autoload ;;;###autoload
(defun narf:go-test-run-all () (defun doom:go-test-run-all ()
(interactive) (interactive)
(async-shell-command (format "cd '%s' && go test" (narf/project-root)))) (async-shell-command (format "cd '%s' && go test" (doom/project-root))))
;;;###autoload ;;;###autoload
(defun narf:go-test-run-package () (defun doom:go-test-run-package ()
(interactive) (interactive)
(error "Not yet implemented") (error "Not yet implemented")
(async-shell-command (format "cd '%s' && go test %s" (narf/project-root) (narf--go-get-package)))) (async-shell-command (format "cd '%s' && go test %s" (doom/project-root) (doom--go-get-package))))
(provide 'defuns-go) (provide 'defuns-go)
;;; defuns-go.el ends here ;;; defuns-go.el ends here

View file

@ -1,18 +1,18 @@
;;; defuns-java.el --- ;;; defuns-java.el
;; yasnippet defuns ;; yasnippet defuns
;;;###autoload ;;;###autoload
(defun narf/java-android-mode-is-layout-file () (defun doom/java-android-mode-is-layout-file ()
(and android-mode (and android-mode
(eq major-mode 'nxml-mode) (eq major-mode 'nxml-mode)
(string-equal (file-name-base (directory-file-name default-directory)) "layout"))) (string-equal (file-name-base (directory-file-name default-directory)) "layout")))
;;;###autoload ;;;###autoload
(defun narf/java-android-mode-in-tags (&rest tags) (defun doom/java-android-mode-in-tags (&rest tags)
(-contains? tags (android-mode-tag-name))) (-contains? tags (android-mode-tag-name)))
;;;###autoload ;;;###autoload
(defun narf/java-android-mode-tag-name () (defun doom/java-android-mode-tag-name ()
(save-excursion (save-excursion
(let (beg end) (let (beg end)
(nxml-backward-up-element) (nxml-backward-up-element)
@ -23,13 +23,13 @@
(buffer-substring-no-properties beg end)))) (buffer-substring-no-properties beg end))))
;;;###autoload ;;;###autoload
(defun narf|android-mode-enable-maybe () (defun doom|android-mode-enable-maybe ()
(let ((root (narf/project-root))) (let ((root (doom/project-root)))
(when (or (narf/project-has-files "local.properties" root) (when (or (doom/project-has-files "local.properties" root)
(narf/project-has-files "AndroidManifest.xml" root) (doom/project-has-files "AndroidManifest.xml" root)
(narf/project-has-files "src/main/AndroidManifest.xml" root)) (doom/project-has-files "src/main/AndroidManifest.xml" root))
(android-mode +1) (android-mode +1)
(narf/set-build-command "./gradlew %s" "build.gradle")))) (doom/set-build-command "./gradlew %s" "build.gradle"))))
(provide 'defuns-java) (provide 'defuns-java)
;;; defuns-java.el ends here ;;; defuns-java.el ends here

View file

@ -1,7 +1,7 @@
;;; defuns-julia.el ;;; defuns-julia.el
;;;###autoload ;;;###autoload
(defun narf/julia-repl () (defun doom/julia-repl ()
"Run an inferior instance of `julia' inside Emacs." "Run an inferior instance of `julia' inside Emacs."
(interactive) (interactive)
(let ((buffer (get-buffer-create "*Julia*"))) (let ((buffer (get-buffer-create "*Julia*")))

View file

@ -1,26 +1,26 @@
;;; defuns-lisp.el ;;; defuns-lisp.el
;;;###autoload ;;;###autoload
(defun narf/elisp-find-function-at-pt () (defun doom/elisp-find-function-at-pt ()
(interactive) (interactive)
(let ((func (function-called-at-point))) (let ((func (function-called-at-point)))
(if func (find-function func)))) (if func (find-function func))))
;;;###autoload ;;;###autoload
(defun narf/elisp-find-function-at-pt-other-window () (defun doom/elisp-find-function-at-pt-other-window ()
(interactive) (interactive)
(let ((func (function-called-at-point))) (let ((func (function-called-at-point)))
(if func (find-function-other-window func)))) (if func (find-function-other-window func))))
(defun narf--ert-pre () (defun doom--ert-pre ()
(save-buffer) (save-buffer)
(eval-buffer)) (eval-buffer))
;;;###autoload ;;;###autoload
(defun narf/ert-run-test () (defun doom/ert-run-test ()
(interactive) (interactive)
(let (case-fold-search) (let (case-fold-search)
(narf--ert-pre) (doom--ert-pre)
(aif (thing-at-point 'defun t) (aif (thing-at-point 'defun t)
(if (string-match "(ert-deftest \\([^ ]+\\)" it) (if (string-match "(ert-deftest \\([^ ]+\\)" it)
(ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1))) (ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1)))
@ -28,34 +28,34 @@
(user-error "No test found at point")))) (user-error "No test found at point"))))
;;;###autoload ;;;###autoload
(defun narf/ert-rerun-test () (defun doom/ert-rerun-test ()
(interactive) (interactive)
(let (case-fold-search) (let (case-fold-search)
(narf--ert-pre) (doom--ert-pre)
(aif (car-safe ert--selector-history) (aif (car-safe ert--selector-history)
(ert-run-tests-interactively it) (ert-run-tests-interactively it)
(message "No test found in history, looking for test at point") (message "No test found in history, looking for test at point")
(narf/ert-run-test)))) (doom/ert-run-test))))
;;;###autoload ;;;###autoload
(defun narf/ert-run-all-tests () (defun doom/ert-run-all-tests ()
(interactive) (interactive)
(ert-delete-all-tests) (ert-delete-all-tests)
(narf--ert-pre) (doom--ert-pre)
(ert-run-tests-interactively t)) (ert-run-tests-interactively t))
;;;###autoload ;;;###autoload
(defun narf/elisp-auto-compile () (defun doom/elisp-auto-compile ()
(when (let ((file-name (buffer-file-name))) (when (let ((file-name (buffer-file-name)))
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name))) (and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
(--any? (f-child-of? file-name it) (--any? (f-child-of? file-name it)
(append (list narf-core-dir narf-modules-dir (append (list doom-core-dir doom-modules-dir
narf-core-dir narf-modules-dir doom-core-dir doom-modules-dir
narf-private-dir))))) doom-private-dir)))))
(narf:compile-el))) (doom:compile-el)))
;;;###autoload ;;;###autoload
(defun narf/elisp-inf-ielm () (defun doom/elisp-inf-ielm ()
(ielm) (ielm)
(let ((buf (current-buffer))) (let ((buf (current-buffer)))
(bury-buffer) (bury-buffer)

View file

@ -1,7 +1,7 @@
;;; defuns-lua.el ;;; defuns-lua.el
;;;###autoload ;;;###autoload
(defun narf/inf-lua () (defun doom/inf-lua ()
(interactive) (interactive)
(lua-start-process "lua" "lua") (lua-start-process "lua" "lua")
(pop-to-buffer lua-process-buffer)) (pop-to-buffer lua-process-buffer))

View file

@ -1,11 +1,11 @@
;;; defuns-markdown.el --- for module-markdown.el ;;; defuns-markdown.el
;; Implement strike-through formatting ;; Implement strike-through formatting
(defvar narf--markdown-regex-del (defvar doom--markdown-regex-del
"\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)") "\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
;;;###autoload ;;;###autoload
(defun narf/markdown-insert-del () (defun doom/markdown-insert-del ()
"Surround region in github strike-through delimiters." "Surround region in github strike-through delimiters."
(interactive) (interactive)
(let ((delim "~~")) (let ((delim "~~"))
@ -13,13 +13,12 @@
;; Active region ;; Active region
(let ((bounds (markdown-unwrap-things-in-region (let ((bounds (markdown-unwrap-things-in-region
(region-beginning) (region-end) (region-beginning) (region-end)
narf--markdown-regex-del 2 4))) doom--markdown-regex-del 2 4)))
(markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds))) (markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds)))
;; Bold markup removal, bold word at point, or empty markup insertion ;; Bold markup removal, bold word at point, or empty markup insertion
(if (thing-at-point-looking-at narf--markdown-regex-del) (if (thing-at-point-looking-at doom--markdown-regex-del)
(markdown-unwrap-thing-at-point nil 2 4) (markdown-unwrap-thing-at-point nil 2 4)
(markdown-wrap-or-insert delim delim 'word nil nil))))) (markdown-wrap-or-insert delim delim 'word nil nil)))))
(provide 'defuns-markdown) (provide 'defuns-markdown)
;;; defuns-markdown.el ends here ;;; defuns-markdown.el ends here

View file

@ -1,41 +1,41 @@
;;; defuns-org-notebook.el ;;; defuns-org-notebook.el
;;;###autoload ;;;###autoload
(defun narf/org () (defun doom/org ()
(interactive) (interactive)
(find-file (f-expand "inbox.org" org-directory))) (find-file (f-expand "inbox.org" org-directory)))
;;;###autoload ;;;###autoload
(defun narf/org-notebook-new () (defun doom/org-notebook-new ()
(interactive) (interactive)
(projectile-invalidate-cache nil) (projectile-invalidate-cache nil)
(let* ((default-directory org-directory) (let* ((default-directory org-directory)
(dir (projectile-complete-dir)) (dir (projectile-complete-dir))
(narf-org-quicknote-dir dir)) (doom-org-quicknote-dir dir))
(when dir (when dir
(narf/org-notebook-quick-note)))) (doom/org-notebook-quick-note))))
;;;###autoload ;;;###autoload
(defun narf/org-notebook-quick-note () (defun doom/org-notebook-quick-note ()
(interactive) (interactive)
(let (text) (let (text)
(when (evil-visual-state-p) (when (evil-visual-state-p)
(setq text (buffer-substring-no-properties evil-visual-beginning evil-visual-end))) (setq text (buffer-substring-no-properties evil-visual-beginning evil-visual-end)))
(switch-to-buffer (generate-new-buffer "*quick-note*")) (switch-to-buffer (generate-new-buffer "*quick-note*"))
(setq default-directory narf-org-quicknote-dir) (setq default-directory doom-org-quicknote-dir)
(erase-buffer) (erase-buffer)
(insert text))) (insert text)))
;;;###autoload ;;;###autoload
(defun narf/org-download-dnd (uri action) (defun doom/org-download-dnd (uri action)
(if (eq major-mode 'org-mode) (if (eq major-mode 'org-mode)
(narf:org-attach uri) (doom:org-attach uri)
(let ((dnd-protocol-alist (let ((dnd-protocol-alist
(rassq-delete-all 'narf/org-download-dnd (copy-alist dnd-protocol-alist)))) (rassq-delete-all 'doom/org-download-dnd (copy-alist dnd-protocol-alist))))
(dnd-handle-one-url nil action uri)))) (dnd-handle-one-url nil action uri))))
;;;###autoload (autoload 'narf:org-attach "defuns-org-notebook" nil t) ;;;###autoload (autoload 'doom:org-attach "defuns-org-notebook" nil t)
(evil-define-command narf:org-attach (&optional uri) (evil-define-command doom:org-attach (&optional uri)
(interactive "<a>") (interactive "<a>")
(unless (eq major-mode 'org-mode) (unless (eq major-mode 'org-mode)
(user-error "Not in an org-mode buffer")) (user-error "Not in an org-mode buffer"))
@ -51,22 +51,22 @@
(if (evil-visual-state-p) (if (evil-visual-state-p)
(org-insert-link nil (format "./%s" rel-path) (org-insert-link nil (format "./%s" rel-path)
(concat (buffer-substring-no-properties (region-beginning) (region-end)) (concat (buffer-substring-no-properties (region-beginning) (region-end))
" " (narf/org-attach-icon rel-path))) " " (doom/org-attach-icon rel-path)))
(insert (if image-p (insert (if image-p
(format "[[./%s]]" rel-path) (format "[[./%s]]" rel-path)
(format "%s [[./%s][%s]]" (format "%s [[./%s][%s]]"
(narf/org-attach-icon rel-path) (doom/org-attach-icon rel-path)
rel-path (f-filename rel-path))))) rel-path (f-filename rel-path)))))
(when (string-match-p (regexp-opt '("jpg" "jpeg" "gif" "png")) (f-ext rel-path)) (when (string-match-p (regexp-opt '("jpg" "jpeg" "gif" "png")) (f-ext rel-path))
(org-toggle-inline-images))) (org-toggle-inline-images)))
(let ((attachments (narf-org-attachments))) (let ((attachments (doom-org-attachments)))
(unless attachments (unless attachments
(user-error "No attachments in this file")) (user-error "No attachments in this file"))
(helm :sources (helm-build-sync-source "Attachments" :candidates attachments))))) (helm :sources (helm-build-sync-source "Attachments" :candidates attachments)))))
;;;###autoload ;;;###autoload
(defun narf/org-attach-icon (path) (defun doom/org-attach-icon (path)
(char-to-string (pcase (downcase (f-ext path)) (char-to-string (pcase (downcase (f-ext path))
("jpg" ?) ("jpeg" ?) ("png" ?) ("gif" ?) ("jpg" ?) ("jpeg" ?) ("png" ?) ("gif" ?)
("pdf" ?) ("pdf" ?)
@ -79,7 +79,7 @@
(t ?)))) (t ?))))
;;;###autoload ;;;###autoload
(defun narf/org-attachments () (defun doom/org-attachments ()
"Retrieves a list of all the attachments pertinent to the currect org-mode buffer." "Retrieves a list of all the attachments pertinent to the currect org-mode buffer."
(org-save-outline-visibility nil (org-save-outline-visibility nil
(let ((attachments '()) (let ((attachments '())
@ -100,15 +100,15 @@
(-distinct attachments)))) (-distinct attachments))))
;;;###autoload ;;;###autoload
(defun narf/org-cleanup-attachments () (defun doom/org-cleanup-attachments ()
"Deletes any attachments that are no longer present in the org-mode buffer." "Deletes any attachments that are no longer present in the org-mode buffer."
(let* ((attachments (narf/org-attachments)) (let* ((attachments (doom/org-attachments))
(to-delete (-difference narf-org-attachments-list attachments))) (to-delete (-difference doom-org-attachments-list attachments)))
(mapc (lambda (f) (mapc (lambda (f)
(message "Deleting attachment: %s" f) (message "Deleting attachment: %s" f)
(delete-file f t)) (delete-file f t))
to-delete) to-delete)
(setq narf-org-attachments-list attachments))) (setq doom-org-attachments-list attachments)))
;; ;;
@ -117,10 +117,10 @@
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as ;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp. ;; regexp.
;;;###autoload (autoload 'narf:org-helm-search "defuns-org-notebook" nil t) ;;;###autoload (autoload 'doom:org-helm-search "defuns-org-notebook" nil t)
(evil-define-operator narf:org-helm-search (beg end &optional search bang) (evil-define-operator doom:org-helm-search (beg end &optional search bang)
(interactive "<r><a><!>") (interactive "<r><a><!>")
(narf:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory)) (doom:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory))
(provide 'defuns-org-notebook) (provide 'defuns-org-notebook)
;;; defuns-org-notebook.el ends here ;;; defuns-org-notebook.el ends here

View file

@ -1,25 +1,25 @@
;;; defuns-org.el ;;; defuns-org.el
;;;###autoload ;;;###autoload
(defun narf/org-find-file-in-notes () (defun doom/org-find-file-in-notes ()
(interactive) (interactive)
(in! (f-slash org-directory) (in! (f-slash org-directory)
(helm-projectile-find-file))) (helm-projectile-find-file)))
;;;###autoload ;;;###autoload
(defun narf/org-find-file () (defun doom/org-find-file ()
(interactive) (interactive)
(in! (f-slash org-directory) (in! (f-slash org-directory)
(helm-find-files nil))) (helm-find-files nil)))
;;;###autoload ;;;###autoload
(defun narf/org-find-exported-file () (defun doom/org-find-exported-file ()
(interactive) (interactive)
(in! (f-slash narf-org-export-directory) (in! (f-slash doom-org-export-directory)
(helm-find-files nil))) (helm-find-files nil)))
;;;###autoload ;;;###autoload
(defun narf/org-get-property (name) (defun doom/org-get-property (name)
(interactive) (interactive)
(save-excursion (save-excursion
(goto-char 1) (goto-char 1)
@ -27,7 +27,7 @@
(buffer-substring-no-properties (match-beginning 1) (match-end 1)))) (buffer-substring-no-properties (match-beginning 1) (match-end 1))))
;;;###autoload ;;;###autoload
(defun narf/org-indent () (defun doom/org-indent ()
(interactive) (interactive)
(cond (cond
((and (org-on-heading-p) ((and (org-on-heading-p)
@ -37,7 +37,7 @@
(t (call-interactively 'self-insert-command)))) (t (call-interactively 'self-insert-command))))
;;;###autoload ;;;###autoload
(defun narf/org-dedent () (defun doom/org-dedent ()
(interactive) (interactive)
(cond (cond
((and (org-on-heading-p) ((and (org-on-heading-p)
@ -47,7 +47,7 @@
(t (call-interactively 'self-insert-command)))) (t (call-interactively 'self-insert-command))))
;;;###autoload ;;;###autoload
(defun narf/org-insert-item (direction) (defun doom/org-insert-item (direction)
"Inserts a new heading or item, depending on the context. I use this instead of "Inserts a new heading or item, depending on the context. I use this instead of
`org-insert-item' or `org-insert-heading' because they try to do too much and end up doing `org-insert-item' or `org-insert-heading' because they try to do too much and end up doing
this otherwise simple task wrong (e.g. whitespace in the wrong places)." this otherwise simple task wrong (e.g. whitespace in the wrong places)."
@ -74,7 +74,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
('below ('below
(org-table-insert-row)) (org-table-insert-row))
('above ('above
(narf/org-table-prepend-row-or-shift-up)))) (doom/org-table-prepend-row-or-shift-up))))
(t (t
(let ((level (save-excursion (let ((level (save-excursion
(org-back-to-heading) (org-back-to-heading)
@ -104,7 +104,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
(evil-append-line 1))) (evil-append-line 1)))
;;;###autoload ;;;###autoload
(defun narf/org-toggle-checkbox () (defun doom/org-toggle-checkbox ()
(interactive) (interactive)
(let ((context (org-element-lineage (org-element-context) '(item) t))) (let ((context (org-element-lineage (org-element-context) '(item) t)))
(when context (when context
@ -116,7 +116,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
(insert "[ ] "))))) (insert "[ ] ")))))
;;;###autoload ;;;###autoload
(defun narf/org-dwim-at-point () (defun doom/org-dwim-at-point ()
(interactive) (interactive)
(let* ((scroll-pt (window-start)) (let* ((scroll-pt (window-start))
(context (org-element-context)) (context (org-element-context))
@ -160,14 +160,14 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
((memq type '(link)) ((memq type '(link))
(let ((path (org-element-property :path (org-element-lineage (org-element-context) '(link) t)))) (let ((path (org-element-property :path (org-element-lineage (org-element-context) '(link) t))))
(if (and path (image-type-from-file-name path)) (if (and path (image-type-from-file-name path))
(narf/org-refresh-inline-images) (doom/org-refresh-inline-images)
(org-open-at-point)))) (org-open-at-point))))
(t (narf/org-refresh-inline-images))) (t (doom/org-refresh-inline-images)))
(set-window-start nil scroll-pt))) (set-window-start nil scroll-pt)))
;;;###autoload ;;;###autoload
(defun narf/org-refresh-inline-images () (defun doom/org-refresh-inline-images ()
(interactive) (interactive)
(if (> (length org-inline-image-overlays) 0) (if (> (length org-inline-image-overlays) 0)
(org-remove-inline-images) (org-remove-inline-images)
@ -182,7 +182,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
;; Formatting shortcuts ;; Formatting shortcuts
;;;###autoload ;;;###autoload
(defun narf/org-surround (delim) (defun doom/org-surround (delim)
(if (region-active-p) (if (region-active-p)
(save-excursion (save-excursion
(goto-char (region-beginning)) (goto-char (region-beginning))
@ -193,7 +193,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
(save-excursion (insert delim)))) (save-excursion (insert delim))))
;;;###autoload ;;;###autoload
(defun narf/org-word-count (beg end &optional count-footnotes?) (defun doom/org-word-count (beg end &optional count-footnotes?)
"Report the number of words in the Org mode buffer or selected region. "Report the number of words in the Org mode buffer or selected region.
Ignores: Ignores:
- comments - comments
@ -265,7 +265,7 @@ COUNT-FOOTNOTES? is non-nil."
(if mark-active "region" "buffer"))))) (if mark-active "region" "buffer")))))
;;;###autoload ;;;###autoload
(defun narf/org-remove-link () (defun doom/org-remove-link ()
"Replace an org link by its description or if empty its address" "Replace an org link by its description or if empty its address"
(interactive) (interactive)
(if (org-in-regexp org-bracket-link-regexp 1) (if (org-in-regexp org-bracket-link-regexp 1)
@ -277,52 +277,52 @@ COUNT-FOOTNOTES? is non-nil."
(insert description)))) (insert description))))
;;;###autoload ;;;###autoload
(defun narf/org-table-next-row () (defun doom/org-table-next-row ()
(interactive) (interactive)
(if (org-at-table-p) (org-table-next-row) (org-down-element))) (if (org-at-table-p) (org-table-next-row) (org-down-element)))
;;;###autoload ;;;###autoload
(defun narf/org-table-previous-row () (defun doom/org-table-previous-row ()
(interactive) (interactive)
(if (org-at-table-p) (narf--org-table-previous-row) (org-up-element))) (if (org-at-table-p) (doom--org-table-previous-row) (org-up-element)))
;;;###autoload ;;;###autoload
(defun narf/org-table-next-field () (defun doom/org-table-next-field ()
(interactive) (interactive)
(if (org-at-table-p) (org-table-next-field) (org-end-of-line))) (if (org-at-table-p) (org-table-next-field) (org-end-of-line)))
;;;###autoload ;;;###autoload
(defun narf/org-table-previous-field () (defun doom/org-table-previous-field ()
(interactive) (interactive)
(if (org-at-table-p) (org-table-previous-field) (org-beginning-of-line))) (if (org-at-table-p) (org-table-previous-field) (org-beginning-of-line)))
;;;###autoload ;;;###autoload
(defun narf/org-table-append-field-or-shift-right () (defun doom/org-table-append-field-or-shift-right ()
(interactive) (interactive)
(org-shiftmetaright) (org-shiftmetaright)
(when (org-at-table-p) (org-metaright))) (when (org-at-table-p) (org-metaright)))
;;;###autoload ;;;###autoload
(defun narf/org-table-prepend-field-or-shift-left () (defun doom/org-table-prepend-field-or-shift-left ()
(interactive) (interactive)
(if (org-at-table-p) (if (org-at-table-p)
(org-shiftmetaright) (org-shiftmetaright)
(org-shiftmetaleft))) (org-shiftmetaleft)))
;;;###autoload ;;;###autoload
(defun narf/org-table-append-row-or-shift-down () (defun doom/org-table-append-row-or-shift-down ()
(interactive) (interactive)
(org-shiftmetadown) (org-shiftmetadown)
(when (org-at-table-p) (org-metadown))) (when (org-at-table-p) (org-metadown)))
;;;###autoload ;;;###autoload
(defun narf/org-table-prepend-row-or-shift-up () (defun doom/org-table-prepend-row-or-shift-up ()
(interactive) (interactive)
(if (org-at-table-p) (if (org-at-table-p)
(org-shiftmetadown) (org-shiftmetadown)
(org-shiftmetaup))) (org-shiftmetaup)))
(defun narf--org-table-previous-row () (defun doom--org-table-previous-row ()
"Go to the previous row (same column) in the current table. Before doing so, "Go to the previous row (same column) in the current table. Before doing so,
re-align the table if necessary. (Necessary because org-mode has a re-align the table if necessary. (Necessary because org-mode has a
`org-table-next-row', but not `org-table-previous-row')" `org-table-next-row', but not `org-table-previous-row')"
@ -340,8 +340,8 @@ re-align the table if necessary. (Necessary because org-mode has a
(skip-chars-backward "^|\n\r") (skip-chars-backward "^|\n\r")
(when (org-looking-at-p " ") (forward-char)))) (when (org-looking-at-p " ") (forward-char))))
;;;###autoload (autoload 'narf:org-link "defuns-org" nil t) ;;;###autoload (autoload 'doom:org-link "defuns-org" nil t)
(evil-define-command narf:org-link (link) (evil-define-command doom:org-link (link)
"Add LINK to the org buffer. If a selection is active, link selection to LINK." "Add LINK to the org buffer. If a selection is active, link selection to LINK."
(interactive "<a>") (interactive "<a>")
(unless (eq major-mode 'org-mode) (unless (eq major-mode 'org-mode)
@ -351,7 +351,7 @@ re-align the table if necessary. (Necessary because org-mode has a
(org-insert-link nil link (when (and beg end) (buffer-substring-no-properties beg end))))) (org-insert-link nil link (when (and beg end) (buffer-substring-no-properties beg end)))))
;;;###autoload ;;;###autoload
(defun narf/sp-org-skip-asterisk (ms mb me) (defun doom/sp-org-skip-asterisk (ms mb me)
(or (and (= (line-beginning-position) mb) (or (and (= (line-beginning-position) mb)
(eq 32 (char-after (1+ mb)))) (eq 32 (char-after (1+ mb))))
(and (= (1+ (line-beginning-position)) me) (and (= (1+ (line-beginning-position)) me)

View file

@ -1,14 +1,14 @@
;;; defuns-python.el ;;; defuns-python.el
;;;###autoload ;;;###autoload
(defun narf*anaconda-mode-doc-buffer () (defun doom*anaconda-mode-doc-buffer ()
"Delete the window on escape or C-g." "Delete the window on escape or C-g."
(with-current-buffer (get-buffer "*anaconda-doc*") (with-current-buffer (get-buffer "*anaconda-doc*")
(local-set-key [escape] 'anaconda-nav-quit) (local-set-key [escape] 'anaconda-nav-quit)
(local-set-key [?\C-g] 'anaconda-nav-quit))) (local-set-key [?\C-g] 'anaconda-nav-quit)))
;;;###autoload ;;;###autoload
(defun narf/inf-python () (defun doom/inf-python ()
(run-python python-shell-interpreter t t)) (run-python python-shell-interpreter t t))
(provide 'defuns-python) (provide 'defuns-python)

View file

@ -1,13 +1,13 @@
;;; defuns-regex.el ;;; defuns-regex.el
;;;###autoload ;;;###autoload
(defun narf|reb-cleanup () (defun doom|reb-cleanup ()
(replace-regexp "^[ \n]*" "" nil (point-min) (point-max)) (replace-regexp "^[ \n]*" "" nil (point-min) (point-max))
(text-scale-set 2) (text-scale-set 2)
(goto-char 2)) (goto-char 2))
;;;###autoload (autoload 'narf:regex "defuns-regex" nil t) ;;;###autoload (autoload 'doom:regex "defuns-regex" nil t)
(evil-define-operator narf:regex (beg end type &optional regexstr bang) (evil-define-operator doom:regex (beg end type &optional regexstr bang)
"Either a) converts selected (or entered-in) pcre regex into elisp "Either a) converts selected (or entered-in) pcre regex into elisp
regex, OR b) opens up re-builder." regex, OR b) opens up re-builder."
:move-point nil :move-point nil

View file

@ -1,7 +1,7 @@
;;; defuns-sh.el ;;; defuns-sh.el
(defvar sh-extra-font-lock--keywords (defvar sh-extra-font-lock--keywords
`((narf/sh-extra-font-lock--match-var-in-double-quoted-string `((doom/sh-extra-font-lock--match-var-in-double-quoted-string
(2 font-lock-variable-name-face prepend)) (2 font-lock-variable-name-face prepend))
(,(concat (,(concat
"\\<" "\\<"
@ -10,13 +10,13 @@
(0 'font-lock-builtin-face)))) (0 'font-lock-builtin-face))))
;;;###autoload ;;;###autoload
(defun narf/sh-extra-font-lock--is-in-double-quoted-string () (defun doom/sh-extra-font-lock--is-in-double-quoted-string ()
"Non-nil if point in inside a double-quoted string." "Non-nil if point in inside a double-quoted string."
(let ((state (syntax-ppss))) (let ((state (syntax-ppss)))
(eq (nth 3 state) ?\"))) (eq (nth 3 state) ?\")))
;;;###autoload ;;;###autoload
(defun narf/sh-extra-font-lock--match-var-in-double-quoted-string (limit) (defun doom/sh-extra-font-lock--match-var-in-double-quoted-string (limit)
"Search for variables in double-quoted strings bounded by LIMIT." "Search for variables in double-quoted strings bounded by LIMIT."
(let (res) (let (res)
(while (while
@ -24,11 +24,11 @@
(re-search-forward (re-search-forward
"\\$\\({#?\\)?\\([[:alpha:]_][[:alnum:]_]*\\|[-#?@!]\\)" "\\$\\({#?\\)?\\([[:alpha:]_][[:alnum:]_]*\\|[-#?@!]\\)"
limit t)) limit t))
(not (narf/sh-extra-font-lock--is-in-double-quoted-string)))) (not (doom/sh-extra-font-lock--is-in-double-quoted-string))))
res)) res))
;;;###autoload ;;;###autoload
(defun narf|sh-extra-font-lock-activate () (defun doom|sh-extra-font-lock-activate ()
"Activate sh-extra-font-lock." "Activate sh-extra-font-lock."
(interactive) (interactive)
(font-lock-add-keywords nil sh-extra-font-lock--keywords) (font-lock-add-keywords nil sh-extra-font-lock--keywords)
@ -39,7 +39,7 @@
(font-lock-fontify-buffer))))) (font-lock-fontify-buffer)))))
;;;###autoload ;;;###autoload
(defun narf/inf-shell () (defun doom/inf-shell ()
(let* ((dest-sh (symbol-name sh-shell)) (let* ((dest-sh (symbol-name sh-shell))
(sh-shell-file dest-sh)) (sh-shell-file dest-sh))
(sh-shell-process t) (sh-shell-process t)

View file

@ -1,26 +1,26 @@
;;; defuns-web.el ;;; defuns-web.el
;;;###autoload ;;;###autoload
(defun narf/web-html-email2mailto (beg end) (defun doom/web-html-email2mailto (beg end)
(interactive "r") (interactive "r")
(replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b" (replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b"
"<a href=\"mailto:\\1\">\\1</a>" "<a href=\"mailto:\\1\">\\1</a>"
nil beg end)) nil beg end))
;;;###autoload ;;;###autoload
(defun narf/web-html-url2anchor (beg end) (defun doom/web-html-url2anchor (beg end)
(interactive "r") (interactive "r")
(replace-regexp "\\bhttps?://.+?\\b" (replace-regexp "\\bhttps?://.+?\\b"
"<a href=\"\\1\">\\1</a>" "<a href=\"\\1\">\\1</a>"
nil beg end)) nil beg end))
;;;###autoload ;;;###autoload
(defun narf/web-refresh-browser () (defun doom/web-refresh-browser ()
(interactive) (interactive)
(call-process-shell-command "osascript -e 'tell application \"Google Chrome\" to tell the active tab of its first window to reload' &" nil 0)) (call-process-shell-command "osascript -e 'tell application \"Google Chrome\" to tell the active tab of its first window to reload' &" nil 0))
;;;###autoload (autoload 'narf/html-entities "defuns-web" nil t) ;;;###autoload (autoload 'doom/html-entities "defuns-web" nil t)
(evil-define-operator narf/html-entities (bang beg end) (evil-define-operator doom/html-entities (bang beg end)
"HTML encode/decode the selected region. Based on Xah's replace HTML named entities "HTML encode/decode the selected region. Based on Xah's replace HTML named entities
function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html" function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
(interactive "<!><r>") (interactive "<!><r>")

View file

@ -4,20 +4,20 @@
(defmacro define-org-section! (type directory &optional id-func link-glob) (defmacro define-org-section! (type directory &optional id-func link-glob)
(setq directory (f-slash directory)) (setq directory (f-slash directory))
(let* ((type-str (symbol-name type)) (let* ((type-str (symbol-name type))
(link-sym (intern (format "narf/org-link-%s" type-str))) (link-sym (intern (format "doom/org-link-%s" type-str)))
(dir-var (intern (format "org-directory-%s" type-str)))) (dir-var (intern (format "org-directory-%s" type-str))))
`(progn `(progn
;; Variable containing directory: `org-directory-%s' ;; Variable containing directory: `org-directory-%s'
(defvar ,dir-var ,(expand-file-name directory org-directory)) (defvar ,dir-var ,(expand-file-name directory org-directory))
;; Open helm in directory: `narf/helm-org-%s' ;; Open helm in directory: `doom/helm-org-%s'
(evil-define-command ,(intern (format "narf:org-search-%s" type-str)) () (evil-define-command ,(intern (format "doom:org-search-%s" type-str)) ()
(interactive) (interactive)
(let ((default-directory (concat ,dir-var "/" (format-time-string "%Y") "/"))) (let ((default-directory (concat ,dir-var "/" (format-time-string "%Y") "/")))
(helm-find-files nil))) (helm-find-files nil)))
;; Open helm in directory: `narf/helm-org-%s' ;; Open helm in directory: `doom/helm-org-%s'
(defun ,(intern (format "narf/helm-org-find-file-in-%s" type-str)) () (defun ,(intern (format "doom/helm-org-find-file-in-%s" type-str)) ()
(interactive) (interactive)
(helm-do-ag (f-slash ,dir-var))) (helm-do-ag (f-slash ,dir-var)))

View file

@ -23,7 +23,7 @@
:init-value nil :init-value nil
:lighter " BIG" :lighter " BIG"
:global t :global t
(narf/load-font (if big-mode big-mode-font narf-default-font)) (doom/load-font (if big-mode big-mode-font doom-default-font))
(setq-default powerline-height (setq-default powerline-height
(if big-mode (if big-mode
big-mode-modeline-height big-mode-modeline-height

View file

@ -2,7 +2,7 @@
;; WIP ;; WIP
(defvar narf-ctags-alist (defvar doom-ctags-alist
'((ruby-mode :exec "ripper-tags -R -f %t --emacs") '((ruby-mode :exec "ripper-tags -R -f %t --emacs")
(c++-mode :ext "cpp") (c++-mode :ext "cpp")
(c-mode :ext "c") (c-mode :ext "c")
@ -11,26 +11,26 @@
)) ))
(add-hook 'find-file-hook 'narf|init-tags) (add-hook 'find-file-hook 'doom|init-tags)
(defun narf|init-tags () (defun doom|init-tags ()
(awhen (narf/tags-p) (awhen (doom/tags-p)
(setq tags-table-list (list it)))) (setq tags-table-list (list it))))
;; TODO ;; TODO
;; (defun narf/tags-generate () ;; (defun doom/tags-generate ()
;; (interactive) ;; (interactive)
;; (let ((command (assoc major-mode narf-ctags-alist)) ;; (let ((command (assoc major-mode doom-ctags-alist))
;; (default-directory (narf/project-root))) ;; (default-directory (doom/project-root)))
;; (unless command ;; (unless command
;; (user-error "No tag generator for %s" major-mode)) ;; (user-error "No tag generator for %s" major-mode))
;; (async-shell-command command "*narf:generate-tags*"))) ;; (async-shell-command command "*doom:generate-tags*")))
;;;###autoload ;;;###autoload
(defun narf/find-def () (defun doom/find-def ()
(interactive) (interactive)
(let ((orig-pt (point)) (let ((orig-pt (point))
(orig-file (buffer-file-name))) (orig-file (buffer-file-name)))
(cond ((and (narf/tags-p) (cond ((and (doom/tags-p)
(progn (call-interactively 'helm-etags-select) (progn (call-interactively 'helm-etags-select)
(and (/= orig-pt (point)) (and (/= orig-pt (point))
(f-same? orig-file buffer-file-name))))) (f-same? orig-file buffer-file-name)))))
@ -40,8 +40,8 @@
(t (call-interactively 'evil-goto-definition))))) (t (call-interactively 'evil-goto-definition)))))
;;;###autoload ;;;###autoload
(defun narf/tags-p () (defun doom/tags-p ()
(let ((path (expand-file-name ".tags" (narf/project-root)))) (let ((path (expand-file-name ".tags" (doom/project-root))))
(and (f-exists? path) path))) (and (f-exists? path) path)))
(provide 'extra-tags) (provide 'extra-tags)

View file

@ -24,37 +24,37 @@
:ex-arg shell :ex-arg shell
(list (when (evil-ex-p) (evil-ex-file-arg)))) (list (when (evil-ex-p) (evil-ex-file-arg))))
;;;###autoload (autoload 'narf:tmux-cd "extra-tmux" nil t) ;;;###autoload (autoload 'doom:tmux-cd "extra-tmux" nil t)
(evil-define-command narf:tmux-cd (&optional bang) (evil-define-command doom:tmux-cd (&optional bang)
(interactive "<!>") (interactive "<!>")
(if bang (if bang
(narf/tmux-cd-to-project) (doom/tmux-cd-to-project)
(narf/tmux-cd-to-here))) (doom/tmux-cd-to-here)))
(defvar narf-tmux-last-command nil "The last command sent to tmux") (defvar doom-tmux-last-command nil "The last command sent to tmux")
;;;###autoload (autoload 'narf:tmux "extra-tmux" nil t) ;;;###autoload (autoload 'doom:tmux "extra-tmux" nil t)
(evil-define-operator narf:tmux (&optional command bang) (evil-define-operator doom:tmux (&optional command bang)
"Sends input to tmux. Use `bang' to append to tmux" "Sends input to tmux. Use `bang' to append to tmux"
:type inclusive :type inclusive
(interactive "<term><!>") (interactive "<term><!>")
(unless command (unless command
(setq command narf-tmux-last-command)) (setq command doom-tmux-last-command))
(if (not command) (if (not command)
(os-switch-to-term) (os-switch-to-term)
(tmux command (not bang)) (tmux command (not bang))
(setq narf-tmux-last-command command) (setq doom-tmux-last-command command)
(when (evil-ex-p) (when (evil-ex-p)
(message "[Tmux] %s" command)))) (message "[Tmux] %s" command))))
;;;###autoload ;;;###autoload
(defun narf/tmux-cd-to-here (&optional dir) (defun doom/tmux-cd-to-here (&optional dir)
(interactive) (interactive)
(tmux (format "cd '%s'" (or dir default-directory)))) (tmux (format "cd '%s'" (or dir default-directory))))
;;;###autoload ;;;###autoload
(defun narf/tmux-cd-to-project () (defun doom/tmux-cd-to-project ()
(interactive) (interactive)
(narf/tmux-cd-to-here (narf/project-root))) (doom/tmux-cd-to-here (doom/project-root)))
(provide 'extra-tmux) (provide 'extra-tmux)
;;; extra-tmux.el ends here ;;; extra-tmux.el ends here

View file

@ -8,10 +8,11 @@
;; Write-mode settings ;; Write-mode settings
(defconst write-mode nil) (defconst write-mode nil)
(defconst write-mode-theme 'narf-light) (defconst write-mode-theme 'doom-light)
(defconst write-mode-font (font-spec :family "Hack" :size 12)) (defconst write-mode-font (font-spec :family "Hack" :size 12))
(defconst write-mode--last-mode-line mode-line-format) (defconst write-mode--last-mode-line mode-line-format)
(defconst write-mode--last-theme doom-current-theme)
(defconst write-mode--last-line-spacing line-spacing) (defconst write-mode--last-line-spacing line-spacing)
(spaceline-compile (spaceline-compile
@ -40,8 +41,8 @@ functionality with buffer-local ones, which can be buggy in a minor-mode."
(interactive) (interactive)
(let* ((mode-p write-mode) (let* ((mode-p write-mode)
(on-off (if mode-p -1 +1))) (on-off (if mode-p -1 +1)))
(narf/load-theme (if mode-p 'narf-dark write-mode-theme) t) (doom/load-theme (if mode-p write-mode--last-theme write-mode-theme) t)
(narf/load-font (if mode-p narf-default-font write-mode-font)) (doom/load-font (if mode-p doom-default-font write-mode-font))
(if mode-p (if mode-p
(remove-hook 'org-mode-hook 'write-mode|org-hook) (remove-hook 'org-mode-hook 'write-mode|org-hook)
(add-hook 'org-mode-hook 'write-mode|org-hook)) (add-hook 'org-mode-hook 'write-mode|org-hook))
@ -54,7 +55,7 @@ functionality with buffer-local ones, which can be buggy in a minor-mode."
(unless mode-p (unless mode-p
(setq mode-line-format write-mode--last-mode-line (setq mode-line-format write-mode--last-mode-line
header-line-format nil)))) header-line-format nil))))
(narf/get-buffers-in-modes '(org-mode markdown-mode))) (doom/get-buffers-in-modes '(org-mode markdown-mode)))
(setq write-mode (not mode-p)))) (setq write-mode (not mode-p))))
(when (> emacs-major-version 24) (when (> emacs-major-version 24)

View file

@ -4,8 +4,8 @@
:commands (c-mode c++-mode objc-mode java-mode) :commands (c-mode c++-mode objc-mode java-mode)
:mode ("\\.mm" . objc-mode) :mode ("\\.mm" . objc-mode)
:init :init
(add-hook! c++-mode '(highlight-numbers-mode narf|init-c++-C11-highlights)) (add-hook! c++-mode '(highlight-numbers-mode doom|init-c++-C11-highlights))
(add-hook 'c-initialization-hook 'narf|init-c/c++-settings) (add-hook 'c-initialization-hook 'doom|init-c/c++-settings)
;; C++ header files ;; C++ header files
(push (cons (lambda () (and (f-ext? buffer-file-name "h") (push (cons (lambda () (and (f-ext? buffer-file-name "h")
@ -30,22 +30,22 @@
(setq c-tab-always-indent nil (setq c-tab-always-indent nil
c-electric-flag nil) c-electric-flag nil)
(map! :map c-mode-base-map (:localleader :nv ";" 'narf/append-semicolon)) (map! :map c-mode-base-map (:localleader :nv ";" 'doom/append-semicolon))
(sp-with-modes '(c-mode c++-mode objc-mode java-mode) (sp-with-modes '(c-mode c++-mode objc-mode java-mode)
(sp-local-pair "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p)) (sp-local-pair "<" ">" :when '(doom/sp-point-is-template-p doom/sp-point-after-include-p))
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))) (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
;; Doxygen blocks ;; Doxygen blocks
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC"))) (sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC")))) (sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
;; Improve indentation of inline lambdas in C++11 ;; Improve indentation of inline lambdas in C++11
(advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist)) (advice-add 'c-lineup-arglist :around 'doom/c-lineup-arglist))
(use-package irony (use-package irony
:after cc-mode :after cc-mode
:config :config
(setq irony-server-install-prefix (concat narf-temp-dir "/irony/")) (setq irony-server-install-prefix (concat doom-temp-dir "/irony/"))
(add-hook! c++-mode (add-hook! c++-mode
(make-variable-buffer-local 'irony-additional-clang-options) (make-variable-buffer-local 'irony-additional-clang-options)
(push "-std=c++11" irony-additional-clang-options)) (push "-std=c++11" irony-additional-clang-options))

View file

@ -10,7 +10,7 @@
:commands (omnisharp-mode) :commands (omnisharp-mode)
:preface :preface
(setq omnisharp-auto-complete-want-documentation nil (setq omnisharp-auto-complete-want-documentation nil
omnisharp-server-executable-path (concat narf-ext-dir "/OmniSharp.exe")) omnisharp-server-executable-path (concat doom-ext-dir "/OmniSharp.exe"))
:when (file-exists-p omnisharp-server-executable-path) :when (file-exists-p omnisharp-server-executable-path)
:init (add-hook! csharp-mode '(turn-on-eldoc-mode omnisharp-mode)) :init (add-hook! csharp-mode '(turn-on-eldoc-mode omnisharp-mode))
:config :config

View file

@ -1,7 +1,7 @@
;;; module-css.el ;;; module-css.el
(after! emr (after! emr
(emr-declare-command 'narf/css-toggle-inline-or-block (emr-declare-command 'doom/css-toggle-inline-or-block
:title "toggle inline/block" :title "toggle inline/block"
:modes '(css-mode less-css-mode scss-mode) :modes '(css-mode less-css-mode scss-mode)
:predicate (lambda () (not (use-region-p))))) :predicate (lambda () (not (use-region-p)))))
@ -35,7 +35,7 @@
(use-package sass-mode (use-package sass-mode
:mode "\\.sass$" :mode "\\.sass$"
:config :config
(def-builder! sass-mode narf/sass-build) (def-builder! sass-mode doom/sass-build)
(def-company-backend! sass-mode (css yasnippet)) (def-company-backend! sass-mode (css yasnippet))
(def-docset! sass-mode "sass,bourbon") (def-docset! sass-mode "sass,bourbon")
(push '("sass" "css") projectile-other-file-alist)) (push '("sass" "css") projectile-other-file-alist))
@ -43,15 +43,15 @@
(use-package scss-mode (use-package scss-mode
:mode "\\.scss$" :mode "\\.scss$"
:config :config
(def-builder! scss-mode narf/scss-build) (def-builder! scss-mode doom/scss-build)
(def-company-backend! scss-mode (css yasnippet)) (def-company-backend! scss-mode (css yasnippet))
(def-docset! scss-mode "sass,bourbon") (def-docset! scss-mode "sass,bourbon")
(push '("scss" "css") projectile-other-file-alist) (push '("scss" "css") projectile-other-file-alist)
(setq scss-compile-at-save nil)) (setq scss-compile-at-save nil))
(map! :map (css-mode-map sass-mode-map scss-mode-map) (map! :map (css-mode-map sass-mode-map scss-mode-map)
:n "M-R" 'narf/web-refresh-browser :n "M-R" 'doom/web-refresh-browser
(:localleader :nv ";" 'narf/append-semicolon) (:localleader :nv ";" 'doom/append-semicolon)
(:leader (:leader
:n ";" 'helm-css-scss :n ";" 'helm-css-scss
:n ":" 'helm-css-scss-multi)) :n ":" 'helm-css-scss-multi))

View file

@ -5,7 +5,7 @@
:defer t :defer t
:init :init
(evil-set-initial-state 'eshell-mode 'normal) (evil-set-initial-state 'eshell-mode 'normal)
(setq eshell-directory-name (concat narf-temp-dir "/eshell") (setq eshell-directory-name (concat doom-temp-dir "/eshell")
eshell-scroll-to-bottom-on-input 'all eshell-scroll-to-bottom-on-input 'all
eshell-buffer-shorthand t eshell-buffer-shorthand t
@ -14,7 +14,7 @@
eshell-error-if-no-glob t eshell-error-if-no-glob t
;; em-alias ;; em-alias
eshell-aliases-file (concat narf-temp-dir "/.eshell-aliases")) eshell-aliases-file (concat doom-temp-dir "/.eshell-aliases"))
;; plan 9 smart shell ;; plan 9 smart shell
(require 'em-smart) (require 'em-smart)
@ -24,15 +24,15 @@
(setq eshell-smart-space-goes-to-end t) (setq eshell-smart-space-goes-to-end t)
;; em-prompt ;; em-prompt
(setq eshell-prompt-function 'narf/eshell-prompt) (setq eshell-prompt-function 'doom/eshell-prompt)
(map! :map eshell-mode-map (map! :map eshell-mode-map
:n "i" 'narf/eshell-evil-prepend-maybe :n "i" 'doom/eshell-evil-prepend-maybe
:n "I" 'narf/eshell-evil-prepend :n "I" 'doom/eshell-evil-prepend
:n "a" 'narf/eshell-evil-append-maybe :n "a" 'doom/eshell-evil-append-maybe
:n "A" 'narf/eshell-evil-append :n "A" 'doom/eshell-evil-append
:n "r" 'narf/eshell-evil-replace-maybe :n "r" 'doom/eshell-evil-replace-maybe
:n "R" 'narf/eshell-evil-replace-state-maybe)) :n "R" 'doom/eshell-evil-replace-state-maybe))
(provide 'module-eshell) (provide 'module-eshell)
;;; module-eshell.el ends here ;;; module-eshell.el ends here

View file

@ -15,9 +15,9 @@
(:leader :n "h" 'godef-describe) (:leader :n "h" 'godef-describe)
(:localleader (:localleader
:n "p" 'helm-go-package :n "p" 'helm-go-package
:n "tr" 'narf:go-test-run-all :n "tr" 'doom:go-test-run-all
:n "ta" 'narf:go-test-run-all :n "ta" 'doom:go-test-run-all
:n "ts" 'narf:go-test-run-package)) :n "ts" 'doom:go-test-run-package))
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))

View file

@ -15,7 +15,7 @@
(use-package inf-haskell (use-package inf-haskell
:commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell) :commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell)
:config :config
(map! :map inf-haskell-mode-map "ESC ESC" 'narf/popup-close)) (map! :map inf-haskell-mode-map "ESC ESC" 'doom/popup-close))
(provide 'module-haskell) (provide 'module-haskell)
;;; module-haskell.el ends here ;;; module-haskell.el ends here

View file

@ -1,6 +1,8 @@
;;; module-java.el --- the poster child for carpal tunnel ;;; module-java.el --- the poster child for carpal tunnel
(def-docset! java-mode "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc") (after! c-initialization
(def-docset! java-mode
"java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc"))
(use-package eclim (use-package eclim
:functions (eclim--project-dir eclim--project-name) :functions (eclim--project-dir eclim--project-name)
@ -29,7 +31,7 @@
(use-package android-mode (use-package android-mode
:commands android-mode :commands android-mode
:init :init
(add-hook! (java-mode groovy-mode nxml-mode) 'narf|android-mode-enable-maybe) (add-hook! (java-mode groovy-mode nxml-mode) 'doom|android-mode-enable-maybe)
:config :config
(def-yas-mode! 'android-mode) (def-yas-mode! 'android-mode)
(after! company-dict (after! company-dict

View file

@ -22,7 +22,7 @@
;; [pedantry intensifies] ;; [pedantry intensifies]
(add-hook! js2-mode (setq mode-name "JS2")) (add-hook! js2-mode (setq mode-name "JS2"))
(map! :map js2-mode-map (:localleader :nv ";" 'narf/append-semicolon))) (map! :map js2-mode-map (:localleader :nv ";" 'doom/append-semicolon)))
(use-package tern (use-package tern
:after js2-mode :after js2-mode
@ -95,14 +95,14 @@
(setq tide-format-options (setq tide-format-options
'(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t
:placeOpenBraceOnNewLineForFunctions nil)) :placeOpenBraceOnNewLineForFunctions nil))
(defun narf|tide-setup () (defun doom|tide-setup ()
(tide-setup) (tide-setup)
(flycheck-mode +1) (flycheck-mode +1)
(eldoc-mode +1)) (eldoc-mode +1))
(add-hook 'typescript-mode-hook 'narf|tide-setup) (add-hook 'typescript-mode-hook 'doom|tide-setup)
(add-hook! web-mode (add-hook! web-mode
(when (f-ext? buffer-file-name "tsx") (when (f-ext? buffer-file-name "tsx")
(narf|tide-setup))) (doom|tide-setup)))
(map! :map typescript-mode-map (map! :map typescript-mode-map
:m "gd" 'tide-jump-to-definition :m "gd" 'tide-jump-to-definition
@ -115,7 +115,7 @@
:files ("package.json") :files ("package.json")
:when :when
(lambda (&rest _) (lambda (&rest _)
(let* ((project-path (narf/project-root)) (let* ((project-path (doom/project-root))
(hash (gethash project-path npm-conf)) (hash (gethash project-path npm-conf))
(package-file (f-expand "package.json" project-path)) (package-file (f-expand "package.json" project-path))
deps) deps)
@ -128,7 +128,7 @@
:modes (nodejs-project-mode bower-project-mode) :modes (nodejs-project-mode bower-project-mode)
:when :when
(lambda (&rest _) (lambda (&rest _)
(awhen (gethash (narf/project-root) npm-conf) (awhen (gethash (doom/project-root) npm-conf)
(assq 'express (cdr-safe (assq 'dependencies it)))))) (assq 'express (cdr-safe (assq 'dependencies it))))))
;; TODO electron-compile support ;; TODO electron-compile support
@ -137,7 +137,7 @@
:files ("app/index.html" "app/main.js") :files ("app/index.html" "app/main.js")
:when :when
(lambda (&rest _) (lambda (&rest _)
(awhen (gethash (narf/project-root) npm-conf) (awhen (gethash (doom/project-root) npm-conf)
(let ((deps (append (car-safe (assq 'dependencies it)) (let ((deps (append (car-safe (assq 'dependencies it))
(car-safe (assq 'devDependencies it))))) (car-safe (assq 'devDependencies it)))))
(or (assq 'electron-prebuilt deps) (or (assq 'electron-prebuilt deps)
@ -148,7 +148,7 @@
:modes (nodejs-project-mode bower-project-mode) :modes (nodejs-project-mode bower-project-mode)
:when :when
(lambda (&rest _) (lambda (&rest _)
(let* ((project (narf/project-root)) (let* ((project (doom/project-root))
(deps (append (cdr-safe (assq 'dependencies (gethash project bower-conf))) (deps (append (cdr-safe (assq 'dependencies (gethash project bower-conf)))
(cdr-safe (assq 'dependencies (gethash project npm-conf)))))) (cdr-safe (assq 'dependencies (gethash project npm-conf))))))
(assq 'react deps)))) (assq 'react deps))))

View file

@ -3,7 +3,7 @@
(use-package julia-mode (use-package julia-mode
:mode "\\.jl$" :mode "\\.jl$"
:interpreter "julia" :interpreter "julia"
:config (def-repl! julia-mode narf/julia-repl)) :config (def-repl! julia-mode doom/julia-repl))
(provide 'module-julia) (provide 'module-julia)
;;; module-julia.el ends here ;;; module-julia.el ends here

View file

@ -1,6 +1,6 @@
;;; module-latex.el ;;; module-latex.el
(defvar bibtex-dir "~/Dropbox/docs/biblio") (defvar doom-bibtex-dir "~/Dropbox/docs/biblio")
(use-package reftex (use-package reftex
:commands turn-on-reftex :commands turn-on-reftex
@ -8,7 +8,7 @@
(setq reftex-plug-into-AUCTeX t (setq reftex-plug-into-AUCTeX t
reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref") reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref")
reftex-default-bibliography reftex-default-bibliography
`(,(expand-file-name "phys.bib" bibtex-dir))) `(,(expand-file-name "phys.bib" doom-bibtex-dir)))
(add-hook! (LaTeX-mode latex-mode) 'turn-on-reftex)) (add-hook! (LaTeX-mode latex-mode) 'turn-on-reftex))
(use-package helm-bibtex (use-package helm-bibtex
@ -26,12 +26,12 @@
:config :config
(setq helm-bibtex-bibliography (setq helm-bibtex-bibliography
(list (f-expand "phys.bib" bibtex-dir)) (list (f-expand "phys.bib" doom-bibtex-dir))
helm-bibtex-library-path helm-bibtex-library-path
(list (f-expand "phys-pdf" bibtex-dir)) (list (f-expand "phys-pdf" doom-bibtex-dir))
helm-bibtex-notes-path (f-expand "notes.org" bibtex-dir) helm-bibtex-notes-path (f-expand "notes.org" doom-bibtex-dir)
helm-bibtex-pdf-open-function helm-bibtex-pdf-open-function
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath)))) (lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))

View file

@ -4,12 +4,12 @@
(add-hook! emacs-lisp-mode '(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode)) (add-hook! emacs-lisp-mode '(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode))
;; Real go-to-definition for elisp ;; Real go-to-definition for elisp
(map! :map emacs-lisp-mode-map :m "gd" 'narf/elisp-find-function-at-pt) (map! :map emacs-lisp-mode-map :m "gd" 'doom/elisp-find-function-at-pt)
(add-hook 'emacs-lisp-mode-hook 'narf/elisp-init) (add-hook 'emacs-lisp-mode-hook 'doom/elisp-init)
(defun narf/elisp-init () (defun doom/elisp-init ()
(def-company-backend! emacs-lisp-mode (elisp yasnippet)) (def-company-backend! emacs-lisp-mode (elisp yasnippet))
(def-repl! emacs-lisp-mode narf/elisp-inf-ielm) (def-repl! emacs-lisp-mode doom/elisp-inf-ielm)
(def-rotate! emacs-lisp-mode (def-rotate! emacs-lisp-mode
:symbols (("t" "nil") :symbols (("t" "nil")
("let" "let*") ("let" "let*")
@ -23,16 +23,16 @@
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist) (delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
editorconfig-indentation-alist)) editorconfig-indentation-alist))
(remove-hook 'emacs-lisp-mode-hook 'narf/elisp-init)) (remove-hook 'emacs-lisp-mode-hook 'doom/elisp-init))
(add-hook 'emacs-lisp-mode-hook 'narf/elisp-hook) (add-hook 'emacs-lisp-mode-hook 'doom/elisp-hook)
(defun narf/elisp-hook () (defun doom/elisp-hook ()
(setq mode-name "Elisp") ; [pedantry intensifies] (setq mode-name "Elisp") ; [pedantry intensifies]
(font-lock-add-keywords (font-lock-add-keywords
nil `(("(\\(lambda\\)" (1 (narf/show-as ))) nil `(("(\\(lambda\\)" (1 (doom/show-as )))
("(\\(narf\\)\\>" (1 font-lock-keyword-face append)) ("(\\(doom\\)\\(-[^) ]+\\)?)" (0 font-lock-keyword-face append))
;; Highlight narf macros (macros are fontified in emacs 25+) ;; Highlight doom macros (macros are fontified in emacs 25+)
(,(concat (,(concat
"(\\(def-" "(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend" (regexp-opt '("electric" "project-type" "company-backend"
@ -43,7 +43,7 @@
(1 font-lock-keyword-face append)) (1 font-lock-keyword-face append))
(,(concat (,(concat
"(\\(" "(\\("
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook" (regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "define-org-link" "ex" "associate" "define-org-link" "ex"
"define-org-section")) "define-org-section"))
"!\\)") "!\\)")
@ -58,7 +58,7 @@
(2 font-lock-function-name-face)))) (2 font-lock-function-name-face))))
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
(add-hook 'after-save-hook 'narf/elisp-auto-compile nil t) (add-hook 'after-save-hook 'doom/elisp-auto-compile nil t)
(dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<.+\\_>\\)" 2) (dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<.+\\_>\\)" 2)
("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<.+\\_>\\)" 2) ("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<.+\\_>\\)" 2)
@ -107,10 +107,10 @@
:modes (emacs-lisp-mode) :modes (emacs-lisp-mode)
:match "/test/.+-test\\.el$" :match "/test/.+-test\\.el$"
:bind (:localleader :bind (:localleader
:n "tr" 'narf/ert-rerun-test :n "tr" 'doom/ert-rerun-test
:n "ta" 'narf/ert-run-all-tests :n "ta" 'doom/ert-run-all-tests
:n "ts" 'narf/ert-run-test) :n "ts" 'doom/ert-run-test)
(add-hook 'ert-results-mode-hook 'narf|hide-mode-line)) (add-hook 'ert-results-mode-hook 'doom|hide-mode-line))
(provide 'module-lisp) (provide 'module-lisp)
;;; module-elisp.el ends here ;;; module-elisp.el ends here

View file

@ -7,7 +7,7 @@
:config :config
(def-company-backend! lua-mode (lua yasnippet)) (def-company-backend! lua-mode (lua yasnippet))
(def-electric! lua-mode :words ("else" "end")) (def-electric! lua-mode :words ("else" "end"))
(def-repl! lua-mode narf/inf-lua) (def-repl! lua-mode doom/inf-lua)
(sp-with-modes '(lua-mode) (sp-with-modes '(lua-mode)
;; disable defaults ;; disable defaults
(sp-local-pair "if" nil :actions :rem) (sp-local-pair "if" nil :actions :rem)

View file

@ -1,21 +1,26 @@
;;; module-org-crm.el ;;; module-org-crm.el
(defun narf|org-crm-init () (add-hook 'org-load-hook 'doom|org-crm-init)
(define-org-section! cproject "Work")
(define-org-section! project "Projects") (defvar org-directory-crm (expand-file-name "/crm/" org-directory))
(define-org-section! contact "Contacts")
(defun doom|org-crm-init ()
;; (define-org-section! work "Work")
;; (define-org-section! project "Projects")
;; (define-org-section! contact "Contacts")
) )
(defun narf/org-crm-new (type name) ;;
(defun doom/org-crm-new (type name)
) )
(defun narf/org-crm-visit-project (&optional name) (defun doom/org-crm-visit-project (&optional name)
) )
(defun narf/org-crm-visit-contact (&optional name) (defun doom/org-crm-visit-contact (&optional name)
) )
(defun narf/org-crm-visit-invoice (&optional name) (defun doom/org-crm-visit-invoice (&optional name)
) )
(provide 'module-org-crm) (provide 'module-org-crm)

View file

@ -9,19 +9,19 @@
;; for images and documents into org files ;; for images and documents into org files
;; + A pandoc-powered export system ;; + A pandoc-powered export system
(add-hook 'org-load-hook 'narf|org-notebook-init t) (add-hook 'org-load-hook 'doom|org-notebook-init t)
(add-hook 'org-load-hook 'narf|org-attach-init t) (add-hook 'org-load-hook 'doom|org-attach-init t)
(add-hook 'org-load-hook 'narf|org-export-init t) (add-hook 'org-load-hook 'doom|org-export-init t)
(defvar org-directory-notebook (expand-file-name "/notebook/" org-directory)) (defvar org-directory-notebook (expand-file-name "/notebook/" org-directory))
(defvar org-default-notes-file (expand-file-name "inbox.org" org-directory)) (defvar org-default-notes-file (expand-file-name "inbox.org" org-directory))
(defvar org-attach-directory ".attach/") (defvar org-attach-directory ".attach/")
(defvar narf-org-export-directory (concat org-directory ".export")) (defvar doom-org-export-directory (concat org-directory ".export"))
(defvar narf-org-quicknote-dir (concat org-directory "Inbox/")) (defvar doom-org-quicknote-dir (concat org-directory "Inbox/"))
;; Keep track of attachments ;; Keep track of attachments
(defvar-local narf-org-attachments-list '() (defvar-local doom-org-attachments-list '()
"A list of attachments for the current buffer") "A list of attachments for the current buffer")
;; Tell helm to ignore these directories ;; Tell helm to ignore these directories
@ -31,14 +31,14 @@
;; ;;
(defun narf|org-notebook-init () (defun doom|org-notebook-init ()
;; (define-org-section! course "Classes" ;; (define-org-section! course "Classes"
;; (lambda (path) (substring path 0 (s-index-of " " path))) "%s*.org") ;; (lambda (path) (substring path 0 (s-index-of " " path))) "%s*.org")
;; (exmap "ocl[ass]" 'narf:org-search-course) ;; (exmap "ocl[ass]" 'doom:org-search-course)
(narf-fix-unicode "FontAwesome" '(? ? ? ? ? ? ? ? ?) 13)) (doom-fix-unicode "FontAwesome" '(? ? ? ? ? ? ? ?) 13))
;; ;;
(defun narf|org-attach-init () (defun doom|org-attach-init ()
;; Drag-and-drop support ;; Drag-and-drop support
(require 'org-download) (require 'org-download)
(setq-default org-download-image-dir org-attach-directory (setq-default org-download-image-dir org-attach-directory
@ -50,23 +50,23 @@
;; Write download paths relative to current file ;; Write download paths relative to current file
(defun org-download--dir-2 () nil) (defun org-download--dir-2 () nil)
(defun narf*org-download--fullname (path) (defun doom*org-download--fullname (path)
(f-relative path (f-dirname (buffer-file-name)))) (f-relative path (f-dirname (buffer-file-name))))
(advice-add 'org-download--fullname :filter-return 'narf*org-download--fullname) (advice-add 'org-download--fullname :filter-return 'doom*org-download--fullname)
;; Add another drag-and-drop handler that will handle anything but image files ;; Add another drag-and-drop handler that will handle anything but image files
(setq dnd-protocol-alist `(("^\\(https?\\|ftp\\|file\\|nfs\\):\\(//\\)?" . narf/org-download-dnd) (setq dnd-protocol-alist `(("^\\(https?\\|ftp\\|file\\|nfs\\):\\(//\\)?" . doom/org-download-dnd)
,@dnd-protocol-alist)) ,@dnd-protocol-alist))
;; ...auto-delete attachments once all references to it have been deleted. ;; ...auto-delete attachments once all references to it have been deleted.
(add-hook 'org-mode-hook 'narf|org-attach-track-init) (add-hook 'org-mode-hook 'doom|org-attach-track-init)
(defun narf|org-attach-track-init () (defun doom|org-attach-track-init ()
(setq narf-org-attachments-list (narf/org-attachments)) (setq doom-org-attachments-list (doom/org-attachments))
(add-hook 'after-save-hook 'narf/org-cleanup-attachments nil t))) (add-hook 'after-save-hook 'doom/org-cleanup-attachments nil t)))
;; ;;
(defun narf|org-export-init () (defun doom|org-export-init ()
"Set up my own exporting system." "Set up my own exporting system."
(setq org-export-backends '(ascii html latex md) (setq org-export-backends '(ascii html latex md)
org-export-with-toc t org-export-with-toc t
@ -76,21 +76,21 @@
(setq org-pandoc-options '((standalone . t) (mathjax . t) (parse-raw . t))) (setq org-pandoc-options '((standalone . t) (mathjax . t) (parse-raw . t)))
;; Export to a central directory (why isn't this easier?) ;; Export to a central directory (why isn't this easier?)
(unless (file-directory-p narf-org-export-directory) (unless (file-directory-p doom-org-export-directory)
(mkdir narf-org-export-directory)) (mkdir doom-org-export-directory))
(defun narf*org-export-output-file-name (args) (defun doom*org-export-output-file-name (args)
(unless (nth 2 args) (unless (nth 2 args)
(setq args (append args (list narf-org-export-directory)))) (setq args (append args (list doom-org-export-directory))))
args) args)
(advice-add 'org-export-output-file-name :filter-args 'narf*org-export-output-file-name)) (advice-add 'org-export-output-file-name :filter-args 'doom*org-export-output-file-name))
;; ;;
;; (defvar narf-org-tags '()) ;; (defvar doom-org-tags '())
;; (defun narf|org-tag-init () ;; (defun doom|org-tag-init ()
;; (async-start ;; (async-start
;; `(lambda () ;; `(lambda ()
;; (let ((default-directory (narf/project-root)) ;; (let ((default-directory (doom/project-root))
;; (data (s-trim (shell-command-to-string "ag --nocolor --nonumbers '^#\\+TAGS:'"))) ;; (data (s-trim (shell-command-to-string "ag --nocolor --nonumbers '^#\\+TAGS:'")))
;; (alist '())) ;; (alist '()))
;; (unless (zerop (length data)) ;; (unless (zerop (length data))

View file

@ -1,8 +1,8 @@
;;; module-org.el ;;; module-org.el
(add-hook 'org-load-hook 'narf|org-init t) (add-hook 'org-load-hook 'doom|org-init t)
(add-hook 'org-load-hook 'narf|org-keybinds t) (add-hook 'org-load-hook 'doom|org-keybinds t)
(add-hook 'org-mode-hook 'narf|org-hook) (add-hook 'org-mode-hook 'doom|org-hook)
(defvar org-directory (expand-file-name "~/Dropbox/notes/")) (defvar org-directory (expand-file-name "~/Dropbox/notes/"))
@ -17,7 +17,7 @@
(require 'module-org-notebook) (require 'module-org-notebook)
;; ;;
(defun narf|org-hook () (defun doom|org-hook ()
(evil-org-mode +1) (evil-org-mode +1)
(visual-line-mode +1) (visual-line-mode +1)
(setq line-spacing 2) (setq line-spacing 2)
@ -29,14 +29,14 @@
(outline-previous-visible-heading 1) (outline-previous-visible-heading 1)
(org-show-subtree)))) (org-show-subtree))))
(defun narf|org-update () (defun doom|org-update ()
(when (file-exists-p buffer-file-name) (when (file-exists-p buffer-file-name)
(org-update-statistics-cookies t))) (org-update-statistics-cookies t)))
(add-hook 'before-save-hook 'narf|org-update nil t) (add-hook 'before-save-hook 'doom|org-update nil t)
(add-hook 'evil-insert-state-exit-hook 'narf|org-update nil t)) (add-hook 'evil-insert-state-exit-hook 'doom|org-update nil t))
(defun narf|org-init () (defun doom|org-init ()
(setq-default (setq-default
org-export-coding-system 'utf-8 org-export-coding-system 'utf-8
@ -109,7 +109,7 @@
org-highlight-latex-and-related '(latex) org-highlight-latex-and-related '(latex)
org-latex-create-formula-image-program 'dvipng org-latex-create-formula-image-program 'dvipng
org-latex-image-default-width ".9\\linewidth" org-latex-image-default-width ".9\\linewidth"
org-latex-preview-ltxpng-directory (concat narf-temp-dir "/ltxpng/") org-latex-preview-ltxpng-directory (concat doom-temp-dir "/ltxpng/")
org-latex-remove-logfiles nil org-latex-remove-logfiles nil
org-startup-with-latex-preview nil org-startup-with-latex-preview nil
;; org-latex-packages-alist ;; org-latex-packages-alist
@ -122,7 +122,7 @@
;; TODO: New vocabulary word ;; TODO: New vocabulary word
("c" "Changelog" entry ("c" "Changelog" entry
(file+headline (f-expand "CHANGELOG.org" (narf/project-root)) "Unreleased") (file+headline (f-expand "CHANGELOG.org" (doom/project-root)) "Unreleased")
"* %?") "* %?")
;; ("p" "Project Notes" entry ;; ("p" "Project Notes" entry
@ -142,8 +142,8 @@
;; "** %i%?\n") ;; "** %i%?\n")
)) ))
(narf-fix-unicode "DejaVu Sans" '(?♭ ?♯)) (doom-fix-unicode "DejaVu Sans" '(?♭ ?♯))
(narf-fix-unicode "Hack" '(?× ?∙ ?⌉ ?⌈ ?⌊ ?⌋ (doom-fix-unicode "Hack" '(?× ?∙ ?⌉ ?⌈ ?⌊ ?⌋
?∩ ? ?⊆ ?⊂ ?⊄ ?⊇ ?⊃ ?⊅ ?∩ ? ?⊆ ?⊂ ?⊄ ?⊇ ?⊃ ?⊅
?⇒ ?⇐ ?⇔ ?↔ ?→ ?≡ ?∴ ?∵ ?⊕ ?∀ ?∃ ?∄ ?∈ ?∉ ?⇒ ?⇐ ?⇔ ?↔ ?→ ?≡ ?∴ ?∵ ?⊕ ?∀ ?∃ ?∄ ?∈ ?∉
? ?∧ )) ? ?∧ ))
@ -196,13 +196,13 @@
(pushnew 'org-is-agenda-file recentf-exclude) (pushnew 'org-is-agenda-file recentf-exclude)
;; Remove highlights on ESC ;; Remove highlights on ESC
(defun narf*org-remove-occur-highlights (&rest args) (defun doom*org-remove-occur-highlights (&rest args)
(when (eq major-mode 'org-mode) (org-remove-occur-highlights))) (when (eq major-mode 'org-mode) (org-remove-occur-highlights)))
(advice-add 'evil-force-normal-state :before 'narf*org-remove-occur-highlights) (advice-add 'evil-force-normal-state :before 'doom*org-remove-occur-highlights)
;; smartparens config ;; smartparens config
(sp-with-modes '(org-mode) (sp-with-modes '(org-mode)
(sp-local-pair "*" "*" :unless '(sp-point-after-word-p sp-point-at-bol-p) :skip-match 'narf/sp-org-skip-asterisk) (sp-local-pair "*" "*" :unless '(sp-point-after-word-p sp-point-at-bol-p) :skip-match 'doom/sp-org-skip-asterisk)
(sp-local-pair "_" "_" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p)) (sp-local-pair "_" "_" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p))
(sp-local-pair "/" "/" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC"))) (sp-local-pair "/" "/" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC")))
(sp-local-pair "~" "~" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC"))) (sp-local-pair "~" "~" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC")))
@ -213,12 +213,12 @@
(sp-local-pair "$$" "$$" :post-handlers '((:add " | ")) :unless '(sp-point-at-bol-p)) (sp-local-pair "$$" "$$" :post-handlers '((:add " | ")) :unless '(sp-point-at-bol-p))
(sp-local-pair "{" nil))) (sp-local-pair "{" nil)))
(defun narf|org-keybinds () (defun doom|org-keybinds ()
(map! (:map org-mode-map (map! (:map org-mode-map
"RET" nil "RET" nil
"C-j" nil "C-j" nil
"C-k" nil "C-k" nil
:i [remap narf/inflate-space-maybe] 'org-self-insert-command :i [remap doom/inflate-space-maybe] 'org-self-insert-command
:i "RET" 'org-return-indent) :i "RET" 'org-return-indent)
(:map evil-org-mode-map (:map evil-org-mode-map
@ -227,36 +227,36 @@
:ni "A-k" 'org-metaup :ni "A-k" 'org-metaup
:ni "A-j" 'org-metadown :ni "A-j" 'org-metadown
;; Expand tables (or shiftmeta move) ;; Expand tables (or shiftmeta move)
:ni "A-L" 'narf/org-table-append-field-or-shift-right :ni "A-L" 'doom/org-table-append-field-or-shift-right
:ni "A-H" 'narf/org-table-prepend-field-or-shift-left :ni "A-H" 'doom/org-table-prepend-field-or-shift-left
:ni "A-K" 'narf/org-table-prepend-row-or-shift-up :ni "A-K" 'doom/org-table-prepend-row-or-shift-up
:ni "A-J" 'narf/org-table-append-row-or-shift-down :ni "A-J" 'doom/org-table-append-row-or-shift-down
:i "C-L" 'narf/org-table-next-field :i "C-L" 'doom/org-table-next-field
:i "C-H" 'narf/org-table-previous-field :i "C-H" 'doom/org-table-previous-field
:i "C-K" 'narf/org-table-previous-row :i "C-K" 'doom/org-table-previous-row
:i "C-J" 'narf/org-table-next-row :i "C-J" 'doom/org-table-next-row
:i "C-e" 'org-end-of-line :i "C-e" 'org-end-of-line
:i "C-a" 'org-beginning-of-line :i "C-a" 'org-beginning-of-line
:i "<tab>" 'narf/org-indent :i "<tab>" 'doom/org-indent
:i "<S-tab>" 'narf/org-dedent :i "<S-tab>" 'doom/org-dedent
:nv "j" 'evil-next-visual-line :nv "j" 'evil-next-visual-line
:nv "k" 'evil-previous-visual-line :nv "k" 'evil-previous-visual-line
:v "<S-tab>" 'narf/yas-insert-snippet :v "<S-tab>" 'doom/yas-insert-snippet
:i "M-a" (λ! (evil-visual-state) (org-mark-element)) :i "M-a" (λ! (evil-visual-state) (org-mark-element))
:n "M-a" 'org-mark-element :n "M-a" 'org-mark-element
:v "M-a" 'mark-whole-buffer :v "M-a" 'mark-whole-buffer
:ni "<M-return>" (λ! (narf/org-insert-item 'below)) :ni "<M-return>" (λ! (doom/org-insert-item 'below))
:ni "<S-M-return>" (λ! (narf/org-insert-item 'above)) :ni "<S-M-return>" (λ! (doom/org-insert-item 'above))
:i "M-b" (λ! (narf/org-surround "*")) ; bold :i "M-b" (λ! (doom/org-surround "*")) ; bold
:i "M-u" (λ! (narf/org-surround "_")) ; underline :i "M-u" (λ! (doom/org-surround "_")) ; underline
:i "M-i" (λ! (narf/org-surround "/")) ; italics :i "M-i" (λ! (doom/org-surround "/")) ; italics
:i "M-`" (λ! (narf/org-surround "+")) ; strikethrough :i "M-`" (λ! (doom/org-surround "+")) ; strikethrough
:v "M-b" "S*" :v "M-b" "S*"
:v "M-u" "S_" :v "M-u" "S_"
@ -265,7 +265,7 @@
(:leader (:leader
:n ";" 'helm-org-in-buffer-headings :n ";" 'helm-org-in-buffer-headings
:n "oa" 'narf/org-attachment-reveal) :n "oa" 'doom/org-attachment-reveal)
(:localleader (:localleader
:n "/" 'org-sparse-tree :n "/" 'org-sparse-tree
@ -276,18 +276,18 @@
:n "=" 'org-align-all-tags :n "=" 'org-align-all-tags
:nv "l" 'org-insert-link :nv "l" 'org-insert-link
:n "L" 'org-store-link :n "L" 'org-store-link
:n "x" 'narf/org-remove-link :n "x" 'doom/org-remove-link
;; :n "w" 'writing-mode ;; :n "w" 'writing-mode
:n "v" 'variable-pitch-mode :n "v" 'variable-pitch-mode
:n "SPC" 'narf/org-toggle-checkbox :n "SPC" 'doom/org-toggle-checkbox
:n "RET" 'org-archive-subtree :n "RET" 'org-archive-subtree
:n "a" 'org-agenda :n "a" 'org-agenda
:n "A" 'narf:org-attachment-list :n "A" 'doom:org-attachment-list
:n "d" 'org-time-stamp :n "d" 'org-time-stamp
:n "D" 'org-deadline :n "D" 'org-deadline
:n "i" 'narf/org-toggle-inline-images-at-point :n "i" 'doom/org-toggle-inline-images-at-point
:n "t" (λ! (org-todo (if (org-entry-is-todo-p) 'none 'todo))) :n "t" (λ! (org-todo (if (org-entry-is-todo-p) 'none 'todo)))
:v "t" (λ! (evil-ex-normal evil-visual-beginning evil-visual-end "\\t")) :v "t" (λ! (evil-ex-normal evil-visual-beginning evil-visual-end "\\t"))
:n "T" 'org-todo :n "T" 'org-todo
@ -312,7 +312,7 @@
:m "]l" 'org-next-link :m "]l" 'org-next-link
:m "[l" 'org-previous-link :m "[l" 'org-previous-link
:n "RET" 'narf/org-dwim-at-point :n "RET" 'doom/org-dwim-at-point
:m "gh" 'outline-up-heading :m "gh" 'outline-up-heading
:m "gj" 'org-forward-heading-same-level :m "gj" 'org-forward-heading-same-level

View file

@ -10,14 +10,14 @@
:init :init
(add-hook 'php-mode-hook 'flycheck-mode) (add-hook 'php-mode-hook 'flycheck-mode)
(setq php-template-compatibility nil (setq php-template-compatibility nil
php-extras-eldoc-functions-file (concat narf-temp-dir "/php-extras-eldoc-functions")) php-extras-eldoc-functions-file (concat doom-temp-dir "/php-extras-eldoc-functions"))
:config :config
(def-repl! php-mode php-boris) (def-repl! php-mode php-boris)
(def-docset! php-mode "php,laravel") (def-docset! php-mode "php,laravel")
(def-company-backend! php-mode '(php-extras-company company-yasnippet)) (def-company-backend! php-mode '(php-extras-company company-yasnippet))
(map! :map php-mode-map (:localleader :nv ";" 'narf/append-semicolon)) (map! :map php-mode-map (:localleader :nv ";" 'doom/append-semicolon))
(sp-with-modes '(php-mode) (sp-with-modes '(php-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))) (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
@ -85,7 +85,7 @@
:files ("composer.json") :files ("composer.json")
:when :when
(lambda (&rest _) (lambda (&rest _)
(let* ((project-path (narf/project-root)) (let* ((project-path (doom/project-root))
(hash (gethash project-path php-composer-conf)) (hash (gethash project-path php-composer-conf))
(package-file (f-expand "composer.json" project-path)) (package-file (f-expand "composer.json" project-path))
deps) deps)

View file

@ -5,7 +5,7 @@
:commands (processing-mode processing-find-sketch) :commands (processing-mode processing-find-sketch)
:mode "\\.pde$" :mode "\\.pde$"
:init :init
(add-hook 'processing-compilation-mode-hook 'narf|hide-mode-line) (add-hook 'processing-compilation-mode-hook 'doom|hide-mode-line)
:config :config
(def-builder! processing-mode processing-sketch-build) (def-builder! processing-mode processing-sketch-build)
@ -28,7 +28,7 @@
(quickrun-add-command (quickrun-add-command
"processing" `((:command . ,processing-location) "processing" `((:command . ,processing-location)
(:exec . (lambda () (format "--sketch=%s --output=%s --force --run" (:exec . (lambda () (format "--sketch=%s --output=%s --force --run"
(narf/project-root) processing-output-dir))) (doom/project-root) processing-output-dir)))
(:description . "Run Processing sketch")) (:description . "Run Processing sketch"))
:mode 'processing-mode)) :mode 'processing-mode))

View file

@ -6,7 +6,7 @@
:commands python-mode :commands python-mode
:init :init
(setq-default (setq-default
python-environment-directory narf-temp-dir python-environment-directory doom-temp-dir
python-shell-interpreter "ipython" python-shell-interpreter "ipython"
python-shell-interpreter-args "--deep-reload" python-shell-interpreter-args "--deep-reload"
python-shell-prompt-regexp "In \\[[0-9]+\\]: " python-shell-prompt-regexp "In \\[[0-9]+\\]: "
@ -23,7 +23,7 @@
(def-company-backend! python-mode (anaconda)) (def-company-backend! python-mode (anaconda))
(def-docset! python-mode "py,py3,python") (def-docset! python-mode "py,py3,python")
(def-version-cmd! python-mode "python --version 2>&1 | cut -d' ' -f2") (def-version-cmd! python-mode "python --version 2>&1 | cut -d' ' -f2")
(def-repl! python-mode narf/inf-python) (def-repl! python-mode doom/inf-python)
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens (define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
@ -31,14 +31,14 @@
:after python :after python
:init :init
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode)) (add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
(setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/") (setq anaconda-mode-installation-directory (concat doom-temp-dir "/anaconda/")
anaconda-mode-eldoc-as-single-line t) anaconda-mode-eldoc-as-single-line t)
:config :config
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions) (map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit) (map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
(advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer)) (advice-add 'anaconda-mode-doc-buffer :after 'doom*anaconda-mode-doc-buffer))
(use-package company-anaconda (use-package company-anaconda
:after anaconda-mode :after anaconda-mode

View file

@ -12,8 +12,8 @@
(use-package racer (use-package racer
:after rust-mode :after rust-mode
:preface :preface
(setq racer-cmd (concat narf-ext-dir "/racer") (setq racer-cmd (concat doom-ext-dir "/racer")
racer-rust-src-path (concat narf-ext-dir "/rust/src/")) racer-rust-src-path (concat doom-ext-dir "/rust/src/"))
:when (f-exists? racer-cmd) :when (f-exists? racer-cmd)
:init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup)) :init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
:config :config

View file

@ -6,22 +6,22 @@
("/\\.?bash\\(/.*\\|rc\\|_profile\\)$" . sh-mode)) ("/\\.?bash\\(/.*\\|rc\\|_profile\\)$" . sh-mode))
:init :init
(add-hook! sh-mode (add-hook! sh-mode
'(flycheck-mode narf|sh-extra-font-lock-activate)) '(flycheck-mode doom|sh-extra-font-lock-activate))
:config :config
(def-company-backend! sh-mode (shell)) (def-company-backend! sh-mode (shell))
(def-electric! sh-mode :words ("else" "elif" "fi" "done")) (def-electric! sh-mode :words ("else" "elif" "fi" "done"))
(def-repl! sh-mode narf/inf-shell) (def-repl! sh-mode doom/inf-shell)
(setq sh-indent-after-continuation 'always) (setq sh-indent-after-continuation 'always)
;; [pedantry intensifies] ;; [pedantry intensifies]
(add-hook! sh-mode (setq mode-name "sh")) (add-hook! sh-mode (setq mode-name "sh"))
(sp-with-modes '(sh-mode) (sp-with-modes '(sh-mode)
(sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
(sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
(sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
(sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
(sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)))) (sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))))
(use-package company-shell (use-package company-shell
:after sh-script :after sh-script

View file

@ -17,12 +17,12 @@
"<M-right>" nil "<M-right>" nil
;; Assumes you have a markdown renderer plugin in chrome ;; Assumes you have a markdown renderer plugin in chrome
:nv "M-r" (λ! (narf-open-with "Google Chrome")) :nv "M-r" (λ! (doom-open-with "Google Chrome"))
"M-*" 'markdown-insert-list-item "M-*" 'markdown-insert-list-item
"M-b" 'markdown-insert-bold "M-b" 'markdown-insert-bold
"M-i" 'markdown-insert-italic "M-i" 'markdown-insert-italic
"M-`" 'narf/markdown-insert-del "M-`" 'doom/markdown-insert-del
(:localleader (:localleader
:nv "i" 'markdown-insert-image :nv "i" 'markdown-insert-image

View file

@ -10,8 +10,8 @@
(push '("jade" "html") projectile-other-file-alist) (push '("jade" "html") projectile-other-file-alist)
(push '("pug" "html") projectile-other-file-alist) (push '("pug" "html") projectile-other-file-alist)
(map! :map pug-mode-map (map! :map pug-mode-map
:i [tab] 'narf/dumb-indent :i [tab] 'doom/dumb-indent
:i [backtab] 'narf/dumb-dedent)) :i [backtab] 'doom/dumb-dedent))
(use-package web-mode (use-package web-mode
:mode ("\\.p?html?$" :mode ("\\.p?html?$"
@ -37,7 +37,7 @@
(map! :map web-mode-map (map! :map web-mode-map
"M-/" 'web-mode-comment-or-uncomment "M-/" 'web-mode-comment-or-uncomment
:n "M-r" 'narf/web-refresh-browser :n "M-r" 'doom/web-refresh-browser
:n "za" 'web-mode-fold-or-unfold :n "za" 'web-mode-fold-or-unfold
(:localleader :n "t" 'web-mode-element-rename) (:localleader :n "t" 'web-mode-element-rename)
@ -77,7 +77,7 @@
:files ("bower.json") :files ("bower.json")
:when :when
(lambda (&rest _) (lambda (&rest _)
(let* ((project-path (narf/project-root)) (let* ((project-path (doom/project-root))
(hash (gethash project-path bower-conf)) (hash (gethash project-path bower-conf))
(package-file (f-expand "bower.json" project-path)) (package-file (f-expand "bower.json" project-path))
deps) deps)
@ -90,7 +90,7 @@
:modes (nodejs-project-mode bower-project-mode) :modes (nodejs-project-mode bower-project-mode)
:when :when
(lambda (&rest _) (lambda (&rest _)
(let* ((project (narf/project-root)) (let* ((project (doom/project-root))
(bower (gethash project bower-conf)) (bower (gethash project bower-conf))
(npm (gethash project npm-conf)) (npm (gethash project npm-conf))
(deps (append (cdr-safe (assq 'dependencies bower)) (deps (append (cdr-safe (assq 'dependencies bower))

View file

@ -15,17 +15,17 @@
;; debug ;; debug
"<f9>" 'what-face "<f9>" 'what-face
"M-b" 'narf:build "M-b" 'doom:build
"M-t" 'narf:tab-create "M-t" 'doom:tab-create
"M-T" 'narf/tab-display "M-T" 'doom/tab-display
"A-`" 'os-switch-to-term "A-`" 'os-switch-to-term
"C-`" 'narf/popup-toggle "C-`" 'doom/popup-toggle
"C-~" 'narf:repl "C-~" 'doom:repl
"M-w" 'narf/close-window-or-tab "M-w" 'doom/close-window-or-tab
"M-W" 'delete-frame "M-W" 'delete-frame
"M-n" 'narf/new-buffer "M-n" 'doom/new-buffer
"M-N" 'narf/new-frame "M-N" 'doom/new-frame
;; Simpler window navigation ;; Simpler window navigation
"C-j" 'evil-window-down "C-j" 'evil-window-down
@ -33,28 +33,28 @@
"C-h" 'evil-window-left "C-h" 'evil-window-left
"C-l" 'evil-window-right "C-l" 'evil-window-right
"A-j" 'narf/evil-window-resize-d "A-j" 'doom/evil-window-resize-d
"A-k" 'narf/evil-window-resize-u "A-k" 'doom/evil-window-resize-u
"A-h" 'narf/evil-window-resize-l "A-h" 'doom/evil-window-resize-l
"A-l" 'narf/evil-window-resize-r "A-l" 'doom/evil-window-resize-r
"C-<escape>" 'evil-emacs-state "C-<escape>" 'evil-emacs-state
:e "C-<escape>" 'evil-normal-state :e "C-<escape>" 'evil-normal-state
:m "M-1" (λ! (narf:switch-to-tab 0)) :m "M-1" (λ! (doom:switch-to-tab 0))
:m "M-2" (λ! (narf:switch-to-tab 1)) :m "M-2" (λ! (doom:switch-to-tab 1))
:m "M-3" (λ! (narf:switch-to-tab 2)) :m "M-3" (λ! (doom:switch-to-tab 2))
:m "M-4" (λ! (narf:switch-to-tab 3)) :m "M-4" (λ! (doom:switch-to-tab 3))
:m "M-5" (λ! (narf:switch-to-tab 4)) :m "M-5" (λ! (doom:switch-to-tab 4))
:m "M-6" (λ! (narf:switch-to-tab 5)) :m "M-6" (λ! (doom:switch-to-tab 5))
:m "M-7" (λ! (narf:switch-to-tab 6)) :m "M-7" (λ! (doom:switch-to-tab 6))
:m "M-8" (λ! (narf:switch-to-tab 7)) :m "M-8" (λ! (doom:switch-to-tab 7))
:m "M-9" (λ! (narf:switch-to-tab 8)) :m "M-9" (λ! (doom:switch-to-tab 8))
(:when IS-MAC (:when IS-MAC
"<A-left>" 'backward-word "<A-left>" 'backward-word
"<A-right>" 'forward-word "<A-right>" 'forward-word
"<M-backspace>" 'narf/backward-kill-to-bol-and-indent "<M-backspace>" 'doom/backward-kill-to-bol-and-indent
"A-SPC" 'just-one-space "A-SPC" 'just-one-space
"M-a" 'mark-whole-buffer "M-a" 'mark-whole-buffer
"M-c" 'evil-yank "M-c" 'evil-yank
@ -64,19 +64,19 @@
"M-v" 'clipboard-yank "M-v" 'clipboard-yank
"M-z" 'undo "M-z" 'undo
"M-Z" 'redo "M-Z" 'redo
"C-M-f" 'narf:toggle-fullscreen "C-M-f" 'doom:toggle-fullscreen
:m "M-j" 'narf/multi-next-line :m "M-j" 'doom/multi-next-line
:m "M-k" 'narf/multi-previous-line :m "M-k" 'doom/multi-previous-line
:n "M-r" 'narf:eval-buffer :n "M-r" 'doom:eval-buffer
:v "M-r" 'narf:eval-region :v "M-r" 'doom:eval-region
:ni "<M-f1>" 'narf/dash-at-pt :ni "<M-f1>" 'doom/dash-at-pt
;; Textmate-esque indent shift left/right ;; Textmate-esque indent shift left/right
:i "M-]" 'narf/smart-indent :i "M-]" 'doom/smart-indent
:i "M-[" 'narf/dumb-dedent :i "M-[" 'doom/dumb-dedent
;; Restore osx text objects ;; Restore osx text objects
:i "<A-backspace>" 'evil-delete-backward-word :i "<A-backspace>" 'evil-delete-backward-word
@ -84,7 +84,7 @@
:m ";" 'evil-ex :m ";" 'evil-ex
(:leader (:leader
:nv "," 'narf/helm-buffers-dwim :nv "," 'doom/helm-buffers-dwim
:nv "<" 'helm-buffers-list :nv "<" 'helm-buffers-list
:nv "." 'helm-find-files :nv "." 'helm-find-files
:nv ">" 'helm-projectile-find-file-in-known-projects :nv ">" 'helm-projectile-find-file-in-known-projects
@ -100,32 +100,32 @@
:n "h" 'help-command :n "h" 'help-command
:nv "p" 'helm-show-kill-ring :nv "p" 'helm-show-kill-ring
:n "R" 'narf/reset-theme :n "R" 'doom/reset-theme
:n "e" 'narf/flycheck-errors :n "e" 'doom/flycheck-errors
:n "s" 'yas-visit-snippet-file :n "s" 'yas-visit-snippet-file
:n "S" 'narf/yas-find-file :n "S" 'doom/yas-find-file
:n "D" 'vc-annotate :n "D" 'vc-annotate
(:prefix "d" (:prefix "d"
:n "." 'narf/vcs-show-hunk :n "." 'doom/vcs-show-hunk
:n "/" 'vc-diff :n "/" 'vc-diff
:n "s" 'narf/vcs-stage-hunk :n "s" 'doom/vcs-stage-hunk
:n "r" 'narf/vcs-revert-hunk) :n "r" 'doom/vcs-revert-hunk)
:n "b" 'helm-bookmarks :n "b" 'helm-bookmarks
:nv "l" 'narf/nlinum-toggle :nv "l" 'doom/nlinum-toggle
:nv "qq" 'evil-save-and-quit :nv "qq" 'evil-save-and-quit
:nv "QQ" 'narf/kill-all-buffers-do-not-remember :nv "QQ" 'doom/kill-all-buffers-do-not-remember
;; Quick access to my dotfiles and emacs.d ;; Quick access to my dotfiles and emacs.d
:nv "E" 'narf/helm-find-in-emacsd :nv "E" 'doom/helm-find-in-emacsd
:nv "\\" 'narf/helm-find-in-dotfiles :nv "\\" 'doom/helm-find-in-dotfiles
;; Tmux ;; Tmux
(:prefix "t" (:prefix "t"
:n "." 'narf/tmux-cd-to-here :n "." 'doom/tmux-cd-to-here
:n "/" 'narf/tmux-cd-to-project :n "/" 'doom/tmux-cd-to-project
:v "r" 'narf:tmux) :v "r" 'doom:tmux)
;; Open with O/S ;; Open with O/S
:n "O" 'os-reveal :n "O" 'os-reveal
@ -141,22 +141,22 @@
:n "T" 'os-switch-to-term-and-cd) :n "T" 'os-switch-to-term-and-cd)
;; Org notes ;; Org notes
:n "X" 'narf/org :n "X" 'doom/org
(:prefix "x" (:prefix "x"
:n "." 'narf/org-find-file :n "." 'doom/org-find-file
:n "/" 'narf/org-find-file-in-notes :n "/" 'doom/org-find-file-in-notes
:n "e" 'narf/org-find-exported-file)) :n "e" 'doom/org-find-exported-file))
(:localleader (:localleader
:n "\\" 'narf/neotree :n "\\" 'doom/neotree
:n "]" 'imenu-list-minor-mode :n "]" 'imenu-list-minor-mode
:n "b" 'narf:build :n "b" 'doom:build
:n "R" 'narf:repl :n "R" 'doom:repl
:v "R" 'narf:repl-eval :v "R" 'doom:repl-eval
:v "r" 'narf:eval-region :v "r" 'doom:eval-region
(:prefix "r" (:prefix "r"
:n "e" 'emr-show-refactor-menu :n "e" 'emr-show-refactor-menu
:n "r" 'narf:eval-buffer)) :n "r" 'doom:eval-buffer))
:nv "K" 'smart-up :nv "K" 'smart-up
@ -164,24 +164,24 @@
:n "=" (λ! (save-excursion (call-interactively 'evil-indent))) :n "=" (λ! (save-excursion (call-interactively 'evil-indent)))
:v "=" 'evil-indent :v "=" 'evil-indent
:n "zr" 'narf/evil-open-folds :n "zr" 'doom/evil-open-folds
:n "zm" 'narf/evil-close-folds :n "zm" 'doom/evil-close-folds
:n "zx" 'narf/kill-real-buffer :n "zx" 'doom/kill-real-buffer
:n "ZX" 'bury-buffer :n "ZX" 'bury-buffer
;; These are intentionally reversed ;; These are intentionally reversed
:n "]b" 'narf/next-real-buffer :n "]b" 'doom/next-real-buffer
:n "[b" 'narf/previous-real-buffer :n "[b" 'doom/previous-real-buffer
:m "]d" 'narf/vcs-next-hunk :m "]d" 'doom/vcs-next-hunk
:m "[d" 'narf/vcs-prev-hunk :m "[d" 'doom/vcs-prev-hunk
:m "]e" 'narf/flycheck-next-error :m "]e" 'doom/flycheck-next-error
:m "[e" 'narf/flycheck-previous-error :m "[e" 'doom/flycheck-previous-error
;; Switch tabs ;; Switch tabs
:n "]w" 'narf:switch-to-tab-right :n "]w" 'doom:switch-to-tab-right
:n "[w" 'narf:switch-to-tab-left :n "[w" 'doom:switch-to-tab-left
:m "gt" 'narf:switch-to-tab-right :m "gt" 'doom:switch-to-tab-right
:m "gT" 'narf:switch-to-tab-left :m "gT" 'doom:switch-to-tab-left
;; Increment/decrement number under cursor ;; Increment/decrement number under cursor
:n "g=" 'evil-numbers/inc-at-pt :n "g=" 'evil-numbers/inc-at-pt
@ -192,17 +192,17 @@
(call-interactively 'find-file-at-point) (call-interactively 'find-file-at-point)
(helm-mode 1)) (helm-mode 1))
:m "gD" 'narf/find-def :m "gD" 'doom/find-def
:n "gp" 'narf/reselect-paste :n "gp" 'doom/reselect-paste
:n "gc" 'evil-commentary :n "gc" 'evil-commentary
:n "gx" 'evil-exchange :n "gx" 'evil-exchange
:n "gr" 'narf:eval-region :n "gr" 'doom:eval-region
:n "gR" 'narf:eval-buffer :n "gR" 'doom:eval-buffer
:v "gR" 'narf:eval-region-and-replace :v "gR" 'doom:eval-region-and-replace
:m "g]" 'smart-right :m "g]" 'smart-right
:m "g[" 'smart-left :m "g[" 'smart-left
:v "@" 'narf/evil-macro-on-all-lines :v "@" 'doom/evil-macro-on-all-lines
:n "g@" 'narf/evil-macro-on-all-lines :n "g@" 'doom/evil-macro-on-all-lines
:v "." 'evil-repeat :v "." 'evil-repeat
@ -240,7 +240,7 @@
;; Textmate-esque newlines ;; Textmate-esque newlines
:i "<backspace>" 'backward-delete-char-untabify :i "<backspace>" 'backward-delete-char-untabify
:i "<M-backspace>" 'narf/backward-kill-to-bol-and-indent :i "<M-backspace>" 'doom/backward-kill-to-bol-and-indent
:i "<C-return>" 'evil-ret-and-indent :i "<C-return>" 'evil-ret-and-indent
;; Emacsien motions for insert mode ;; Emacsien motions for insert mode
@ -256,20 +256,20 @@
:n "!" 'rotate-text :n "!" 'rotate-text
(:map evil-window-map ; prefix "C-w" (:map evil-window-map ; prefix "C-w"
"u" 'narf/undo-window-change "u" 'doom/undo-window-change
;; Jump to new splits ;; Jump to new splits
"s" 'narf/evil-window-split "s" 'doom/evil-window-split
"v" 'narf/evil-window-vsplit "v" 'doom/evil-window-vsplit
;; Move window in one step ;; Move window in one step
"H" (λ! (narf/evil-window-move 'left)) "H" (λ! (doom/evil-window-move 'left))
"J" (λ! (narf/evil-window-move 'down)) "J" (λ! (doom/evil-window-move 'down))
"K" (λ! (narf/evil-window-move 'up)) "K" (λ! (doom/evil-window-move 'up))
"L" (λ! (narf/evil-window-move 'right)) "L" (λ! (doom/evil-window-move 'right))
"C-u" 'narf/undo-window-change "C-u" 'doom/undo-window-change
"C-r" 'narf/redo-window-change "C-r" 'doom/redo-window-change
"C-h" 'evil-window-left "C-h" 'evil-window-left
"C-j" 'evil-window-down "C-j" 'evil-window-down
"C-k" 'evil-window-up "C-k" 'evil-window-up
@ -289,17 +289,17 @@
;; `yasnippet' ;; `yasnippet'
:i [(tab)] 'yas-expand :i [(tab)] 'yas-expand
:v "<backtab>" 'narf/yas-insert-snippet :v "<backtab>" 'doom/yas-insert-snippet
;; `auto-yasnippet' ;; `auto-yasnippet'
:i "<C-tab>" 'aya-expand :i "<C-tab>" 'aya-expand
:nv "<C-tab>" 'aya-create :nv "<C-tab>" 'aya-create
;; Vim omni-complete emulation ;; Vim omni-complete emulation
:i "C-SPC" 'narf/company-complete :i "C-SPC" 'doom/company-complete
(:prefix "C-x" (:prefix "C-x"
:i "C-l" 'narf/company-whole-lines :i "C-l" 'doom/company-whole-lines
:i "C-k" 'narf/company-dict-or-keywords :i "C-k" 'doom/company-dict-or-keywords
:i "C-f" 'company-files :i "C-f" 'company-files
:i "C-]" 'company-tags :i "C-]" 'company-tags
:i "s" 'company-ispell :i "s" 'company-ispell
@ -320,7 +320,7 @@
"C-S-s" 'company-search-candidates "C-S-s" 'company-search-candidates
"C-s" 'company-filter-candidates "C-s" 'company-filter-candidates
"C-SPC" 'company-complete-common-or-cycle "C-SPC" 'company-complete-common-or-cycle
[tab] 'narf/company-complete-common-or-complete-full [tab] 'doom/company-complete-common-or-complete-full
"<backtab>" 'company-select-previous "<backtab>" 'company-select-previous
[escape] (λ! (company-abort) (evil-normal-state 1)) [escape] (λ! (company-abort) (evil-normal-state 1))
"<C-return>" 'helm-company) "<C-return>" 'helm-company)
@ -331,7 +331,7 @@
(:after help-mode (:after help-mode
(:map help-map (:map help-map
"e" 'narf/popup-messages) "e" 'doom/popup-messages)
(:map help-mode-map (:map help-mode-map
:n "]]" 'help-go-forward :n "]]" 'help-go-forward
:n "[[" 'help-go-back))) :n "[[" 'help-go-back)))

View file

@ -1,12 +1,12 @@
;;; my-commands.el ;;; my-commands.el
(evil-define-operator narf:evil-ex-global (beg end pattern command &optional invert) (evil-define-operator doom:evil-ex-global (beg end pattern command &optional invert)
"Rewritten :g[lobal] that will highlight buffer matches. Takes the same arguments." "Rewritten :g[lobal] that will highlight buffer matches. Takes the same arguments."
:motion mark-whole-buffer :move-point nil :motion mark-whole-buffer :move-point nil
(interactive "<r><g//><!>") (interactive "<r><g//><!>")
(evil-ex-global beg end pattern command invert)) (evil-ex-global beg end pattern command invert))
(evil-define-operator narf:align (&optional beg end bang pattern) (evil-define-operator doom:align (&optional beg end bang pattern)
"Ex interface to `align-regexp'. Accepts vim-style regexps." "Ex interface to `align-regexp'. Accepts vim-style regexps."
(interactive "<r><!><//>") (interactive "<r><!><//>")
(align-regexp (align-regexp
@ -18,87 +18,87 @@
1 1)) 1 1))
;;; Rewritten commands ;;; Rewritten commands
(ex! "g[lobal]" 'narf:evil-ex-global) (ex! "g[lobal]" 'doom:evil-ex-global)
;;; Custom commands ;;; Custom commands
;; Emacs utilities ;; Emacs utilities
(ex! "echo" 'narf:echo) (ex! "echo" 'doom:echo)
(ex! "minor" 'helm-describe-modes) ; list minor modes (ex! "minor" 'helm-describe-modes) ; list minor modes
;; Quick mapping keys to commands, allows :nmap \m !make ;; Quick mapping keys to commands, allows :nmap \m !make
(ex! "imap" 'narf:imap) (ex! "imap" 'doom:imap)
(ex! "mmap" 'narf:mmap) (ex! "mmap" 'doom:mmap)
(ex! "nmap" 'narf:nmap) (ex! "nmap" 'doom:nmap)
(ex! "omap" 'narf:omap) (ex! "omap" 'doom:omap)
(ex! "vmap" 'narf:vmap) (ex! "vmap" 'doom:vmap)
;; Editing ;; Editing
(ex! "@" 'narf/evil-macro-on-all-lines) (ex! "@" 'doom/evil-macro-on-all-lines)
(ex! "al[ign]" 'narf:align) (ex! "al[ign]" 'doom:align)
(ex! "htmle[nt]" 'narf/html-entities) ; encode/decode html entities (ex! "htmle[nt]" 'doom/html-entities) ; encode/decode html entities
(ex! "ie[dit]" 'evil-multiedit-ex-match) (ex! "ie[dit]" 'evil-multiedit-ex-match)
(ex! "na[rrow]" 'narf:narrow) (ex! "na[rrow]" 'doom:narrow)
(ex! "rec[ent]" 'narf:helm-recentf) ; show recent files (ex! "rec[ent]" 'doom:helm-recentf) ; show recent files
(ex! "ref[actor]" 'emr-show-refactor-menu) (ex! "ref[actor]" 'emr-show-refactor-menu)
(ex! "reo[rient]" 'narf/window-reorient) ; scroll all windows to left (ex! "reo[rient]" 'doom/window-reorient) ; scroll all windows to left
(ex! "retab" 'narf:whitespace-retab) (ex! "retab" 'doom:whitespace-retab)
(ex! "settr[im]" 'narf:toggle-delete-trailing-whitespace) (ex! "settr[im]" 'doom:toggle-delete-trailing-whitespace)
(ex! "snip[pets]" 'narf:yas-snippets) ; open snippet (ex! "snip[pets]" 'doom:yas-snippets) ; open snippet
(ex! "tsnip[pets]" 'narf:yas-file-templates) ; open file template (ex! "tsnip[pets]" 'doom:yas-file-templates) ; open file template
(ex! "wal[ign]" 'narf:whitespace-align) ; align by spaces (ex! "wal[ign]" 'doom:whitespace-align) ; align by spaces
;; External resources ;; External resources
(ex! "dash" 'narf:dash) ; look up in Dash.app (ex! "dash" 'doom:dash) ; look up in Dash.app
(ex! "http" 'httpd-start) ; start http server (ex! "http" 'httpd-start) ; start http server
(ex! "re[gex]" 'narf:regex) ; open re-builder (ex! "re[gex]" 'doom:regex) ; open re-builder
(ex! "repl" 'narf:repl) ; invoke or send to repl (ex! "repl" 'doom:repl) ; invoke or send to repl
(ex! "t[mux]" 'narf:tmux) ; send to tmux (ex! "t[mux]" 'doom:tmux) ; send to tmux
(ex! "tcd" 'narf:tmux-cd) ; cd to default-directory in tmux (ex! "tcd" 'doom:tmux-cd) ; cd to default-directory in tmux
(ex! "x" 'narf:send-to-scratch-or-org) (ex! "x" 'doom:send-to-scratch-or-org)
;; GIT ;; GIT
(ex! "ga[dd]" 'narf/vcs-stage-hunk) (ex! "ga[dd]" 'doom/vcs-stage-hunk)
(ex! "gbr[owse]" 'narf:git-remote-browse) ; show file in github/gitlab (ex! "gbr[owse]" 'doom:git-remote-browse) ; show file in github/gitlab
(ex! "gre[vert]" 'narf/vcs-revert-hunk) (ex! "gre[vert]" 'doom/vcs-revert-hunk)
;; Dealing with buffers ;; Dealing with buffers
(ex! "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer (ex! "k[ill]" 'doom/kill-real-buffer) ; Kill current buffer
(ex! "k[ill]all" 'narf:kill-all-buffers) ; Kill buffers (bang = in project) (ex! "k[ill]all" 'doom:kill-all-buffers) ; Kill buffers (bang = in project)
(ex! "k[ill]b" 'narf:kill-buried-buffers) ; Kill buried buffers (ex! "k[ill]b" 'doom:kill-buried-buffers) ; Kill buried buffers
(ex! "k[ill]m" 'narf:kill-matching-buffers) ; kill buffers by regexp (ex! "k[ill]m" 'doom:kill-matching-buffers) ; kill buffers by regexp
(ex! "k[ill]o" 'narf:kill-other-buffers) ; kill other buffers (ex! "k[ill]o" 'doom:kill-other-buffers) ; kill other buffers
(ex! "k[ill]u" 'narf/kill-unreal-buffers) ; kill unreal buffers (ex! "k[ill]u" 'doom/kill-unreal-buffers) ; kill unreal buffers
(ex! "l[ast]" 'narf/popup-last-buffer) ; pop up last popup (ex! "l[ast]" 'doom/popup-last-buffer) ; pop up last popup
(ex! "m[sg]" 'narf/popup-messages) ; open *messages* in popup (ex! "m[sg]" 'doom/popup-messages) ; open *messages* in popup
;; Project navigation ;; Project navigation
(ex! "a" 'helm-projectile-find-other-file) (ex! "a" 'helm-projectile-find-other-file)
(ex! "ag" 'narf:helm-ag-search) (ex! "ag" 'doom:helm-ag-search)
(ex! "ag[cw]d" 'narf:helm-ag-search-cwd) (ex! "ag[cw]d" 'doom:helm-ag-search-cwd)
(ex! "cd" 'narf:cd) (ex! "cd" 'doom:cd)
(ex! "se[arch]" 'narf:helm-swoop) ; in-file search (ex! "se[arch]" 'doom:helm-swoop) ; in-file search
;; Project tools ;; Project tools
(ex! "build" 'narf:build) (ex! "build" 'doom:build)
(ex! "ma[ke]" 'narf:build) (ex! "ma[ke]" 'doom:build)
;; File operations ;; File operations
(ex! "mv" 'narf:file-move) (ex! "mv" 'doom:file-move)
(ex! "rm" 'narf:file-delete) (ex! "rm" 'doom:file-delete)
;; Presentation/demo ;; Presentation/demo
(ex! "big" 'big-mode) (ex! "big" 'big-mode)
(ex! "full[scr]" 'narf:toggle-fullscreen) (ex! "full[scr]" 'doom:toggle-fullscreen)
;; Sessions/tabs ;; Sessions/tabs
(ex! "sl[oad]" 'narf:load-session) (ex! "sl[oad]" 'doom:load-session)
(ex! "ss[ave]" 'narf:save-session) (ex! "ss[ave]" 'doom:save-session)
(ex! "tabc[lose]" 'narf:kill-tab) (ex! "tabc[lose]" 'doom:kill-tab)
(ex! "tabc[lose]o" 'narf:kill-other-tabs) (ex! "tabc[lose]o" 'doom:kill-other-tabs)
(ex! "tabl[ast]" 'narf:switch-to-tab-last) (ex! "tabl[ast]" 'doom:switch-to-tab-last)
(ex! "tabn[ew]" 'narf:tab-create) (ex! "tabn[ew]" 'doom:tab-create)
(ex! "tabn[ext]" 'narf:switch-to-tab-right) (ex! "tabn[ext]" 'doom:switch-to-tab-right)
(ex! "tabp[rev]" 'narf:switch-to-tab-left) (ex! "tabp[rev]" 'doom:switch-to-tab-left)
(ex! "tabr[ename]" 'narf:tab-rename) (ex! "tabr[ename]" 'doom:tab-rename)
(ex! "tabs" 'narf/tab-display) (ex! "tabs" 'doom/tab-display)
;; Org-mode ;; Org-mode
(ex! "att[ach]" 'narf:org-attach) ; attach file to org file (ex! "att[ach]" 'doom:org-attach) ; attach file to org file
(ex! "link" 'narf:org-link) (ex! "link" 'doom:org-link)
(ex! "org" 'narf:org-helm-search) ; search org notes (ex! "org" 'doom:org-helm-search) ; search org notes
;; Plugins ;; Plugins
(ex! "er[rors]" 'narf/flycheck-errors) (ex! "er[rors]" 'doom/flycheck-errors)
;; Debuggers ;; Debuggers
(ex! "debug" 'narf:debug) (ex! "debug" 'doom:debug)
(provide 'my-commands) (provide 'my-commands)
;;; my-commands.el ends here ;;; my-commands.el ends here

Some files were not shown because too many files have changed in this diff Show more