From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CLK0CWGPU2H4VwAAgWs5BA (envelope-from ) for ; Tue, 28 Sep 2021 23:55:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +JthBWGPU2GCZgAA1q6Kng (envelope-from ) for ; Tue, 28 Sep 2021 21:55:45 +0000 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 64FC95388 for ; Tue, 28 Sep 2021 23:55:44 +0200 (CEST) Received: from localhost ([::1]:60582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVL4g-0007gK-Qq for larch@yhetil.org; Tue, 28 Sep 2021 17:55:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVEW0-0000mI-O1 for emacs-orgmode@gnu.org; Tue, 28 Sep 2021 10:55:29 -0400 Received: from secure.cowgar.com ([209.160.64.5]:50086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVEVw-0005bt-Uo for emacs-orgmode@gnu.org; Tue, 28 Sep 2021 10:55:27 -0400 Received: from [104.14.89.110] (port=34606 helo=jdebian.attlocal.net) by secure.cowgar.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1mVEVs-0004KC-Ph; Tue, 28 Sep 2021 10:55:20 -0400 From: Jeremy Cowgar To: emacs-orgmode@gnu.org Subject: [PATCH] Treat :tangle-mode as an octal value not integer Date: Tue, 28 Sep 2021 10:54:48 -0400 Message-Id: <20210928145448.245883-1-jeremy@cowgar.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.160.64.5; envelope-from=jeremy@cowgar.com; helo=secure.cowgar.com 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 28 Sep 2021 17:55:01 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeremy Cowgar Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632866144; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5UvXWT27JoqQZWvxsfUCtH5T8N7Yv8NL4cGiW6TPYnM=; b=jafGCMAxCXf5hd10UouwDZpRKiiveFld5zOMCyqLBeABieMh+tuuiJupzEZDNkyRtL7WjX a0WK6GuCzFCgqLhGYWxT9l3nJio9F3dhlakjAS+WnvBdoTkF1PeDVggHTI/Q/mi6unX5zH d5f6CNa7A21L2nWfFCTl3KoxiWYDyVcL2n7XPRxlWpLxEwU7oaMt6346HsB6BkPkHFBN6/ 62SZAbJCP94M9nz7J4Otx+/FYyoO+FBXIHKohYnJaVHrxvnD8RqW+uWoB7g21SiiOxuy3a dn/h9oIu8fsTLBi4lipxMqc1stxGPde3nB2mVwa8BU7qjAkTUL/RHTUmyjh1FQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632866144; a=rsa-sha256; cv=none; b=QCzh3CvVTFa9joPIL1X8JOOPzJTBxRVC4Lp2Oa1HSElRHGWAYsNqYgyvGC5AWD8NDgDwTh bz6if/v2vozb9Lsz5RShAvWhe0faqbYWk0QyAv/34LoY6N79G3phmrilq37YfQSZjlhksp i7DGGkw1Saq2kMs3xscw2sYz+IoikMQwnXR25Ldng4Syz3o8AG3wfvPWQAMHO3LQi6d9Kk I3xvoCGQNMMqIpWUwOn77rUsm2EqA87bdV7w/WfTSJz8gUB0m3FSVjegrOUheZjNu0zxOw 13wQmp/r9LDkgxa7eakYF7z4QkQQqf/FK3/ircoGXwY5PFr50VxaWCj2P5xvhQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: 2.60 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 64FC95388 X-Spam-Score: 2.60 X-Migadu-Scanner: scn0.migadu.com X-TUID: HWVuoG52jPgz As an org user I would expect :tangle-mode 0660 to produce a file that has user rw, group rw, other nothing. Instead, what really happens currently is 0660 is treated as an integer which is actually 3140. This produces unexpected file permissions. Prior to this patch to have rw,rw,none, one has to convert 0660 octal into an integer (432) and then specify :tangle-mode 432. This is counter intuitive and requires multiple steps. After this patch, one just specifies the octal code as you do with chmod. :tangle-mode 0660 results in a file that is rw,rw,none. --- lisp/ob-tangle.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 2dd1d031c..154bd5145 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -246,7 +246,12 @@ matching a regular expression." (get-spec (lambda (name) (cdr (assq name (nth 4 spec))))) (she-bang (let ((sheb (funcall get-spec :shebang))) (when (> (length sheb) 0) sheb))) - (tangle-mode (funcall get-spec :tangle-mode))) + (tangle-mode (let ((tmode (funcall get-spec :tangle-mode))) + (when tmode + ;; convert integer representing an octal + ;; number to its real octal value + (string-to-number + (number-to-string tmode) 8))))) (unless (string-equal block-lang lang) (setq lang block-lang) (let ((lang-f (org-src-get-lang-mode lang))) -- 2.30.2