From unknown Sat Aug 16 18:16:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#32744 <32744@debbugs.gnu.org> To: bug#32744 <32744@debbugs.gnu.org> Subject: Status: There seems to be a bug in current-column in character mode Reply-To: bug#32744 <32744@debbugs.gnu.org> Date: Sun, 17 Aug 2025 01:16:36 +0000 retitle 32744 There seems to be a bug in current-column in character mode reassign 32744 emacs submitter 32744 Kalman Reti severity 32744 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 16 12:25:53 2018 Received: (at submit) by debbugs.gnu.org; 16 Sep 2018 16:25:53 +0000 Received: from localhost ([127.0.0.1]:42276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1Zrt-0004po-5P for submit@debbugs.gnu.org; Sun, 16 Sep 2018 12:25:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1X6p-0000Y3-Qv for submit@debbugs.gnu.org; Sun, 16 Sep 2018 09:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1X6j-0004HO-V2 for submit@debbugs.gnu.org; Sun, 16 Sep 2018 09:29:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1X6j-0004H0-PN for submit@debbugs.gnu.org; Sun, 16 Sep 2018 09:29:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1X6j-000523-48 for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 09:29:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1X6i-0004F6-Ep for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 09:29:01 -0400 Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]:34541) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1X6i-0004Eb-8f for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 09:29:00 -0400 Received: by mail-oi0-x232.google.com with SMTP id 13-v6so16733299ois.1 for ; Sun, 16 Sep 2018 06:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=lPibZ2hFwM8Q0YbFbPwEWdJBG3L7gOvAZRD/kOs1KaU=; b=OMrPd9uC77YfoK9wI7lm93AgJj+ztJz+jHaDL28tAYpQpwYaocgUDlLrtsePXDra4i xhptSpZ2yTQFiSoaapcRII5qn7sPdaweiUN+PNqbq8ZoeokZgsdoJ9QYkr47SFb+7WXj xjO6c4RTKe6LnnFqu8bJXHlitBe/sRomLcOlstCD4VhncD25Qr/nBYD5V1UqoD9Rnyvt mYxGbH8rY2kZ5SSZL94RyOH8XrV6D3lJPc9h5fgZmLJyxdh43HVAzeeTG/+lBeHXEtVb syrHIM/tsHSNz424fCgG4RAxzwliv9E7pMimSBeAXm3L0t/PPRd8SvKI2JTynQvPzhuK Lz3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=lPibZ2hFwM8Q0YbFbPwEWdJBG3L7gOvAZRD/kOs1KaU=; b=KoZz5VRXhtR1aqd+QYPvR1Uurm33t5RSgpwbt1aP/nHcIRIsfjv+IFsIWGJiCxwICO ZRSmpnR+7jiOyxrxW26pfb7hAashQfBkyt9seV7epJtpQEXeNCSAC58FZR35DC6BFnuv koDysdyb9mY+8d+8z5kv4BfJnH9G5EKtw247NTyIOmv3JBEA+X8qfoGVkz0+qduYhK1R c837fCbzRwR1hfNLm9wbIIdmqLcbYn6xqIUX2LZe6r9v989jnPNNmuno9c0ueDBvLYYr gqYhUlB2h98+wJ27gYzZeupdqoLea2bVifbbWJzWbzP87PnduNWsKU50u34vFy+zLHYQ yZNA== X-Gm-Message-State: APzg51BIvQcvQUxESKO+C1PnMMaWu9fN0AfECMAJ/9UDitxBbDgDWSUx +CB1Gua/hH8UqAowlcH7VfJ3DBLIDPehzayD/P4BgscS X-Google-Smtp-Source: ANB0VdZFxOcN2QJf/SsWDzNsSGpIXgc1OUVqB+aNB5h5QW1E0TlJOJjubZGWSP3vF6OAnBBq6LhUheKlBjkn+weXUD0= X-Received: by 2002:aca:bd8b:: with SMTP id n133-v6mr15142827oif.108.1537104539113; Sun, 16 Sep 2018 06:28:59 -0700 (PDT) MIME-Version: 1.0 From: Kalman Reti Date: Sun, 16 Sep 2018 09:28:47 -0400 Message-ID: Subject: There seems to be a bug in current-column in character mode To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000095dc50575fd0a6e" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 16 Sep 2018 12:25:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --000000000000095dc50575fd0a6e Content-Type: text/plain; charset="UTF-8" In an empty buffer, m-: of (let ((p (point))) (insert " ") (add-text-properties p (point) `(display (space :width 7))) (insert ".") (current-column)) returns 2 in gui mode but 8 in character mode of emacsen more recent than emacs 22. (I tried it in several emacs versions including the most recent 27.0.50 snapshot.) I discovered this by figuring out why the m-x bubbles game hasn't worked in character mode since emacs 22. --000000000000095dc50575fd0a6e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In an empty buffer, m-: of

(let ((= p (point))) (insert " ") (add-text-properties p (point) `(display= (space :width 7))) (insert ".") (current-column))

returns 2 in gui mode but 8 in character mode of em= acsen more recent than emacs 22.=C2=A0 (I tried it in several emacs version= s including the most recent 27.0.50 snapshot.)

I discovered this by figuring out why the m-x bubbles game hasn't work= ed in character mode since emacs 22.
--000000000000095dc50575fd0a6e-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 16 13:11:57 2018 Received: (at 32744) by debbugs.gnu.org; 16 Sep 2018 17:11:57 +0000 Received: from localhost ([127.0.0.1]:42289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1aaT-0005uI-GB for submit@debbugs.gnu.org; Sun, 16 Sep 2018 13:11:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1aaS-0005u6-4W for 32744@debbugs.gnu.org; Sun, 16 Sep 2018 13:11:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1aaJ-0000L7-01 for 32744@debbugs.gnu.org; Sun, 16 Sep 2018 13:11:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1aaI-0000L3-SS; Sun, 16 Sep 2018 13:11:46 -0400 Received: from [176.228.60.248] (port=4202 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g1aaI-0008Ii-8u; Sun, 16 Sep 2018 13:11:46 -0400 Date: Sun, 16 Sep 2018 20:11:40 +0300 Message-Id: <83y3c1gyer.fsf@gnu.org> From: Eli Zaretskii To: Kalman Reti In-reply-to: (message from Kalman Reti on Sun, 16 Sep 2018 09:28:47 -0400) Subject: Re: bug#32744: There seems to be a bug in current-column in character mode References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32744 Cc: 32744@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Kalman Reti > Date: Sun, 16 Sep 2018 09:28:47 -0400 > > In an empty buffer, m-: of > > (let ((p (point))) (insert " ") (add-text-properties p (point) `(display (space :width 7))) (insert ".") > (current-column)) > > returns 2 in gui mode but 8 in character mode of emacsen more recent than emacs 22. (I tried it in several > emacs versions including the most recent 27.0.50 snapshot.) I get 8 in GUI frames as well. The display spec (space :width 7) means 7 times the width of the default face's font. So if your default GUI font is monospaced, you should get 8 in both GUI and text-mode frames. So I'm unsure how come you get 2 in GUI mode. Maybe you've omitted some important detail in the reproducer. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 16 19:44:41 2018 Received: (at 32744) by debbugs.gnu.org; 16 Sep 2018 23:44:41 +0000 Received: from localhost ([127.0.0.1]:42447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1giX-0000ZT-9c for submit@debbugs.gnu.org; Sun, 16 Sep 2018 19:44:41 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:39385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1giV-0000ZG-HT for 32744@debbugs.gnu.org; Sun, 16 Sep 2018 19:44:39 -0400 Received: by mail-oi0-f53.google.com with SMTP id c190-v6so17365913oig.6 for <32744@debbugs.gnu.org>; Sun, 16 Sep 2018 16:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2OPDV7Pi/51MdE8pikSub0eYTrJLxY2thWIG5ECPbYo=; b=RGVNUzpz1ZbhmXvJYuVTn1D2yUvTnqJP3GdyCebtV+lCSSZ7yMOvWsG+se9BYS6jEh iBGQmYnZ8LPep3VNrgXw2HZrahRexWu1SymHiUJNkrNOIaNlBpW4O6j1ZHObLJLyHbXo wpA+Rb6bthC4jz7fBcWaY3w5iRMQm+XVjTS79JHZk8M/cwDMljm02DwQOZzzldpc8FBC s53mTAQhuR9mZdwE5OQa6Z+rKZLmkL3euAw6NmoKSEOEgR1/MyjSpT4NTM7OLZzLvwJw MCWiW1PWZJm/hL1EMIjmp+D1CbA/DqdJlaQwtVlvoERA2CzOkkktItPM4FsAmJuLSooy f9iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2OPDV7Pi/51MdE8pikSub0eYTrJLxY2thWIG5ECPbYo=; b=byvEHC6DrIBs8ECgU5OWJrt8EfDrHsGneqQk4tqTBlcQw5uHLoHlvFJn5XX4krY5JL oNFc756r1ttnZ7+y/v3Nsq8Kv/HXpBs5e1JfmMQeOA32o71v1KeikoDjzZSRv81QYyWd CHwJIQhB2jIIO3n2pVmdIbUGcPpOtPOuTWhZfKMkZ625nv2SnhWHJt8UCzb6F7Rh5xUF TS3sbHMOgihOdpd8QYpubLuYQ8DCv9G/hgh7NFO4aMy0uZZSKD/ld5JckY/J3YkVIW06 lip29ZzLInQqcdhPBWa+PnY6aZ8N1J0jXNrT4IZSQD2xhH82b2Ln4r/r2ZEr1XG6r6Bv 9K2w== X-Gm-Message-State: APzg51AVfprI5OQKpf1Df8n2tAtna7Y0Ccq7QjOP/72qpVUIvNzRzJ59 6hMRtOfe0rYfk30fwNTrsSjEeytmagAboBd8ER0= X-Google-Smtp-Source: ANB0VdZbra2unPPDz7esHajDjWZNWo7dnb2XE0Ka6uatHT7SEWmnPWacF66T91dJlWlxty094GY32KFa90v1D7KoQBA= X-Received: by 2002:aca:b844:: with SMTP id i65-v6mr16524358oif.177.1537141473690; Sun, 16 Sep 2018 16:44:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:604c:0:0:0:0:0 with HTTP; Sun, 16 Sep 2018 16:44:33 -0700 (PDT) Received: by 2002:ac9:604c:0:0:0:0:0 with HTTP; Sun, 16 Sep 2018 16:44:33 -0700 (PDT) In-Reply-To: References: <83y3c1gyer.fsf@gnu.org> From: Kalman Reti Date: Sun, 16 Sep 2018 19:44:33 -0400 Message-ID: Subject: Re: bug#32744: There seems to be a bug in current-column in character mode To: Eli Zaretskii Content-Type: multipart/alternative; boundary="000000000000824a31057605a3a5" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 32744 Cc: 32744@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000824a31057605a3a5 Content-Type: text/plain; charset="UTF-8" On Sep 16, 2018 1:12 PM, "Eli Zaretskii" wrote: > From: Kalman Reti > Date: Sun, 16 Sep 2018 09:28:47 -0400 > > In an empty buffer, m-: of > > (let ((p (point))) (insert " ") (add-text-properties p (point) `(display (space :width 7))) (insert ".") > (current-column)) > > returns 2 in gui mode but 8 in character mode of emacsen more recent than emacs 22. (I tried it in several > emacs versions including the most recent 27.0.50 snapshot.) I get 8 in GUI frames as well. The display spec (space :width 7) means 7 times the width of the default face's font. So if your default GUI font is monospaced, you should get 8 in both GUI and text-mode frames. So I'm unsure how come you get 2 in GUI mode. Maybe you've omitted some important detail in the reproducer. I apologize; you are correct, it gets 8 in gui mode as well. I must have been confused about which window was running which version of emacs while I was experimenting. But is that the correct value? The bubbles game code clearly wants it to mean 'the number of forward-chars I have to do from the beginning of the line to get here' not 'what column does it visually look like I'm on'. The doc string for the function doesn't clarify the intended meaning. If you do m-x bubbles immediately followed by m-: (current-column) it returns 1 in the gui case but a number larger than one (which depends upon the :width keyword of the wide-displaying space), but for the game to work in the character case it needs to return 1. Thanks. --000000000000824a31057605a3a5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sep 16, 2018 1:12 PM, "Eli Zaretskii" <eliz@gnu.org> wrote:
> From: Kalman R= eti <kalman.r= eti@gmail.com>
> Date: Sun, 16 Sep 2018 09:28:47 -0400
>
> In an empty buffer, m-: of
>
> (let ((p (point))) (insert " ") (add-text-properties p (poin= t) `(display (space :width 7))) (insert ".")
> (current-column))
>
> returns 2 in gui mode but 8 in character mode of emacsen more recent t= han emacs 22.=C2=A0 (I tried it in several
> emacs versions including the most recent 27.0.50 snapshot.)

I get 8 in GUI frames as well.

The display spec (space :width 7) means 7 times the width of the
default face's font.=C2=A0 So if your default GUI font is monospaced, y= ou
should get 8 in both GUI and text-mode frames.

So I'm unsure how come you get 2 in GUI mode.=C2=A0 Maybe you've om= itted
some important detail in the reproducer.
=

I apologize; you are correct,= it gets 8 in gui mode as well. I must have been confused about which windo= w was running which version of emacs while I was experimenting.

But is that the correct value? The = bubbles game code clearly wants it to mean 'the number of forward-chars= I have to do from the beginning of the line to get here' not 'what= column does it visually look like I'm on'.
=
The doc string for the function doesn't cla= rify the intended meaning.

If you do m-x bubbles immediately followed by m-: (current-column) it re= turns 1 in the gui case but a number larger than one (which depends upon th= e :width keyword of the wide-displaying space), but for the game to work in= the character case it needs to return 1.

=

Thanks.

--000000000000824a31057605a3a5-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 17 10:43:18 2018 Received: (at 32744-done) by debbugs.gnu.org; 17 Sep 2018 14:43:18 +0000 Received: from localhost ([127.0.0.1]:43242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1ukA-00062g-6r for submit@debbugs.gnu.org; Mon, 17 Sep 2018 10:43:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1uk9-00062U-53 for 32744-done@debbugs.gnu.org; Mon, 17 Sep 2018 10:43:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1ujz-0006AF-OH for 32744-done@debbugs.gnu.org; Mon, 17 Sep 2018 10:43:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1ujz-00069Z-Ir; Mon, 17 Sep 2018 10:43:07 -0400 Received: from [176.228.60.248] (port=1342 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g1ujy-0000Pu-9u; Mon, 17 Sep 2018 10:43:07 -0400 Date: Mon, 17 Sep 2018 17:43:02 +0300 Message-Id: <83o9cwgp6x.fsf@gnu.org> From: Eli Zaretskii To: Kalman Reti In-reply-to: (message from Kalman Reti on Sun, 16 Sep 2018 19:44:33 -0400) Subject: Re: bug#32744: There seems to be a bug in current-column in character mode References: <83y3c1gyer.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32744-done Cc: 32744-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Kalman Reti > Date: Sun, 16 Sep 2018 19:44:33 -0400 > Cc: 32744@debbugs.gnu.org > > I get 8 in GUI frames as well. > > The display spec (space :width 7) means 7 times the width of the > default face's font. So if your default GUI font is monospaced, you > should get 8 in both GUI and text-mode frames. > > So I'm unsure how come you get 2 in GUI mode. Maybe you've omitted > some important detail in the reproducer. > > I apologize; you are correct, it gets 8 in gui mode as well. I must have been confused about which window > was running which version of emacs while I was experimenting. > > But is that the correct value? The bubbles game code clearly wants it to mean 'the number of forward-chars I > have to do from the beginning of the line to get here' not 'what column does it visually look like I'm on'. > > The doc string for the function doesn't clarify the intended meaning. > > If you do m-x bubbles immediately followed by m-: (current-column) it returns 1 in the gui case but a number > larger than one (which depends upon the :width keyword of the wide-displaying space), but for the game to > work in the character case it needs to return 1. It's a bug in bubbles.el, now fixed on the emacs-26 branch. The patch is below, so you can apply it locally if you want. The patch does some cleanup, so it might not be easy to spot the crucial problem it fixes. The root cause of the bug was that bubbles--initialize had 2 code paths in it: one for GUI frames (which worked), and another for TTY frames (which didn't, and it seems to me that no one has ever tried it). The GUI part computed the offsets as lists, i.e. '(N), whereas the TTY part produced just N, a simple number. And the display property 'space' treats each of these differently: '(N) is treated as pixel width, while N is treated as a multiple of the default character width (your example only used the N form, so it produced 8 instead of 1 from current-column). Once we produce '(N) both in GUI and in TTY frames, the game works in both. Here's the patch I promised; I'm closing the bug report. diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el index e30838d..ee2135b 100644 --- a/lisp/play/bubbles.el +++ b/lisp/play/bubbles.el @@ -250,10 +250,10 @@ bubbles--images-ok "Indicate whether images have been created successfully.") (defvar bubbles--col-offset 0 - "Horizontal offset for centering the bubbles grid.") + "Horizontal offset for centering the bubbles grid, in pixels.") (defvar bubbles--row-offset 0 - "Vertical offset for centering the bubbles grid.") + "Vertical offset for centering the bubbles grid, in pixels.") (defvar bubbles--save-data nil "List containing bubbles save data (SCORE BUFFERCONTENTS).") @@ -960,33 +960,26 @@ bubbles-quit (defun bubbles--compute-offsets () "Update horizontal and vertical offsets for centering the bubbles grid. Set `bubbles--col-offset' and `bubbles--row-offset'." - (cond ((and (display-images-p) - bubbles--images-ok - (not (eq bubbles-graphics-theme 'ascii)) - (fboundp 'window-inside-pixel-edges)) - ;; compute offset in units of pixels - (let ((bubbles--image-size - (car (image-size (car bubbles--images) t)))) - (setq bubbles--col-offset - (list - (max 0 (/ (- (nth 2 (window-inside-pixel-edges)) - (nth 0 (window-inside-pixel-edges)) - (* ( + bubbles--image-size 2) ;; margin - (bubbles--grid-width))) 2)))) - (setq bubbles--row-offset - (list - (max 0 (/ (- (nth 3 (window-inside-pixel-edges)) - (nth 1 (window-inside-pixel-edges)) - (* (+ bubbles--image-size 1) ;; margin - (bubbles--grid-height))) 2)))))) - (t - ;; compute offset in units of chars - (setq bubbles--col-offset - (max 0 (/ (- (window-width) - (bubbles--grid-width)) 2))) - (setq bubbles--row-offset - (max 0 (/ (- (window-height) - (bubbles--grid-height) 2) 2)))))) + (let* ((use-images-p (and (display-images-p) + bubbles--images-ok + (not (eq bubbles-graphics-theme 'ascii)))) + (bubbles--image-size + (if use-images-p (car (image-size (car bubbles--images) t)) 1)) + ;; In GUI mode, leave thin margins around the images. + (image-hor-size + (if use-images-p (+ bubbles--image-size 2) bubbles--image-size)) + (image-vert-size + (if use-images-p (1+ bubbles--image-size) bubbles--image-size))) + (setq bubbles--col-offset + (max 0 (/ (- (nth 2 (window-body-pixel-edges)) + (nth 0 (window-body-pixel-edges)) + (* image-hor-size (bubbles--grid-width))) + 2))) + (setq bubbles--row-offset + (max 0 (/ (- (nth 3 (window-body-pixel-edges)) + (nth 1 (window-body-pixel-edges)) + (* image-vert-size (bubbles--grid-height))) + 2))))) (defun bubbles--remove-overlays () "Remove all overlays." @@ -1007,7 +1000,8 @@ bubbles--initialize (insert " ") (put-text-property (point-min) (point) 'display - (cons 'space (list :height bubbles--row-offset))) + (cons 'space (list :height + (list bubbles--row-offset)))) (insert "\n") (let ((max-char (length (bubbles--colors)))) (dotimes (i (bubbles--grid-height)) @@ -1015,7 +1009,8 @@ bubbles--initialize (insert " ") (put-text-property p (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (dotimes (j (bubbles--grid-width)) (let* ((index (random max-char)) (char (nth index bubbles-chars))) @@ -1025,7 +1020,8 @@ bubbles--initialize (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (put-text-property (point-min) (point-max) 'pointer 'arrow)) (bubbles-mode) (bubbles--reset-score) @@ -1177,7 +1173,7 @@ bubbles--show-scores (insert " ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert (format "Score: %4d" bubbles--score)) (put-text-property pos (point) 'status t)))) @@ -1197,7 +1193,7 @@ bubbles--game-over (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert "Game Over!")) ;; save score (gamegrid-add-score (format "bubbles-%s-%d-%d-%d-scores" From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 17 10:55:00 2018 Received: (at 32744-done) by debbugs.gnu.org; 17 Sep 2018 14:55:00 +0000 Received: from localhost ([127.0.0.1]:43256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1uvT-0006Kp-CG for submit@debbugs.gnu.org; Mon, 17 Sep 2018 10:55:00 -0400 Received: from mail-ot1-f43.google.com ([209.85.210.43]:46280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1uvR-0006Kd-BF for 32744-done@debbugs.gnu.org; Mon, 17 Sep 2018 10:54:58 -0400 Received: by mail-ot1-f43.google.com with SMTP id v44-v6so11575479ote.13 for <32744-done@debbugs.gnu.org>; Mon, 17 Sep 2018 07:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AIaX3nOMTmrjOOmV7yYKNboqdUBDptTt+gseX68gn4E=; b=Q9/wH7Xt911PNp7I3k0lbjyr/NTYOCTFZpPGaPXveaaRpBFVvhOvjK96tE4iUmuvlq fb1xkbgqFkp0xLal9hb4cFxk4LjoMUh3Fxfns+pCF5PN833Gc5n3PkVzxhUdpjFZegFA Fw7Z8nkEZj+lfyftGrx0MZ9NPSbSgEAHL9JGmJgu42KxOHp4VQ9V66fipUHsp05v/+TA cabk73NxUaLRXmvUbWXPY3TjQhe0T3ZT4ruc3u6Gy/ZjGWXQcE8rH5g+xN2iPQc1yWqy woPTSFyCvTK7/jCbbDJTxO6x21Kgo1nW/5WkKKrrH6tndWGQwn0/aJnSg3umJ1UEV749 X9bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AIaX3nOMTmrjOOmV7yYKNboqdUBDptTt+gseX68gn4E=; b=i94OI7ZVWyymirRJcJaAmRW025R9ytTUjnwKCeGqWqwtW9uXMYz9qcEN2V5IuxhzgC 80tbfkaU/iKlQmmoLtDZC7r6biBWbSnWiOD6Dio9dA6vL0uXUQr/6JNENkAUk12PrU3F jdeEvsV/uv0Yr9mpXAlljkNM8Gn05+40ZUK1sVlLi75LE0/gK/6TU+wSz1bRbK3nuPUp wXEgaQmaxrjKf/WFoZWcLkEsJOOvRISn+Bk35kpZHI5dP08Jb9kQevBNvlO7Atg/h+s6 XPRnLvyMLpqZtg38juGowVz4CMVKrCyM/FEhM5lOqCqUyTSe+aZlc2zZCqBUuHwD5VOw 09JQ== X-Gm-Message-State: APzg51BWKKXd6fWjGCxgDbg0HphLm74BCWhGCpuIXVkBq/6BA3tF67nl uTesiYE1iYiHtMPhEwGDlHL5twgTxYUBegZ51uI= X-Google-Smtp-Source: ANB0VdYcImntaaDoeRGlA1MHna/AO3aI1cmtZVec3Dph/Y4zaU4X1GGpFtOU9K7zXjEayfSDoyNWMWbjwWvxHmN3TzI= X-Received: by 2002:a9d:ff5:: with SMTP id m50-v6mr12870724otd.276.1537196091432; Mon, 17 Sep 2018 07:54:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:604c:0:0:0:0:0 with HTTP; Mon, 17 Sep 2018 07:54:50 -0700 (PDT) Received: by 2002:ac9:604c:0:0:0:0:0 with HTTP; Mon, 17 Sep 2018 07:54:50 -0700 (PDT) In-Reply-To: <83o9cwgp6x.fsf@gnu.org> References: <83y3c1gyer.fsf@gnu.org> <83o9cwgp6x.fsf@gnu.org> From: Kalman Reti Date: Mon, 17 Sep 2018 10:54:50 -0400 Message-ID: Subject: Re: bug#32744: There seems to be a bug in current-column in character mode To: Eli Zaretskii Content-Type: multipart/alternative; boundary="000000000000fae3780576125ad1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 32744-done Cc: 32744-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000fae3780576125ad1 Content-Type: text/plain; charset="UTF-8" On Sep 17, 2018 10:43 AM, "Eli Zaretskii" wrote: > From: Kalman Reti > Date: Sun, 16 Sep 2018 19:44:33 -0400 > Cc: 32744@debbugs.gnu.org > > I get 8 in GUI frames as well. > > The display spec (space :width 7) means 7 times the width of the > default face's font. So if your default GUI font is monospaced, you > should get 8 in both GUI and text-mode frames. > > So I'm unsure how come you get 2 in GUI mode. Maybe you've omitted > some important detail in the reproducer. > > I apologize; you are correct, it gets 8 in gui mode as well. I must have been confused about which window > was running which version of emacs while I was experimenting. > > But is that the correct value? The bubbles game code clearly wants it to mean 'the number of forward-chars I > have to do from the beginning of the line to get here' not 'what column does it visually look like I'm on'. > > The doc string for the function doesn't clarify the intended meaning. I think the doc string for current column should be enhanced to say what it is returning. > > If you do m-x bubbles immediately followed by m-: (current-column) it returns 1 in the gui case but a number > larger than one (which depends upon the :width keyword of the wide-displaying space), but for the game to > work in the character case it needs to return 1. It's a bug in bubbles.el, now fixed on the emacs-26 branch. The patch is below, so you can apply it locally if you want. The existing bubbles code works for both gui and character mode in emacs 22, so I'd characterize it less as a bug in bubbles as an incompatibility introduced after emacs 22. Is there some other function that will give 'how many forward-chars necessary to go from beginning of line to here? Thanks for the patch. The patch does some cleanup, so it might not be easy to spot the crucial problem it fixes. The root cause of the bug was that bubbles--initialize had 2 code paths in it: one for GUI frames (which worked), and another for TTY frames (which didn't, and it seems to me that no one has ever tried it). The GUI part computed the offsets as lists, i.e. '(N), whereas the TTY part produced just N, a simple number. And the display property 'space' treats each of these differently: '(N) is treated as pixel width, while N is treated as a multiple of the default character width (your example only used the N form, so it produced 8 instead of 1 from current-column). Once we produce '(N) both in GUI and in TTY frames, the game works in both. Here's the patch I promised; I'm closing the bug report. diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el index e30838d..ee2135b 100644 --- a/lisp/play/bubbles.el +++ b/lisp/play/bubbles.el @@ -250,10 +250,10 @@ bubbles--images-ok "Indicate whether images have been created successfully.") (defvar bubbles--col-offset 0 - "Horizontal offset for centering the bubbles grid.") + "Horizontal offset for centering the bubbles grid, in pixels.") (defvar bubbles--row-offset 0 - "Vertical offset for centering the bubbles grid.") + "Vertical offset for centering the bubbles grid, in pixels.") (defvar bubbles--save-data nil "List containing bubbles save data (SCORE BUFFERCONTENTS).") @@ -960,33 +960,26 @@ bubbles-quit (defun bubbles--compute-offsets () "Update horizontal and vertical offsets for centering the bubbles grid. Set `bubbles--col-offset' and `bubbles--row-offset'." - (cond ((and (display-images-p) - bubbles--images-ok - (not (eq bubbles-graphics-theme 'ascii)) - (fboundp 'window-inside-pixel-edges)) - ;; compute offset in units of pixels - (let ((bubbles--image-size - (car (image-size (car bubbles--images) t)))) - (setq bubbles--col-offset - (list - (max 0 (/ (- (nth 2 (window-inside-pixel-edges)) - (nth 0 (window-inside-pixel-edges)) - (* ( + bubbles--image-size 2) ;; margin - (bubbles--grid-width))) 2)))) - (setq bubbles--row-offset - (list - (max 0 (/ (- (nth 3 (window-inside-pixel-edges)) - (nth 1 (window-inside-pixel-edges)) - (* (+ bubbles--image-size 1) ;; margin - (bubbles--grid-height))) 2)))))) - (t - ;; compute offset in units of chars - (setq bubbles--col-offset - (max 0 (/ (- (window-width) - (bubbles--grid-width)) 2))) - (setq bubbles--row-offset - (max 0 (/ (- (window-height) - (bubbles--grid-height) 2) 2)))))) + (let* ((use-images-p (and (display-images-p) + bubbles--images-ok + (not (eq bubbles-graphics-theme 'ascii)))) + (bubbles--image-size + (if use-images-p (car (image-size (car bubbles--images) t)) 1)) + ;; In GUI mode, leave thin margins around the images. + (image-hor-size + (if use-images-p (+ bubbles--image-size 2) bubbles--image-size)) + (image-vert-size + (if use-images-p (1+ bubbles--image-size) bubbles--image-size))) + (setq bubbles--col-offset + (max 0 (/ (- (nth 2 (window-body-pixel-edges)) + (nth 0 (window-body-pixel-edges)) + (* image-hor-size (bubbles--grid-width))) + 2))) + (setq bubbles--row-offset + (max 0 (/ (- (nth 3 (window-body-pixel-edges)) + (nth 1 (window-body-pixel-edges)) + (* image-vert-size (bubbles--grid-height))) + 2))))) (defun bubbles--remove-overlays () "Remove all overlays." @@ -1007,7 +1000,8 @@ bubbles--initialize (insert " ") (put-text-property (point-min) (point) 'display - (cons 'space (list :height bubbles--row-offset))) + (cons 'space (list :height + (list bubbles--row-offset)))) (insert "\n") (let ((max-char (length (bubbles--colors)))) (dotimes (i (bubbles--grid-height)) @@ -1015,7 +1009,8 @@ bubbles--initialize (insert " ") (put-text-property p (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (dotimes (j (bubbles--grid-width)) (let* ((index (random max-char)) (char (nth index bubbles-chars))) @@ -1025,7 +1020,8 @@ bubbles--initialize (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (put-text-property (point-min) (point-max) 'pointer 'arrow)) (bubbles-mode) (bubbles--reset-score) @@ -1177,7 +1173,7 @@ bubbles--show-scores (insert " ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert (format "Score: %4d" bubbles--score)) (put-text-property pos (point) 'status t)))) @@ -1197,7 +1193,7 @@ bubbles--game-over (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert "Game Over!")) ;; save score (gamegrid-add-score (format "bubbles-%s-%d-%d-%d-scores" --000000000000fae3780576125ad1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sep 17, 2018 10:43 AM, "Eli Zaretskii" <eliz@gnu.org> wrote:
> From: Kalman Reti <kalman.reti@gmail.com>
> Date: Sun, 16 Sep 2018 19:44:33 -0400
> Cc: 32744@debbugs.gnu.org=
>
>=C2=A0 I get 8 in GUI frames as well.
>
>=C2=A0 The display spec (space :width 7) means 7 times the width of the=
>=C2=A0 default face's font.=C2=A0 So if your default GUI font is mo= nospaced, you
>=C2=A0 should get 8 in both GUI and text-mode frames.
>
>=C2=A0 So I'm unsure how come you get 2 in GUI mode.=C2=A0 Maybe yo= u've omitted
>=C2=A0 some important detail in the reproducer.
>
> I apologize; you are correct, it gets 8 in gui mode as well. I must ha= ve been confused about which window
> was running which version of emacs while I was experimenting.
>
> But is that the correct value? The bubbles game code clearly wants it = to mean 'the number of forward-chars I
> have to do from the beginning of the line to get here' not 'wh= at column does it visually look like I'm on'.
>
> The doc string for the function doesn't clarify the intended meani= ng.

I think the doc string for current column should be enhanced= to say what it is returning.
>
> If you do m-x bubbles immediately followed by m-: (current-column) it = returns 1 in the gui case but a number
> larger than one (which depends upon the :width keyword of the wide-dis= playing space), but for the game to
> work in the character case it needs to return 1.

It's a bug in bubbles.el, now fixed on the emacs-26 branch.=C2=A0= The patch
is below, so you can apply it locally if you want.

The existing bubble= s code works for both gui and character mode in emacs 22, so I'd charac= terize it less as a bug in bubbles as an incompatibility introduced after e= macs 22.

Is there some o= ther function that will give 'how many forward-chars necessary to go fr= om beginning of line to here?

Thanks for the patch.


The patch does some cleanup, so it might not be easy to spot the
crucial problem it fixes.=C2=A0 The root cause of the bug was that
bubbles--initialize had 2 code paths in it: one for GUI frames (which
worked), and another for TTY frames (which didn't, and it seems to me that no one has ever tried it).=C2=A0 The GUI part computed the offsets as<= br> lists, i.e. '(N), whereas the TTY part produced just N, a simple
number.=C2=A0 And the display property 'space' treats each of these=
differently: '(N) is treated as pixel width, while N is treated as a multiple of the default character width (your example only used the N
form, so it produced 8 instead of 1 from current-column).=C2=A0 Once we
produce '(N) both in GUI and in TTY frames, the game works in both.

Here's the patch I promised; I'm closing the bug report.

diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index e30838d..ee2135b 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -250,10 +250,10 @@ bubbles--images-ok
=C2=A0 =C2=A0"Indicate whether images have been created successfully.&= quot;)

=C2=A0(defvar bubbles--col-offset 0
-=C2=A0 "Horizontal offset for centering the bubbles grid.")
+=C2=A0 "Horizontal offset for centering the bubbles grid, in pixels.&= quot;)

=C2=A0(defvar bubbles--row-offset 0
-=C2=A0 "Vertical offset for centering the bubbles grid.")
+=C2=A0 "Vertical offset for centering the bubbles grid, in pixels.&qu= ot;)

=C2=A0(defvar bubbles--save-data nil
=C2=A0 =C2=A0"List containing bubbles save data (SCORE BUFFERCONTENTS)= .")
@@ -960,33 +960,26 @@ bubbles-quit
=C2=A0(defun bubbles--compute-offsets ()
=C2=A0 =C2=A0"Update horizontal and vertical offsets for centering the= bubbles grid.
=C2=A0Set `bubbles--col-offset' and `bubbles--row-offset'." -=C2=A0 (cond ((and (display-images-p)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bubbles--images-ok
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (not (eq bubbles-graphics= -theme 'ascii))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (fboundp 'window-insi= de-pixel-edges))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; compute offset in units of pixels
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((bubbles--image-size
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (car (image-size (= car bubbles--images) t))))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq bubbles--col-offset
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(list
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (max 0 (/ (= - (nth 2 (window-inside-pixel-edges))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(nth 0 (window-inside-pixel-edges)) -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(* ( + bubbles--image-size 2) ;; marg= in
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bubbles--grid-width))) 2))))=
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq bubbles--row-offset
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(list
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (max 0 (/ (= - (nth 3 (window-inside-pixel-edges))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(nth 1 (window-inside-pixel-edges)) -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(* (+ bubbles--image-size 1) ;; margi= n
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bubbles--grid-height))) 2)))= )))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 (t
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; compute offset in units of chars
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq bubbles--col-offset
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(max 0 (/ (- (windo= w-width)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (bubbles--grid-width)) 2)))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq bubbles--row-offset
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(max 0 (/ (- (windo= w-height)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (bubbles--grid-height) 2) 2))))))
+=C2=A0 (let* ((use-images-p (and (display-images-p)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 bubbles--images-ok
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (not (eq bubbles-graphics-theme 'ascii))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(bubbles--image-size
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if use-images-p (car (image-size (car = bubbles--images) t)) 1))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; In GUI mode, leave thin margins aroun= d the images.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(image-hor-size
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if use-images-p (+ bubbles--image-size= 2) bubbles--image-size))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(image-vert-size
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if use-images-p (1+ bubbles--image-siz= e) bubbles--image-size)))
+=C2=A0 =C2=A0 (setq bubbles--col-offset
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (max 0 (/ (- (nth 2 (window-body-pixel-= edges))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(nth 0 (window-body-pixel-edges))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(* image-hor-size (bubbles--grid-width)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2)))=
+=C2=A0 =C2=A0 (setq bubbles--row-offset
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (max 0 (/ (- (nth 3 (window-body-pixel-= edges))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(nth 1 (window-body-pixel-edges))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(* image-vert-size (bubbles--grid-height)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2)))= ))

=C2=A0(defun bubbles--remove-overlays ()
=C2=A0 =C2=A0"Remove all overlays."
@@ -1007,7 +1000,8 @@ bubbles--initialize
=C2=A0 =C2=A0 =C2=A0(insert " ")
=C2=A0 =C2=A0 =C2=A0(put-text-property (point-min) (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 'display
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cons 'space (list :height bubbles--row-offset)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cons 'space (list :height
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= list bubbles--row-offset))))
=C2=A0 =C2=A0 =C2=A0(insert "\n")
=C2=A0 =C2=A0 =C2=A0(let ((max-char (length (bubbles--colors))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(dotimes (i (bubbles--grid-height))
@@ -1015,7 +1009,8 @@ bubbles--initialize
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert " ")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(put-text-property p (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'display
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cons 'space (list :width bubbles--col-o= ffset))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cons 'space (list :width
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (list bubbles--col-offset)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(dotimes (j (bubbles--grid-width))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let* ((index (random max-char)) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (char (nth i= ndex bubbles-chars)))
@@ -1025,7 +1020,8 @@ bubbles--initialize
=C2=A0 =C2=A0 =C2=A0 =C2=A0(insert "\n ")
=C2=A0 =C2=A0 =C2=A0 =C2=A0(put-text-property (1- (point)) (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 'display
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(cons 'space (list :width bubbles--col-offset))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(cons 'space (list :width
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (list bubbles--col-offset)))))
=C2=A0 =C2=A0 =C2=A0(put-text-property (point-min) (point-max) 'pointer= 'arrow))
=C2=A0 =C2=A0(bubbles-mode)
=C2=A0 =C2=A0(bubbles--reset-score)
@@ -1177,7 +1173,7 @@ bubbles--show-scores
=C2=A0 =C2=A0 =C2=A0 =C2=A0(insert " ")
=C2=A0 =C2=A0 =C2=A0 =C2=A0(put-text-property (1- (point)) (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 'display
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(cons 'space (list :width bubbles--col-offset)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(cons 'space (list :width (list bubbles--col-offset)))= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0(insert (format "Score:=C2=A0 =C2=A0 %4d&qu= ot; bubbles--score))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(put-text-property pos (point) 'status t))))=

@@ -1197,7 +1193,7 @@ bubbles--game-over
=C2=A0 =C2=A0 =C2=A0(insert "\n ")
=C2=A0 =C2=A0 =C2=A0(put-text-property (1- (point)) (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 'display
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cons 'space (list :width bubbles--col-offset)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cons 'space (list :width (list bubbles--col-offset))))
=C2=A0 =C2=A0 =C2=A0(insert "Game Over!"))
=C2=A0 =C2=A0;; save score
=C2=A0 =C2=A0(gamegrid-add-score (format "bubbles-%s-%d-%d-%d-scores&q= uot;

--000000000000fae3780576125ad1-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 17 11:23:00 2018 Received: (at 32744) by debbugs.gnu.org; 17 Sep 2018 15:23:00 +0000 Received: from localhost ([127.0.0.1]:43271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1vMa-00071M-H6 for submit@debbugs.gnu.org; Mon, 17 Sep 2018 11:23:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1vMZ-00071A-H2 for 32744@debbugs.gnu.org; Mon, 17 Sep 2018 11:22:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1vMP-0001Fi-9c for 32744@debbugs.gnu.org; Mon, 17 Sep 2018 11:22:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1vMP-0001Dx-2d; Mon, 17 Sep 2018 11:22:49 -0400 Received: from [176.228.60.248] (port=3816 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g1vMO-0001Rq-Hv; Mon, 17 Sep 2018 11:22:49 -0400 Date: Mon, 17 Sep 2018 18:22:45 +0300 Message-Id: <83k1nkgncq.fsf@gnu.org> From: Eli Zaretskii To: Kalman Reti In-reply-to: (message from Kalman Reti on Mon, 17 Sep 2018 10:54:50 -0400) Subject: Re: bug#32744: There seems to be a bug in current-column in character mode References: <83y3c1gyer.fsf@gnu.org> <83o9cwgp6x.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32744 Cc: 32744@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Kalman Reti > Date: Mon, 17 Sep 2018 10:54:50 -0400 > Cc: 32744-done@debbugs.gnu.org > > > The doc string for the function doesn't clarify the intended meaning. > > I think the doc string for current column should be enhanced to say what it is returning. What would you want it to say in addition or differently to what it says now? > It's a bug in bubbles.el, now fixed on the emacs-26 branch. The patch > is below, so you can apply it locally if you want. > > The existing bubbles code works for both gui and character mode in emacs 22, so I'd characterize it less as a > bug in bubbles as an incompatibility introduced after emacs 22. I don't see bubbles.el in any Emacs 22.x release I have here. Maybe you have some downstream distribution which backported the game from Emacs 23? I did try in Emacs 23, and I saw the same problem there. And the initial revision of bubbles.el I see in Git has the same problem on TTY frames as the one I described. Perhaps there was some bug/misfeature in current-column, which was meanwhile fixed. > Is there some other function that will give 'how many forward-chars necessary to go from beginning of line to > here? I think you want posn-actual-col-row. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 17 11:34:34 2018 Received: (at 32744) by debbugs.gnu.org; 17 Sep 2018 15:34:34 +0000 Received: from localhost ([127.0.0.1]:43277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1vXm-0007Jv-IJ for submit@debbugs.gnu.org; Mon, 17 Sep 2018 11:34:34 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:44187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1vXl-0007Jh-Oy for 32744@debbugs.gnu.org; Mon, 17 Sep 2018 11:34:34 -0400 Received: by mail-ot1-f48.google.com with SMTP id 36-v6so11727813oth.11 for <32744@debbugs.gnu.org>; Mon, 17 Sep 2018 08:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gfrUrJ904KHPDIfaFGqhhMo8XeZKJqEeDmdlFXjo0oY=; b=Fp6wN0zSgIMQrHN6+31b6T3PJD3NOzlQqCzYmOV+jbB/24pDl5yDEVc5kK7EXWUmOt u7YIlcqSu89FxkeY0Daf1RUDigSndCJ37O8wh+3cuRDOKJD00zkEKnw1uwFAWY7DHX9B 4qTArog1gtGqrgThaDNgyMKO0Q5NUGEWw0pAZsk764XJIO92FR/rq7BLKxK/NtWxb5Q2 FCYV/xslIvdz2EY/2mBs4CqXhozel61AfJ/ddpsatVymknRvBTCGwnSaBNCtMGf7jE7g iFr60GsqNcbWlRfNHLlOYN44gB1FLhPqy2bmdkEXJLCzMVUH+C9gbKNwqNWzvy/8LHXi Esjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gfrUrJ904KHPDIfaFGqhhMo8XeZKJqEeDmdlFXjo0oY=; b=bLOUtPIbcd51761hPpCDOTZEvVagnl/7FXRgNhDLpgA+R5Khuh+idUPcz8bWwKvLBw sw+0GGa6GY+kTw+eA2V8wPBd4k6nIGQBsnnfOBsPCf1iQCRqkBL9Gx4kYtmCVu3ixtde VZt/6PZ2nT8/ttcRHJn4RaM3YY51AgVv8Jhij2TR71t03amJ5BNd+kPjhsKVBdpfSDq3 izyhEceP9aoKkle//X2qXZ0//oFyi55wOXoOyu+K5/FZw51Zoq7AKQ6rK9XZQhn+7Vvl 2/2sULH3DNbu6mm4nGbcAEBNRps8Dw8geAiIWdhFigr8oD2OaOOqVLGLD2WweUHvgMXk IFHQ== X-Gm-Message-State: APzg51AALl6QZnHiCayBD1pfYRCMGXh7OI6rnRr2DDl3dlz4fvW50JzX WWHl3c2ZEIvtntF3XgJAAl181G4FWi5bWLHUwuE= X-Google-Smtp-Source: ANB0Vdab87bDAryCjp9B9YwMOA1vNl8yk8lNwtIGI0qvTbFfFRB+ZCTNHz+6xoewrdCFdslZbu0/ckpKx4bv4q9JDI8= X-Received: by 2002:a9d:36a:: with SMTP id 97-v6mr12470880otv.165.1537198468160; Mon, 17 Sep 2018 08:34:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:540f:0:0:0:0:0 with HTTP; Mon, 17 Sep 2018 08:34:27 -0700 (PDT) In-Reply-To: <83k1nkgncq.fsf@gnu.org> References: <83y3c1gyer.fsf@gnu.org> <83o9cwgp6x.fsf@gnu.org> <83k1nkgncq.fsf@gnu.org> From: Noam Postavsky Date: Mon, 17 Sep 2018 11:34:27 -0400 Message-ID: Subject: Re: bug#32744: There seems to be a bug in current-column in character mode To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 32744 Cc: 32744@debbugs.gnu.org, Kalman Reti X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 17 September 2018 at 11:22, Eli Zaretskii wrote: >> Is there some other function that will give 'how many forward-chars necessary to go from beginning of line to >> here? > > I think you want posn-actual-col-row. Or (- (point) (line-beginning-position)) From unknown Sat Aug 16 18:16:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 16 Oct 2018 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator