GNU bug report logs - #26910
26.0.50; Enhancement request: type-checking in customize-set-variable

Previous Next

Package: emacs;

Reported by: "N. Raghavendra" <raghu <at> hri.res.in>

Date: Sat, 13 May 2017 16:38:02 UTC

Severity: wishlist

Found in version 26.0.50

To reply to this bug, email your comments to 26910 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26910; Package emacs. (Sat, 13 May 2017 16:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "N. Raghavendra" <raghu <at> hri.res.in>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 13 May 2017 16:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "N. Raghavendra" <raghu <at> hri.res.in>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Enhancement request: type-checking in customize-set-variable
Date: Sat, 13 May 2017 14:52:57 +0530
I would like a way to set options using Emacs Lisp directly (without
interacting with customization buffers), which ensures that the :set and
:type specifications of the options are respected.  Evaluating

(customize-set-variable OPTION VALUE)

uses the :set property of OPTION, but doesn't check that VALUE has the
type specified in the

(defcustom OPTION ...)

expression.

I request the addition of an optional argument to customize-set-variable,
so that, e.g.,

(customize-set-variable OPTION VALUE "This is a comment." t)

generates an error if VALUE is not of the type specified by

(defcustom OPTION ...),

and otherwise does everything that

(customize-set-variable OPTION VALUE "This is a comment.")

does now.  I also request a similar addition to `custom-set-variables'.

----------------------------------------------------------------------

In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-01-22 built on ailuros
Repository revision: 0a49f158f1598fb92989f3cbdc238a7e5f1bd8a3
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Linux Mint 18.1 Serena

Recent messages:
No new newsgroups
Checking new news...
nnimap read 0k from imap.gmail.com
Reading active file via nndraft...done
Checking new news...done
Configuring package gnus-topic...done
Opening nnimap server on gmail...done
nnimap read 0k from imap.gmail.com
Configuring package gnus-async...done
Configuring package sendmail...done

Configured using:
 'configure --prefix=/pkg/emacs --with-x --with-x-toolkit=gtk3
 --with-xft'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_IN
  locale-coding-system: iso-latin-1-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  pdf-occur-global-minor-mode: t
  delete-selection-mode: t
  override-global-mode: t
  helm-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/pkg/el-get/org-mode/lisp/ob-lilypond hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-lilypond
/pkg/el-get/org-mode/lisp/ob-ruby hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-ruby
/pkg/el-get/org-mode/lisp/org-footnote hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-footnote
/pkg/el-get/org-mode/lisp/ob-screen hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-screen
/pkg/el-get/org-mode/lisp/ob-asymptote hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-asymptote
/pkg/el-get/org-mode/lisp/ob-fortran hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-fortran
/pkg/el-get/org-mode/lisp/ox-ascii hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-ascii
/pkg/el-get/org-mode/lisp/org-timer hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-timer
/pkg/el-get/org-mode/lisp/org-faces hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-faces
/pkg/el-get/org-mode/lisp/ob-calc hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-calc
/pkg/el-get/org-mode/lisp/org-clock hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-clock
/pkg/el-get/org-mode/lisp/ob-java hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-java
/pkg/el-get/org-mode/lisp/ob-gnuplot hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-gnuplot
/pkg/el-get/org-mode/lisp/org-irc hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-irc
/pkg/el-get/org-mode/lisp/ob-makefile hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-makefile
/pkg/el-get/org-mode/lisp/ob-table hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-table
/pkg/el-get/org-mode/lisp/ob-exp hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-exp
/pkg/el-get/org-mode/lisp/ob-plantuml hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-plantuml
/pkg/el-get/org-mode/lisp/org-mouse hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-mouse
/pkg/el-get/org-mode/lisp/ob-scheme hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-scheme
/pkg/el-get/org-mode/lisp/org-crypt hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-crypt
/pkg/el-get/org-mode/lisp/ob-dot hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-dot
/pkg/el-get/org-mode/lisp/ob-ledger hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-ledger
/pkg/el-get/org-mode/lisp/ox-md hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-md
/pkg/el-get/org-mode/lisp/ob-core hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-core
/pkg/el-get/org-mode/lisp/org-indent hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-indent
/pkg/el-get/org-mode/lisp/ob-awk hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-awk
/pkg/el-get/org-mode/lisp/ob-scala hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-scala
/pkg/el-get/org-mode/lisp/ob-R hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-R
/pkg/el-get/org-mode/lisp/org-agenda hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-agenda
/pkg/el-get/org-mode/lisp/org-id hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-id
/pkg/el-get/org-mode/lisp/org-bibtex hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-bibtex
/pkg/el-get/org-mode/lisp/ob-css hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-css
/pkg/el-get/org-mode/lisp/ob-shen hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-shen
/pkg/el-get/org-mode/lisp/org-attach hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-attach
/pkg/el-get/org-mode/lisp/org-colview hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-colview
/pkg/el-get/org-mode/lisp/org hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org
/pkg/el-get/org-mode/lisp/ob-keys hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-keys
/pkg/el-get/org-mode/lisp/ox-icalendar hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-icalendar
/pkg/el-get/org-mode/lisp/ob-ref hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-ref
/pkg/el-get/org-mode/lisp/org-feed hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-feed
/pkg/el-get/org-mode/lisp/ob-latex hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-latex
/pkg/el-get/org-mode/lisp/ob hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob
/pkg/el-get/org-mode/lisp/ox-odt hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-odt
/pkg/el-get/org-mode/lisp/ob-haskell hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-haskell
/pkg/el-get/org-mode/lisp/org-docview hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-docview
/pkg/el-get/org-mode/lisp/ob-lisp hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-lisp
/pkg/el-get/org-mode/lisp/org-table hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-table
/pkg/el-get/org-mode/lisp/ob-io hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-io
/pkg/el-get/org-mode/lisp/ob-eval hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-eval
/pkg/el-get/org-mode/lisp/ob-sass hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-sass
/pkg/el-get/org-mode/lisp/ob-org hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-org
/pkg/el-get/org-mode/lisp/org-list hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-list
/pkg/el-get/org-mode/lisp/ob-lob hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-lob
/pkg/el-get/org-mode/lisp/org-bbdb hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-bbdb
/pkg/el-get/org-mode/lisp/org-inlinetask hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-inlinetask
/pkg/el-get/org-mode/lisp/ob-C hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-C
/pkg/el-get/org-mode/lisp/org-compat hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-compat
/pkg/el-get/org-mode/lisp/ob-matlab hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-matlab
/pkg/el-get/org-mode/lisp/org-info hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-info
/pkg/el-get/org-mode/lisp/ob-clojure hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-clojure
/pkg/el-get/org-mode/lisp/ob-emacs-lisp hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-emacs-lisp
/pkg/el-get/org-mode/lisp/org-capture hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-capture
/pkg/el-get/org-mode/lisp/ox-beamer hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-beamer
/pkg/el-get/org-mode/lisp/ob-mscgen hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-mscgen
/pkg/el-get/org-mode/lisp/ob-comint hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-comint
/pkg/el-get/org-mode/lisp/ob-sqlite hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-sqlite
/pkg/el-get/org-mode/lisp/ob-octave hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-octave
/pkg/el-get/org-mode/lisp/org-macro hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-macro
/pkg/el-get/org-mode/lisp/ob-tangle hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-tangle
/pkg/el-get/org-mode/lisp/org-mobile hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-mobile
/pkg/el-get/org-mode/lisp/ob-picolisp hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-picolisp
/pkg/el-get/org-mode/lisp/ob-sql hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-sql
/pkg/el-get/org-mode/lisp/org-ctags hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-ctags
/pkg/el-get/org-mode/lisp/org-src hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-src
/pkg/el-get/org-mode/lisp/org-mhe hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-mhe
/pkg/el-get/org-mode/lisp/ox-texinfo hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-texinfo
/pkg/el-get/org-mode/lisp/ox-html hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-html
/pkg/el-get/org-mode/lisp/org-rmail hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-rmail
/pkg/el-get/org-mode/lisp/ob-ditaa hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-ditaa
/pkg/el-get/org-mode/lisp/org-loaddefs hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-loaddefs
/pkg/el-get/org-mode/lisp/org-protocol hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-protocol
/pkg/el-get/org-mode/lisp/org-datetree hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-datetree
/pkg/el-get/org-mode/lisp/org-pcomplete hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-pcomplete
/pkg/el-get/org-mode/lisp/org-habit hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-habit
/pkg/el-get/org-mode/lisp/ox-man hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-man
/pkg/el-get/org-mode/lisp/ox-publish hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-publish
/pkg/el-get/org-mode/lisp/ox-org hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-org
/pkg/el-get/org-mode/lisp/ox hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox
/pkg/el-get/org-mode/lisp/ob-maxima hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-maxima
/pkg/el-get/org-mode/lisp/org-gnus hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-gnus
/pkg/el-get/org-mode/lisp/ox-latex hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ox-latex
/pkg/el-get/org-mode/lisp/org-archive hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-archive
/pkg/el-get/org-mode/lisp/org-entities hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-entities
/pkg/el-get/org-mode/lisp/ob-perl hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-perl
/pkg/el-get/org-mode/lisp/ob-js hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-js
/pkg/el-get/org-mode/lisp/org-plot hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-plot
/pkg/el-get/org-mode/lisp/ob-ocaml hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-ocaml
/pkg/el-get/org-mode/lisp/org-macs hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-macs
/pkg/el-get/org-mode/lisp/org-element hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-element
/pkg/el-get/org-mode/lisp/org-eshell hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-eshell
/pkg/el-get/org-mode/lisp/org-version hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-version
/pkg/el-get/org-mode/lisp/ob-python hides /pkg/emacs/share/emacs/26.0.50/lisp/org/ob-python
/pkg/el-get/org-mode/lisp/org-install hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-install
/pkg/el-get/org-mode/lisp/org-w3m hides /pkg/emacs/share/emacs/26.0.50/lisp/org/org-w3m

Features:
(shadow gnus-cite flyspell ispell mail-extr nnir emacsbug sendmail
gnus-async gnus-ml gnus-topic nndraft nnmh utf-7 gnus-demon
my-ypldap-org-contacts my-ypldap-org-contacts-helper org-contacts
org-capture org-agenda network-stream nsm starttls gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view
mml-smime smime dig nntp gnus-cache gnus-sum gnus-group gnus-undo
my-gnus-init.el offlineimap gnus-start gnus-cloud nnimap nnmail
mail-source tls gnutls utf7 netrc nnoo gnus-spec gnus-int gnus-range
message puny rfc822 mml mml-sec epa derived epg mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils winner helm-command helm-elisp helm-eval edebug server
my-init.el my-whitespace whitespace my-vc my-uniquify my-tramp
my-tool-bar my-tex my-tex-site my-tex-buf my-simple my-sh-script
my-sendmail my-reftex my-proof-useropts my-plain-tex my-pg-custom
my-pdf-view my-pdf-tools pdf-occur ibuf-ext ibuffer ibuffer-loaddefs
tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
let-alist pdf-misc imenu pdf-tools pdf-view jka-compr pdf-cache pdf-info
pdf-util my-ox ox-odt rng-loc rng-uri rng-parse rng-match rng-dt
rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar ox-html table ox-ascii ox-publish ox org-element avl-tree
org org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-comint find-func cal-menu calendar
cal-loaddefs ob-exp ob-core org-compat ob-eval org-macs my-ox-publish
my-time my-ox-html my-org my-org-contacts my-org-capture my-org-agenda
my-dired-some-files my-offlineimap my-nnml my-nnmail my-nnir my-nnfolder
mm-util mail-prsvr my-base-feature my-nadvice my-my-ypldap-org-contacts
my-my-time my-my-el-get-port my-el-get-port my-my-bibtex-file-field
my-my-bibtex-clean agda-input quail my-my-base-feature my-mouse
my-mm-decode my-message my-menu-bar my-mailcap my-macrostep my-latex
my-ispell my-info my-helm my-helm-mode my-helm-lib my-helm-files
my-helm-dabbrev my-helm-config my-helm-command my-helm-buffers my-gnutls
my-gnus my-gnus-topic my-gnus-sum my-gnus-start my-gnus-msg
my-gnus-group my-gnus-dired my-gnus-demon my-gnus-async my-gnus-art
my-frame my-font-lock my-font-core my-flyspell my-files my-faces
my-emms-source-file my-emms-setup emms-librefm-stream
emms-librefm-scrobbler emms-playlist-limit emms-volume
emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd tq emms-playing-time emms-lyrics emms-url time-date
emms-streams emms-show-all emms-tag-editor emms-mark emms-mode-line
emms-cache emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-player-vlc emms-player-mplayer
emms-player-simple emms-source-playlist emms-source-file locate
my-elisp-mode my-diminish my-delsel delsel my-cus-edit cus-edit
cus-start cus-load wid-edit my-coq my-coq-system my-compile
my-company-coq my-bibtex my-agda-input my-use-package use-package
bind-key my-el-get org-loaddefs helm-mode helm-files rx image-dired
image-mode tramp tramp-compat tramp-loaddefs trampver ucs-normalize
shell pcomplete parse-time format-spec dired-x dired-aux ffap thingatpt
helm-buffers helm-elscreen helm-tags helm-bookmark helm-adaptive
helm-info info bookmark helm-locate helm-grep helm-regexp helm-external
helm-net browse-url xml helm-utils compile comint ansi-color ring
helm-help helm-types helm easy-mmode helm-source eieio-compat
helm-multi-match helm-lib advice helm-config helm-easymenu edmacro
kmacro helm-autoloads emms-setup emms emms-compat diminish proof-site
proof-autoloads pg-vars preview-latex tex-site auto-loads .loaddefs
el-get-bundle el-get el-get-autoloading el-get-list-packages
el-get-dependencies el-get-build el-get-status pp el-get-methods
el-get-fossil el-get-svn el-get-pacman el-get-github-zip
el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go
el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify
el-get-emacsmirror el-get-github el-get-git el-get-elpa el-get-darcs
el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get
el-get-recipes el-get-byte-compile subr-x el-get-custom el-get-core
autoload radix-tree lisp-mnt cl dired dired-loaddefs my-system url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap finder-inf package epg-config url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cl-extra
help-mode easymenu cconv cl-loaddefs pcase cl-lib disp-table mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 567283 26624)
 (symbols 48 51192 2)
 (miscs 40 131 303)
 (strings 32 133090 16113)
 (string-bytes 1 4369195)
 (vectors 16 76644)
 (vector-slots 8 1110642 10975)
 (floats 8 728 400)
 (intervals 56 923 8)
 (buffers 976 25)
 (heap 1024 71343 2610))

-- 
N. Raghavendra <raghu <at> hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26910; Package emacs. (Sat, 13 May 2017 17:51:01 GMT) Full text and rfc822 format available.

Message #8 received at 26910 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: "N. Raghavendra" <raghu <at> hri.res.in>, 26910 <at> debbugs.gnu.org
Subject: RE: bug#26910: 26.0.50; Enhancement request: type-checking in
 customize-set-variable
Date: Sat, 13 May 2017 10:50:44 -0700 (PDT)
> I request the addition of an optional argument to
> customize-set-variable, so that, e.g.,
> (customize-set-variable OPTION VALUE "This is a comment." t)
> generates an error if VALUE is not of the type specified by
> (defcustom OPTION ...),

+1

Should it raise an error or just show a message and be ignored
(not set the value)?

How about having the new optional argument specify the behavior?

Non-nil means type-check.  The particular non-nil value:

 * `no-error' means if type-check fails just show a message (and
   do not set value).
 * any other non-nil value means raise an error

(defun customize-set-variable (variable value &optional comment type-checking)
  "...
Non-nil optional arg TYPE-CHECKING means type-check VALUE and
set the option value only if the type is appropriate.

If TYPE-CHECKING is `no-error' then display a message about the
incorrect type, but do not raise an error.  Any other non-nil
value means raise an error."

...)

> and otherwise does everything that
> (customize-set-variable OPTION VALUE "This is a comment.")
> does now.

Sounds good to me.

> I also request a similar addition to `custom-set-variables'.

I think this one is impossible, since `custom-set-variables' has
only an &rest parameter: the args are not wrapped in an explicit
list.  We cannot add an optional parameter after the &rest parameter.

In addition, `custom-set-variables' accepts an _expression_,
without evaluating it (by default) for each variable.  Unless
the optional NOW element is present - in that case we could
type-check the resulting value.

This also means that we would need to provide such control
separately for each variable passed to `custom-set-variables'.
We could do that by allowing NOW to take one or more special
non-nil values, to mean type-check after evaluating.  Probably
we would want to allow two such special type-checking values:

 If NOW is present and non-nil, then also evaluate EXP and set
 the default value for the SYMBOL to the value of EXP.  If NOW
 is the symbol `type-check' then raise an error if the result of
 evaluating EXP is not of an appropriate type.  If NOW is the
 symbol `type-check-no-error' then type-check the value of EXP
 but just show a message, instead of raising an error, when the
 value has an inappropriate type.

What about also having another function, similar to
`custom-set-variables', but which accepts an explicit list of
(SYMBOL EXP [NOW [REQUEST [COMMENT]]]) entries plus an optional
TYPE-CHECKING arg that has the effect of providing a default
type-checking behavior for all entries that have non-nil NOW.

Without non-nil arg TYPE-CHECKING it would behave just like
(apply 'custom-set-variables VARLIST), where VARLIST is the
explicit list of variable specs.

Maybe something like this:

(defun custom-set-varlist (varlist &optional type-checking)
  "Invoke `custom-set-variables' on the settings in list VARLIST.
Each such setting has the form of an argument acceptable to
`custom-set-variables'.

Non-nil optional arg TYPE-CHECKING means type-check each VARLIST
entry that has a non-nil NOW element, and set the option value
only if the type is appropriate.

The value of TYPE-CHECKING determines the default type-checking
behavior: a value of `no-error' means display messages about the
incorrect types, but do not raise an error.  Any other non-nil
value means raise an error.

The default type-checking behavior can be overridden for any
given variable by its NOW element.  If NOW is `type-check' or
`type-check-no-error' then it overrides the value of arg
TYPE-CHECKING for that variable.  If NOW is any other non-nil
value then the value of TYPE-CHECKING determines the behavior."

...)




This bug report was last modified 8 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.