[#8815] Segfault in libc strlen, via rb_str_new2 — "Sean E. Russell" <ser@...>

Howdy,

12 messages 2006/09/09
[#8817] Re: Segfault in libc strlen, via rb_str_new2 — Eric Hodel <drbrain@...7.net> 2006/09/09

On Sep 8, 2006, at 10:10 PM, Sean E. Russell wrote:

[PATCH] Emacs ruby-mode: here-doc indentation & more

From: "Marshall T. Vandegrift" <llasram@...>
Date: 2006-09-06 23:56:52 UTC
List: ruby-core #8804

Hi,

Here's a patch to the Emacs ruby-mode function `ruby-parse-partial' to
handle more correctly indentation of here-docs:




Without the patch, here-doc terminators are considered to end at the
first non-word character.  For example, `ruby-parse-partial' would think
that the here-doc continues until line 5 of the following:
    
  1  begin
  2    puts <<-end_here_doc
  3      "Hear this, Doc?"
  4    end_here_doc
  5  end

This is the cheesy one-line version of the patch, and the bug itself
highlights a few issues:

  - There exists a defined regexp and function to find the beginnings
    and endings of here-docs, but this code doesn't use them.
  - Later on in `ruby-sexp-partial' there is code which *does* use them,
    but that code never gets run because it's in a later form of a call
    to `cond'.
  - The font-lock code is completely separate from the indentation code,
    which in this cases causes the highlighting to be correct while the
    auto-indentation gets it wrong.

Essentially, ruby-mode shows signs of having grown organically over
time.  In its current state, it's very difficult to add new features or
fix bugs.  It could use some serious love, and I'm willing to give it
that love if matz be willing. :-)

Things I'd like to do:

  - Remove unused functions and redundant logic.
  - Remove Emacs 19 compatibility stuff, including hilit19 support.
  - Bring code in line with current Emacs conventions, including for
    comments, documentation strings, local variables, and key bindings.
  - Add proper parsing of general delimited literals.
  - Add proper syntax-table modification for quote characters in
    literals (e.g., preventing an unmatched ' in a here-doc from
    painting the buffer in `font-lock-string-face').

If I put the work into these things, would my changes be accepted?
Thanks!

-Marshall

Attachments (1)

here-doc-sexp.patch (575 Bytes, text/x-patch)
--- ruby-elisp-orig/ruby-mode.el	2006-09-05 13:39:45.000000000 -0400
+++ ruby-elisp-modified/ruby-mode.el	2006-09-06 19:22:19.000000000 -0400
@@ -523,7 +523,7 @@
        ((looking-at "<<")
 	(cond
 	 ((and (ruby-expr-beg 'heredoc)
-	       (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\sw+\\)"))
+	       (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\(?:\\sw\\|\\s_\\)+\\)"))
 	  (setq re (regexp-quote (or (match-string 4) (match-string 2))))
 	  (if (match-beginning 1) (setq re (concat "\\s *" re)))
 	  (let* ((id-end (goto-char (match-end 0)))

In This Thread

Prev Next