GNU bug report logs - #78097
30.1; editorconfig can pass nil to file-name-directory

Previous Next

Package: emacs;

Reported by: "Peter J. Jones" <mlists <at> devalot.com>

Date: Sun, 27 Apr 2025 15:31:02 UTC

Severity: normal

Found in version 30.1

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 78097 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Peter J. Jones" <mlists <at> devalot.com>
Cc: 78097 <at> debbugs.gnu.org
Subject: Re: bug#78097: 30.1; editorconfig can pass nil to file-name-directory
Date: Mon, 05 May 2025 09:55:56 -0400
>> FWIW, the fact that `editorconfig-get-local-variables-functions' is run
>> when there are no `.editorconfig` files is an accident.
> The reason I was using `editorconfig-get-local-variables-functions' is
> because both `editorconfig-after-apply-functions' and
> `editorconfig-hack-properties-functions' are documented to behave that
> way but are deprecated and `editorconfig-hack-properties-functions'
> reports that `editorconfig-get-local-variables-functions' should be used
> instead.
> If none of these hooks are available for this purpose can you recommend
> a way that I can achieve my goal?

I'm afraid I don't have a ready answer for it.
Maybe something like:

    (add-hook 'change-major-mode-after-body-hook #'my-global-file-defaults)
    (defun my-global-file-defaults ()
      (when buffer-file-name
        (add-hook 'before-save-hook
                  #'editorconfig--delete-trailing-whitespace nil t)))

Obviously, Emacs lacks an official "delete-trailing-whitespace mode":
the above should not have to rely on an editorconfig-specific function.
🙁

> No.  I was starting to suspect that it wasn't working and after seeing
> your patch I now know it's most definitely not working!  I was so deep
> in the weeds trying to fix the "stringp nil" issue that I never went
> back to see if my fix actually worked.  Sorry about that.

We've all been there.  🙂
Thanks for confirming my suspicion.


        Stefan





This bug report was last modified 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.