Skip to content

Commit

Permalink
Remove dependency on noflet
Browse files Browse the repository at this point in the history
I think `cl-flet` is sufficient for `with-ansi` because we only want to
bind the color names to the functions lexically, not dynamically.

In other words we don't want/need it to work for things like this:
```
(defun foo ()
  (black "foo"))

(with-ansi (foo))
```

In fact it seems like using dynamic flet could even be dangerous here.
For example imagine a user had their own function called `black` that they
intended to call from `foo` in the code above.
  • Loading branch information
davidshepherd7 committed Jul 1, 2015
1 parent dd50a2a commit b10c6b5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ansi.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Version: 0.4.0
;; Keywords: color, ansi
;; URL: http://github.com/rejeep/ansi
;; Package-Requires: ((s "1.6.1") (dash "1.5.0") (noflet "0.0.11"))
;; Package-Requires: ((s "1.6.1") (dash "1.5.0"))

;; This file is NOT part of GNU Emacs.

Expand All @@ -30,7 +30,6 @@

;;; Code:

(require 'noflet)
(require 'dash)
(require 's)

Expand Down Expand Up @@ -104,7 +103,7 @@

(defmacro with-ansi (&rest body)
"In this block shortcut names (without ansi- prefix) can be used."
`(noflet
`(cl-flet
,(-map
(lambda (alias)
(let ((fn (intern (format "ansi-%s" (symbol-name alias)))))
Expand Down

0 comments on commit b10c6b5

Please sign in to comment.