Bug #528

Several ruby-mode.el improvements

Added by Natalie Weizenbaum almost 7 years ago. Updated over 4 years ago.

[ruby-core:18424]
Status:Closed
Priority:Normal
Assignee:Yukihiro Matsumoto
ruby -v: Backport:

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

0001--misc-ruby-mode.el-improve-here-doc-performance.patch Magnifier (2.57 KB) Natalie Weizenbaum, 08/31/2008 03:54 PM

0002--misc-ruby-mode.el-don-t-crash-the-whole-mode-if-t.patch Magnifier (894 Bytes) Natalie Weizenbaum, 08/31/2008 03:54 PM

0003--misc-ruby-mode.el-don-t-highlight-keywords-when-t.patch Magnifier (1.12 KB) Natalie Weizenbaum, 08/31/2008 03:54 PM

0004--misc-ruby-mode.el-misc-ruby-electric.el-use-rege.patch Magnifier (4.44 KB) Natalie Weizenbaum, 08/31/2008 03:54 PM

0005--misc-.el-untabify-for-interal-consistency-and-c.patch Magnifier (81.7 KB) Natalie Weizenbaum, 08/31/2008 03:54 PM

0006--misc-ruby-mode.el-fix-a-variable-name-error.patch Magnifier (712 Bytes) Natalie Weizenbaum, 09/07/2008 06:37 AM

0007--misc-emacs-mode.el-don-t-set-case-fold-search-glo.patch Magnifier (2.72 KB) Natalie Weizenbaum, 09/07/2008 06:37 AM

History

#1 Updated by Koichi Sasada almost 7 years ago

  • Assignee set to Yukihiro Matsumoto

=begin

=end

#2 Updated by Natalie Weizenbaum almost 7 years ago

=begin
Looks like these patches are broken. I've fixed the issue (and some additional stuff) in my Git repo (http://github.com/nex3/ruby); feel free to draw the patches from there however you want. If you want me to work up more patch files, let me know.
=end

#3 Updated by Yukihiro Matsumoto almost 7 years ago

=begin
Hi,

In message "Re: [Bug #528] Several ruby-mode.el improvements"
on Sun, 7 Sep 2008 04:27:52 +0900, Nathan Weizenbaum redmine@ruby-lang.org writes:

|Looks like these patches are broken. I've fixed the issue (and some additional stuff) in my Git repo (http://github.com/nex3/ruby); feel free to draw the patches from there however you want. If you want me to work up more patch files, let me know.

Since I am no git expert, could you re-attach the right patches?
I'd love to merge them.

                        matz.

=end

#4 Updated by Natalie Weizenbaum almost 7 years ago

=begin
Sure, here are two more patches that should work with patch -p1. Patch 6 fixes the variable-name bug that was breaking the original patches, and patch 7 sets case-fold-search locally rather than globally (another issue introduced by my changes in r18150, I'm afraid).
=end

#5 Updated by Yukihiro Matsumoto almost 7 years ago

=begin
Hi,

In message "Re: [Bug #528] Several ruby-mode.el improvements"
on Sun, 7 Sep 2008 06:31:57 +0900, Nathan Weizenbaum redmine@ruby-lang.org writes:

|File 0006--misc-ruby-mode.el-fix-a-variable-name-error.patch added
|File 0007--misc-emacs-mode.el-don-t-set-case-fold-search-glo.patch added
|
|Sure, here are two more patches that should work with patch -p1. Patch 6 fixes the variable-name bug that was breaking the original patches, and patch 7 sets case-fold-search locally rather than globally (another issue introduced by my changes in r18150, I'm afraid).

Could you tell us which patches should we apply? Is it ok to apply
those 7 patches in line, replacing no.6 and no.7 replaced by new ones?

                        matz.

=end

#6 Updated by Natalie Weizenbaum almost 7 years ago

=begin
Applying each of the patches in order from 1 to 7 should work fine. The links to patches 6 and 7 at the top and on my previous post are actually the same, so it doesn't matter which one you use.
=end

#7 Updated by Yukihiro Matsumoto almost 7 years ago

=begin
Hi,

In message "Re: [Bug #528] Several ruby-mode.el improvements"
on Sun, 7 Sep 2008 06:55:17 +0900, Nathan Weizenbaum redmine@ruby-lang.org writes:

|Applying each of the patches in order from 1 to 7 should work fine. The links to patches 6 and 7 at the top and on my previous post are actually the same, so it doesn't matter which one you use.

OK, thanks. I will apply the patches soon.

                        matz.

=end

#8 Updated by Yukihiro Matsumoto almost 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r19202.
=end

Also available in: Atom PDF