From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Cross Subject: Re: ob-clojure should not tangle with inserting (ns ..) line when no :ns specified. Date: Sat, 01 Dec 2018 08:25:22 +1100 Message-ID: <87a7lq1cn1.fsf@gmail.com> References: <877egvj6l2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqHx-0004eS-Pc for emacs-orgmode@gnu.org; Fri, 30 Nov 2018 16:25:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqHw-0006Al-SN for emacs-orgmode@gnu.org; Fri, 30 Nov 2018 16:25:29 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqHw-000657-Gp for emacs-orgmode@gnu.org; Fri, 30 Nov 2018 16:25:28 -0500 Received: by mail-pl1-x635.google.com with SMTP id w4so3407631plz.1 for ; Fri, 30 Nov 2018 13:25:28 -0800 (PST) In-reply-to: <877egvj6l2.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: numbchild@gmail.com Cc: org-mode stardiviner writes: > The ob-clojure tangle will insert ~(ns ..)~ from babel header argument :ns or use defualt ~(ns user)~. > > #+begin_src clojure :eval no :ns "" :tangle "data/code/xunfei-clj-demo/project.clj" :results link :file "data/code/xunfei-clj-demo/project.clj" > (defproject xunfei-clj-demo "0.1.0-SNAPSHOT" > :description "xunfei-clj demo" > :url "http://example.com/FIXME" > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > :dependencies [[org.clojure/clojure "1.9.0"] > [xunfei-clj "0.1.4-SNAPSHOT"]] > :resource-paths ["lib/Msc.jar"]) > #+end_src > > In upper case, obviously I don't want insert the ~(ns ..)~ line of code. > > I hope the ob-clojure header argument ~:ns~ should detect value like > "nil", "" (empty string) or something else. Or when ~:ns~ header > argument is not specified. So that the tangling will not auto insert > ~(ns ..)~ line. I think the problem here is that really, project.clj is not a valid clojure source file. It is really a clojure data file or clojure snippet (I mean in the sense that you cannot execute it or include it as a dependency within a clojure program - it is input data for the lein build tool). If lein was being developed from scratch today, rather than project.clj, you would probably have project.edn. The question is, should we allow setting ns to nil/"", preventing inclusion of a ns line, which would make 'real' clojure source files invalid just to support this edge case or should we consider an alternative solution e.g. - have a 'lein-project' source type which could perhaps provide additional support for editing project.clj files (as I suspect lein is on the way out - replaced with things like clj or boot) - try using edn-mode and having support for edn as a valid language type. I've never used edn mode and I'm not 100% certain project.clj and edn are completely compatible. It seems to me that the preferred build tool is likely to become clj or derivatives of clj. I've noticed increasingly longer delays in new lein releases (the 'reflection' warning has been there for nearly 12 months now, as has the incorrect classpath warning on some platforms). In the long-term, I think org would probably benefit from integration with clj rather than cider for ob-clojure as it is likely to be more stable and less complex. Using cider has always felt like pushing a square peg into a round hole to me. Tim -- Tim Cross