v1.1.3 bump

+ sp: be quiet
+ popup: load *eval* rule earlier
+ evil-anzu: defer, due to long load time
+ Update makefile
+ Clean up core.el
+ line-spacing = 1, less rpadding on nlinum-format
+ Add *esup* popup rule
+ Refactor doom macro
+ Refactor doom-byte-compile
+ :big [SIZE] + use inconsolata in big-mode
+ :v TAB -> doom/yas-insert-snippet
+ eval: use pop-to-buffer instead of doom/popup-buffer
+ Refactor backspace fn; handle pair deletion issue with sp better
+ \#bringbackwindowsystem
+ db: remove unused var
+ Update init.el
This commit is contained in:
Henrik Lissner 2016-05-28 21:51:21 -04:00
parent df13257ce8
commit fc78d46f30
19 changed files with 86 additions and 76 deletions

View file

@ -6,7 +6,7 @@ all: install autoloads init.elc
# If you run either of these with emacs open, run doom-reload afterwards # If you run either of these with emacs open, run doom-reload afterwards
install: autoloads _install init.elc install: autoloads _install init.elc
update: autoloads _update init.elc update: autoloads _update core/core.elc init.elc
autoloads: autoloads:
@$(EMACS) --batch -l init.el --eval '(doom-reload-autoloads)' 2>&1 @$(EMACS) --batch -l init.el --eval '(doom-reload-autoloads)' 2>&1
@ -31,11 +31,11 @@ clean-cache:
_update: _update:
@cask update 2>&1 @cask update 2>&1
@rm -f init.elc @rm -f init.elc core/core.elc
_install: _install:
@cask install 2>&1 @cask install 2>&1
@rm -f init.elc @rm -f init.elc core/core.elc
@mkdir -p $(CACHE_DIR)/{undo,backup,workgroups} @mkdir -p $(CACHE_DIR)/{undo,backup,workgroups}
.PHONY: all .PHONY: all

View file

@ -1,34 +1,34 @@
;;; core-defuns.el ;;; core-defuns.el
;; Bootstrap macro ;; Bootstrap macro
(defmacro doom (_ default-theme __ term-theme ___ font &rest packages) (defmacro doom (_ theme __ font &rest packages)
"Bootstrap DOOM emacs and initialize PACKAGES" "Bootstrap DOOM emacs and initialize PACKAGES"
`(let ((gc-cons-threshold 339430400) `(let (file-name-handler-alist)
(gc-cons-percentage 0.6)
file-name-handler-alist)
;; Local settings ;; Local settings
(load "~/.emacs.local.el" t t) ;; (load "~/.emacs.local.el" t t)
;; Global constants ;; Global constants
(defvar doom-default-theme ,default-theme) (defvar doom-default-theme ,theme)
(defvar doom-terminal-theme ,term-theme)
(defvar doom-default-font (defvar doom-default-font
(font-spec :family ,(nth 0 font) (font-spec :family ,(nth 0 font)
:size ,(nth 1 font) :size ,(nth 1 font)
:antialias ,(not (nth 2 font)))) :antialias ,(not (nth 2 font))))
(defvar doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)) (defvar doom-current-theme doom-default-theme)
(defvar doom-current-font doom-default-font) (defvar doom-current-font doom-default-font)
(unless noninteractive (unless noninteractive
,@(mapcar (lambda (pkg) `(require ',pkg)) ,@(mapcar (lambda (pkg) `(require ',pkg))
packages) packages)
(when (display-graphic-p) (when window-system
(require 'server) (require 'server)
(unless (server-running-p) (unless (server-running-p)
(server-start))) (server-start)))
;; Prevent any auto-displayed text + benchmarking ;; Prevent any auto-displayed text + benchmarking
(advice-add 'display-startup-echo-area-message :override 'ignore) (advice-add 'display-startup-echo-area-message :override 'ignore)
(message "")))) (message ""))
(setq-default gc-cons-threshold 4388608
gc-cons-percentage 0.4)))
;; Backwards compatible `with-eval-after-load' ;; Backwards compatible `with-eval-after-load'
(unless (fboundp 'with-eval-after-load) (unless (fboundp 'with-eval-after-load)
@ -339,14 +339,20 @@ e.g. (doom-fix-unicode \"DejaVu Sans\" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎
(font-spec :name font :size size) nil 'prepend)) (font-spec :name font :size size) nil 'prepend))
chars)) chars))
(defun doom-byte-compile () (defun doom-byte-compile (&optional minimal)
"Byte compile the core and library .el files in ~/.emacs.d" "Byte compile the core and library .el files in ~/.emacs.d"
(interactive) (interactive)
(mapc (lambda (f) (byte-compile-file (concat doom-emacs-dir "/" f))) (mapc (lambda (f) (byte-compile-file (concat doom-emacs-dir "/" f)))
'("init.el" "private/my-commands.el" "private/my-bindings.el" '("init.el" "private/my-commands.el" "private/my-bindings.el"
"core/core.el" "core/core-defuns.el" "core/core-ui.el")) "core/core.el" "core/core-defuns.el" "core/core-ui.el"
(byte-recompile-directory doom-core-dir 0 t) "core/core-os.el" "core/core-os-osx.el" "core/core-os-win32.el"
(byte-recompile-directory doom-modules-dir 0 t) "core/core-os-linux.el"))
(unless minimal
(byte-recompile-directory doom-core-dir 0 t)
(byte-recompile-directory doom-modules-dir 0 t))
(when minimal
(byte-recompile-directory (concat doom-core-dir "/defuns") 0 t)
(byte-recompile-directory (concat doom-modules-dir "/defuns") 0 t))
(message "Compiled!")) (message "Compiled!"))
(provide 'core-defuns) (provide 'core-defuns)

View file

@ -20,8 +20,7 @@
:init (add-hook 'quickrun/mode-hook 'linum-mode) :init (add-hook 'quickrun/mode-hook 'linum-mode)
:config :config
(setq quickrun-focus-p nil) (setq quickrun-focus-p nil)
(def-popup! "*quickrun*" :align below :size 10) (def-popup! "*quickrun*" :align below :size 10))
(def-popup! "*eval*" :align below :size 20))
(use-package repl-toggle (use-package repl-toggle
:commands (rtog/toggle-repl rtog/add-repl) :commands (rtog/toggle-repl rtog/add-repl)

View file

@ -205,6 +205,7 @@
:commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt)) :commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt))
(use-package evil-anzu (use-package evil-anzu
:defer 1
:config :config
(setq anzu-cons-mode-line-p nil (setq anzu-cons-mode-line-p nil
anzu-minimum-input-length 1 anzu-minimum-input-length 1

View file

@ -12,8 +12,9 @@
(setq shackle-rules (setq shackle-rules
`(;; Util `(;; Util
("^\\*.+-Profiler-Report .+\\*$" :align below :size 0.3 :regexp t) ("^\\*.+-Profiler-Report .+\\*$" :align below :size 0.3 :regexp t)
("*esup*" :align below :size 30 :noselect t) ("*esup*" :align below :size 0.4 :noselect t)
("*minor-modes*" :align below :size 0.5 :noselect t) ("*minor-modes*" :align below :size 0.5 :noselect t)
("*eval*" :align below :size 20)
;; Emacs ;; Emacs
("*Pp Eval Output*" :align below :size 0.3) ("*Pp Eval Output*" :align below :size 0.3)
("*Apropos*" :align below :size 0.3) ("*Apropos*" :align below :size 0.3)

View file

@ -51,7 +51,7 @@
(erase-buffer) (erase-buffer)
(setq doom-buffer-edited nil) (setq doom-buffer-edited nil)
(insert (insert
(let* ((auto-detect-frame (or auto-detect-frame (not (display-graphic-p)))) (let* ((auto-detect-frame (or auto-detect-frame (not window-system)))
(width (max 3 (- (if auto-detect-frame (width (max 3 (- (if auto-detect-frame
(window-width) (window-width)
(cdr (assq 'width default-frame-alist))) 3))) (cdr (assq 'width default-frame-alist))) 3)))

View file

@ -6,6 +6,7 @@
(fset 'yes-or-no-p 'y-or-n-p) (fset 'yes-or-no-p 'y-or-n-p)
(setq-default (setq-default
line-spacing 1
indicate-buffer-boundaries nil ; don't show where buffer starts/ends indicate-buffer-boundaries nil ; don't show where buffer starts/ends
indicate-empty-lines nil ; don't show empty lines indicate-empty-lines nil ; don't show empty lines
fringes-outside-margins t ; switches order of fringe and margin fringes-outside-margins t ; switches order of fringe and margin
@ -42,7 +43,7 @@
;; Initialize UI ;; Initialize UI
(load-theme doom-current-theme t) (load-theme doom-current-theme t)
(tooltip-mode -1) ; show tooltips in echo area (tooltip-mode -1) ; show tooltips in echo area
(if (not (display-graphic-p)) (if (not window-system)
(menu-bar-mode -1) (menu-bar-mode -1)
(scroll-bar-mode -1) ; no scrollbar (scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar (tool-bar-mode -1) ; no toolbar
@ -151,7 +152,7 @@
:commands nlinum-mode :commands nlinum-mode
:preface :preface
(setq linum-format "%3d ") (setq linum-format "%3d ")
(defvar nlinum-format "%4d ") (defvar nlinum-format "%4d ")
(defvar doom--hl-nlinum-overlay nil) (defvar doom--hl-nlinum-overlay nil)
(defvar doom--hl-nlinum-line nil) (defvar doom--hl-nlinum-line nil)
:init :init
@ -260,7 +261,8 @@
(spaceline-define-segment *anzu (spaceline-define-segment *anzu
"Show the current match number and the total number of matches. Requires "Show the current match number and the total number of matches. Requires
anzu to be enabled." anzu to be enabled."
(when (evil-ex-hl-active-p 'evil-ex-search) (when (and (featurep 'evil-anzu)
(evil-ex-hl-active-p 'evil-ex-search))
(powerline-raw (powerline-raw
(let ((here anzu--current-position) (let ((here anzu--current-position)
(total anzu--total-matched)) (total anzu--total-matched))

View file

@ -14,7 +14,7 @@ defuns/defuns-workgroups.el.")
automatically renamed to the project name.") automatically renamed to the project name.")
(use-package workgroups2 (use-package workgroups2
:when (display-graphic-p) :when window-system
:init :init
(setq-default (setq-default
wg-session-file (concat doom-temp-dir "/workgroups/last") wg-session-file (concat doom-temp-dir "/workgroups/last")

View file

@ -13,6 +13,10 @@
;; ;;
;;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el ;;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
;; Premature optimization for faster startup
(setq-default gc-cons-threshold 339430400
gc-cons-percentage 0.6)
(defalias '! 'eval-when-compile) (defalias '! 'eval-when-compile)
(defconst doom-emacs-dir (! (expand-file-name user-emacs-directory))) (defconst doom-emacs-dir (! (expand-file-name user-emacs-directory)))
@ -27,6 +31,9 @@
emacs-major-version emacs-minor-version)) emacs-major-version emacs-minor-version))
"Hostname and emacs-version-based elisp temp directories") "Hostname and emacs-version-based elisp temp directories")
;; window-system is deprecated. Not on my watch!
(unless (boundp 'window-system)
(defvar window-system (framep-on-display)))
;; ;;
;; Load path ;; Load path
@ -37,7 +44,7 @@
;; Populate the load-path manually; cask shouldn't be an internal dependency ;; Populate the load-path manually; cask shouldn't be an internal dependency
(setq load-path (setq load-path
(! (defsubst --subdirs (path &optional include-self) (! (defun --subdirs (path &optional include-self)
(let ((result (if include-self (list path) (list)))) (let ((result (if include-self (list path) (list))))
(mapc (lambda (file) (mapc (lambda (file)
(when (file-directory-p file) (when (file-directory-p file)
@ -67,11 +74,6 @@
(prefer-coding-system 'utf-8) ; with sugar on top (prefer-coding-system 'utf-8) ; with sugar on top
(setq default-process-coding-system '(utf-8-unix . utf-8-unix)) (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
;; Premature optimization for faster startup
(setq-default gc-cons-threshold 4388608
gc-cons-percentage 0.3
major-mode 'text-mode)
;; stop package.el from being annoying. I rely solely on Cask. ;; stop package.el from being annoying. I rely solely on Cask.
(setq package--init-file-ensured t (setq package--init-file-ensured t
package-enable-at-startup nil package-enable-at-startup nil
@ -81,10 +83,10 @@
("org" . "http://orgmode.org/elpa/")) ("org" . "http://orgmode.org/elpa/"))
ad-redefinition-action 'accept ; silence the advised function warnings ad-redefinition-action 'accept ; silence the advised function warnings
confirm-nonexistent-file-or-buffer t
compilation-always-kill t ; kill compl. process before spawning another compilation-always-kill t ; kill compl. process before spawning another
compilation-ask-about-save nil ; save all buffers before compiling compilation-ask-about-save nil ; save all buffers before compiling
compilation-scroll-output t ; scroll with output while compiling compilation-scroll-output t ; scroll with output while compiling
confirm-nonexistent-file-or-buffer t
delete-by-moving-to-trash t delete-by-moving-to-trash t
echo-keystrokes 0.02 ; show me what I type echo-keystrokes 0.02 ; show me what I type
ediff-diff-options "-w" ediff-diff-options "-w"
@ -92,6 +94,7 @@
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 nil ; no minibufferception enable-recursive-minibuffers nil ; no minibufferception
idle-update-delay 5 ; update a little less often idle-update-delay 5 ; update a little less often
major-mode 'text-mode
ring-bell-function 'ignore ; silence of the bells! ring-bell-function 'ignore ; silence of the bells!
save-interprogram-paste-before-kill nil save-interprogram-paste-before-kill nil
sentence-end-double-space nil sentence-end-double-space nil
@ -120,8 +123,6 @@
(autoload 'use-package "use-package" "" nil 'macro) (autoload 'use-package "use-package" "" nil 'macro)
(require 'f) (require 'f)
(require 'dash)
(require 's)
(require 'core-vars) (require 'core-vars)
(require 'core-defuns) (require 'core-defuns)
(unless (require 'autoloads nil t) (unless (require 'autoloads nil t)

View file

@ -35,7 +35,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
;; Buffer Life and Death ;;;;;;;;;;;;;;; ;; Buffer Life and Death ;;;;;;;;;;;;;;;
(unless (display-graphic-p) (unless window-system
(defalias 'wg-workgroup-associated-buffers 'ignore) (defalias 'wg-workgroup-associated-buffers 'ignore)
(defalias 'wg-current-workgroup 'ignore) (defalias 'wg-current-workgroup 'ignore)
(defalias 'wg-save-session 'ignore)) (defalias 'wg-save-session 'ignore))

View file

@ -53,16 +53,16 @@ elisp buffer). Otherwise forward the region to Quickrun."
(lines (length (s-lines out)))) (lines (length (s-lines out))))
(if (< lines 5) (if (< lines 5)
(princ out t) (princ out t)
(with-current-buffer (get-buffer-create "*eval*") (let ((buf (get-buffer-create "*eval*")))
;; (rename-buffer (buffer-name old-buf)) (with-current-buffer buf
(read-only-mode -1) (read-only-mode -1)
(setq-local scroll-margin 0) (setq-local scroll-margin 0)
(emacs-lisp-mode) (emacs-lisp-mode)
(erase-buffer) (erase-buffer)
(insert out) (insert out)
(read-only-mode 1) (read-only-mode 1)
(goto-char (point-min)) (goto-char (point-min)))
(doom/popup-buffer (current-buffer)))))) (pop-to-buffer buf)))))
(t (quickrun-region beg end)))) (t (quickrun-region beg end))))
;;;###autoload (autoload 'doom:eval-region-and-replace "defuns-quickrun" nil t) ;;;###autoload (autoload 'doom:eval-region-and-replace "defuns-quickrun" nil t)

View file

@ -54,24 +54,22 @@ already there, move it to the true bol."
possible, or just one char if that's not possible." possible, or just one char if that's not possible."
(interactive) (interactive)
(let* ((context (sp--get-pair-list-context 'navigate)) (let* ((context (sp--get-pair-list-context 'navigate))
(open-pair (sp--get-opening-regexp context)) (open-pair-re (sp--get-opening-regexp context))
(close-pair (sp--get-closing-regexp context)) (close-pair-re (sp--get-closing-regexp context))
open-len close-len) open-len close-len)
(cond ;; When in strings (sp acts weird with quotes; this is the fix) (cond ;; When in strings (sp acts weird with quotes; this is the fix)
;; Also, skip closing delimiters ;; Also, skip closing delimiters
((and (and (sp--looking-back open-pair) ((and (and (sp--looking-back open-pair-re)
(setq open-len (- (match-beginning 0) (match-end 0)))) (setq open-len (- (match-beginning 0) (match-end 0))))
(and (looking-at close-pair) (and (looking-at close-pair-re)
(setq close-len (- (match-beginning 0) (match-end 0))))) (setq close-len (- (match-beginning 0) (match-end 0))))
(string= (plist-get (sp-get-thing t) :op)
(plist-get (sp-get-thing) :cl)))
(delete-backward-char open-len) (delete-backward-char open-len)
(delete-char close-len)) (delete-char close-len))
;; If using tabs (or at bol), just delete normally
((or indent-tabs-mode
(= (point-at-bol) (point)))
(call-interactively 'backward-delete-char-untabify))
;; Delete up to the nearest tab column IF only whitespace between ;; Delete up to the nearest tab column IF only whitespace between
;; point and bol. ;; point and bol.
((sp--looking-back-p "^[\\t ]*" (point-at-bol)) ((sp--looking-back-p "^[\\t ]*" (line-beginning-position))
(let ((movement (% (current-column) tab-width)) (let ((movement (% (current-column) tab-width))
(p (point))) (p (point)))
(when (= movement 0) (when (= movement 0)

13
init.el
View file

@ -2,7 +2,7 @@
;; ;;
;; Author: Henrik Lissner <henrik@lissner.net> ;; Author: Henrik Lissner <henrik@lissner.net>
;; URL: https://github.com/hlissner/.emacs.d ;; URL: https://github.com/hlissner/.emacs.d
;; Version: 1.1.2 ;; Version: 1.1.3
;; ;;
;; ================= =============== =============== ======== ======== ;; ================= =============== =============== ======== ========
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . // ;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
@ -29,11 +29,10 @@
;;; License: MIT ;;; License: MIT
(defconst emacs-start-time (current-time)) (defconst emacs-start-time (current-time))
(load (concat user-emacs-directory "core/core.el")) (load (concat user-emacs-directory "core/core"))
(doom :default-theme 'doom-one (doom :theme (if window-system 'doom-one 'doom-dark)
:terminal-theme 'doom-dark :font ("Inconsolata" 14)
:default-font ("Fira Mono" 12)
;;; The heart of DOOM ;;; The heart of DOOM
core-popup ; taming sudden and inevitable windows core-popup ; taming sudden and inevitable windows
@ -81,8 +80,8 @@
module-web ; The end is always near </html> module-web ; The end is always near </html>
;;; Experimental ;;; Experimental
;; module-eshell ; for inferior OSes *cough*windows ;; module-eshell ; for inferior OSes *cough*windows
;; module-org ; for organized fearless leader ;; module-org ; for organized fearless leader
;;; Extra libraries ;;; Extra libraries
extra-demo ; allow me to demonstrate... extra-demo ; allow me to demonstrate...

View file

@ -9,8 +9,8 @@
;; + TODO peer programming collab ;; + TODO peer programming collab
;; Big-mode settings ;; Big-mode settings
(defconst big-mode-font (font-spec :family "Hack" :size 16)) (defconst big-mode-font (font-spec :family "Inconsolata" :size 18))
(defconst big-mode-line-spacing 0) (defconst big-mode-line-spacing 1)
(defconst big-mode-modeline-height 35) (defconst big-mode-modeline-height 35)
;; ;;
@ -37,8 +37,15 @@
(setq neo-window-width 28) (setq neo-window-width 28)
(remove-hook 'neo-after-create-hook 'doom|text-scale-1))) (remove-hook 'neo-after-create-hook 'doom|text-scale-1)))
(defun doom|text-scale-1 (&rest _) (text-scale-set -1) (setq line-spacing 0)) (defun doom|text-scale-1 (&rest _)
(defun doom|text-scale+1 (&rest _) (text-scale-set +1)) (text-scale-set -1) (setq line-spacing 0))
(evil-define-command doom:big-mode (&optional size)
(interactive "<a>")
(let ((big-mode-font big-mode-font))
(when (and size (not big-mode))
(font-put big-mode-font :size (string-to-int size)))
(big-mode (if big-mode -1 +1))))
(provide 'extra-demo) (provide 'extra-demo)
;;; extra-demo.el ends here ;;; extra-demo.el ends here

View file

@ -12,11 +12,7 @@
sql-user "root" sql-user "root"
sql-password "")) sql-password ""))
(defvar db-commands ;; extract these
'((mysql
(:listdb )
)))
(evil-define-command doom:db-select (product) (evil-define-command doom:db-select (product)
(interactive "<a>") (interactive "<a>")
(sql-set-product (intern product)) (sql-set-product (intern product))

View file

@ -263,8 +263,8 @@
;; yasnippet ;; yasnippet
(:map yas-minor-mode-map (:map yas-minor-mode-map
:i [(tab)] 'yas-expand :i [(tab)] 'yas-expand
:v "<backtab>" 'doom/yas-insert-snippet) :v [(tab)] 'doom/yas-insert-snippet)
;; company-mode and vim-like omni-complete ;; company-mode and vim-like omni-complete
:i "C-SPC" 'doom/company-complete :i "C-SPC" 'doom/company-complete

View file

@ -80,7 +80,7 @@
(ex! "rm" 'doom:file-delete) (ex! "rm" 'doom:file-delete)
;; Presentation/demo ;; Presentation/demo
(ex! "big" 'big-mode) (ex! "big" 'doom:big-mode)
(ex! "full[scr]" 'doom:toggle-fullscreen) (ex! "full[scr]" 'doom:toggle-fullscreen)
;; Sessions/tabs ;; Sessions/tabs

View file

@ -22,7 +22,7 @@
(doom-blend color "#FFFFFF" (- 1 alpha))) (doom-blend color "#FFFFFF" (- 1 alpha)))
(when (display-graphic-p) (when window-system
(defface doom-default '((t (:inherit default))) (defface doom-default '((t (:inherit default)))
"Face for source code windows." "Face for source code windows."
:group 'doom) :group 'doom)

View file

@ -22,7 +22,7 @@
(doom-blend color "#FFFFFF" (- 1 alpha))) (doom-blend color "#FFFFFF" (- 1 alpha)))
(when (display-graphic-p) (when window-system
(defface doom-default '((t (:inherit default))) (defface doom-default '((t (:inherit default)))
"Face for source code windows." "Face for source code windows."
:group 'doom) :group 'doom)