emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] file wide/language specific switches?


From: John Kitchin
Subject: Re: [O] file wide/language specific switches?
Date: Fri, 28 Sep 2018 15:59:16 -0400

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


On Fri, Sep 28, 2018 at 3:16 PM Nicolas Goaziou <address@hidden> wrote:
Hello,

John Kitchin <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]