unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: alex.branham@gmail.com, 30990@debbugs.gnu.org,
	Stefan Kangas <stefan@marxist.se>
Subject: bug#30990: Should the byte compiler warn about :type mismatches?
Date: Wed, 09 Oct 2019 15:34:20 +0200	[thread overview]
Message-ID: <m236g282lf.fsf@gmail.com> (raw)
In-Reply-To: <87woxu7rf8.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]

>>>>> On Mon, 30 Sep 2019 17:45:39 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Robert Pluim <rpluim@gmail.com> writes:
    >> (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.

    Lars> I think fixing those would be a win.

Hmm. Current attempt attached. Iʼm having trouble with
'sql-postgres-login-params', and 'sql-password-wallet', probably
because I donʼt know enough about custom, suggestions welcome.

    >> 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)

    Lars> [...]

    >> -  :type 'bool
    >> +  :type 'boolean

    Lars> etc.  Looks good to me; please push.

Done. One more, which I missed because itʼs not defined from lisp. Iʼm
not so sure about mentioning U+2502 in the tag, since I have a
vague memory that nil actually means 'autodetect if the frame can
display U+2502'.

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 15d33b43c0..6b8fa0c6c9 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -671,9 +671,11 @@ minibuffer-prompt-properties--setter
               :safe (lambda (value) (or (booleanp value) (integerp value))))
              (display-fill-column-indicator-character
               display-fill-column-indicator
-              character
+              (choice
+               (const :tag "Default (U+2502)" nil)
+               (character :tag "Character" ))
               "27.1"
-              :safe characterp)
+              :safe (lambda (value) (or (characterp value) (null value))))
 	     ;; xfaces.c
 	     (scalable-fonts-allowed display boolean "22.1")
 	     ;; xfns.c



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correct-some-more-custom-type-specs.patch --]
[-- Type: text/x-patch, Size: 3901 bytes --]

From 067250e0d5addcd8b7ee9072b3eae66c0c53d7a4 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Wed, 9 Oct 2019 15:28:47 +0200
Subject: [PATCH] Correct some more custom type specs
To: emacs-devel@gnu.org

* lisp/winner.el (winner-boring-buffers-regexp):
* lisp/progmodes/js.el (js-jsx-indent-level):
* lisp/image-dired.el (image-dired-external-viewer):
* lisp/gnus/nnir.el (nnir-notmuch-filter-group-names-function):
Correct custom type specification.

* lisp/textmodes/bibtex.el (bibtex-string-file-path):
(bibtex-file-path): Correct custom type specification and document
source of initial value.
---
 lisp/gnus/nnir.el        |  2 +-
 lisp/image-dired.el      |  4 +++-
 lisp/progmodes/js.el     |  3 ++-
 lisp/textmodes/bibtex.el | 14 ++++++++++----
 lisp/winner.el           |  3 ++-
 5 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 1041373a05..7cb2d1615a 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -535,7 +535,7 @@ nnir-notmuch-filter-group-names-function
    (lambda (g) (replace-regexp-in-string \"\\\\.\" \"/\" g)))"
   :version "27.1"
   :type '(choice function
-		 nil))
+		 (const :tag "No" nil)))
 
 ;;; Developer Extension Variable:
 
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index c1c767ba78..85bc924794 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -538,7 +538,9 @@ image-dired-external-viewer
   "Name of external viewer.
 Including parameters.  Used when displaying original image from
 `image-dired-thumbnail-mode'."
-  :type 'string
+  :version "27.1"
+  :type '(choice string
+                 (const :tag "Not Set" nil))
   :group 'image-dired)
 
 (defcustom image-dired-main-image-directory "~/pics/"
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 3050e8f1a7..8d457a28ec 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -650,7 +650,8 @@ js-jsx-indent-level
       </element>
   )"
   :version "27.1"
-  :type 'integer
+  :type '(choice integer
+                 (const :tag "Not Set" nil))
   :safe (lambda (x) (or (null x) (integerp x)))
   :group 'js)
 ;; This is how indentation behaved out-of-the-box until Emacs 27.  JSX
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 7e99032084..c29e963180 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -933,9 +933,12 @@ bibtex-string-files
   :type '(repeat file))
 
 (defcustom bibtex-string-file-path (getenv "BIBINPUTS")
-  "Colon-separated list of paths to search for `bibtex-string-files'."
+  "Colon-separated list of paths to search for `bibtex-string-files'.
+Initialized from the BIBINPUTS environment variable."
   :group 'bibtex
-  :type 'string)
+  :version "27.1"
+  :type '(choice string
+                 (const :tag "Not Set" nil)))
 
 (defcustom bibtex-files nil
   "List of BibTeX files that are searched for entry keys.
@@ -949,9 +952,12 @@ bibtex-files
                          directory file)))
 
 (defcustom bibtex-file-path (getenv "BIBINPUTS")
-  "Colon separated list of paths to search for `bibtex-files'."
+  "Colon separated list of paths to search for `bibtex-files'.
+Initialized from the BIBINPUTS environment variable."
   :group 'bibtex
-  :type 'string)
+  :version "27.1"
+  :type '(choice string
+                 (const :tag "Not Set" nil)))
 
 (defcustom bibtex-search-entry-globally nil
   "If non-nil, interactive calls of `bibtex-search-entry' search globally.
diff --git a/lisp/winner.el b/lisp/winner.el
index dc8bde5331..fea5211d90 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -61,7 +61,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 "Not Set" nil))
   :version "27.1")
 
 \f
-- 
2.23.0


  reply	other threads:[~2019-10-09 13:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 16:55 bug#30990: Should the byte compiler warn about :type mismatches? Alex Branham
2018-03-29 17:11 ` Glenn Morris
2020-09-25 12:44   ` Lars Ingebrigtsen
2019-09-28 19:00 ` Stefan Kangas
2019-09-28 19:21   ` Eli Zaretskii
2019-09-30 11:49     ` Robert Pluim
2019-09-30 15:45       ` Lars Ingebrigtsen
2019-10-09 13:34         ` Robert Pluim [this message]
2019-10-09 17:57           ` Lars Ingebrigtsen
2019-10-09 20:05           ` Lars Ingebrigtsen
2019-10-10 13:11             ` Robert Pluim
2019-10-11  5:54               ` Lars Ingebrigtsen
2020-09-25 13:18               ` Lars Ingebrigtsen
2020-09-25 13:36                 ` Lars Ingebrigtsen
2020-09-25 13:43                   ` Lars Ingebrigtsen
2019-10-09 18:44 ` Mattias Engdegård
2019-10-11  9:31 ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m236g282lf.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=30990@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    --cc=larsi@gnus.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).