From: Eric Schulte <schulte.eric@gmail.com>
To: phaebz@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Deactivate babel source block
Date: Sun, 06 Oct 2013 09:09:36 -0600 [thread overview]
Message-ID: <87k3hqfnbj.fsf@gmail.com> (raw)
In-Reply-To: <l2rb84$gdv$1@ger.gmane.org> (Michael Bach's message of "Sun, 06 Oct 2013 11:41:32 +0200")
You want to set the :eval and :tangle header arguments, this can be done
with `org-babel-insert-header-arg' bound to "C-c C-v j". I've just
updated this function so that it now takes two optional arguments
specifying the header argument and value.
So your function could now be something like the following.
(defun my-org-babel-deactivate ()
(interactive)
(org-babel-insert-header-arg "eval" "never")
(org-babel-insert-header-arg "tangle" "no"))
Hope this helps,
Michael Bach <phaebz@gmail.com> writes:
> Dear org-mode Users and Developers,
>
>
> I am looking for a nice way to deactivate a babel source block with
> point being anywhere on it. Imagine e.g. C-c C-v C-w to say "I want to
> toggle execution/tangling for this block".
>
> Background: I have the .emacs setup in a literate org-mode file where I
> am testing new emacs packages. Now many blocks represent specific
> features that I want to be activated / deactivated. This should ideally
> behave like the other source code functions (i.e. C-c C-v family).
>
> My naive approach as elisp noob was:
> #+begin_src emacs-lisp
> (defun my-org-babel-deactivate ()
> (interactive)
> (org-edit-special)
> (mark-whole-buffer)
> (comment-region)
> (org-edit-src-exit))
> #+end_src
>
> Apart from it not working (Wrong number of arguments), this would have
> been a dirty one in any case. Now I thought there must be a better way
> by setting/un-setting the respective header arguments in an automated
> way. Is this already possible with org-mode version 8.2?
>
> Best Regards,
> Michael
>
>
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D
next prev parent reply other threads:[~2013-10-06 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-06 9:41 Deactivate babel source block Michael Bach
2013-10-06 15:09 ` Eric Schulte
2013-10-06 15:09 ` Eric Schulte [this message]
2013-10-06 15:23 ` Michael Bach
2013-10-07 8:31 ` Rainer M Krug
2013-10-09 9:57 ` Eric S Fraga
2013-10-09 16:28 ` Eric Schulte
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=87k3hqfnbj.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=phaebz@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).