emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC


From: Alan Mackenzie
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Fri, 28 Feb 2014 19:50:52 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Stefan.

On Mon, Feb 24, 2014 at 10:24:23PM -0500, Stefan Monnier wrote:
> > The other bit takes over the value of c-electric-indent-mode into CC
> > Mode only when it has been set by the user, thus preventing
> > electric.el's default overriding CC Mode's.

> For that I think it's better to only obey electric-indent-mode if
> Emacs>24.3 rather than use the electric-indent-mode-has-been-called crutch.

That does not achieve the same effect.

> >> > +  ;; Emacs has en/disabled `electric-indent-mode'.  Propagate this 
> >> > through to
> >> > +  ;; each CC Mode buffer.
> >> > +  (when (and (boundp 'electric-indent-mode-has-been-called)
> >> > +             (> electric-indent-mode-has-been-called 1))
> >> > +    (mapc (lambda (buf)
> >> > +            (with-current-buffer buf
> >> > +              (when c-buffer-is-cc-mode
> >> > +                ;; Don't use `c-toggle-electric-state' here due to 
> >> > recursion.
> >> > +                (setq c-electric-flag electric-indent-mode)
> >> > +                (c-update-modeline))))
> >> > +          (buffer-list))))
> >> And could you also explain what this one is trying to avoid?
> > Basically the same thing.  It's preventing an inopportune default (as
> > contrasted with an explicit user setting) overriding CC Mode's default.

> Looks quite different since it checks (>
> electric-indent-mode-has-been-called 1), ....

Both bits of code check (> electric-indent-mode-has-been-called 1), hence
they are very similar, not quite different.

> .... but if you say it's the same, then I'll remove
> electric-indent-mode-has-been-called and let you check Emacs's version
> instead.

Please don't do this.  I meant literally what I wrote.

A better solution would be to provide a less ugly way of checking whether
a user has called electric-indent-mode - possibly some enhancement of
define-minor-mode.  I can't think of any at the moment.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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