From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Martyanoff Newsgroups: gmane.emacs.devel Subject: [PATCH] Update compat Date: Wed, 25 Jan 2023 21:32:50 +0100 Message-ID: <20230125203250.132801-1-nicolas@n16f.net> References: <83ilgufsdb.fsf@gnu.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32234"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 25 21:34:19 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKmTL-0008BZ-QR for ged-emacs-devel@m.gmane-mx.org; Wed, 25 Jan 2023 21:34:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKmSa-0006Ql-7I; Wed, 25 Jan 2023 15:33:32 -0500 Original-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 1pKmSW-0006Ns-4P for emacs-devel@gnu.org; Wed, 25 Jan 2023 15:33:30 -0500 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKmST-0001Ji-MR for emacs-devel@gnu.org; Wed, 25 Jan 2023 15:33:27 -0500 Original-Received: by mail-wr1-x436.google.com with SMTP id t18so5447271wro.1 for ; Wed, 25 Jan 2023 12:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=n16f-net.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ieghu7jMPSq6E6Tjhpp1q0tAoD8R179zkqZENA8Jhc4=; b=Ni4EAlFIvkO4wrSbDURYIeFZc7VM7QqAR1ARAhshb8fiXegNMhth7YMYY1IuyWDOUl SLB7q+B+u/3Rl/iIr1Cq3Pk/ypNfKPoNTVT67a0Ava8/pcA6/ngH/sS9h0asjrM0dqtL JHa7H04S0ghRfWHZ9pFRbkXiGd9vUWgsiQswColIPwH3epnb4vMEZ8jb6iwLmZkBYwgQ HzwuKShSoCUFbt5BM2YacJ94fbIi1SkGWx7pVz+kcfuUJcFO4fX+LTGcxxYTsQ136v9j 6lKfb+z9b4sop7AiBk6LudkpWrt+4qDFLl0kehBHlDKv9TqOrdNa9T0CHNgucx6EofON HDEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ieghu7jMPSq6E6Tjhpp1q0tAoD8R179zkqZENA8Jhc4=; b=6kVNbPLw+HhMLcjDHXB8MccPYzx0UZr+1ZqjnPO6WAiNQNPkQLHH7n5COLuRhC/c9U xzQlSEeEHjxkAhzGlEPSjmftiiMKyW7CBhslEqGn2ChaR7Co+54Hn5EBVICBp2k1v5Yb PFCZVdsUvm33MLfb+H0XISvasQ0ziP2mCuZWnUTU7IEYqrVMaq22CW2REy6iH02WjRQM t4Aeakhflw6X5XSGLMsfGpzrAiMpOWJHYHVEx4E+akdIn7CQsUn50Mpx1tRROMIbXdKF 4G8VPbAh1fAtc8Im0WPcq8lBkwau2Q0UCdLq6Qon/OWZ6lpCVIBhoYvAs6GyxOR9nhgX nOlw== X-Gm-Message-State: AO0yUKVvGuGgFjGJNssn6Mw7HMr9O5GhJ52syZwO/55s5XxLHaTC+osV hn76gKuVUgXpPjfv1zpZBBH1q+7p3+n3IeWKX2dToA== X-Google-Smtp-Source: AK7set/l07Y3aT1njQ7gKROUkvLS7SVFdAwxoKvIDinEG5VPOPOKfd2VV0Z5NAVYVxBcsGwWHdUlAw== X-Received: by 2002:a05:6000:257:b0:2bf:bb48:ddaf with SMTP id m23-20020a056000025700b002bfbb48ddafmr2714268wrz.7.1674678801526; Wed, 25 Jan 2023 12:33:21 -0800 (PST) Original-Received: from localhost (2a01cb04001912003e217b0e0a701843.ipv6.abo.wanadoo.fr. [2a01:cb04:19:1200:3e21:7b0e:a70:1843]) by smtp.gmail.com with ESMTPSA id j14-20020a5d452e000000b002bfb6b9f55bsm3096548wra.16.2023.01.25.12.33.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:33:21 -0800 (PST) X-Mailer: git-send-email 2.38.1 In-Reply-To: <83ilgufsdb.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=nicolas@n16f.net; helo=mail-wr1-x436.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302657 Archived-At: From: GNU ELPA Mirror Bot Timestamp: 2022-11-23 00:00:55 GNU ELPA commit: c1e7d260a3e9305188aea0b5a372f4ccd4dfb22c Emacs commit: 057901f55ad12ebbc9cf092dd6ad0f02539849f9 --- compat-27.el | 11 +++++++++++ compat.texi | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/compat-27.el b/compat-27.el index 04abe6e..714df89 100644 --- a/compat-27.el +++ b/compat-27.el @@ -662,6 +662,17 @@ defvar json-null) (when (stringp res) (compat--file-local-name res))) (executable-find command))) +;;*UNTESTED +(compat-defun make-empty-file (filename &optional parents) + "Create an empty file FILENAME. +Optional arg PARENTS, if non-nil then creates parent dirs as needed." + (when (and (file-exists-p filename) (null parents)) + (signal 'file-already-exists (list "File exists" filename))) + (let ((paren-dir (file-name-directory filename))) + (when (and paren-dir (not (file-exists-p paren-dir))) + (make-directory paren-dir parents))) + (write-region "" nil filename nil 0)) + ;; TODO provide advice for directory-files-recursively ;;;; Defined in format-spec.el diff --git a/compat.texi b/compat.texi index f19d27f..9953269 100644 --- a/compat.texi +++ b/compat.texi @@ -1482,6 +1482,14 @@ derived from any of the major modes given by the symbols @var{modes}. @xref{Derived Modes,,,elisp}. @end defun +@c based on lispref/files.texi +@defun make-empty-file filename &optional parents +This function creates an empty file named @var{filename}. As +@code{make-directory}, this function creates parent directories if +@var{parents} is non-@code{nil}. If @var{filename} already exists, this +function signals an error. +@end defun + @subsection Prefixed Definitions These functions are prefixed with @code{compat} prefix, and are only loaded when @code{compat-27} is required: -- 2.38.1