Skip to content

Commit c2be85b

Browse files
committed
Use an internal variable for concat to allow template resolution (#66)
Avoids redefining `concat` in el-patch-template.
1 parent c4a1b43 commit c2be85b

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

el-patch-template.el

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,11 @@ Similar to `el-patch--resolve' with a special treatment for
523523
`el-patch-concat'. Specifically, if the arguments of
524524
`el-patch-concat' have `...' in them, it is not resolved but
525525
changed to `el-patch-template--concat'."
526-
(cl-letf* ((old-concat (symbol-function 'concat))
527-
((symbol-function 'concat)
528-
(lambda (&rest args)
529-
(if (cl-some (lambda (x) (equal x '...)) args)
530-
(cons 'el-patch-template--concat args)
531-
(apply old-concat args)))))
526+
(let ((el-patch--concat-function
527+
(lambda (args)
528+
(if (cl-some (lambda (x) (equal x '...)) args)
529+
(cons 'el-patch-template--concat args)
530+
(apply #'concat args)))))
532531
(el-patch--resolve forms nil)))
533532

534533
;; Stolen from el-patch--select

el-patch.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ when a patch renames a symbol.")
197197
(defvar el-patch--not-present (make-symbol "el-patch--not-present")
198198
"Value used as a default argument to `gethash'.")
199199

200+
(defvar el-patch--concat-function #'concat
201+
"Function to concatenate strings when resolving patches.")
202+
200203
;;;; Resolving patches
201204

202205
(defmacro el-patch--with-puthash (table kvs &rest body)
@@ -346,7 +349,8 @@ their bindings."
346349
(when (<= (length form) 1)
347350
(error "Not enough arguments (%d) for `el-patch-concat'"
348351
(1- (length form))))
349-
(list (apply #'concat (cl-mapcan resolve (cdr form)))))
352+
(list (apply el-patch--concat-function
353+
(cl-mapcan resolve (cdr form)))))
350354
(_
351355
(let ((car-forms (funcall resolve (car form)))
352356
(cdr-forms (funcall resolve (cdr form))))

0 commit comments

Comments
 (0)