Function: cvs-flags-query

cvs-flags-query is a byte-compiled function defined in pcvs-util.el.gz.

Signature

(cvs-flags-query SYM &optional DESC ARG)

Documentation

Query flags based on SYM.

Optional argument DESC will be used for the prompt. If ARG (or a prefix argument) is nil, just use the 0th default. If it is a non-negative integer, use the corresponding default. If it is a negative integer, query for a new value of the corresponding
  default and return that new value.
If it is C-u (universal-argument), just query and return a value without
  altering the defaults.
If it is C-u (universal-argument) C-u (universal-argument), behave just
  as if a negative zero was provided.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs-util.el.gz
(defun cvs-flags-query (sym &optional desc arg)
  "Query flags based on SYM.
Optional argument DESC will be used for the prompt.
If ARG (or a prefix argument) is nil, just use the 0th default.
If it is a non-negative integer, use the corresponding default.
If it is a negative integer, query for a new value of the corresponding
  default and return that new value.
If it is \\[universal-argument], just query and return a value without
  altering the defaults.
If it is \\[universal-argument] \\[universal-argument], behave just
  as if a negative zero was provided."
  (let* ((flags (symbol-value sym))
	 (desc (or desc (cvs-flags-desc flags)))
	 (qtypedesc (cvs-flags-qtypedesc flags))
	 (hist-sym (cvs-flags-hist-sym flags))
	 (arg (if (eq arg 'noquery) 0 (or arg current-prefix-arg 0)))
	 (numarg (prefix-numeric-value arg))
	 (defaults (cvs-flags-defaults flags))
	 (permstr (if (< numarg 0) (format " (%sth default)" (- numarg)))))
    ;; special case for universal-argument
    (when (consp arg)
      (setq permstr (if (> numarg 4) " (permanent)" ""))
      (setq numarg 0))

    ;; sanity check
    (unless (< (abs numarg) (length defaults))
      (error "There is no %sth default" (abs numarg)))

    (if permstr
	(let* ((prompt (format "%s%s: " desc permstr))
	       (fs (cvs-query-read (nth (- numarg) (cvs-flags-defaults flags))
				   prompt qtypedesc hist-sym)))
	  (when (not (equal permstr ""))
	    (setf (nth (- numarg) (cvs-flags-defaults flags)) fs))
	  fs)
      (nth numarg defaults))))