all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: file wide/language specific switches?
Date: Fri, 28 Sep 2018 15:59:16 -0400	[thread overview]
Message-ID: <CAJ51ETrr8iSdzgRj78PnQyGijcAyq6hVEiR403=KH7P4Kbntvw@mail.gmail.com> (raw)
In-Reply-To: <8736tt77rb.fsf@nicolasgoaziou.fr>

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

ok, thanks for confirming!

I tried a workaround like this:

#+BEGIN_SRC emacs-lisp -r
(defun my-tangle-with-r ()
  (interactive)
  (let* ((temporary-file-directory ".")
(tmpname (make-temp-file "switch" nil ".org"))
buf
data)
    (write-region (point-min) (point-max) tmpname)
    (setq buf (find-file-noselect tmpname))
    (with-current-buffer buf
      (setq data (org-element-parse-buffer))
      (org-element-map data 'src-block
(lambda (src)
  (org-element-put-property src :switches "-r")))
      (erase-buffer)
      (insert (org-element-interpret-data data))
      (save-buffer)
      (org-babel-tangle))
    (kill-buffer buf)
    (delete-file tmpname)))
#+END_SRC

Any suggestions for improvement? It seems to work for me, but says it
tangled from the temp file instead of the main file (that is expected, but
not ideal). I tried some simpler ways but with org-export-with-buffer-copy,
for example, I ran into difficulties because of the buffer modification,
which I could find a way around that didn't lead to many copies of the
buffer being open. In this solution, I just save it and have no issue there.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Fri, Sep 28, 2018 at 3:16 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > I am working on a pretty large literate program right now, and am using
> > coderefs in the blocks. I know I can add a -r switch to a code block to
> > remove the labels, but there are /a lot/ of blocks, and I wondered if
> there
> > was some way to specify a file-wide switch, or a language specific
> switch?
> > It isn't obvious that is possible, so I thought I would ask.
>
> No, there is not.
>
> Regards,
>
> --
> Nicolas Goaziou
>

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

      reply	other threads:[~2018-09-28 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28 18:36 file wide/language specific switches? John Kitchin
2018-09-28 19:16 ` Nicolas Goaziou
2018-09-28 19:59   ` John Kitchin [this message]

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

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

  git send-email \
    --in-reply-to='CAJ51ETrr8iSdzgRj78PnQyGijcAyq6hVEiR403=KH7P4Kbntvw@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.