Code Monkey home page Code Monkey logo

Comments (2)

rktjmp avatar rktjmp commented on June 21, 2024

@monkoose, not sure if you are still using hotpot, do you have a particularly large amount of complex macros?

Looking at this line, we have to clear the in-memory versions of macros each time we build and can be expensive to code-gen.

;; Issue https://github.com/rktjmp/hotpot.nvim/issues/117
;; Macro modules are retained in memory, so even if they're edited,
;; we compile with the older version and output incorrect code.
;; For now (?) we will force all macros to be reloaded each time make is
;; called to ensure they're reloaded.
(case package.loaded
{:hotpot.fennel fennel} (each [k _ (pairs fennel.macro-loaded)]
(tset fennel.macro-loaded k nil)))

from hotpot.nvim.

monkoose avatar monkoose commented on June 21, 2024

I do use it, but I have converted it to use .hotpot.lua only and compile on demand, and compile into /lua directory and not use any cache files. It requires some workaround in init.lua, but after that it works like a charm, doesn't preload hotpot on neovim startup and compiles when any fennel file in my config was changed.

And maybe it was some macro issue, because previously I have used vim.api functions in some of my macros and with such option to make it work like that

    compiler = {
        macros = {
            env = "_COMPILER",
            compilerEnv = _G,
            allowedGlobals = false,
        },
    },

But after I have realized that this is wrong approach and it messes up with other fennel compilers (from aniseed or fennel-ls) I have fixed it, but I have already switched to using hotpot only on demand, so can't be sure that it was the issue.

My init.lua looks like this (there is workaround to make neovim work on first startup, when there are missing compiled files)

vim.loader.enable()

local plugins_path = vim.fn.stdpath("data") .. "/lazy"
local config_path = vim.fn.stdpath("config")

-- Bootstrap lazy.nvim
local lazy_path = plugins_path .. "/lazy.nvim"
if not vim.loop.fs_stat(lazy_path) then
  vim.notify("Fetching lazy.nvim...", vim.log.levels.INFO)
  vim.fn.system({
    "git",
    "clone",
    "--depth=1",
    "--filter=blob:none",
    "--single-branch",
    -- "--branch=stable", -- latest stable release
    "https://github.com/folke/lazy.nvim.git",
    lazy_path,
  })
end

vim.opt.runtimepath:prepend(lazy_path)

local ok, plugins = pcall(require, "plugins.lazy")
if not ok then
  vim.print(plugins)
  plugins = {
    {
      "rktjmp/hotpot.nvim",
      dependencies = "monkoose/parsley",
      config = function() require("hotpot.api.make").auto.build(config_path) end,
    },
  }
end

require("lazy").setup({
  performance = {
    rtp = {
      disabled_plugins = {
        "gzip",
        "tarPlugin",
        "zipPlugin",
        "matchparen",
        "tutor",
        "matchit",
        "tohtml",
        "rplugin",
      },
    },
  },
  ui = { border = {'', '', '', '', '', '',  '', ''} },
  spec = plugins,
})

require("conf.options")
require("statusline")
require("conf.autocmds")
require("conf.maps")

.hotpot.lua

return {
    compiler = {
        macros = {
            env = "_COMPILER",
            compilerEnv = _G,
        },
    },
    build = {
        {atomic = true},
        {"fnl/**/*macros.fnl", false},
        {"fnl/**/*.fnl", true},
        {"colors/*.fnl", true},
        {"after/**/*.fnl", true},
    },
    clean = {
      {"lua/**/*.lua", true}
    }
}

from hotpot.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.