BUG: ruby-mode.el /Today's Comic/

Discussion in 'Ruby' started by Weber, Jan 23, 2007.

  1. Weber

    Weber Guest

    Hi all
    This regexp seems to break ruby-mode parser or something like that (I'm
    not an advanced emacs user)
    This is the code:

    def image_data
    src = open("http://www.dilbert.com/").read
    soup = BeautifulSoup.new(src)
    url = soup.find('img', { :attrs => { 'alt' => /Today's Comic/ } })
    open("http://www.dilbert.com" + url['src'], "rb").read
    end

    I'd appreciate if someone else tried this too. I'm using last version
    of ruby-mode.el and Gnu Emacs 22.0.92.1

    Cheers
    -Weber
     
    Weber, Jan 23, 2007
    #1
    1. Advertisements

  2. Weber

    Jeremy Henty Guest

    What's the actual problem? I don't see anything wrong - at least
    <Tab> still sets the indentation correctly.

    An obvious guess is that the "'" character is the problem. Try
    escaping it: " /Today\'s Comic/ ". Of course I can't test this fix as
    I don't see the problem!
    $ ruby --version
    ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-linux]
    $ emacs !$
    emacs --version
    GNU Emacs 21.4.1
    Copyright (C) 2002 Free Software Foundation, Inc.
    GNU Emacs comes with ABSOLUTELY NO WARRANTY.
    You may redistribute copies of Emacs
    under the terms of the GNU General Public License.
    For more information about these matters, see the file named COPYING.

    ruby-mode.el patched as follows (to fix a different regexp problem):

    diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
    index 38d5b71..33c5901 100755
    --- a/misc/ruby-mode.el
    +++ b/misc/ruby-mode.el
    @@ -383,6 +383,8 @@ The variable ruby-indent-level controls the amount of indentation.
    (t
    (setq in-string (point))
    (goto-char end))))
    + ((looking-at "/=")
    + (goto-char pnt))
    ((looking-at "/")
    (cond
    ((and (not (eobp)) (ruby-expr-beg 'expr-re))

    Regards,

    Jeremy Henty
     
    Jeremy Henty, Jan 24, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.