Git Product home page Git Product logo

Comments (45)

exu avatar exu commented on May 23, 2024 1

I've added to load-path

Engine forcing didn't help too.

Shortcuts are working great, only syntax highlighting isn't enabled when I loads the file.
After editing file syntax colors are visible on part of the screen that above the cursor like on screenshot.

2013-01-14--1358172303_590x360_scrot

from web-mode.

kawabata avatar kawabata commented on May 23, 2024 1

I'm also facing the same issue.
It seems 'font-lock-mode' is reversed.
When 'font-lock-mode' is enabled, then no syntax hiliting.
When 'font-lock-mode' is disabled, then syntax hiliting begins.

As of it, M-x font-lock-mode solves temporalily in my case.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

Hi,
we'll try to solve your problem.
First, have you added web-mode.el in your load-path ?
Then, What is the file extension of your file ?

I've added a note about web-mode-engines-alist on http://web-mode.org
Perhaps you should add in your .emacs

(setq web-mode-engines-alist
'(("\\.html\\.twig\\'" . "twig"))
)

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

What is the file extension of our template ?
Do you have rainbow-mode enabled ? (if yes, can you try to turn it off)
Have you any errors appearing in your "* Messages *" buffer ?
Could you send me your template file ?

from web-mode.

exu avatar exu commented on May 23, 2024
  1. html.twig (but html files havwe the same problems)
  2. i have installed but it is only on for elisp files (for those files i
    have prelude yasnippets projectile modes enabled)
  3. No errors in * Messages *
  4. Template: It's not related to template i have the same behaviour in plain
    HTML file with added C-c C-i html5 template from web-mode snippets
<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <meta charset="utf-8" />
  </head>
  <body>

  </body>
</html>

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

Could you try to load emacs with a slimmed down version of your .emacs (with just the lines needed by web-mode) ?

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

+1 I have similar problem. Prelude loads php-mode early on in https://github.com/bbatsov/prelude/blob/master/core/prelude-packages.el#L90

("\\.php\\'" php-mode php-mode)

Also, in Prelude, this code above loaded before any customizations kept in personal directory are loaded. (I guess @exu is using a similar method.) Can this be an issue? I was having the same issue (no syntax highlighting) and then suddenly web-mode stopped loading altogether. Here is the full web-mode config that I use:

(require 'web-mode)
;; (add-to-list 'auto-mode-alist '("\\.php$" . php-mode)) ;; - Unnecessary because Prelude does it
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode)) ;; - For Drupal
(add-to-list 'auto-mode-alist '("\\.\\(module\\|test\\|install\\|theme\\)$" . php-mode)) ;; - For Drupal
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("/\\(views\\|html\\|templates\\)/.*\\.php\\'" . web-mode))

;; Customizations
(setq web-mode-markup-indent-offset 4)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 4)
(setq web-mode-disable-autocompletion t)
(local-set-key (kbd "RET") 'newline-and-indent)

from web-mode.

exu avatar exu commented on May 23, 2024

WIth web-mode only it's ok.

But with plain emacs prelude installed it isn't working anymore. Symptoms are the same as I have written above.

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@exu any idea what configuration in prelude is clashing with web-mode?

from web-mode.

exu avatar exu commented on May 23, 2024

@kaustavdm It's hard to debug, i have some of it's functionalities disabled / set but webmode doesn't work in both customized and plain prelude, so it is some problem with core prelude functionalites. I wrote email to @bbatsov so maybe he can put some light on this problem.

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@exu Thanks. I was considering raising a support issue in prelude.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@exu @kaustavdm I do not use prelude.
Please check that rainbow-mode is not loaded.
Moreover do not hesitate to post the solution if you find one ... I'll update http://web-mode.org

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@fxbois Oops. Shoot me! Prelude does load rainbow-mode and it had completely skipped my mind :-(

https://github.com/bbatsov/prelude/blob/master/core/prelude-packages.el#L49

So I guess this is a "won't fix" unless either web-mode or prelude uses something different

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@kaustavdm I ll try to see if I can disable rainbow-mode inside web-mode (if you have a solution do not hesitate to share)

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@fxbois Thanks. That will be nice. I'll see if I can help. But I'm just a learner of Emacs Lisp

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024

Prelude enables rainbow-mode only in css-mode and emacs-lisp-mode. I doubt it's active in web-mode.

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@bbatsov In my case, I'm not able to get web-mode to take over .tpl.php or other files using config at https://gist.github.com/4532700. This is after a fresh reinstall of prelude an hour back.

P.S. I know I'm double posting, but can't help since these are two different repos.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@exu @kaustavdm does my last commit solve the issue ?

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@fxbois I'm afraid it doesn't. I did another fresh install of prelude and now using the config you have provided, web-mode triggers properly, but it doesn't give syntax highlighting. Also, as @bbatsov has mentioned above, rainbow-mode is not enabled in web-mode.

from web-mode.

exu avatar exu commented on May 23, 2024

@fxbois no changes

from web-mode.

exu avatar exu commented on May 23, 2024

Ok I've located what is causing the problem, it dissapears when i disable whitespace-mode
It's NOT prelude related error it appears on plain emacs installation too.

Steps to reproduce on clean installation:

M-x whitespace-mode

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

I ve pushed a commit that disables whitespace-mode
Does it work ?

from web-mode.

exu avatar exu commented on May 23, 2024

No it doesn't. I have whitespace-mode enabled (i've checked out on clean prelude install with webmode only)

from web-mode.

exu avatar exu commented on May 23, 2024

Ok i've disabled whitespace mode in prelude (as in README) but it didn't help - it helps only when I do this manually by M-x whitespace-mode.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@bbatsov could you tell me how can I disable whitespace-mode ?

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024

@exu Are you sure. It works just file for me, but you have to take into account the fact the setting will not have effect on currently opened buffer (only on newly created).

@fxbois What you're doing is not working, since the hooks (like prog-mode-hook) are being run after your checks. Btw wouldn't it be better of web-mode was made compatible with whitespace-mode. AFAIK it's one of the most popular minor modes around and a lot of people use it.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@bbatsov yes it would be great like being compatible with rainbow-mode (which is another mode that is not compatible with web-mode). Alas my mode doesn't work like most other modes. I mix two technics : font-locking (for code blocks ie. a php block) and direct setting of face attribute (for strings, comments, and html elements/attributes). It is required because I have to deal this kind of case : a html part embeds a javascript that contains a string that contains a php block that contains a string. I can not do this if I rely only on font-locking.
Meanwhile, are you in touch with the whitespace-mode developer ? I would be happy to see what is possible

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024

@fxbois whitespace-mode is a core Emacs package and it's maintained by the Emacs dev team. I guess the best way to get in touch with them would be on the Emacs dev mailing list.

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024

@fxbois Btw, you might inherit from fundamental-mode instead of prog-mode for the time being and that would avoid many problems like this, since people generally tend to add common minor modes to their prog-mode hooks.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@bbatsov inheriting from prog-mode was asked by the core-team this summer.
But do you know a way to disable those minor modes inside web-mode ? (it could be a short term solution)

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024

You can add the code to disable them to the web-mode-hook by default. It's being ran after prog-mode's hook anyways so that should do the trick.

Cheers,
Bozhidar

On Tuesday, January 15, 2013 at 12:04 PM, fxbois wrote:

@bbatsov (https://github.com/bbatsov) inheriting from prog-mode was asked by the code-team this summer.
But do you know a way to disable those minor modes inside web-mode ? (it could be a short term solution)


Reply to this email directly or view it on GitHub (#18 (comment)).

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@bbatsov could you give an example ? what code would you write to disable whitespace-mode ?

from web-mode.

bbatsov avatar bbatsov commented on May 23, 2024
(add-hook 'web-mode-hook 'whitespace-turn-off)

or

(add-hook 'web-mode-hook (lambda () (whitespace-mode -1))

Cheers,
Bozhidar

On Tuesday, January 15, 2013 at 12:09 PM, fxbois wrote:

@bbatsov (https://github.com/bbatsov) could you give an example ? what code would you write to disable whitespace-mode ?


Reply to this email directly or view it on GitHub (#18 (comment)).

from web-mode.

exu avatar exu commented on May 23, 2024

I've put (add-hook 'web-mode-hook 'whitespace-turn-off) (i've done it with whitespace-mode -1 version before) into my init file, but this didn't resolve my problem.
Disabling whitespace-mode works only in plain emacs installation.

When prelude is enabled with whitespace hook I have the same results.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@exu what do you call "plain emacs installation" ... is it running emacs with a strimmed down init.el ?

from web-mode.

exu avatar exu commented on May 23, 2024

@fxbois Yes i have web-mode only in init file (as you pointed out above)

from web-mode.

exu avatar exu commented on May 23, 2024

Ok, I've rewritten my emacs configs without prelude and everything works great (all dependencies without prelude). So I think that it's somethig with prelude default settings which can't be reverted (maybe some emacs bug).

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@exu thank you for the report. I ll close this issue. I hope to be able to solve the issue with whitespace-mode

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

@fxbois I finally got web-mode working with Prelude with @bbatsov's suggestion above.

@exu You said that you had added (add-hook 'web-mode-hook (lambda () (whitespace-mode -1))) to the beginning of init.el. Did you do that while using prelude? i.e. had you edited prelude's init.el and added the code at the beginning? Can you try this method:

The way I did it:

Can you test this method with Prelude? It works for me 😄

emacs Prelude - -source-cb_website-application-views-portfolio_view php_004

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@kaustavdm is there anything to change in web-mode.el ?

from web-mode.

kaustavdm avatar kaustavdm commented on May 23, 2024

No. I added my comment just as an info that disabling whitespace mode in prelude has to be done in a particular way. Also, best if web-mode.el can be made compatible with whitespace mode. I miss whitespace mode while in web mode, but that should be another feature request ☕

from web-mode.

anildigital avatar anildigital commented on May 23, 2024

I am facing the same issue

--- WEB-MODE DEBUG BEG ---
versions: emacs(24.3) web-mode("7.0.60")
vars: engine("none") content-type("html") file("/Users/anil/Code/javascript/gameoflife/index.html")
system: window(ns) config("x86_64-apple-darwin13.0.2")
colors: fg(nil) bg(nil) 
modes: whitespace-mode(nil) rainbow-mode(nil) idle-highlight-mode(nil) fic-mode(nil)
(transient-mark-mode line-number-mode auto-compression-mode auto-encryption-mode auto-composition-mode blink-cursor-mode font-lock-mode global-font-lock-mode file-name-shadow-mode mouse-wheel-mode tooltip-mode show-paren-mode ido-everywhere diff-auto-refine-mode emmet-mode textmate-mode hi-lock-mode)
--- WEB-MODE DEBUG END ---

Syntax highlighting doesn't work.. unless I press M-x web-mode.

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@kawabata Hi I ve rewriter the highlighting code ... could you try the beta version available on
http://web-mode.org/beta/web-mode.el ?

from web-mode.

kawabata avatar kawabata commented on May 23, 2024

It seems to solve the problem. Indeed, HTML files are fontified from the
beginning.
However, instead, it seems that
global-font-lock-mode is turned off, resulting other non-web-mode buffers
to lose the fontification...

2014-01-27 fxbois [email protected]

@kawabata https://github.com/kawabata Hi I ve rewriter the highlighting
code ... could you try the beta version available on
http://web-mode.org/beta/web-mode.el ?

�$B!=�(B
Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-33412572
.


�$B@nH(�(B �$BB@0l�(B (KAWABATA, Taichi) E-mail: [email protected]

from web-mode.

fxbois avatar fxbois commented on May 23, 2024

@kawabata I ve just opened a java file in a window that add a web-mode.el buffer and this issue did not raise
I think it is an issue with your .emacs

from web-mode.

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.