Hello, Florian Lindner <mailingli...@xgm.de> writes:
> What is the use of (and org-attach-allow-inheritance t)? Doesn't it always > returns org-attach-allow-inheritance? It return nil if `org-attach-allow-inheritance' is nil, t otherwise. In particular, if `org-attach-allow-inheritance' is set to `selective', the S-exp returns t. > Anyways, I'm not really sure if I understand the doc of org-entry-get > correctly. Does org-entry-get not automatically > take inheritance into account, based on the the per-entry or global > setting? No it doesn't. The caller choose if it should ignore inheritance (the default), use it unconditionally (a non-nil INHERIT argument), or let the user decide (`selective' INHERIT argument). >> ;; FIXME: Need a special case for directory reset (non-nil ARG). > > Why that? Aren't old and new holding the appropriate dirs in that case > and copy over / delete as they should? Probably. I was thinking to some special case that may not exist, after all. Never mind then. > Latest version: > > (defun flo/org-attach-move (&optional arg) > "Move current attachements to another directory. > When ARG is non-nil, reset attach directory. Create directory if > needed." > (interactive "P") > (let ((old (org-attach-dir)) > (new > (progn > (if arg (org-entry-delete nil "ATTACH_DIR") > (let ((dir (read-directory-name > "Attachment directory: " > (org-entry-get nil > "ATTACH_DIR" > (and org-attach-allow-inheritance > t))))) > (org-entry-put nil "ATTACH_DIR" dir))) > (org-attach-dir t)))) > (unless (or (string= old new) > (not old)) > ;; FIXME: Need a special case for directory reset (non-nil ARG). > (when (yes-or-no-p "Copy over attachments from old directory? ") > (copy-directory old new t nil t)) > (when (yes-or-no-p (concat "Delete " old)) > (delete-directory old t))))) It looks good. Could you provide a patch for that, and an entry in ORG-NEWS? Also, it would be nice to provide test for the feature. Thank you ! Regards, -- Nicolas Goaziou