[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: |
Thu, 1 Jun 2017 13:20:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
Am 01.06.2017 um 06:39 schrieb Eric Abrahamsen:
> Florian Lindner <address@hidden> writes:
>
>> Hello,
>>
>> two questions about moving attachments to org files:
>>
>> C-c C-a a attaches a file and stores it under ./data/ID/...
>>
>> Using C-c C-a s I can set another directory a attachment directory.
>> Can I make org-mode move the content of the previous
>> directory to the new directory?
>>
>> Can I "reset" the attachment directory, i.e. like C-c C-a s but
>> :ATTACH_DIR: is deleted and the contents of the previous
>> directory are moved to ./data/ID?
>>
>> Rationale:
>>
>> I use org mode as a document management system. Create an entry Papers ->
>> Interpolation -> ECCOMAS. I know create an
>> custom attachment directory ECCOMAS, next to the org file as long as I
>> am working on that paper. When it's finished, I
>> want to move the contents of the ECCOMAS attachment directory to ./data/ID/.
>
> It doesn't work this way now, but I think it makes sense, and I would
> also find that helpful. `org-attach-set-directory' could be changed to
> check for existing files, and offer to move them. There's no
> `org-attach-unset-directory', but I suppose there could be.
Hey,
I hacked together some lines of lisp that should achieve that. It's my first
non-trivial (from my point of trivialness)
piece of code. I'm open for any suggestions:
(defun flo/org-attach-move ()
(interactive)
(when (org-attach-dir)
(let ((target (read-string "Move attachments to: ")) ; read-directory-name
here?
(attach-dir (org-attach-dir)))
(if (string= target "")
(progn
(org-entry-delete nil "ATTACH_DIR")
(setq target (org-attach-dir t)))
(progn
(org-entry-put nil "ATTACH_DIR" target)
(make-directory target t))
)
(unless (string= target attach-dir)
(copy-directory attach-dir target t nil t)
(message "Deleting %s" attach-dir)
;; (shell-command "rm -rf %s" attach-dir)
)
)
)
)
Best,
Florian
- Re: [O] Moving and resetting attachments, Eric Abrahamsen, 2017/06/01
- Re: [O] Moving and resetting attachments,
Florian Lindner <=
- 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/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