Coder Social home page Coder Social logo

Comments (11)

blithefeng avatar blithefeng commented on July 18, 2024 2

@seagle0128 @HouzuoGuo In doom-emacs modules/ui/modeline/config.el, there is a advice

(defadvice! +modeline-disable-icon-in-daemon-a (fn &rest args)
    :around #'doom-modeline-propertize-icon
    (when (display-graphic-p)
      (apply fn args)))

I disable this and It works! This advice results doom-modeline-propertize-icon returns nil in terminal.

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 18, 2024 1

@HouzuoGuo Are you using doom-emacs? Can you please reproduce with emacs -Q? I couldn't reproduce on macOS and Linux.

from doom-modeline.

blithefeng avatar blithefeng commented on July 18, 2024 1

@seagle0128
我写了简单的init.el

;; -*- lexical-binding: t -*-

(require 'package)
(setq package-archives '(("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
                         ("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")))

(setq package-enable-at-startup nil)
(package-initialize)

(package-refresh-contents)

(unless (package-installed-p 'compat)
  (package-install 'compat))

(unless (package-installed-p 'nerd-icons)
  (package-install 'nerd-icons))

(unless (package-installed-p 'doom-modeline)
  (package-install 'doom-modeline))

(require 'doom-modeline)
(doom-modeline-mode 1)

然后终端启动是有图标的
image

from doom-modeline.

blithefeng avatar blithefeng commented on July 18, 2024

@seagle0128 你好,你的这个commit修复并不能解决问题。我这里clone了库测试了下,导致问题的根因在调用doom-modeline-propertize-icon这个函数时,不过我实在是没有找到原因。我在这个函数里面加了message,但是并没有执行到
看起来在调用 (doom-modeline-propertize-icon icon face) 的时候问题就已经出现了。我修改为(if icon icon "")就能正常在终端下展示图标了

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 18, 2024

这样不能修复问题吗?

(if icon
     (doom-modeline-propertize-icon icon face)
   "")

from doom-modeline.

blithefeng avatar blithefeng commented on July 18, 2024

这样不能修复问题,最新的commit也不能修复问题。其实我这里看起来不是icon为nil的问题,而是在调用(doom-modeline-propertize-icon icon face)的时候,不知道中间发生了什么,导致还没进到这个函数里面去执行就已经出错了。我也不知道是不是doom那边的一些advice或者hook的问题。不过我改成直接使用时居然能正常work,但是其他地方还在使用这个函数

(if icon
            (when-let ((props (get-text-property 0 'face icon)))
              (when (listp props)
                (cl-destructuring-bind (&key family height inherit :allow-other-keys) props
                  (propertize icon 'face `(:inherit (doom-modeline ,(or face inherit props))
                                           :family ,(or family "")
                                           :height ,(or height 1.0))))))
          "")))

from doom-modeline.

blithefeng avatar blithefeng commented on July 18, 2024
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
   propertize(nil help-echo "LSP Connected [gopls:1888/starting]\nC-mouse-1: Swi..." mouse-face doom-modeline-highlight local-map (keymap (mode-line keymap (mouse-3 . lsp-workspace-restart) (mouse-2 . lsp-works$
   doom-modeline-update-lsp()
   run-hooks(lsp-before-initialize-hook)
   lsp--start-workspace(#s(lsp-session :folders ("~/Workspace/playground/gotest") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1ff5caa2e07d> :folder->servers #<hash-table $
   lsp--start-connection(#s(lsp-session :folders ("~/Workspace/playground/gotest") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1ff5caa2e07d> :folder->servers #<hash-table$
   #f(compiled-function (client) #<bytecode 0x1ae5a3ddf7144946>)(#s(lsp--client :language-id "go" :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<by$
   mapcar(#f(compiled-function (client) #<bytecode 0x1ae5a3ddf7144946>) (#s(lsp--client :language-id "go" :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspa$
   -map(#f(compiled-function (client) #<bytecode 0x1ae5a3ddf7144946>) (#s(lsp--client :language-id "go" :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace$
   lsp--ensure-lsp-servers(#s(lsp-session :folders ("~/Workspace/playground/gotest") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1ff5caa2e07d> :folder->servers #<hash-tab$
   lsp--try-project-root-workspaces(nil nil)
   lsp()
   lsp--init-if-visible()
   #f(compiled-function () #<bytecode 0x73f1a6b086c831>)()
   apply(#f(compiled-function () #<bytecode 0x73f1a6b086c831>) nil)
   timer-event-handler([t 0 0 0 nil #f(compiled-function () #<bytecode 0x73f1a6b086c831>) nil idle 0 nil])

这个不知道对你有没有帮助

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 18, 2024

@blithefeng 能用 emacs -Q 重现下吗?如果是doom内部改了什么就不好定位了。你提供的backtrace就是icon为nil(虽然我认为这是不可能的),所以我加了一层保护。如果这样还是这个错误就奇怪了。

from doom-modeline.

HouzuoGuo avatar HouzuoGuo commented on July 18, 2024

I'm still experiencing this issue after doom-modeline to 259ff6a

Error during redisplay: (eval (doom-modeline-segment--modals)) signaled (wrong-type-argument stringp nil) [42 times]
Projectile project root has been force-set to "/google/src/cloud/howardguo/uni-filter/google3/production/automation/autodash/" in workspace "uni-filter"
Error during redisplay: (eval (doom-modeline-segment--modals)) signaled (wrong-type-argument stringp nil) [5 times]
run-hooks: Wrong type argument: stringp, nilError during redisplay: (eval (doom-modeline-segment--modals)) signaled (wrong-type-argument stringp nil)
Error during redisplay: (eval (doom-modeline-segment--modals)) signaled (wrong-type-argument stringp nil) [26 times]

BTW, my emacs runs in a terminal instead of a graphical window, in case that helps.

See https://pastebin.com/6rUJSTCQ for the system information, there are also more details in doomemacs/doomemacs#7367

from doom-modeline.

HouzuoGuo avatar HouzuoGuo commented on July 18, 2024

@blithefeng many thanks!

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 18, 2024

如果非要加advice,其实更应该override doom-modeline-icon-displayable-p,或者直接不安装nerd-icons。但是nerd-icons既然支持terminal,为什么不用呢? 😄 给doom提issue吧

from doom-modeline.

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.