Clean up + refactor
This commit is contained in:
parent
2e702b260e
commit
844039b99b
10 changed files with 215 additions and 271 deletions
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
;; Sane scroll settings
|
;; Sane scroll settings
|
||||||
scroll-margin 0
|
scroll-margin 0
|
||||||
scroll-conservatively 9999
|
scroll-conservatively 101
|
||||||
scroll-preserve-screen-position t
|
scroll-preserve-screen-position t
|
||||||
shift-select-mode nil
|
shift-select-mode nil
|
||||||
tabify-regexp "^\t* [ \t]+"
|
tabify-regexp "^\t* [ \t]+"
|
||||||
|
@ -22,11 +22,17 @@
|
||||||
'((tab-mark ?\t [?> ?\t])
|
'((tab-mark ?\t [?> ?\t])
|
||||||
(newline-mark 10 [36 10]))
|
(newline-mark 10 [36 10]))
|
||||||
truncate-lines t ; do not soft-wrap lines
|
truncate-lines t ; do not soft-wrap lines
|
||||||
truncate-partial-width-windows nil)
|
truncate-partial-width-windows nil
|
||||||
|
jit-lock-stealth-time 1)
|
||||||
|
|
||||||
|
|
||||||
;; Automatic minor modes ;;;;;;;;;;;
|
;; Automatic minor modes ;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defvar narf-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 ()
|
(defun narf|enable-minor-mode-maybe ()
|
||||||
"Check file name against `narf-auto-minor-mode-alist'."
|
"Check file name against `narf-auto-minor-mode-alist'."
|
||||||
(when buffer-file-name
|
(when buffer-file-name
|
||||||
|
@ -62,6 +68,9 @@
|
||||||
(add-hook! makefile-mode 'narf|enable-tabs) ; Use normal tabs in makefiles
|
(add-hook! makefile-mode 'narf|enable-tabs) ; Use normal tabs in makefiles
|
||||||
(add-hook! before-save 'delete-trailing-whitespace)
|
(add-hook! before-save 'delete-trailing-whitespace)
|
||||||
(add-hook! eldoc-mode (diminish 'eldoc-mode " ?"))
|
(add-hook! eldoc-mode (diminish 'eldoc-mode " ?"))
|
||||||
|
;; Line wrapping
|
||||||
|
(add-hook! prog-mode 'narf|enable-comment-hard-wrap)
|
||||||
|
(add-hook! auto-fill-mode (diminish 'auto-fill-function))
|
||||||
|
|
||||||
(defadvice delete-trailing-whitespace (around delete-trailing-whitespace-ignore-line activate)
|
(defadvice delete-trailing-whitespace (around delete-trailing-whitespace-ignore-line activate)
|
||||||
"Don't delete trailing whitespace on current line, if in insert mode."
|
"Don't delete trailing whitespace on current line, if in insert mode."
|
||||||
|
@ -71,10 +80,6 @@
|
||||||
(when (string-match-p "^[\s\t]*$" linestr)
|
(when (string-match-p "^[\s\t]*$" linestr)
|
||||||
(insert linestr))))
|
(insert linestr))))
|
||||||
|
|
||||||
;; Line wrapping
|
|
||||||
(add-hook! text-mode 'narf|enable-hard-wrap)
|
|
||||||
(add-hook! prog-mode 'narf|enable-comment-hard-wrap)
|
|
||||||
(add-hook! auto-fill-mode (diminish 'auto-fill-function))
|
|
||||||
;; If file is oversized...
|
;; If file is oversized...
|
||||||
(add-hook! find-file
|
(add-hook! find-file
|
||||||
(when (> (buffer-size) (* 1024 1024))
|
(when (> (buffer-size) (* 1024 1024))
|
||||||
|
@ -87,7 +92,7 @@
|
||||||
|
|
||||||
;; (global-whitespace-mode 1) ; Show whitespace
|
;; (global-whitespace-mode 1) ; Show whitespace
|
||||||
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
|
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
|
||||||
(global-auto-revert-mode 1) ; revert buffers for changed files
|
(global-auto-revert-mode -1) ; revert buffers for changed files
|
||||||
(electric-indent-mode -1)
|
(electric-indent-mode -1)
|
||||||
|
|
||||||
;; window config undo/redo
|
;; window config undo/redo
|
||||||
|
|
|
@ -84,9 +84,9 @@
|
||||||
:functions (iedit-current-occurrence-string iedit-restrict-region)
|
:functions (iedit-current-occurrence-string iedit-restrict-region)
|
||||||
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
|
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
|
||||||
:config
|
:config
|
||||||
(bind!
|
(bind! :v "SPC" 'narf:iedit-restrict-to-region
|
||||||
:v "SPC" 'narf:iedit-restrict-to-region
|
(:map evil-iedit-state-map
|
||||||
(:map evil-iedit-state-map ; Don't interfere with evil-snipe
|
;; Don't interfere with evil-snipe
|
||||||
"s" nil
|
"s" nil
|
||||||
"S" nil
|
"S" nil
|
||||||
"V" 'evil-visual-line
|
"V" 'evil-visual-line
|
||||||
|
@ -135,8 +135,7 @@
|
||||||
(evil-snipe-enable-incremental-highlight))))
|
(evil-snipe-enable-incremental-highlight))))
|
||||||
|
|
||||||
(use-package evil-numbers
|
(use-package evil-numbers
|
||||||
:commands (evil-numbers/inc-at-pt
|
:commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt))
|
||||||
evil-numbers/dec-at-pt))
|
|
||||||
|
|
||||||
(use-package evil-search-highlight-persist
|
(use-package evil-search-highlight-persist
|
||||||
:config
|
:config
|
||||||
|
@ -168,8 +167,12 @@
|
||||||
(evil-space-setup "?" "N" "n")
|
(evil-space-setup "?" "N" "n")
|
||||||
|
|
||||||
(after! evil-snipe
|
(after! evil-snipe
|
||||||
(mapc (lambda (x) (evil-space-setup x 'evil-snipe-repeat 'evil-snipe-repeat-reverse))
|
(evil-space-setup 'evil-snipe-f 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||||
'(evil-snipe-f evil-snipe-F evil-snipe-t evil-snipe-T evil-snipe-s evil-snipe-S)))
|
(evil-space-setup 'evil-snipe-F 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||||
|
(evil-space-setup 'evil-snipe-t 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||||
|
(evil-space-setup 'evil-snipe-T 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||||
|
(evil-space-setup 'evil-snipe-s 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||||
|
(evil-space-setup 'evil-snipe-S 'evil-snipe-repeat 'evil-snipe-repeat-reverse))
|
||||||
|
|
||||||
(after! evil-visualstar
|
(after! evil-visualstar
|
||||||
(evil-space-setup 'evil-visualstar/begin-search-forward "n" "N")
|
(evil-space-setup 'evil-visualstar/begin-search-forward "n" "N")
|
||||||
|
|
|
@ -5,14 +5,16 @@
|
||||||
(fringe-mode '(1 . 8))
|
(fringe-mode '(1 . 8))
|
||||||
(setq frame-title-format '(buffer-file-name "%f" ("%b"))))
|
(setq frame-title-format '(buffer-file-name "%f" ("%b"))))
|
||||||
|
|
||||||
(setq show-paren-delay 0)
|
;; Highlight matching parens
|
||||||
|
(setq show-paren-delay 0.05)
|
||||||
|
(show-paren-mode 1)
|
||||||
|
|
||||||
(global-hl-line-mode 1) ; do highlight line
|
(global-hl-line-mode 1) ; do highlight line
|
||||||
(blink-cursor-mode 1) ; do blink cursor
|
(blink-cursor-mode 1) ; do blink cursor
|
||||||
(line-number-mode 1) ; do show line no in modeline
|
(line-number-mode 1) ; do show line no in modeline
|
||||||
(column-number-mode 1) ; do show col no in modeline
|
(column-number-mode 1) ; do show col no in modeline
|
||||||
(tooltip-mode -1) ; don't show tooltips
|
(tooltip-mode -1) ; don't show tooltips
|
||||||
;; (size-indication-mode 1) ; do show file size
|
(size-indication-mode -1)
|
||||||
|
|
||||||
(setq-default
|
(setq-default
|
||||||
;; Multiple cursors across buffers cause a strange redraw delay for
|
;; Multiple cursors across buffers cause a strange redraw delay for
|
||||||
|
@ -36,7 +38,6 @@
|
||||||
(add-hook! text-mode 'fci-mode))
|
(add-hook! text-mode 'fci-mode))
|
||||||
|
|
||||||
(use-package nlinum ; line numbers
|
(use-package nlinum ; line numbers
|
||||||
:disabled t
|
|
||||||
:defer t
|
:defer t
|
||||||
:defines nlinum--width
|
:defines nlinum--width
|
||||||
:preface
|
:preface
|
||||||
|
@ -48,8 +49,8 @@
|
||||||
(defvar narf--hl-nlinum-line nil)
|
(defvar narf--hl-nlinum-line nil)
|
||||||
(defvar nlinum-format " %3d ")
|
(defvar nlinum-format " %3d ")
|
||||||
:init
|
:init
|
||||||
;; Highlight line number
|
|
||||||
(defun narf|nlinum-unhl-line ()
|
(defun narf|nlinum-unhl-line ()
|
||||||
|
"Highlight line number"
|
||||||
(when narf--hl-nlinum-overlay
|
(when narf--hl-nlinum-overlay
|
||||||
(let* ((ov narf--hl-nlinum-overlay)
|
(let* ((ov narf--hl-nlinum-overlay)
|
||||||
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
narf--hl-nlinum-line nil))))
|
narf--hl-nlinum-line nil))))
|
||||||
|
|
||||||
(defun narf|nlinum-hl-line (&optional line)
|
(defun narf|nlinum-hl-line (&optional line)
|
||||||
|
"Unhighlight line number"
|
||||||
(let ((line-no (or line (line-number-at-pos (point)))))
|
(let ((line-no (or line (line-number-at-pos (point)))))
|
||||||
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||||
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
||||||
|
@ -83,8 +85,7 @@
|
||||||
|
|
||||||
(defun narf|nlinum-enable ()
|
(defun narf|nlinum-enable ()
|
||||||
(nlinum-mode +1)
|
(nlinum-mode +1)
|
||||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line))
|
(add-hook! post-command 'narf|nlinum-hl-line))
|
||||||
|
|
||||||
(defun narf|nlinum-disable ()
|
(defun narf|nlinum-disable ()
|
||||||
(nlinum-mode -1)
|
(nlinum-mode -1)
|
||||||
(remove-hook 'post-command-hook 'narf|nlinum-hl-line)
|
(remove-hook 'post-command-hook 'narf|nlinum-hl-line)
|
||||||
|
@ -99,27 +100,40 @@
|
||||||
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(use-package spaceline-segments
|
(use-package spaceline-segments
|
||||||
:init
|
:config
|
||||||
(setq-default
|
(setq-default
|
||||||
powerline-default-separator 'wave
|
powerline-default-separator 'wave
|
||||||
powerline-height 18)
|
powerline-height 18)
|
||||||
:config
|
|
||||||
(require 'spaceline-segments)
|
(require 'spaceline-segments)
|
||||||
|
|
||||||
|
;; Modeline caches
|
||||||
|
(defvar narf--spaceline-file-path nil)
|
||||||
|
(make-variable-buffer-local 'narf--spaceline-file-path)
|
||||||
|
|
||||||
|
(defvar narf--spaceline-vc nil)
|
||||||
|
(make-variable-buffer-local 'narf--spaceline-vc)
|
||||||
|
(add-hook! before-save (setq narf--spaceline-vc nil))
|
||||||
|
|
||||||
|
;; Custom modeline segments
|
||||||
(spaceline-define-segment narf-buffer-path
|
(spaceline-define-segment narf-buffer-path
|
||||||
"Name of buffer."
|
"Name of buffer."
|
||||||
(concat (let ((buffer-path (buffer-file-name)))
|
(concat (or narf--spaceline-file-path
|
||||||
|
(setq narf--spaceline-file-path
|
||||||
|
(let ((buffer-path (buffer-file-name)))
|
||||||
(if (and buffer-path (file-exists-p buffer-path))
|
(if (and buffer-path (file-exists-p buffer-path))
|
||||||
(progn
|
(progn
|
||||||
(setq buffer-path (abbreviate-file-name buffer-path))
|
(let* ((max-length (/ (window-width) 2))
|
||||||
(let ((path (file-relative-name buffer-path (file-name-directory (narf/project-root))))
|
(project-path (narf/project-root))
|
||||||
(max-length (/ (window-width) 2)))
|
(path (file-relative-name
|
||||||
|
buffer-path (file-name-directory (if (string-match "/+\\'" project-path)
|
||||||
|
(replace-match "" t t project-path)
|
||||||
|
project-path)))))
|
||||||
(if (> (length path) max-length)
|
(if (> (length path) max-length)
|
||||||
(concat "…" (replace-regexp-in-string
|
(concat "…" (replace-regexp-in-string
|
||||||
"^.*?/" "/"
|
"^.*?/" "/"
|
||||||
(let ((l (length path))) (substring path (- l max-length) l))))
|
(let ((l (length path))) (substring path (- l max-length) l))))
|
||||||
path)))
|
path)))
|
||||||
(powerline-buffer-id)))
|
(powerline-buffer-id)))))
|
||||||
(if (buffer-modified-p)
|
(if (buffer-modified-p)
|
||||||
(propertize "*" 'font-lock-face `(:inherit ,other-face :foreground "orange")))
|
(propertize "*" 'font-lock-face `(:inherit ,other-face :foreground "orange")))
|
||||||
" ")
|
" ")
|
||||||
|
@ -127,15 +141,11 @@
|
||||||
|
|
||||||
(spaceline-define-segment narf-buffer-encoding-abbrev
|
(spaceline-define-segment narf-buffer-encoding-abbrev
|
||||||
"The line ending convention used in the buffer."
|
"The line ending convention used in the buffer."
|
||||||
(let ((buf-coding (format "%s" buffer-file-coding-system)))
|
(let ((buf-coding (symbol-name buffer-file-coding-system)))
|
||||||
(if (string-match "\\(dos\\|unix\\|mac\\)" buf-coding)
|
(if (string-match "\\(dos\\|unix\\|mac\\)" buf-coding)
|
||||||
(match-string 1 buf-coding)
|
(match-string 1 buf-coding)
|
||||||
buf-coding))
|
buf-coding))
|
||||||
:when (not (string-match "unix" (symbol-name buffer-file-coding-system))))
|
:when (not (string-match-p "unix" (symbol-name buffer-file-coding-system))))
|
||||||
|
|
||||||
(spaceline-define-segment narf-line-column
|
|
||||||
"The current line and column numbers."
|
|
||||||
"%l/%c")
|
|
||||||
|
|
||||||
(spaceline-define-segment narf-buffer-position
|
(spaceline-define-segment narf-buffer-position
|
||||||
"A more vim-like buffer position."
|
"A more vim-like buffer position."
|
||||||
|
@ -146,7 +156,9 @@
|
||||||
|
|
||||||
(spaceline-define-segment narf-vc
|
(spaceline-define-segment narf-vc
|
||||||
"Version control info"
|
"Version control info"
|
||||||
(replace-regexp-in-string (regexp-quote (symbol-name (vc-deduce-backend))) "" (s-trim (powerline-vc)) t t)
|
(or narf--spaceline-vc
|
||||||
|
(replace-regexp-in-string (regexp-quote (symbol-name (vc-deduce-backend)))
|
||||||
|
"" (s-trim (powerline-vc)) t t))
|
||||||
:when (powerline-vc))
|
:when (powerline-vc))
|
||||||
|
|
||||||
(spaceline-define-segment narf-hud
|
(spaceline-define-segment narf-hud
|
||||||
|
@ -154,20 +166,18 @@
|
||||||
(powerline-hud highlight-face default-face)
|
(powerline-hud highlight-face default-face)
|
||||||
:tight t)
|
:tight t)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Initialize modeline
|
||||||
|
|
||||||
(spaceline-install
|
(spaceline-install
|
||||||
;; Left side
|
;; Left side
|
||||||
'(((narf-buffer-path :face other-face) remote-host)
|
'(((narf-buffer-path :face other-face) remote-host)
|
||||||
((flycheck-error flycheck-warning flycheck-info)
|
((flycheck-error flycheck-warning flycheck-info) :when active)
|
||||||
:when active)
|
|
||||||
(narf-vc :face other-face :when active))
|
(narf-vc :face other-face :when active))
|
||||||
;; Right side
|
;; Right side
|
||||||
'(selection-info
|
'(selection-info
|
||||||
narf-buffer-encoding-abbrev
|
narf-buffer-encoding-abbrev
|
||||||
(major-mode (minor-modes process :when active))
|
(major-mode (minor-modes :separator " ") process :when active)
|
||||||
(global :when active)
|
(global :when active)
|
||||||
(narf-line-column narf-buffer-position :face powerline-border)
|
narf-buffer-position
|
||||||
narf-hud)))
|
narf-hud)))
|
||||||
|
|
||||||
(provide 'core-ui)
|
(provide 'core-ui)
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
|
|
||||||
(defconst narf--splash-buffer-name "*narf*")
|
(defconst narf--splash-buffer-name "*narf*")
|
||||||
|
|
||||||
(defvar narf-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.")
|
|
||||||
|
|
||||||
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
|
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
|
||||||
image-mode
|
image-mode
|
||||||
dired-mode
|
dired-mode
|
||||||
|
@ -50,6 +45,5 @@ gets killed.")
|
||||||
"A list of files that count as 'project files', which determine whether a
|
"A list of files that count as 'project files', which determine whether a
|
||||||
folder is the root of a project or not.")
|
folder is the root of a project or not.")
|
||||||
|
|
||||||
|
|
||||||
(provide 'core-vars)
|
(provide 'core-vars)
|
||||||
;;; core-vars.el ends here
|
;;; core-vars.el ends here
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
;; see lib/yasnippet-macros.el
|
;; see lib/yasnippet-macros.el
|
||||||
|
|
||||||
(use-package yasnippet
|
(use-package yasnippet
|
||||||
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
|
:mode ("emacs\\.d/private/\\(snippets\\|templates\\)/.+$" . snippet-mode)
|
||||||
:diminish (yas-minor-mode . "Y")
|
:diminish (yas-minor-mode . "Y")
|
||||||
:commands (yas-minor-mode
|
:commands (yas-minor-mode
|
||||||
yas-minor-mode-on
|
yas-minor-mode-on
|
||||||
|
|
174
core/core.el
174
core/core.el
|
@ -5,133 +5,46 @@
|
||||||
;; narf-... A public variable/constant or function
|
;; narf-... A public variable/constant or function
|
||||||
;; narf--... An internal variable or function (non-interactive)
|
;; narf--... An internal variable or function (non-interactive)
|
||||||
;; narf/... An autoloaded interactive function
|
;; narf/... An autoloaded interactive function
|
||||||
;; narf:... An ex command
|
;; narf:... An ex command OR keybind function
|
||||||
;; narf|... A hook
|
;; narf|... A hook
|
||||||
;; narf*... An advising function
|
;; narf*... An advising function
|
||||||
;; ...! Macro
|
;; ...! Macro
|
||||||
;;
|
;;
|
||||||
;;; Bootstrap:
|
;;;
|
||||||
|
|
||||||
(unless (require 'autoloads nil t)
|
|
||||||
(load (concat narf-emacs-dir "scripts/generate-autoloads.el"))
|
|
||||||
(require 'autoloads))
|
|
||||||
|
|
||||||
(require 'core-vars)
|
|
||||||
(require 'core-defuns)
|
|
||||||
(require 'diminish)
|
|
||||||
|
|
||||||
;; NARF!
|
|
||||||
(define-minor-mode narf-mode "Narf, yoink, poit."
|
|
||||||
:global t
|
|
||||||
:init-value t
|
|
||||||
:keymap (make-sparse-keymap))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(eval-when-compile
|
|
||||||
(require 's)
|
|
||||||
(require 'dash)
|
|
||||||
(require 'f)
|
|
||||||
|
|
||||||
(defvar use-package-verbose narf-debug-mode)
|
|
||||||
;; (setq use-package-expand-minimally (not narf-debug-mode))
|
|
||||||
(require 'use-package)
|
|
||||||
|
|
||||||
(defun use-package--add-keyword (keyword after)
|
|
||||||
(setq use-package-keywords
|
|
||||||
(-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords)
|
|
||||||
keyword use-package-keywords)))
|
|
||||||
|
|
||||||
(progn ; remap :bind to bind! macro instead of bind-keys
|
|
||||||
;; (defun use-package-handler/:bind
|
|
||||||
;; (name-symbol keyword arg rest state &optional override)
|
|
||||||
;; (let ((commands (mapcar #'cdr arg)))
|
|
||||||
;; (use-package-concat
|
|
||||||
;; (use-package-process-keywords name-symbol
|
|
||||||
;; (use-package-sort-keywords
|
|
||||||
;; (use-package-plist-maybe-put rest :defer t))
|
|
||||||
;; (use-package-plist-append state :commands commands))
|
|
||||||
;; `((ignore (,bind! ,@arg))))))
|
|
||||||
)
|
|
||||||
|
|
||||||
(progn ; add :after to use-package
|
|
||||||
(use-package--add-keyword :after :load-path)
|
|
||||||
|
|
||||||
(defalias 'use-package-normalize/:after 'use-package-normalize-symlist)
|
|
||||||
|
|
||||||
(defun use-package-handler/:after (name-symbol keyword arg rest state)
|
|
||||||
(let ((body (use-package-process-keywords name-symbol rest state)))
|
|
||||||
(if (null arg)
|
|
||||||
body
|
|
||||||
(use-package-concat
|
|
||||||
(use-package-process-keywords name-symbol
|
|
||||||
(use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state)
|
|
||||||
(apply #'nconc
|
|
||||||
(mapcar (lambda (feature)
|
|
||||||
`((after! ,feature (require ',name-symbol))))
|
|
||||||
(delete-dups arg))))))))
|
|
||||||
|
|
||||||
;; Make any folders needed
|
|
||||||
(dolist (file '("" "undo" "backup"))
|
|
||||||
(let ((path (concat narf-temp-dir file)))
|
|
||||||
(unless (file-exists-p path)
|
|
||||||
(make-directory path t)))))
|
|
||||||
|
|
||||||
;; Emacs configuration ;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;;; UTF-8 please
|
|
||||||
(setq locale-coding-system 'utf-8) ; pretty
|
|
||||||
(set-terminal-coding-system 'utf-8) ; pretty
|
|
||||||
(set-keyboard-coding-system 'utf-8) ; pretty
|
|
||||||
(set-selection-coding-system 'utf-8) ; please
|
|
||||||
(prefer-coding-system 'utf-8) ; with sugar on top
|
|
||||||
|
|
||||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
|
||||||
|
|
||||||
(setq-default
|
(setq-default
|
||||||
confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?"))
|
|
||||||
|
|
||||||
gc-cons-threshold 20000000 ; avoid garbage collection
|
|
||||||
enable-recursive-minibuffers t ; minibufferception
|
|
||||||
echo-keystrokes 0.02 ; show me those keystrokes
|
|
||||||
ring-bell-function 'ignore ; silence of the bells!
|
|
||||||
|
|
||||||
inhibit-startup-screen t ; don't show emacs start screen
|
|
||||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
|
||||||
initial-major-mode 'text-mode ; initial scratch buffer mode
|
|
||||||
initial-scratch-message nil
|
|
||||||
major-mode 'text-mode
|
|
||||||
|
|
||||||
compilation-always-kill t
|
compilation-always-kill t
|
||||||
compilation-ask-about-save nil
|
compilation-ask-about-save nil
|
||||||
compilation-scroll-output t
|
compilation-scroll-output t
|
||||||
|
confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?"))
|
||||||
sentence-end-double-space nil ; sentences end with periods. period.
|
echo-keystrokes 0.02 ; show me those keystrokes
|
||||||
|
|
||||||
ediff-diff-options "-w"
|
ediff-diff-options "-w"
|
||||||
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
||||||
ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames
|
ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames
|
||||||
|
enable-recursive-minibuffers t ; minibufferception
|
||||||
;; Don't save clipboard contents into kill-ring before replacing them
|
history-length 1000
|
||||||
|
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
|
save-interprogram-paste-before-kill nil
|
||||||
|
sentence-end-double-space nil
|
||||||
|
|
||||||
;; Don't let the cursor go into minibuffer prompt
|
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||||
;; from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||||
minibuffer-prompt-properties
|
|
||||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
|
||||||
|
|
||||||
;; remove annoying ellipsis when printing sexp in message buffer
|
;; remove annoying ellipsis when printing sexp in message buffer
|
||||||
eval-expression-print-length nil
|
eval-expression-print-length nil
|
||||||
eval-expression-print-level nil
|
eval-expression-print-level nil
|
||||||
|
|
||||||
history-length 1000
|
|
||||||
|
|
||||||
;; Backups ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; Disable all backups (that's what git/dropbox are for)
|
;; Disable all backups (that's what git/dropbox are for)
|
||||||
bookmark-save-flag t
|
bookmark-save-flag t
|
||||||
bookmark-default-file (! (concat narf-temp-dir "bookmarks"))
|
bookmark-default-file (! (concat narf-temp-dir "bookmarks"))
|
||||||
auto-save-default nil
|
auto-save-default nil
|
||||||
auto-save-list-file-name (! (concat narf-temp-dir "autosave"))
|
auto-save-list-file-name (! (concat narf-temp-dir "autosave"))
|
||||||
|
|
||||||
;; In case I want to reactivate backup files
|
;; In case I want to reactivate backup files
|
||||||
make-backup-files nil
|
make-backup-files nil
|
||||||
create-lockfiles nil
|
create-lockfiles nil
|
||||||
|
@ -141,25 +54,60 @@
|
||||||
undo-tree-auto-save-history t
|
undo-tree-auto-save-history t
|
||||||
undo-tree-history-directory-alist `(("." . ,(! (concat narf-temp-dir "undo/")))))
|
undo-tree-history-directory-alist `(("." . ,(! (concat narf-temp-dir "undo/")))))
|
||||||
|
|
||||||
|
;;; UTF-8 please
|
||||||
|
(setq locale-coding-system 'utf-8) ; pretty
|
||||||
|
(set-terminal-coding-system 'utf-8) ; pretty
|
||||||
|
(set-keyboard-coding-system 'utf-8) ; pretty
|
||||||
|
(set-selection-coding-system 'utf-8) ; please
|
||||||
|
(prefer-coding-system 'utf-8) ; with sugar on top
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||||
|
|
||||||
|
|
||||||
|
;; Bootstrap ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(unless (require 'autoloads nil t)
|
||||||
|
(load (concat narf-emacs-dir "scripts/generate-autoloads.el"))
|
||||||
|
(require 'autoloads))
|
||||||
|
(require 'core-vars)
|
||||||
|
(require 'core-defuns)
|
||||||
|
(require 'diminish)
|
||||||
|
|
||||||
|
;; NARF!
|
||||||
|
(define-minor-mode narf-mode "Narf, yoink, poit."
|
||||||
|
:global t :init-value t :keymap (make-sparse-keymap))
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(defvar use-package-verbose narf-debug-mode)
|
||||||
|
(require 'dash)
|
||||||
|
(require 'use-package)
|
||||||
|
(require 'defuns-use-package)
|
||||||
|
|
||||||
|
;; Make any folders needed
|
||||||
|
(dolist (file '("" "undo" "backup"))
|
||||||
|
(let ((path (concat narf-temp-dir file)))
|
||||||
|
(unless (file-exists-p path)
|
||||||
|
(make-directory path t)))))
|
||||||
|
|
||||||
;; Save history across sessions
|
;; Save history across sessions
|
||||||
(require 'savehist)
|
(use-package savehist
|
||||||
(setq savehist-file (! (concat narf-temp-dir "savehist"))
|
:config
|
||||||
|
(setq savehist-file (! (concat narf-temp-dir "savehist"))
|
||||||
savehist-additional-variables
|
savehist-additional-variables
|
||||||
'(kill-ring global-mark-ring search-ring regexp-search-ring extended-command-history))
|
'(kill-ring global-mark-ring search-ring regexp-search-ring extended-command-history))
|
||||||
(savehist-mode 1)
|
(savehist-mode 1))
|
||||||
|
|
||||||
(require 'recentf)
|
(use-package recentf
|
||||||
(setq recentf-save-file (! (concat narf-temp-dir "recentf"))
|
:config
|
||||||
|
(setq recentf-save-file (! (concat narf-temp-dir "recentf"))
|
||||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||||
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$" "wg-default"
|
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$" "wg-default"
|
||||||
"/company-statistics-cache.el$")
|
"/company-statistics-cache.el$")
|
||||||
recentf-max-menu-items 0
|
recentf-max-menu-items 0
|
||||||
recentf-max-saved-items 250
|
recentf-max-saved-items 250
|
||||||
recentf-auto-cleanup 600)
|
recentf-auto-cleanup 600)
|
||||||
(recentf-mode 1)
|
(recentf-mode 1))
|
||||||
|
|
||||||
(require 'popwin)
|
(use-package popwin :config (popwin-mode 1))
|
||||||
(popwin-mode 1)
|
|
||||||
|
|
||||||
;; Save cursor location across sessions. Only save for files that exist.
|
;; Save cursor location across sessions. Only save for files that exist.
|
||||||
(use-package saveplace
|
(use-package saveplace
|
||||||
|
@ -175,10 +123,6 @@
|
||||||
:commands (describe-buffer describe-command describe-file
|
:commands (describe-buffer describe-command describe-file
|
||||||
describe-keymap describe-option describe-option-of-type))
|
describe-keymap describe-option describe-option-of-type))
|
||||||
|
|
||||||
(require 'server)
|
|
||||||
(unless (server-running-p)
|
|
||||||
(server-start))
|
|
||||||
|
|
||||||
(add-hook! after-init
|
(add-hook! after-init
|
||||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
||||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||||
|
|
43
init.el
43
init.el
|
@ -41,22 +41,19 @@
|
||||||
;;; License: GPLv3
|
;;; License: GPLv3
|
||||||
|
|
||||||
(defconst narf-debug-mode nil)
|
(defconst narf-debug-mode nil)
|
||||||
|
(setq gc-cons-threshold 84857600) ; avoid garbage collection
|
||||||
|
|
||||||
(scroll-bar-mode -1) ; no scrollbar
|
(let (file-name-handler-alist) ; premature optimization weee!
|
||||||
(tool-bar-mode -1) ; no toolbar
|
(scroll-bar-mode -1) ; no scrollbar
|
||||||
(menu-bar-mode -1) ; no menubar
|
(tool-bar-mode -1) ; no toolbar
|
||||||
(when window-system
|
(menu-bar-mode -1) ; no menubar
|
||||||
(set-frame-font (if (> (display-pixel-width) 1280)
|
|
||||||
(font-spec :family "Ubuntu Mono" :size 14 :antialias t)
|
|
||||||
(font-spec :family "terminus (ttf)" :size 12 :antialias nil)))
|
|
||||||
(set-frame-parameter nil 'fullscreen 'fullboth))
|
|
||||||
|
|
||||||
(load (concat user-emacs-directory "init-load-path.el"))
|
|
||||||
(load-theme (if window-system 'narf-dark 'wombat) t)
|
|
||||||
(mapc 'require
|
|
||||||
`(;; benchmark ; records load times in `require-times'; see `list-times'
|
|
||||||
core ; core/core.el
|
|
||||||
|
|
||||||
|
(set-frame-font (font-spec :family "terminus (ttf)" :size 12 :antialias nil))
|
||||||
|
(load (concat user-emacs-directory "init-load-path.el"))
|
||||||
|
(load-theme (if window-system 'narf-dark 'brin) t)
|
||||||
|
(set-frame-parameter nil 'fullscreen 'fullboth)
|
||||||
|
(mapc 'require
|
||||||
|
`(core ; core/core.el
|
||||||
,(cond (IS-MAC 'core-os-osx)
|
,(cond (IS-MAC 'core-os-osx)
|
||||||
(IS-LINUX 'core-os-linux)
|
(IS-LINUX 'core-os-linux)
|
||||||
(IS-WINDOWS 'core-os-win32))
|
(IS-WINDOWS 'core-os-win32))
|
||||||
|
@ -75,34 +72,38 @@
|
||||||
core-workgroups ; cure Emacs alzheimers
|
core-workgroups ; cure Emacs alzheimers
|
||||||
|
|
||||||
module-cc ; c/c++/obj-c madness
|
module-cc ; c/c++/obj-c madness
|
||||||
module-crystal ; ruby at the speed of c
|
;; module-crystal ; ruby at the speed of c
|
||||||
module-csharp ; unity, mono and xamarin
|
;; module-csharp ; unity, mono and xamarin
|
||||||
module-data ; dbs 'n data formats
|
module-data ; dbs 'n data formats
|
||||||
|
module-elisp ; drowning in parentheses
|
||||||
module-eshell ; eshell (on windows)
|
module-eshell ; eshell (on windows)
|
||||||
module-go ; a hipster dialect
|
module-go ; a hipster dialect
|
||||||
module-java ; the poster child for carpal tunnel syndome
|
module-java ; the poster child for carpal tunnel syndome
|
||||||
module-js ; alert("not java, javascript!")
|
module-js ; alert("not java, javascript!")
|
||||||
module-elisp ;
|
|
||||||
module-lua ; one-based indices? one-based indices.
|
|
||||||
module-lb6 ; LaunchBar 6 development
|
module-lb6 ; LaunchBar 6 development
|
||||||
|
module-lua ; one-based indices? one-based indices.
|
||||||
|
module-markdown ; markdown
|
||||||
;; module-org ; for fearless [organized] leader
|
;; module-org ; for fearless [organized] leader
|
||||||
module-php ; making php less painful to work with
|
module-php ; making php less painful to work with
|
||||||
module-python ; beautiful is better than ugly
|
module-python ; beautiful is better than ugly
|
||||||
module-regex ; /^[^\s](meaning)[^\n]*/
|
module-regex ; /^[^\s](meaning)[^\n]*/
|
||||||
module-ruby ; <3
|
module-ruby ; <3
|
||||||
|
module-rust
|
||||||
module-sass ; @include magic;
|
module-sass ; @include magic;
|
||||||
module-sh ; she sells Z-shells by the C shore
|
module-sh ; she sells Z-shells by the C shore
|
||||||
module-swift ; yay, emoji variables!
|
module-swift ; yay, emoji variables!
|
||||||
module-markdown ; markdown
|
|
||||||
;; module-rust
|
|
||||||
module-vim ; the confessional
|
module-vim ; the confessional
|
||||||
module-web ; for the 2.0'er
|
module-web ; for the 2.0'er
|
||||||
|
|
||||||
my-bindings
|
my-bindings
|
||||||
my-commands
|
my-commands
|
||||||
))
|
)))
|
||||||
|
|
||||||
(defun display-startup-echo-area-message ()
|
(defun display-startup-echo-area-message ()
|
||||||
(message ">>> Loaded in %s" (emacs-init-time)))
|
(message ">>> Loaded in %s" (emacs-init-time)))
|
||||||
|
|
||||||
|
(require 'server)
|
||||||
|
(unless (server-running-p)
|
||||||
|
(server-start))
|
||||||
|
|
||||||
;;; I think so Brain...
|
;;; I think so Brain...
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
markdown-unwrap-things-in-region
|
markdown-unwrap-things-in-region
|
||||||
markdown-wrap-or-insert
|
markdown-wrap-or-insert
|
||||||
markdown-unwrap-thing-at-point)
|
markdown-unwrap-thing-at-point)
|
||||||
|
:init
|
||||||
|
(add-hook! markdown-mode 'narf|enable-hard-wrap)
|
||||||
:config
|
:config
|
||||||
(bind! :map markdown-mode-map
|
(bind! :map markdown-mode-map
|
||||||
"<backspace>" nil
|
"<backspace>" nil
|
||||||
|
|
|
@ -42,34 +42,19 @@
|
||||||
(add-company-backend! python-mode (anaconda)))
|
(add-company-backend! python-mode (anaconda)))
|
||||||
|
|
||||||
(after! emr
|
(after! emr
|
||||||
(emr-declare-command
|
(mapc (lambda (x)
|
||||||
'anaconda-mode-view-doc
|
(let ((command-name (car x))
|
||||||
:title "view documentation"
|
(title (cadr x))
|
||||||
:modes 'python-mode
|
(region-p (caddr x))
|
||||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
predicate)
|
||||||
|
(setq predicate (lambda () (and (anaconda-mode-running-p)
|
||||||
(not (use-region-p))
|
(not (use-region-p))
|
||||||
(not (sp-point-in-string-or-comment)))))
|
(not (sp-point-in-string-or-comment)))))
|
||||||
(emr-declare-command
|
(emr-declare-command (intern (format "anaconda-mode-%s" (symbol-name command-name)))
|
||||||
'anaconda-mode-goto-assignments
|
:title title :modes 'python-mode :predicate predicate)))
|
||||||
:title "go to assignments"
|
'((view-doc "view documentation" t)
|
||||||
:modes 'python-mode
|
(goto-assignments "go to assignments" t)
|
||||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
(usages "show usages" nil)))))
|
||||||
(not (use-region-p))
|
|
||||||
(not (sp-point-in-string-or-comment)))))
|
|
||||||
(emr-declare-command
|
|
||||||
'anaconda-mode-goto-definitions
|
|
||||||
:title "go to definition"
|
|
||||||
:modes 'python-mode
|
|
||||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
|
||||||
(not (use-region-p))
|
|
||||||
(not (sp-point-in-string-or-comment)))))
|
|
||||||
(emr-declare-command
|
|
||||||
'anaconda-mode-usages
|
|
||||||
:title "show usages"
|
|
||||||
:modes 'python-mode
|
|
||||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
|
||||||
(not (use-region-p))
|
|
||||||
(not (sp-point-in-string-or-comment)))))))
|
|
||||||
|
|
||||||
(provide 'module-python)
|
(provide 'module-python)
|
||||||
;;; module-python.el ends here
|
;;; module-python.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue