[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash e7bc8fe 250/439: Make dash-specific font lock opti
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash e7bc8fe 250/439: Make dash-specific font lock optional |
Date: |
Tue, 04 Aug 2015 20:28:39 +0000 |
branch: externals/dash
commit e7bc8feb6aea44f6585943d411acebd8b0dd1249
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Make dash-specific font lock optional
Closes #52
---
README.md | 9 ++-
dash.el | 326 ++++++++++++++++++++++++++--------------------------
readme-template.md | 7 +
3 files changed, 179 insertions(+), 163 deletions(-)
diff --git a/README.md b/README.md
index e16cd06..0ddcdfa 100644
--- a/README.md
+++ b/README.md
@@ -44,6 +44,13 @@ To get function combinators:
;; Package-Requires: ((dash "1.8.0") (dash-functional "1.0.0") (emacs
"24"))
+## Syntax highlighting of dash functions
+
+Font lock of dash functions in emacs lisp buffers is now optional.
+Include this in your emacs settings to get syntax highlighting:
+
+ (eval-after-load "dash" '(dash-enable-font-lock))
+
## Functions
@@ -1038,7 +1045,7 @@ but is twice as fast as it only traverse the structure
once.
```cl
(-tree-mapreduce-from 'identity '* 1 '(1 (2 (3 4) (5 6)) (7 (8 9)))) ;; =>
362880
-(--tree-mapreduce-from (+ it it) (cons it acc) nil '(1 (2 (4 9) (2 1)) (7 (4
3)))) ;; => (2 (4 (8 18) (4 2)) (14 (8 6)))
+(--tree-mapreduce-from (+ it it) (cons it acc) nil '(1 (2 (4 9) (2 1)) (7 (4
3)))) ;; => '(2 (4 (8 18) (4 2)) (14 (8 6)))
(concat "{" (--tree-mapreduce-from (cond ((-cons-pair? it) (concat
(symbol-name (car it)) " -> " (symbol-name (cdr it)))) (t (concat (symbol-name
it) " : {"))) (concat it (unless (or (equal acc "}") (equal (substring it (1-
(length it))) "{")) ", ") acc) "}" '((elips-mode (foo (bar . booze)) (baz .
qux)) (c-mode (foo . bla) (bum . bam))))) ;; => "{elips-mode : {foo : {bar ->
booze}, baz -> qux}, c-mode : {foo -> bla, bum -> bam}}"
```
diff --git a/dash.el b/dash.el
index 2938398..afc8752 100644
--- a/dash.el
+++ b/dash.el
@@ -843,7 +843,7 @@ otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair."
(if (= (length vars-vals) 1)
`(-if-let ,first-pair ,then ,@else)
`(-if-let ,first-pair
- (-if-let* ,rest ,then ,@else)
+ (-if-let* ,rest ,then ,@else)
,@else))))
(defmacro --if-let (val then &rest else)
@@ -1065,7 +1065,7 @@ then on this result and second element from the list etc.
The initial value is ignored on cons pairs as they always contain
two elements."
- (cond
+ (cond
((not tree) nil)
((-cons-pair? tree) tree)
((listp tree)
@@ -1084,7 +1084,7 @@ FN is first applied to first element of the list and
second
element, then on this result and third element from the list etc.
See `-reduce-r' for how exactly are lists of zero or one element handled."
- (cond
+ (cond
((not tree) nil)
((-cons-pair? tree) tree)
((listp tree)
@@ -1102,165 +1102,167 @@ replaced with new ones. This is useful when you need
to clone a
structure such as plist or alist."
(-tree-map 'identity list))
-(eval-after-load "lisp-mode"
- '(progn
- (let ((new-keywords '(
- "--each"
- "-each"
- "--each-while"
- "-each-while"
- "--dotimes"
- "-dotimes"
- "-map"
- "--map"
- "--reduce-from"
- "-reduce-from"
- "--reduce"
- "-reduce"
- "--reduce-r-from"
- "-reduce-r-from"
- "--reduce-r"
- "-reduce-r"
- "--filter"
- "-filter"
- "-select"
- "--select"
- "--remove"
- "-remove"
- "-reject"
- "--reject"
- "--keep"
- "-keep"
- "-flatten"
- "-concat"
- "--mapcat"
- "-mapcat"
- "--first"
- "-first"
- "--any?"
- "-any?"
- "-some?"
- "--some?"
- "-any-p"
- "--any-p"
- "-some-p"
- "--some-p"
- "--all?"
- "-all?"
- "-every?"
- "--every?"
- "-all-p"
- "--all-p"
- "-every-p"
- "--every-p"
- "--none?"
- "-none?"
- "-none-p"
- "--none-p"
- "-only-some?"
- "--only-some?"
- "-only-some-p"
- "--only-some-p"
- "-take"
- "-drop"
- "--take-while"
- "-take-while"
- "--drop-while"
- "-drop-while"
- "-split-at"
- "-rotate"
- "-insert-at"
- "--split-with"
- "-split-with"
- "-partition"
- "-partition-in-steps"
- "-partition-all"
- "-partition-all-in-steps"
- "-interpose"
- "-interleave"
- "--zip-with"
- "-zip-with"
- "-zip"
- "--map-indexed"
- "-map-indexed"
- "--map-when"
- "-map-when"
- "--replace-where"
- "-replace-where"
- "-partial"
- "-rpartial"
- "-juxt"
- "-applify"
- "-on"
- "-flip"
- "-const"
- "-cut"
- "-orfn"
- "-andfn"
- "-elem-index"
- "-elem-indices"
- "-find-indices"
- "--find-indices"
- "-find-index"
- "--find-index"
- "-select-by-indices"
- "-grade-up"
- "-grade-down"
- "->"
- "->>"
- "-->"
- "-when-let"
- "-when-let*"
- "--when-let"
- "-if-let"
- "-if-let*"
- "--if-let"
- "-union"
- "-distinct"
- "-intersection"
- "-difference"
- "-contains?"
- "-contains-p"
- "-repeat"
- "-cons*"
- "-sum"
- "-product"
- "-min"
- "-min-by"
- "--min-by"
- "-max"
- "-max-by"
- "--max-by"
- "-cons-to-list"
- "-value-to-list"
- "-tree-mapreduce-from"
- "--tree-mapreduce-from"
- "-tree-mapreduce"
- "--tree-mapreduce"
- "-tree-map"
- "--tree-map"
- "-tree-reduce-from"
- "--tree-reduce-from"
- "-tree-reduce"
- "--tree-reduce"
- "-clone"
- ))
- (special-variables '(
- "it"
- "it-index"
- "acc"
- "other"
- )))
- (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "\\<" (regexp-opt
special-variables 'paren) "\\>")
- 1
font-lock-variable-name-face)) 'append)
- (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(\\s-*"
(regexp-opt new-keywords 'paren) "\\>")
- 1 font-lock-keyword-face))
'append))
- (--each (buffer-list)
- (with-current-buffer it
- (when (and (eq major-mode 'emacs-lisp-mode)
- (boundp 'font-lock-mode)
- font-lock-mode)
- (font-lock-refresh-defaults))))))
+(defun dash-enable-font-lock ()
+ "Add syntax highlighting to dash functions, macros and magic values."
+ (eval-after-load "lisp-mode"
+ '(progn
+ (let ((new-keywords '(
+ "--each"
+ "-each"
+ "--each-while"
+ "-each-while"
+ "--dotimes"
+ "-dotimes"
+ "-map"
+ "--map"
+ "--reduce-from"
+ "-reduce-from"
+ "--reduce"
+ "-reduce"
+ "--reduce-r-from"
+ "-reduce-r-from"
+ "--reduce-r"
+ "-reduce-r"
+ "--filter"
+ "-filter"
+ "-select"
+ "--select"
+ "--remove"
+ "-remove"
+ "-reject"
+ "--reject"
+ "--keep"
+ "-keep"
+ "-flatten"
+ "-concat"
+ "--mapcat"
+ "-mapcat"
+ "--first"
+ "-first"
+ "--any?"
+ "-any?"
+ "-some?"
+ "--some?"
+ "-any-p"
+ "--any-p"
+ "-some-p"
+ "--some-p"
+ "--all?"
+ "-all?"
+ "-every?"
+ "--every?"
+ "-all-p"
+ "--all-p"
+ "-every-p"
+ "--every-p"
+ "--none?"
+ "-none?"
+ "-none-p"
+ "--none-p"
+ "-only-some?"
+ "--only-some?"
+ "-only-some-p"
+ "--only-some-p"
+ "-take"
+ "-drop"
+ "--take-while"
+ "-take-while"
+ "--drop-while"
+ "-drop-while"
+ "-split-at"
+ "-rotate"
+ "-insert-at"
+ "--split-with"
+ "-split-with"
+ "-partition"
+ "-partition-in-steps"
+ "-partition-all"
+ "-partition-all-in-steps"
+ "-interpose"
+ "-interleave"
+ "--zip-with"
+ "-zip-with"
+ "-zip"
+ "--map-indexed"
+ "-map-indexed"
+ "--map-when"
+ "-map-when"
+ "--replace-where"
+ "-replace-where"
+ "-partial"
+ "-rpartial"
+ "-juxt"
+ "-applify"
+ "-on"
+ "-flip"
+ "-const"
+ "-cut"
+ "-orfn"
+ "-andfn"
+ "-elem-index"
+ "-elem-indices"
+ "-find-indices"
+ "--find-indices"
+ "-find-index"
+ "--find-index"
+ "-select-by-indices"
+ "-grade-up"
+ "-grade-down"
+ "->"
+ "->>"
+ "-->"
+ "-when-let"
+ "-when-let*"
+ "--when-let"
+ "-if-let"
+ "-if-let*"
+ "--if-let"
+ "-union"
+ "-distinct"
+ "-intersection"
+ "-difference"
+ "-contains?"
+ "-contains-p"
+ "-repeat"
+ "-cons*"
+ "-sum"
+ "-product"
+ "-min"
+ "-min-by"
+ "--min-by"
+ "-max"
+ "-max-by"
+ "--max-by"
+ "-cons-to-list"
+ "-value-to-list"
+ "-tree-mapreduce-from"
+ "--tree-mapreduce-from"
+ "-tree-mapreduce"
+ "--tree-mapreduce"
+ "-tree-map"
+ "--tree-map"
+ "-tree-reduce-from"
+ "--tree-reduce-from"
+ "-tree-reduce"
+ "--tree-reduce"
+ "-clone"
+ ))
+ (special-variables '(
+ "it"
+ "it-index"
+ "acc"
+ "other"
+ )))
+ (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "\\<"
(regexp-opt special-variables 'paren) "\\>")
+ 1
font-lock-variable-name-face)) 'append)
+ (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(\\s-*"
(regexp-opt new-keywords 'paren) "\\>")
+ 1
font-lock-keyword-face)) 'append))
+ (--each (buffer-list)
+ (with-current-buffer it
+ (when (and (eq major-mode 'emacs-lisp-mode)
+ (boundp 'font-lock-mode)
+ font-lock-mode)
+ (font-lock-refresh-defaults)))))))
(provide 'dash)
;;; dash.el ends here
diff --git a/readme-template.md b/readme-template.md
index e483bb0..a8be55a 100644
--- a/readme-template.md
+++ b/readme-template.md
@@ -44,6 +44,13 @@ To get function combinators:
;; Package-Requires: ((dash "1.8.0") (dash-functional "1.0.0") (emacs
"24"))
+## Syntax highlighting of dash functions
+
+Font lock of dash functions in emacs lisp buffers is now optional.
+Include this in your emacs settings to get syntax highlighting:
+
+ (eval-after-load "dash" '(dash-enable-font-lock))
+
## Functions
[[ function-list ]]
- [elpa] externals/dash dbcb3ef 231/439: Update README, (continued)
- [elpa] externals/dash dbcb3ef 231/439: Update README, Phillip Lord, 2015/08/04
- [elpa] externals/dash bf85b21 242/439: Change &optional branches to &rest branches in `-if-let`s, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8e2422a 239/439: Add Christina Whyte (@kurisuwhyte) to list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash b4d84de 243/439: Add debug declarations for `-when-let`s and `-if-let`s, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6d20aa0 241/439: If has an indent function 2, not 1, Phillip Lord, 2015/08/04
- [elpa] externals/dash 459322d 244/439: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9936885 245/439: Merge pull request #51 from Fuco1/debug-decl, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38307e3 223/439: Partition docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash bf99147 247/439: Fix `-tree-mapreduce-from` test & reformat the tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 75efb60 246/439: Add tree map/reduce, Phillip Lord, 2015/08/04
- [elpa] externals/dash e7bc8fe 250/439: Make dash-specific font lock optional,
Phillip Lord <=
- [elpa] externals/dash 2ee84cb 251/439: Release 2.3.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash f4ba8db 252/439: Add -snoc, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9de1435 248/439: Merge pull request #53 from Fuco1/tree-stuff, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0f4cae9 249/439: Improve docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash ec9afcb 255/439: Merge pull request #54 from Fuco1/index/modify, Phillip Lord, 2015/08/04
- [elpa] externals/dash d8ccf85 254/439: Add replace/update/remove functions for index/indices, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bbaed5 256/439: Release 2.4.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash ab727ba 257/439: Correct anchors for links starting with '!', Phillip Lord, 2015/08/04
- [elpa] externals/dash 8052eb9 253/439: Merge pull request #55 from Fuco1/snoc, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8005153 259/439: Add customize option to turn on font-lock for dash, Phillip Lord, 2015/08/04