[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Supporting Edit Definition
Date: Thu, 17 Aug 89 23:31:33 CDT
From: firstname.lastname@example.org (Daniel A Haug)
I often use non-standard top-level forms for defining functions, methods,
constants, etc. For example, DEFUNEX, that expands into a defun with
an export form. However, I lose M-. support for these forms. While the
:source-file-name property is retained on the symbol, zmacs cannot find
it in the buffer. I tried tracking down how M-. works, to solve it.
But, this quickly became an overwhelming task. One must really know
zwei internals to accomplish this. I also saw hardcoded checks in the
zwei code for DEFUN, etc.
See the section "Using the SYS:FUNCTION-PARENT declaration" in book 2A
of the documentation. If the defining macro name begins with "DEF" and
the name of the thing being defined is the second element of the form
this is all you need to know. Example:
(defmacro defunex (name lambda-list &body body)
;; This tells the system that the DEFUNEX is in this file.
(si:record-source-file-name ',name 'defunex)
(defun ,name ,lambda-list
;; This says that when looking for the function definition, Zmacs
;; should instead look for the DEFUNEX form.
(declare (sys:function-parent ,name defunex))
All the special casing for DEFUN is because DEFUN has relatively complex
syntax. It allows non-symbol function names, and it allows shorthands
such as (DEFUN (FOO BAR) ...) in place of (DEFUN (:PROPERTY FOO BAR)