rougier / nano-emacs

GNU Emacs / N Λ N O - Emacs made simple
GNU General Public License v3.0
2.52k stars 194 forks source link

Modeline error in html files with web-mode #89

Closed vllur closed 3 years ago

vllur commented 3 years ago

With web-mode, modeline disappears in HTML files buffers and this shows in the Messages buffer:

Error during redisplay: (eval (cond ((nano-modeline-prog-mode-p) (nano-modeline-default-mode)) ((nano-modeline-message-mode-p) (nano-modeline-message-mode)) ((nano-modeline-elfeed-search-mode-p) (nano-modeline-elfeed-search-mode)) ((nano-modeline-elfeed-show-mode-p) (nano-modeline-elfeed-show-mode)) ((nano-modeline-deft-mode-p) (nano-modeline-deft-mode)) ((nano-modeline-info-mode-p) (nano-modeline-info-mode)) ((nano-modeline-calendar-mode-p) (nano-modeline-calendar-mode)) ((nano-modeline-org-capture-mode-p) (nano-modeline-org-capture-mode)) ((nano-modeline-org-agenda-mode-p) (nano-modeline-org-agenda-mode)) ((nano-modeline-org-clock-mode-p) (nano-modeline-org-clock-mode)) ((nano-modeline-term-mode-p) (nano-modeline-term-mode)) ((nano-modeline-vterm-mode-p) (nano-modeline-term-mode)) ((nano-modeline-mu4e-dashboard-mode-p) (nano-modeline-mu4e-dashboard-mode)) ((nano-modeline-mu4e-main-mode-p) (nano-modeline-mu4e-main-mode)) ((nano-modeline-mu4e-headers-mode-p) (nano-modeline-mu4e-headers-mode)) ((nano-modeline-text-mode-p) (nano-modeline-default-mode)) ((nano-modeline-pdf-view-mode-p) (nano-modeline-pdf-view-mode)) ((nano-modeline-docview-mode-p) (nano-modeline-docview-mode)) ((nano-modeline-completion-list-mode-p) (nano-modeline-completion-list-mode)) ((nano-modeline-nano-help-mode-p) (nano-modeline-nano-help-mode)) (t (nano-modeline-default-mode)))) signaled (wrong-type-argument characterp sgml-xml-mode) 

HTML syntax highlighting is also broken, but CSS files works fine. I'm not sure why this happens.

rougier commented 3 years ago

Could you try this nano-modeline and reports if the error is the same?

vllur commented 3 years ago

I have made little sample config that uses only straight.el, web-mode and nano-modeline and the error is exactly the same.

(defvar bootstrap-version)
(let ((bootstrap-file
    (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
    (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
      (url-retrieve-synchronously
        "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
        'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t)

(straight-use-package 'web-mode)
(straight-use-package '(nano-modeline :type git :host github
                                   :repo "rougier/nano-modeline"))
(require 'nano-modeline)
(nano-modeline)
rougier commented 3 years ago

Sorry for the delay. Could you try to edit the nano-modeline.el file to remove every mode at the end (from line 625 to line 645 and check if this still fails. If so, can you try to just not call nano-modeline (just to check the problem comess from the modeline)?

vllur commented 3 years ago

Seems like line 625 and default is the problem. It calls (nano-modeline-default-mode), which uses nano-mode-name to compose the string. mode-name in this case is (sgml-xml-mode "XHTML+" "HTML+"), so the first element is sgml-xml-mode. As I understand it's a boolean, so it's either t or nil, never char/string.

rougier commented 3 years ago

I see. I think we should replace the mode-name code with something like (format-mode-line mode-name). Could you test and make a PR if this works ?

vllur commented 3 years ago

It works, I made a pull request in nano-modeline repo, so I will close the issue.