Merge branch 'develop' into release-2.0.4

* develop: (45 commits)
  General cleanup
  Update changelog
  Refactor doom-get-packages
  Refactor doom-initialize-packages
  Refactor core.el
  Enable shackle-mode later in startup process
  Appease byte-compiler
  Bind e => debugger-eval-expression in debugger
  Less 'nowhere to go' spam on doom/kill-this-buffer
  Add display-line-numbers support in Emacs 26 #59
  Remove (interactive) from non-interactive funcs
  Refactor doom-popup-size (cond -> pcase)
  Refactor doom-popup-prop (cond -> pcase)
  Fix wrong-type-argument: bufferp error on ESC
  Revert 8edba655: disable undo persistence
  Refactor makefile
  Rename core + module byte-compilation make tasks
  doom/clean-compiled => doom/clean-compiled-files
  Rename doom/clean-cache => doom/reset (+ make reset)
  Rename bin/doctor => bin/doom-doctor
  ...
This commit is contained in:
Henrik Lissner 2017-07-14 15:25:30 +02:00
commit 0541e48370
36 changed files with 644 additions and 286 deletions

View file

@ -163,6 +163,6 @@ These are /not/ loaded automatically. Use ~load!~ to do so.
+ ~doom/reload-autoloads~
+ ~doom/compile~
+ ~doom/recompile~
+ ~doom/clean-cache~
+ ~doom/reset~
+ ~doom/clean-compiled~

View file

@ -140,7 +140,7 @@ default/fallback account."
mu4e-marks)
;; This hook correctly modifies gmail flags on emails when they are marked.
;; Without it refiling (archiving), trashing, and flagging (starring) email
;; Without it, refiling (archiving), trashing, and flagging (starring) email
;; won't properly result in the corresponding gmail action, since the marks
;; are ineffectual otherwise.
(defun +email|gmail-fix-flags (mark msg)

View file

@ -20,10 +20,10 @@
(defvar +ivy--file-search-all-files-p nil)
(defun +ivy--file-search (engine beg end query &optional directory)
(let* ((directory (or directory (doom-project-root)))
(let* ((project-root (doom-project-root))
(directory (or directory project-root))
(recursion-p +ivy--file-search-recursion-p)
(all-files-p +ivy--file-search-all-files-p)
(project-root (doom-project-root))
(query
(or query
(and beg end
@ -40,24 +40,22 @@
(t
(file-relative-name directory project-root))))))
(setq +ivy--file-last-search query)
(cond ((eq engine 'ag)
(let ((args (concat
(if all-files-p " -a")
(unless recursion-p " -n"))))
(counsel-ag query directory args (format prompt args))))
((eq engine 'rg)
;; smart-case instead of case-insensitive flag
(let ((counsel-rg-base-command
(replace-regexp-in-string " -i " " -S " counsel-rg-base-command))
(args (concat
(if all-files-p " -uu")
(unless recursion-p " --maxdepth 0"))))
(counsel-rg query directory args (format prompt args))))
((eq engine 'pt)) ; TODO pt search engine (necessary?)
(t (error "No search engine specified")))))
(pcase engine
('ag
(let ((args (concat
(if all-files-p " -a")
(unless recursion-p " -n"))))
(counsel-ag query directory args (format prompt args))))
('rg
;; smart-case instead of case-insensitive flag
(let ((counsel-rg-base-command
(replace-regexp-in-string " -i " " -S " counsel-rg-base-command))
(args (concat
(if all-files-p " -uu")
(unless recursion-p " --maxdepth 0"))))
(counsel-rg query directory args (format prompt args))))
('pt) ;; TODO pt search engine (necessary?)
(_ (error "No search engine specified")))))
;;;###autoload (autoload '+ivy:ag "completion/ivy/autoload/evil" nil t)
(evil-define-operator +ivy:ag (beg end query &optional all-files-p directory)

View file

@ -3,9 +3,8 @@
;; Show more information in ivy-switch-buffer; and only display
;; workgroup-relevant buffers.
(defun +ivy--get-buffers (&optional buffer-list)
(when-let (buffer-list (or buffer-list (doom-buffer-list)))
(let* ((buffer-list (or buffer-list (doom-buffer-list)))
(min-name
(when-let (buffer-list (delq (current-buffer) (or buffer-list (doom-buffer-list))))
(let* ((min-name
(+ 5 (cl-loop for buf in buffer-list
maximize (length (buffer-name buf)))))
(min-mode
@ -38,35 +37,39 @@
(defun +ivy--select-buffer-action (buffer)
(ivy--switch-buffer-action
(s-chop-suffix
(string-remove-suffix
"[+]"
(substring buffer 0 (string-match-p (regexp-quote " ") buffer)))))
(defun +ivy--select-buffer-other-window-action (buffer)
(ivy--switch-buffer-other-window-action
(s-chop-suffix
(string-remove-suffix
"[+]"
(substring buffer 0 (string-match-p (regexp-quote " ") buffer)))))
;;;###autoload
(defun +ivy/switch-workspace-buffer (&optional other-window-p)
"Switch to an open buffer in the current workspace."
"Switch to an open buffer in the current workspace.
If OTHER-WINDOW-P (universal arg), then open target in other window."
(interactive "P")
(+ivy/switch-buffer other-window-p t))
;;;###autoload
(defun +ivy/switch-buffer (&optional other-window-p workspace-only-p)
"Switch to an open buffer in the global buffer list. If WORKSPACE-ONLY-P,
limit to buffers in the current workspace."
"Switch to an open buffer in the global buffer list.
If OTHER-WINDOW-P (universal arg), then open target in other window.
If WORKSPACE-ONLY-P (universal arg), limit to buffers in the current workspace."
(interactive "P")
(ivy-read (format "%s buffers: " (if workspace-only-p "Workspace" "Global"))
(+ivy--get-buffers (unless workspace-only-p (buffer-list)))
:action (if other-window-p
'+ivy--select-buffer-other-window-action
'+ivy--select-buffer-action)
:matcher 'ivy--switch-buffer-matcher
#'+ivy--select-buffer-other-window-action
#'+ivy--select-buffer-action)
:matcher #'ivy--switch-buffer-matcher
:keymap ivy-switch-buffer-map
:caller '+ivy/switch-workspace-buffer))
:caller #'+ivy/switch-workspace-buffer))
(defun +ivy--tasks-candidates (tasks)
"Generate a list of task tags (specified by `+ivy-task-tags') for

View file

@ -13,8 +13,8 @@
;;;###autoload (autoload '+evil/mc-make-cursor-here "feature/evil/autoload/evil-mc" nil t)
(evil-define-command +evil/mc-make-cursor-here ()
"Create a cursor at point. If in visual block or line mode, then create
cursors in column beneath+above the point on each line. Otherwise pauses
cursors."
cursors on each line of the selection, on the column of the cursor. Otherwise
pauses cursors."
:repeat nil
:keep-visual nil
:evil-mc t

View file

@ -29,25 +29,28 @@
(defun +workspace-buffer-list (&optional persp)
"Return a list of buffers in PERSP (defaults to the current perspective).
The buffer list is ordered by recency (same as `buffer-list').
PERSP can be a string (name of a workspace) or a perspective hash (satisfies
`+workspace-p').
If PERSP is t, then return a list of orphaned buffers associated with no
perspectives."
(cond ((not persp)
(persp-buffer-list-restricted))
((eq persp t)
(cl-remove-if #'persp--buffer-in-persps (doom-buffer-list)))
((+workspace-p persp)
(safe-persp-buffers persp))
((stringp persp)
(safe-persp-buffers (+workspace-get persp t)))))
(unless persp
(setq persp (get-current-persp)))
(if (eq persp t)
(cl-remove-if #'persp--buffer-in-persps (buffer-list))
(when (stringp persp)
(setq persp (+workspace-get persp t)))
(cl-loop for buf in (buffer-list)
if (persp-contain-buffer-p buf persp)
collect buf)))
;;;###autoload
(defun +workspace-p (obj)
"Return t if OBJ is a perspective hash table."
(and obj
(hash-table-p obj)
(cl-struct-p obj)
(perspective-p obj)))
;;;###autoload
@ -70,11 +73,21 @@ perspectives."
(error "%s is not an available workspace" name))
persp)))
;;;###autoload
(defalias '+workspace-current #'get-current-persp)
;;;###autoload
(defun +workspace-current-name ()
"Get the name of the currently active workspace."
(safe-persp-name (get-current-persp)))
;;;###autoload
(defun +workspace-contains-buffer-p (&optional buffer workspace)
"Return non-nil if buffer is in workspace (defaults to current workspace)."
(unless workspace
(setq workspace (+workspace-current)))
(persp-contain-buffer-p buffer workspace nil))
;;;###autoload
(defun +workspace-load (name)
"Loads and inserts a single workspace (named NAME) into the current session.

View file

@ -55,16 +55,20 @@ renamed.")
;; only auto-save when real buffers are present
(advice-add #'persp-asave-on-exit :around #'+workspaces*autosave-real-buffers)
(defun +workspaces|on-persp-mode ()
;; Remap `buffer-list' to current workspace's buffers in `doom-buffer-list'
(if persp-mode
(advice-add #'doom-buffer-list :override #'+workspace-buffer-list)
(advice-remove #'doom-buffer-list #'+workspace-buffer-list)))
(add-hook 'persp-mode-hook #'+workspaces|on-persp-mode)
;; Defer delayed warnings even further, so they appear after persp-mode is
;; started and the main workspace is ready to display them. Otherwise, warning
;; buffers will be hidden on startup.
(remove-hook 'delayed-warnings-hook #'display-delayed-warnings)
(defun +workspaces|init (&optional frame)
(unless persp-mode
(persp-mode +1)
;; Remap `buffer-list' to current workspace's buffers in
;; `doom-buffer-list'
(advice-add #'doom-buffer-list :override #'+workspace-buffer-list))
(persp-mode +1))
(let ((frame (or frame (selected-frame))))
(unless noninteractive
;; The default perspective persp-mode makes (defined by

View file

@ -0,0 +1,89 @@
;;; feature/workspaces/test/autoload-workspaces.el -*- lexical-binding: t; -*-
(require! :feature workspaces)
(defmacro -with-workspace! (buffer-args &rest body)
(declare (indent defun))
(let ((buffers
(cl-loop for bsym in buffer-args
collect `(,bsym (get-buffer-create ,(symbol-name bsym))))))
`(let (noninteractive)
(+workspaces|init)
(save-window-excursion
(let* (,@buffers)
(cl-loop with persp = (get-current-persp)
for buf in (list ,@(mapcar #'car buffers))
do (persp-add-buffer buf persp)
do (with-current-buffer buf
(setq buffer-file-name (make-temp-file "workspaces-test-"))))
,@body
(dolist (buf (list ,@(mapcar #'car buffers)))
(persp-remove-buffer buf)
(kill-buffer buf))))
(persp-mode -1)
(setq *persp-hash* nil
persp-buffer-props-hash nil))))
;;
(def-test! init
(-with-workspace! ()
(should (equal (+workspace-current-name) +workspaces-main))))
(def-test! advice
(should (advice-member-p #'+workspaces*auto-add-buffer #'switch-to-buffer)))
(def-test! current
(-with-workspace! ()
(should (equal (+workspace-current-name) +workspaces-main))
(should (+workspace-exists-p +workspaces-main))
(let ((workspace (+workspace-get +workspaces-main))
(current-workspace (+workspace-current)))
(should workspace)
(should (+workspace-p workspace))
(should (+workspace-p current-workspace))
(should (equal workspace current-workspace)))))
(def-test! workspace-list
(-with-workspace! ()
(should (equal (+workspace-list-names)
(list (+workspace-current-name))))
(should (equal (+workspace-list)
(list (+workspace-current))))))
(def-test! workspace-crud
"Creating, reading, updating and deleting workspaces."
(-with-workspace! ()
(let ((new-workspace-name "*new-test*")
(renamed-workspace-name "*old-test*"))
(should (+workspace-new new-workspace-name))
(should (seq-contains (+workspace-list-names) new-workspace-name))
(should (equal new-workspace-name
(+workspace-rename new-workspace-name renamed-workspace-name)))
(should-not (seq-contains (+workspace-list-names) new-workspace-name))
(should (seq-contains (+workspace-list-names) renamed-workspace-name))
(should (= (length (+workspace-list-names)) 2))
(+workspace-delete renamed-workspace-name)
(should (= (length (+workspace-list-names)) 1)))))
(def-test! workspace-switch
(-with-workspace! ()
(let ((new-workspace-name "*new-test*"))
(should-error (+workspace-switch new-workspace-name))
(should (+workspace-switch new-workspace-name t))
(should (equal (+workspace-current-name) new-workspace-name)))))
(def-test! buffer-list
(-with-workspace! (a b)
(let ((c (get-buffer-create "c"))
(d (get-buffer-create "d")))
(should (+workspace-contains-buffer-p a))
(should (+workspace-contains-buffer-p b))
(should-not (+workspace-contains-buffer-p c))
;; New (and real) buffers should be added to workspace buffer list.
(doom-set-buffer-real c t)
(switch-to-buffer "c")
(should (+workspace-contains-buffer-p c))
;; unreal buffers shouldn't
(switch-to-buffer "d")
(should-not (+workspace-contains-buffer-p d)))))

View file

@ -145,18 +145,6 @@
(def-package! disaster :commands disaster)
;;
;; Plugins
;;
(when (featurep! :completion company)
(def-package! company-cmake :after cmake-mode)
(def-package! company-irony :after irony)
(def-package! company-irony-c-headers :after company-irony))
;;
;; Major modes
;;
@ -166,8 +154,6 @@
:config
(set! :company-backend 'cmake-mode '(company-cmake company-yasnippet)))
(def-package! glsl-mode :mode ("\\.glsl$" "\\.vert$" "\\.frag$" "\\.geom$"))
(def-package! cuda-mode :mode "\\.cuh?$")
(def-package! opencl-mode :mode "\\.cl$")
@ -175,3 +161,29 @@
(def-package! demangle-mode
:commands demangle-mode
:init (add-hook 'llvm-mode-hook #'demangle-mode))
(def-package! glsl-mode
:mode "\\.glsl$"
:mode "\\.vert$"
:mode "\\.frag$"
:mode "\\.geom$")
;;
;; Plugins
;;
(when (featurep! :completion company)
(def-package! company-cmake :after cmake-mode)
(def-package! company-irony :after irony)
(def-package! company-irony-c-headers :after company-irony)
(def-package! company-glsl
:when (featurep! :completion company)
:after glsl-mode
:config
(if (executable-find "glslangValidator")
(warn "glsl-mode: couldn't find glslangValidator, disabling company-glsl")
(set! :company-backend 'glsl-mode '(company-glsl)))))

View file

@ -15,6 +15,7 @@
(package! flycheck-irony))
(when (featurep! :completion company)
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))
(package! company-irony)
(package! company-irony-c-headers))

View file

@ -0,0 +1,15 @@
;;; lang/perl/config.el -*- lexical-binding: t; -*-
;; There's also `perl-mode' for perl < 6, which is already set up.
(when (featurep! :feature syntax-checker)
(add-hook 'perl-mode-hook #'flycheck-mode))
(def-package! perl6-mode
:init (require 'perl6-detect))
(def-package! flycheck-perl6
:after perl6-mode
:when (featurep! :feature syntax-checker)
:config (add-hook 'perl6-mode-hook #'flycheck-mode))

View file

@ -0,0 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; lang/perl/packages.el
(package! perl6-mode)
(when (featurep! :feature syntax-checker)
(package! flycheck-perl6))

View file

@ -0,0 +1,10 @@
;;; lang/plantuml/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +plantuml/install ()
"Install plantuml.jar."
(interactive)
(unless (file-exists-p plantuml-jar-path)
(user-error "plantuml.jar already installed"))
(url-copy-file "https://kent.dl.sourceforge.net/project/plantuml/plantuml.jar"
plantuml-jar-path))

View file

@ -0,0 +1,18 @@
;;; lang/plantuml/config.el -*- lexical-binding: t; -*-
(def-package! plantuml-mode
:mode "\\.p\\(lant\\)?uml$"
:config
(setq plantuml-jar-path (concat doom-etc-dir "plantuml.jar"))
(set! :popup "*PLANTUML Preview*" :size 25 :noselect t :autokill t)
(unless (executable-find "java")
(warn "plantuml-mode: can't find java, preview disabled."))
(unless (file-exists-p plantuml-jar-path)
(warn "plantuml-mode: can't find plantuml.jar; run M-x +plantuml/install.")))
(def-package! flycheck-plantuml
:when (featurep! :feature syntax-checker)
:after plantuml-mode
:config (flycheck-plantuml-setup))

View file

@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/plantuml/packages.el
(package! plantuml-mode)
(when (featurep! :feature syntax-checker)
(package! flycheck-plantuml))

View file

@ -50,6 +50,6 @@
:when (featurep! :completion company)
:after sh-script
:config
(set! :company-backend 'sh-mode '(company-shell))
(set! :company-backend 'sh-mode '(company-shell company-files))
(setq company-shell-delete-duplicates t))

View file

@ -190,6 +190,11 @@ between the two."
:i "C-H" #'+org/table-previous-field
:i "C-K" #'+org/table-previous-row
:i "C-J" #'+org/table-next-row
;; Expand tables (or shiftmeta move)
:ni "C-S-l" #'+org/table-append-field-or-shift-right
:ni "C-S-h" #'+org/table-prepend-field-or-shift-left
:ni "C-S-k" #'+org/table-prepend-row-or-shift-up
:ni "C-S-j" #'+org/table-append-row-or-shift-down
:n [tab] #'+org/toggle-fold
:i [tab] #'+org/indent-or-next-field-or-yas-expand

View file

@ -66,6 +66,9 @@
:m "A-j" #'+hlissner:multi-next-line
:m "A-k" #'+hlissner:multi-previous-line
(:prefix "C-x"
"p" #'doom/other-popup)
;; --- <leader> -------------------------------------
(:leader
@ -628,6 +631,7 @@
;; For elisp debugging
:map debugger-mode-map
:n "RET" #'debug-help-follow
:n "e" #'debugger-eval-expression
:n "n" #'debugger-step-through
:n "c" #'debugger-continue)
@ -695,7 +699,7 @@
(evilem-default-keybindings prefix)
(evilem-define (kbd (concat prefix " n")) #'evil-ex-search-next)
(evilem-define (kbd (concat prefix " N")) #'evil-ex-search-previous)
(evilem-define (kbd (concat prefix " s")) 'evil-snipe-repeat
(evilem-define (kbd (concat prefix " s")) #'evil-snipe-repeat
:pre-hook (save-excursion (call-interactively #'evil-snipe-s))
:bind ((evil-snipe-scope 'buffer)
(evil-snipe-enable-highlight)
@ -748,7 +752,9 @@
(:after org-mode
(:map org-mode-map
:i [remap doom/inflate-space-maybe] #'org-self-insert-command))
:i [remap doom/inflate-space-maybe] #'org-self-insert-command
:i "C-e" #'org-end-of-line
:i "C-a" #'org-beginning-of-line))
;; Make ESC quit all the things
(:map (minibuffer-local-map

View file

@ -57,7 +57,7 @@
(ex! "k[ill]o" #'doom/kill-other-buffers)
(ex! "l[ast]" #'doom/popup-restore)
(ex! "m[sg]" #'view-echo-area-messages)
(ex! "pop[up]" #'doom/popup) ; open current buffer in popup
(ex! "pop[up]" #'doom/popup-this-buffer)
;; Project navigation
(ex! "a" #'projectile-find-other-file)