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

@ -10,7 +10,7 @@
(mapc (lambda (rule)
(define-auto-insert
(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
("/\\.gitignore$" "__" gitignore-mode)
("/Dockerfile$" "__" dockerfile-mode)
@ -34,7 +34,7 @@
;; Elisp
("-test\\.el$" "__" emacs-ert-mode)
("/.+\\.el$" "__initfile" emacs-lisp-mode)
("\\(\\.emacs\\.d\\|narf-emacs\\)/private/\\(snippets\\|templates\\)/.+$"
("\\(\\.emacs\\.d\\|doom-emacs\\)/private/\\(snippets\\|templates\\)/.+$"
"__" snippet-mode)
;; Go

View file

@ -15,12 +15,12 @@
company-backends '((company-capf company-keywords))
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
;; Rewrites evil-complete to use company-dabbrev
(setq evil-complete-next-func 'narf/company-evil-complete-next
evil-complete-previous-func 'narf/company-evil-complete-previous)
(setq evil-complete-next-func 'doom/company-evil-complete-next
evil-complete-previous-func 'doom/company-evil-complete-previous)
(push 'company-sort-by-occurrence company-transformers)
(global-company-mode +1)
@ -45,7 +45,7 @@
(use-package 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
:after ac-php-company)

View file

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

View file

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

View file

@ -23,7 +23,7 @@
(use-package repl-toggle
:commands (rtog/toggle-repl rtog/add-repl)
:init
(defvar narf--repl-buffer nil)
(defvar doom--repl-buffer nil)
(defvar-local repl-p nil)
(setq rtog/mode-repl-alist '())
@ -61,14 +61,14 @@
:n "c" 'realgud:cmd-continue)
;; 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)
("s[tep]" . realgud:cmd-step)
("b[reak]" . narf:debug-toggle-breakpoint)
("b[reak]" . doom:debug-toggle-breakpoint)
("c[ontinue]" . realgud:cmd-continue))
(advice-add 'realgud-cmdbuf-init :after 'narf:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'narf:def-debug-off))
(advice-add 'realgud-cmdbuf-init :after 'doom:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'doom:def-debug-off))
(provide 'core-eval)
;;; core-eval.el ends here

View file

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

View file

@ -24,7 +24,7 @@
:n "RET" 'flycheck-error-list-goto-error)
;; 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
[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)
;;; 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
(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'
(advice-add 'helm :filter-args 'narf*helm-replace-prompt)
(advice-add 'helm :filter-args 'doom*helm-replace-prompt)
;; 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)))
@ -71,8 +71,8 @@
(use-package helm-buffers
:commands (helm-buffers-list helm-mini)
:config
(defvar narf-helm-force-project-buffers nil)
(defun helm*buffer-list (&rest _) (narf/get-buffer-names narf-helm-force-project-buffers))
(defvar doom-helm-force-project-buffers nil)
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
(advice-add 'helm-buffer-list :override 'helm*buffer-list))
(use-package helm-tags

View file

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

View file

@ -68,7 +68,7 @@
;; 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."
(interactive)
(let* ((path (f-full (s-replace "'" "\\'"
@ -85,16 +85,16 @@
(defmacro def-open-with! (id &optional app dir)
`(defun ,(intern (format "os-%s" id)) ()
(interactive)
(narf-open-with ,app ,dir)))
(doom-open-with ,app ,dir)))
(def-open-with! open-in-default-program)
(def-open-with! open-in-browser "Google Chrome")
(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-folder "Transmit" default-directory)
(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 ()
(interactive)
@ -102,8 +102,8 @@
(defun os-switch-to-term-and-cd ()
(interactive)
(narf:send-to-tmux (format "cd %s" (shell-quote-argument default-directory)))
(narf-switch-to-iterm))
(doom:send-to-tmux (format "cd %s" (shell-quote-argument default-directory)))
(doom-switch-to-iterm))
;; Open with external programs
(use-package openwith

View file

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

View file

@ -10,7 +10,7 @@
:config
(shackle-mode 1)
(setq shackle-rules
'(;; Debuggers
`(;; Debuggers
("\\`\\*\\(g\\|zsh\\|bash\\)db.*?\\*\\'" :align below :size 20 :regexp t)
("\\`\\*trepanjs.*?\\*\\'" :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)
("*processing-compilation*" :align below :size 10 :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)
("*Messages*" :align below :size 15 :select t)
("*Warnings*" :align below :size 10 :noselect t)
@ -57,26 +57,26 @@
;; Custom + REPLs
("*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 _)
(when (featurep 'repl-toggle)
(when (string-prefix-p "*" (buffer-name (get-buffer b)))
(with-current-buffer b repl-p)))))
: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!")
;; 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 'narf|hide-mode-line) ; No mode line in popups
(add-hook 'shackle-popup-hook 'doom|popup-init) ; Keep track of popups
(add-hook 'shackle-popup-hook 'doom|hide-mode-line) ; No mode line in popups
;; Prevents popups from messaging with windows-moving functions
(defun narf*save-popups (orig-fun &rest args)
(narf/popup-save (apply orig-fun args)))
(advice-add 'narf/evil-window-move :around 'narf*save-popups))
(defun doom*save-popups (orig-fun &rest args)
(doom/popup-save (apply orig-fun args)))
(advice-add 'doom/evil-window-move :around 'doom*save-popups))
;;
@ -143,41 +143,41 @@
helm-split-window-in-side-p t))
(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
;; Helm-ag needs a little coaxing for it to cooperate with shackle. Mostly to prevent
;; it from switching between windows and buffers.
(defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popup-compat activate)
(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)
(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)
(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)))
(after! quickrun
;; 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.
(defun narf*quickrun-close-popup (&optional _ _ _ _)
(defun doom*quickrun-close-popup (&optional _ _ _ _)
(let* ((buffer (get-buffer quickrun/buffer-name))
(window (and buffer (get-buffer-window buffer))))
(when buffer
(shut-up! (quickrun/kill-running-process))
(narf/popup-close window nil t))))
(advice-add 'quickrun :before 'narf*quickrun-close-popup)
(advice-add 'quickrun-region :before 'narf*quickrun-close-popup)
(doom/popup-close window nil t))))
(advice-add 'quickrun :before 'doom*quickrun-close-popup)
(advice-add 'quickrun-region :before 'doom*quickrun-close-popup)
;; 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)))
(with-selected-window window
(goto-char (point-min)))))
(add-hook 'quickrun-after-run-hook 'narf|quickrun-after-run)
(add-hook 'quickrun/mode-hook 'narf|hide-mode-line))
(add-hook 'quickrun-after-run-hook 'doom|quickrun-after-run)
(add-hook 'quickrun/mode-hook 'doom|hide-mode-line))
(add-hook! org-load
;; This ensures org-src-edit yields control of its buffer to shackle.
@ -196,7 +196,7 @@
args))
;; 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."
(interactive)
(if org-agenda-columns-active
@ -210,11 +210,11 @@
org-agenda-buffer nil))))
(map! :map org-agenda-mode-map
:e "<escape>" 'narf/org-agenda-quit
:e "ESC" 'narf/org-agenda-quit
:e [escape] 'narf/org-agenda-quit
"q" 'narf/org-agenda-quit
"Q" 'narf/org-agenda-quit))
:e "<escape>" 'doom/org-agenda-quit
:e "ESC" 'doom/org-agenda-quit
:e [escape] 'doom/org-agenda-quit
"q" 'doom/org-agenda-quit
"Q" 'doom/org-agenda-quit))
(after! realgud
;; This allows realgud debuggers to run in a popup.
@ -229,7 +229,7 @@
(if (and process (eq 'run (process-status process)))
(progn
(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-cmdbuf-info-in-debugger?= 't)
(realgud-cmdbuf-info-cmd-args= cmd-args)

View file

@ -13,7 +13,7 @@
(add-hook 'dired-mode-hook 'dired-omit-mode)
;; List directories first
(defun narf|dired-sort ()
(defun doom|dired-sort ()
"Dired sort hook to list directories first."
(save-excursion
(let (buffer-read-only)
@ -23,15 +23,15 @@
(fboundp 'dired-insert-set-properties)
(dired-insert-set-properties (point-min) (point-max)))
(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
(defun narf|create-non-existent-directory ()
(defun doom|create-non-existent-directory ()
(let ((parent-directory (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p parent-directory))
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
(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
@ -50,13 +50,13 @@
ido-enable-tramp-completion nil
ido-enable-tramp-completion t
ido-cr+-max-items 10000
ido-save-directory-list-file (concat narf-temp-dir "/ido.last"))
(add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind)
ido-save-directory-list-file (concat doom-temp-dir "/ido.last"))
(add-hook 'ido-setup-hook 'doom|ido-setup-home-keybind)
:config
(add-hook! ido-setup
(push "\\`.DS_Store$" 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)
(ido-vertical-mode 1)
@ -70,7 +70,7 @@
"C-w" 'ido-delete-backward-word-updir
"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
@ -92,19 +92,19 @@
neo-banner-message nil)
:config
(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
(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
(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
(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
(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)
(defun narf|neotree-init-keymap ()
(add-hook 'neotree-mode-hook 'doom|neotree-init-keymap)
(defun doom|neotree-init-keymap ()
(setq line-spacing 1)
(map! :map evil-motion-state-local-map
"ESC ESC" 'neotree-hide
@ -127,17 +127,17 @@
:config
(setq projectile-require-project-root nil
projectile-enable-caching t
projectile-cache-file (concat narf-temp-dir "/projectile.cache")
projectile-known-projects-file (concat narf-temp-dir "/projectile.projects")
projectile-cache-file (concat doom-temp-dir "/projectile.cache")
projectile-known-projects-file (concat doom-temp-dir "/projectile.projects")
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)
;; 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))
(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 "assets" projectile-globally-ignored-directories)

View file

@ -3,7 +3,7 @@
;; y/n instead of yes/no
(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
blink-matching-paren nil ; don't blink--too distracting
@ -45,12 +45,13 @@
(when window-system
(setq confirm-kill-emacs
(lambda (_)
(if (narf/get-real-buffers)
(if (doom/get-real-buffers)
(y-or-n-p ">> Gee, I dunno Brain... Are you sure?")
t))))
(load-theme narf-current-theme t)
(load-theme doom-current-theme t)
(tooltip-mode -1) ; show tooltips in echo area
;; set up minibuffer and fringe
(if (not window-system)
(menu-bar-mode -1)
@ -59,44 +60,44 @@
;; full filename in frame title
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
;; set fonts
(set-frame-font narf-default-font t)
(set-face-attribute 'default t :font narf-current-font)
(set-frame-font doom-default-font t)
(set-face-attribute 'default t :font doom-current-font)
;; standardize fringe width
(push `(left-fringe . ,narf-fringe-size) default-frame-alist)
(push `(right-fringe . ,narf-fringe-size) default-frame-alist)
(push `(left-fringe . ,doom-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
(add-hook! after-init (set-window-fringes (minibuffer-window) 0 0 nil))
;; Show tilde in margin on empty lines
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
(set-fringe-bitmap-face 'tilde 'fringe)
(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))
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde))
;; 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
(when (and (> emacs-major-version 24) (featurep 'eldoc))
(global-eldoc-mode -1))
;; 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")
(defface narf-fixme-face '((t (:inherit font-lock-warning-face)))
(defface doom-fixme-face '((t (:inherit font-lock-warning-face)))
"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")
(add-hook! (prog-mode emacs-lisp-mode css-mode)
(font-lock-add-keywords
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'narf-todo-face prepend)
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'narf-fixme-face prepend)
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'narf-note-face prepend))))
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'doom-todo-face prepend)
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'doom-fixme-face prepend)
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'doom-note-face prepend))))
;; Hide mode-line in help/compile window
(add-hook 'help-mode-hook 'narf|hide-mode-line)
(add-hook 'compilation-mode-hook 'narf|hide-mode-line)
(add-hook 'help-mode-hook 'doom|hide-mode-line)
(add-hook 'compilation-mode-hook 'doom|hide-mode-line)
;;
@ -107,17 +108,17 @@
:init
(add-hook! (prog-mode markdown-mode) 'hl-line-mode)
:config
(defvar-local narf--hl-line-mode nil)
(defvar-local doom--hl-line-mode nil)
(setq 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 narf|hl-line-off () (if narf--hl-line-mode (hl-line-mode -1)))
(defun doom|hl-line-on () (if doom--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
(add-hook 'evil-visual-state-entry-hook 'narf|hl-line-off)
(add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on))
(add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off)
(add-hook 'evil-visual-state-exit-hook 'doom|hl-line-on))
(use-package visual-fill-column :defer t
:config
@ -134,17 +135,17 @@
(after! editorconfig
(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
;; highlight-indentation-mode can display them consistently)
(add-hook! highlight-indentation-mode
(if highlight-indentation-mode
(progn
(narf/add-whitespace)
(add-hook 'after-save-hook 'narf/add-whitespace nil t)
(doom/add-whitespace)
(add-hook 'after-save-hook 'doom/add-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))))
(use-package highlight-numbers :commands (highlight-numbers-mode))
@ -161,16 +162,16 @@
:commands (rainbow-mode)
:init
;; 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
:commands nlinum-mode
:preface
(setq linum-format "%3d ")
(defvar nlinum-format "%4d ")
(defvar narf--hl-nlinum-overlay nil)
(defvar narf--hl-nlinum-line nil)
(defface narf-linum '((t (:inherit linum)))
(defvar doom--hl-nlinum-overlay nil)
(defvar doom--hl-nlinum-line nil)
(defface doom-linum '((t (:inherit linum)))
"Face for line in popups")
(defface linum-highlight-face '((t (:inherit linum)))
"Face for line highlights")
@ -179,7 +180,7 @@
(markdown-mode prog-mode scss-mode web-mode conf-mode)
'nlinum-mode)
(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
(add-hook! nlinum-mode
(setq nlinum--width
@ -193,8 +194,8 @@
(use-package spaceline
:init
(defvar-local narf--env-version nil)
(defvar-local narf--env-command nil)
(defvar-local doom--env-version nil)
(defvar-local doom--env-command nil)
(defvar powerline-height 26)
(defvar powerline-default-separator nil)
@ -209,7 +210,7 @@
(when buffer-file-name
(powerline-raw
(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))))
(concat (projectile-project-name) "/"
(if (> (length buffer-path) max-length)
@ -329,7 +330,7 @@ anzu to be enabled."
"The major mode, including process, environment and text-scale info."
(concat (format "%s" mode-name)
(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)
(/= text-scale-mode-amount 0)
(format " (%+d)" text-scale-mode-amount))))
@ -370,20 +371,20 @@ anzu to be enabled."
'((t (:foreground "#8DE6F7" :distant-foreground "#21889B")))
"Face for flycheck info feedback in the modeline.")
(defvar-local narf--flycheck-err-cache nil "")
(defvar-local narf--flycheck-cache nil "")
(defvar-local doom--flycheck-err-cache nil "")
(defvar-local doom--flycheck-cache nil "")
(spaceline-define-segment *flycheck
"Persistent and cached flycheck indicators in the mode-line."
(when (and (bound-and-true-p flycheck-mode)
(or flycheck-current-errors
(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)))
narf--flycheck-cache)
(and (setq narf--flycheck-err-cache flycheck-current-errors)
(setq narf--flycheck-cache
(let ((fe (narf/-flycheck-count 'error))
(fw (narf/-flycheck-count 'warning)))
doom--flycheck-cache)
(and (setq doom--flycheck-err-cache flycheck-current-errors)
(setq doom--flycheck-cache
(let ((fe (doom/-flycheck-count 'error))
(fw (doom/-flycheck-count 'warning)))
(concat
(if fe (propertize (format " ⚠%s " fe)
'face (if active

View file

@ -10,8 +10,8 @@
"/git/ignore$"))
(use-package git-gutter
:commands (git-gutter-mode narf/vcs-next-hunk narf/vcs-prev-hunk
narf/vcs-show-hunk narf/vcs-stage-hunk narf/vcs-revert-hunk)
:commands (git-gutter-mode doom/vcs-next-hunk doom/vcs-prev-hunk
doom/vcs-show-hunk doom/vcs-stage-hunk doom/vcs-revert-hunk)
:init
(add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode)
:config
@ -31,11 +31,11 @@
(advice-add 'evil-force-normal-state :after 'git-gutter)
(add-hook 'focus-in-hook 'git-gutter:update-all-windows)
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk))
(defalias 'doom/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'doom/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'doom/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'doom/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'doom/vcs-revert-hunk 'git-gutter:revert-hunk))
(after! vc-annotate
(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)
;; 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
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
automatically renamed to the project name.")
(use-package workgroups2
:when (display-graphic-p)
:init
(add-hook 'emacs-startup-hook 'workgroups-mode)
(setq-default
wg-session-file (concat narf-temp-dir "/workgroups/last")
wg-workgroup-directory (concat narf-temp-dir "/workgroups/")
wg-session-file (concat doom-temp-dir "/workgroups/last")
wg-workgroup-directory (concat doom-temp-dir "/workgroups/")
wg-first-wg-name "*untitled*"
wg-session-load-on-start 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-right "")
(add-hook 'emacs-startup-hook 'workgroups-mode)
:config
;; 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
(advice-add 'wg-change-modeline :override 'ignore)
;; 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
;; 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
;; switch to a different package in the future, like persp-mode, eyebrowse or wconf.
(defalias 'narf/tab-display 'narf/workgroup-display)
(defalias 'narf/helm-tabs 'narf:helm-wg)
(defalias 'narf/close-window-or-tab 'narf/close-window-or-workgroup)
(defalias 'narf:tab-create 'narf:workgroup-new)
(defalias 'narf:tab-rename 'narf:workgroup-rename)
(defalias 'narf:kill-tab 'narf:workgroup-delete)
(defalias 'narf:kill-other-tabs 'narf:kill-other-workgroups)
(defalias 'narf:switch-to-tab 'narf:switch-to-workgroup-at-index)
(defalias 'narf:switch-to-tab-left 'wg-switch-to-workgroup-left)
(defalias 'narf:switch-to-tab-right 'wg-switch-to-workgroup-right)
(defalias 'narf:switch-to-tab-last 'wg-switch-to-previous-workgroup))
(defalias 'doom/tab-display 'doom/workgroup-display)
(defalias 'doom/helm-tabs 'doom:helm-wg)
(defalias 'doom/close-window-or-tab 'doom/close-window-or-workgroup)
(defalias 'doom:tab-create 'doom:workgroup-new)
(defalias 'doom:tab-rename 'doom:workgroup-rename)
(defalias 'doom:kill-tab 'doom:workgroup-delete)
(defalias 'doom:kill-other-tabs 'doom:kill-other-workgroups)
(defalias 'doom:switch-to-tab 'doom:switch-to-workgroup-at-index)
(defalias 'doom:switch-to-tab-left 'wg-switch-to-workgroup-left)
(defalias 'doom:switch-to-tab-right 'wg-switch-to-workgroup-right)
(defalias 'doom:switch-to-tab-last 'wg-switch-to-previous-workgroup))
(provide 'core-workgroups)
;;; core-workgroups.el ends here

View file

@ -15,7 +15,7 @@
yas-also-auto-indent-first-line t
yas-wrap-around-region nil
;; 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))
(add-hook! (text-mode prog-mode snippet-mode markdown-mode org-mode)
@ -24,15 +24,15 @@
:config
(yas-reload-all)
(map! :map yas-keymap
"C-e" 'narf/yas-goto-end-of-field
"C-a" 'narf/yas-goto-start-of-field
"<M-right>" 'narf/yas-goto-end-of-field
"<M-left>" 'narf/yas-goto-start-of-field
"C-e" 'doom/yas-goto-end-of-field
"C-a" 'doom/yas-goto-start-of-field
"<M-right>" 'doom/yas-goto-end-of-field
"<M-left>" 'doom/yas-goto-start-of-field
"<S-tab>" 'yas-prev-field
"<M-backspace>" 'narf/yas-clear-to-sof
"<M-backspace>" 'doom/yas-clear-to-sof
"<escape>" 'evil-normal-state
[backspace] 'narf/yas-backspace
"<delete>" 'narf/yas-delete)
[backspace] 'doom/yas-backspace
"<delete>" 'doom/yas-delete)
;; Exit snippets on ESC in normal mode
(advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets)
@ -41,14 +41,14 @@
;; Once you're in normal mode, you're out
(add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet)
;; 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
(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
:commands (aya-create aya-expand aya-open-line aya-persist-snippet)
: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)
;;; core-yasnippet.el ends here

View file

@ -2,14 +2,14 @@
;;
;;; Naming conventions:
;;
;; narf-… A public variable/constant or function
;; narf--… An internal variable or function (non-interactive)
;; narf/… An autoloaded interactive function
;; narf:… An ex command
;; narf|… A hook
;; narf*… An advising function
;; narf.… Custom prefix commands
;; ! Macro or shortcut alias
;; doom-... A public variable/constant or function
;; doom--... An internal variable or function (non-interactive)
;; doom/... An autoloaded interactive function
;; doom:... An ex command
;; doom|... A hook
;; doom*... An advising function
;; doom.... Custom prefix commands
;; ...! Macro or shortcut alias
;;
;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
;;
@ -20,9 +20,9 @@
package--init-file-ensured t
package-enable-at-startup nil
package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("org" . "http://orgmode.org/elpa/"))
("org" . "http://orgmode.org/elpa/"))
ad-redefinition-action 'accept ; silence the advised function warnings
compilation-always-kill t ; kill compilation process before spawning another
@ -36,34 +36,31 @@
enable-recursive-minibuffers nil ; no minibufferception
idle-update-delay 2 ; update a little less often
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
ring-bell-function 'ignore ; silence of the bells!
save-interprogram-paste-before-kill 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
minibuffer-prompt-properties
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
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)
history-length 1000
vc-make-backup-files 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
create-lockfiles nil
backup-directory-alist `((".*" . ,(concat narf-temp-dir "/backup/")))
backup-directory-alist `((".*" . ,(concat doom-temp-dir "/backup/")))
;; Remember undo history
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
(setq locale-coding-system 'utf-8) ; pretty
@ -79,16 +76,16 @@
;; Variables
;;
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
(defvar doom-unreal-buffers '("^ ?\\*.+\\*"
image-mode
dired-mode
reb-mode
messages-buffer-mode)
"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
killed by `narf/kill-unreal-buffers', or after `narf/kill-real-buffer').")
ignored when using `doom:next-real-buffer' and `doom:previous-real-buffer' (or
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*"
"*Buffer List*" "*Ibuffer*" "*NeoTree*" "
*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*")
"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)
("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
gets killed.")
(defvar narf-project-root-files
(defvar doom-project-root-files
'(".git" ".hg" ".svn" ".project" "local.properties" "project.properties"
"rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt"
"build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json"
@ -130,10 +127,14 @@ folder is the root of a project or not.")
;;
(require 'f)
(unless (require 'autoloads nil t)
(load (concat narf-emacs-dir "/scripts/generate-autoloads.el"))
(require 'autoloads))
(require 'dash)
(require 's)
(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)
@ -147,7 +148,7 @@ folder is the root of a project or not.")
persistent-soft-flush
persistent-soft-location-readable
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
:commands (async-start
@ -168,17 +169,17 @@ folder is the root of a project or not.")
;; 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
`auto-mode-alist'. All elements of this alist are checked, meaning you can
enable multiple minor modes for the same regexp.")
(defun narf|enable-minor-mode-maybe ()
"Check file name against `narf-auto-minor-mode-alist'."
(defun doom|enable-minor-mode-maybe ()
"Check file name against `doom-auto-minor-mode-alist'."
(when buffer-file-name
(let ((name 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.
(setq name (file-name-sans-versions name))
;; Remove remote file name identification.
@ -190,7 +191,7 @@ enable multiple minor modes for the same regexp.")
(funcall (cdar alist) 1))
(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...
(advice-add 'display-startup-echo-area-message :override 'ignore)
;; ...so we can display our own
(message ":: Loaded in %.3fs"
(float-time (time-subtract (current-time) emacs-start-time))))
(setq emacs-end-time (float-time (time-subtract (current-time) emacs-start-time)))
(message ":: Loaded in %.3fs" emacs-end-time))
(provide 'core)
;;; core.el ends here

View file

@ -2,10 +2,10 @@
;; for ../core-auto-insert.el
;;;###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."
(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)
(funcall yas-dont-activate))
((consp yas-dont-activate)

View file

@ -1,7 +1,7 @@
;;; defuns-buffers.el
;;;###autoload (autoload 'narf:narrow "defuns-buffers" nil t)
(evil-define-operator narf:narrow (&optional beg end bang)
;;;###autoload (autoload 'doom:narrow "defuns-buffers" nil t)
(evil-define-operator doom:narrow (&optional beg end 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
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)))
;;;###autoload
(defun narf/set-read-only-region (begin end)
(defun doom/set-read-only-region (begin end)
"See http://stackoverflow.com/questions/7410125"
(let ((modified (buffer-modified-p)))
(add-text-properties begin end '(read-only t))
(set-buffer-modified-p modified)))
;;;###autoload
(defun narf/set-region-writeable (begin end)
(defun doom/set-region-writeable (begin end)
"See http://stackoverflow.com/questions/7410125"
(let ((modified (buffer-modified-p))
(inhibit-read-only t))
@ -41,7 +41,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
(defalias 'wg-save-session 'ignore))
;;;###autoload
(defun narf/get-buffers (&optional project-p)
(defun doom/get-buffers (&optional project-p)
"Get all buffers in the 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))
(buffer-list)))
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)
(lambda (b) (projectile-project-buffer-p b it))
buffers)
buffers)))
;;;###autoload
(defun narf/get-buffer-names (&optional project-p)
(defun doom/get-buffer-names (&optional project-p)
(mapcar (lambda (b) (buffer-name b))
(narf/get-buffers project-p)))
(doom/get-buffers project-p)))
;;;###autoload
(defun narf/get-visible-windows (&optional buffer-list)
(defun doom/get-visible-windows (&optional buffer-list)
(-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
(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)"
(-filter #'get-buffer-window (or buffer-list (narf/get-buffers))))
(-filter #'get-buffer-window (or buffer-list (doom/get-buffers))))
;;;###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)"
(let* ((buffers (or buffer-list (narf/get-buffers)))
(let* ((buffers (or buffer-list (doom/get-buffers)))
(old-len (length buffers)))
(-remove 'get-buffer-window buffers)))
;;;###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"
(--filter (string-match-p pattern (buffer-name it))
(or buffer-list (narf/get-buffers))))
(or buffer-list (doom/get-buffers))))
;;;###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"
(--filter (with-current-buffer it (memq major-mode modes))
(or buffer-list (narf/get-buffers))))
(or buffer-list (doom/get-buffers))))
;;;###autoload
(defun narf/get-real-buffers (&optional buffer-list)
(-filter #'narf/real-buffer-p (or buffer-list (narf/get-buffers))))
(defun doom/get-real-buffers (&optional buffer-list)
(-filter #'doom/real-buffer-p (or buffer-list (doom/get-buffers))))
;;;###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
the buffer if it is being displayed in another window."
(interactive)
(let (new-dir)
(if (string-match-p "^\\*scratch\\*" (or (buffer-name) ""))
(message "Already in the scratch buffer")
(setq new-dir (narf/project-root))
(if (string-match-p doom-buffer-name (or (buffer-name) ""))
(progn
(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)
(bury-buffer)
(kill-this-buffer)))
(if (narf/popup-p (selected-window))
(narf/popup-close)
(unless (narf/real-buffer-p (current-buffer))
(narf/previous-real-buffer)
(narf|update-scratch-buffer-cwd new-dir)))))
(kill-this-buffer))
(if (doom/popup-p (selected-window))
(doom/popup-close)
(unless (doom/real-buffer-p (current-buffer))
(doom/previous-real-buffer)
(doom|update-scratch-buffer-cwd new-dir))))))
;;;###autoload
(defun narf/kill-unreal-buffers ()
"Kill all buried, unreal buffers in current frame. See `narf-unreal-buffers'"
(defun doom/kill-unreal-buffers ()
"Kill all buried, unreal buffers in current frame. See `doom-unreal-buffers'"
(interactive)
(let* ((all-buffers (narf/get-buffers))
(real-buffers (narf/get-real-buffers all-buffers))
(let* ((all-buffers (doom/get-buffers))
(real-buffers (doom/get-real-buffers all-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)
(narf/kill-process-buffers)
(doom/kill-process-buffers)
(message "Cleaned up %s buffers" (length kill-list))))
;;;###autoload
(defun narf/kill-process-buffers ()
(defun doom/kill-process-buffers ()
"Kill all buffers that represent running processes and aren't visible."
(interactive)
(let ((buffer-list (narf/get-buffers))
(let ((buffer-list (doom/get-buffers))
(killed-processes 0))
(dolist (p (process-list))
(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
(not (string= process-name "server"))
(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)))
;;;###autoload
(defun narf/kill-matching-buffers (regexp &optional buffer-list)
(defun doom/kill-matching-buffers (regexp &optional buffer-list)
(interactive)
(let ((i 0))
(mapc (lambda (b)
(when (string-match-p regexp (buffer-name b))
(kill-buffer b)
(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)))
;;;###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
left, create a scratch buffer."
(let* ((start-buffer (current-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))
(max 25)
(i 0)
@ -169,16 +171,16 @@ left, create a scratch buffer."
(if (or (= realc 0)
(and (= realc 1) (eq (car real-buffers) (current-buffer))))
(progn
(narf|update-scratch-buffer-cwd)
(switch-to-buffer "*scratch*")
(doom|update-scratch-buffer-cwd)
(switch-to-buffer doom-buffer-name)
(message "Nowhere to go"))
(funcall move-func)
(while (and continue)
(let ((current-buffer (current-buffer)))
(cond ((or (eq current-buffer start-buffer)
(>= i max))
(narf|update-scratch-buffer-cwd)
(switch-to-buffer "*scratch*")
(doom|update-scratch-buffer-cwd)
(switch-to-buffer doom-buffer-name)
(setq continue nil))
((not (memq current-buffer real-buffers))
(funcall move-func))
@ -187,70 +189,70 @@ left, create a scratch buffer."
(cl-incf i)))))
;;;###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))))
(when (buffer-live-p buffer)
(not (--any? (if (stringp it)
(string-match-p it (buffer-name buffer))
(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>
;;;###autoload
(defun narf/next-real-buffer ()
(defun doom/next-real-buffer ()
"Switch to the next buffer and avoid special buffers."
(interactive)
(narf/cycle-real-buffers +1))
(doom/cycle-real-buffers +1))
;;;###autoload
(defun narf/previous-real-buffer ()
(defun doom/previous-real-buffer ()
"Switch to the previous buffer and avoid special buffers."
(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))
(affected 0))
(mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers)
(unless (narf/real-buffer-p)
(narf/previous-real-buffer))
(unless (doom/real-buffer-p)
(doom/previous-real-buffer))
(message "Killed %s buffers" affected)))
;;;###autoload (autoload 'narf:kill-all-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-all-buffers (&optional bang)
;;;###autoload (autoload 'doom:kill-all-buffers "defuns-buffers" nil t)
(evil-define-command doom:kill-all-buffers (&optional bang)
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
(interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang)))
(mapc (lambda (w) (when (eq (window-buffer w) (get-buffer "*scratch*"))
(doom--kill-buffers (doom/get-buffers (not bang)))
(mapc (lambda (w) (when (eq (window-buffer w) doom-buffer)
(delete-window w)))
(narf/get-visible-windows)))
(doom/get-visible-windows)))
;;;###autoload (autoload 'narf:kill-other-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-other-buffers (&optional bang)
;;;###autoload (autoload 'doom:kill-other-buffers "defuns-buffers" nil t)
(evil-define-command doom:kill-other-buffers (&optional bang)
"Kill all other project buffers. If BANG, kill *all* other buffers (in workgroup)."
(interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang))
(doom--kill-buffers (doom/get-buffers (not bang))
(lambda (b) (not (eq b (current-buffer)))))
(when bang
(delete-other-windows)))
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-buried-buffers (&optional bang)
;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command doom:kill-buried-buffers (&optional bang)
"Kill buried project buffers (in workgroup) and report how many it found. BANG = get all
buffers regardless of project."
(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)
(evil-define-command narf:kill-matching-buffers (&optional bang pattern)
;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command doom:kill-matching-buffers (&optional bang pattern)
"Kill project buffers matching regex pattern PATTERN. If BANG, then extend search to
buffers regardless of project."
:repeat nil
(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)
(evil-define-operator narf:send-to-scratch-or-org (&optional beg end bang)
;;;###autoload (autoload 'doom:send-to-scratch-or-org "defuns-buffers" nil t)
(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."
:move-point nil
:type inclusive
@ -261,9 +263,9 @@ buffers regardless of project."
(if bang
(org-capture-string text)
;; or scratch buffer by default
(let* ((project-dir (narf/project-root t))
(buffer-name "*scratch*"))
(narf/popup-buffer buffer-name)
(let* ((project-dir (doom/project-root t))
(buffer-name doom-buffer-name))
(doom/popup-buffer buffer-name)
(with-current-buffer buffer-name
(when project-dir
(cd project-dir))
@ -271,19 +273,19 @@ buffers regardless of project."
(funcall mode))
))))
;;;###autoload (autoload 'narf:cd "defuns-buffers" nil t)
(evil-define-command narf:cd (dir)
;;;###autoload (autoload 'doom:cd "defuns-buffers" nil t)
(evil-define-command doom:cd (dir)
"Ex-command alias for `cd'"
:repeat nil
(interactive "<f>")
(cd (if (zerop (length dir)) "~" dir)))
;;;###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."
(interactive)
(let ((confirm-kill-emacs nil))
(mapc 'kill-buffer (narf/get-buffers))
(mapc 'kill-buffer (doom/get-buffers))
(kill-this-buffer)
(delete-other-windows)
(wg-save-session t)

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
;;; 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))
`(,(car it) . ,(cdr it)))
((assoc-default char embrace--pairs-list)
@ -11,23 +11,23 @@
(t `(,char . ,char))))
;;;###autoload
(defun narf/embrace-escaped ()
(defun doom/embrace-escaped ()
"Escaped surround characters."
(let ((char (read-char "\\")))
(if (eq char 27)
(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")))
(cons (format text (car pair))
(format text (cdr pair)))))))
;;;###autoload
(defun narf/embrace-latex ()
(defun doom/embrace-latex ()
"LaTeX commands"
(cons (format "\\%s{" (read-string "\\")) "}"))
;;;###autoload
(defun narf/embrace-elisp-fn ()
(defun doom/embrace-elisp-fn ()
(cons (format "(%s " (or (read-string "(") "")) ")"))
(provide 'defuns-embrace)

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
;;; defuns-git.el
;;;### (autoload 'narf/git-remote-browse "defuns-git" nil t)
(evil-define-command narf:git-remote-browse (&optional bang)
;;;### (autoload 'doom:git-remote-browse "defuns-git" nil t)
(evil-define-command doom:git-remote-browse (&optional bang)
"Open the website for the current (or specified) version controlled FILE. If BANG,
then use hub to do it."
(interactive "<!>")
@ -11,7 +11,7 @@ then use hub to do it."
(error
(setq url (shell-command-to-string "hub browse -u --"))
(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"
(line-number-at-pos (region-beginning))
(line-number-at-pos (region-end)))))))))

View file

@ -1,8 +1,7 @@
;;; defuns-helm.el
;; see ../core-helm.el
;;;###autoload (autoload 'narf:helm-recentf "defuns-helm" nil t)
(evil-define-command narf:helm-recentf (&optional bang)
;;;###autoload (autoload 'doom:helm-recentf "defuns-helm" nil t)
(evil-define-command doom:helm-recentf (&optional bang)
"Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
`bang', then `search' is interpreted as regexp."
:repeat nil
@ -11,8 +10,8 @@
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp.
;;;###autoload (autoload 'narf:helm-ag-search "defuns-helm" nil t)
(evil-define-operator narf:helm-ag-search (beg end search regex-p &optional dir)
;;;###autoload (autoload 'doom:helm-ag-search "defuns-helm" nil t)
(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
selection, otherwise activate live ag searching in helm.
@ -22,7 +21,7 @@ DIR specifies the default-directory from which ag is run."
:repeat nil
(interactive "<r><a><!>")
(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 "))
(input "")
(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
;; as regexp
;;;###autoload (autoload 'narf:helm-ag-search-cwd "defuns-helm" nil t)
(evil-define-operator narf:helm-ag-search-cwd (beg end &optional search bang)
;;;###autoload (autoload 'doom:helm-ag-search-cwd "defuns-helm" nil t)
(evil-define-operator doom:helm-ag-search-cwd (beg end &optional search bang)
:type inclusive :repeat nil
(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
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
;; `scss-mode'
;;;###autoload (autoload 'narf:helm-swoop "defuns-helm" nil t)
(evil-define-command narf:helm-swoop (&optional search bang)
;;;###autoload (autoload 'doom:helm-swoop "defuns-helm" nil t)
(evil-define-command doom:helm-swoop (&optional search bang)
:repeat nil
(interactive "<a><!>")
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search)))
;;;###autoload
(defun narf/helm-find-in-emacsd ()
(defun doom/helm-find-in-emacsd ()
(interactive)
(in! narf-emacs-dir (helm-projectile-find-file)))
(in! doom-emacs-dir (helm-projectile-find-file)))
;;;###autoload
(defun narf/helm-find-in-dotfiles ()
(defun doom/helm-find-in-dotfiles ()
(interactive)
(in! (expand-file-name ".dotfiles" "~") (helm-projectile-find-file)))
;;;###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
buffers."
(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)))
;;;###autoload
(defun narf*helm-replace-prompt (plist)
(defun doom*helm-replace-prompt (plist)
(if (keywordp (car plist))
(setq plist (plist-put plist :prompt helm-global-prompt))
(setcar (nthcdr 2 plist) helm-global-prompt))
plist)
;;;###autoload
(defun narf*helm-hide-header (source &optional force)
(defun doom*helm-hide-header (source &optional force)
(setq header-line-format nil)
(narf|hide-mode-line))
(doom|hide-mode-line))
;;;###autoload
(defun narf*helm-hide-source-header-maybe ()
(defun doom*helm-hide-source-header-maybe ()
(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 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)
;;; defuns-helm.el ends here

View file

@ -1,7 +1,7 @@
;;; defuns-highlight-indentation.el
;;;###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
display consistent guides. Whitespace is stripped out on save, so this doesn't affect the
end file."
@ -38,7 +38,7 @@ end file."
nil)
;;;###autoload
(defun narf*hl-indent-guess-offset ()
(defun doom*hl-indent-guess-offset ()
(string-to-int (gethash 'indent_size (editorconfig-get-properties))))
(provide 'defuns-highlight-indentation)

View file

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

View file

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

View file

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

View file

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

View file

@ -1,16 +1,16 @@
;;; defuns-project.el
;;;###autoload
(defun narf/project-root (&optional strict-p)
"Get the path to the root of your project. Uses `narf-project-root-files' to
(defun doom/project-root (&optional strict-p)
"Get the path to the root of your project. Uses `doom-project-root-files' to
determine if a directory is a project."
(let (projectile-require-project-root strict-p)
(projectile-project-root)))
;;;###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."
(let ((root (or root (narf/project-root)))
(let ((root (or root (doom/project-root)))
(files (if (listp files) files (list files)))
(found-p (if files t)))
(while (and found-p files)
@ -21,7 +21,10 @@ determine if a directory is a project."
found-p))
;;;###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)
;;; defuns-project.el ends here

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
(defmacro def-company-backend! (hooks backends)
"Register a company backend for a mode."
(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) "-"))))
(quoted (eq (car-safe backends) 'quote)))
`(progn

View file

@ -7,12 +7,12 @@
(chars (plist-get rest :chars))
(words (plist-get rest :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
(defun ,fn-name ()
(electric-indent-local-mode +1)
,(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))))))
;;;###autoload
@ -23,7 +23,7 @@
(words (plist-get rest :words))
(patterns (plist-get rest :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
(defun ,fn-name ()
,(if symbols `(setq-local rotate-text-local-symbols ',symbols))

View file

@ -4,12 +4,12 @@
(defmacro def-builder! (mode command &optional build-file)
"Register major/minor MODE with build COMMAND. If FILES are provided, do an additional
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
(defun ,fn ()
(when (or (null ,build-file)
(narf/project-has-files ,build-file))
(setq narf--build-command '(,command . ,build-file))))
(doom/project-has-files ,build-file))
(setq doom--build-command '(,command . ,build-file))))
(add-hook! ,mode ',fn))))
;;;###autoload

View file

@ -9,7 +9,7 @@
(mapc (lambda (cmd) (evil-ex-define-cmd (car cmd) (cdr cmd)))
',commands))
(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))))
;; Shortcuts for the evil expression register

View file

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

View file

@ -2,16 +2,16 @@
;;;###autoload
(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
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\")
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
first time."
(add-hook! (focus-in find-file) 'narf|spaceline-env-update)
`(add-hook! ,modes (setq narf--env-command ,command)))
(add-hook! (focus-in find-file) 'doom|spaceline-env-update)
`(add-hook! ,modes (setq doom--env-command ,command)))
(provide 'defuns-spaceline)
;;; defuns-spaceline.el ends here

View file

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