GNU bug report logs - #48180
ruby-mode.el: fix font lock for puts and printf

Previous Next

Package: emacs;

Reported by: Steve Purcell <steve <at> sanityinc.com>

Date: Mon, 3 May 2021 01:02:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 48180 in the body.
You can then email your comments to 48180 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-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 01:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve Purcell <steve <at> sanityinc.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 03 May 2021 01:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steve Purcell <steve <at> sanityinc.com>
To: bug-gnu-emacs <at> gnu.org
Subject: ruby-mode.el: fix font lock for puts and printf
Date: Mon, 03 May 2021 13:01:17 +1200
[Message part 1 (text/plain, inline)]
Tags: patch

Both these methods can be called without arguments, so the font
locking of "bare" calls to either is incorrect.  The fix is to
font-lock them as for other kernel methods which accepts zero or more
arguments.


In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.4.0, NS appkit-2022.44 Version 10.16 (Build 20E232))
Repository revision: 30d974bf5c02a1367291fbb6fa17a182bb7974b7
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.3

Configured using:
 'configure
 --prefix=/nix/store/kvhx6vn5wvif4s9aiwp75v8pxplh19i2-emacs-gcc-20210502.0
 --disable-build-details --with-modules --with-ns
 --disable-ns-self-contained --with-native-compilation
 CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200'

[0001-lisp-progmodes-ruby-mode.el-puts-and-printf-do-not-r.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 07:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 48180 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Steve Purcell <steve <at> sanityinc.com>
Cc: 48180 <at> debbugs.gnu.org
Subject: Re: bug#48180: ruby-mode.el: fix font lock for puts and printf
Date: Mon, 03 May 2021 09:41:56 +0200
Steve Purcell <steve <at> sanityinc.com> writes:

> Both these methods can be called without arguments, so the font
> locking of "bare" calls to either is incorrect.  The fix is to
> font-lock them as for other kernel methods which accepts zero or more
> arguments.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 03 May 2021 07:43:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 48180 <at> debbugs.gnu.org and Steve Purcell <steve <at> sanityinc.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 03 May 2021 07:43:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 10:18:01 GMT) Full text and rfc822 format available.

Message #15 received at 48180 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Steve Purcell <steve <at> sanityinc.com>, 48180 <at> debbugs.gnu.org
Subject: Re: bug#48180: ruby-mode.el: fix font lock for puts and printf
Date: Mon, 3 May 2021 13:17:48 +0300
Hi Steve,

On 03.05.2021 04:01, Steve Purcell wrote:
> Both these methods can be called without arguments, so the font
> locking of "bare" calls to either is incorrect.  The fix is to
> font-lock them as for other kernel methods which accepts zero or more
> arguments.

Is that important? Like, is anybody likely to call either without args? 
font-lock is not a precise facility (that anything depends on), so we 
can afford to be wrong in 0.01% cases.

If we institute this principle, I suppose we'll need to do this for all 
functions that can work without args? In my testing, that's also:

p, open, loop, warn, print

Also note that your title says 'printf', but the patch said 'print'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 17:05:03 GMT) Full text and rfc822 format available.

Message #18 received at 48180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Steve Purcell <steve <at> sanityinc.com>, 48180 <at> debbugs.gnu.org
Subject: Re: bug#48180: ruby-mode.el: fix font lock for puts and printf
Date: Mon, 03 May 2021 19:42:44 +0300
>> Both these methods can be called without arguments, so the font
>> locking of "bare" calls to either is incorrect.  The fix is to
>> font-lock them as for other kernel methods which accepts zero or more
>> arguments.
>
> Is that important? Like, is anybody likely to call either without args?
> font-lock is not a precise facility (that anything depends on), so we can
> afford to be wrong in 0.01% cases.

It always bothered me that in ruby-mode highlighting was broken for printing
without arguments, but I had no time to investigate.  Now finally this is fixed.
Maybe some other printing like "p" could be fixed as well, but the
already fixed "puts" and "print" is an improvement.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 20:33:01 GMT) Full text and rfc822 format available.

Message #21 received at 48180 <at> debbugs.gnu.org (full text, mbox):

From: Steve Purcell <steve <at> sanityinc.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 48180 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#48180: ruby-mode.el: fix font lock for puts and printf
Date: Tue, 4 May 2021 08:31:53 +1200
On 4 May 2021, at 04:42, Juri Linkov <juri <at> linkov.net> wrote:
> 
>> Is that important? Like, is anybody likely to call either without args?
>> font-lock is not a precise facility (that anything depends on), so we can
>> afford to be wrong in 0.01% cases.
> 
> It always bothered me that in ruby-mode highlighting was broken for printing
> without arguments, but I had no time to investigate.  Now finally this is fixed.
> Maybe some other printing like "p" could be fixed as well, but the
> already fixed "puts" and "print" is an improvement.


Yes, it’s actually pretty common to just use “puts” without args to print an empty line.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48180; Package emacs. (Mon, 03 May 2021 20:43:02 GMT) Full text and rfc822 format available.

Message #24 received at 48180 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Steve Purcell <steve <at> sanityinc.com>, Juri Linkov <juri <at> linkov.net>
Cc: 48180 <at> debbugs.gnu.org
Subject: Re: bug#48180: ruby-mode.el: fix font lock for puts and printf
Date: Mon, 3 May 2021 23:42:16 +0300
On 03.05.2021 23:31, Steve Purcell wrote:
>> It always bothered me that in ruby-mode highlighting was broken for printing
>> without arguments, but I had no time to investigate.  Now finally this is fixed.
>> Maybe some other printing like "p" could be fixed as well, but the
>> already fixed "puts" and "print" is an improvement.
> 
> Yes, it’s actually pretty common to just use “puts” without args to print an empty line.

Very good, then.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Jun 2021 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 328 days ago.

Previous Next


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