emacs-diffs
[Top][All Lists]
Advanced

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

master 6a7bb1ddbc: Make some additional defcustom types more restrictive


From: Stefan Kangas
Subject: master 6a7bb1ddbc: Make some additional defcustom types more restrictive
Date: Wed, 6 Jul 2022 13:30:05 -0400 (EDT)

branch: master
commit 6a7bb1ddbc9837b2d2af60236be58723114855ac
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 lisp/desktop.el              |  2 +-
 lisp/doc-view.el             |  3 ++-
 lisp/emacs-lisp/backtrace.el |  3 ++-
 lisp/files.el                | 10 +++++-----
 lisp/filesets.el             |  8 ++++----
 lisp/gnus/spam-stat.el       |  2 +-
 lisp/hi-lock.el              |  4 ++--
 lisp/ido.el                  |  2 +-
 lisp/image/gravatar.el       |  2 +-
 lisp/imenu.el                |  4 ++--
 lisp/informat.el             |  2 +-
 lisp/mail/hashcash.el        |  4 ++--
 lisp/mail/mail-hist.el       |  2 +-
 lisp/mail/smtpmail.el        |  2 +-
 lisp/msb.el                  |  2 +-
 lisp/nxml/rng-valid.el       |  4 ++--
 lisp/progmodes/gdb-mi.el     |  2 +-
 lisp/recentf.el              |  2 +-
 lisp/simple.el               |  6 +++---
 lisp/tab-line.el             |  2 +-
 lisp/term.el                 |  4 ++--
 lisp/thumbs.el               | 16 ++++++++--------
 lisp/type-break.el           |  8 ++++----
 lisp/vc/compare-w.el         |  5 ++---
 lisp/woman.el                |  2 +-
 25 files changed, 52 insertions(+), 51 deletions(-)

diff --git a/lisp/desktop.el b/lisp/desktop.el
index 947f7cff5c..850d2a86ef 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -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")
 
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 25c476b99b..0f659fb8b3 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -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.
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index e305822af1..4f98bf3f4f 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -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")
 
diff --git a/lisp/files.el b/lisp/files.el
index b2f035d4df..f84fe7e085 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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.
diff --git a/lisp/filesets.el b/lisp/filesets.el
index b97dda3cd6..b1829793f1 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -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)
diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el
index b0d258d67a..084eb3d774 100644
--- a/lisp/gnus/spam-stat.el
+++ b/lisp/gnus/spam-stat.el
@@ -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")
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 8cddd64482..b56f26d529 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -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
diff --git a/lisp/ido.el b/lisp/ido.el
index b3365059d2..134081d675 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -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.
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index 78a2df72c4..8c49c1edf2 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -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)
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 4393c6ed6c..040e373fb4 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -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.
diff --git a/lisp/informat.el b/lisp/informat.el
index e7595fa541..c126ab5b1a 100644
--- a/lisp/informat.el
+++ b/lisp/informat.el
@@ -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)
 
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el
index b343a017e3..8d274d9cac 100644
--- a/lisp/mail/hashcash.el
+++ b/lisp/mail/hashcash.el
@@ -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))
diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el
index e02d4218dd..a13f9de174 100644
--- a/lisp/mail/mail-hist.el
+++ b/lisp/mail/mail-hist.el
@@ -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
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 88e55e968c..da786dec00 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -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
diff --git a/lisp/msb.el b/lisp/msb.el
index 6e1d03ac27..616799f067 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -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)"
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 56ff3b66c0..b9c980222e 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -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.
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 03beb06569..21bb75ae0c 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -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")
 
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 4bc1ab5c21..b80ee3dd7d 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -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.
diff --git a/lisp/simple.el b/lisp/simple.el
index 042384bbe7..e79487eba8 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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 ()
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 80b0aabd77..3e3b4c9559 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -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")
 
diff --git a/lisp/term.el b/lisp/term.el
index c129ed976d..a28d8c5d76 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -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.
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index e622bcedc4..158597d7c8 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -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.
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 267facccc4..dca5a43b89 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -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] "
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index b56b4c0d83..64d5d1081a 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -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
diff --git a/lisp/woman.el b/lisp/woman.el
index fd5fee2005..73e068a822 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -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



reply via email to

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