From 5139ef2244563e99d28aeeee2e00cfd846372261 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Mon, 23 Jun 2025 10:51:51 -0700 Subject: [PATCH] Add copy in el-patch-literal --- CHANGELOG.md | 5 +++++ el-patch.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b420f2..5581341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. +## Unreleased +### Bugs fixed +* Using `el-patch-literal` could result in incorrect patch generation + in some cases. This is fixed. + ## 3.1 (released 2023-11-23) ### Features * New user option `el-patch-use-advice` which can be customized to diff --git a/el-patch.el b/el-patch.el index b910d5e..fe24a48 100644 --- a/el-patch.el +++ b/el-patch.el @@ -250,7 +250,7 @@ Return a list of forms to be spliced into the surrounding s-expression. Resolve in favor of the original version if NEW is nil; otherwise resolve in favor of the new version. TABLE is a hash table of `el-patch-let' bindings, which maps symbols to -their bindings." +their bindings. The return value may be destructively modified." (let ((table (or table (make-hash-table :test 'equal)))) (cond ((consp form) @@ -344,7 +344,7 @@ their bindings." (when (<= (length form) 1) (error "Not enough arguments (%d) for `el-patch-literal'" (1- (length form)))) - (cdr form)) + (el-patch--copy-semitree (cdr form))) ((quote el-patch-concat) (when (<= (length form) 1) (error "Not enough arguments (%d) for `el-patch-concat'"