Function: robin-define-package

robin-define-package is an autoloaded macro defined in robin.el.gz.

Signature

(robin-define-package NAME DOCSTRING &rest RULES)

Documentation

Define a robin package.

NAME is the string of this robin package. DOCSTRING is the documentation string of this robin package. Each RULE is of the form (INPUT OUTPUT) where INPUT is a string and OUTPUT is either a character or a string. RULES are not evaluated.

If there already exists a robin package whose name is NAME, the new one replaces the old one.

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/international/robin.el.gz
;;;###autoload
(defmacro robin-define-package (name docstring &rest rules)
  "Define a robin package.

NAME is the string of this robin package.
DOCSTRING is the documentation string of this robin package.
Each RULE is of the form (INPUT OUTPUT) where INPUT is a string and
OUTPUT is either a character or a string.  RULES are not evaluated.

If there already exists a robin package whose name is NAME, the new
one replaces the old one."

  (let ((iname (intern name))
	(new (list name ""))		; "" as a fake output
	input output pairs)
    (dolist (r rules)
      (setq input (car r)
	    output (cadr r))
      (robin-add-rule name new input output)
      (cond
       ((not (stringp input))
	(error "Bad input sequence %S" r))
       ((characterp output)
	(setq pairs
	      (cons (cons input output)
		    pairs)))
       ((not (stringp output))
	(error "Bad output pattern %S" r))))
    (setcar (cdr new) docstring)	; replace "" above with real docstring
    `(let ((slot (assoc ,name robin-package-alist))
	   (newdef ',new)
	   (prop ',iname)
	   (lst ',pairs))
       (if slot
	   (setcdr slot (cdr newdef))
	 (setq robin-package-alist
	       (cons newdef robin-package-alist)))
       (dolist (l lst)
	 (put-char-code-property (cdr l) prop (car l))))))