emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* file wide/language specific switches?
@ 2018-09-28 18:36 John Kitchin
  2018-09-28 19:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: John Kitchin @ 2018-09-28 18:36 UTC (permalink / raw)
  To: org-mode-email

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

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.

Thanks,

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file wide/language specific switches?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2018-09-28 19:16 UTC (permalink / raw)
  To: John Kitchin; +Cc: org-mode-email

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file wide/language specific switches?
  2018-09-28 19:16 ` Nicolas Goaziou
@ 2018-09-28 19:59   ` John Kitchin
  0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2018-09-28 19:59 UTC (permalink / raw)
  To: org-mode-email

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-28 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).