emacs-ibuffer-project icon indicating copy to clipboard operation
emacs-ibuffer-project copied to clipboard

Add guard in case dir of buffer is not/no longer readable.

Open MagielBruntink opened this issue 11 months ago • 3 comments

In case the file/directory of an open buffer has been deleted/moved/made unreadable, calling project-current would throw an error Opening directory: Not a directory. This PR adds a guard against that situation.

MagielBruntink avatar Mar 14 '24 09:03 MagielBruntink

Thank you for PR!

Can you please provide steps to reproduce the issue?

The default-directory buffer variable is not changed when directory is deleted. And the project-current function will return nil for not existing directory.

I've opened file inside git repository, then deleted the project folder and I see no errors when calling ibuffer.

muffinmad avatar Mar 14 '24 12:03 muffinmad

It's quite an edge case, really. Had to puzzle a bit to replicate it :-)

  • Create a directory, eg test and open it with dired
  • M-x ibuffer , directory test should appear
  • Kill the Ibuffer buffer
  • Delete the directory
  • M-x ibuffer-project-clear-cache
  • Create a file in the same dir with the same name test, save it
  • M-x ibuffer should then show the error message

MagielBruntink avatar Mar 14 '24 12:03 MagielBruntink

I still cannot reproduce the issue. What is the value of the default-directory variable in newly created file after this step?

Create a file in the same dir with the same name test, save it

muffinmad avatar Mar 17 '24 08:03 muffinmad