Function: erc-cmd-SET

erc-cmd-SET is a byte-compiled function defined in erc.el.gz.

Signature

(erc-cmd-SET LINE)

Documentation

Set the variable named by the first word in LINE to some VALUE.

VALUE is computed by evaluating the rest of LINE in Lisp.

Aliases

erc-cmd-VAR erc-cmd-VARIABLE

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-SET (line)
  "Set the variable named by the first word in LINE to some VALUE.
VALUE is computed by evaluating the rest of LINE in Lisp."
  (cond
   ((string-match "^\\s-*\\(\\S-+\\)\\s-+\\(.*\\)$" line)
    (let ((var (read (concat "erc-" (match-string 1 line))))
          (val (read (match-string 2 line))))
      (if (boundp var)
          (progn
            (set var (eval val t))
            (erc-display-message
             nil nil 'active (format "Set %S to %S" var val))
            t)
        (setq var (read (match-string 1 line)))
        (if (boundp var)
            (progn
              (set var (eval val t))
              (erc-display-message
               nil nil 'active (format "Set %S to %S" var val))
              t)
          (erc-display-message nil 'error 'active 'variable-not-bound)
          nil))))
   ((string-match "^\\s-*$" line)
    (erc-display-line
     (concat "Available user variables:\n"
             (apply
              #'concat
              (mapcar
               (lambda (var)
                 (let ((val (symbol-value var)))
                   (concat (format "%S:" var)
                           (if (consp val)
                               (concat "\n" (pp-to-string val))
                             (format " %S\n" val)))))
               (apropos-internal "^erc-" 'custom-variable-p))))
     (current-buffer))
    t)
   (t nil)))