all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: "Dmitry Gutov" <dgutov@yandex.ru>,
	jostein@kjonigsen.net, "Simen Heggestøyl" <simenheg@gmail.com>
Cc: Alan Mackenzie <acm@muc.de>,
	19946@debbugs.gnu.org, dan.colascione@gmail.com
Subject: bug#19946: 24.4; js-mode, indentation
Date: Sun, 20 Mar 2016 17:08:26 -0700	[thread overview]
Message-ID: <56EF3B7A.6050807@dancol.org> (raw)
In-Reply-To: <f3c19186-d327-37f9-dd8a-2281eafb94ae@yandex.ru>


[-- Attachment #1.1: Type: text/plain, Size: 1544 bytes --]

On 03/20/2016 12:49 PM, Dmitry Gutov wrote:
> On 03/20/2016 09:47 PM, Jostein Kjønigsen wrote:
> 
>>> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
>>> index 15a52ba..dffdb77 100644
>>> --- a/lisp/progmodes/js.el
>>> +++ b/lisp/progmodes/js.el
>>> @@ -578,6 +578,7 @@ js-mode-syntax-table
>>>       (c-populate-syntax-table table)
>>>       (modify-syntax-entry ?$ "_" table)
>>>       (modify-syntax-entry ?` "\"" table)
>>> +    (modify-syntax-entry ?\C-M " " table)
>>>       table)
>>>     "Syntax table for `js-mode'.")
>>>
>>
>> That works for me, at least in js-mode.
>>
>> While not a general solution to all weird files one might encounter
>> while working in Emacs, it at least makes js-files behave as expected.
>> And in a fairly reusable manner too: I can copy this code and I'm home
>> free.
>>
>> Would pushing this up to cc-mode's c-populate-syntax-table function also
>> be considered an option? Or does that just sound on overall way too
>> risky?
> 
> I don't see any problem there, but that's up to Alan.

It don't have any problem teaching specific modes about carriage
returns, but this approach doesn't scale. A better approach, I think,
would be to extend something like ws-butler for dealing with
mixed-line-ending files. On load, we'd transform `\r\n' -> `\n', but
*remember* which `\n's represent `\r\n` and perform the reverse
translation when writing. This way, you'd preserve clowny extra carriage
returns from other people, but see a clean, unified view in Emacs.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-03-21  0:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 10:09 bug#19946: 24.4; js-mode, indentation Jostein Kjønigsen
2016-03-19 22:13 ` Simen Heggestøyl
2016-03-20  1:27   ` Dmitry Gutov
2016-03-20  8:25     ` Andreas Schwab
2016-03-20 19:01     ` Jostein Kjønigsen
2016-03-20 19:02       ` Daniel Colascione
2016-03-20 19:15         ` Jostein Kjønigsen
2016-04-03 18:05           ` John Wiegley
2016-04-03 18:17             ` Eli Zaretskii
2016-03-20 19:18       ` Dmitry Gutov
2016-03-20 19:47         ` Jostein Kjønigsen
2016-03-20 19:49           ` Dmitry Gutov
2016-03-21  0:08             ` Daniel Colascione [this message]
2016-03-21  0:32               ` Dmitry Gutov
2020-08-25  9:48     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56EF3B7A.6050807@dancol.org \
    --to=dancol@dancol.org \
    --cc=19946@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=dan.colascione@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=jostein@kjonigsen.net \
    --cc=simenheg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.