Function: define-mode-local-override
define-mode-local-override is a macro defined in mode-local.el.gz.
Signature
(define-mode-local-override NAME MODE ARGS DOCSTRING &rest BODY)
Documentation
Define a mode specific override of the function overload NAME.
Has meaning only if NAME has been created with define-overloadable-function.
MODE is the major mode this override is being defined for.
ARGS are the function arguments, which should match those of the same
named function created with define-overload.
DOCSTRING is the documentation string.
BODY is the implementation of this function.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/mode-local.el.gz
(defmacro define-mode-local-override
(name mode args docstring &rest body)
"Define a mode specific override of the function overload NAME.
Has meaning only if NAME has been created with `define-overloadable-function'.
MODE is the major mode this override is being defined for.
ARGS are the function arguments, which should match those of the same
named function created with `define-overload'.
DOCSTRING is the documentation string.
BODY is the implementation of this function."
;; FIXME: Make this obsolete and use cl-defmethod with &context instead.
(declare (doc-string 4)
(indent defun)
(debug (&define name symbolp lambda-list stringp def-body)))
(let ((newname (intern (format "%s-%s" name mode))))
`(progn
(eval-and-compile
(defun ,newname ,args
,(concat docstring "\n"
(internal--format-docstring-line
"Override `%s' in `%s' buffers."
name mode))
;; The body for this implementation
,@body)
;; For find-func to locate the definition of NEWNAME.
(put ',newname 'definition-name ',name))
(mode-local-bind '((,name . ,newname))
'(override-flag t)
',mode))))