From 550d5b72188e902375df05970407ced9b9720225 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 30 Jan 2016 21:16:10 -0500 Subject: [PATCH] General clean up --- core/core-editor.el | 6 +- core/core-evil.el | 2 +- core/core-os-osx.el | 5 +- core/core-popup.el | 190 +--------------------------------------- core/core-ui.el | 6 +- core/core-yasnippet.el | 2 + init.el | 2 +- modules/module-js.el | 3 +- modules/module-rust.el | 2 +- private/my-commands.el | 2 +- scripts/byte-compile.el | 4 +- 11 files changed, 20 insertions(+), 204 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index 0de978fad..7f3b49256 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -20,8 +20,8 @@ scroll-conservatively 1001 scroll-preserve-screen-position t - hscroll-step 5 - hscroll-margin 6 + hscroll-step 1 + hscroll-margin 1 shift-select-mode t tabify-regexp "^\t* [ \t]+" @@ -65,6 +65,7 @@ enable multiple minor modes for the same regexp.") ;; Modes 'n hooks ;;;;;;;;;;;;;;;;;;; + (associate! applescript-mode :match "\\.applescript$") (associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$") (associate! makefile-gmake-mode :match "/Makefile$") @@ -155,6 +156,7 @@ enable multiple minor modes for the same regexp.") '(("t" "nil") ("let" "let*") ("when" "unless") + ("append" "prepend") ("add-hook" "add-hook!" "remove-hook"))))) (use-package smart-forward :commands (smart-up smart-down smart-left smart-right)) diff --git a/core/core-evil.el b/core/core-evil.el index 7971f6899..fa5b817fd 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -89,7 +89,7 @@ (setq-local evil-ex-commands (copy-alist evil-ex-commands))) (evil-ex-define-cmd cmd function)) ;; Shortcuts for `evil-ex-define-cmd' - (defalias 'exmap 'evil-ex-define-cmd) + (defalias 'exmap 'evil-ex-define-cmd) (defalias 'exmap! 'evil-ex-define-cmd-local) (progn ; evil hacks diff --git a/core/core-os-osx.el b/core/core-os-osx.el index 3f12e631e..732b537f3 100644 --- a/core/core-os-osx.el +++ b/core/core-os-osx.el @@ -35,8 +35,9 @@ (unless window-system (require 'mouse) (xterm-mouse-mode t) - (global-set-key [mouse-4] (λ! (scroll-down 1))) - (global-set-key [mouse-5] (λ! (scroll-up 1))) + (global-set-key [mouse-4] (λ! (scroll-down 4))) + (global-set-key [mouse-5] (λ! (scroll-up 4))) + (defun track-mouse (e)) (setq mouse-sel-mode t)) diff --git a/core/core-popup.el b/core/core-popup.el index d4b3909a1..e4a85e277 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -1,4 +1,4 @@ -;;; core-popup.el --- hacks for better popwin integration +;;; core-popup.el --- taming stray windows (use-package shackle :config @@ -228,193 +228,5 @@ (setq mode-line-format nil) (goto-char (point-max))))) -;; (use-package popwin -;; :disabled t -;; :config -;; (setq popwin:popup-window-height 0.3) -;; (mapc (lambda (rule) (push rule popwin:special-display-config)) -;; '(("*Help*" :position bottom :height 0.3 :stick t) -;; (debugger-mode :position bottom :height 15 :dedicated t :stick t) -;; ("*evil-registers*" :position bottom :height 0.3 :stick t) -;; ("*scratch*" :position bottom :height 20 :stick t) -;; ("*Apropos*" :position bottom :height 40 :stick t) -;; ("*Backtrace*" :position bottom :height 15 :dedicated t :stick t) -;; ("*flycheck errors*" :position bottom :height 15 :stick t) -;; ("*quickrun*" :position bottom :height 15 :stick t) -;; ("*minor-modes*" :position bottom :height 0.5 :stick t) -;; ("^\\*CPU-Profiler-Report .+\\*$" :regexp t :position bottom :height 0.35) - -;; ;; vcs -;; ("^\\*git-gutter.+\\*$" :regexp t :position bottom :height 0.4 :stick t) -;; ("*vc-diff*" :position bottom :height 0.4 :stick t) -;; ("*vc-change-log*" :position bottom :stick t :noselect t) - -;; ;; Helm -;; ;; ("^\\*[Hh]elm.*?\\*\\'" :regexp t :position bottom :height 0.2) -;; ;; ("*helm-mode-**" :regexp t :position bottom :height 10) -;; ;; ("*helm-ag*" :position bottom :height 0.4 :stick t) - -;; ;; Org -;; (org-src-mode :position bottom :height 0.5 :stick t) -;; (org-agenda-mode :position bottom :height 0.4 :stick t) -;; ("^\\*Org-Babel.*\\*$" :regexp t :position bottom :height 15 :tail t) -;; ("*Agenda Commands*" :position bottom :height 0.5) -;; (" *Org todo*" :position bottom :height 5) -;; ("*Org Links*" :position bottom :height 2) - -;; ;; REPLs -;; ((lambda (buffer) (with-current-buffer buffer (bound-and-true-p repl-toggle-mode))) -;; :position bottom :height 0.2 :stick t) -;; )) - -;; (popwin-mode 1) - -;; (after! evil -;; ;; Fix disruptive errors w/ hidden buffers caused by popwin -;; (defadvice evil-ex-hl-do-update-highlight (around evil-ex-hidden-buffer-ignore-errors activate) -;; (ignore-errors ad-do-it))) - -;; (after! neotree -;; (when neo-persist-show -;; (add-hook! 'popwin:before-popup-hook (setq neo-persist-show nil)) -;; (add-hook! 'popwin:after-popup-hook (setq neo-persist-show t)))) - -;; (after! quickrun -;; (defun narf*quickrun-close-popwin (&optional _ _ _ _) -;; (when (get-buffer quickrun/buffer-name) -;; (quickrun/kill-quickrun-buffer) -;; (narf/popup-close "*quickrun*"))) - -;; (defun quickrun/pop-to-buffer (buf cb) -;; (popwin:pop-to-buffer buf) -;; (with-current-buffer buf -;; (evil-resize-window 5) -;; (funcall cb) -;; (setq mode-line-format nil))) - -;; (defun narf/quickrun-after-run () -;; (with-selected-window popwin:popup-window -;; (let* ((lines (count-lines (point-min) (point-max))) -;; (act-lines (max 5 (min 40 (count-lines (point-min) (point-max)))))) -;; (evil-resize-window act-lines) -;; (goto-char (point-min))))) -;; (add-hook! quickrun-after-run 'narf/quickrun-after-run) - -;; (advice-add 'quickrun :before 'narf*quickrun-close-popwin) -;; (advice-add 'quickrun-region :before 'narf*quickrun-close-popwin)) - -;; (after! helm -;; ;; Faster than popwin! -;; (add-to-list 'display-buffer-alist -;; `(,(rx bos "*helm" (* not-newline) "*" eos) -;; (display-buffer-in-side-window) -;; (inhibit-same-window . t) -;; (window-height . 0.4))) -;; ;; (defun narf/helm-split-window (&optional window) -;; ;; "Minimalistic split-fn; leaves popwin to handle helm buffers." -;; ;; popwin:popup-window) - -;; (setq-default -;; ;; helm-split-window-preferred-function 'narf/helm-split-window -;; helm-split-window-default-side 'below -;; helm-split-window-in-side-p t -;; ;; helm-display-function 'popwin:popup-buffer -;; ) - -;; ;; (defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popwin-compat activate) -;; ;; (cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)) -;; ;; (defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popwin-compat activate) -;; ;; (cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)) - -;; ;; I remove any attempt to kill the helm-ag window, because popwin handles it. -;; ;; (defun helm-ag--edit (_candidate) -;; ;; (let ((default-directory helm-ag--default-directory)) -;; ;; (with-current-buffer (get-buffer-create "*helm-ag-edit*") -;; ;; (erase-buffer) -;; ;; (setq-local helm-ag--default-directory helm-ag--default-directory) -;; ;; (let (buf-content) -;; ;; (with-current-buffer (get-buffer "*helm-ag*") -;; ;; (goto-char (point-min)) -;; ;; (forward-line 1) -;; ;; (let* ((body-start (point)) -;; ;; (marked-lines (cl-loop for ov in (overlays-in body-start (point-max)) -;; ;; when (eq 'helm-visible-mark (overlay-get ov 'face)) -;; ;; return (helm-marked-candidates)))) -;; ;; (if (not marked-lines) -;; ;; (setq buf-content (buffer-substring-no-properties -;; ;; body-start (point-max))) -;; ;; (setq buf-content (concat (mapconcat 'identity marked-lines "\n") "\n"))))) -;; ;; (insert buf-content) -;; ;; (add-text-properties (point-min) (point-max) -;; ;; '(read-only t rear-nonsticky t front-sticky t)) -;; ;; (let ((inhibit-read-only t)) -;; ;; (setq header-line-format -;; ;; (format "[%s] C-c C-c: Commit, C-c C-k: Abort" -;; ;; (abbreviate-file-name helm-ag--default-directory))) -;; ;; (goto-char (point-min)) -;; ;; (while (re-search-forward "^\\(\\(?:[^:]+:\\)\\{1,2\\}\\)\\(.*\\)$" nil t) -;; ;; (let ((file-line-begin (match-beginning 1)) -;; ;; (file-line-end (match-end 1)) -;; ;; (body-begin (match-beginning 2)) -;; ;; (body-end (match-end 2))) -;; ;; (add-text-properties file-line-begin file-line-end -;; ;; '(face font-lock-function-name-face -;; ;; intangible t)) -;; ;; (remove-text-properties body-begin body-end '(read-only t)) -;; ;; (set-text-properties body-end (1+ body-end) -;; ;; '(read-only t rear-nonsticky t)))))))) -;; ;; (popwin:display-buffer (get-buffer "*helm-ag-edit*")) -;; ;; ;; (other-window 1) -;; ;; ;; (switch-to-buffer (get-buffer "*helm-ag-edit*")) -;; ;; (goto-char (point-min)) -;; ;; (setq next-error-function 'compilation-next-error-function) -;; ;; (setq-local compilation-locs (make-hash-table :test 'equal :weakness 'value)) -;; ;; (use-local-map helm-ag-edit-map)) -;; ) - -;; (add-hook! org-load -;; ;; (defun org-src-switch-to-buffer (buffer context) -;; ;; (popwin:popup-buffer (get-buffer buffer) :height 0.5)) - -;; (defun org-switch-to-buffer-other-window (&rest args) -;; (mapc (lambda (b) -;; (let ((buf (if (stringp b) (get-buffer-create b) b))) -;; (popwin:pop-to-buffer buf t t))) -;; args))) - -;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (defun narf/popup-p (&optional buffer) -;; (and (popwin:popup-window-live-p) -;; (if buffer (eq buffer popwin:popup-buffer) t))) - -;; (defun narf/popup-close () -;; (let ((popup-p (popwin:popup-window-live-p)) -;; (comint-p (derived-mode-p 'comint-mode))) -;; (when comint-p -;; (when (eq rtog/--last-buffer (current-buffer)) -;; (setq rtog/--last-buffer nil -;; narf-repl-buffer nil)) -;; (kill-this-buffer)) -;; (when popup-p -;; (popwin:close-popup-window t)))) - -;; (defun narf/popup-buffer (buffer &optional height) -;; (popwin:popup-buffer buffer)) - -;; (defun narf/popup-toggle () -;; (interactive) -;; (if (popwin:popup-window-live-p) -;; (popwin:close-popup-window) -;; (popwin:popup-last-buffer))) - -;; (defun narf/popup-last-buffer () -;; (interactive) -;; (popwin:popup-last-buffer)) - -;; (defun narf/popup-messages () -;; (interactive) -;; (popwin:messages))) - (provide 'core-popup) ;;; core-popup.el ends here diff --git a/core/core-ui.el b/core/core-ui.el index d7e88b65b..8fd24238a 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -65,8 +65,9 @@ (blink-cursor-mode 1) ; do blink cursor (tooltip-mode -1) ; show tooltips in echo area -(when (featurep 'eldoc) - (global-eldoc-mode -1)) ; on by default in Emacs 25? +;; on by default in Emacs 25 +(when (and (featurep 'eldoc) (>= emacs-major-version 25)) + (global-eldoc-mode -1)) ;; Highlight line (add-hook! (prog-mode puml-mode markdown-mode) 'hl-line-mode) @@ -152,7 +153,6 @@ (hl-line-mode (if rainbow-mode -1 1))))) (use-package volatile-highlights - :when (not EMACS-WRITE) :config (vhl/define-extension 'my-undo-tree-highlights 'undo-tree-undo 'undo-tree-redo) diff --git a/core/core-yasnippet.el b/core/core-yasnippet.el index 597ac87f0..5199c98c9 100644 --- a/core/core-yasnippet.el +++ b/core/core-yasnippet.el @@ -74,5 +74,7 @@ (after! yasnippet (advice-add 'yas-expand :before 'sp-remove-active-pair-overlay))) +;; TODO: Add auto-yasnippet + (provide 'core-yasnippet) ;;; core-yasnippet.el ends here diff --git a/init.el b/init.el index ba8fa383e..47713e0be 100644 --- a/init.el +++ b/init.el @@ -103,7 +103,7 @@ module-write ; making Emacs fit for writing fiction, papers & notes ;; Extra Tools - module-demo ; let me demonstrate... + module-demo ; allow me to demonstrate... ;; Key bindings & ex commands my-bindings diff --git a/modules/module-js.el b/modules/module-js.el index a6d006a3f..25e811643 100644 --- a/modules/module-js.el +++ b/modules/module-js.el @@ -99,8 +99,7 @@ (use-package coffee-mode :mode "\\.coffee$" :config - (setq-default - coffee-indent-like-python-mode t)) + (setq-default coffee-indent-like-python-mode t)) (use-package nodejs-repl :defer t) diff --git a/modules/module-rust.el b/modules/module-rust.el index 58883b322..e72dbb10c 100644 --- a/modules/module-rust.el +++ b/modules/module-rust.el @@ -10,7 +10,7 @@ :config (add-hook! rust-mode 'flycheck-mode)) (use-package racer - :if (file-exists-p "/usr/local/bin/racer") + :when (file-exists-p "/usr/local/bin/racer") :config (setq racer-cmd "/usr/local/bin/racer" racer-rust-src-path "~/Dropbox/lib/rust/src/") diff --git a/private/my-commands.el b/private/my-commands.el index 8fcd816c4..4eff1272b 100644 --- a/private/my-commands.el +++ b/private/my-commands.el @@ -49,7 +49,7 @@ (exmap "agr" 'narf:helm-ag-regex-search) (exmap "agr[cw]d" 'narf:helm-ag-regex-search-cwd) (exmap "cd" 'narf:cd) -(exmap "fi[nd]" 'narf:helm-swoop) +(exmap "f[ind]" 'narf:helm-swoop) ;; Project tools (exmap "ma[ke]" 'narf:build) ;; File operations diff --git a/scripts/byte-compile.el b/scripts/byte-compile.el index 0f35c9675..c4915ab72 100755 --- a/scripts/byte-compile.el +++ b/scripts/byte-compile.el @@ -1,9 +1,9 @@ #!emacs --script -(load (concat user-emacs-directory "init-packages.el")) +(load (concat user-emacs-directory "bootstrap.el")) (require 'bytecomp) -(byte-recompile-file (expand-file-name "init-load-path.el" narf-emacs-dir) nil 0) +(byte-recompile-file (expand-file-name "bootstrap.el" narf-emacs-dir) nil 0) (byte-recompile-file (expand-file-name "init.el" narf-emacs-dir) nil 0) (byte-recompile-file (expand-file-name "core.el" narf-core-dir) t 0) (byte-recompile-file (expand-file-name "core-vars.el" narf-core-dir) t 0)