emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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

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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).