]> git.eshelyaron.com Git - emacs.git/commitdiff
Make some additional defcustom types more restrictive
authorStefan Kangas <stefan@marxist.se>
Wed, 6 Jul 2022 17:29:51 +0000 (19:29 +0200)
committerStefan Kangas <stefan@marxist.se>
Wed, 6 Jul 2022 17:29:51 +0000 (19:29 +0200)
* 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.

25 files changed:
lisp/desktop.el
lisp/doc-view.el
lisp/emacs-lisp/backtrace.el
lisp/files.el
lisp/filesets.el
lisp/gnus/spam-stat.el
lisp/hi-lock.el
lisp/ido.el
lisp/image/gravatar.el
lisp/imenu.el
lisp/informat.el
lisp/mail/hashcash.el
lisp/mail/mail-hist.el
lisp/mail/smtpmail.el
lisp/msb.el
lisp/nxml/rng-valid.el
lisp/progmodes/gdb-mi.el
lisp/recentf.el
lisp/simple.el
lisp/tab-line.el
lisp/term.el
lisp/thumbs.el
lisp/type-break.el
lisp/vc/compare-w.el
lisp/woman.el

index 947f7cff5cb259e32739701a38a8d66b2f870950..850d2a86efac33d96a23aadbbcd9cc0e34a23bde 100644 (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")
 
index 25c476b99baacc6697213fab77d66d6e0f4007f3..0f659fb8b3703821d9da72fe83e48e627b3145bc 100644 (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.
index e305822af1ffabc5a3cdc3b88e9f3b0ab5571b92..4f98bf3f4f5e3221ecc4c2684f220cfb1a3dbb10 100644 (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")
 
index b2f035d4df8a0c60684542a2cd4f044f7f6ec803..f84fe7e085b01b4dbbc21f64aaef227623abd442 100644 (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.
index b97dda3cd61d159c96fc38ef5a788a5e5394b788..b1829793f1155030c4604804a362d5dbf224620e 100644 (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)
 \f
 
 (defun filesets-filter-dir-names (lst &optional negative)
index b0d258d67a5950d94087dff50f51283e2c3a1c7e..084eb3d77456b4ed3e9c26f9696fff182ccc99bc 100644 (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")
index 8cddd6448244dd7788cfe5d2fac435289cf01038..b56f26d5297c5b918d145427d4ad876d8dd3346c 100644 (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
index b3365059d253a7016a79e320da5dcb7bd042bf9e..134081d675957ee122dbcbd70ecef5752b10571c 100644 (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.
index 78a2df72c4c36004167a7c233267c243284f7ff6..8c49c1edf28c6c82a6ed02f97e8d50f3c7978464 100644 (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)
index 4393c6ed6cb9089511e71dc175d9c4047b7c9085..040e373fb42ec7b37409c13f55d77ba9e27282d4 100644 (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.
index e7595fa541a940c3a69365eb0765dc86e494e371..c126ab5b1a192206b60db5d03600287734f22668 100644 (file)
 ;;;###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)
 
index b343a017e34f380265da58fc23e936eb46a142ac..8d274d9cac4a737267ea0cbe221fa9fbc7d01388 100644 (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))
index e02d4218dd260c9e082bf712d0bdbcd7a7a2dbc9..a13f9de1740b9725eaf5cb09253642d2551f2478 100644 (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
index 88e55e968c4305dd4c34bc220ce9d216a2297940..da786dec00488ed1762d9aaf2b11886fe3e2fba7 100644 (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
index 6e1d03ac277b8c0332a4c5ea6d3bf0385de6e9b8..616799f067b40862fa35fe2abbe55043f3ed9e32 100644 (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)"
index 56ff3b66c0f4cc764001676d7b57905535a8f11b..b9c980222e215781580166a2b65340a06ac7ea32 100644 (file)
 
 (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.
index 03beb065699b13fa09d014a9f0cde8ff7e8ce67a..21bb75ae0cfac768303deb3f925d12b6b996e094 100644 (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")
 
index 4bc1ab5c21974b8a1ff36d77c1c5c0afdeb4f644..b80ee3dd7d800367e778c36607694de88e66ec2a 100644 (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.
index 042384bbe727c594bf04351b9e742431225f4f4c..e79487eba86d1620be87425ac59d0859d6f445c1 100644 (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 ()
index 80b0aabd7769f7cb1249dda36f97d750d86d8127..3e3b4c95595d7970ed42b3f4573d8dae25fbaeb4 100644 (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")
 
index c129ed976d56b6f7ca19ac40594876791a8a0336..a28d8c5d76101c9b17b3aff654d46e293abcb655 100644 (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.
index e622bcedc4edf53eeda6bcbc5037ca89e0fbf2de..158597d7c8cfc667979fbddc1b8037510125bb73 100644 (file)
 
 (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.
index 267facccc47c1b4450c55f31c78c79bcf7f0b0eb..dca5a43b8930a243a0759cc9fe3110e36eb8b46c 100644 (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] "
index b56b4c0d83a77c3c1c518b4ee53ca798b780e03c..64d5d1081a39c10ae9c0649ed31e1ed355015515 100644 (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
index fd5fee2005a87d19be456257bfc837aa0e9f2b33..73e068a82215284097237915d0ce51a7963e16f3 100644 (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