Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Created March 11, 2015 11:50
Show Gist options
  • Save xuchunyang/f4964e57ba90801da77b to your computer and use it in GitHub Desktop.
Save xuchunyang/f4964e57ba90801da77b to your computer and use it in GitHub Desktop.
elisp-learn-eieio-1.el
(defclass record () ; No superclasses
((name :initarg :name
:initform ""
:type string
:custom string
:documentation "The name of a person.")
(birthday :initarg :birthday
:initform "Jan 1, 1970"
:custom string
:type string
:documentation "The person's birthday.")
(phone :initarg :phone
:initform ""
:documentation "Phone number."))
"A single record for tracking pepole I know.")
(setq rec (record "Eric" :name "Eric" :birthday "June" :phone "1234-2222"))
(defmethod call-record ((rec record) &optional scriptname)
"Dial the phone for the record REC.
Execute the program SCRIPTNAME to dial the phone."
(message "Dialing the phone for %s" (oref rec name)))
(call-record rec)
(call-record emacs-version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment