Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-14 Thread Nicolas Goaziou
Hello, Carlos Pita writes: > I think your refactor improves the original code a lot and makes clear > that toggling is just a special case. > > I've been testing the changes with a pretty complex beamer document > and found no fault. Great! Thank you for the feedback and the suggested

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> Please let me know if anything went wrong. I think your refactor improves the original code a lot and makes clear that toggling is just a special case. I've been testing the changes with a pretty complex beamer document and found no fault. Thanks!

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Carlos Pita writes: > Nicolas, here is a patch implementing alternative B above with > ORG-NEWS entry and everything. > > I have been playing with it and find the bindings quite handy. > > Code is indeed a bit simpler. > > If you like it, feel free to amend it before merging. Thank you. I

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
Nicolas, here is a patch implementing alternative B above with ORG-NEWS entry and everything. I have been playing with it and find the bindings quite handy. Code is indeed a bit simpler. If you like it, feel free to amend it before merging. Best regards -- Carlos From

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
Ok, let's make this more concrete so I can start working on it then. Alternative A: Provide three functions: org-toggle-latex-fragment: bound to C-c C-x C-l has an optional argument arg delegates to org-preview-latex-section if necessary (outside of fragment or C-u)

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Carlos Pita writes: >> C-c C-x C-l: as you defined it >> C-u C-c C-x C-l: preview document scope. >> C-- (or C-0) C-c C-x C-l: as you defined C-u C-c C-x C-l. >> C-- (or C-0) C-u C-c C-x C-l: unpreview document scope. > > Btw, I don't think that "preview the entire document" is such a rare > use

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> C-c C-x C-l: as you defined it > C-u C-c C-x C-l: preview document scope. > C-- (or C-0) C-c C-x C-l: as you defined C-u C-c C-x C-l. > C-- (or C-0) C-u C-c C-x C-l: unpreview document scope. Btw, I don't think that "preview the entire document" is such a rare use case. Consider that you've

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> WDYT? I like it. Indeed, I was tempted to suggest removing document scope but, as an end user, I moderate my proposals to be more or less conservative. There are some complications though. If we remove the document scope bindings we have to refactor the current function quite a bit, because

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Hello, Carlos Pita writes: > So lets play with minus as a modifier, I like that idea. > > (A) Here is a variation of my proposal: > > [C- -] [C-u] [C-u] C-c C-x C-l > > The modifier [C- -] means force preview. > The modifier [C-u] means section scope. > The modifier [C-u][C-u] means document

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-12 Thread Carlos Pita
> `C-c C-x C-S-l` is too ugly, even for me. It is a convention we don't > use in Org. Mmm ok :). I proposed it because it is easy to remember if you think you're modifying a base action by S and also because it's easier to keep C pressed (versus simply S-l or M-l). So lets play with minus as a

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-12 Thread Nicolas Goaziou
Carlos Pita writes: > What about leaving everything as it is now and adding C-c C-x C-S-l to mean > "force preview", of course with the C-u and C-u C-u variants. This is a bit > more orthogonal in the sense that the numerical argument controls scope and > the S modifier controls "forcing". Also,

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-12 Thread Carlos Pita
What about leaving everything as it is now and adding C-c C-x C-S-l to mean "force preview", of course with the C-u and C-u C-u variants. This is a bit more orthogonal in the sense that the numerical argument controls scope and the S modifier controls "forcing". Also, it's backwards compatible

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-12 Thread Nicolas Goaziou
Hello, Carlos Pita writes: > A last suggestion. Incidentally the toggle returns nil when at least a > fragment is unpreviewed and non-nil otherwise (as a side effect of > message). This can be documented and made part of the interface, so > that something like the following can be put together

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-11 Thread Carlos Pita
A last suggestion. Incidentally the toggle returns nil when at least a fragment is unpreviewed and non-nil otherwise (as a side effect of message). This can be documented and made part of the interface, so that something like the following can be put together by the end user: (defun

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-11 Thread Carlos Pita
> I suggest to make C-c C-x C-l a toggle with preference for previewing, > that is: preview everything except when everything is already previewed. Mmmm I think this is not easy since it would imply changing org-remove-latex-fragment-image-overlay return value: (if

Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-11 Thread Carlos Pita
> the current section. Now, there is C-u C-u C-c C-x C-l for that. AFAICS, Sorry I meant just one C-u. C-u C-u is to clear the entire buffer of previews.

[O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-11 Thread Carlos Pita
According to the docstring: ``` (defun org-toggle-latex-fragment ( arg) "Preview the LaTeX fragment at point, or all locally or globally. If the cursor is on a LaTeX fragment, create the image and overlay it over the source code, if there is none. Remove it otherwise. **If there is no