wbolster / emacs-python-black

Emacs package to reformat Python using black-macchiato
BSD 3-Clause "New" or "Revised" License
95 stars 11 forks source link

pass buffer file name to ‘black --stdin-filename …’ #14

Open wbolster opened 1 year ago

wbolster commented 1 year ago

pass the file name (if any) to black via the ‘--stdin-filename’ command line flag. it will be used to discover the project root directory and hence the configuration file (see find_project_root() callers in the black sources), instead of the default behaviour:

If you’re formatting standard input, Black will look for configuration starting from the current working directory. – https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#where-black-looks-for-the-file

closes #13.

wbolster commented 1 year ago

@ayys can you give this a try?