emacs-devel
[Top][All Lists]
Advanced

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

Re: What primitive has moved point?


From: Alan Mackenzie
Subject: Re: What primitive has moved point?
Date: Sat, 7 Nov 2009 13:25:37 +0000
User-agent: Mutt/1.5.9i

Hi, Stefan!

On Fri, Nov 06, 2009 at 10:36:05AM -0500, Stefan Monnier wrote:
> > After point has been moved, how can I determine exactly which
> > primitive did the moving?

> Down this path lies madness.

Hmmm.  Thinking about it a bit longer, you're probably right.  Though,
having been maintaining CC Mode for ~8 years, this madness is sadly no
longer to be avoided.  ;-(

> > (possibly by the use of point-entered/left text properties),

> ...more madness.

These properties were invented by somebody with some use in mind.  So
they can't be that mad.  OK, a quick grep shows they're used in the
games, and table.el.

> > However, if the user gets to brace B with forward-line (e.g., with C-p)
> > I want to leave point well alone.

> I think your "feature" will be a misfeature, but if you really really
> want to implement it, the sanest way is probably to consider not the
> primitive used, but the direction of the movement: remember point in
> pre-command-hook, and compare in post-command-hook.  Otherwise: wrap all
> the relevant primitives (via defadvice, for example) and make them do
> what you want.

Actually, users have been complaining for a long time about "alternative"
parens in branches of #if's not scanning or parsing properly.  I WANT TO
FIX THIS, difficult though it might be.

Maybe this would be a better idea:
(i) "Neutralize" the syntactic value of every character inside a #define
or each branch of #if/#elseif/#else apart from the favoured one.  Do this
neutralization by splatting the area with syntax-table text properties,
whilst remembering what the "real" properties should be.
(ii) Each time point enters such a "splatted" region, restore the
properties.  Also restore them for the purpose of font locking.
(iii) Each time point leaves such a region, splat the properties again.

What do you think?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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