pinoaffe / org-vcard

Export and import vCards from within GNU Emacs' Org mode.
61 stars 7 forks source link

Missing user-specific styles directory warning #37

Closed lovrolu closed 2 years ago

lovrolu commented 2 years ago

After upgrading org-vcard recently, I keep getting the warning below, even though I don't use any custom styles:

org-vcard/:catch: Creating directory: No such file or directory, /home/<home>/.config/emacs/org-vcard-styles/

It seems to have been introduced in 5bee93fbc0d2ad152149342f1327f785ef217fe8, where org-vcard-custom-styles-dir is unconditionally added to the list org-vcard--styles-dirs. When iterating over this list later in the code, directories are created using make-directory in case they don't exist. However, the parents argument is not specified, so creating intermediate missing directories is disabled and ends up causing the warning above.

I think it would be better not to create the user-specific styles directory, because if it doesn't exist then the user is probably not making use of any custom styles.

One other subtle issue is the fact that org-vcard--styles-dirs is set only once (when the package is first loaded), and later changes to org-vcard-custom-styles-dir won't affect its value (but they should since org-vcard-custom-styles-dir is a user-configurable custom variable).

flexibeast commented 2 years ago

No, it wasn't introduced in that commit, which merely re-ordered code to fix dependency issues, and renamed some variables that should have been marked as internal but hadn't been. The commit shows that the line:

  ,org-vcard-custom-styles-dir)

was pre-existing. (The line before it was modified due to a variable rename.) So i presume that the re-ordering exposed this problem.

In https://github.com/flexibeast/org-vcard/commit/3a73d6e1f54fda807ffa7b978884ea7efc09b55e, i've changed the default value for org-vcard-custom-styles-dir to nil, changed the defvar for org-vcard--styles-dirs so that org-vcard-custom-styles-dir only added when it's non-nil, and removed the directory creation code.

Thank you for picking up the issue regarding propagation of changes to org-vcard-custom-styles-dir; i've created https://github.com/flexibeast/org-vcard/issues/38 for this.

lovrolu commented 2 years ago

Oh yep, you're right. I was mislead by GitHub's coloring of the unquote comma as green and didn't pay attention to the sidebar on the left. :'-)

I'll pull the latest changes and report back soon.

lovrolu commented 2 years ago

Yep, that fixes it, thanks!