Giter VIP home page Giter VIP logo

Comments (11)

fxbois avatar fxbois commented on June 14, 2024 3

should be fixed with last commit ... sorry to have disturbed your studious Christmas Holidays !

from web-mode.

takueof avatar takueof commented on June 14, 2024 1

@fxbois
Hi. I'm using web-mode df57cd0 (from MELPA) but work fine.

However, I confirmed that I get the same error occur that @uskebasi reported after update to 9586a44 (latest master commit) from MELPA.

I think it's better to revert the master branch to df57cd0, what do you think?

(Thanks: @uskebasi ๐Ÿ‘)

from web-mode.

debiru avatar debiru commented on June 14, 2024 1

I am currently installing Emacs (GNU Emacs 27.1) on Ubuntu 22.04. I too have encountered this problem.

Could you tell me how to trigger the bug ?

$ cat ~/.emacs.d/init.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(setq package-list '(web-mode))

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))

The trigger is to open any html file after install web-mode (20231223.1924) by melpa package. Then can't open the file and Emacs says Args out of range: "", 0 in footer field.

I investigated this in the environment at hand, but on Ubuntu 20.04 (GNU Emacs 26.3) and macOS X (GNU Emacs 28.1), I was able to open the file in web-mode without error after following the same procedure. Perhaps the reproducibility may vary depending on the OS.

from web-mode.

debiru avatar debiru commented on June 14, 2024 1

Note: Workaround for those encountering the same problem.

Use stable.melpa.org instead of melpa.org.

(setq package-archives '(("melpa-stable" . "https://stable.melpa.org/packages/")))
(package-initialize)
  1. delete current package. M-x package-delete web-mode
  2. install as stable package. M-x package-install web-mode

You can install web-mode-17.3.13 instead of web-mode-20231223.1924.

from web-mode.

fxbois avatar fxbois commented on June 14, 2024 1

thank you @takueof , I'll work on this today

from web-mode.

takueof avatar takueof commented on June 14, 2024 1

@fxbois
I'm installed web-mode 20231225.1458 via MELPA, and verified that the problem was fixed!
Thank you for your quick fix even during the holiday season ๐Ÿ™

Happy holidays (and hacking)! ๐ŸŽ„

from web-mode.

fxbois avatar fxbois commented on June 14, 2024

could you send me the template ?

from web-mode.

uskebasi avatar uskebasi commented on June 14, 2024

This is my init.el portion
(use-package web-mode
:ensure t
:config
(with-eval-after-load "lsp"
(assq-delete-all 'web-mode lsp-language-id-configuration)
(add-to-list 'lsp-language-id-configuration '(web-mode . "php")))
(setq web-mode-extra-snippets
'(("erb" . (("toto" . "<% toto | %>\n\n<% end %>")))
("php" . (("dowhile" . "\n\n")
("debug" . "")))
))

  (add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
  (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 '("\\.[agj]sp\\'" . 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 '("\\.mustache\\'" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
  (add-hook 'web-mode-hook #'lsp)
  )

(add-hook 'web-mode-hook #'(lambda ()
                             (enable-minor-mode
                              '("\\.jsx?\\'" . prettier-js-mode))))

(eval-after-load 'web-mode
  '(progn
     (add-hook 'web-mode-hook #'add-node-modules-path)
     ))

(defun my-web-mode-hook ()
  (add-hook 'before-save-hook #'web-mode-buffer-indent))

(add-hook 'web-mode-hook 'my-web-mode-hook)

     ;; When called this automatically detects the submode at the current location.
     ;; It will then either forward to end of tag(HTML) or end of code block(JS/CSS).
     ;; This will be passed to hs-minor-mode to properly navigate and fold the code.

(defun mhtml-forward (arg)
  (interactive "P")
  (pcase (get-text-property (point) 'mhtml-submode)
    ('nil (sgml-skip-tag-forward 1))
    (submode (forward-sexp))))

     ;; Adds the tag and curly-brace detection to hs-minor-mode for mhtml.

(add-to-list 'hs-special-modes-alist
             '(mhtml-mode
               "{\\|<[^/>]+?"
               "}\\|</[^/>]*[^/]>"
               "<!--"
               mhtml-forward
               nil))

This is one of my project files: same behavior with any aother of them

Sorgenti Sigillate

2

						<hr class="dark horizontal my-0">
						<div class="card-footer p-3">
							<p class="mb-0"><span class="text-success text-sm font-weight-bolder">1 </span>Presso altri</p>
						</div>
					</div>
				</div>
				<div class="col-lg-5 col-sm-5 mt-sm-0 mt-4">
					<div class="card  mb-2">
						<div class="card-header p-3 pt-2">
							<div class="icon icon-lg icon-shape bg-gradient-primary shadow-primary shadow text-center border-radius-xl mt-n4 position-absolute">
								<i class='fas fa-atom' style='font-size:48px;color:white'></i>
							</div>
							<div class="text-end pt-1">
								<p class="text-sm mb-0 text-capitalize">Attivitร </p>
								<h4 class="mb-0">2,300</h4>
							</div>
						</div>

						<hr class="dark horizontal my-0">
						<div class="card-footer p-3">
							<p class="mb-0"><span class="text-success text-sm font-weight-bolder"> X </span>XXX</p>
						</div>
					</div>

				</div>

				<div class="col-lg-5 col-sm-5 mt-sm-0 mt-4">
					<div class="card  mb-2">
						<div class="card-header p-3 pt-2 bg-transparent">
							<div class="icon icon-lg icon-shape bg-gradient-success shadow-success text-center  border-radius-xl mt-n4 position-absolute ">
								<i class='fas fa-satellite-dish ' style='font-size:48px;color:red'></i>
							</div>
							<div class="text-end pt-1">
								<p class="text-sm mb-0 text-capitalize ">Macchine Radiogene</p>
								<h4 class="mb-0 ">3</h4>
							</div>
						</div>

						<hr class="horizontal my-0 dark">
						<div class="card-footer p-3">
							<p class="mb-0 "><span class="text-success text-sm font-weight-bolder"> X</span>XXX</p>
						</div>
					</div>
				</div>
				<div class="col-lg-5 col-sm-5 mt-sm-0 mt-4">
					<div class="card ">
						<div class="card-header p-3 pt-2 bg-transparent">
							<div class="icon icon-lg icon-shape bg-gradient-info shadow-info text-center border-radius-xl mt-n4 position-absolute">
								<i class="material-icons opacity-10">person_add</i>
							</div>
							<div class="text-end pt-1">
								<p class="text-sm mb-0 text-capitalize ">Utenti Registrati</p>
								<h4 class="mb-0 ">9</h4>
							</div>
						</div>

						<hr class="horizontal my-0 dark">
						<div class="card-footer p-3">
							<p class="mb-0 ">Aggiornati</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

from web-mode.

fxbois avatar fxbois commented on June 14, 2024

Could you tell me how to trigger the bug ?

from web-mode.

takueof avatar takueof commented on June 14, 2024

@debiru
Good job, Thanks! ๐Ÿ‘

from web-mode.

takueof avatar takueof commented on June 14, 2024

@fxbois
I also wrote a minimal configuration init.el:

;;; init.el --- "GNU Emacs" main config file to composition for debug -*- lexical-binding: t; -*-

;;; Commentary:

;; This GNU Emacs config file is minimum composition for debug.

;;; Code:

(setq debug-on-error t)

(require 'package)
(add-to-list 'package-archives '("MELPA" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)

;; `web-mode'
(package-install 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))

;; Local Variables:
;; coding: utf-8-unix
;; mode: Emacs-Lisp
;; no-byte-compile: t
;; End:

;;; init.el ends here

The startup command is:

emacs -nw --init-directory=~/.emacs.d.minimum

Below is my GNU Emacs environment (Please let me know if you would like additional information):

  • GNU Emacs 29.1 (Stable)
  • macOS 13.6.3 (Ventura)
  • Bash 5.2.21

Below is a test HTML file:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Test</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
    <p>Paragraph</p>
  </body>
</html>

Finally, here is the stack trace when opening the HTML file mentioned above:

Debugger entered--Lisp error: (args-out-of-range "" 0)
  web-mode-scan-elements(1 181)
  web-mode-scan-region(1 181)
  web-mode-invalidate-region(1 181)
  web-mode-scan(1 181)
  web-mode-extend-region()
  font-lock-default-fontify-region(1 181 nil)
  font-lock-fontify-region(1 181 nil)
  font-lock-default-fontify-buffer()
  font-lock-fontify-buffer()
  font-lock-initial-fontify()
  font-lock-mode()
  turn-on-font-lock()
  turn-on-font-lock-if-desired()
  global-font-lock-mode-enable-in-buffers()
  run-hooks(after-change-major-mode-hook)
  run-mode-hooks(web-mode-hook)
  web-mode()
  set-auto-mode-0(web-mode nil)
  set-auto-mode--apply-alist((("\\.html\\'" . web-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.\\(?:3fr\\|arw\\|bmp\\|cr[2w]\\|d\\(?:cr\\|ds\\|ng\\)\\|ex..." . image-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-mode) ("\\.re?st\\'" . rst-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode) ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode) ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode) ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . image-mode) ("\\.png\\'" . image-mode) ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode) ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" . tex-mode) ("\\.ltx\\'" . latex-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer index.html> "~/.emacs.d.minimum/index.html" nil nil "~/.emacs.d.minimum/index.html" (167475415 16777220))
  find-file-noselect("~/.emacs.d.minimum/index.html" nil nil t)
  find-file("~/.emacs.d.minimum/index.html" t)
  funcall-interactively(find-file "~/.emacs.d.minimum/index.html" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)

I would be happy if you could use it as a reference ๐Ÿ™

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.