1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Make some defcustom types more restrictive

* lisp/abbrev.el (abbrev-suggest-hint-threshold):
* lisp/bookmark.el (bookmark-bmenu-file-column)
(bookmark-menu-length):
* lisp/buff-menu.el (Buffer-menu-size-width)
(Buffer-menu-mode-width):
* lisp/calendar/calendar.el (calendar-week-start-day)
(calendar-intermonth-spacing, calendar-column-width)
(calendar-day-digit-width):
* lisp/calc/calc.el (calc-undo-length):
* lisp/calendar/timeclock.el (timeclock-workday):
* lisp/comint.el (comint-buffer-maximum-size)
(comint-input-ring-size):
* lisp/doc-view.el (doc-view-resolution, doc-view-image-width):
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column):
* lisp/emacs-lisp/comp.el (native-comp-debug)
(native-comp-verbose, native-comp-async-jobs-number):
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width):
* lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines):
* lisp/frame.el (blink-cursor-blinks):
* lisp/info.el (Info-breadcrumbs-depth):
* lisp/jit-lock.el (jit-lock-chunk-size):
* lisp/kmacro.el (kmacro-ring-max):
* lisp/menu-bar.el (yank-menu-length, yank-menu-max-items):
* lisp/midnight.el (clean-buffer-list-delay-general)
(clean-buffer-list-delay-special):
* lisp/net/dictionary.el (dictionary-port)
(dictionary-proxy-port):
* lisp/net/ldap.el (ldap-default-port):
* lisp/net/pop3.el (pop3-port, pop3-stream-length):
* lisp/net/rcirc.el (rcirc-default-port):
* lisp/net/sieve-manage.el (sieve-manage-default-port):
* lisp/play/spook.el (spook-phrase-default-count):
* lisp/play/tetris.el (tetris-buffer-width)
(tetris-buffer-height, tetris-width, tetris-height)
(tetris-top-left-x, tetris-top-left-y):
* lisp/profiler.el (profiler-sampling-interval):
* lisp/progmodes/sql.el (sql-port):
* lisp/recentf.el (recentf-max-menu-items):
* lisp/strokes.el (strokes-grid-resolution):
* lisp/tab-bar.el (tab-bar-tab-name-truncated-max):
* lisp/term/xterm.el (xterm-max-cut-length):
* lisp/time.el (display-time-interval, world-clock-timer-second):
* lisp/url/url-cache.el (url-cache-expire-time):
* lisp/url/url-cookie.el (url-cookie-save-interval):
* lisp/url/url-history.el (url-history-save-interval):
* lisp/url/url-queue.el (url-queue-parallel-processes)
(url-queue-timeout):
* lisp/url/url-vars.el (url-max-password-attempts)
(url-max-redirections):
* lisp/vc/emerge.el (emerge-min-visible-lines):
* lisp/vc/vc.el (vc-log-show-limit):
* lisp/window.el (window-min-height, window-min-width):
* lisp/winner.el (winner-ring-size): Use :type natnum.

* lisp/savehist.el (savehist-file-modes): Fix setting to nil value and
use :type natnum.
This commit is contained in:
Stefan Kangas 2022-07-05 16:26:45 +02:00
parent 3868c3aa3e
commit 9d866a1f8d
42 changed files with 71 additions and 70 deletions

View file

@ -885,7 +885,7 @@ longer than the abbrev, the benefit of informing the user is not
significant. If you always want to be informed about existing
abbrevs for the text you type, set this value to zero or less.
This setting only applies if `abbrev-suggest' is non-nil."
:type 'number
:type 'natnum
:version "28.1")
(defun abbrev--suggest-get-active-tables-including-parents ()

View file

@ -160,7 +160,7 @@ This includes the annotations column.")
(defcustom bookmark-bmenu-file-column 30
"Column at which to display filenames in a buffer listing bookmarks.
You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]."
:type 'integer)
:type 'natnum)
(defcustom bookmark-bmenu-toggle-filenames t
@ -174,7 +174,7 @@ A non-nil value may result in truncated bookmark names."
(defcustom bookmark-menu-length 70
"Maximum length of a bookmark name displayed on a popup menu."
:type 'integer)
:type 'natnum)
;; FIXME: Is it really worth a customization option?
(defcustom bookmark-search-delay 0.2

View file

@ -92,13 +92,13 @@ number."
(defcustom Buffer-menu-size-width 7
"Width of buffer size column in the Buffer Menu."
:type 'number
:type 'natnum
:group 'Buffer-menu
:version "24.3")
(defcustom Buffer-menu-mode-width 16
"Width of mode name column in the Buffer Menu."
:type 'number
:type 'natnum
:group 'Buffer-menu)
(defcustom Buffer-menu-use-frame-buffer-list t

View file

@ -412,7 +412,7 @@ and deleted by `calc-pop'."
(defcustom calc-undo-length 100
"The number of undo steps that will be preserved when Calc is quit."
:type 'integer)
:type 'natnum)
(defcustom calc-highlight-selections-with-faces nil
"If non-nil, use a separate face to indicate selected sub-formulas.

View file

@ -211,7 +211,7 @@ If you change this variable directly (without using customize)
after starting `calendar', you should call `calendar-redraw' to
update the calendar display to reflect the change, otherwise
movement commands will not work correctly."
:type 'integer
:type 'natnum
;; Change the initialize so that if you reload calendar.el, it will not
;; cause a redraw.
:initialize 'custom-initialize-default
@ -511,7 +511,7 @@ Then redraw the calendar, if necessary."
:initialize #'custom-initialize-default
:set (lambda (sym val)
(calendar-set-layout-variable sym val 1))
:type 'integer
:type 'natnum
:version "23.1")
;; FIXME calendar-month-column-width?
@ -520,7 +520,7 @@ Then redraw the calendar, if necessary."
:initialize #'custom-initialize-default
:set (lambda (sym val)
(calendar-set-layout-variable sym val 3))
:type 'integer
:type 'natnum
:version "23.1")
(defun calendar-day-header-construct (&optional width)
@ -553,7 +553,7 @@ Must be at least one less than `calendar-column-width'."
:initialize #'custom-initialize-default
:set (lambda (sym val)
(calendar-set-layout-variable sym val 2))
:type 'integer
:type 'natnum
:version "23.1")
(defcustom calendar-intermonth-header nil

View file

@ -86,7 +86,7 @@
(defcustom timeclock-workday (* 8 60 60)
"The length of a work period in seconds."
:type 'integer)
:type 'natnum)
(defvar timeclock--previous-workday nil)

View file

@ -330,12 +330,12 @@ This variable is buffer-local in all Comint buffers."
"The maximum size in lines for Comint buffers.
Comint buffers are truncated from the top to be no greater than this number, if
the function `comint-truncate-buffer' is on `comint-output-filter-functions'."
:type 'integer
:type 'natnum
:group 'comint)
(defcustom comint-input-ring-size 500
"Size of the input history ring in `comint-mode'."
:type 'integer
:type 'natnum
:group 'comint
:version "23.2")

View file

@ -225,7 +225,7 @@ are available (see Info node `(emacs)Document View')"
(defcustom doc-view-resolution 100
"Dots per inch resolution used to render the documents.
Higher values result in larger images."
:type 'number)
:type 'natnum)
(defvar doc-view-doc-type nil
"The type of document in the current buffer.
@ -301,7 +301,7 @@ scaling."
Has only an effect if `doc-view-scale-internally' is non-nil and support for
scaling is compiled into Emacs."
:version "24.1"
:type 'number)
:type 'natnum)
(defcustom doc-view-dvipdfm-program "dvipdfm"
"Program to convert DVI files to PDF.

View file

@ -1725,8 +1725,8 @@ The byte-compiler will emit a warning for documentation strings
containing lines wider than this. If `fill-column' has a larger
value, it will override this variable."
:group 'bytecomp
:type 'integer
:safe #'integerp
:type 'natnum
:safe #'natnump
:version "28.1")
(define-obsolete-function-alias 'byte-compile-docstring-length-warn

View file

@ -63,7 +63,7 @@ This is intended for debugging the compiler itself.
2 emit debug symbols and dump pseudo C code.
3 emit debug symbols and dump: pseudo C code, GCC intermediate
passes and libgccjit log file."
:type 'integer
:type 'natnum
:safe #'natnump
:version "28.1")
@ -74,7 +74,7 @@ This is intended for debugging the compiler itself.
1 final LIMPLE is logged.
2 LAP, final LIMPLE, and some pass info are logged.
3 max verbosity."
:type 'integer
:type 'natnum
:risky t
:version "28.1")
@ -111,7 +111,7 @@ during bootstrap."
"Default number of subprocesses used for async native compilation.
Value of zero means to use half the number of the CPU's execution units,
or one if there's just one execution unit."
:type 'integer
:type 'natnum
:risky t
:version "28.1")

View file

@ -418,22 +418,22 @@ synchronously."
(defcustom package-name-column-width 30
"Column width for the Package name in the package menu."
:type 'number
:type 'natnum
:version "28.1")
(defcustom package-version-column-width 14
"Column width for the Package version in the package menu."
:type 'number
:type 'natnum
:version "28.1")
(defcustom package-status-column-width 12
"Column width for the Package status in the package menu."
:type 'number
:type 'natnum
:version "28.1")
(defcustom package-archive-column-width 8
"Column width for the Package archive in the package menu."
:type 'number
:type 'natnum
:version "28.1")

View file

@ -146,7 +146,7 @@ See variable `eshell-scroll-to-bottom-on-output' and function
Eshell buffers are truncated from the top to be no greater than this
number, if the function `eshell-truncate-buffer' is on
`eshell-output-filter-functions'."
:type 'integer)
:type 'natnum)
(defcustom eshell-output-filter-functions
'(eshell-postoutput-scroll-to-bottom

View file

@ -2841,7 +2841,7 @@ Values smaller than 0.2 sec are treated as 0.2 sec."
"How many times to blink before using a solid cursor on NS, X, and MS-Windows.
Use 0 or negative value to blink forever."
:version "24.4"
:type 'integer
:type 'natnum
:group 'cursor)
(defvar blink-cursor-blinks-done 1

View file

@ -260,7 +260,7 @@ This only has an effect if `Info-hide-note-references' is non-nil."
"Depth of breadcrumbs to display.
0 means do not display breadcrumbs."
:version "23.1"
:type 'integer)
:type 'natnum)
(defcustom Info-search-whitespace-regexp "\\s-+"
"If non-nil, regular expression to match a sequence of whitespace chars.

View file

@ -51,7 +51,7 @@ This variable controls both `display-time' and stealth fontification.
The optimum value is a little over the typical number of buffer
characters which fit in a typical window."
:type 'integer)
:type 'natnum)
(defcustom jit-lock-stealth-time nil

View file

@ -129,7 +129,7 @@ Set to nil if no mouse binding is desired."
(defcustom kmacro-ring-max 8
"Maximum number of keyboard macros to save in macro ring."
:type 'integer)
:type 'natnum)
(defcustom kmacro-execute-before-append t

View file

@ -2194,12 +2194,12 @@ otherwise it could decide to silently do nothing."
(defcustom yank-menu-length 20
"Text of items in `yank-menu' longer than this will be truncated."
:type 'integer
:type 'natnum
:group 'menu)
(defcustom yank-menu-max-items 60
"Maximum number of entries to display in the `yank-menu'."
:type 'integer
:type 'natnum
:group 'menu
:version "29.1")

View file

@ -67,14 +67,14 @@ The autokilling is done by `clean-buffer-list' when it is in `midnight-hook'.
Currently displayed and/or modified (unsaved) buffers, as well as buffers
matching `clean-buffer-list-kill-never-buffer-names' and
`clean-buffer-list-kill-never-regexps' are excluded."
:type 'integer)
:type 'natnum)
(defcustom clean-buffer-list-delay-special 3600
"The number of seconds before some buffers become eligible for autokilling.
Buffers matched by `clean-buffer-list-kill-regexps' and
`clean-buffer-list-kill-buffer-names' are killed if they were last
displayed more than this many seconds ago."
:type 'integer)
:type 'natnum)
(defcustom clean-buffer-list-kill-regexps '("\\`\\*Man ")
"List of regexps saying which buffers will be killed at midnight.

View file

@ -89,7 +89,7 @@ You can specify here:
This port is probably always 2628 so there should be no need to modify it."
:group 'dictionary
:set #'dictionary-set-server-var
:type 'number
:type 'natnum
:version "28.1")
(defcustom dictionary-identification
@ -206,7 +206,7 @@ where the current word was found."
"The port of the proxy server, used only when `dictionary-use-http-proxy' is set."
:group 'dictionary-proxy
:set #'dictionary-set-server-var
:type 'number
:type 'natnum
:version "28.1")
(defcustom dictionary-use-single-buffer

View file

@ -54,7 +54,7 @@ a separator."
Initialized from the LDAP library at build time.
Default value is 389."
:type '(choice (const :tag "Use library default" nil)
(integer :tag "Port number")))
(natnum :tag "Port number")))
(defcustom ldap-default-base nil
"Default base for LDAP searches.

View file

@ -59,7 +59,7 @@
(defcustom pop3-port 110
"POP3 port."
:version "22.1" ;; Oort Gnus
:type 'number
:type 'natnum
:group 'pop3)
(defcustom pop3-password-required t
@ -88,7 +88,7 @@ valid value is `apop'."
The lower the number, the more latency-sensitive the fetching
will be. If your pop3 server doesn't support streaming at all,
set this to 1."
:type 'number
:type 'natnum
:version "24.1"
:group 'pop3)

View file

@ -130,7 +130,7 @@ be displayed instead."
(defcustom rcirc-default-port 6667
"The default port to connect to."
:type 'integer)
:type 'natnum)
(defcustom rcirc-default-nick (user-login-name)
"Your nick."

View file

@ -131,7 +131,7 @@ for doing the actual authentication."
(defcustom sieve-manage-default-port "sieve"
"Default port number or service name for managesieve protocol."
:type '(choice integer string)
:type '(choice natnum string)
:version "24.4")
(defcustom sieve-manage-default-stream 'network

View file

@ -49,7 +49,7 @@
(defcustom spook-phrase-default-count 15
"Default number of phrases to insert."
:type 'integer)
:type 'natnum)
;;;###autoload
(defun spook ()

View file

@ -95,27 +95,27 @@ If the return value is a number, it is used as the timer period."
(defcustom tetris-buffer-width 30
"Width of used portion of buffer."
:type 'number)
:type 'natnum)
(defcustom tetris-buffer-height 22
"Height of used portion of buffer."
:type 'number)
:type 'natnum)
(defcustom tetris-width 10
"Width of playing area."
:type 'number)
:type 'natnum)
(defcustom tetris-height 20
"Height of playing area."
:type 'number)
:type 'natnum)
(defcustom tetris-top-left-x 3
"X position of top left of playing area."
:type 'number)
:type 'natnum)
(defcustom tetris-top-left-y 1
"Y position of top left of playing area."
:type 'number)
:type 'natnum)
(defcustom tetris-allow-repetitions t
"If non-nil, use a random selection for each shape.

View file

@ -38,7 +38,7 @@
(defcustom profiler-sampling-interval 1000000
"Default sampling interval in nanoseconds."
:type 'integer
:type 'natnum
:group 'profiler)

View file

@ -274,8 +274,8 @@ file. Since that is a plaintext file, this could be dangerous."
(defcustom sql-port 0
"Default port for connecting to a MySQL or Postgres server."
:version "24.1"
:type 'number
:safe 'numberp)
:type 'natnum
:safe 'natnump)
(defcustom sql-default-directory nil
"Default directory for SQL processes."

View file

@ -178,7 +178,7 @@ The default is to call `find-file' to edit the selected file."
(defcustom recentf-max-menu-items 10
"Maximum number of items in the recentf menu."
:group 'recentf
:type 'integer)
:type 'natnum)
(defcustom recentf-menu-filter nil
"Function used to filter files displayed in the recentf menu.

View file

@ -97,7 +97,8 @@ This is decimal, not octal. The default is 384 (0600 in octal).
Set to nil to use the default permissions that Emacs uses, typically
mandated by umask. The default is a bit more restrictive to protect
the user's privacy."
:type 'integer)
:type '(choice (natnum :tag "Specify")
(const :tag "Use default" :value nil)))
(defcustom savehist-autosave-interval (* 5 60)
"The interval between autosaves of minibuffer history.

View file

@ -252,7 +252,7 @@ WARNING: Changing the value of this variable will gravely affect the
figure out what it should be based on your needs and on how
quick the particular platform(s) you're operating on, and
only then start programming in your custom strokes."
:type 'integer)
:type 'natnum)
(defcustom strokes-file (locate-user-emacs-file "strokes" ".strokes")
"File containing saved strokes for Strokes mode."

View file

@ -618,7 +618,7 @@ Also add the number of windows in the window configuration."
"Maximum length of the tab name from the current buffer.
Effective when `tab-bar-tab-name-function' is customized
to `tab-bar-tab-name-truncated'."
:type 'integer
:type 'natnum
:group 'tab-bar
:version "27.1")

View file

@ -66,7 +66,7 @@ If you select a region larger than this size, it won't be copied to your system
clipboard. Since clipboard data is base 64 encoded, the actual number of
string bytes that can be copied is 3/4 of this value."
:version "25.1"
:type 'integer)
:type 'natnum)
(defcustom xterm-set-window-title nil
"Whether Emacs should set window titles to an Emacs frame in an XTerm."

View file

@ -93,7 +93,7 @@ Non-nil means \\[display-time] should display day and date as well as time."
(defcustom display-time-interval 60
"Seconds between updates of time in the mode line."
:type 'integer)
:type 'natnum)
(defcustom display-time-24hr-format nil
"Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23.
@ -519,7 +519,7 @@ If the value is t instead of an alist, use the value of
(defcustom world-clock-timer-second 60
"Interval in seconds for updating the `world-clock' buffer."
:type 'integer
:type 'natnum
:version "28.1")
(defface world-clock-label

View file

@ -37,7 +37,7 @@
"Default maximum time in seconds before cache files expire.
Used by the function `url-cache-expired'."
:version "24.1"
:type 'integer
:type 'natnum
:group 'url-cache)
;; Cache manager

View file

@ -360,7 +360,7 @@ to run the `url-cookie-setup-save-timer' function manually."
(set-default var val)
(if (bound-and-true-p url-setup-done)
(url-cookie-setup-save-timer)))
:type 'integer
:type 'natnum
:group 'url-cookie)
(defun url-cookie-setup-save-timer ()

View file

@ -63,7 +63,7 @@ to run the `url-history-setup-save-timer' function manually."
(set-default var val)
(if (bound-and-true-p url-setup-done)
(url-history-setup-save-timer)))
:type 'integer
:type 'natnum
:group 'url-history)
(defvar url-history-timer nil)

View file

@ -36,13 +36,13 @@
(defcustom url-queue-parallel-processes 6
"The number of concurrent processes."
:version "24.1"
:type 'integer
:type 'natnum
:group 'url)
(defcustom url-queue-timeout 5
"How long to let a job live once it's started (in seconds)."
:version "24.1"
:type 'integer
:type 'natnum
:group 'url)
;;; Internal variables.

View file

@ -297,7 +297,7 @@ get the first available language (as opposed to the default)."
(defcustom url-max-password-attempts 5
"Maximum number of times a password will be prompted for.
Applies when a protected document is denied by the server."
:type 'integer
:type 'natnum
:group 'url)
(defcustom url-show-status t
@ -330,7 +330,7 @@ undefined."
(defcustom url-max-redirections 30
"The maximum number of redirection requests to honor in a HTTP connection.
A negative number means to honor an unlimited number of redirection requests."
:type 'integer
:type 'natnum
:group 'url)
(defcustom url-confirmation-func 'y-or-n-p

View file

@ -221,7 +221,7 @@ depend on the flags."
(defcustom emerge-min-visible-lines 3
"Number of lines to show above and below the flags when displaying a difference."
:type 'integer)
:type 'natnum)
(defcustom emerge-temp-file-prefix
(expand-file-name "emerge" temporary-file-directory)

View file

@ -824,7 +824,7 @@ for the backend you use."
"Limit the number of items shown by the VC log commands.
Zero means unlimited.
Not all VC backends are able to support this feature."
:type 'integer)
:type 'natnum)
(defcustom vc-allow-async-revert nil
"Specifies whether the diff during \\[vc-revert] may be asynchronous.

View file

@ -451,7 +451,7 @@ window to a height less than the one specified here, an
application should instead call `window-resize' with a non-nil
IGNORE argument. In order to have `split-window' make a window
shorter, explicitly specify the SIZE argument of that function."
:type 'integer
:type 'natnum
:version "24.1"
:group 'windows)
@ -483,7 +483,7 @@ window to a width less than the one specified here, an
application should instead call `window-resize' with a non-nil
IGNORE argument. In order to have `split-window' make a window
narrower, explicitly specify the SIZE argument of that function."
:type 'integer
:type 'natnum
:version "24.1"
:group 'windows)

View file

@ -50,7 +50,7 @@
(defcustom winner-ring-size 200
"Maximum number of stored window configurations per frame."
:type 'integer)
:type 'natnum)
(defcustom winner-boring-buffers '("*Completions*")
"List of buffer names whose windows `winner-undo' will not restore.