emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Akira Kyle <akira@akirakyle.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c
Date: Sat, 24 Sep 2022 10:04:18 +0800	[thread overview]
Message-ID: <87zgep5xzx.fsf@localhost> (raw)
In-Reply-To: <878rmag67k.fsf@akirakyle.com>

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

      reply	other threads:[~2022-09-24  2:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgep5xzx.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=akira@akirakyle.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).