Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased
### Bugs fixed
* The autoloading logic was a bit wrong and would lead to `el-patch`
itself being loaded, just from activating the autoloads. This has
been fixed, so now activating the autoloads does just that, and
`el-patch` itself is only loaded when you actually use an autoloaded
function.

## 3.1.1 (released 2025-08-15)
### Bugs fixed
* Using `el-patch-literal` could result in incorrect patch generation
Expand Down
10 changes: 9 additions & 1 deletion el-patch-stub.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
This temporary replacement for the real functionality just takes
care of the `declare' forms, and leaves everything else for
later."
(unless (fboundp 'el-patch-deftype)
(when (autoloadp (symbol-function 'el-patch-deftype))
(put 'el-patch-deftype 'orig-function (symbol-function 'el-patch-deftype))
(defmacro el-patch-deftype (type &rest kwargs)
(let ((name (intern (format "el-patch-%S" type)))
(props (plist-get kwargs :declare)))
Expand All @@ -37,6 +38,13 @@ later."
(put ',name 'doc-string-elt ',(alist-get 'doc-string props))
(put ',name 'lisp-indent-function ',(alist-get 'indent props)))))))

(defun el-patch--deftype-stub-teardown ()
"Reset `el-patch-deftype' back to its original value, if needed.
This cleans up for `el-patch--deftype-stub-setup'."
(when-let ((orig (get 'el-patch-deftype 'orig-function)))
(fset 'el-patch-deftype orig)
(put 'el-patch-deftype 'orig-function nil)))

(provide 'el-patch-stub)

;; Local Variables:
Expand Down
3 changes: 3 additions & 0 deletions el-patch.el
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ patch."

;;;; Internal variables

;;;###autoload
(defvar el-patch-variant nil
"Advanced variable for defining patch variants.
This variable may be used to define multiple different patches
Expand Down Expand Up @@ -884,6 +885,8 @@ DEFINITION is a list starting with `defun' or similar."
:declare ((doc-string 3)
(indent defun)))

;;;###autoload(el-patch--deftype-stub-teardown)

;;;; Validating patches

(defcustom el-patch-pre-validate-hook nil
Expand Down
Loading