dirvish icon indicating copy to clipboard operation
dirvish copied to clipboard

[Bug] `'dirvish-open-with-programs` has an incorrect `'custom-type` property

Open hab25 opened this issue 2 years ago • 1 comments

Thank you for the bug report

  • [X] I am using the latest version of dirvish related packages.
  • [X] I checked CUSTOMIZING|EXTENSIONS.
  • [X] You may also try reproduce the issue using clean environment and minimal configurations with the command emacs -Q.

Bug description

'dirvish-open-with-programs has an incorrect 'custom-type property. This prevents it from being customized via the customize interface, and fails programmatic type-checking (see the Anything else section below).

Steps to reproduce

(customize-variable 'dirvish-open-with-programs)

and see that no customization buttons specific to 'dirvish-open-with-programs show up in the customize buffer and the following message appears in the message buffer:

mapcar: Wrong type argument: symbolp, (repeat string)

OR

(widget-convert (get 'dirvish-open-with-programs 'custom-type))

and see that an error is signaled (my erro callstack is provided below).

Expected behavior

Customize buffer displays properly;

widget-convert works.

OS

Linux

Emacs Version

28

Emacs Configurations

Vanilla

Error callstack

Debugger entered--Lisp error: (wrong-type-argument symbolp (repeat string))
  widget-convert(((repeat string) :tag "File extensions"))
  mapcar(widget-convert (((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args")))
  widget-types-convert-widget((cons :format "%v" :args (((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args"))))
  widget-convert((cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args")))
  mapcar(widget-convert ((cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args"))))
  widget-types-convert-widget((editable-list :inline t :args ((cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args")))))
  widget-convert((editable-list :inline t (cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args"))))
  mapcar(widget-convert ((editable-list :inline t (cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args")))))
  widget-types-convert-widget((alist :key-type ((repeat string) :tag "File extensions") :value-type ((repeat string) :tag "External command and args") :args ((editable-list :inline t (cons :format "%v" ((repeat string) :tag "File extensions") ((repeat string) :tag "External command and args"))))))
  widget-convert((alist :key-type ((repeat string) :tag "File extensions") :value-type ((repeat string) :tag "External command and args")))
  eval-expression((widget-convert (custom-type 'dirvish-open-with-programs)) nil nil 127)

Anything else

I use the #'custom-type and #'custom-value-satisfies-type-p functions of cus-edit-plus (https://github.com/emacsmirror/cus-edit-plus/blob/99b16cb95e1b892e15e3091f124e0be6dd914e16/cus-edit%2B.el#L1073) to type-check any variables I set (if they have a 'custom-type property). This allows me to catch many type errors like this one. Dirvish may want to do something similar.

hab25 avatar Feb 16 '23 16:02 hab25

I use the #'custom-type and #'custom-value-satisfies-type-p functions of cus-edit-plus (https://github.com/emacsmirror/cus-edit-plus/blob/99b16cb95e1b892e15e3091f124e0be6dd914e16/cus-edit%2B.el#L1073) to type-check any variables I set (if they have a 'custom-type property). This allows me to catch many type errors like this one. Dirvish may want to do something similar.

Emacs 29 comes with similar functionality in the form of the new setopt. I believe that therefore, my usage, as described above, has been made obsolete.

hab25 avatar Aug 04 '23 21:08 hab25