[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c
From: |
Ihor Radchenko |
Subject: |
Re: Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c |
Date: |
Sat, 24 Sep 2022 10:04:18 +0800 |
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