Coder Social home page Coder Social logo

Comments (5)

czipperz avatar czipperz commented on July 22, 2024

Example code:

(add-hook 'markdown-mode-hook #'poly-markdown-mode)

from poly-markdown.

vspinu avatar vspinu commented on July 22, 2024

It's not needed in all markdown files. The canonical way is to extend the markdown mode and assoc into auto-mode alist.

https://github.com/polymode/poly-R/blob/master/poly-R.el#L92

You can add hook locally if you want but that will mess child modes and also modes which use markdown as host or (especially) innermode.

from poly-markdown.

czipperz avatar czipperz commented on July 22, 2024

Really we shouldn't be adding the hook at all, instead let the user enable it manually. That's what I've seen

from poly-markdown.

czipperz avatar czipperz commented on July 22, 2024

The canonical way is to extend the markdown mode and assoc into auto-mode alist.

That's definitely not something I've seen. magit-filenotify recommends add-hook. racer uses the same. The wiki recommends add-hook for paredit.

Where did you get this idea?

from poly-markdown.

vspinu avatar vspinu commented on July 22, 2024

That's definitely not something I've seen

You haven't seen enough. Those functionality enhancers designed as to be used in hooks. Polymodes are proper emacs modes. Emacs modes are installed in auto-mode alist. End of story.

If a polymode is intended to be used as a minor-mode then yes, it should be placed in a hook, but poly-markdown is generally not.

The technical reason that I have given above is a very severe one. If I load it in markdown hook then child modes like poly-markdown+r-mode will trigger poly-markdown-mode, if markdown-mode is used as a innermode it will trigger the poly-markdown-mode etc.

from poly-markdown.

Related Issues (17)

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.