Coder Social home page Coder Social logo

Troubles auto-loading about ox-slimhtml HOT 9 CLOSED

balddotcat avatar balddotcat commented on July 27, 2024
Troubles auto-loading

from ox-slimhtml.

Comments (9)

balddotcat avatar balddotcat commented on July 27, 2024

I think you're looking for (require 'ox-slimhtml); the first argument to load is a path, as a string - in the above, does the variable ox-slimhtml refer to the path of the file itself?

The require statement should be preceded with call to (and (require 'package) (package-initialize)) in your init file, or otherwise - this sets up the package environment.

When installing with M-x package-install, Emacs usually takes care of updating custom.el for you, and updates load-path - which, if you're still having problems, is what I would check next.

Personally, I use M-x load-library to load a packages into the current environment, as required.

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

Yeah, sorry, that was just a typo. I meant(require 'ox-slimhtml).

If I install the package manually and add (require 'ox-slimhtml) to my init-file (all the way after all other packages are installed and after (package-initialize)), it doesn't load on startup. If I then go and execute (load 'ox-slimhtml) manually, it works.

If I use use-package like so

(use-package ox-slimhtml
  :ensure t)

then it works in the session right after the installation, but doesn't load on startup either.

I wonder if this is something to do with my config, but other packages load and work as expected...

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

I should clarify: by "doesn't load" I mean the backend is not loaded (?) If I try (org-export-to-buffer 'slimhtml "*slimhtml*"), I get the error:

Unknown "nil" back-end: Aborting export

So, 'slimhtml is not defined, and if I do this:

(org-export-define-derived-backend 'custom-html-exporter
        'slimhtml                             ;; org's default exporter is 'html
      :translate-alist
      '((bold . ox-slimhtml-bold)             ;; technically, this is already set
        (special-block . org-html-special-block)))

I get this:

Debugger entered--Lisp error: (error "Cannot use unknown \"slimhtml\" back-end as a parent")
  signal(error ("Cannot use unknown \"slimhtml\" back-end as a parent"))
  error("Cannot use unknown \"%s\" back-end as a parent" slimhtml)
  org-export-register-backend(#s(org-export-backend :name custom-html-exporter :parent slimhtml :transcoders ((bold . ox-slimhtml-bold) (special-block . org-html-special-block)) :options nil :filters nil :blocks nil :menu nil))
  org-export-define-derived-backend(custom-html-exporter slimhtml :translate-alist ((bold . ox-slimhtml-bold) (special-block . org-html-special-block)))
  eval((org-export-define-derived-backend 'custom-html-exporter 'slimhtml :translate-alist '((bold . ox-slimhtml-bold) (special-block . org-html-special-block))) nil)
  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)

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

Oh, wait, I completely messed up the order of org-export-define-derived-backend, my bad.
Let me try to figure this out, the problem is with my load process I think

from ox-slimhtml.

balddotcat avatar balddotcat commented on July 27, 2024

I think the problem is a missing autoload declaration - hopefully this is as simple as adding one line above the org-export backend definition, but I'll have to test it.

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

I managed to fix this by moving the loading of ox-slimhtml after the custom-file loading (I store it in a separate file). So, I guess, steps to reproduce this bug are potentially as follows:

  1. Install ox-slimhtml
  2. In the config, load ox-slimhtml first
  3. Then load the custom file ((load custom-file 'noerror))

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

Geez, how dumb am I... It's totally my problem — I generate custom org backends list in my customize file. So, sorry about all this.

from ox-slimhtml.

balddotcat avatar balddotcat commented on July 27, 2024

I usually run my publishing projects through a separate Emacs daemon, or in batch mode - with a simple require - so thanks for pointing out this use-case scenario!

Verified, locally, that running (require 'ox-slimhtml) in a fresh environment loads the slimhtml exporter definition; one can see the presence of the menu option in Export Dispatcher, as an example.

from ox-slimhtml.

freetonik avatar freetonik commented on July 27, 2024

Yeah, my problem was that I had re-defined the list of backends in my customize file, and that file is loaded last:

'(org-export-backends (quote (ascii html latex md hugo)))

from ox-slimhtml.

Related Issues (6)

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.