Mercurial > emacs
annotate lisp/emacs-lisp/eieio-base.el @ 110682:ba6a1c230532
gnus-html.el (gnus-html-prefetch-images): Adjust regexp to avoid regexp backtrace overflows.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 01 Oct 2010 13:33:03 +0000 |
parents | 280c8ae2476d |
children | 417b1e4d63cd |
rev | line source |
---|---|
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; eieio-base.el --- Base classes for EIEIO. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;;; Copyright (C) 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010 |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Version: 0.2 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: OO, lisp |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106840
diff
changeset
|
9 ;; Package: eieio |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; (at your option) any later version. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;;; Commentary: |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; Base classes for EIEIO. These classes perform some basic tasks |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; but are generally useless on their own. To use any of these classes, |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; inherit from one or more of them. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;;; Code: |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'eieio) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;;; eieio-instance-inheritor |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; Enable instance inheritance via the `clone' method. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; Works by using the `slot-unbound' method which usually throws an |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; error if a slot is unbound. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (defclass eieio-instance-inheritor () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ((parent-instance :initarg :parent-instance |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 :type eieio-instance-inheritor-child |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 "The parent of this instance. |
105474 | 46 If a slot of this class is referenced, and is unbound, then the parent |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 is checked for a value.") |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 ) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 "This special class can enable instance inheritance. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 Use `clone' to make a new object that does instance inheritance from |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 a parent instance. When a slot in the child is referenced, and has |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 not been set, use values from the parent." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 :abstract t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (defmethod slot-unbound ((object eieio-instance-inheritor) class slot-name fn) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 "If a slot OBJECT in this CLASS is unbound, try to inherit, or throw a signal. |
105474 | 57 SLOT-NAME is the offending slot. FN is the function signalling the error." |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (if (slot-boundp object 'parent-instance) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 ;; It may not look like it, but this line recurses back into this |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;; method if the parent instance's slot is unbound. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (eieio-oref (oref object parent-instance) slot-name) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 ;; Throw the regular signal. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (call-next-method))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (defmethod clone ((obj eieio-instance-inheritor) &rest params) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 "Clone OBJ, initializing `:parent' to OBJ. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 All slots are unbound, except those initialized with PARAMS." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 (let ((nobj (make-vector (length obj) eieio-unbound)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (nm (aref obj object-name)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (passname (and params (stringp (car params)))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (num 1)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (aset nobj 0 'object) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (aset nobj object-class (aref obj object-class)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ;; The following was copied from the default clone. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (if (not passname) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (save-match-data |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (if (string-match "-\\([0-9]+\\)" nm) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (setq num (1+ (string-to-number (match-string 1 nm))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 nm (substring nm 0 (match-beginning 0)))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (aset nobj object-name (concat nm "-" (int-to-string num)))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (aset nobj object-name (car params))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 ;; Now initialize from params. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (if params (shared-initialize nobj (if passname (cdr params) params))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (oset nobj parent-instance obj) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 nobj)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (defmethod eieio-instance-inheritor-slot-boundp ((object eieio-instance-inheritor) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 slot) |
105474 | 89 "Return non-nil if the instance inheritor OBJECT's SLOT is bound. |
90 See `slot-boundp' for details on binding slots. | |
91 The instance inheritor uses unbound slots as a way of cascading cloned | |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 slot values, so testing for a slot being bound requires extra steps |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 for this kind of object." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (if (slot-boundp object slot) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ;; If it is regularly bound, return t. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 t |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (if (slot-boundp object 'parent-instance) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (eieio-instance-inheritor-slot-boundp (oref object parent-instance) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 slot) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 nil))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 ;;; eieio-instance-tracker |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ;; Track all created instances of this class. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ;; The class must initialize the `tracking-symbol' slot, and that |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 ;; symbol is then used to contain these objects. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (defclass eieio-instance-tracker () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ((tracking-symbol :type symbol |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 :allocation :class |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 "The symbol used to maintain a list of our instances. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 The instance list is treated as a variable, with new instances added to it.") |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 ) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 "This special class enables instance tracking. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 Inheritors from this class must overload `tracking-symbol' which is |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 a variable symbol used to store a list of all instances." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 :abstract t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (defmethod initialize-instance :AFTER ((this eieio-instance-tracker) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 &rest slots) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 "Make sure THIS is in our master list of this class. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 Optional argument SLOTS are the initialization arguments." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 ;; Theoretically, this is never called twice for a given instance. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (let ((sym (oref this tracking-symbol))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (if (not (memq this (symbol-value sym))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (set sym (append (symbol-value sym) (list this)))))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (defmethod delete-instance ((this eieio-instance-tracker)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 "Remove THIS from the master list of this class." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (set (oref this tracking-symbol) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (delq this (symbol-value (oref this tracking-symbol))))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; In retrospect, this is a silly function. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (defun eieio-instance-tracker-find (key slot list-symbol) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 "Find KEY as an element of SLOT in the objects in LIST-SYMBOL. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 Returns the first match." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (object-assoc key slot (symbol-value list-symbol))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;;; eieio-singleton |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 ;; The singleton Design Pattern specifies that there is but one object |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 ;; of a given class ever created. The EIEIO singleton base class defines |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;; a CLASS allocated slot which contains the instance used. All calls to |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ;; `make-instance' will either create a new instance and store it in this |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 ;; slot, or it will just return what is there. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (defclass eieio-singleton () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 ((singleton :type eieio-singleton |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 :allocation :class |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 "The only instance of this class that will be instantiated. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 Multiple calls to `make-instance' will return this object.")) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 "This special class causes subclasses to be singletons. |
106840
5df8e547a422
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
154 A singleton is a class which will only ever have one instance." |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 :abstract t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (defmethod constructor :STATIC ((class eieio-singleton) name &rest slots) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 "Constructor for singleton CLASS. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 NAME and SLOTS initialize the new object. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 This constructor guarantees that no matter how many you request, |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 only one object ever exists." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 ;; NOTE TO SELF: In next version, make `slot-boundp' support classes |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 ;; with class allocated slots or default values. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (let ((old (oref-default class singleton))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (if (eq old eieio-unbound) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (oset-default class singleton (call-next-method)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 old))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 ;;; eieio-persistent |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 ;; For objects which must save themselves to disk. Provides an |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 ;; `object-write' method to save an object to disk, and a |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 ;; `eieio-persistent-read' function to call to read an object |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 ;; from disk. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 ;; Also provide the method `eieio-persistent-path-relative' to |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 ;; calculate path names relative to a given instance. This will |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 ;; make the saved object location independent by converting all file |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 ;; references to be relative to the directory the object is saved to. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 ;; You must call `eieio-peristent-path-relative' on each file name |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 ;; saved in your object. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (defclass eieio-persistent () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 ((file :initarg :file |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 :type string |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 "The save file for this persistent object. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 This must be a string, and must be specified when the new object is |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 instantiated.") |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (extension :type string |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 :allocation :class |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 :initform ".eieio" |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 "Extension of files saved by this object. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 Enables auto-choosing nice file names based on name.") |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (file-header-line :type string |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 :allocation :class |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 :initform ";; EIEIO PERSISTENT OBJECT" |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 "Header line for the save file. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 This is used with the `object-write' method.") |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (do-backups :type boolean |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 :allocation :class |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 :initform t |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 :documentation |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 "Saving this object should make backup files. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 Setting to nil will mean no backups are made.")) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 "This special class enables persistence through save files |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 Use the `object-save' method to write this object to disk. The save |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 format is Emacs Lisp code which calls the constructor for the saved |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 object. For this reason, only slots which do not have an `:initarg' |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 specified will not be saved." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 :abstract t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (defmethod eieio-persistent-save-interactive ((this eieio-persistent) prompt |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 &optional name) |
105474 | 217 "Prepare to save THIS. Use in an `interactive' statement. |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 Query user for file name with PROMPT if THIS does not yet specify |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 a file. Optional argument NAME specifies a default file name." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (unless (slot-boundp this 'file) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (oset this file |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (read-file-name prompt nil |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (if name |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (concat name (oref this extension)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 )))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (oref this file)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (defun eieio-persistent-read (filename) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 "Read a persistent object from FILENAME, and return it." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (let ((ret nil) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (buffstr nil)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (unwind-protect |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (progn |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105652
diff
changeset
|
234 (with-current-buffer (get-buffer-create " *tmp eieio read*") |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (insert-file-contents filename nil nil nil t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (goto-char (point-min)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (setq buffstr (buffer-string))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ;; Do the read in the buffer the read was initialized from |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 ;; so that any initialize-instance calls that depend on |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 ;; the current buffer will work. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (setq ret (read buffstr)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (if (not (child-of-class-p (car ret) 'eieio-persistent)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (error "Corrupt object on disk")) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (setq ret (eval ret)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (oset ret file filename)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (kill-buffer " *tmp eieio read*")) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 ret)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (defmethod object-write ((this eieio-persistent) &optional comment) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 "Write persistent object THIS out to the current stream. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 Optional argument COMMENT is a header line comment." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (call-next-method this (or comment (oref this file-header-line)))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (defmethod eieio-persistent-path-relative ((this eieio-persistent) file) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 "For object THIS, make absolute file name FILE relative." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (file-relative-name (expand-file-name file) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (file-name-directory (oref this file)))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (defmethod eieio-persistent-save ((this eieio-persistent) &optional file) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 "Save persistent object THIS to disk. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 Optional argument FILE overrides the file name specified in the object |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 instance." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (save-excursion |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (let ((b (set-buffer (get-buffer-create " *tmp object write*"))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (default-directory (file-name-directory (oref this file))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (cfn (oref this file))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (unwind-protect |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (save-excursion |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 (erase-buffer) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (let ((standard-output (current-buffer))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 (oset this file |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (if file |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (eieio-persistent-path-relative this file) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (file-name-nondirectory cfn))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (object-write this (oref this file-header-line))) |
105652
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105474
diff
changeset
|
276 (let ((backup-inhibited (not (oref this do-backups))) |
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105474
diff
changeset
|
277 (cs (car (find-coding-systems-region |
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105474
diff
changeset
|
278 (point-min) (point-max))))) |
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105474
diff
changeset
|
279 (unless (eq cs 'undecided) |
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105474
diff
changeset
|
280 (setq buffer-file-coding-system cs)) |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 ;; Old way - write file. Leaves message behind. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 ;;(write-file cfn nil) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 ;; New way - Avoid the vast quantities of error checking |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 ;; just so I can get at the special flags that disable |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;; displaying random messages. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (write-region (point-min) (point-max) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 cfn nil 1) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 )) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 ;; Restore :file, and kill the tmp buffer |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (oset this file cfn) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (setq buffer-file-name nil) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (kill-buffer b))))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 ;; Notes on the persistent object: |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 ;; It should also set up some hooks to help it keep itself up to date. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 ;;; Named object |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 ;; |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 ;; Named objects use the objects `name' as a slot, and that slot |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 ;; is accessed with the `object-name' symbol. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (defclass eieio-named () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 () |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 "Object with a name. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 Name storage already occurs in an object. This object provides get/set |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 access to it." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 :abstract t) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (defmethod slot-missing ((obj eieio-named) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 slot-name operation &optional new-value) |
106840
5df8e547a422
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
313 "Called when a non-existent slot is accessed. |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 For variable `eieio-named', provide an imaginary `object-name' slot. |
105474 | 315 Argument OBJ is the named object. |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 Argument SLOT-NAME is the slot that was attempted to be accessed. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 OPERATION is the type of access, such as `oref' or `oset'. |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 NEW-VALUE is the value that was being set into SLOT if OPERATION were |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 a set type." |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (if (or (eq slot-name 'object-name) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (eq slot-name :object-name)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (cond ((eq operation 'oset) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (if (not (stringp new-value)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (signal 'invalid-slot-type |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (list obj slot-name 'string new-value))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (object-set-name-string obj new-value)) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (t (object-name-string obj))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (call-next-method))) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (provide 'eieio-base) |
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 |
105377 | 332 ;; arch-tag: 6260571e-9e8a-41a0-880f-a937b0c2ea8b |
104431
a64f3429f0ac
emacs-lisp/eieio-base.el, emacs-lisp/eieio-comp.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 ;;; eieio-base.el ends here |