From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MCY4JmYUEWfeCQEAqHPOHw:P1 (envelope-from ) for ; Thu, 17 Oct 2024 13:43:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id MCY4JmYUEWfeCQEAqHPOHw (envelope-from ) for ; Thu, 17 Oct 2024 15:43:02 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Pb9en65k; 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=1729172581; 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=lEDfu14OtGTSynp13xNM+rwiw9uT/LDIc5BZipS0grU=; b=Jjy64ZKf0ZRpFTPxECu0U4eWxKH3ODMxuLny1xrBIFPHB6mToyz3ZJRqK1n7psy2+lvrRv uShsnj0IW6FfVb3Wn3umTIwbycwzLKqgaC2ItQOj7oQQxEQLIYWH+1+nQr/EF2jsxIMnAt +OK1zJmvcOtFRbzH9OnqLtQQiRZg6l/VSk3IjOmcbeu2zMQPQDOBlPS2k10dYdlnnSUWU0 a2E3UeejShkqnEcCK9Ch82H+q5acFcV8FNTkD50/+e51xOvgTeChYj9QHEc3sQJsRS1QMG b1pVt8V8MTBE25IlhMlzm0xlWzieROcK2x98w+1mRyqbF3Scs2BleJedc/fUug== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729172581; a=rsa-sha256; cv=none; b=Sod080lOtPYwA053HEvTSpxdWD4Wpevn0BP7GzUqc8GiOxe0a5rcGuCQ7B9oXVNkjl3mBn WnF+8dTwxz9MECYG+tlDRXIxowHhViJhwopgP9ONGzODIdaSXCKbX9j5tYvHLqCn27wEL8 1reIuMVZrWX9P6zXdftCQUg+eQj4gnrUO//cUvXTGggB68bwmFV+v5r852xeO2wZBTPplJ d3VF7pfbWXABfH1M25xXNfcjYU+0hDvmqmkpanOmaL6c5S371UnI8OaSH3w5s6+dT38MW1 9o3s544hX5wdMxP6GUM07/V/nWqgmvWOWE5OUhdm3jTe58drrAIX/8mjfoFOQA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Pb9en65k; 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 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 640D16E1A for ; Thu, 17 Oct 2024 15:43:00 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1Qlg-0002VO-Pg; Thu, 17 Oct 2024 09:42: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 1t1Qle-0002Uz-LW for emacs-orgmode@gnu.org; Thu, 17 Oct 2024 09:42:18 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t1Qlc-0006R0-KQ; Thu, 17 Oct 2024 09:42:18 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2fb3c3d5513so10814821fa.1; Thu, 17 Oct 2024 06:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172533; x=1729777333; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lEDfu14OtGTSynp13xNM+rwiw9uT/LDIc5BZipS0grU=; b=Pb9en65kKrDh7YWjPI5bSJuYVHmFeEdu1PYrbt2a7YqV2J3hz6qCervcLzUg3trRDD i9Dg49Itwjjx+RGAm1/VpOIttx5IU2JPQc+7dsyJWv8O4YI0Abr0o9LSRqa5WA17MS21 G90y6loTOKO5OhTB9D1HFQ2ycLo0e+qItYlVEZXEeJscH5NNnEiPL2OOALG0nxca6ynV qQzm5rxwLzn0mJWTNx8diisbZIA9A8T5b+w5z2f8pTtCg2G4MfkeuK1R0nzjpo6f8V5/ STWm1KIYvzFtVIuuIP1XDdQDc20oWyulIwacKqT+Esb4KdKB9/rsulEdFsCZwocid+QW xNUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172533; x=1729777333; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lEDfu14OtGTSynp13xNM+rwiw9uT/LDIc5BZipS0grU=; b=dzxPgUYToYOLP/YyZGT/YX2fgOVzq2pOfVBUsNdgN0MGfNz7I/JmdtNcJjKxecSuUr 0tvUibDUH29gXe8iOl+3ErFrWpWOlC/+l7GsQvUJ/1trPZOqvmpZNy+eSsCbLhE/pRmY KEQvy+MfQKQznwJM6LyxQndstHq5qOL4YCewziPvAWUN6aqt4PxpWy3NOd4O/zpE2iwN X7cRMyeK4pm9n8GMdoijtHnR9IUW2IlbO1vVJJ8jJDHmFJhoc5Mp4bSQtziE1dX4t7ZT OgZPoG5caN31KYTDUg+uFLTD10BQ4x7zNLUHknTP1FQu0cjga/6g0pyHkxPa2qC3HuCS 5Gcg== X-Forwarded-Encrypted: i=1; AJvYcCXc4Qe1SJkBlDGTiJmiaTjwHhM33uFcwylKCt9FRORBCEGExIuCtQ84naP0icKopgvD5xE=@gnu.org X-Gm-Message-State: AOJu0Yysxtwcx5oFWfVGY4n+HXHPhadwJNl9v1zMEv4kZGajclVre/U0 gRpQm5Om6CkYnNLi7CN0SuMKKrlHEmbUlD0A3rspdjNfGsGOk8nbehOcHzksTSgaahLHlF2aBo4 thk6Ywqg0/rgzLBYTTLXhfrBgfnR1+h+Z X-Google-Smtp-Source: AGHT+IGYNaEXgQJrEtGWnPEqoRmcBZ0DjqU4sPSRX6IEDj7t9OYOfhKE9sG/eDaG/YcbQLVwSYIB+17JBa5ID73lLH8= X-Received: by 2002:a2e:610a:0:b0:2f7:4d86:5dcf with SMTP id 38308e7fff4ca-2fb329ba7e3mr84585531fa.35.1729172533223; Thu, 17 Oct 2024 06:42:13 -0700 (PDT) MIME-Version: 1.0 References: <87y12n6d5l.fsf@localhost> In-Reply-To: <87y12n6d5l.fsf@localhost> From: Anoop GR Date: Thu, 17 Oct 2024 19:12:01 +0530 Message-ID: Subject: Re: ob-clojure breaks tangling of comments using org-babel-tangle for clojure source code blocks To: Ihor Radchenko Cc: emacs-orgmode@gnu.org, Bastien Guerry Content-Type: multipart/alternative; boundary="000000000000992b560624ac5ae6" Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=anoopemacs@gmail.com; helo=mail-lj1-x22b.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, HTML_MESSAGE=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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.76 X-Spam-Score: -4.76 X-Migadu-Queue-Id: 640D16E1A X-Migadu-Scanner: mx13.migadu.com X-TUID: m940WfDi4drg --000000000000992b560624ac5ae6 Content-Type: text/plain; charset="UTF-8" > > I guess that we may leave the comments intact if the code block does not > have :var. > I moved the comment stripping code in org-babel-expand-body:clojure to follow the above idea:- --- (defun org-babel-expand-body:clojure (body params) "Expand BODY according to PARAMS, return the expanded body." (let* ((vars (org-babel--get-vars params)) (backend-override (cdr (assq :backend params))) (org-babel-clojure-backend (cond (backend-override (intern backend-override)) (org-babel-clojure-backend org-babel-clojure-backend) (t (user-error "You need to customize `org-babel-clojure-backend' or set the `:backend' header argument")))) (ns (or (cdr (assq :ns params)) (if (eq org-babel-clojure-backend 'cider) (or cider-buffer-ns (let ((repl-buf (cider-current-connection))) (and repl-buf (buffer-local-value 'cider-buffer-ns repl-buf)))) org-babel-clojure-default-ns))) (result-params (cdr (assq :result-params params))) (print-level nil) (print-length nil) (body (org-trim (concat ;; Source block specified namespace :ns. (and (cdr (assq :ns params)) (format "(ns %s)\n" ns)) ;; Variables binding. (if (null vars) (org-trim body) (let ((body (replace-regexp-in-string "^[ ]*;+.*$" "" body))) ; Remove comments, they break (let [...] ...) bindings (format "(let [%s]\n%s)" (mapconcat (lambda (var) (format "%S '%S" (car var) (cdr var))) vars "\n ") body))))))) (if (or (member "code" result-params) (member "pp" result-params)) (format "(clojure.pprint/pprint (do %s))" body) body))) --- Now, it no longer loses comments on tangling. --000000000000992b560624ac5ae6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxibG9ja3F1b3RlIGNsYXNz PSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhleDtib3JkZXItbGVm dDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4Ij5JIGd1ZXNzIHRo YXQgd2UgbWF5IGxlYXZlIHRoZSBjb21tZW50cyBpbnRhY3QgaWYgdGhlIGNvZGUgYmxvY2sgZG9l cyBub3Q8YnI+DQpoYXZlIDp2YXIuPGJyPjwvYmxvY2txdW90ZT48ZGl2Pjxicj48L2Rpdj48ZGl2 PkkgbW92ZWQgdGhlIGNvbW1lbnQgc3RyaXBwaW5nIGNvZGUgaW4gb3JnLWJhYmVsLWV4cGFuZC1i b2R5OmNsb2p1cmUgdG8gZm9sbG93IHRoZSBhYm92ZSBpZGVhOi08YnI+PC9kaXY+PGRpdj48ZGl2 Pi0tLTwvZGl2PjxkaXY+KGRlZnVuIG9yZy1iYWJlbC1leHBhbmQtYm9keTpjbG9qdXJlIChib2R5 IHBhcmFtcyk8YnI+wqAgJnF1b3Q7RXhwYW5kIEJPRFkgYWNjb3JkaW5nIHRvIFBBUkFNUywgcmV0 dXJuIHRoZSBleHBhbmRlZCBib2R5LiZxdW90Ozxicj7CoCAobGV0KiAoKHZhcnMgKG9yZy1iYWJl bC0tZ2V0LXZhcnMgcGFyYW1zKSk8YnI+wqAgwqAgwqAgwqAgwqAoYmFja2VuZC1vdmVycmlkZSAo Y2RyIChhc3NxIDpiYWNrZW5kIHBhcmFtcykpKTxicj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