-;;; derived.el -- allow inheritance of major modes.
+;;; derived.el --- allow inheritance of major modes.
;;; (formerly mode-clone.el)
;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
\f
;;; Commentary:
(setq docstring (or docstring (derived-mode-make-docstring parent child)))
(` (progn
- (derived-mode-init-mode-variables (quote (, child)))
+ (derived-mode-init-mode-variables '(, child))
+ (put '(, child) 'derived-mode-parent '(, parent))
(defun (, child) ()
(, docstring)
(interactive)
; Run the parent.
((, parent))
; Identify special modes.
- (if (get (quote (, parent)) 'special)
- (put (quote (, child)) 'special t))
+ (if (get '(, parent) 'special)
+ (put '(, child) 'special t))
; Identify the child mode.
- (setq major-mode (quote (, child)))
+ (setq major-mode '(, child))
(setq mode-name (, name))
; Set up maps and tables.
- (derived-mode-set-keymap (quote (, child)))
- (derived-mode-set-syntax-table (quote (, child)))
- (derived-mode-set-abbrev-table (quote (, child)))
+ (derived-mode-set-keymap '(, child))
+ (derived-mode-set-syntax-table '(, child))
+ (derived-mode-set-abbrev-table '(, child))
; Splice in the body (if any).
(,@ body)
;;; ; Run the setup function, if
;;; ; any -- this will soon be
;;; ; obsolete.
-;;; (derived-mode-run-setup-function (quote (, child)))
+;;; (derived-mode-run-setup-function '(, child))
; Run the hooks, if any.
- (derived-mode-run-hooks (quote (, child)))))))
+ (derived-mode-run-hooks '(, child))))))
;; PUBLIC: find the ultimate class of a derived mode.
(defun derived-mode-merge-syntax-tables (old new)
"Merge an old syntax table into a new one.
Where the new table already has an entry, nothing is copied from the old one."
- (map-char-table
- (function (lambda (key value)
- (or (char-table-range new key)
- (set-char-table-range new key value))))
- old))
+ (set-char-table-parent new old))
;; Merge an old abbrev table into a new one.
;; This function requires internal knowledge of how abbrev tables work,