seagle0128 / doom-modeline

A fancy and fast mode-line inspired by minimalism design.
https://seagle0128.github.io/doom-modeline/
GNU General Public License v3.0
1.27k stars 157 forks source link

[Bug] `string-pixel-width` defined shadowing (emacs 29) builtin #651

Closed emil-vdw closed 1 year ago

emil-vdw commented 1 year ago

Thank you for the bug report

Bug description

8276548 defines string-pixel-width if not defined (<29) returning a value of type float. Other packages (dashboard for example) optionally uses this new function expecting an int.

I don't know whether this should be a bug report for dashboard but it does seem wrong to shadow an upcoming builtin?

From dashboard-widgets.el:

(defun dashboard-string-pixel-width (str)
  "Return the width of STR in pixels."
  (if (fboundp #'string-pixel-width)
      (string-pixel-width str)
    (require 'shr)
    (shr-string-pixel-width str)))

Steps to reproduce

Expected behavior

Both packages deal with optionally defined string-pixel-width.

OS

Linux

Emacs Version

28

Emacs Configurations

No response

Error callstack

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p 1010.1)
  dashboard-str-len(#("It is not right to vex ourselves at things, For th..." 0 74 (face dashboard-banner-logo-title)))
  dashboard-center-text(326 400)
  dashboard-insert-center(#("It is not right to vex ourselves at things, For th..." 0 74 (face dashboard-banner-logo-title)))
  dashboard-insert-banner()
  dashboard-insert-startupify-lists()
  dashboard-open()
  funcall-interactively(dashboard-open)
  command-execute(dashboard-open record)
  counsel-M-x-action("dashboard-open")
  #f(compiled-function (x) #<bytecode -0x1e2d8cae803746c0>)("dashboard-open")
  ivy-call()
  #<subr ivy-read>("M-x " [zls lsp-make-signature-help-options lsp-ui-imenu-window-fix-width lsp:omnisharp-run-tests-in-class-request-column nexti lsp-pwsh-help-completion lsp-treemacs-cycle-severity lsp-ui-doc-hide org-indent-drawer verification-uri :maxLength c-electric-lt-gt lsp-rust-analyzer-injected-modifier-face ANO treemacs-icon-icon-refresh dired-unmark-all-marks flycheck-mode-line-prefix cl-struct-flycheck-syntax-check-tags ANT f-ancestor-of\? org-table--descriptor-line lsp-perlnavigator eshell-return-exits-minibuffer :EndLineNumber DIMENSIONAL :showDevDebugOutput traversed kotlin-language-server ns-l-compact-sequence org-switch-to-buffer-other-window A289A gdb-thread-number lsp-elixir-suggest-specs org-table-get-range rg-header-render-toggle WatchKind lsp:set-rename-params-uri\? lsp-pyls-plugins-flake8-hang-closing lsp-ui-find-workspace-symbol lsp--virtual-buffer lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-brackets lsp-lua-hint-enable lsp-headerline--face-for-symbol gud-target-name lsp:set-file-operation-pattern-options\? lsp-inlay-hint-face org-at-keyword-p lsp-rust-analyzer-trait-modifier bibtex-text-in-string yaml--char-at-pos ...] :predicate #f(compiled-function (sym) #<bytecode -0x167920ae2e8785c9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  apply(#<subr ivy-read> ("M-x " [zls lsp-make-signature-help-options lsp-ui-imenu-window-fix-width lsp:omnisharp-run-tests-in-class-request-column nexti lsp-pwsh-help-completion lsp-treemacs-cycle-severity lsp-ui-doc-hide org-indent-drawer verification-uri :maxLength c-electric-lt-gt lsp-rust-analyzer-injected-modifier-face ANO treemacs-icon-icon-refresh dired-unmark-all-marks flycheck-mode-line-prefix cl-struct-flycheck-syntax-check-tags ANT f-ancestor-of\? org-table--descriptor-line lsp-perlnavigator eshell-return-exits-minibuffer :EndLineNumber DIMENSIONAL :showDevDebugOutput traversed kotlin-language-server ns-l-compact-sequence org-switch-to-buffer-other-window A289A gdb-thread-number lsp-elixir-suggest-specs org-table-get-range rg-header-render-toggle WatchKind lsp:set-rename-params-uri\? lsp-pyls-plugins-flake8-hang-closing lsp-ui-find-workspace-symbol lsp--virtual-buffer lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-brackets lsp-lua-hint-enable lsp-headerline--face-for-symbol gud-target-name lsp:set-file-operation-pattern-options\? lsp-inlay-hint-face org-at-keyword-p lsp-rust-analyzer-trait-modifier bibtex-text-in-string yaml--char-at-pos ...] :predicate #f(compiled-function (sym) #<bytecode -0x167920ae2e8785c9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
  ivy-read("M-x " [zls lsp-make-signature-help-options lsp-ui-imenu-window-fix-width lsp:omnisharp-run-tests-in-class-request-column nexti lsp-pwsh-help-completion lsp-treemacs-cycle-severity lsp-ui-doc-hide org-indent-drawer verification-uri :maxLength c-electric-lt-gt lsp-rust-analyzer-injected-modifier-face ANO treemacs-icon-icon-refresh dired-unmark-all-marks flycheck-mode-line-prefix cl-struct-flycheck-syntax-check-tags ANT f-ancestor-of\? org-table--descriptor-line lsp-perlnavigator eshell-return-exits-minibuffer :EndLineNumber DIMENSIONAL :showDevDebugOutput traversed kotlin-language-server ns-l-compact-sequence org-switch-to-buffer-other-window A289A gdb-thread-number lsp-elixir-suggest-specs org-table-get-range rg-header-render-toggle WatchKind lsp:set-rename-params-uri\? lsp-pyls-plugins-flake8-hang-closing lsp-ui-find-workspace-symbol lsp--virtual-buffer lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-brackets lsp-lua-hint-enable lsp-headerline--face-for-symbol gud-target-name lsp:set-file-operation-pattern-options\? lsp-inlay-hint-face org-at-keyword-p lsp-rust-analyzer-trait-modifier bibtex-text-in-string yaml--char-at-pos ...] :predicate #f(compiled-function (sym) #<bytecode -0x167920ae2e8785c9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

Anything else

No response

seagle0128 commented 1 year ago

Thanks for the reporting! I am fixing it.