Add delq! and pushnew! macros
And move projectile configs to their respective modules (and out of package configs).
This commit is contained in:
parent
f934f38627
commit
742687a51e
5 changed files with 33 additions and 21 deletions
|
@ -135,6 +135,20 @@ Accepts the same arguments as `message'."
|
||||||
|
|
||||||
(defalias 'lambda! 'λ!)
|
(defalias 'lambda! 'λ!)
|
||||||
|
|
||||||
|
(defmacro pushnew! (place &rest values)
|
||||||
|
"Like `cl-pushnew', but will prepend VALUES to PLACE.
|
||||||
|
The order VALUES is preserved."
|
||||||
|
`(dolist (--value-- (nreverse (list ,@values)))
|
||||||
|
(cl-pushnew --value-- ,place)))
|
||||||
|
|
||||||
|
(defmacro delq! (elt list &optional fetcher)
|
||||||
|
"Delete ELT from LIST in-place."
|
||||||
|
`(setq ,list
|
||||||
|
(delq ,(if fetcher
|
||||||
|
`(funcall ,fetcher ,elt ,list)
|
||||||
|
elt)
|
||||||
|
,list)))
|
||||||
|
|
||||||
(defmacro defer-until! (condition &rest body)
|
(defmacro defer-until! (condition &rest body)
|
||||||
"Run BODY when CONDITION is true (checks on `after-load-functions'). Meant to
|
"Run BODY when CONDITION is true (checks on `after-load-functions'). Meant to
|
||||||
serve as a predicated alternative to `after!'."
|
serve as a predicated alternative to `after!'."
|
||||||
|
|
|
@ -39,18 +39,7 @@ Emacs.")
|
||||||
|
|
||||||
;; a more generic project root file
|
;; a more generic project root file
|
||||||
(push ".project" projectile-project-root-files-bottom-up)
|
(push ".project" projectile-project-root-files-bottom-up)
|
||||||
|
(push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories)
|
||||||
(setq projectile-globally-ignored-directories
|
|
||||||
(append projectile-globally-ignored-directories
|
|
||||||
(list (abbreviate-file-name doom-local-dir) ".sync"
|
|
||||||
"node_modules" "flow-typed"))
|
|
||||||
projectile-other-file-alist
|
|
||||||
(append projectile-other-file-alist
|
|
||||||
'(("css" "scss" "sass" "less" "styl")
|
|
||||||
("scss" "css")
|
|
||||||
("sass" "css")
|
|
||||||
("less" "css")
|
|
||||||
("styl" "css"))))
|
|
||||||
|
|
||||||
;; Accidentally indexing big directories like $HOME or / will massively bloat
|
;; Accidentally indexing big directories like $HOME or / will massively bloat
|
||||||
;; projectile's cache (into the hundreds of MBs). This purges those entries
|
;; projectile's cache (into the hundreds of MBs). This purges those entries
|
||||||
|
|
|
@ -237,13 +237,14 @@ This is ignored by ccls.")
|
||||||
(def-package! ccls
|
(def-package! ccls
|
||||||
:when (featurep! +lsp)
|
:when (featurep! +lsp)
|
||||||
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc|init-ccls)
|
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc|init-ccls)
|
||||||
|
:init
|
||||||
|
(after! projectile
|
||||||
|
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
|
||||||
|
(add-to-list 'projectile-project-root-files-bottom-up ".ccls-root")
|
||||||
|
(add-to-list 'projectile-project-root-files-top-down-recurring "compile_commands.json"))
|
||||||
:config
|
:config
|
||||||
(defun +cc|init-ccls ()
|
(defun +cc|init-ccls ()
|
||||||
(setq-local company-transformers nil)
|
(setq-local company-transformers nil)
|
||||||
(setq-local company-lsp-async t)
|
(setq-local company-lsp-async t)
|
||||||
(setq-local company-lsp-cache-candidates nil)
|
(setq-local company-lsp-cache-candidates nil)
|
||||||
(lsp))
|
(lsp)))
|
||||||
(after! projectile
|
|
||||||
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
|
|
||||||
(add-to-list 'projectile-project-root-files-bottom-up ".ccls-root")
|
|
||||||
(add-to-list 'projectile-project-root-files-top-down-recurring "compile_commands.json")))
|
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
;; Other
|
;; Other
|
||||||
:yield "import"))
|
:yield "import"))
|
||||||
|
|
||||||
|
(after! projectile
|
||||||
|
(pushnew! projectile-project-root-files "package.json")
|
||||||
|
(pushnew! projectile-globally-ignored-directories "node_modules" "flow-typed"))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Major modes
|
;; Major modes
|
||||||
|
@ -54,10 +58,6 @@
|
||||||
(set-electric! 'js2-mode :chars '(?\} ?\) ?. ?:))
|
(set-electric! 'js2-mode :chars '(?\} ?\) ?. ?:))
|
||||||
(set-repl-handler! 'js2-mode #'+javascript/open-repl)
|
(set-repl-handler! 'js2-mode #'+javascript/open-repl)
|
||||||
|
|
||||||
(after! projectile
|
|
||||||
(add-to-list 'projectile-project-root-files "package.json")
|
|
||||||
(add-to-list 'projectile-globally-ignored-directories "node_modules"))
|
|
||||||
|
|
||||||
(map! :map js2-mode-map
|
(map! :map js2-mode-map
|
||||||
:localleader
|
:localleader
|
||||||
"S" #'+javascript/skewer-this-buffer))
|
"S" #'+javascript/skewer-this-buffer))
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
"CSS" "HTML" "Bourbon" "Compass"
|
"CSS" "HTML" "Bourbon" "Compass"
|
||||||
["Sass" (memq major-mode '(scss-mode sass-mode))]))
|
["Sass" (memq major-mode '(scss-mode sass-mode))]))
|
||||||
|
|
||||||
|
(after! projectile
|
||||||
|
(pushnew! projectile-project-root-files
|
||||||
|
'("css" "scss" "sass" "less" "styl")
|
||||||
|
'("scss" "css")
|
||||||
|
'("sass" "css")
|
||||||
|
'("less" "css")
|
||||||
|
'("styl" "css")))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Major modes
|
;; Major modes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue