ag91 / moldable-emacs

Adapting Emacs for moldable development
GNU General Public License v3.0
107 stars 8 forks source link

Build Warnings & Errors #5

Open kat-co opened 3 years ago

kat-co commented 3 years ago

Hello! I am very excited by this work, and I wanted to try it out. To do so, I created a Guix package both because I use Guix and I wanted to start playing around, and because Guix builds in a clean-room environment and helps me to understand what software actually needs and does.

Here is the package definition:

(define-public emacs-moldable-emacs
  (let ((commit "0737b3aecc0afd6d59166563d566bbe1d322a9d2"))
    (package
      (name "emacs-moldable-emacs")
      (version (git-version "0.0.0" "1" commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/ag91/moldable-emacs")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32 "0zlmv7qrjc01y0j3hrrw80r82z1a5l4ki3b8ldnq0qls61x1xwfy"))))
      (inputs
       `(("emacs-dash" ,emacs-dash)
         ("emacs-s" ,emacs-s)
         ("emacs-async" ,emacs-async)))
      (build-system emacs-build-system)
      (home-page "https://github.com/ag91/moldable-emacs")
      (synopsis "Adapting Emacs for moldable development ")
      (description
       "This is an extension of Emacs aiming to enable Moldable
Development. Or better still, aiming to make you a better story teller
when you deal with code.")
      (license license:gpl3+))))

Unfortunately I got a build error:

Build Log ``` The following derivation will be built: /gnu/store/g7r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv building /gnu/store/g7r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv... starting phase `set-SOURCE-DATE-EPOCH' phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds starting phase `set-paths' environment variable `PATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/bin:/gnu/store/v6f44zccwh9z5zk3pjlywjybbi8n2hjh-tar-1.32/bin:/gnu/store/ncydgq2znms5n1d2k5yqshhf58nsixwv-gzip-1.10/bin:/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8/bin:/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/bin:/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/bin:/gnu/store/n4n560pfvvw50a9369axw5vj5rrqfj1n-diffutils-3.7/bin:/gnu/store/cd5qf3kcnlq35p9k392pjdpdzpsnds70-patch-2.7.6/bin:/gnu/store/hic7snhayfl7m6cpfqqr73nmm19bpqkg-findutils-4.7.0/bin:/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/bin:/gnu/store/ishk7fswcs4gkwcp8mh788z4mvvl9bxh-sed-4.8/bin:/gnu/store/bhs4rj58v8j1narb2454raan2ps38xd8-grep-3.4/bin:/gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32/bin:/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3/bin:/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin:/gnu/store/mpa04aq8lblbcviyxywxcsb1zbi0mf39-ld-wrapper-0/bin:/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/bin:/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/bin:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/sbin' environment variable `EMACSLOADPATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/share/emacs/site-lisp:/gnu/store/255jfysgmqi8lwl8x0nh88x3j5s3fi8a-emacs-dash-2.19.1/share/emacs/site-lisp:/gnu/store/lkin08vh3vlz0f5qirvhbq00jskmx834-emacs-s-1.12.0/share/emacs/site-lisp:/gnu/store/24bnqdxmchk3vgahazbbpqaq8wzbj1hr-emacs-async-1.9.4/share/emacs/site-lisp' environment variable `INFOPATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/share/info:/gnu/store/v6f44zccwh9z5zk3pjlywjybbi8n2hjh-tar-1.32/share/info:/gnu/store/ncydgq2znms5n1d2k5yqshhf58nsixwv-gzip-1.10/share/info:/gnu/store/n4n560pfvvw50a9369axw5vj5rrqfj1n-diffutils-3.7/share/info:/gnu/store/hic7snhayfl7m6cpfqqr73nmm19bpqkg-findutils-4.7.0/share/info:/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/share/info:/gnu/store/ishk7fswcs4gkwcp8mh788z4mvvl9bxh-sed-4.8/share/info:/gnu/store/bhs4rj58v8j1narb2454raan2ps38xd8-grep-3.4/share/info:/gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32/share/info:/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3/share/info:/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/share/info:/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/share/info:/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/share/info:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/share/info' environment variable `BASH_LOADABLES_PATH' unset environment variable `C_INCLUDE_PATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/include:/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8/include:/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/include:/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/include:/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/include:/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3/include:/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/include:/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/include:/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20/include' environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/include:/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8/include:/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/include:/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/include:/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/include:/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3/include:/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/include:/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++:/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/include:/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20/include' environment variable `LIBRARY_PATH' set to `/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/lib:/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8/lib:/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/lib:/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/lib:/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/lib:/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/lib:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib:/gnu/store/s3dcqzwqaakv1yx37by9chksdbkgih17-glibc-2.31-static/lib:/gnu/store/hwcky7446s952w0mwchhmm211ll07zrq-glibc-utf8-locales-2.31/lib' environment variable `GUIX_LOCPATH' set to `/gnu/store/hwcky7446s952w0mwchhmm211ll07zrq-glibc-utf8-locales-2.31/lib/locale' phase `set-paths' succeeded after 0.0 seconds starting phase `install-locale' using 'en_US.utf8' locale for category "LC_ALL" phase `install-locale' succeeded after 0.0 seconds starting phase `unpack' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/moldable-emacs.el' -> `./moldable-emacs.el' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/LICENSE.md' -> `./LICENSE.md' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/README.org' -> `./README.org' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/resources/my.jpg' -> `./resources/my.jpg' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/molds/core-1.el' -> `./molds/core-1.el' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/molds/contrib.el' -> `./molds/contrib.el' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/molds/contrib-1.el' -> `./molds/contrib-1.el' `/gnu/store/ardf5qwqj82gva405hywf2vbd25jhqgh-emacs-moldable-emacs-0.0.0-1.0737b3a-checkout/molds/core.el' -> `./molds/core.el' phase `unpack' succeeded after 0.0 seconds starting phase `expand-load-path' source directory "/tmp/guix-build-emacs-moldable-emacs-0.0.0-1.0737b3a.drv-0/source" prepended to the `EMACSLOADPATH' environment variable expanded load paths for dash-2.19.1, s-1.12.0, async-1.9.4 phase `expand-load-path' succeeded after 0.0 seconds starting phase `patch-usr-bin-file' phase `patch-usr-bin-file' succeeded after 0.0 seconds starting phase `patch-source-shebangs' phase `patch-source-shebangs' succeeded after 0.0 seconds starting phase `patch-generated-file-shebangs' phase `patch-generated-file-shebangs' succeeded after 0.0 seconds starting phase `check' test suite not run phase `check' succeeded after 0.0 seconds starting phase `install' `/tmp/guix-build-emacs-moldable-emacs-0.0.0-1.0737b3a.drv-0/source/moldable-emacs.el' -> `/gnu/store/46r4pm57qrppz5jb90l5nid8c575y117-emacs-moldable-emacs-0.0.0-1.0737b3a/share/emacs/site-lisp/moldable-emacs-0.0.0-1.0737b3a/moldable-emacs.el' phase `install' succeeded after 0.0 seconds starting phase `make-autoloads' INFO Scraping files for moldable-emacs-autoloads.el... INFO Scraping files for moldable-emacs-autoloads.el...done phase `make-autoloads' succeeded after 0.0 seconds starting phase `enable-autoloads-compilation' phase `enable-autoloads-compilation' succeeded after 0.0 seconds starting phase `patch-el-files' phase `patch-el-files' succeeded after 0.0 seconds starting phase `build' Checking /gnu/store/46r4pm57qrppz5jb90l5nid8c575y117-emacs-moldable-emacs-0.0.0-1.0737b3a/share/emacs/site-lisp/moldable-emacs-0.0.0-1.0737b3a/... Compiling /gnu/store/46r4pm57qrppz5jb90l5nid8c575y117-emacs-moldable-emacs-0.0.0-1.0737b3a/share/emacs/site-lisp/moldable-emacs-0.0.0-1.0737b3a/moldable-emacs-autoloads.el... Compiling /gnu/store/46r4pm57qrppz5jb90l5nid8c575y117-emacs-moldable-emacs-0.0.0-1.0737b3a/share/emacs/site-lisp/moldable-emacs-0.0.0-1.0737b3a/moldable-emacs.el... In toplevel form: moldable-emacs.el:5:1:Warning: defcustom for ‘me/files-with-molds’ fails to specify type moldable-emacs.el:5:1:Warning: defcustom for ‘me/files-with-molds’ fails to specify containing group moldable-emacs.el:5:1:Warning: defcustom for ‘me/files-with-molds’ fails to specify type moldable-emacs.el:5:1:Warning: defcustom for ‘me/files-with-molds’ fails to specify containing group moldable-emacs.el:15:1:Warning: defcustom for ‘me/molds-debug-on’ fails to specify type moldable-emacs.el:15:1:Warning: defcustom for ‘me/molds-debug-on’ fails to specify containing group moldable-emacs.el:15:1:Warning: defcustom for ‘me/molds-debug-on’ fails to specify type moldable-emacs.el:15:1:Warning: defcustom for ‘me/molds-debug-on’ fails to specify containing group In me/insert-string-table: moldable-emacs.el:116:15:Warning: assignment to free variable ‘org-confirm-elisp-link-function’ In me/alist-to-plist: moldable-emacs.el:122:27:Warning: ‘(_ (ignore-errors (= (length (car alist)) (length (-filter #'stringp (car alist))))))’ is a malformed function moldable-emacs.el:126:25:Warning: reference to free variable ‘keys’ In me/first-org-table: moldable-emacs.el:170:28:Warning: reference to free variable ‘org-table-line-regexp’ In me/all-flat-org-tables: moldable-emacs.el:182:38:Warning: reference to free variable ‘org-table-line-regexp’ In me/mold-treesitter-to-parse-tree: moldable-emacs.el:209:46:Warning: reference to free variable ‘tree-sitter-tree’ moldable-emacs.el:223:31:Warning: reference to free variable ‘acc’ moldable-emacs.el:226:21:Warning: assignment to free variable ‘acc’ moldable-emacs.el:227:18:Warning: reference to free variable ‘fn’ In me/setup-self-mold-data: moldable-emacs.el:429:35:Warning: reference to free variable ‘self’ moldable-emacs.el:434:46:Warning: reference to free variable ‘mold-data’ moldable-emacs.el:435:20:Warning: reference to free variable ‘me/last-used-mold’ In me/set-dired-self-for-playground: moldable-emacs.el:442:17:Warning: reference to free variable ‘me/last-used-mold’ moldable-emacs.el:443:25:Warning: reference to free variable ‘mold-data’ moldable-emacs.el:449:49:Warning: ‘mark-whole-buffer’ is for interactive use only. moldable-emacs.el:451:37:Warning: assignment to free variable ‘self’ In me/set-self-mold-data: moldable-emacs.el:459:38:Warning: reference to free variable ‘self’ moldable-emacs.el:461:16:Warning: assignment to free variable ‘mold-data’ In me/mold-demo: moldable-emacs.el:731:22:Warning: ‘(mold mold)’ is a malformed function moldable-emacs.el:734:8:Warning: reference to free variable ‘example’ moldable-emacs.el:759:1:Warning: defcustom for ‘me/enable-history’ fails to specify type moldable-emacs.el:759:1:Warning: defcustom for ‘me/enable-history’ fails to specify containing group moldable-emacs.el:759:1:Warning: defcustom for ‘me/enable-history’ fails to specify type moldable-emacs.el:759:1:Warning: defcustom for ‘me/enable-history’ fails to specify containing group Symbol’s value as variable is void: me/before-register-mold-hook command "/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/bin/emacs" "--quick" "--batch" "--eval=(eval '(progn (setq byte-compile-debug t) (byte-recompile-directory (file-name-as-directory \"/gnu/store/46r4pm57qrppz5jb90l5nid8c575y117-emacs-moldable-emacs-0.0.0-1.0737b3a/share/emacs/site-lisp/moldable-emacs-0.0.0-1.0737b3a\") 0 1)) t)" failed with status 255 builder for `/gnu/store/g7r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv' failed with exit code 1 build of /gnu/store/g7r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv failed View build log at '/var/log/guix/drvs/g7/r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv.bz2'. guix build: error: build of `/gnu/store/g7r2bp615xf2b036wwyqgfi651yfsc2y-emacs-moldable-emacs-0.0.0-1.0737b3a.drv' failed ```

I know this is a very new mode, so I was wondering if there is a stable commit I can use to start? And if you find this helpful, Guix is a very handy tool to guide development, and can be used on any Linux distribution.

ag91 commented 3 years ago

This is wonderful, thanks for the initiative! And I guess this is a good time to learn more about Guix too. Do you use Guix the package manager or the whole distribution? I will look into your error log asap (I guess I shall just become a bit more serious about style issues and testing, so I don't break your derivation).

kat-co commented 3 years ago

I use both the package manager and the distribution. Usually I'm using the package manager on systems where the distribution is performing some kind of critical task for me, like a commercial NAS distribution. Ludovic Courtès just did a wonderful post touching on a few of the things I really appreciate about Guix: reproducibility, and a kind of rationality about the software you use, and how it all fits together.

If you do decide to try Guix to help with development, please let me know. Usually what this looks like is placing a guix.scm at the root of the project, and then replacing the source field with (source (dirname (current-filename))). Then you can do things like guix build -f guix.scm, guix environment -l guix.scm (give me a shell with all the things needed to build this), or even guix pack -f {deb, docker, tarball, squashfs} -e '(list (load "guix.scm") "out")' to generate things you can distribute.

Finally, please don't feel the need to formalize your development process on my behalf. I understand that you are in the exploratory phase, and I wouldn't want you to slow down. Maybe tagging stable commits would be enough. You will never break a working Guix package because of the aforementioned reproducibility guarantee.

Thanks for the consideration!

ag91 commented 3 years ago

@kat-co sorry it took longer than expected because I was playing around with guix. It seems things work from my latest commit. Just wondering if you could help me understand, this is the file that worked for me:

(use-modules (guix packages)
             (guix download)
             (guix build-system gnu)
             (guix licenses)
             (gnu packages emacs)
             (guix build-system emacs)
             (gnu packages emacs-xyz))

(package
 (name "emacs-moldable-emacs")
 (version "0.0.0")
 ;; (source
 ;;  (origin
 ;;   (method git-fetch)
 ;;   (uri (git-reference
 ;;         (url "https://github.com/ag91/moldable-emacs")
 ;;         (commit commit)))
 ;;   (file-name (git-file-name name version))
 ;;   (sha256
 ;;    (base32 "0zlmv7qrjc01y0j3hrrw80r82z1a5l4ki3b8ldnq0qls61x1xwfy"))))
 (source (dirname (current-filename)))
 (inputs
  `(("emacs-dash" ,emacs-dash)
    ("emacs-s" ,emacs-s)
    ("emacs-async" ,emacs-async)))
 (build-system emacs-build-system)
 (home-page "https://github.com/ag91/moldable-emacs")
 (synopsis "Adapting Emacs for moldable development ")
 (description
  "This is an extension of Emacs aiming to enable Moldable
Development. Or better still, aiming to make you a better story teller
when you deal with code.")
 (license gpl3+))

Why didn't you need the use-modules section in your recipe? And what is (define-public emacs-moldable-emacs about? I would be happy to add a Guix recipe to the repo, once I understand which one is the right one :)

kat-co commented 3 years ago

Thank you so much! I've been trying to package your commits every day! I'm so happy I can try moldable-emacs out!

You are correct that you need the use-modules block in order to resolve dependencies. I'm sorry I left that out as in Guix circles, it's usually implied that the correct dependencies will be added. For reference, this is the guile module the package would live in within Gux proper.

Re. define-public: when it's within a Guile module, if it is intended to be referenced from outside, say by the script that lets you install the package, or to add as a dependency to something outside the module, it must be exported from the module. The Guile manual tells us:

Export all bindings which should be in the public interface, either by using define-public or export [...]

Also, when the package definition is not local to your project, and is instead written for Guix, or a Guix channel (as I have done here, it must have a proper source field that tells anything, notably the Guix build daemon, how to go fetch the code for building, and what the hash should be so everyone has confidence that everything is as it should be.

But when you are writing the package to be checked in at the root of your source (i.e. like a Dockerfile, or a Makefile), you want a simple use-module block and (source (dirname (current-filename))). This is because guix environment can take a --load flag:

--load=file -l file Create an environment for the package or list of packages that the code within file evaluates to.

which expects a file that returns (and in Guile, like emacs-lisp, that means is the last form declared) a package, and not a module.

In this scenario, you want the (source (dirname (current-filename))) because you want to just build whatever is already checked out. I use this all the time for local development (and there is upcoming work to make this even better).

I hope this all helps. It would be very nice to have a guix.scm at the root of moldable-emacs (I can review the PR if you like), and if you're interested in contributing to Guix proper, I can help you with that too. You might be interested in running guix lint emacs-moldable-emacs first.

Finally, you may close this issue if you like! Or, we can continue discussing things here. Thank you for the consideration!

kat-co commented 3 years ago

As I'm experimenting with this, I noticed the package definitions we've been discussion would omit the molds/ directory. I've updated my channel's definition to include:

     (arguments
       `(#:include (cons "^molds/" %default-include)))

Also, the inputs should be propagated-inputs, which in Guix vernacular means "dependencies needed at runtime". This means Guix will install these dependencies alongside moldable-emacs when the package is installed.

kat-co commented 3 years ago

Upon executing `(require 'moldable-emacs) I receive:

Debugger entered--Lisp error: (void-function ert-set-test)
  ert-set-test(me-alist-to-plist_convert-alist-to-plist #s(ert-test me-alist-to-plist_convert-alist-to-plist nil #[nil "\306\30\3071\22\0\310\31\311\312!)\313D0\202\33\0\32\314\20\n@\nA)D\33\315\34\316\35\317\216\320\10\13\"\211\24)\2040\0\321\15!\210)\f+\207" [fn-0 signal-hook-function err args-1 value-2 form-description-4 equal (error) ert--should-signal-hook me-alist-to-plist (("A" "b") (1 2) (3 4)) ((:A 1 :b 2) (:A 3 :b 4)) signal ert-form-evaluation-aborted-3 nil #[nil "\305C\306\10\11BD\244\n\307=?\205\22\0\310\nD\244\311\312N\211\33\205!\0\313\314\13\11\"D)\244\24\315\f!\207" [fn-0 args-1 value-2 -explainer- form-description-4 (should (equal (me-alist-to-plist ...) '...)) :form ert-form-evaluation-aborted-3 :value equal ert-explainer :explanation apply ert--signal-should-execution] 6] apply ert-fail] 3] nil :passed nil))
  byte-code("\300\301\302\303\301\304\305\304\306\304&\7\"\207" [ert-set-test me-alist-to-plist_convert-alist-to-plist record ert-test nil #f(compiled-function () #<bytecode 0x1366bdd>) :passed] 10)
  require(moldable-emacs)
  (progn (require 'moldable-emacs))
  eval((progn (require 'moldable-emacs)) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I had not seen or used ert before (very nice to see it exists!). But you might want to consider moving these to somewhere that will not be loaded by end-users, as suggested here. If you'd like to keep them in here:

https://github.com/ag91/moldable-emacs/blob/13d909bbb32cb48a8cdaeb6f698a1d8cc38c257d/moldable-emacs.el#L134-L140

I think you need a (require 'ert) at the top?

ag91 commented 3 years ago

Amazing explanation, thanks! You are correct, sometimes I write tests inline: I will move those in a dedicated file so we don't need that requirement here.

ag91 commented 3 years ago

Done, moved the tests in a dedicated file. Also opened https://github.com/ag91/moldable-emacs/pull/8 for the Guix recipe (although I didn't run the recipe yet myself, I just built it for now)

kat-co commented 3 years ago

Success! And (require 'moldable-emacs) works without errors.

There are still quite a few warnings you may or may not want to take a look at. Things I would consider:

New Build Log ``` starting phase `build' Checking /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/... Compiling /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/moldable-emacs-autoloads.el... Compiling /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/moldable-emacs.el... In toplevel form: moldable-emacs.el:6:1:Warning: defcustom for ‘me-i-know-what-i-am-doing’ fails to specify type moldable-emacs.el:6:1:Warning: defcustom for ‘me-i-know-what-i-am-doing’ fails to specify containing group moldable-emacs.el:6:1:Warning: defcustom for ‘me-i-know-what-i-am-doing’ fails to specify type moldable-emacs.el:6:1:Warning: defcustom for ‘me-i-know-what-i-am-doing’ fails to specify containing group moldable-emacs.el:10:1:Warning: defcustom for ‘me-files-with-molds’ fails to specify type moldable-emacs.el:10:1:Warning: defcustom for ‘me-files-with-molds’ fails to specify containing group moldable-emacs.el:10:1:Warning: defcustom for ‘me-files-with-molds’ fails to specify type moldable-emacs.el:10:1:Warning: defcustom for ‘me-files-with-molds’ fails to specify containing group moldable-emacs.el:20:1:Warning: defcustom for ‘me-molds-debug-on’ fails to specify type moldable-emacs.el:20:1:Warning: defcustom for ‘me-molds-debug-on’ fails to specify containing group moldable-emacs.el:20:1:Warning: defcustom for ‘me-molds-debug-on’ fails to specify type moldable-emacs.el:20:1:Warning: defcustom for ‘me-molds-debug-on’ fails to specify containing group In me-insert-string-table: moldable-emacs.el:121:15:Warning: assignment to free variable ‘org-confirm-elisp-link-function’ In me-alist-to-plist: moldable-emacs.el:127:27:Warning: ‘(_ (ignore-errors (= (length (car alist)) (length (-filter #'stringp (car alist))))))’ is a malformed function moldable-emacs.el:131:25:Warning: reference to free variable ‘keys’ In me-first-org-table: moldable-emacs.el:174:28:Warning: reference to free variable ‘org-table-line-regexp’ In me-all-flat-org-tables: moldable-emacs.el:184:38:Warning: reference to free variable ‘org-table-line-regexp’ In me-mold-treesitter-to-parse-tree: moldable-emacs.el:209:46:Warning: reference to free variable ‘tree-sitter-tree’ moldable-emacs.el:223:31:Warning: reference to free variable ‘acc’ moldable-emacs.el:226:21:Warning: assignment to free variable ‘acc’ moldable-emacs.el:227:18:Warning: reference to free variable ‘fn’ In me-setup-self-mold-data: moldable-emacs.el:415:35:Warning: reference to free variable ‘self’ moldable-emacs.el:420:46:Warning: reference to free variable ‘mold-data’ moldable-emacs.el:421:20:Warning: reference to free variable ‘me-last-used-mold’ In me-set-dired-self-for-playground: moldable-emacs.el:428:17:Warning: reference to free variable ‘me-last-used-mold’ moldable-emacs.el:429:25:Warning: reference to free variable ‘mold-data’ moldable-emacs.el:435:49:Warning: ‘mark-whole-buffer’ is for interactive use only. moldable-emacs.el:437:37:Warning: assignment to free variable ‘self’ In me-set-self-mold-data: moldable-emacs.el:445:38:Warning: reference to free variable ‘self’ moldable-emacs.el:447:16:Warning: assignment to free variable ‘mold-data’ In me-mold-demo: moldable-emacs.el:685:22:Warning: ‘(mold mold)’ is a malformed function moldable-emacs.el:688:8:Warning: reference to free variable ‘example’ moldable-emacs.el:713:1:Warning: defcustom for ‘me-enable-history’ fails to specify type moldable-emacs.el:713:1:Warning: defcustom for ‘me-enable-history’ fails to specify containing group moldable-emacs.el:713:1:Warning: defcustom for ‘me-enable-history’ fails to specify type moldable-emacs.el:713:1:Warning: defcustom for ‘me-enable-history’ fails to specify containing group moldable-emacs.el:1066:1:Warning: defcustom for ‘me-note-file-store’ fails to specify type moldable-emacs.el:1066:1:Warning: defcustom for ‘me-note-file-store’ fails to specify containing group moldable-emacs.el:1066:1:Warning: defcustom for ‘me-note-file-store’ fails to specify type moldable-emacs.el:1066:1:Warning: defcustom for ‘me-note-file-store’ fails to specify containing group In end of data: moldable-emacs.el:1281:1:Warning: the following functions are not known to be defined: some, pp-display-expression, if-let*, keys, org-table-transpose-table-at-point, org-table-to-lisp, orgtbl-to-orgtbl, org-table-end, tsc-root-node, tsc-mapc-children, tsc-node-type, tsc-node-text, tsc-node-start-position, tsc-node-end-position, tree-sitter-mode, dired-get-marked-files, dired-mark, dired-unmark-all-files, if-let, example, concatenate, org-before-first-heading-p, org-on-heading-p, org-previous-visible-heading, org-agenda-get-some-entry-text, org-ql-query, incf, string-blank-p, projectile-project-root, projectile-current-project-files, seqp, copy-list, xah-hash-to-list Checking /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/molds... Compiling /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/molds/contrib.el... In toplevel form: molds/contrib.el:11:1:Warning: ‘(report (ignore-errors (me-find-relative-test-report (buffer-file-name))))’ is a malformed function molds/contrib.el:15:2:Warning: ‘:fn’ called as a function molds/contrib.el:17:15:Warning: reference to free variable ‘report’ molds/contrib.el:18:2:Warning: ‘:fn’ called as a function molds/contrib.el:24:51:Warning: reference to free variable ‘buffername’ molds/contrib.el:48:30:Warning: assignment to free variable ‘self’ molds/contrib.el:54:26:Warning: reference to free variable ‘target/test-reports’ molds/contrib.el:55:43:Warning: reference to free variable ‘1\.4\.2’ molds/contrib.el:59:2:Warning: ‘:fn’ called as a function molds/contrib.el:62:2:Warning: ‘:fn’ called as a function molds/contrib.el:80:2:Warning: ‘:fn’ called as a function molds/contrib.el:82:2:Warning: ‘:fn’ called as a function molds/contrib.el:169:1:Warning: ‘(tree (me-mold-treesitter-to-parse-tree))’ is a malformed function molds/contrib.el:172:2:Warning: ‘:fn’ called as a function molds/contrib.el:175:63:Warning: reference to free variable ‘tree’ molds/contrib.el:176:2:Warning: ‘:fn’ called as a function In me-dot-string-to-picture: molds/contrib.el:240:34:Warning: ‘(dot (executable-find "/gnu/store/2bx8y8h090wwmmv245zpxa0dmvw6r3cj-python-graph-cli-0.1.17/bin/graph"))’ is a malformed function molds/contrib.el:245:86:Warning: reference to free variable ‘dotfilename’ molds/contrib.el:245:73:Warning: reference to free variable ‘dot’ molds/contrib.el:247:89:Warning: reference to free variable ‘filename’ molds/contrib.el:258:1:Warning: ‘(tables (me-all-flat-org-tables))’ is a malformed function molds/contrib.el:261:2:Warning: ‘:fn’ called as a function molds/contrib.el:263:27:Warning: reference to free variable ‘tables’ molds/contrib.el:268:2:Warning: ‘:fn’ called as a function molds/contrib.el:281:2:Warning: ‘:fn’ called as a function molds/contrib.el:285:2:Warning: ‘:fn’ called as a function molds/contrib.el:296:1:Warning: ‘(file-name (buffer-file-name))’ is a malformed function molds/contrib.el:296:1:Warning: ‘(_ (shell-command-to-string (format "imgclip -p '%s' --lang eng" (or file-name (let ((path (concat "/tmp/" buf-name))) (write-region (point-min) (point-max) path) path)))))’ is a malformed function molds/contrib.el:296:1:Warning: ‘(:name "Initial Loading" :given (:type file :name "/tmp/my.jpg" :mode image-mode :contents "/home-andrea/.emacs.d/lisp/moldable-emacs/resources/my.jpg") :then (:type buffer :name "Text from my.jpg" :mode fundamental-mode :contents "Loading text from image..."))’ is a malformed function molds/contrib.el:320:20:Warning: ‘:fn’ called as a function molds/contrib.el:322:20:Warning: ‘:async’ called as a function molds/contrib.el:318:12:Warning: reference to free variable ‘self’ molds/contrib.el:325:1:Warning: ‘(bufferfile (buffer-file-name))’ is a malformed function molds/contrib.el:328:2:Warning: ‘:fn’ called as a function molds/contrib.el:346:53:Warning: reference to free variable ‘bufferfile’ molds/contrib.el:333:2:Warning: ‘:fn’ called as a function molds/contrib.el:352:1:Warning: ‘(old-file (plist-get mold-data :old-file))’ is a malformed function molds/contrib.el:355:2:Warning: ‘:fn’ called as a function molds/contrib.el:360:11:Warning: reference to free variable ‘old-file’ molds/contrib.el:361:2:Warning: ‘:fn’ called as a function molds/contrib.el:370:1:Warning: ‘(matching-test (ignore-errors (projectile-find-matching-test (buffer-file-name))))’ is a malformed function molds/contrib.el:374:2:Warning: ‘:fn’ called as a function molds/contrib.el:381:51:Warning: reference to free variable ‘matching-test’ molds/contrib.el:379:2:Warning: ‘:fn’ called as a function molds/contrib.el:413:25:Warning: assignment to free variable ‘org-confirm-elisp-link-function’ molds/contrib.el:418:1:Warning: ‘(edn (or (when (region-active-p) (ignore-errors (parseedn-read-str (buffer-substring-no-properties (caar (region-bounds)) (cdar (region-bounds)))))) (ignore-errors (parseedn-read))))’ is a malformed function molds/contrib.el:424:2:Warning: ‘:fn’ called as a function molds/contrib.el:426:15:Warning: reference to free variable ‘edn’ molds/contrib.el:427:2:Warning: ‘:fn’ called as a function In end of data: molds/contrib.el:436:1:Warning: the following functions are not known to be defined: me-color-string, me-register-mold, :fn, me-require, esxml-query-all, me-insert-org-table, me-register-mold-by-key, me-mold-compose, me-by-type, c/calculate-complexity-stats, string-join, if-let*, dotfilename, filename, _, output, buf-name, :async, c/get-coupled-files-alist, c/show-todo-buffer, projectile-project-root, me-mold-treesitter-file, me-hash-to-plist, me-print-to-buffer Compiling /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/molds/core.el... In toplevel form: molds/core.el:1:1:Warning: ‘(:name "Empty file" :given (:type file :name "/tmp/test.txt" :mode text-mode :contents "") :then (:type buffer :name "Playground" :mode emacs-lisp-mode :contents ";; Tips: ;; Use `self' to access the mold context. ;; You can access the previous mold context through `mold-data'. "))’ is a malformed function molds/core.el:28:14:Warning: ‘:fn’ called as a function molds/core.el:29:14:Warning: ‘:fn’ called as a function molds/core.el:13:32:Warning: reference to free variable ‘buffername’ molds/core.el:19:25:Warning: assignment to free variable ‘self’ molds/core.el:21:23:Warning: reference to free variable ‘identity’ molds/core.el:35:1:Warning: ‘(:given (:type file :name "/tmp/example" :mode fundamental-mode :contents "") :then (:type buffer :name "Query" :mode emacs-lisp-mode :contents "\"Just evaluating a string: anything you evaluate in this mold appears here\""))’ is a malformed function molds/core.el:51:14:Warning: ‘:fn’ called as a function molds/core.el:51:91:Warning: ‘:fn’ called as a function molds/core.el:55:2:Warning: ‘:fn’ called as a function molds/core.el:56:2:Warning: ‘:fn’ called as a function molds/core.el:117:1:Warning: ‘(:name "JSON to code flattened tree" :given (:type file :name "/tmp/test.json" :mode json-mode :contents "{ \"a\": 1, \"b\": [1,2] } ") :then (:type buffer :name "CodeAsTree" :mode emacs-lisp-mode :contents "((:type object :text \"{ \\\"a\\\": 1, \\\"b\\\": [1,2] }\" :begin 1 :end 27 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"{\" :text \"{\" :begin 1 :end 2 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type pair :text \"\\\"a\\\": 1\" :begin 5 :end 11 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type string :text \"\\\"a\\\"\" :begin 5 :end 8 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 5 :end 6 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type string_content :text \"a\" :begin 6 :end 7 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 7 :end 8 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \":\" :text \":\" :begin 8 :end 9 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type number :text \"1\" :begin 10 :end 11 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \",\" :text \",\" :begin 11 :end 12 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type pair :text \"\\\"b\\\": [1,2]\" :begin 15 :end 25 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type string :text \"\\\"b\\\"\" :begin 15 :end 18 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 15 :end 16 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type string_content :text \"b\" :begin 16 :end 17 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 17 :end 18 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \":\" :text \":\" :begin 18 :end 19 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type array :text \"[1,2]\" :begin 20 :end 25 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"[\" :text \"[\" :begin 20 :end 21 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type number :text \"1\" :begin 21 :end 22 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \",\" :text \",\" :begin 22 :end 23 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type number :text \"2\" :begin 23 :end 24 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"]\" :text \"]\" :begin 24 :end 25 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"}\" :text \"}\" :begin 26 :end 27 :buffer \"test.json\" :buffer-file \"/tmp/test.json\")) "))’ is a malformed function molds/core.el:133:14:Warning: ‘:fn’ called as a function molds/core.el:135:14:Warning: ‘:fn’ called as a function molds/core.el:139:1:Warning: ‘(:name "Pointer just after \"a\": " :given (:type file :name "/tmp/test.json" :mode json-mode :contents "{ \"a\": 1, \"b\": [1,2] } ") :then (:type buffer :name "m/tree" :mode emacs-lisp-mode :contents "((:type string :text \"\\\"a\\\"\" :begin 5 :end 8 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 5 :end 6 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type string_content :text \"a\" :begin 6 :end 7 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \"\\\"\" :text \"\\\"\" :begin 7 :end 8 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type \":\" :text \":\" :begin 8 :end 9 :buffer \"test.json\" :buffer-file \"/tmp/test.json\") (:type number :text \"1\" :begin 10 :end 11 :buffer \"test.json\" :buffer-file \"/tmp/test.json\")) "))’ is a malformed function molds/core.el:155:14:Warning: ‘:fn’ called as a function molds/core.el:157:14:Warning: ‘:fn’ called as a function molds/core.el:161:1:Warning: ‘(l (list-at-point))’ is a malformed function molds/core.el:161:1:Warning: ‘(:name "Alist to Org table" :given (:type file :name "/tmp/my.el" :mode emacs-lisp-mode :contents "((\"Index\" \"Value\") (1 3) (2 9) (3 27))") :then (:type buffer :name "Org Table for list starting for (:Index 1 :Value 3)" :mode org-mode :contents "| Index | Value | |-------+-------| | 1 | 3 | | 2 | 9 | | 3 | 27 | | | | "))’ is a malformed function molds/core.el:188:14:Warning: ‘:fn’ called as a function molds/core.el:177:54:Warning: reference to free variable ‘l’ molds/core.el:190:14:Warning: ‘:fn’ called as a function molds/core.el:186:2:Warning: ‘:name’ called as a function molds/core.el:200:14:Warning: ‘:type’ called as a function molds/core.el:201:21:Warning: reference to free variable ‘file’ molds/core.el:201:51:Warning: reference to free variable ‘emacs-lisp-mode’ molds/core.el:202:14:Warning: ‘:type’ called as a function molds/core.el:203:21:Warning: reference to free variable ‘buffer’ molds/core.el:203:94:Warning: reference to free variable ‘org-mode’ molds/core.el:203:94:Warning: ‘:name’ called as a function molds/core.el:203:94:Warning: ‘:type’ called as a function molds/core.el:203:94:Warning: ‘:type’ called as a function molds/core.el:206:1:Warning: ‘(:given (:type buffer :name "OrgTableToCSV" :mode csv-mode :contents "a,b,c 1,2,3 2,3,4") :then (:type buffer :name "CSVtoPlist" :mode emacs-lisp-mode :contents "((:a \"2\" :b \"3\" :c \"4\") (:a \"1\" :b \"2\" :c \"3\")) "))’ is a malformed function molds/core.el:235:14:Warning: ‘:fn’ called as a function molds/core.el:237:14:Warning: ‘:fn’ called as a function molds/core.el:228:34:Warning: ‘next-line’ is for interactive use only; use ‘forward-line’ instead. molds/core.el:240:1:Warning: ‘(list (me-first-org-table))’ is a malformed function molds/core.el:240:1:Warning: ‘(:name "Org table to plist" :given (:type file :name "/tmp/my.org" :mode org-mode :contents "| bla | some | |-------+------| | \"bla\" | 1 | | \"blo\" | 2 | ") :then (:type buffer :name "Org Table for list starting for (:bla \"bla\" :some 1)" :mode emacs-lisp-mode :contents "((:bla \"\\\"bla\\\"\" :some \"1\") (:bla \"\\\"blo\\\"\" :some \"2\")) "))’ is a malformed function molds/core.el:255:14:Warning: ‘:fn’ called as a function molds/core.el:245:15:Warning: reference to free variable ‘list’ molds/core.el:257:14:Warning: ‘:fn’ called as a function molds/core.el:263:2:Warning: ‘:fn’ called as a function molds/core.el:266:2:Warning: ‘:fn’ called as a function molds/core.el:267:2:Warning: ‘:fn’ called as a function molds/core.el:279:2:Warning: ‘:fn’ called as a function molds/core.el:282:2:Warning: ‘:fn’ called as a function molds/core.el:290:1:Warning: ‘(:given (:type buffer :name "SentencesAsTree" :mode emacs-lisp-mode :contents "((\"Some sentence\") (\"Some other sentence\") (\"Some more\")) "))’ is a malformed function molds/core.el:304:14:Warning: ‘:fn’ called as a function molds/core.el:293:2:Warning: ‘:fn’ called as a function molds/core.el:311:2:Warning: ‘:fn’ called as a function molds/core.el:312:2:Warning: ‘:fn’ called as a function molds/core.el:318:23:Warning: assignment to free variable ‘sexp’ molds/core.el:318:23:Warning: reference to free variable ‘sexp’ molds/core.el:326:1:Warning: ‘(:given (:type buffer :name "CodeAsTree" :mode emacs-lisp-mode :contents "((:type declaration :text \"include a;\" :begin 1 :end 11 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type type_identifier :text \"include\" :begin 1 :end 8 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type identifier :text \"a\" :begin 9 :end 10 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type \";\" :text \";\" :begin 10 :end 11 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type declaration :text \"include b;\" :begin 12 :end 22 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type type_identifier :text \"include\" :begin 12 :end 19 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type identifier :text \"b\" :begin 20 :end 21 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\") (:type \";\" :text \";\" :begin 21 :end 22 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\")) ") :then (:type buffer :name "TreeOfDuplicates" :mode emacs-lisp-mode :contents "((:type type_identifier :text \"include\" :begin 12 :end 19 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\")) "))’ is a malformed function molds/core.el:342:14:Warning: ‘:fn’ called as a function molds/core.el:350:4:Warning: ‘:fn’ called as a function molds/core.el:353:1:Warning: ‘(:name "Simple addition" :given (:type file :name "/home-andrea/someElispBuffer" :mode emacs-lisp-mode :contents "(+ 1 2)") :then (:type buffer :name "m/tree-eval-from" :mode emacs-lisp-mode :contents "3"))’ is a malformed function molds/core.el:373:14:Warning: ‘:fn’ called as a function molds/core.el:378:14:Warning: ‘:fn’ called as a function molds/core.el:398:1:Warning: ‘(:given (:type buffer :name "TreeOfDuplicates" :mode emacs-lisp-mode :contents "((:type type_identifier :text \"include\" :begin 12 :end 19 :buffer \"my.cc\" :buffer-file \"/tmp/my.cc\")) ") :then (:type buffer :name "TreeToOrgTodos" :mode org-mode :contents "* Todo list [/] - [ ] [[elisp:(progn (find-file-other-window \"/tmp/my.cc\") (goto-char 12))][include]]"))’ is a malformed function molds/core.el:426:14:Warning: ‘:fn’ called as a function molds/core.el:427:4:Warning: ‘:fn’ called as a function molds/core.el:423:25:Warning: assignment to free variable ‘org-confirm-elisp-link-function’ molds/core.el:430:1:Warning: ‘(:name "Basic stats" :given (:type file :name "/tmp/test.txt" :mode text-mode :contents "This is a little test file. Test! ") :then (:type buffer :name "Statistics" :mode org-mode :contents "* Generic Stats - Reading time: 0 minutes - Page has 1 line (0 + 1) - Buffer has 1 line, 7 words, and 34 characters. - Average book pages for this text: 0 - Buffer size in KiloBytes: 158 - Up to three most and least used words: 1 | file 1 | little 1 | test 1 | test 1 | test! 1 | this "))’ is a malformed function molds/core.el:502:14:Warning: ‘:fn’ called as a function molds/core.el:504:14:Warning: ‘:fn’ called as a function molds/core.el:490:46:Warning: reference to free variable ‘type’ molds/core.el:510:2:Warning: ‘:fn’ called as a function molds/core.el:511:2:Warning: ‘:fn’ called as a function molds/core.el:526:2:Warning: ‘:fn’ called as a function molds/core.el:527:2:Warning: ‘:fn’ called as a function molds/core.el:540:1:Warning: ‘(plist (thing-at-point 'sexp t))’ is a malformed function molds/core.el:543:2:Warning: ‘:fn’ called as a function molds/core.el:545:15:Warning: reference to free variable ‘plist’ molds/core.el:549:2:Warning: ‘:fn’ called as a function molds/core.el:560:1:Warning: ‘(table (me-first-org-table))’ is a malformed function molds/core.el:560:1:Warning: ‘(:name "Sample table" :given (:type file :name "/tmp/test.org" :mode org-mode :contents "* Some Heading | a | b | |---+---| | 1 | 2 | | 2 | 3 | ") :then (:type buffer :name "m/first-org-table" :mode org-mode :contents "| a | b | |---+---| | 1 | 2 | | 2 | 3 |"))’ is a malformed function molds/core.el:575:14:Warning: ‘:fn’ called as a function molds/core.el:565:10:Warning: reference to free variable ‘table’ molds/core.el:587:14:Warning: ‘:fn’ called as a function molds/core.el:597:1:Warning: ‘(:name "Simple table to CSV" :given (:type buffer :name "m/first-org-table2021-07-04-18:20:55" :mode org-mode :contents "| bla | some | |-------+------| | \"bla\" | 1 | | \"blo\" | 2 | ") :then (:type buffer :name "m/csv-from-org-table2021-07-04-18:33:27" :mode csv-mode :contents "bla,some \"\"\"bla\"\"\",1 \"\"\"blo\"\"\",2"))’ is a malformed function molds/core.el:616:14:Warning: ‘:fn’ called as a function molds/core.el:618:14:Warning: ‘:fn’ called as a function molds/core.el:640:2:Warning: ‘:fn’ called as a function molds/core.el:641:2:Warning: ‘:fn’ called as a function molds/core.el:645:14:Warning: ‘mark-whole-buffer’ is for interactive use only. molds/core.el:653:1:Warning: ‘(hash\? (shell-command-to-string "git rev-parse --short HEAD"))’ is a malformed function molds/core.el:661:20:Warning: ‘:fn’ called as a function molds/core.el:675:20:Warning: ‘:fn’ called as a function molds/core.el:672:86:Warning: reference to free variable ‘hash\?’ molds/core.el:673:43:Warning: reference to free variable ‘hash’ molds/core.el:698:1:Warning: ‘(notes (me-filter-notes-by-buffer (buffer-name)))’ is a malformed function molds/core.el:701:2:Warning: ‘:fn’ called as a function molds/core.el:706:31:Warning: reference to free variable ‘notes’ molds/core.el:702:2:Warning: ‘:fn’ called as a function molds/core.el:709:1:Warning: ‘(notes (me-filter-notes-by-project))’ is a malformed function molds/core.el:712:2:Warning: ‘:fn’ called as a function molds/core.el:713:2:Warning: ‘:fn’ called as a function molds/core.el:721:1:Warning: ‘(notes (me-filter-notes-by-mode major-mode))’ is a malformed function molds/core.el:724:2:Warning: ‘:fn’ called as a function molds/core.el:725:2:Warning: ‘:fn’ called as a function molds/core.el:732:1:Warning: ‘(notes (or (ignore-errors self) (me-load-notes)))’ is a malformed function molds/core.el:735:2:Warning: ‘:fn’ called as a function molds/core.el:757:54:Warning: ‘:fn’ called as a function molds/core.el:763:2:Warning: ‘:fn’ called as a function molds/core.el:781:50:Warning: ‘:fn’ called as a function molds/core.el:781:45:Warning: reference to free variable ‘self’ molds/core.el:785:1:Warning: ‘(notes (me-load-notes))’ is a malformed function molds/core.el:788:2:Warning: ‘:fn’ called as a function molds/core.el:789:2:Warning: ‘:fn’ called as a function molds/core.el:815:1:Warning: ‘(node (thing-at-point 'sexp))’ is a malformed function molds/core.el:815:1:Warning: ‘(:name "Simple list" :given (:type file :name "/tmp/test.el" :mode emacs-lisp-mode :contents "(list 1 2 3)") :then (:type buffer :name "Node at point" :mode emacs-lisp-mode :contents "(list 1 2 3) "))’ is a malformed function molds/core.el:836:14:Warning: ‘:fn’ called as a function molds/core.el:820:15:Warning: reference to free variable ‘node’ molds/core.el:838:14:Warning: ‘:fn’ called as a function molds/core.el:831:25:Warning: assignment to free variable ‘self-pos’ molds/core.el:841:1:Warning: ‘(expression (me-arithmetic-at-point))’ is a malformed function molds/core.el:841:1:Warning: ‘(:name "Simple arithmetic expression" :given (:type file :name "/tmp/my.txt" :mode text-mode :contents "bla bla 1 + 1 / 2 bla bla ") :then (:type buffer :name "Evaluate 1 + 1 / 2" :mode fundamental-mode :contents "1 + 1 / 2 = 1.5"))’ is a malformed function molds/core.el:847:28:Warning: ‘:fn’ called as a function molds/core.el:846:35:Warning: reference to free variable ‘expression’ molds/core.el:858:14:Warning: ‘:fn’ called as a function molds/core.el:864:2:Warning: ‘:fn’ called as a function molds/core.el:866:25:Warning: reference to free variable ‘me-mold-history’ molds/core.el:864:35:Warning: reference to free variable ‘me-current-history-index’ molds/core.el:865:2:Warning: ‘:fn’ called as a function molds/core.el:896:2:Warning: ‘:fn’ called as a function molds/core.el:896:19:Warning: reference to free variable ‘me-molds-debug-on’ molds/core.el:896:37:Warning: reference to free variable ‘me-usable-mold-stats’ molds/core.el:897:2:Warning: ‘:fn’ called as a function molds/core.el:910:2:Warning: ‘:fn’ called as a function molds/core.el:910:19:Warning: reference to free variable ‘me-i-know-what-i-am-doing’ molds/core.el:911:2:Warning: ‘:fn’ called as a function In end of data: molds/core.el:928:1:Warning: the following functions are not known to be defined: me-register-mold, :fn, me-mold-treesitter-to-parse-tree, me-org-to-flatten-tree, me-by-type, me-print-to-buffer, me-usable-molds, me-find-missing-dependencies-for-molds, me-usable-molds-requiring-deps, me-insert-org-table, me-require, seq-contains-p, tree-sitter-node-at-point, me-alist-to-plist, me-insert-flat-org-table, :name, :type, me-buffer-changed-while-the-mold-is-on-p, libxml-parse-html-region, nodes-with-duplication, thing-at-point-bounds-of-list-at-point, me-get-book-pages, me-get-reading-time, me-word-stats, me-insert-treesitter-follow-overlay, json-read, json-plist-p, json-mode, json-encode-plist, json-encode-array, json-pretty-print-buffer, org-table-to-lisp, csv-mode, orgtbl-to-csv, org-next-link, ag/org-replace-link-by-link-description, me-register-mold-by-key, me-mold-compose, org-table-create-or-convert-from-region, me-org-tabletolisp-to-plist, when-let*, hash, me-ask-for-details-according-to-context, me-override-keybiding-in-buffer, me-note-to-org-heading, me-color-string, outline-hide-sublevels Checking /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/tutorials... Done (Total of 4 files compiled in 2 directories) phase `build' succeeded after 0.2 seconds starting phase `validate-compiled-autoloads' Loading /gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d/share/emacs/site-lisp/moldable-emacs-0.0.0-1.822965d/moldable-emacs-autoloads.elc... phase `validate-compiled-autoloads' succeeded after 0.0 seconds starting phase `move-doc' phase `move-doc' succeeded after 0.0 seconds starting phase `patch-shebangs' phase `patch-shebangs' succeeded after 0.0 seconds starting phase `strip' phase `strip' succeeded after 0.0 seconds starting phase `validate-runpath' phase `validate-runpath' succeeded after 0.0 seconds starting phase `validate-documentation-location' phase `validate-documentation-location' succeeded after 0.0 seconds starting phase `delete-info-dir-file' phase `delete-info-dir-file' succeeded after 0.0 seconds starting phase `patch-dot-desktop-files' phase `patch-dot-desktop-files' succeeded after 0.0 seconds starting phase `install-license-files' installing 1 license files from '.' phase `install-license-files' succeeded after 0.0 seconds starting phase `reset-gzip-timestamps' phase `reset-gzip-timestamps' succeeded after 0.0 seconds starting phase `compress-documentation' phase `compress-documentation' succeeded after 0.0 seconds successfully built /gnu/store/rwps0awcbnzsdva3f79lmar2g6r7rl71-emacs-moldable-emacs-0.0.0-1.822965d.drvsuccessfully built /gnu/store/rwps0awcbnzsdva3f79lmar2g6r7rl71-emacs-moldable-emacs-0.0.0-1.822965d.drv/gnu/store/q61nh5h563m5i2j2vzgjddlh0bdcdwvi-emacs-moldable-emacs-0.0.0-1.822965d ```
ag91 commented 3 years ago

Yeah thanks, I have to schedule a refactoring session in which I make the code look proper. I would keep using me-require in the molds preconditions (probably even for always available dependencies), because I can generate detailed documentation. Also you never know I could make a mold that generates a (artistic) dependency graph at some point!