bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30990: Should the byte compiler warn about :type mismatches?


From: Robert Pluim
Subject: bug#30990: Should the byte compiler warn about :type mismatches?
Date: Mon, 30 Sep 2019 13:49:28 +0200

>>>>> On Sat, 28 Sep 2019 22:21:55 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Stefan Kangas <stefan@marxist.se>
    >> Date: Sat, 28 Sep 2019 21:00:22 +0200
    >> Cc: Alex Branham <alex.branham@gmail.com>, 30990@debbugs.gnu.org
    >> 
    >> The following options might have problems:
    >> sql-password-wallet
    >> tramp-default-host-alist
    >> display-fill-column-indicator-character
    >> bibtex-string-file-path
    >> js-jsx-indent-level
    >> bibtex-file-path
    >> sql-use-indent-support
    >> sql-postgres-login-params
    >> winner-boring-buffers-regexp
    >> add-log-dont-create-changelog-file
    >> nnir-notmuch-filter-group-names-function
    >> flymake-cc-command
    >> 
    >> Since we're getting closer to the release of Emacs 27.1, perhaps we
    >> should sort these out.

    Eli> We should, but bugs like this can be fixed even after the emacs-27
    Eli> branch is cut.

I took a quick look, most of them are because the starting value is
nil, and the type is something that canʼt be nil, which means the type
should actually be something like

(choice string (const nil))

an example, where nil here means "donʼt do any checking":

diff --git a/lisp/winner.el b/lisp/winner.el
index ec3b296489..0e5bd90966 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -71,7 +71,8 @@ winner-boring-buffers
 
 (defcustom winner-boring-buffers-regexp nil
   "`winner-undo' will not restore windows with buffers matching this regexp."
-  :type 'string
+  :type '(choice (string :tag "Regexp")
+                 (const :tag "Don't check" nil))
   :version "27.1")

Iʼm not sure those are worth fixing.

I did spot what seem to be some genuine errors though (hmm, would
flymake-cc-command need a :version tag update as well? The existing
definition makes customize error out)

diff --git i/lisp/image.el w/lisp/image.el
index eaa6ed3b0e..e44330fdfa 100644
--- i/lisp/image.el
+++ w/lisp/image.el
@@ -148,7 +148,7 @@ image-use-external-converter
 support in Emacs can still be displayed if an external conversion
 program (like ImageMagick \"convert\", GraphicsMagick \"gm\"
 or \"ffmpeg\") is installed."
-  :type 'bool
+  :type 'boolean
   :version "27.1")
 
 ;; Map put into text properties on images.
diff --git i/lisp/progmodes/flymake-cc.el w/lisp/progmodes/flymake-cc.el
index ecf6e648a7..7b36fcf06d 100644
--- i/lisp/progmodes/flymake-cc.el
+++ w/lisp/progmodes/flymake-cc.el
@@ -37,7 +37,7 @@ flymake-cc-command
 input and prints the result on its standard output."
   :type '(choice
           (symbol :tag "Function")
-          ((repeat :) string))
+          (repeat :tag "Command(s)" string))
   :group 'flymake-cc)
 
 (defun flymake-cc--make-diagnostics (source)
diff --git i/lisp/progmodes/sql.el w/lisp/progmodes/sql.el
index 2d33b3130c..0e14a6e4b2 100644
--- i/lisp/progmodes/sql.el
+++ w/lisp/progmodes/sql.el
@@ -737,7 +737,7 @@ sql-use-indent-support
 The package must be available to be loaded and activated."
   :group 'SQL
   :link '(url-link "https://elpa.gnu.org/packages/sql-indent.html";)
-  :type 'booleanp
+  :type 'boolean
   :version "27.1")
 
 (defun sql-indent-enable ()
diff --git i/lisp/vc/add-log.el w/lisp/vc/add-log.el
index 47a68167fb..5c27a65ea1 100644
--- i/lisp/vc/add-log.el
+++ w/lisp/vc/add-log.el
@@ -811,7 +811,7 @@ add-log-dont-create-changelog-file
   "If non-nil, don't create ChangeLog files for log entries.
 If a ChangeLog file does not already exist, a non-nil value
 means to put log entries in a suitably named buffer."
-  :type :boolean
+  :type 'boolean
   :version "27.1")
 
 (put 'add-log-dont-create-changelog-file 'safe-local-variable 'booleanp)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]