emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Florian Lindner <mailinglists@xgm.de>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: Moving and resetting attachments
Date: Tue, 20 Jun 2017 20:12:32 +0200	[thread overview]
Message-ID: <5b786b61-8cf2-6635-5000-fa25512242be@xgm.de> (raw)
In-Reply-To: <87tw3jr2f8.fsf@nicolasgoaziou.fr>

Am 13.06.2017 um 23:41 schrieb Nicolas Goaziou:
> Hello,
> 
> Florian Lindner <mailinglists@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.

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

  reply	other threads:[~2017-06-20 18:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 12:29 Moving and resetting attachments Florian Lindner
2017-06-01  4:39 ` Eric Abrahamsen
2017-06-01 11:20   ` Florian Lindner
2017-06-02  9:19     ` Eric Abrahamsen
2017-06-02  9:51       ` Nicolas Goaziou
2017-06-02 12:34         ` Eric Abrahamsen
2017-06-02 14:34           ` Nicolas Goaziou
2017-06-02 16:51             ` Eric Abrahamsen
2017-06-04  7:59               ` Nicolas Goaziou
2017-06-04 23:25                 ` Eric Abrahamsen
2017-06-06 13:56                   ` Florian Lindner
2017-06-07  7:52       ` Florian Lindner
2017-06-10  7:36         ` Nicolas Goaziou
2017-06-13  8:49           ` Florian Lindner
2017-06-13 21:41             ` Nicolas Goaziou
2017-06-20 18:12               ` Florian Lindner [this message]
2017-06-24  8:53                 ` Nicolas Goaziou
2017-06-28 14:57                   ` Florian Lindner
2017-06-13  8:53           ` Florian Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b786b61-8cf2-6635-5000-fa25512242be@xgm.de \
    --to=mailinglists@xgm.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).