From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 0F5rC8pPFWa00AAAe85BDQ:P1 (envelope-from ) for ; Tue, 09 Apr 2024 16:25:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0F5rC8pPFWa00AAAe85BDQ (envelope-from ) for ; Tue, 09 Apr 2024 16:25:14 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=V+lTK+Hg; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1712672714; 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=hTVizUNzVUNqcrHlvCGml5V451BKqhB0Xt2cG1Vxlqc=; b=e3gUx9U2eDfINgJQU+mZA61jM2i8yGRLkWRyqGyI/PXAtqZ2eQcqx3dZxDMdscvwfu3tG4 PCSJvSduSEQ1lUBamskNaDilFGBqUgMK1dExeuenawhU4c5Pbd4jCIHezghwTr8WCEsBiA Mp8TShJ+uJukC60fgo1LWzeLPkMyZBM/Em8UBue03jq2M8yf2NeCMYbIxonyUZp5yktWrI VKXw14Cq3ZhVK4xHqXf7EGpgFwIkIWv+sk7kh0fV3S6C0duPkP+2dUvxjJu+sKW+MwbA1D 8JvJm28Cuor4KAz32q/JGVNmNB/sThEXd/Glwk8Rjoe1rBIBj8elom2icg0uyQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712672714; a=rsa-sha256; cv=none; b=OpcbgPQpclClNHAWZ0Mx3OFkBlI96EXrisUUBAV53ZTGemATDcf6/Kvlb8GJ2xEzbWhk72 rKeZevFyLcPGzvlKqjgahbiJkyXg7GE24p4Byg0qCQg2RGBqr2B7bhqaC67/fuCGaOuSXL WpDdVydAIdIe22AFIE2LWW4UvVN5ly1Nx1nkyJ8Zx9btF9FfpawRx1JERFUIUzkL52i4LE zk05autOA8YkelWqIoOKHRZ8tTP0I34wQ2l9Ye/B5yRdn8P51xPpLw9Q67onkvA4kS4HZ9 vwFYRQ+dcI/n6svasdFkxfl3/rdrvXy6qQTpxtDqsC0+3DFpwevyhezVUGmkwA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=V+lTK+Hg; 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"; dmarc=pass (policy=none) header.from=posteo.net 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 0220F54B58 for ; Tue, 9 Apr 2024 16:25:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruCOl-0005PO-UB; Tue, 09 Apr 2024 10:24:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruCOj-0005Oi-Ps for emacs-orgmode@gnu.org; Tue, 09 Apr 2024 10:24:30 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruCOX-0008Pi-V4 for emacs-orgmode@gnu.org; Tue, 09 Apr 2024 10:24:29 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9D007240101 for ; Tue, 9 Apr 2024 16:24:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712672653; bh=mesAmaJWMUjUL2MxSXgEOiPRJ2wkZEdIFlzU2v3sbMA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=V+lTK+Hgf9guoaYlMpUAbfw+MOoO0/BhOyrwGSufHvcPLQLhQ5ctB0vhb4wJUdb0x +9ogb/vsvBMGm0it00Imi29EIacAmQ+GS4FnvC8o+7dId3+nt3Cn+MxJJMNqYj+snJ 2v/G7XbthcpnNVmX9iQ+oSwU1OdcpcqW9pQ64Db24BZEQ8lFX5EhlCQuAuc4ST0vau cC3kcEx/OngMXYfURfQ4TLkq2qZCkGRUSJ66lEMycgJiNo3HAS+kA+FLLiTOErHoyP zUPClNjmI4tPdmA/THqkdxtNeGcL+ga6x2uuADFj6FpPbuGjt55AAJj5sDTrkhAaEd BwiFCqvugYBXQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VDSrX5YyKz9rxM; Tue, 9 Apr 2024 16:24:12 +0200 (CEST) From: Ihor Radchenko To: Rudi C Cc: emacs-orgmode@gnu.org Subject: Re: [Q] startup hook: How do I detect if the current buffer has been opened programmatically? In-Reply-To: References: Date: Tue, 09 Apr 2024 14:24:37 +0000 Message-ID: <87msq2397e.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.61 X-Spam-Score: -5.61 X-Migadu-Queue-Id: 0220F54B58 X-Migadu-Scanner: mx13.migadu.com X-TUID: J6qEC34psTzg Rudi C writes: > Org-mode occasionally opens files automatically, for instance, when > inserting or opening ID links, or during certain searches. I need to > determine if a buffer was opened programmatically or manually by the user > within the startup hooks. This distinction is important because, e.g., I > want to automatically preview all LaTeX fragments if the buffer was opened > by the user, but not if it was opened programmatically. AFAIK, there is no reliable way to do this. You may play around with `find-file-hook'. See `org-with-file-buffer' macro in org-macs.el (on main). -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at