rejeep / f.el

Modern API for working with files and directories in Emacs
GNU General Public License v3.0
680 stars 68 forks source link

Add `f-presence`, `f-presence-directory`, `f-presence-file`, `f-presence-symlink`, and `f-presence-readable` #131

Open sylvorg opened 9 months ago

sylvorg commented 9 months ago

The same as the previous pull request, but hopefully with everything rebased and merged properly:

Add functions to return path when path exists, is a file, is a directory, is a symlink, or is readable, similar to s-presence from Magnar's s.el.

This should be useful in situations such as (cond), where you might want to see if a file, directory, symlink, etc. exists before returning it, all in one go.

Phundrak commented 8 months ago

Hi, sorry for the delayed response. Your code looks good to me, I just need you to do two things before I can merge this PR:

  1. Squash your commits into one. You should be able to do this with the command git reset --soft HEAD~5. You can also do a git rebase -i HEAD~5 if you prefer to.
  2. Then you should be able to commit again to modify your commit message. As mentioned in [CONTRIBUTING.org] (https://github.com/rejeep/f.el/blob/master/CONTRIBUTING.org#git-commit-messages), your commit messages should not contain lines longer than 72 characters. As you can see, your commit message gets truncated here. Something like Add \f-presence` and related functions` ought to do the job, and you could mention the other functions in the body of your commit.

In the meantime, I’ll run the workflow to check your workflow to verify if everything checks out.

sylvorg commented 8 months ago

No worries, and I think that should do the trick! Just let me know if you need anything else!

sylvorg commented 8 months ago

Regarding the latest CI run:

Huh... Well that's disappointing... What happened?

Phundrak commented 8 months ago

Running the tests locally, it seems like they either are incorrect, the function they are supposed to be testing is incorrect, or they contain syntax errors.

Ran 261 tests in 0.728 seconds
10 unexpected results:
   FAILED  f-presence-directory/directory-paths
   FAILED  f-presence-directory/non-directory-paths
   FAILED  f-presence-file/file-paths
   FAILED  f-presence-file/non-file-paths
   FAILED  f-presence-readable/readable-paths
   FAILED  f-presence-readable/unreadable-paths
   FAILED  f-presence-symlink/non-symlink-paths
   FAILED  f-presence-symlink/symlink-paths
   FAILED  f-presence/existent-paths
   FAILED  f-presence/nonexistent-paths
make[1]: *** [Makefile:14: unit] Error 1
make[1]: Leaving directory '/home/phundrak/.config/emacs/straight/repos/f.el'
make: *** [Makefile:8: test] Error 2

Please make sure you run make test (after make install-deps if necessary) and that all tests pass.