emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: flare <gabrielxaviersmith@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [FEATURE REQUEST] No tangle of code blocks within archived subtrees
Date: Fri, 4 Sep 2020 21:48:44 -0700	[thread overview]
Message-ID: <CA+G3_PMQLgCd6zvOosZUZoqgfeNctRHu+RV4O_FWgAjM3M6mRw@mail.gmail.com> (raw)
In-Reply-To: <877dt9ey2c.fsf@gmail.com>

Hi Gabriel,
   This seems like it is probably a bug given that everything else
about archive headings
is disabled. In the meantime, depending on how many blocks you are
dealing with you
could hack around this by using the following header argument.
#+header: :tangle (unless-archived "/ssh:host:/path/to/file")
The implementation of unless-archived is below along with a demo org file.
Best!
Tom

* Bootstrap
This is a giant hack which only works because the state of Emacs
when resolving the tangle header is sitting on the block in question
which I'm guessing is an implementation detail.
#+begin_src elisp
(defun unless-archived (path)
  (save-excursion
    (if (let ((heading (outline-previous-heading)) archived)
          (while (and (not archived) heading)
            (let ((element (org-element-at-point)))
              (setq archived (org-element-property :archivedp element)))
            (setq heading (ignore-errors (outline-up-heading 1)))
            (message "%s" heading))
          archived)
        "no"
      path)))
#+end_src
* sysadmin
** some server I don't use anymore                                 :ARCHIVE:
*** distractor heading
*** tangled code in here
#+header: :tangle (unless-archived "/ssh:localhost:/tmp/some-file.sh")
#+begin_src bash
"yes this tangles when archived"
#+end_src


  reply	other threads:[~2020-09-05  4:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05  1:31 [FEATURE REQUEST] No tangle of code blocks within archived subtrees flare
2020-09-05  4:48 ` Tom Gillespie [this message]
2020-09-06  9:36   ` Bastien
2020-09-06 10:00     ` Tom Gillespie
2020-09-07  4:52       ` Bastien
2020-09-08  6:54         ` Tom Gillespie

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=CA+G3_PMQLgCd6zvOosZUZoqgfeNctRHu+RV4O_FWgAjM3M6mRw@mail.gmail.com \
    --to=tgbugs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gabrielxaviersmith@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).