emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Florian Lindner <mailinglists@xgm.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Moving and resetting attachments
Date: Tue, 13 Jun 2017 23:41:15 +0200	[thread overview]
Message-ID: <87tw3jr2f8.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <f1c95d02-d856-69ec-9bf3-beb22d803839@xgm.de> (Florian Lindner's message of "Tue, 13 Jun 2017 10:49:05 +0200")

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.

> 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

  reply	other threads:[~2017-06-13 21:41 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 [this message]
2017-06-20 18:12               ` Florian Lindner
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=87tw3jr2f8.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=mailinglists@xgm.de \
    /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).