Aaron Ecay <aarone...@gmail.com> writes: Thanks for the advice idea, that is a nice one. It doesn't work for me like this though:
#+BEGIN_SRC emacs-lisp (defadvice org-ctrl-c-ctrl-c (around latex-overlays) "ignore latex overlays in C-cC-c" (let ((org-latex-fragment-image-overlays nil)) ad-do-it)) #+END_SRC maybe because that is a buffer local variable? > Hi John, > > 2014ko uztailak 14an, John Kitchin-ek idatzi zuen: >> >> I am using org-mode files with equations and code blocks in lectures, >> and it is problematic that C-c C-c removes the equation overlays when >> running a code block. First, you have to press C-c C-c twice to run the >> block, since the first one gets rid of the equations, but then you have >> run C-c C-x C-l to get the equations back! and the cycle repeats >> throughout a lecture. >> >> I would prefer that the equations stay untouched, and that the code >> blocks run without modifying them. >> >> I think the best behavior would be for C-c C-x C-l to toggle the >> equations, and to remove the C-c C-c behavior for latex overlays >> completely. But it would be ok if this was done by a C-c C-c hook >> function, so that a user could remove the latex overlay without touching >> the org-code. >> >> Maybe a new function like this: >> >> #+BEGIN_SRC emacs-lisp >> (defun org-toggle-latex-overlays (arg) >> "Toggle LaTeX fragments." >> (interactive "P") >> (if org-latex-fragment-image-overlays >> (org-remove-latex-fragment-image-overlays) >> (org-preview-latex-fragment arg))) >> #+END_SRC >> >> could be added. Any thoughts? > > I don’t have a comment on the substance of the proposal, but rather two > suggestions for workarounds. > > The first is to use the C-c C-v C-e binding to execute source blocks > rather than C-c C-c. > > The second is to let-bind ‘org-latex-fragment-image-overlays’ to nil > in an advice around the ‘org-ctrl-c-ctrl-c’ function, allowing you to > still use the more convenient C-c C-c binding. -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu