GNU bug report logs - #1593
ruby-mode: problems with font-lock

Previous Next

Package: emacs;

Reported by: "Pietro Giorgianni" <giorgian <at> gmail.com>

Date: Wed, 17 Dec 2008 06:57:12 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1593 in the body.
You can then email your comments to 1593 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1593; Package emacs. (Wed, 17 Dec 2008 06:57:13 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Pietro Giorgianni" <giorgian <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 17 Dec 2008 06:57:14 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Pietro Giorgianni" <giorgian <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: ruby-mode: problems with font-lock
Date: Tue, 16 Dec 2008 12:06:43 +0100
The syntax  %{#{'?'}} , while legal (it is equivalent to '?'), makes
all the following text appear in font-lock-string-face.

The same happens with %{#{"?"}} , and seems to rise from the ?" or ?'
part: if I put a space (or whatever) after the ? , things work.

Real life example (from the sources of rubyonrails):

self.class_eval %{
  def self.#{method_id}(*args)
    guard_protected_attributes = false

    if args[0].is_a?(Hash)
      guard_protected_attributes = true
      attributes = args[0].with_indifferent_access
      find_attributes = attributes.slice(*[:#{attribute_names.join(',:')}])
    else
      find_attributes = attributes =
construct_attributes_from_arguments([:#{attribute_names.join(',:')}],
args)
    end

    options = { :conditions => find_attributes }
    set_readonly_option!(options)

    record = find_initial(options)

     if record.nil?
      record = self.new { |r| r.send(:attributes=, attributes,
guard_protected_attributes) }
      #{'yield(record) if block_given?'}
      #{'record.save' if instantiator == :create}
      record
    else
      record
    end
  end
}, __FILE__, __LINE__


---

In GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600)
 of 2008-09-06 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ITA
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Ruby

Minor modes in effect:
  erc-log-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-highlight-nicknames-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-readonly-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  display-time-mode: t
  encoded-kbd-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
c e n s o r e d


Recent messages:
censored...
Loading emacsbug...done





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1593; Package emacs. (Sat, 20 Dec 2008 07:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 20 Dec 2008 07:45:03 GMT) Full text and rfc822 format available.

Message #10 received at 1593 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Phil Hagelberg  <phil <at> evri.com>
Cc: "Pietro Giorgianni" <giorgian <at> gmail.com>, 1593 <at> debbugs.gnu.org
Subject: Re: ruby-mode: problems with font-lock
Date: Sat, 20 Dec 2008 02:37:38 -0500
Hi Phil,

If you have time, could you take a look at this bug report?  Thanks.

"Pietro Giorgianni" <giorgian <at> gmail.com> wrote:

  The syntax  %{#{'?'}} , while legal (it is equivalent to '?'), makes
  all the following text appear in font-lock-string-face.

  The same happens with %{#{"?"}} , and seems to rise from the ?" or ?'
  part: if I put a space (or whatever) after the ? , things work.

  Real life example (from the sources of rubyonrails):

  self.class_eval %{
    def self.#{method_id}(*args)
      guard_protected_attributes = false

      if args[0].is_a?(Hash)
        guard_protected_attributes = true
        attributes = args[0].with_indifferent_access
        find_attributes =
        attributes.slice(*[:#{attribute_names.join(',:')}])
      else
        find_attributes = attributes = construct_attributes_from_arguments([:#{attribute_names.join(',:')}], args)
      end

      options = { :conditions => find_attributes }
      set_readonly_option!(options)

      record = find_initial(options)

       if record.nil?
        record = self.new { |r| r.send(:attributes=, attributes, guard_protected_attributes) }
        #{'yield(record) if block_given?'}
        #{'record.save' if instantiator == :create}
        record
      else
        record
      end
    end
  }, __FILE__, __LINE__




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1593; Package emacs. (Mon, 29 Dec 2008 14:35:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Pietro Giorgianni" <giorgian <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 29 Dec 2008 14:35:03 GMT) Full text and rfc822 format available.

Message #15 received at 1593 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Pietro Giorgianni" <giorgian <at> gmail.com>
To: 1593 <at> debbugs.gnu.org
Subject: update
Date: Mon, 29 Dec 2008 15:28:55 +0100
Hi,

The %{} syntax is actually a special case of
%[<WHAT>]<DELIMITER>...<DELIMITER>, where

<WHAT>, optional, can be:
  q - single quote string, as in 'foo';
  Q - double quote string, as in "foo";
  x - command output expression, as in `foo`;
  r - regexp, as in /foo/

<DELIMITER> can by any non-alphanumeric character, including spaces
and newline, or the pairs {}, [], (), <>.

This means that things like %|"|, which is equivalent to '"' (or to
"\""), can mess up syntax highlight in emacs.

thanks again




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Tue, 04 Oct 2011 22:04:01 GMT) Full text and rfc822 format available.

Notification sent to "Pietro Giorgianni" <giorgian <at> gmail.com>:
bug acknowledged by developer. (Tue, 04 Oct 2011 22:04:02 GMT) Full text and rfc822 format available.

Message #20 received at 1593-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 1593-done <at> debbugs.gnu.org
Subject: Re: bug#1593: ruby-mode: problems with font-lock
Date: Tue, 04 Oct 2011 18:01:44 -0400
Vesion: 24.1

"Pietro Giorgianni" wrote:

> The syntax  %{#{'?'}} , while legal (it is equivalent to '?'), makes
> all the following text appear in font-lock-string-face.
>
> The same happens with %{#{"?"}} , and seems to rise from the ?" or ?'
> part: if I put a space (or whatever) after the ? , things work.

I see this in Emacs 23.3, but not in the current trunk, so it seems to
have been fixed.

The other stuff mentioned in your update seems to be the subject of
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6286




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 02 Nov 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.