* Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c
@ 2022-09-23 2:38 Akira Kyle
2022-09-24 2:04 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Akira Kyle @ 2022-09-23 2:38 UTC (permalink / raw)
To: emacs-orgmode
I recently thought to add ~org-latex-preview~ to
~org-ctrl-c-ctrl-c~ and it has been quite the productivity
booster! Two arguments as to why this should be done:
- ~org-ctrl-c-ctrl-c~ currently does nothing when inside
latex-fragment or latex-environment so why not make it
~org-latex-preview~?
- This intuitively matches my muscle memory from using
babel. LaTeX is code after all, and I'm often making mistakes,
so I want the fastest "edit-compile-edit" loop possible.
Here's what I currently have to achieve this in case anyone wants
to give it a try right now :)
#+begin_src emacs-lisp
(defun my-org-ctrl-c-ctrl-c-latex-preview-hook ()
(let ((element (car (org-element-context))))
(if (or (eq element 'latex-fragment) (eq element
'latex-environment))
(org-latex-preview))))
(add-hook 'org-ctrl-c-ctrl-c-final-hook
'my-org-ctrl-c-ctrl-c-latex-preview-hook)
#+end_src
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c
2022-09-23 2:38 Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c Akira Kyle
@ 2022-09-24 2:04 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-09-24 2:04 UTC (permalink / raw)
To: Akira Kyle; +Cc: emacs-orgmode
Akira Kyle <akira@akirakyle.com> writes:
> I recently thought to add ~org-latex-preview~ to
> ~org-ctrl-c-ctrl-c~ and it has been quite the productivity
> booster! Two arguments as to why this should be done:
> - ~org-ctrl-c-ctrl-c~ currently does nothing when inside
> latex-fragment or latex-environment so why not make it
> ~org-latex-preview~?
> - This intuitively matches my muscle memory from using
> babel. LaTeX is code after all, and I'm often making mistakes,
> so I want the fastest "edit-compile-edit" loop possible.
Yes, it is indeed a good idea.
Alternatively, we may also use <TAB> for this.
Also, there is https://github.com/awth13/org-appear/
> Here's what I currently have to achieve this in case anyone wants
> to give it a try right now :)
>
> #+begin_src emacs-lisp
> (defun my-org-ctrl-c-ctrl-c-latex-preview-hook ()
> (let ((element (car (org-element-context))))
It will be more reliable to use `org-element-type' instead of `car'. The
latter is relying on internal implementation detail.
> (if (or (eq element 'latex-fragment) (eq element
> 'latex-environment))
Can simply use (memq element-type '(latex-fragment latex-environment))
Would you be interested to submit a patch?
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-24 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 2:38 Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c Akira Kyle
2022-09-24 2:04 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.