From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolando Pereira Newsgroups: gmane.emacs.bugs Subject: bug#11923: 24.1.50; (Contains ERT test) ruby-indent-line doesn't indent line after symbol creation using string interpolation Date: Thu, 12 Jul 2012 15:53:26 +0100 Message-ID: <87liip3uah.fsf@sapo.pt> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1342108657 10353 80.91.229.3 (12 Jul 2012 15:57:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 12 Jul 2012 15:57:37 +0000 (UTC) To: 11923@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 12 17:57:36 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SpLln-00084i-NM for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Jul 2012 17:57:35 +0200 Original-Received: from localhost ([::1]:37045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpLln-0007dJ-4A for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Jul 2012 11:57:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpLlj-0007d9-LF for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 11:57:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpLli-0006ge-9i for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 11:57:31 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpLli-0006ga-5z for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 11:57:30 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SpLr4-0006cp-AE for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 12:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rolando Pereira Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jul 2012 16:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134210896225432 (code B ref -1); Thu, 12 Jul 2012 16:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Jul 2012 16:02:42 +0000 Original-Received: from localhost ([127.0.0.1]:36227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SpLqi-0006c6-FU for submit@debbugs.gnu.org; Thu, 12 Jul 2012 12:02:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48566) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SpKra-0005CT-MO for submit@debbugs.gnu.org; Thu, 12 Jul 2012 10:59:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpKm6-0005pE-8e for submit@debbugs.gnu.org; Thu, 12 Jul 2012 10:53:58 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:35278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpKm6-0005pA-57 for submit@debbugs.gnu.org; Thu, 12 Jul 2012 10:53:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpKly-0005Pz-Pi for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 10:53:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpKlt-0005mg-KW for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 10:53:42 -0400 Original-Received: from relay4.ptmail.sapo.pt ([212.55.154.24]:60145 helo=sapo.pt) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SpKlt-0005lj-08 for bug-gnu-emacs@gnu.org; Thu, 12 Jul 2012 10:53:37 -0400 Original-Received: (qmail 22518 invoked from network); 12 Jul 2012 14:53:33 -0000 Original-Received: from unknown (HELO sapo.pt) (10.134.37.164) by relay4 with SMTP; 12 Jul 2012 14:53:33 -0000 Original-Received: (qmail 21606 invoked from network); 12 Jul 2012 14:53:33 -0000 Original-Received: from unknown (HELO rolando-desktop) (finalyugi@sapo.pt@[178.166.117.32]) (envelope-sender ) by mta14 (qmail-ptmail-1.0.0) with AES128-SHA encrypted SMTP for ; 12 Jul 2012 14:53:29 -0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 12 Jul 2012 12:02:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61858 Archived-At: When writing ruby code, if you type something like :"foo#{variable_name}" emacs can no longer indent lines following it because it gives the following error: ruby-forward-string: Search failed: "[^\\]\\(\\\\\\\\\\)*[\"]" However, ruby-mode has no problem indenting lines that only contain :"foo" (ie. without the string interpolation). Here's an ERT that shows the problem. In it, I don't activate ruby-mode because `ruby-indent-line' can be called after the call to (require 'ruby-mode) and I believe it makes the test simpler (eg. no need to worry about stuff in ruby-mode-hook): (ert-deftest indent-line-after-symbol-made-from-string-interpolation () "Ensure that `ruby-mode' can indent lines after seeing a symbol made using string interpolation The syntax for creating a symbol using string interpolation is the following: :\"bar#{variable_name}\" For example, if `variable_name' is the number 10, then this creates the symbol :bar10 and if `variable_name' is the string \"bar\", then this creates the symbol :barbar." (let ((initial-content "def foo(suffix) :\"bar#{suffix}\" ") (expected-content "def foo(suffix) :\"bar#{suffix}\" ")) (require 'ruby-mode) (with-temp-buffer ;; No need to call `ruby-mode', since `ruby-indent-line' can be ;; used after the (require 'ruby-mode) ;(ruby-mode) (insert initial-content) (ruby-indent-line) (let ((buffer-content (buffer-substring-no-properties (point-min) (point-max)))) (ert-should (string= buffer-content expected-content)))))) To experience the problem from emacs -Q you can do the following steps (which are similar to the steps that the ERT test performs): 1. Open emacs -Q 2. Require 'ruby-mode with M-: (require 'ruby-mode) 2. Create a "ruby-temp" buffer with C-x b ruby-temp RET 3. Write the following: "def foo(suffix) :"bar#{suffix}" " <-- cursor is here 4. Call M-x ruby-indent-line The final result should be: "def foo(suffix) :"bar#{suffix} " <-- cursor is here But ruby-indent-line crashes instead with the following error: ruby-forward-string: Search failed: "[^\\]\\(\\\\\\\\\\)*[\"]" In GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.20.1) of 2012-06-17 on rolando-desktop Bzr revision: 108644 rudalics@gmx.at-20120617104350-tpcax4jzuiamvw9r Windowing system distributor `The X.Org Foundation', version 11.0.10706000 Important settings: value of $LANG: pt_PT.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r u b y - i n d e n t - l i n e C-x b * n m e m e s M e s s C-x b * s c r C-y - i n t e r p o l a t i o n u s i n g SPC s t r i n g SPC i n r t e t e r p o l a t i o n u s i n g SPC s t r i n g SPC i n t e r p o l a t i o n SPC i s M-d M-d M-d M-d M-x r e p o r t - e m Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. byte-code: End of buffer ruby-forward-string: Search failed: #("[^\\]\\(\\\\\\\\\\)*[\"]" 14 15 (face font-lock-string-face fontified t)) Mark set Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils ruby-mode time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)