Make some additional defcustom types more restrictive

* lisp/desktop.el (desktop-lazy-idle-delay):
* lisp/files.el (dired-kept-versions)
(kept-old-versions, kept-new-versions):
* lisp/filesets.el (filesets-max-submenu-length)
(filesets-max-entry-length, filesets-tree-max-level)
(filesets-query-user-limit):
* lisp/hi-lock.el (hi-lock-file-patterns-range)
(hi-lock-highlight-range):
* lisp/ido.el (ido-max-work-directory-list):
* lisp/image/gravatar.el (gravatar-cache-ttl):
* lisp/imenu.el (imenu-auto-rescan-maxout, imenu-max-items):
* lisp/informat.el (Info-split-threshold):
* lisp/mail/hashcash.el (hashcash-default-payment)
(hashcash-default-accept-payment):
* lisp/mail/mail-hist.el (mail-hist-history-size):
* lisp/mail/smtpmail.el (smtpmail-retries):
* lisp/msb.el (msb-display-most-recently-used):
* lisp/nxml/rng-valid.el (rng-state-cache-distance)
(rng-validate-chunk-size):
* lisp/progmodes/gdb-mi.el (gdb-max-source-window-count):
* lisp/recentf.el (recentf-arrange-by-rules-min-items):
* lisp/simple.el (kill-ring-max, mark-ring-max)
(global-mark-ring-max):
* lisp/tab-line.el (tab-line-tab-name-truncated-max):
* lisp/term.el (term-buffer-maximum-size, term-input-chunk-size):
* lisp/thumbs.el (thumbs-max-image-number)
(thumbs-thumbsdir-max-size, thumbs-relief, thumbs-margin)
(thumbs-image-resizing-step):
* lisp/type-break.el (type-break-interval)
(type-break-good-rest-interval, type-break-query-interval)
(type-break-warning-repeat):
* lisp/vc/compare-w.el (compare-windows-sync-string-size):
* lisp/woman.el (woman-fill-column): Use defcustom :type natnum.

* lisp/emacs-lisp/backtrace.el (backtrace-line-length):
* lisp/doc-view.el (doc-view-conversion-refresh-interval):
Use defcustom :type natnum and allow the nil value.

* lisp/gnus/spam-stat.el (spam-stat-process-directory-age):
Use defcustom :type integer.
This commit is contained in:
Stefan Kangas 2022-07-06 19:29:51 +02:00
parent 22bcbf8e2c
commit 6a7bb1ddbc
25 changed files with 52 additions and 51 deletions

View file

@ -481,7 +481,7 @@ If value is t, all buffers are restored immediately."
(defcustom desktop-lazy-idle-delay 5
"Idle delay before starting to create buffers.
See `desktop-restore-eager'."
:type 'integer
:type 'natnum
:group 'desktop
:version "22.1")

View file

@ -378,7 +378,8 @@ After such a refresh newly converted pages will be available for
viewing. If set to nil there won't be any refreshes and the
pages won't be displayed before conversion of the whole document
has finished."
:type 'integer)
:type '(choice natnum
(const :value nil :tag "No refreshes")))
(defcustom doc-view-continuous nil
"In Continuous mode reaching the page edge advances to next/previous page.

View file

@ -58,7 +58,8 @@ Backtrace mode will attempt to abbreviate printing of backtrace
frames by setting `print-level' and `print-length' to make them
shorter than this, but success is not guaranteed. If set to nil
or zero, backtrace mode will not abbreviate the forms it prints."
:type 'integer
:type '(choice natnum
(const :value nil :tag "Don't abbreviate"))
:group 'backtrace
:version "27.1")

View file

@ -316,7 +316,7 @@ The value `never' means do not make them."
(defcustom dired-kept-versions 2
"When cleaning directory, number of versions to keep."
:type 'integer
:type 'natnum
:group 'backup
:group 'dired)
@ -330,16 +330,16 @@ If nil, ask confirmation. Any other value prevents any trimming."
(defcustom kept-old-versions 2
"Number of oldest versions to keep when a new numbered backup is made."
:type 'integer
:type 'natnum
:safe #'natnump
:group 'backup)
(put 'kept-old-versions 'safe-local-variable 'integerp)
(defcustom kept-new-versions 2
"Number of newest versions to keep when a new numbered backup is made.
Includes the new backup. Must be greater than 0."
:type 'integer
:type 'natnum
:safe #'natnump
:group 'backup)
(put 'kept-new-versions 'safe-local-variable 'integerp)
(defcustom require-final-newline nil
"Whether to add a newline automatically at the end of the file.

View file

@ -414,12 +414,12 @@ time to time or if the fileset cache causes troubles."
Set this value to 0 to turn menu splitting off. BTW, parts of submenus
will not be rewrapped if their length exceeds this value."
:set #'filesets-set-default
:type 'integer)
:type 'natnum)
(defcustom filesets-max-entry-length 50
"Truncate names of split submenus to this length."
:set #'filesets-set-default
:type 'integer)
:type 'natnum)
(defcustom filesets-browse-dir-function #'dired
"A function or command used for browsing directories.
@ -518,7 +518,7 @@ i.e. how deep the menu should be. Try something like
and it should become clear what this option is about. In any case,
including directory trees to the menu can take a lot of memory."
:set #'filesets-set-default
:type 'integer)
:type 'natnum)
(defcustom filesets-commands
'(("Isearch"
@ -1027,7 +1027,7 @@ defined in `filesets-ingroup-patterns'."
(defcustom filesets-query-user-limit 15
"Query the user before opening a fileset with that many files."
:set #'filesets-set-default
:type 'integer)
:type 'natnum)
(defun filesets-filter-dir-names (lst &optional negative)

View file

@ -189,7 +189,7 @@ When using `spam-stat-process-spam-directory' or
been touched in this many days will be considered. Without
this filter, re-training spam-stat with several thousand messages
will start to take a very long time."
:type 'number)
:type 'integer)
(defvar spam-stat-last-saved-at nil
"Time stamp of last change of spam-stat-file on this run")

View file

@ -97,7 +97,7 @@
When a file is visited and hi-lock mode is on, patterns starting
up to this limit are added to font-lock's patterns. See documentation
of functions `hi-lock-mode' and `hi-lock-find-patterns'."
:type 'integer
:type 'natnum
:group 'hi-lock)
(defcustom hi-lock-highlight-range 2000000
@ -107,7 +107,7 @@ such as the buffer created by `list-colors-display'. In those buffers
hi-lock patterns will only be applied over a range of
`hi-lock-highlight-range' characters. If font-lock is active then
highlighting will be applied throughout the buffer."
:type 'integer
:type 'natnum
:group 'hi-lock)
(defcustom hi-lock-exclude-modes

View file

@ -554,7 +554,7 @@ See `ido-last-directory-list' and `ido-save-directory-list-file'."
"Maximum number of working directories to record.
This is the list of directories where files have most recently been opened.
See `ido-work-directory-list' and `ido-save-directory-list-file'."
:type 'integer)
:type 'natnum)
(defcustom ido-work-directory-list-ignore-regexps nil
"List of regexps matching directories which should not be recorded.

View file

@ -45,7 +45,7 @@
"Time to live in seconds for gravatar cache entries.
If a requested gravatar has been cached for longer than this, it
is retrieved anew. The default value is 30 days."
:type 'integer
:type 'natnum
;; Restricted :type to number of seconds.
:version "27.1"
:group 'gravatar)

View file

@ -87,7 +87,7 @@ This might not yet be honored by all index-building functions."
(defcustom imenu-auto-rescan-maxout 600000
"Imenu auto-rescan is disabled in buffers larger than this size (in bytes).
Also see `imenu-max-index-time'."
:type 'integer
:type 'natnum
:version "26.2")
(defcustom imenu-use-popup-menu 'on-mouse
@ -132,7 +132,7 @@ element should come before the second. The arguments are cons cells;
(defcustom imenu-max-items 25
"Maximum number of elements in a mouse menu for Imenu."
:type 'integer)
:type 'natnum)
(defcustom imenu-space-replacement "."
"The replacement string for spaces in index names.

View file

@ -158,7 +158,7 @@
;;;###autoload
(defcustom Info-split-threshold 262144
"The number of characters by which `Info-split' splits an info file."
:type 'integer
:type 'natnum
:version "23.1"
:group 'texinfo)

View file

@ -57,7 +57,7 @@
"The default number of bits to pay to unknown users.
If this is zero, no payment header will be generated.
See `hashcash-payment-alist'."
:type 'integer
:type 'natnum
:group 'hashcash)
(defcustom hashcash-payment-alist '()
@ -77,7 +77,7 @@ present, is the string to be hashed; if not present ADDR will be used."
(defcustom hashcash-default-accept-payment 20
"The default minimum number of bits to accept on incoming payments."
:type 'integer
:type 'natnum
:group 'hashcash)
(defcustom hashcash-accept-resources `((,user-mail-address nil))

View file

@ -80,7 +80,7 @@ previous/next input.")
(defcustom mail-hist-history-size (or kill-ring-max 1729)
"The maximum number of elements in a mail field's history.
Oldest elements are dumped first."
:type 'integer)
:type 'natnum)
;;;###autoload
(defcustom mail-hist-keep-history t

View file

@ -171,7 +171,7 @@ attempt."
"The number of times smtpmail will retry sending when getting transient errors.
These are errors with a code of 4xx from the SMTP server, which
mean \"try again\"."
:type 'integer
:type 'natnum
:version "27.1")
(defcustom smtpmail-store-queue-variables nil

View file

@ -299,7 +299,7 @@ If the value is not a number, then the value 10 is used."
(defcustom msb-display-most-recently-used 15
"How many buffers should be in the most-recently-used menu.
No buffers at all if less than 1 or nil (or any non-number)."
:type 'integer
:type 'natnum
:set #'msb-custom-set)
(defcustom msb-most-recently-used-title "Most recently used (%d)"

View file

@ -110,14 +110,14 @@
(defcustom rng-state-cache-distance 2000
"Distance in characters between each parsing and validation state cache."
:type 'integer)
:type 'natnum)
(defcustom rng-validate-chunk-size 8000
"Number of characters in a RELAX NG validation chunk.
A validation chunk will be the smallest chunk that is at least this
size and ends with a tag. After validating a chunk, validation will
continue only if Emacs is still idle."
:type 'integer)
:type 'natnum)
(defcustom rng-validate-delay 1.5
"Time in seconds that Emacs must be idle before starting a full validation.

View file

@ -684,7 +684,7 @@ Note that this variable only takes effect when variable
Until there are such number of source windows on screen, GDB
tries to open a new window when visiting a new source file; after
that GDB starts to reuse existing source windows."
:type 'number
:type 'natnum
:group 'gdb
:version "28.1")

View file

@ -837,7 +837,7 @@ corresponding sub-menu items are displayed in the main recent files
menu or in the `recentf-arrange-by-rule-others' sub-menu if
defined."
:group 'recentf-filters
:type 'number)
:type 'natnum)
(defcustom recentf-arrange-by-rule-subfilter nil
"Function called by a rule based filter to filter sub-menu elements.

View file

@ -5456,7 +5456,7 @@ ring directly.")
(defcustom kill-ring-max 120
"Maximum length of kill ring before oldest elements are thrown away."
:type 'integer
:type 'natnum
:group 'killing
:version "29.1")
@ -7026,7 +7026,7 @@ is set to the buffer displayed in that window.")
(defcustom mark-ring-max 16
"Maximum size of mark ring. Start discarding off end if gets this big."
:type 'integer
:type 'natnum
:group 'editing-basics)
(defvar global-mark-ring nil
@ -7035,7 +7035,7 @@ is set to the buffer displayed in that window.")
(defcustom global-mark-ring-max 16
"Maximum size of global mark ring. \
Start discarding off end if gets this big."
:type 'integer
:type 'natnum
:group 'editing-basics)
(defun pop-to-mark-command ()

View file

@ -288,7 +288,7 @@ variable `tab-line-tab-name-function'."
"Maximum length of the tab name from the current buffer.
Effective when `tab-line-tab-name-function' is customized
to `tab-line-tab-name-truncated-buffer'."
:type 'integer
:type 'natnum
:group 'tab-line
:version "27.1")

View file

@ -915,7 +915,7 @@ Term buffers are truncated from the top to be no greater than this number.
Notice that a setting of 0 means \"don't truncate anything\". This variable
is buffer-local."
:group 'term
:type 'integer
:type 'natnum
:version "27.1")
(defcustom term-bind-function-keys nil
@ -2473,7 +2473,7 @@ Checks if STRING contains a password prompt as defined by
"Long inputs send to term processes are broken up into chunks of this size.
If your process is choking on big inputs, try lowering the value."
:group 'term
:type 'integer)
:type 'natnum)
(defun term-send-string (proc str)
"Send to PROC the contents of STR as input.

View file

@ -73,16 +73,16 @@
(defcustom thumbs-per-line 4
"Number of thumbnails per line to show in directory."
:type 'integer)
:type 'natnum)
(defcustom thumbs-max-image-number 16
"Maximum number of images initially displayed in thumbs buffer."
:type 'integer)
"Maximum number of images initially displayed in thumbs buffer."
:type 'natnum)
(defcustom thumbs-thumbsdir-max-size 50000000
"Maximum size for thumbnails directory.
When it reaches that size (in bytes), a warning is sent."
:type 'integer)
When it reaches that size (in bytes), a warning is displayed."
:type 'natnum)
;; Unfortunately Windows XP has a program called CONVERT.EXE in
;; C:/WINDOWS/SYSTEM32/ for partitioning NTFS systems. So Emacs
@ -106,12 +106,12 @@ This must be the ImageMagick \"convert\" utility."
(defcustom thumbs-relief 5
"Size of button-like border around thumbnails."
:type 'integer)
:type 'natnum)
(defcustom thumbs-margin 2
"Size of the margin around thumbnails.
This is where you see the cursor."
:type 'integer)
:type 'natnum)
(defcustom thumbs-thumbsdir-auto-clean t
"If set, delete older file in the thumbnails directory.
@ -121,7 +121,7 @@ than `thumbs-thumbsdir-max-size'."
(defcustom thumbs-image-resizing-step 10
"Step by which to resize image as a percentage."
:type 'integer)
:type 'natnum)
(defcustom thumbs-temp-dir temporary-file-directory
"Temporary directory to use.

View file

@ -69,7 +69,7 @@
(defcustom type-break-interval (* 60 60)
"Number of seconds between scheduled typing breaks."
:type 'integer
:type 'natnum
:group 'type-break)
(defcustom type-break-good-rest-interval (/ type-break-interval 6)
@ -82,7 +82,7 @@ rest from typing, then the next typing break is simply rescheduled for later.
If a break is interrupted before this much time elapses, the user will be
asked whether or not really to interrupt the break."
:set-after '(type-break-interval)
:type 'integer
:type 'natnum
:group 'type-break)
(defcustom type-break-good-break-interval nil
@ -148,7 +148,7 @@ To avoid being queried at all, set `type-break-query-mode' to nil."
"Number of seconds between queries to take a break, if put off.
The user will continue to be prompted at this interval until he or she
finally submits to taking a typing break."
:type 'integer
:type 'natnum
:group 'type-break)
(defcustom type-break-time-warning-intervals '(300 120 60 30)
@ -171,7 +171,7 @@ will occur."
"Number of keystrokes for which warnings should be repeated.
That is, for each of this many keystrokes the warning is redisplayed
in the echo area to make sure it's really seen."
:type 'integer
:type 'natnum
:group 'type-break)
(defcustom type-break-time-stamp-format "[%H:%M] "

View file

@ -1,7 +1,6 @@
;;; compare-w.el --- compare text between windows for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2022 Free Software
;; Foundation, Inc.
;; Copyright (C) 1986-2022 Free Software Foundation, Inc.
;; Maintainer: emacs-devel@gnu.org
;; Keywords: convenience files vc
@ -99,7 +98,7 @@ may fail by finding the wrong match. The bigger number makes
difference regions more coarse-grained.
The default value 32 is good for the most cases."
:type 'integer
:type 'natnum
:version "22.1")
(defcustom compare-windows-recenter nil

View file

@ -843,7 +843,7 @@ Only useful when run on a graphic display such as X or MS-Windows."
(defcustom woman-fill-column 65
"Right margin for formatted text -- default is 65."
:type 'integer
:type 'natnum
:group 'woman-formatting)
(defcustom woman-fill-frame nil