[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Moving and resetting attachments
From: |
Florian Lindner |
Subject: |
Re: [O] Moving and resetting attachments |
Date: |
Tue, 20 Jun 2017 20:12:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
Am 13.06.2017 um 23:41 schrieb Nicolas Goaziou:
> Hello,
>
> Florian Lindner <address@hidden> 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.
Ok, so it's basically a conversion to bool.
>> 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
Sure, I will do that.
> would be nice to provide test for the feature.
That I'm not so sure of. I try to get myself aquainted to ert, but my elisp
knowledge, you surely know, is very limited.
Do I understand correctly, that there is no test for any org-attach stuff so
far? I've found lisp/test-org-attach-annex.el, but that's for git-annex
stuff.
Best,
Florian
- Re: [O] Moving and resetting attachments, (continued)
- Re: [O] Moving and resetting attachments, Eric Abrahamsen, 2017/06/02
- Re: [O] Moving and resetting attachments, Nicolas Goaziou, 2017/06/02
- Re: [O] Moving and resetting attachments, Eric Abrahamsen, 2017/06/02
- Re: [O] Moving and resetting attachments, Nicolas Goaziou, 2017/06/04
- Re: [O] Moving and resetting attachments, Eric Abrahamsen, 2017/06/04
- Re: [O] Moving and resetting attachments, Florian Lindner, 2017/06/06
- Re: [O] Moving and resetting attachments, Florian Lindner, 2017/06/07
- Re: [O] Moving and resetting attachments, Nicolas Goaziou, 2017/06/10
- Re: [O] Moving and resetting attachments, Florian Lindner, 2017/06/13
- Re: [O] Moving and resetting attachments, Nicolas Goaziou, 2017/06/13
- Re: [O] Moving and resetting attachments,
Florian Lindner <=
- Re: [O] Moving and resetting attachments, Nicolas Goaziou, 2017/06/24
- Re: [O] Moving and resetting attachments, Florian Lindner, 2017/06/28
- Re: [O] Moving and resetting attachments, Florian Lindner, 2017/06/13