[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash e7bc8fe 250/426: Make dash-specific font lock opti
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash e7bc8fe 250/426: Make dash-specific font lock optional |
Date: |
Tue, 04 Aug 2015 19:38:04 +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 ca9b296 263/426: Add Cask-file., (continued)
- [elpa] externals/dash ca9b296 263/426: Add Cask-file., Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bbaed5 256/426: Release 2.4.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8005153 259/426: Add customize option to turn on font-lock for dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9de1435 248/426: Merge pull request #53 from Fuco1/tree-stuff, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7357283 258/426: Merge pull request #57 from Silex/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash da9888f 266/426: Release 2.4.1, Phillip Lord, 2015/08/04
- [elpa] externals/dash 47af4d6 265/426: Merge pull request #61 from Fuco1/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash c788474 264/426: Fix bug with nested lists in `-remove-at-indices`, Phillip Lord, 2015/08/04
- [elpa] externals/dash 396d6ac 271/426: Declare macro before using it., Phillip Lord, 2015/08/04
- [elpa] externals/dash 386ec0a 273/426: Add -same-items? function., Phillip Lord, 2015/08/04
- [elpa] externals/dash e7bc8fe 250/426: Make dash-specific font lock optional,
Phillip Lord <=
- [elpa] externals/dash a84a434 267/426: 2.4.1 in readme-template too, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4818368 272/426: Release 2.4.3, Phillip Lord, 2015/08/04
- [elpa] externals/dash b661f96 269/426: Merge pull request #62 from Fuco1/consfix, Phillip Lord, 2015/08/04
- [elpa] externals/dash 25be31a 270/426: Release 2.4.2, Phillip Lord, 2015/08/04
- [elpa] externals/dash f86d235 268/426: Fix -cons*, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3eb91fe 280/426: Add `-find-last-index`, Phillip Lord, 2015/08/04
- [elpa] externals/dash ec9afcb 255/426: Merge pull request #54 from Fuco1/index/modify, Phillip Lord, 2015/08/04
- [elpa] externals/dash 930b390 278/426: Add -list function., Phillip Lord, 2015/08/04
- [elpa] externals/dash adaeff7 274/426: Merge pull request #65 from rejeep/same-items-predicate, Phillip Lord, 2015/08/04
- [elpa] externals/dash e6cae0b 279/426: Merge pull request #68 from rejeep/list-function, Phillip Lord, 2015/08/04