From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id mOe8CWTS92TlQQAAauVa8A:P1 (envelope-from ) for ; Wed, 06 Sep 2023 03:14:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mOe8CWTS92TlQQAAauVa8A (envelope-from ) for ; Wed, 06 Sep 2023 03:14:12 +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 C6586309E8 for ; Wed, 6 Sep 2023 03:14:11 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="a/A7bu8Q"; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693962851; 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=xKDzXC+F4mwWDOnGQESWEGDsgnB91zvYNS9L8oaDhLY=; b=gUBnpvakYwO7qUy7IZTrLbttNsb0U/MK9nsBmp56RBNwBlyveiaPb82Mj9P49xDTk5i2CL xK8DyGEKO9+lISmUdFnPEdb5FnlGeLcaAp9uazyxU26Lyf08xK+2Vb80FH9k1tsPfSu+p0 fqEepz+rT2M+PUozC6QID49xlooOG4osbhxY1aGTBR10Pjlq0xpXSBy+gRbRWuxTuu9Hg6 afMhX1ARRKOHoudmIyg3967R6s/U1yt1C7mqtJckSNAwjaGLYYoX26sO0o6qOr8FQNXpnO iNeODMOSKba58vSOfi3Butqw57dVunPWD/cv+XzSa0F/29YbFqHdHgAdA1fYHQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693962851; a=rsa-sha256; cv=none; b=cvnwW8whbPOvLJcPFmtwh9weN50h8jetRTNMuS43WtWnEj95Hj9nBSGB11AmSl+1s/QkJo BGHU82LzFZJEjYQep3dk5mVhKucSZuySqf7SdPsn/V6Y22HThi6S8zQlCb0M1Y2dT1sE2P SkrfEI0aR8LMJiC1UGOeecoQxTVc2YgpolEhykPZ3M3Tq9sfQLgsq8/I30Dd+rRe0zD/gO Y3ADicBI3xEsZyLzLKS12HjvkCOTjG3cum3d0+0GnOjhy1UJQQI5U6T85HiQwDDe63Zlbh JjDh4rD2/apXnENA3U8Vos0yiMP/OkNIGgY325iI+tuVLDTlhUSmMOEDP/JpyQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="a/A7bu8Q"; 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=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdh6e-0004ZW-8U; Tue, 05 Sep 2023 21:13:20 -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 1qdh6c-0004ZM-O5 for emacs-orgmode@gnu.org; Tue, 05 Sep 2023 21:13:18 -0400 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdh6Z-0002ha-6V for emacs-orgmode@gnu.org; Tue, 05 Sep 2023 21:13:18 -0400 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-41368601e92so17732141cf.3 for ; Tue, 05 Sep 2023 18:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693962793; x=1694567593; darn=gnu.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=xKDzXC+F4mwWDOnGQESWEGDsgnB91zvYNS9L8oaDhLY=; b=a/A7bu8QIq4evLBQyPM1a8foJWXj/GGGj6a+eUHmiAuJv7rC7iWALZow1eNJWLbpYM TPO82bBxQuSh/m477/Y95uMywzf54aD/C+K3ptqa9ZSMSWi/+203nr+FjFXZs+8m2HSZ hJrTpgO1X8RMwBYMaIejhS28gteMvd/4RQwSLaqlaDcEJZLAv9dTFF8b2jWEneHKwgWG yfq2YZMhhroSQ5l4ozJUme9j6FX3FXbupzyW6ZFgupWXEFlhER5s9vT/96k31e3xHSfy 974lyerPg0HRdebCxVMz7A7SUdaiM6cowd1yhUDk/GMT0ZEmeUUck3+rWqXSeBKAZ1yL Jr3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693962793; x=1694567593; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xKDzXC+F4mwWDOnGQESWEGDsgnB91zvYNS9L8oaDhLY=; b=aFLTL/lhdNLOahs5/HO5XDRkMx+pOW7gZyv+ch8Nwy7gCzaPYzo28FC7wi0qFirNlj GS4EU8LkFegane6ahYquhvkY1T8sDEwJm1jbsnv5RpNFniRwC1e2eq/Rnl1Yw0dIEUbd qFkbYdVXUazztSGOLu8JtvHFkRzRtRxWV66Qpjj2DHU1l3c5S7zWR80OLhMJDvZs3rsu DDCHLrTG2QkS3pk8SG3+13Lk2RzbVMJ+ksq5xCQ0heMbezsNo46DPg82GmfWhOSNtWQ0 AVzgm+favsNEa8wdm1A8pIQ9Bv9H7qePWKgPui6YRdbpBpDOgMurNN7K5pIqMK2NWey2 3KQw== X-Gm-Message-State: AOJu0Yz+hOQbVfYYEVwKpO56hvrdxZFOqs7N8wkMpAP/yBBT9Do8rTJ4 61LYs/sudmOf4NvTmYNGP2lkQFl4Rlk= X-Google-Smtp-Source: AGHT+IGMF7sIP6sqLjgA0aSQYMumal6/flYUC/ywQdNTu8TC+9SC8QaUGEc5Tag6R3kiE/ELWJNxAQ== X-Received: by 2002:ac8:578d:0:b0:410:a088:38f5 with SMTP id v13-20020ac8578d000000b00410a08838f5mr17248676qta.4.1693962793418; Tue, 05 Sep 2023 18:13:13 -0700 (PDT) Received: from laptop ([2601:84:847f:c697:2d4:9eff:feb6:970c]) by smtp.gmail.com with ESMTPSA id bq25-20020a05622a1c1900b0041061a16791sm4788246qtb.67.2023.09.05.18.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 18:13:12 -0700 (PDT) References: <87jztk1rdc.fsf@gmail.com> <878r9zim0z.fsf@localhost> <87pm2zgiac.fsf@gmail.com> <87v8cqwfbc.fsf@localhost> User-agent: mu4e 1.11.15; emacs 30.0.50 From: No Wayman To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Org mode version 9.7-pre (9.7-pre-n/a-g63e8ca @ /home/n/.emacs.d/elpaca/builds/org/); [PATCH] refactor org-babel-lilypond-compile-lilyfile Date: Tue, 05 Sep 2023 21:11:18 -0400 In-reply-to: <87v8cqwfbc.fsf@localhost> Message-ID: <87zg20yugr.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=iarchivedmywholelife@gmail.com; helo=mail-qt1-x834.google.com 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, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx2.migadu.com X-Spam-Score: -6.58 X-Migadu-Queue-Id: C6586309E8 X-Migadu-Spam-Score: -6.58 X-TUID: C606BgVTVmzf --=-=-= Content-Type: text/plain; format=flowed Ihor Radchenko writes: > Thanks! You're welcome. > It looks like ob-lilypond/ly-compile-lilyfile test is relying on > this > optional second argument. So, after applying your patch, make > test is > failing. I've amended the test using cl-letf. I also bound the variables which may generate output files to nil to prevent generating any output files if the test is run interactively. See attached. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-lilypond.el-refactor-org-babel-lilypond-comp.patch >From 94a97e1581c28a5330ddaf6664e1bc00516be807 Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Thu, 24 Aug 2023 09:32:27 -0400 Subject: [PATCH] lisp/ob-lilypond.el: refactor org-babel-lilypond-compile-lilyfile * ob-lilypond.el (org-babel-lilypond-compile-lilyfile): Correct compilation message. Remove superfluous local variables. Remove unused ad-hoc debugging TEST parameter. * test-ob-lilypond.el (ob-lilypond/ly-compile-lilyfile): Locally bind variables which may generate output files. Refactor to account for removed TEST parameter. --- etc/ORG-NEWS | 3 +++ lisp/ob-lilypond.el | 35 +++++++++++++------------------- testing/lisp/test-ob-lilypond.el | 31 ++++++++++++++++------------ 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 842d3fe4d..c40e1be82 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -304,6 +304,9 @@ setting the ~STYLE~ property for each sub-task. The change is breaking when ~org-use-property-inheritance~ is set to ~t~. +*** ~org-babel-lilypond-compile-lilyfile~ ignores optional second argument + +The =TEST= parameter is better served by Emacs debugging tools. ** New and changed options *** ~org-export-smart-quotes-alist~ is now a custom option diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 8b2bd231f..c2dba36aa 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -247,27 +247,20 @@ org-babel-lilypond-execute-tangled-ly (org-babel-lilypond-attempt-to-open-pdf org-babel-lilypond-temp-file) (org-babel-lilypond-attempt-to-play-midi org-babel-lilypond-temp-file))))) -(defun org-babel-lilypond-compile-lilyfile (file-name &optional test) - "Compile lilypond file and check for compile errors. -FILE-NAME is full path to lilypond (.ly) file." - (message "Compiling LilyPond...") - (let ((arg-1 org-babel-lilypond-ly-command) ;program - ;; (arg-2 nil) ;infile - (arg-3 "*lilypond*") ;buffer - (arg-4 t) ;display - (arg-5 (if org-babel-lilypond-gen-png "--png" "")) ;&rest... - (arg-6 (if org-babel-lilypond-gen-html "--html" "")) - (arg-7 (if org-babel-lilypond-gen-pdf "--pdf" "")) - (arg-8 (if org-babel-lilypond-use-eps "-dbackend=eps" "")) - (arg-9 (if org-babel-lilypond-gen-svg "-dbackend=svg" "")) - (arg-10 (concat "--output=" (file-name-sans-extension file-name))) - (arg-11 file-name)) - (if test - `(,arg-1 ,nil ,arg-3 ,arg-4 ,arg-5 ,arg-6 ;; arg-2 - ,arg-7 ,arg-8 ,arg-9 ,arg-10 ,arg-11) - (call-process - arg-1 nil arg-3 arg-4 arg-5 arg-6 ;; arg-2 - arg-7 arg-8 arg-9 arg-10 arg-11)))) +;;Ignoring second arg for pre Org 9.7 compatibility +(defun org-babel-lilypond-compile-lilyfile (filename &optional _) + "Compile Lilypond FILENAME and check for compile errors." + (message "Compiling %s..." filename) + (let ((args (delq nil (list + (and org-babel-lilypond-gen-png "--png") + (and org-babel-lilypond-gen-html "--html") + (and org-babel-lilypond-gen-pdf "--pdf") + (and org-babel-lilypond-use-eps "-dbackend=eps") + (and org-babel-lilypond-gen-svg "-dbackend=svg") + (concat "--output=" (file-name-sans-extension filename)) + filename)))) + (apply #'call-process org-babel-lilypond-ly-command nil + "*lilypond*" 'display args))) (defun org-babel-lilypond-check-for-compile-error (file-name &optional test) "Check for compile error. diff --git a/testing/lisp/test-ob-lilypond.el b/testing/lisp/test-ob-lilypond.el index b829b8a10..5f439793b 100644 --- a/testing/lisp/test-ob-lilypond.el +++ b/testing/lisp/test-ob-lilypond.el @@ -46,19 +46,24 @@ ob-lilypond/org-babel-prep-session:lilypond :type 'error) (ert-deftest ob-lilypond/ly-compile-lilyfile () - (should (equal - `(,org-babel-lilypond-ly-command ;program - nil ;infile - "*lilypond*" ;buffer - t ;display - ,(if org-babel-lilypond-gen-png "--png" "") ;&rest... - ,(if org-babel-lilypond-gen-html "--html" "") - ,(if org-babel-lilypond-gen-pdf "--pdf" "") - ,(if org-babel-lilypond-use-eps "-dbackend=eps" "") - ,(if org-babel-lilypond-gen-svg "-dbackend=svg" "") - "--output=test-file" - "test-file.ly") - (org-babel-lilypond-compile-lilyfile "test-file.ly" t)))) + (cl-letf (((symbol-function 'call-process) 'list) + (org-babel-lilypond-gen-png nil) + (org-babel-lilypond-gen-html nil) + (org-babel-lilypond-use-eps nil) + (org-babel-lilypond-gen-svg nil)) + (should (equal + `(,org-babel-lilypond-ly-command ;program + nil ;infile + "*lilypond*" ;buffer + display + ,@(when org-babel-lilypond-gen-png '("--png")) ;&rest... + ,@(when org-babel-lilypond-gen-html '("--html")) + ,@(when org-babel-lilypond-gen-pdf '("--pdf")) + ,@(when org-babel-lilypond-use-eps '("-dbackend=eps")) + ,@(when org-babel-lilypond-gen-svg '("-dbackend=svg")) + "--output=test-file" + "test-file.ly") + (org-babel-lilypond-compile-lilyfile "test-file.ly"))))) (ert-deftest ob-lilypond/ly-compile-post-tangle () (should (boundp 'org-babel-lilypond-compile-post-tangle))) -- 2.42.0 --=-=-=--