From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kM7kIKJlLmOyIwEAbAwnHQ (envelope-from ) for ; Sat, 24 Sep 2022 04:04:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IHbaIKJlLmMwjQAAauVa8A (envelope-from ) for ; Sat, 24 Sep 2022 04:04:18 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3FE4A398FC for ; Sat, 24 Sep 2022 04:04:18 +0200 (CEST) Received: from localhost ([::1]:48818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obuWf-000890-EQ for larch@yhetil.org; Fri, 23 Sep 2022 22:04:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obuW0-00088s-0p for emacs-orgmode@gnu.org; Fri, 23 Sep 2022 22:03:36 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:33445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obuVy-0003xi-4u for emacs-orgmode@gnu.org; Fri, 23 Sep 2022 22:03:35 -0400 Received: by mail-pl1-x630.google.com with SMTP id iw17so1695253plb.0 for ; Fri, 23 Sep 2022 19:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=tPbKBBj13HCLjDEIyR9vtiMp7/ZCR23xgCo0pi5YCkE=; b=g9fMYCrxsoyhFDGMV80f+Gy4QNfFFvPWQ5nPmIsnJNQR3W8ZYgJ/i1luVij8URipF+ TOrXSYgecxkpjfJVgeKF0U5h9JveMTI3uqCbeJizs7cr2oQEsU+9pXKgbDxsYPBUWdMM UP8jrueHWZYHqhHh6NaNtERBqaNXe80BxEaTKdWj86IX5iiJevILs3PyrH80F7PX3+i3 nmgndV3jewQH8Ahck//KCVUWjBNF8EF8bKEeQfcDdTpfwGc6Fbo/mwVso294XzmbUFM+ uyrjK1fszzQqEVHNskOTqIk8hFzLE5yiKyOMGhubEsN/N9c7VM7zh5mEZhFWoE7jyThp IbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=tPbKBBj13HCLjDEIyR9vtiMp7/ZCR23xgCo0pi5YCkE=; b=gIsYIcCT2pG3/7hWtSUEMLML/s57L32QdIjaGvQ8NlVrKJJpGXSLL1pvghZyaowRQK Smby5qvmrlqqwawy9Jkx+Xl+EsvMOhDtX8X/SMLOGKS50j8vVFqAGV9ebu0Cx3a1r0J8 zikISo3WwzEX/+UN6Qc8HpkyMw5jct156gQRb4w6FVfaf43xnBMhXjuOVBtym9WNCoQa ZU7fxBqEAvpq+MQ7XqxM4tMeReiC92jVY4g5blO2Eiloxm1z/Rfltae1FMz5mqeMN7TG wE59/KwfinYVKOE931txR5MgTzC0b53t9vbo+Jzwh0FrBPgVmw5P8NIY1chefZ5AVJV9 PeNg== X-Gm-Message-State: ACrzQf14/Xar/2dtEDpaX+rYDTn5ex9U/jCZ90WtbpPGws7PzdHmdKgB FV/prHmeIr8mqaRI0v28gZs+NVhIGIA= X-Google-Smtp-Source: AMsMyM4l+OLMsx0KrOoI6m9EGbf3t9F8rmGxRZ+c7AzIr2Ns4kPqyK8c6GCSXO46yw3eFzjr2Ox3yA== X-Received: by 2002:a17:903:1104:b0:178:8756:6e4d with SMTP id n4-20020a170903110400b0017887566e4dmr11633339plh.114.1663985012617; Fri, 23 Sep 2022 19:03:32 -0700 (PDT) Received: from localhost ([2409:8970:a80:3a4:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id bc7-20020a170902930700b0016d8d277c02sm6638724plb.25.2022.09.23.19.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 19:03:31 -0700 (PDT) From: Ihor Radchenko To: Akira Kyle Cc: emacs-orgmode@gnu.org Subject: Re: Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c In-Reply-To: <878rmag67k.fsf@akirakyle.com> References: <878rmag67k.fsf@akirakyle.com> Date: Sat, 24 Sep 2022 10:04:18 +0800 Message-ID: <87zgep5xzx.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=yantar92@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663985058; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tPbKBBj13HCLjDEIyR9vtiMp7/ZCR23xgCo0pi5YCkE=; b=o6LYk1/uBfBoSqP0OUSo4qg9VUWrdfBD1h/7V0X/SjdoM5CuaV8LW004nJkK6oZ/Cb0zCy Z2Gj2OKiZ0TDycgwd116GvmJMa5ljAZBWvhPg6WhgRkmrj5j4mh+TselXruVcdphqxvEBF h7o7PgPwEUuH3TAXYzKYJiD1+9GLH8AGcFYAa8o/m1QJcCMglM0dfIRoeh8C3OGmv1+cUC tjZz9Dl7YpNwY3Tz9RDdVb41/YZ5WxWGTtIgj6dCrwfg2lcXBaTQMrMMmqFm92SG6CBlth ozHgw7aaCVE1sfatLEcTg5QNohH+d+VuCY2zwQCacUMgmTvwLzbXPRc1xePeUg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663985058; a=rsa-sha256; cv=none; b=s27k9knoz6DBgonPgtkA1B2H7ts+/62/PQ4kpPV4oulebsSE8KjI/yY/JTdV7ZI3Sce9yL +84aJe152KAtV+SZzG6XiIEUcqFU8ZXfLjd9cMmF6/+OGgwchJpwtD8KUAzomysNGdoj91 7hqFI7CSnbEY2AhZkRs7VtdEG98BuDhgyxWOm2Zzv8hrf68bdYd0dkTlNsYv4CUsY+i3Ot /R6JqWDNaDA1NTOIGn6UIuXGDOqJSArxXfQs3h+pH0AXW9ceYcAlMsGj0Qlao4U575OCMv Q179M9ZFIvli82TLx/12E+ouPNhRYFDMQLdcZFnLmOlLU/pZl2eOFd1ZFvwPdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=g9fMYCrx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.35 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=g9fMYCrx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3FE4A398FC X-Spam-Score: -3.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: FHZ0gvYR88Pl Akira Kyle 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 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