emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completion-at-point + semantic : erroneous error


From: Stefan Monnier
Subject: Re: completion-at-point + semantic : erroneous error
Date: Thu, 24 Oct 2019 16:17:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> For the part of the patch replacing `define-overloadable-function' with
> methods, I was surprised by the &context syntax.  I've been away from emacs
> devel too long to be familiar with it, but the doc on it was
> helpful. mode-local.el was always a hack to overcome the mess that was
> managing behavior changes between modes while providing useful base
> functionality.  Updating to methods using &context seems like a fine way to
> solve the same problem.
>
> I went back to mode-local to remind myself about it.  One of the things it
> handled was derived modes. 

The `derived-mode` specializer I used in the patch for the &context part
correctly handles derived modes, as the name suggests.  It doesn't pay
attention to mode-local's `mode-local-parent` property, of course, only
to the `derived-mode-parent` property.

[ BTW: I'd like to remove the `mode-local-parent` property.
  AFAICT it's only ever set by set-mode-local-parent which is only used by
  define-child-mode which is used as follows:

    bovine/c.el:(define-child-mode c++-mode c-mode
    bovine/el.el:(define-child-mode lisp-mode emacs-lisp-mode
    html.el:(define-child-mode html-helper-mode html-mode
    wisent/javascript.el:(define-child-mode js-mode javascript-mode)
    wisent/javascript.el:(define-child-mode js-mode javascript-mode)
    wisent/python.el:(define-child-mode python-2-mode python-mode "Python 2 
mode")
    wisent/python.el:(define-child-mode python-3-mode python-mode "Python 3 
mode")

  I suspect these could be replaced with other things.  WDYT? ]

> Not sure what a "&context (major-mode ...) " does to know if it is
> derived from a parent mode or not. 

It looks at the derived-mode-parent property.

> Also in your patch is a TODO about `with-mode-local'.  That with-mode-local
> did more than just allow the next method call to dispatch correctly.  It
> also sets up mode local variables, and other mode-local dispatchers for
> anything the dispatched call might need.  In this case, the completion call
> uses lots of other mode local dispatched functions.  with-mode-local doesn't
> set the major-mode though.  Since all of CEDET is presumably still using
> mode-local features, you will need both.

Yes.  More importantly, I see that additionally to
define-mode-local-override some functions are overloaded on
a buffer-local basis via semantic-install-function-overrides.
This doesn't fit well with the cl-defmethod system.  I can probably get
rid of semantic-install-function-overrides, but do you happen to
know if some functions are overloaded on a buffer-local basis from
elsewhere than semantic-install-function-overrides?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]