Re: [O] proposal to make C-c C-c not remove latex overlays
Hi Charles, Charles Berry writes: > The docstring for `org-preview-latex-fragment' still says: > > "The images can be removed again with \\[org-ctrl-c-ctrl-c]." > > Maybe change that to "\\[org-preview-latex-fragment]"? Fixed, thanks. `org-preview-latex-fragment' is now named `org-toggle-latex-fragment'. -- Bastien
Re: [O] proposal to make C-c C-c not remove latex overlays
Bastien gnu.org> writes: > > Hi Nick, > > Nick Dokos gmail.com> writes: > > > getting rid of just latex fragment undoing in > > org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best > > solution. > > Agreed, this is the case now in master. The docstring for `org-preview-latex-fragment' still says: "The images can be removed again with \\[org-ctrl-c-ctrl-c]." Maybe change that to "\\[org-preview-latex-fragment]"? HTH, Chuck
Re: [O] proposal to make C-c C-c not remove latex overlays
Hi Nick, Nick Dokos writes: > getting rid of just latex fragment undoing in > org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best > solution. Agreed, this is the case now in master. > It probably would be a good idea to make the handling of clock > overlays similar as well and make C-c C-x C-d toggle the clock overlay > state Clock overlays are clearly transient, while LaTeX fragments are more or less permanent -- so allowing C-c C-c for getting rid of clock overlays seems fine to me. But clearly a subjective point of view. Thanks, -- Bastien
Re: [O] proposal to make C-c C-c not remove latex overlays
Aaron Ecay wrote: > 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. Or even `e' if: - on the first character of the #+begin_src keyword, and - speed keys are enabled (not by default!?) Best regards, Seb -- Sebastien Vauban
Re: [O] proposal to make C-c C-c not remove latex overlays
I favor the toggling behavior. There is an org-ctrl-c-ctrl-c-hook variable that can always have functions in it that keep the current behavior, but that can be removed if they are not desired. John Nick Dokos writes: > Andreas Leha writes: > >> Hi all, >> >> John Kitchin writes: >> >>> 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. >> >> Since this thread focusses on work arounds and local customizations so >> far, let me just say, that I completely agree here. What is the >> reasoning behind the current key binding? Is there any benefit over >> using the same key binding to toggle the state? >> > > I'm inclined to agree too: I imagine it would be very annoying after > a while. > > There are three things that C-c C-c currently undoes in an ad-hoc > fashion. The first cond clause in the function looks like this: > > , > |((or (and (boundp 'org-clock-overlays) org-clock-overlays) > | org-occur-highlights > | org-latex-fragment-image-overlays) > | (and (boundp 'org-clock-overlays) (org-clock-remove-overlays)) > | (org-remove-occur-highlights) > | (org-remove-latex-fragment-image-overlays) > | (message "Temporary highlights/overlays removed from current buffer")) > ` > > So if there are clock overlays or occur highlights or latex fragment > image overlays, they are undone and the function is finished. This seems > like a separate issue from the main thrust of what C-c C-c does (and it > does a lot), so my inclination would be to suggest that each of the > above conditions be togglable, using the standard keybinding for each > (C-c C-x C-l for latex fragment image overlay toggling, C-c C-x C-d for > clock display - occur highlights only happen from org-goto with the "/" > keybinding, but there is no org-global keybinding I believe). > > However there is a variable that modifies that behavior: > > , > | org-remove-highlights-with-change is a variable defined in `org.el'. > | Its value is t > | > | Documentation: > | Non-nil means any change to the buffer will remove temporary highlights. > | Such highlights are created by `org-occur' and `org-clock-display'. > | When nil, `C-c C-c needs to be used to get rid of the highlights. > | The highlights created by `org-preview-latex-fragment' always need > | `C-c C-c' to be removed. > ` > > If most of us leave that variable's value at default, the ad-hoc-kery > probably does not raise its head except for latex fragments. If that's > the case, then getting rid of just latex fragment undoing in > org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best > solution. It probably would be a good idea to make the handling of clock > overlays similar as well and make C-c C-x C-d toggle the clock overlay > state (I'd be inclined to take that out of org-ctrl-c-ctrl-c as well, > since I suspect that almost nobody uses it, given the variable above and > its default value - but that's only a hunch). That would leave only > occur highlights to be undone by org-ctrl-c-ctrl-c - which is ugly but > the function is a kitchen-sink kind of function anyway, so that's > probably OK. > > Alternatively, make org-ctrl-c-ctrl-c undo these things as it does > today, but only with a triple prefix arg (which afaict is not used > today). > > As Nicolas would say, WDYT? -- --- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu
Re: [O] proposal to make C-c C-c not remove latex overlays
DOH! thanks, that is exactly what I forgot to do. This works fine after you activate it! Thanks. Nick Dokos writes: > John Kitchin writes: > >> Aaron Ecay 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? >> > > You probably forgot to activate it: > > (ad-activate 'org-ctrl-c-ctrl-c) -- --- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu
Re: [O] proposal to make C-c C-c not remove latex overlays
That is nice. For those of us using windows sometimes, you can kind of get super and hyper keys (see http://ergoemacs.org/emacs/emacs_hyper_super_keys.html). Although, without also using autohotkey, your super keys are limited because windows uses some of them (e.g.s-e launches explorer). H-e works fine. Grant Rettke writes: > C-c C-v C-e might seem like a lot but it nice to have control and be > sure when code is getting evaluated. > > That said, I do have a more obvious one using "super" which is indeed, super: > > (local-set-key (kbd "s-t") 'org-babel-tangle) > (local-set-key (kbd "s-e") 'org-babel-execute-maybe) > Grant Rettke | ACM, ASA, FSF, IEEE, SIAM > g...@wisdomandwonder.com | http://www.wisdomandwonder.com/ > “Wisdom begins in wonder.” --Socrates > ((λ (x) (x x)) (λ (x) (x x))) > “Life has become immeasurably better since I have been forced to stop > taking it seriously.” --Thompson > > > On Tue, Jul 15, 2014 at 4:00 PM, John Kitchin wrote: >> I actually love C-c C-c to run code blocks! Maybe I should just bind it >> to f5 or something, I am just so used to C-cC-c now! >> >> Grant Rettke writes: >> >>> On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay wrote: The first is to use the C-c C-v C-e binding to execute source blocks rather than C-c C-c. >>> >>> Like this? >>> >>> (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1) >>> >>> >> >> -- >> --- >> John Kitchin >> Professor >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> http://kitchingroup.cheme.cmu.edu > > -- --- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu
Re: [O] proposal to make C-c C-c not remove latex overlays
Andreas Leha writes: > Hi all, > > John Kitchin writes: > >> 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. > > Since this thread focusses on work arounds and local customizations so > far, let me just say, that I completely agree here. What is the > reasoning behind the current key binding? Is there any benefit over > using the same key binding to toggle the state? > I'm inclined to agree too: I imagine it would be very annoying after a while. There are three things that C-c C-c currently undoes in an ad-hoc fashion. The first cond clause in the function looks like this: , |((or (and (boundp 'org-clock-overlays) org-clock-overlays) | org-occur-highlights | org-latex-fragment-image-overlays) | (and (boundp 'org-clock-overlays) (org-clock-remove-overlays)) | (org-remove-occur-highlights) | (org-remove-latex-fragment-image-overlays) | (message "Temporary highlights/overlays removed from current buffer")) ` So if there are clock overlays or occur highlights or latex fragment image overlays, they are undone and the function is finished. This seems like a separate issue from the main thrust of what C-c C-c does (and it does a lot), so my inclination would be to suggest that each of the above conditions be togglable, using the standard keybinding for each (C-c C-x C-l for latex fragment image overlay toggling, C-c C-x C-d for clock display - occur highlights only happen from org-goto with the "/" keybinding, but there is no org-global keybinding I believe). However there is a variable that modifies that behavior: , | org-remove-highlights-with-change is a variable defined in `org.el'. | Its value is t | | Documentation: | Non-nil means any change to the buffer will remove temporary highlights. | Such highlights are created by `org-occur' and `org-clock-display'. | When nil, `C-c C-c needs to be used to get rid of the highlights. | The highlights created by `org-preview-latex-fragment' always need | `C-c C-c' to be removed. ` If most of us leave that variable's value at default, the ad-hoc-kery probably does not raise its head except for latex fragments. If that's the case, then getting rid of just latex fragment undoing in org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best solution. It probably would be a good idea to make the handling of clock overlays similar as well and make C-c C-x C-d toggle the clock overlay state (I'd be inclined to take that out of org-ctrl-c-ctrl-c as well, since I suspect that almost nobody uses it, given the variable above and its default value - but that's only a hunch). That would leave only occur highlights to be undone by org-ctrl-c-ctrl-c - which is ugly but the function is a kitchen-sink kind of function anyway, so that's probably OK. Alternatively, make org-ctrl-c-ctrl-c undo these things as it does today, but only with a triple prefix arg (which afaict is not used today). As Nicolas would say, WDYT? -- Nick
Re: [O] proposal to make C-c C-c not remove latex overlays
Hi all, John Kitchin writes: > 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. Since this thread focusses on work arounds and local customizations so far, let me just say, that I completely agree here. What is the reasoning behind the current key binding? Is there any benefit over using the same key binding to toggle the state? [...] Regards, Andreas
Re: [O] proposal to make C-c C-c not remove latex overlays
C-c C-v C-e might seem like a lot but it nice to have control and be sure when code is getting evaluated. That said, I do have a more obvious one using "super" which is indeed, super: (local-set-key (kbd "s-t") 'org-babel-tangle) (local-set-key (kbd "s-e") 'org-babel-execute-maybe) Grant Rettke | ACM, ASA, FSF, IEEE, SIAM g...@wisdomandwonder.com | http://www.wisdomandwonder.com/ “Wisdom begins in wonder.” --Socrates ((λ (x) (x x)) (λ (x) (x x))) “Life has become immeasurably better since I have been forced to stop taking it seriously.” --Thompson On Tue, Jul 15, 2014 at 4:00 PM, John Kitchin wrote: > I actually love C-c C-c to run code blocks! Maybe I should just bind it > to f5 or something, I am just so used to C-cC-c now! > > Grant Rettke writes: > >> On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay wrote: >>> The first is to use the C-c C-v C-e binding to execute source blocks >>> rather than C-c C-c. >> >> Like this? >> >> (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1) >> >> > > -- > --- > John Kitchin > Professor > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > http://kitchingroup.cheme.cmu.edu
Re: [O] proposal to make C-c C-c not remove latex overlays
John Kitchin writes: > Aaron Ecay 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? > You probably forgot to activate it: (ad-activate 'org-ctrl-c-ctrl-c) -- Nick
Re: [O] proposal to make C-c C-c not remove latex overlays
Aaron Ecay 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
Re: [O] proposal to make C-c C-c not remove latex overlays
I actually love C-c C-c to run code blocks! Maybe I should just bind it to f5 or something, I am just so used to C-cC-c now! Grant Rettke writes: > On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay wrote: >> The first is to use the C-c C-v C-e binding to execute source blocks >> rather than C-c C-c. > > Like this? > > (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1) > > -- --- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu
Re: [O] proposal to make C-c C-c not remove latex overlays
On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay wrote: > The first is to use the C-c C-v C-e binding to execute source blocks > rather than C-c C-c. Like this? (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1)
Re: [O] proposal to make C-c C-c not remove latex overlays
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. -- Aaron Ecay
[O] proposal to make C-c C-c not remove latex overlays
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? -- --- John Kitchin Professor