emacs-devel
[Top][All Lists]
Advanced

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

Re: [patch] make electric-pair-mode smarter/more useful


From: Stefan Monnier
Subject: Re: [patch] make electric-pair-mode smarter/more useful
Date: Sat, 14 Dec 2013 10:18:15 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> ;;; Electric newlines after/before/around some chars.
>> 
>> -(defvar electric-layout-rules '()
>> +(defvar electric-layout-rules `((?\n . 
>> ,#'electric-pair-newline-between-pairs-rule))

> Guess I'm a bit late with this comment (sorry), but does this mean that the
> usage of the electric newline would be set on per-mode basis?

I'm not completely sure I understand our question w.r.t the code you
quoted: the code you quoted adds the behavior globally, so it obviously
wouldn't be set on a per-mode basis.

> For example, like described previously, if I want js-mode to only insert
> electric newlines when I press return, will I have to modify
> electric-layout-rules in js-mode-hook, and do so for any other mode I use
> that sets this variable?

I think setting it on a per-mode basis would be OK, but it wouldn't be
set by the user but instead by the major mode, based on the usual coding
style used for that mode.  E.g. we wouldn't set it in Lisp, but we'd set
it in js-mode.

> Wouldn't a separate minor mode be better, electric-newline-mode maybe?

I don't see for it, currently.  It should depend on
electric-layout-mode, tho, of course.


        Stefan



reply via email to

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