diff --git a/Cask b/Cask index 17e65068f..eaf91636b 100644 --- a/Cask +++ b/Cask @@ -244,7 +244,7 @@ (depends-on "org-download") (depends-on "ox-pandoc") -;; Writing -- modules/module-write.el +;; Writing -- modules/extra-write.el (depends-on "helm-bibtex") diff --git a/core/core-editor.el b/core/core-editor.el index a402bb00f..2a7f0a6b0 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -138,8 +138,7 @@ enable multiple minor modes for the same regexp.") ;; Smarter electric-indent (electric-indent-mode -1) ; on by default (defvar narf-electric-indent-p nil) -(defvar narf-electric-indent-words '()) -(make-variable-buffer-local 'narf-electric-indent-words) +(defvar-local narf-electric-indent-words '()) (setq electric-indent-chars '(?\n ?\^?)) (push (lambda (c) (when (eolp) @@ -269,7 +268,6 @@ enable multiple minor modes for the same regexp.") (use-package smart-forward :commands (smart-up smart-down smart-left smart-right)) (use-package smartparens - :functions sp-insert-pair :config (setq sp-autowrap-region nil ; let evil-surround handle this sp-highlight-pair-overlay nil diff --git a/core/core-os-osx.el b/core/core-os-osx.el index 488f3a979..1e11ec937 100644 --- a/core/core-os-osx.el +++ b/core/core-os-osx.el @@ -57,8 +57,8 @@ ;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on ;; Most of this code grokked from: ;; http://stackoverflow.com/questions/15873346/elisp-rename-macro - (defadvice evil-visual-update-x-selection (around clobber-x-select-text activate) - (unless (or (featurep 'mac) (featurep 'ns)) ad-do-it))) + (when (or (featurep 'mac) (featurep 'ns)) + (advice-add 'evil-visual-update-x-selection :override 'ignore))) ;; diff --git a/core/core-sessions.el b/core/core-sessions.el index 3b2368809..946bd48b3 100644 --- a/core/core-sessions.el +++ b/core/core-sessions.el @@ -46,6 +46,9 @@ automatically renamed to the project name.") (add-hook 'emacs-startup-hook 'workgroups-mode) :config + (unless (file-exists-p wg-workgroup-directory) + (mkdir wg-workgroup-directory)) + ;; Remember the set names in between sessions (push 'narf-wg-names savehist-additional-variables) diff --git a/core/core-ui.el b/core/core-ui.el index 03328721f..2e6788251 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -20,7 +20,7 @@ split-width-threshold nil ; favor horizontal splits show-help-function nil ; hide :help-echo text - jit-lock-defer-time 0.04 + jit-lock-defer-time nil jit-lock-stealth-nice 0.1 jit-lock-stealth-time 0.2 jit-lock-stealth-verbose nil @@ -59,8 +59,8 @@ (setq frame-title-format '(buffer-file-name "%f" ("%b"))) ;; set fonts - (narf/load-font narf-default-font) - (set-face-attribute 'default t :font narf-default-font) + (set-frame-font (setq narf-current-font narf-default-font) t) + (set-face-attribute 'default t :font narf-current-font) ;; standardize fringe width (fringe-mode narf-fringe-size) @@ -73,31 +73,22 @@ ;; Brighter minibuffer when active (defface narf-minibuffer-active '((t (:inherit mode-line))) "Face for active minibuffer") - (defun narf|minibuffer-setup () + (add-hook! minibuffer-setup (set-window-fringes (selected-window) 0 0 nil) (make-local-variable 'face-remapping-alist) (add-to-list 'face-remapping-alist '(default narf-minibuffer-active))) - (add-hook! minibuffer-setup 'narf|minibuffer-setup) (add-hook! 'after-init-hook (set-window-fringes (minibuffer-window) 0 0 nil))) ;; Try to display unicode characters without upsetting line-hieght (as much as possible) -(mapc (lambda (set) - (let ((font (car set)) - (chars (cadr set)) - (size (caddr set))) - (mapc (lambda (x) (set-fontset-font - "fontset-default" `(,x . ,x) - (font-spec :name font :size size) nil 'prepend)) - chars))) - '(("DejaVu Sans" (?☑ ?☐ ?⚠ ?★ ?λ ?♭ ?♯ - ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓)) - ;; File attachment symbols (for org-mode) - ("FontAwesome" (? ? ? ? ? ? ? ? ?) 13) - ;; Certain math symbols - ("Hack" (?× ?∙ ?÷ ?⌉ ?⌈ ?⌊ ?⌋ - ?∩ ?∪ ?⊆ ?⊂ ?⊄ ?⊇ ?⊃ ?⊅ - ?⇒ ?⇐ ?⇔ ?↔ ?→ ?≡ ?∴ ?∵ ?⊕ ?∀ ?∃ ?∄ ?∈ ?∉ - ?∨ ?∧ ?¬)))) +(defun narf-fix-unicode (set) + (let ((font (car set)) + (chars (cadr set)) + (size (caddr set))) + (mapc (lambda (x) (set-fontset-font + "fontset-default" `(,x . ,x) + (font-spec :name font :size size) nil 'prepend)) + chars))) +(mapc 'narf-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)) @@ -128,9 +119,10 @@ (defface narf-note-face '((t (:inherit font-lock-warning-face))) "Face for NOTEs") (add-hook! (prog-mode emacs-lisp-mode) - (font-lock-add-keywords nil '(("\\<\\(TODO\\((.+)\\)?:?\\)" 1 'narf-todo-face prepend) - ("\\<\\(FIXME\\((.+)\\)?:?\\)" 1 'narf-fixme-face prepend) - ("\\<\\(NOTE\\((.+)\\)?:?\\)" 1 'narf-note-face prepend)))) + (font-lock-add-keywords + nil '(("\\<\\(TODO\\((.+)\\)?:?\\)" 1 'narf-todo-face prepend) + ("\\<\\(FIXME\\((.+)\\)?:?\\)" 1 'narf-fixme-face prepend) + ("\\<\\(NOTE\\((.+)\\)?:?\\)" 1 'narf-note-face prepend)))) ;; Fade out when unfocused (add-hook! focus-in (set-frame-parameter nil 'alpha 100)) @@ -144,7 +136,10 @@ ;; Plugins ;; -(use-package visual-fill-column :defer t) +(use-package visual-fill-column :defer t + :config + (setq-default visual-fill-column-center-text nil + visual-fill-column-width fill-column)) (use-package highlight-indentation :commands (highlight-indentation-mode highlight-indentation-current-column-mode) @@ -154,9 +149,9 @@ 'highlight-indentation-mode) (after! editorconfig - (defun narf/hl-indent-guess-offset () + (defun narf*hl-indent-guess-offset () (string-to-int (gethash 'indent_size (editorconfig-get-properties)))) - (advice-add 'highlight-indentation-guess-offset :override 'narf/hl-indent-guess-offset)) + (advice-add 'highlight-indentation-guess-offset :override 'narf*hl-indent-guess-offset)) ;; A long-winded method for ensuring whitespace is maintained (so that ;; highlight-indentation-mode can display them consistently) diff --git a/core/core.el b/core/core.el index bddfa72af..c4ae2e7dd 100644 --- a/core/core.el +++ b/core/core.el @@ -34,7 +34,6 @@ ediff-split-window-function 'split-window-horizontally ; side-by-side diffs ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames enable-recursive-minibuffers nil ; no minibufferception - history-length 1000 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 @@ -57,6 +56,8 @@ bookmark-default-file (concat narf-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") make-backup-files nil diff --git a/core/defuns/defuns-ui.el b/core/defuns/defuns-ui.el index c57fbab5e..c5db67362 100644 --- a/core/defuns/defuns-ui.el +++ b/core/defuns/defuns-ui.el @@ -1,17 +1,24 @@ ;;; defuns-ui.el ;; for ../core-ui.el -;;;###autoload -(defun narf:toggle-transparency () - (interactive) - (let* ((alpha (frame-parameter nil 'alpha)) - (alpha-val (if (listp alpha) (car alpha) alpha))) - (if (/= alpha-val 97) - (set-frame-parameter nil 'alpha 100) - (set-frame-parameter nil 'alpha 0)))) - ;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t) +;;;###autoload (autoload 'narf:set-columns "defuns-ui" nil t) (after! evil + (evil-define-command narf:set-columns (&optional bang columns) + "Adjusts visual-fill-column-width on the fly." + (interactive "") + (if (or (= (length columns) 0) bang) + (progn + (setq visual-fill-column-width 80) + (when visual-fill-column-mode + (visual-fill-column-mode -1))) + (setq columns (string-to-number columns)) + (when (> columns 30) + (setq visual-fill-column-width columns))) + (if visual-fill-column-mode + (visual-fill-column--adjust-window) + (visual-fill-column-mode 1))) + (evil-define-command narf:toggle-fullscreen () (interactive) (set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth)))) diff --git a/modules/extra-demo.el b/modules/extra-demo.el index 910503306..9a56791e2 100644 --- a/modules/extra-demo.el +++ b/modules/extra-demo.el @@ -1,13 +1,13 @@ ;;; extra-demo.el --- for collaboration and demonstrations +(defvar powerline-height) + ;; This library offers: ;; + impatient-mode: for broadcasting my emacs session ;; + big-mode: for enlarged text while screencasting ;; + TODO integration with reveal.js for presentations ;; + TODO peer programming collab -(defvar powerline-height) - ;; Big-mode settings (defconst big-mode-font (font-spec :family "Hack" :size 16)) (defconst big-mode-line-spacing 0) @@ -15,8 +15,7 @@ ;; (use-package impatient-mode - :defer t - :commands httpd-start) + :commands (httpd-start impatient-mode)) (defvar big-mode--line-spacing line-spacing) (defvar big-mode--powerline-height powerline-height) diff --git a/modules/extra-write.el b/modules/extra-write.el index b77bca499..482ded837 100644 --- a/modules/extra-write.el +++ b/modules/extra-write.el @@ -1,28 +1,23 @@ ;; extra-write.el ;; This library offers the following: -;; + Write-mode: a mode that turns Emacs into an app for writing notes, papers, or -;; fiction: it adds eye-candy to org-mode, switches to a light color theme and -;; to a more readable font. +;; + TODO Write-mode: a mode that turns Emacs into an app for writing notes, papers, or +;; fiction: it adds eye-candy to org-mode, switches to a light color theme and to a +;; more readable font. ;; + Bibtex integration ;; Write-mode settings (defconst write-mode nil) -(defconst write-mode-font (font-spec :family "Hack" :size 12)) +(defconst write-mode-font (font-spec :family "Hack" :size 14)) (defconst write-mode-biblio-dir "~/Dropbox/docs/biblio") (defconst write-mode--last-mode-line mode-line-format) (defconst write-mode--last-line-spacing line-spacing) ;; -(setq-default visual-fill-column-center-text nil - visual-fill-column-width 80) - (defun write-mode|org-hook () "A hook that runs everytime an org-mode buffer is visited/created while `write-mode' is -active." - ;; (font-lock-add-keywords nil write-mode-org-font-lock-keywords) - ) +active.") (defun write-mode-toggle () "Enable write-mode, this is not a [global] minor mode because it mixes some frame-local @@ -32,11 +27,6 @@ functionality with buffer-local ones, which can be buggy in a minor-mode." (on-off (if mode-p -1 +1))) ;; (scroll-bar-mode on-off) (narf/load-font (if mode-p narf-default-font write-mode-font)) - (when (featurep 'volatile-highlights) - (volatile-highlights-mode (not on-off))) - (when IS-MAC - (setq mouse-wheel-scroll-amount - (if mode-p '(5 ((shift) . 2)) '(3 ((shift) . 2))))) (if write-mode (remove-hook 'org-mode-hook 'write-mode|org-hook) (add-hook 'org-mode-hook 'write-mode|org-hook)) @@ -51,22 +41,7 @@ functionality with buffer-local ones, which can be buggy in a minor-mode." (narf/get-buffers-in-modes '(org-mode markdown-mode))) (setq write-mode (not write-mode)))) -(evil-define-command narf:set-columns (&optional bang columns) - "Adjusts visual-fill-column-width on the fly." - (interactive "") - (if (or (= (length columns) 0) bang) - (progn - (setq visual-fill-column-width 80) - (when visual-fill-column-mode - (visual-fill-column-mode -1))) - (setq columns (string-to-number columns)) - (when (> columns 30) - (setq visual-fill-column-width columns))) - (if visual-fill-column-mode - (visual-fill-column--adjust-window) - (visual-fill-column-mode 1))) - -(when (>= emacs-major-version 25) +(when (> emacs-major-version 24) ;; From ;; Splitting windows while visual-fill-column makes Emacs go crazy. This prevents that ;; by simply disabled VFC before splitting. diff --git a/modules/module-data.el b/modules/module-data.el index dd4a3f6fc..ea9c4bf6b 100644 --- a/modules/module-data.el +++ b/modules/module-data.el @@ -4,18 +4,20 @@ (associate! nxml-mode :match "\\.plist$") (use-package toml-mode :mode "\\.toml$") + (use-package yaml-mode :mode "\\.ya?ml$" :config (def-electric! yaml-mode :chars (?\n ?: ?-))) + (use-package json-mode :mode "\\.js\\(on\\|hintrc\\)$" :config (def-electric! json-mode :chars (?\n ?: ?{ ?}))) +(use-package vimrc-mode :mode ("/\\.?g?vimrc$" "\\.vim$" "/\\.vim/rc/.+$")) + (use-package dockerfile-mode :mode "/Dockerfile$" :config (def-docset! dockerfile-mode "docker") (def-builder! dockerfile-mode dockerfile-build-buffer "Dockerfile")) -(use-package vimrc-mode :mode ("/\\.?g?vimrc$" "\\.vim$" "/\\.vim/rc/.+$")) - ;; (def-project-type! ansible-mode "ans" :modes (yaml-mode)