Refactor out map.el usage
After some profiling, it turns out map-put and map-delete are 5-7x slower (more on Emacs 25) than delq, setf/alist-get and add-to-list for small lists (under 250 items), which is exactly how I've been using them. The only caveat is alist-get's signature is different on Emacs 25, thus a polyfill is necessary in core-lib.
This commit is contained in:
parent
f602a1f607
commit
f6dc6ac74e
29 changed files with 177 additions and 146 deletions
|
@ -83,35 +83,37 @@ compilation database is present in the project.")
|
|||
+cc|fontify-constants))
|
||||
|
||||
;; Custom style, based off of linux
|
||||
(map-put c-style-alist "doom"
|
||||
`((c-basic-offset . ,tab-width)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist (brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty))
|
||||
(c-cleanup-list brace-else-brace)
|
||||
(c-offsets-alist
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(statement-cont . +)
|
||||
(case-label . +)
|
||||
;; align args with open brace OR don't indent at all (if open
|
||||
;; brace is at eolp and close brace is after arg with no trailing
|
||||
;; comma)
|
||||
(arglist-intro . +)
|
||||
(arglist-close +cc-lineup-arglist-close 0)
|
||||
;; don't over-indent lambda blocks
|
||||
(inline-open . 0)
|
||||
(inlambda . 0)
|
||||
;; indent access keywords +1 level, and properties beneath them
|
||||
;; another level
|
||||
(access-label . -)
|
||||
(inclass +cc-c++-lineup-inclass +)
|
||||
(label . 0))))
|
||||
(unless (assoc "doom" c-style-alist)
|
||||
(push '("doom"
|
||||
(c-basic-offset . ,tab-width)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist (brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty))
|
||||
(c-cleanup-list brace-else-brace)
|
||||
(c-offsets-alist
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(statement-cont . +)
|
||||
(case-label . +)
|
||||
;; align args with open brace OR don't indent at all (if open
|
||||
;; brace is at eolp and close brace is after arg with no trailing
|
||||
;; comma)
|
||||
(arglist-intro . +)
|
||||
(arglist-close +cc-lineup-arglist-close 0)
|
||||
;; don't over-indent lambda blocks
|
||||
(inline-open . 0)
|
||||
(inlambda . 0)
|
||||
;; indent access keywords +1 level, and properties beneath them
|
||||
;; another level
|
||||
(access-label . -)
|
||||
(inclass +cc-c++-lineup-inclass +)
|
||||
(label . 0)))
|
||||
c-style-alist))
|
||||
|
||||
;;; Keybindings
|
||||
;; Disable electric keys because it interferes with smartparens and custom
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue