Function: ps-print-quote

ps-print-quote is a byte-compiled function defined in ps-print.el.gz.

Signature

(ps-print-quote ELT)

Documentation

Quote ELT for printing (used for showing settings).

If ELT is nil, return an empty string. If ELT is string, return it. Otherwise, ELT should be a cons (LEN . SYM) where SYM is a variable symbol and LEN is the field length where SYM name will be inserted. The variable ps-prefix-quote is used to form the string, if ps-prefix-quote is nil, it's
used "(setq " as prefix; otherwise, it's used " ". So, the string
generated is:

   * If ps-prefix-quote is nil:
      "(setq SYM-NAME SYM-VALUE"
|<------->|
LEN

   * If ps-prefix-quote is non-nil:
      " SYM-NAME SYM-VALUE"
|<------->|
LEN

If ps-prefix-quote is nil, it's set to t after generating string.

Source Code

;; Defined in /usr/src/emacs/lisp/ps-print.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Utility functions and variables:


(defun ps-print-quote (elt)
  "Quote ELT for printing (used for showing settings).

If ELT is nil, return an empty string.
If ELT is string, return it.
Otherwise, ELT should be a cons (LEN . SYM) where SYM is a variable symbol and
LEN is the field length where SYM name will be inserted.  The variable
`ps-prefix-quote' is used to form the string, if `ps-prefix-quote' is nil, it's
used \"(setq \" as prefix; otherwise, it's used \"      \".  So, the string
generated is:

   * If `ps-prefix-quote' is nil:
      \"(setq SYM-NAME   SYM-VALUE\"
	     |<------->|
		 LEN

   * If `ps-prefix-quote' is non-nil:
      \"      SYM-NAME   SYM-VALUE\"
	     |<------->|
		 LEN

If `ps-prefix-quote' is nil, it's set to t after generating string."
  (cond
   ((stringp elt) elt)
   ((and (consp elt) (integerp (car elt))
	 (symbolp (cdr elt)) (boundp (cdr elt)))
    (let* ((col (car elt))
	   (sym (cdr elt))
	   (key (symbol-name sym))
	   (len (length key))
	   (val (symbol-value sym)))
      (concat (if ps-prefix-quote
		  "      "
		(setq ps-prefix-quote t)
		"(setq ")
	      key
	      (if (> col len)
		  (make-string (- col len) ?\s)
		" ")
	      (ps-value-string val))))
   (t "")
   ))