Giter Club home page Giter Club logo

Comments (8)

josteink avatar josteink commented on July 17, 2024

First of all: This is Emacs using Git master, right?

Second: I'm not sure this can be fixed while maintaining full compatibility with all supported versions of Emacs.

So... Are these just warnings, or are they causing actual errors too?

from typescript.el.

twmr avatar twmr commented on July 17, 2024

First of all: This is Emacs using Git master, right?

Yes, this is a bleeding edge emacs ;)

I created this issue, because there may be performance problems in the case of large files that would be fixed by replacing the font-lock-fontify-buffer by the one suggested in the output above. See twmr/python-cell.el#8

I think the warnings above are also output on a released version of emacs, but I haven't checked it.

from typescript.el.

josteink avatar josteink commented on July 17, 2024

Feel free to try out the proposed changes in the PR. If it breaks compatibility, I'm sure the CI will let us know :)

from typescript.el.

lddubeau avatar lddubeau commented on July 17, 2024

font-lock-fontify-buffer is already avoided on versions of Emacs that provide font-lock-ensure, as the code surrounding the warning's location show:

  "A custom predicate to help `flyspell-prog-mode' determine whether a word should be checked."
  ;; We depend on fontification for our results. font-lock-ensure is defined on
  ;; Emacs 25 and over. Earlier versions use font-lock-fontify-buffer.
  (if (fboundp 'font-lock-ensure)
      (font-lock-ensure)
    (font-lock-fontify-buffer))

(@josteink I guess we should for typescript-mode do the same thing you argued for tide and have an analogue of tide--emacs-at-least here.)

I don't know how the warnings are triggered. If the warning is issued only if font-lock-fontify-buffer is compiled, then it may be avoidable by using conditional compilation. This might be preferable as the choice about which branch to take would be done just once during compilation. Otherwise, with-no-warnings could be used.


syntax-begin-function is something typescript-mode inherited "lock, stock, and barrel" from js-mode. AFAICT, it just became obsolete from 25.1 onwards and was not replaced with anything. I've not been able to track the whole story about it, but it's been discussed here, and the change to js-mode was made here. It was not replaced with anything else there.

I suspect something changed in Emacs' internals that made it so that whatever information it was providing is provided through other means, and this is why it is not replaced with anything. But for us, the issue is as with font-lock-fontify-buffer. We support old versions that assumed that this variable was present and properly set, so we cannot just remove it from the code base.

from typescript.el.

josteink avatar josteink commented on July 17, 2024

font-lock-fontify-buffer is already avoided on versions of Emacs that provide font-lock-ensure, as the code surrounding the warning's location show

Yeah. This was the reason why I asked about actual problems and not just compiler warnings.

I guess we should for typescript-mode do the same thing you argued for tide and have an analogue of tide--emacs-at-least here.

That's a good suggestion, although in this case it is fairly well documented what we're doing and why.

I don't know how the warnings are triggered. If the warning is issued only if font-lock-fontify-buffer is compiled, then it may be avoidable by using conditional compilation.

I haven't looked too deeply into this either, but that sounds plausible.

This might be preferable as the choice about which branch to take would be done just once during compilation.

On the other hand, my experience trying to uncover what was actually run in csharp-mode (which IMO relied too heavily on compile-time constructs) makes me somewhat hesitant to recommend this route.

Maybe if we can put it in a corner, where it is equally well documented as this is?

Otherwise, with-no-warnings could be used.

I think that is a bit drastic. Warnings often show us things which we should do something about, and I'm pretty sure we've made improvements based on warnings in the past.

from typescript.el.

lddubeau avatar lddubeau commented on July 17, 2024

@josteink I meant to reply earlier, but forgot. The one thing that I feel I need to reply to is:

I think that is a bit drastic. Warnings often show us things which we should do something about, and I'm pretty sure we've made improvements based on warnings in the past.

Hmm... are we on the same page here? with-no-warnings can be scoped to the one line that causes the warnings so:

(with-no-warnings
  (setq-local syntax-begin-function #'typescript--syntax-begin-function)))

I suppose a line that is wrapped like this could someday generate additional warnings that it may be good to know about but I'd expect the risk to be fairly small.

This being said, I'm fine with not doing anything to prevent the warnings.

from typescript.el.

josteink avatar josteink commented on July 17, 2024

Hmm... are we on the same page here?

Probably not. I was replying from my phone (quite busy handling babies these days 😃 ), and assumed you meant a global compile-flag passed to the general build process.

with-no-warnings can be scoped to the one line that causes the warnings

Right. In that case I agree, and have no issues with it what so ever.

from typescript.el.

josteink avatar josteink commented on July 17, 2024

Old issue id old. Typescript is now supported in core emacs. Closing this issue.

from typescript.el.

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.