Project

General

Profile

Actions

Bug #528

closed

Several ruby-mode.el improvements

Added by nex3 (Natalie Weizenbaum) about 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-core:18424]

Description

=begin
Here are a few improvements to ruby-mode.el (and the other Ruby Elisp code). I'm putting them all in this one issue, because they're built sequentially, and I don't think the later ones will apply well without the earlier ones. The patches are as follows:

  1. Improve the performance of here-doc highlighting. I noticed that, after my previous patches (r18150), editing Ruby was becoming noticeably sluggish. This was because every time a character was typed, every line in the document would be checked to see if it had a here-doc that ended on the current line. The current version only runs the check if a string is active, and then only at the beginning of the string.

  2. I was making these modifications in a fork of the git mirror of the Ruby repos, so Subversion keyword-substitution wasn't active and the use of $Revision$ in ruby-mode.el caused the whole thing to crash. This patch causes the mode to behave gracefully if this is the case.

  3. If a variable was named "next_foo", the "next" was highlighted as though it were a keyword. This was because >, meaning "end of word", was used in the keyword regexp. This patch uses _>, meaning "end of symbol", instead.

  4. Whenever several words had to be ORed in a regexp, they were simply |ed together. Elisp has a function, regexp-opt, which takes a list of words and ORs them together in an optimized way, so this patch makes use of that.

  5. Tabs -> spaces. Almost all elisp code uses spaces exclusively, spaces are produced by Emacs auto-indentation, and some of the ruby-mode code already uses spaces, so this patch switches all of the code to spaces.

The patches were produced using git's format-patch, so they've got embedded commit messages. They should work fine with patch -p1 as well.
=end


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0