emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ryan Scott <ryan@vicarious-living.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Greg Minshall <minshall@umich.edu>,
	emacs-orgmode@gnu.org, Timothy <tecosaur@gmail.com>
Subject: Re: [PATCH] Re: New source block results option for attaching file to node
Date: Thu, 21 Apr 2022 10:29:01 -0700	[thread overview]
Message-ID: <CAHBUXNyWVQk3e=9g3HgGWkiboHy5PbXXvBkoYTVDaygHg18tyg@mail.gmail.com> (raw)
In-Reply-To: <87zgkey55y.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 3824 bytes --]

Yeah I just recently updated my fourth and realized there were some
necessary conflicts to resolve with the latest.

I'll take a look at addressing these issues and submit an updated patch.
Surprised I missed a calling location and secretly hope that it was added
recently for the sake of my poor ego. :)

With all of the layers and assumptions/behaviors inherent in the way src
block parameters are handled, do you feel like this is an approach that can
work, or should it be abandoned?

Thanks for looking into this.

On Thu, Apr 21, 2022, 05:46 Ihor Radchenko <yantar92@gmail.com> wrote:

> Ryan Scott <ryan@vicarious-living.com> writes:
>
> > Here's my latest patch.
> > Uses special :dir value 'attach to use attachment directory as working
> dir.
> > Now prompts to create IDs for nodes that are missing.
> > Solved a handful of issues with my previous versions of this and I've
> been
> > using it regularly for a bit now.
> >
> > I've added documentation and completed the copyright assignment to the
> FSF.
>
> I have consulted Bastien about our merge policy and apparently it is ok
> to merge staff into files without maintainer. ob-core.el is one of such
> files.
>
> So, I did a more elaborate testing of your patch. I have some comments.
>
> Firstly, the patch does not apply onto current main.
>
> > +Setting =dir= to the symbol ~attach~ or the string ~"'attach"~ will
> > ...
> > +Passing the symbol ~attach~ or string ='attach= to the =:dir= option
>
> When I was trying to use your patch, I felt slightly confused about the
> "'attach" part. It _looks_ like a type and I first tried to do :dir
> "attach" yielding predictable lack of attachment: file link.
>
> Maybe you can say "or the string ~"'attach"~ (with quote)".
>
> > +                 (org-babel-result-to-file
> > +               result
> > +               (org-babel--file-desc (nth 2 info) result)
> > +                  'attachment))))
>
> There are only 2 calls to org-babel-result-to-file in the whole Org
> codebase. And you did not change the second call, which yield strange
> side-effects:
>
> #+NAME: attr_wrap
> #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
>   echo "#+ATTR_LATEX: :width $width"
>   echo "$data"
> #+END_SRC
>
> #+begin_src gnuplot :dir 'attach :file test.png
> plot x
> #+end_src
>
> #+RESULTS:
> [[attachment:test.png]]
>
> #+begin_src gnuplot :dir 'attach :file test.png  :post
> attr_wrap(width="5cm", data=*this*) :results drawer
> plot x
> #+end_src
>
> #+RESULTS:
> :results:
> #+ATTR_LATEX: :width 5cm
> [[file:data/4d/6a76f8-4016-4edf-9d26-e0b3a634dbc1/test20.png]] <----!!!!!
> this is not expected
> :end:
>
> > +If the optional TYPE is passed as 'attachment` and the path is a
> > +descendant of the DEFAULT-DIRECTORY, the generated link will be
> > +specified as an an \"attachment:\" style link"
> > +           (in-attach-dir (when (and request-attachment (> (length
> result-file-name) attach-dir-len))
> > +                            (string=
> > +                             (substring result-file-name 0
> attach-dir-len)
> > +                             attach-dir))))
>
> This is a risky heuristics.
> One can do something like
> (setq org-attach-id-dir
> "/tmp/alsjkdsalkjdlaskdjklasjdlkasjdlkasjdlkajdklasjdlasjlasdjk/")
> and often get your heuristics fail.
> Of course, it will require some terribly noncomplying ob-* library that
> will create file disregarding default-directory, but still...
>
> > +             (if (y-or-n-p (format "Create ID for entry \"%s\"?"
> > +                                   (org-get-heading t t t t)))
>
> This is a nice dialogue, but note that Emacs can run noninteractively or
> execute source block during export (including asynchronous). I would
> guard the query after consulting `noninteractive' variable.
>
>
> Best,
> Ihor
>

[-- Attachment #2: Type: text/html, Size: 4957 bytes --]

  reply	other threads:[~2022-04-21 17:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  8:48 New source block results option for attaching file to node Ryan Scott
2021-08-31 11:15 ` Timothy
2021-08-31 19:43   ` Ryan Scott
2021-09-01 14:45     ` Ihor Radchenko
2021-09-01 20:01       ` Ryan Scott
2021-09-02  7:40         ` [PATCH] " Ryan Scott
2021-09-02 13:44           ` Greg Minshall
2021-09-03  3:10             ` Ihor Radchenko
2021-09-03  3:28               ` Ryan Scott
2021-09-05 13:22                 ` Ihor Radchenko
2021-09-05 13:56                   ` Ryan Scott
2021-09-10  1:04                     ` Ryan Scott
2021-09-10  6:26                       ` Timothy
2021-10-02  8:32                       ` Ihor Radchenko
2021-10-02  9:39                         ` Ryan Scott
2021-10-05  0:04               ` Christopher M. Miles
2021-10-05  1:05                 ` Ryan Scott
2021-10-08  1:22                   ` Christopher M. Miles
2021-11-05  7:16                   ` Ryan Scott
2022-04-21 12:47                     ` Ihor Radchenko
2022-04-21 17:29                       ` Ryan Scott [this message]
2022-04-22  6:02                         ` Ihor Radchenko
2022-04-22  6:19                           ` Ryan Scott
2022-06-10  8:06                             ` Ryan Scott
2022-06-11  4:32                               ` Ihor Radchenko
2022-06-11  7:47                                 ` Ryan Scott
2022-06-11 12:49                                   ` Ihor Radchenko
2022-06-12  0:47                                     ` Ryan Scott
2022-06-14  4:11                                       ` Ihor Radchenko
2022-06-14  5:55                                         ` Ryan Scott
2022-06-14  9:04                                           ` Ryan Scott
2022-06-14 13:48                                             ` Ihor Radchenko
2022-06-14 18:23                                               ` Ryan Scott
2022-06-11 12:51                                   ` Ihor Radchenko

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='CAHBUXNyWVQk3e=9g3HgGWkiboHy5PbXXvBkoYTVDaygHg18tyg@mail.gmail.com' \
    --to=ryan@vicarious-living.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    --cc=tecosaur@gmail.com \
    --cc=yantar92@gmail.com \
    /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).