emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Eric Danan <eric.danan@u-cergy.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-attach: Allow attaching file from visited buffer
Date: Fri, 02 Nov 2018 10:24:40 +0100	[thread overview]
Message-ID: <87bm77al2f.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAMBH+RYziD2iT37Ac1_1_ODYDWso2JdXDD761FsKM1FU2BPVqA@mail.gmail.com> (Eric Danan's message of "Mon, 25 Jun 2018 15:04:11 +0200")

Hello,

Eric Danan <eric.danan@u-cergy.fr> writes:

> Sorry for the slow reply.

Sorry for the even slower reply.

> I tried something similar to your second proposal (mimicking
> `org-attach-dired-to-subtree'), but more convenient in my opinion and
> not losing the method choice. It mimicks the mechanism to store links:
> there is a new command `org-store-attachment' (to which one could give
> a global keybinding such as `C-c a`) that stores an attachment to the
> current buffer in a new variable `org-stored-attachments', and
> `org-attach-attach', when called interactively, prompts to select an
> attachment from this variable if it is non nil (the attachment is then
> removed from the variable). See attached patch (yes I've signed the
> FSF papers).
>
> "Storing an attachment" simply means storing the buffer file name or,
> if there is none, the buffer name, to the variable (there may be a
> better terminology for that). Then `org-attach-attach' detects if the
> "file" is actually the name of a non-file-visiting buffer and uses
> `write-file' rather than the specified or default method in that case.
> So we keep the method choice and don't need to add a specific command
> for buffers to the dispatcher. If you think it's not worth introducing
> complications for allowing to attach non-file-visiting buffers, we
> could simply prevent this in `org-store-attachment'. I also made it so
> that if `org-store-attachment' is called from a dired buffer, then the
> file at point is stored rather than the dired buffer itself.

This sounds interesting, but I have the feeling that would be a bit
complicated in practice.

I assume that when you want to attach a document to a node, you're
already at the node. Ideally, it should be possible to attach something
in one step from here. With your proposal, you need to first mark
a buffer as an attachment, then go back to the node and attach it
properly.

Moreover, when you marked something as an attachment, changed your mind,
and now want to attach something else, `org-store-attachment' prevents
from doing this. The variable shadows other options when it is non-nil.

There are also issues, e.g., what happens if the buffer marked as an
attachment has been killed?

> This can certainly be improved, but I hope it is sufficient for you to
> judge whether you think it is a good idea or not.

I eventually added, in "next" branch (Org 9.3), something much simpler.
Pressing <b> from the attach dispatcher offers to choose a buffer from
the list of active buffers, and save its contents to a file in the
attachment directory.

Does it suit your needs?

> - We could add a mechanism for making `org-attach-attach'
> unconditionally read a file name, ignoring `org-stored-attachments'
> (i.e. a prefix argument, distinct from the one to visit the attachment
> directory). We could also add a command to clear
> `org-stored-attachments' from the dispatcher.

That would solve second problem, but not the others.

> I understand that other users may not like this mechanism and prefer
> different solutions (or leaving things as they are). There was a
> recent suggestion to make the list of commands in the attachment
> dispatcher customizable:
>
> http://lists.gnu.org/archive/html/emacs-orgmode/2018-06/msg00139.html
>
> Do you think it would make sense to do so?

It could make sense to allow customizing attachment actions, if anyone
wants try implementing it.

Thank you for your work and for the ideas!

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2018-11-02  9:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 14:27 [PATCH] org-attach: Allow attaching file from visited buffer Eric Danan
2018-06-21 15:47 ` Nicolas Goaziou
2018-06-25 13:04   ` Eric Danan
2018-11-02  9:24     ` Nicolas Goaziou [this message]
2018-11-02 13:14       ` Eric Danan

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=87bm77al2f.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.danan@u-cergy.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).