radian-software/el-patch

el-patch not validating a patch that it should

rgrinberg opened this issue · 8 comments

When asking el-patch to show the conflict, I get this for actual:

(defun projectile-dir-files-external
    (root directory)
  "Get the files for ROOT under DIRECTORY using external tools."
  (let
      ((default-directory directory))
    (mapcar
     (lambda
       (file)
       (file-relative-name
        (expand-file-name file directory)
        root))
     (projectile-get-repo-files))))

and this for expected:

(defun projectile-dir-files-external
    (root directory)
  "Get the files for ROOT under DIRECTORY using external tools."
  (let
      ((default-directory directory))
    (mapcar
     #'(lambda
         (file)
         (file-relative-name
          (expand-file-name file directory)
          root))
     (projectile-get-repo-files))))

Note the #' near the lambda. I'm not sure why el-patch is expecting it.

What is your patch?

Here's the patch:

    (el-patch-defun projectile-dir-files-external (root directory)
      "Get the files for ROOT under DIRECTORY using external tools."
      (let ((default-directory directory))
        (el-patch-swap
          (mapcar (lambda (file)
                    (file-relative-name (expand-file-name file directory) root))
                  (projectile-get-repo-files))
          (cl-loop for file in (projectile-get-repo-files)
                   collect (string-remove-prefix
                            root
                            (expand-file-name file directory))))))

Are you byte-compiling your configuration?

Hmm, a bit embarrassing but I don't know how to check. I'm using spacemacs, but I'm not sure if it byte compiles the config or not.

I'm not sure if it byte compiles the config or not

Are there corresponding .elc files generated automatically next to your configuration?

I'm using spacemacs

In any case, can you see if this is reproducible outside of Spacemacs? (I.e. from emacs -Q)

Are there corresponding .elc files generated automatically next to your configuration?

Spacemacs has this weird setting that it will load the elisp in your ~/.spacemacs file. That is where my config lies. I don't really see a .spacemacs.elc anywhere. .spacemacs does use this https://github.com/emacscollective/auto-compile module, so my guess would be yes.

In any case, can you see if this is reproducible outside of Spacemacs? (I.e. from emacs -Q)

Hmm, unfortunately this isn't so easy. I need to install projectile, el-patch, so making it work from scratch is a hassle. I understand that this makes the probability of my issue being fixed very low. I'll ignore for this for now.

unfortunately this isn't so easy

Actually, one of the primary reasons I created straight.el is to make exactly this sort of reproduction very easy. See this section of the manual:

$ emacs -Q -l ~/.emacs.d/straight/repos/straight.el/bootstrap.el
> M-x straight-use-package RET projectile RET
> M-x straight-use-package RET el-patch RET

and you don't even have to change anything in ~/.emacs.d for this to work.