>>> David Ponce <david@...> seems to think that:
>Eric,
>
> > David, your mail had these headers:
> >
> > -------
> > X-Spam-Flag: YES
> > X-Spam-Level: ********
> > X-Spam-Checker-Version: SpamAssassin 2.31 (devel $Id:
> > SpamAssassin.pm,v 1.94.2.2 2002/06/20 17:20:29 hughescr Exp $)
> > X-Spam-Report: 8.4 hits, 5 required;
> > * 4.0 -- 'Message-Id' was added by a relay
> > * 1.8 -- Message-Id is not valid, according to RFC-2822
> > * 1.6 -- 'Message-Id' was added by a relay (2)
> > * 1.0 -- RBL: Received via a relay in multihop.dsbl.org
> > [RBL check: found 69.19.252.193.multihop.dsbl.org]
> > * 1.0 -- RBL: Received via a relay in unconfirmed.dsbl.org
> > [RBL check: found 69.19.252.193.unconfirmed.dsbl.org]
> > * -1.0 -- RBL: Do not double penalize if an IP is a multihop and
> > an open relay
> > -------
> >
> > You may want to check your mail relay.
>
>Maybe a problem with my Webmail box? Do you know what is
>SpamAssassin? I am a little lost with these headers :-(
Spamassassin is a mail filter to get rid of unsolicited email.
It appears that you qualify, though the message I'm replying to does
not.
[ ... ]
>
>Attached you will find a cleaner implementation (IMO) of all that.
>If you agree with it, I will put it in semantic-fw.el and update
>callers, and if all work fine I will submit you a patch to review
>before commit ;-)
[ ... ]
>;; QUESTION: Maybe always force a buffer local variable?
>(defsubst semantic-set-local-variable (sym val &optional buffer force)
> "Set variable SYM to VAL if it is or will become local in BUFFER.
>BUFFER defaults to the current buffer.
>If SYM is non local in BUFFER, if optional argument FORCE is non-nil
>make it local and set it, else not set it and display a message.
>Return VAL."
> (if (and (local-variable-if-set-p sym buffer)
> (local-variable-p sym buffer))
> (set sym val)
> (if force
> (set (make-local-variable sym) val)
> (message "Variable `%s' not set, not local in buffer %s"
> sym (buffer-name buffer))))
> val)
To answer this question, I think they should always be locally bound.
[ ... ]
>;; TODO: Fix callers of `setq-major-mode'
>(defmacro setq-mode-local (mode &rest args)
> "Assign new values to variables local in MODE.
>MODE must be a major mode symbol.
>ARGS is a list (SYM VAL SYM VAL ...).
>The symbols SYM are variables; they are literal (not evaluated).
>The values VAL are expressions; they are evaluated.
>Set each SYM to the value of its VAL, locally in buffers already in
>MODE, or in buffers switched to that mode.
>Return the value of the last VAL."
> (when args
> (let (bl sl sym val)
> (while args
> (setq sym (car args)
> val (cadr args)
> bl (cons `(cons ',sym ,val) bl)
> sl (cons `(semantic-set-local-variable ',sym ,val) sl)
> args (cddr args)))
> `(progn
> ;; Save mode bindings
> (semantic-bind (list ,@bl) '(mode-var t) ',mode)
> ;; Assign to local variables in all existing buffers in MODE
> (semantic-map-mode-buffers #'(lambda () ,@sl) ',mode)
> ;; Return the last value
> ,val)
> )))
This is a sophisticated macro. Nifty!
>;; QUESTION: Maybe the following two macros could be useful?
>(defmacro defvar-mode-local (mode sym val &optional docstring)
> "Define MODE local variable SYM with value VAL.
>DOCSTRING is optional."
> `(progn
> (setq-mode-local ,mode ,sym ,val)
> ',sym))
It ought to be possible to bind DOCSTRING to SYM, though perhaps not
from this location in the calling infrastructure.
We can use both in different places, see which is nicer, then
eliminate the other. Since these will usually be defined once in a
language file, the `defvar-' form would look and colorize a lot nicer.
The setq form would be good for something different. Not sure what
yet though.
>(defmacro defconst-mode-local (mode sym val &optional docstring)
> "Define MODE local constant SYM with value VAL.
>DOCSTRING is optional."
> `(progn
> (setq-mode-local ,mode ,sym ,val)
> (put (intern-soft
> (symbol-name ,sym) (semantic-current-bindings ',mode))
> 'constant t)
> ',sym))
Nice. I especially like these last two defines. You might want to use:
(set 'defconst-mode-local 'lisp-indent-function 3)
on the define macros. (Or is it 2?) I usually have to experiment.
Another good thing to do for these (which I have been too lazy to do
lately) is setting up edebug symbols, like this:
(add-hook 'edebug-setup-hook
(lambda ()
(def-edebug-spec defconst-mode-local
(&define
name
form
[ &optional stringp ] ))
))
I usually set these up after I need to debug something.
I do recommend checking these in. Don't bother waiting for a
response from me on a patch though. I won't have time to do a
reasonable review for a day or two anyway.
Thanks!
Eric
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ultranet.com/~zappo Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org
|