From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id mDdbJbuoS2QZGAEASxT56A (envelope-from ) for ; Fri, 28 Apr 2023 13:06:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gNdBJbuoS2QKtwAAauVa8A (envelope-from ) for ; Fri, 28 Apr 2023 13:06:35 +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 4B42635371 for ; Fri, 28 Apr 2023 13:06:35 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682679995; h=from:from:sender:sender:reply-to: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; bh=nO2URRqFk0WqVxXPt/UoeVImLiDRkcrMxYuWM/s9+PE=; b=fBfl4f6KBi/2RmOkHopQifb1HYjlVxpgYrmzBs+3MIkpAHMeJkgc7/z+/Tnv1uHAUTS3BX 7IlaqIl7ECwW3TBbZXyQbwqqilba5shJzUbZgfwAvCznVV9rst2rEfMJ7nEvjZ8887AbD4 JbLsFq+uNMWcJemNCNBcYW0Ch4eZX4kjnzcUmlnETDIpD12mUp4/jnFoHyze/cVAaTsOXf HwyYs+g0I7Y/M9m556FpeMupIXEvVnk9Nh7QPLhhJuKHEKvJ4sGFXW+zYb3GKw4aACBcgw N3kc6O7KVVc/puqo4x53bAmZlaTZmHfIVM9x/fSDicZYr3uNISL+HC4E/K2zdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682679995; a=rsa-sha256; cv=none; b=h+jsDoXjLxAQqa9V/ykL//8Hr8yYTnQxaSHpO3MBHQbSheRysxbgPIUlkGAK2ocPilIZ8T pGSSA3OmcUsVCLkDJGflpm5vi4cTalknd+SUoHH7SLHUhcukkKx6qL+ASZ83TAuNAESHb6 s+z4XeutcKE49gUYYWonCJPWTxFYKvkGMIPevGDDcsp9ltN0MrhEX2Yvlu+gNQAp9LolOG qgpbyFKz5dFHM3AGdJPcd58WRJ/wUpc9KyuuwN+QcuWca/7RbyK6JpyyRVGbqZ01OcD5AZ deo+d4tpcuw5MUOkAaeGQU8K2tUlUGGnNA7br/Ywgj2qrc5pU+8LsBfREjAA6A== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psLvE-0006x6-Rq; Fri, 28 Apr 2023 07:05:53 -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 1psLuh-0006i3-AK for emacs-orgmode@gnu.org; Fri, 28 Apr 2023 07:05:25 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psLuc-0006NT-3G for emacs-orgmode@gnu.org; Fri, 28 Apr 2023 07:05:17 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id f43ad616 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 28 Apr 2023 11:05:05 +0000 (UTC) References: User-agent: mu4e 1.9.22; emacs 30.0.50 To: Mehmet Tekman Cc: emacs-orgmode@gnu.org Subject: Re: [ANN] lisp/ob-tangle-sync.el Date: Fri, 28 Apr 2023 18:57:56 +0800 In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Reply-to: Ruijie Yu From: Ruijie Yu via "General discussions about Org-mode." Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: UNKNOWN X-Migadu-Spam-Score: -4.05 X-Spam-Score: -4.05 X-Migadu-Queue-Id: 4B42635371 X-Migadu-Scanner: in3.migadu.com X-TUID: QGnaOgNSd2ry Mehmet Tekman writes: > Ruijie Yu writes: > >> Great idea! Some inline comments below. >> >> You only need to say #'expand-file-name instead of the quoted lambda. >> Also, you need to set the variable, otherwise the variable >> `org-babel-tangle-sync-files' is undefined. >> >> What I have in mind is this: >> :set (lambda (var val) (set var (mapcar #'expand-file-name val))) >> >> Here you don't have to use `progn' because it is implied from `save-excursion'. >> > > Thanks! I've made your changes, and I've also incorporated John > Wiegley's comments about using "import" instead of "pull" as a > tangle-sync action word (small diff attached). > > I've also written up my changes in the ~etc/ORG-NEWS~ and > targeted my custom variable for the 9.7 release (diff attached). Thanks. Can you make a full patch from the current main branch to your changes, with a commit message and so on? This would help reviewers to look at the full picture of what are modified. Take a look at the manpage git-format-patch(1) if you aren't sure how to do it. For the commit message, take a look at https://orgmode.org/worg/org-contribute.html#commit-messages for inspirations. >> Is there possibility to have a local minor mode (without introducing too >> much code changes)? > > I initially tried it this way, but the problem is that an org > source block buffer might be in sync-mode, but it's > corresponding tangle file might not be, making any changes > asymmetric. > > Another issue is in order to see the changes in the tangled file, > the tangle buffer needs to be reverted (with user prompt) which > then switches off the sync-mode for that buffer on reload. > > One way around this (and it's something I implemented 3 years ago in > my messy org-tanglesync[0] MELPA code) is to set an explicit list of > "sync files", and then for Emacs to parse every =:tangle= header in a > given file when loaded (via =org-src-mode-hook=) to create an alist of > config files and their associated tangled files[1], such as > =((file1.conf . (tanglefile1.txt tanglefile2.txt etc)))=. Then, for > example, when ~tanglefile1.txt~ is loaded, Emacs knows that it should > load the sync-mode too. > > This approach works reasonably well when the "sync files" list is > mandatory, but it's also prone to errors if a sync file is edited and > the alist of config files isn't updated, and the user would also lose > the flexibility of having ~ob-tangle-sync~ function everywhere. > > I think a global minor mode is really elegant in this regard and I > wish I knew about it 3 years ago! Thanks for explaining this. Yes, this sounds like a lot of work with probably insufficient audience, so I'd wait for more use cases to come up before thinking about local minor modes. -- Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.]