all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Fogel <kfogel@red-bean.com>
To: Emacs Devel <emacs-devel@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: [elpa] externals/org ee0961ba31: lisp/org-table.el: fix warning about `eq' usage
Date: Wed, 01 Nov 2023 01:07:50 -0500	[thread overview]
Message-ID: <87pm0u9fbd.fsf@red-bean.com> (raw)
In-Reply-To: <jwvwmv2i3b7.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]

Stefan Monnier wrote:
>> This change does not affect the behavior of
>> `org-table-make-reference' because `eq' treats all instances
>> of the empty string as the same object anyway, e.g., 
>> `(eq (string-trim "aaabbb" "a+" "b+") "")' ==> t.
>
>Not quite so: (eq (string-to-multibyte "") "") => nil

Thank you for noticing this, Stefan.

I did many tests with `eq' and various kinds of generated empty 
strings before writing that commit message -- but, alas, I didn't 
think of testing with a multibyte string.  (I also looked in the 
documentation, and the fact that there was no explicit mention of 
all empty strings being the same object should have tipped me 
off!)

So, I believe this means there is an error in that commit message. 
I've attached the commitinfo below for easy reference, with 
'inline' disposition.

However, the code change itself remains correct... I think?  That 
is: the previous code presumably had a latent bug, in that there 
*could* have been times when the `eq' test would fail when 
comparing against a multibyte empty string.

I don't know much about how Org Mode gets merged into Emacs, nor 
whether there are opportunities for rebasing anywhere along the 
way in that process.  If there's a way to update that commit 
message, then I'd do so (I can post a new one here).  But if 
there's no such opportunity, then so be it: I'll be on the 
permanent record with a technical mistake in a log message.  I'm 
sure it wouldn't be the first time :-/.

Best regards,
-Karl


[-- Attachment #2: commit ee0961ba317 --]
[-- Type: text/plain, Size: 878 bytes --]

commit ee0961ba3170f7bc89c2f6fabda4b6ea2e7a2c88
Author:     Karl Fogel <kfogel@red-bean.com>
AuthorDate: Mon Oct 30 10:33:29 2023 -0500
Commit:     Bastien Guerry <bzg@gnu.org>
CommitDate: Tue Oct 31 21:38:23 2023 +0100

    lisp/org-table.el: fix warning about `eq' usage
    
    * lisp/org-table.el (org-table-make-reference): Use `equal' instead of
    `eq' to compare strings.
    
    This change makes the following warning go away:
    
      Warning (comp): org-table.el:2867:23: \
      Warning: `eq' called with literal string that may never match (arg 2)
    
    This change does not affect the behavior of `org-table-make-reference'
    because `eq' treats all instances of the empty string as the same
    object anyway, e.g., `(eq (string-trim "aaabbb" "a+" "b+") "")' ==> t.
    The only effect of this change is to eliminate the warning.

M	lisp/org-table.el


  reply	other threads:[~2023-11-01  6:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <169879312007.20093.7465071871654518215@vcs2.savannah.gnu.org>
     [not found] ` <20231031225840.6A0FEC06553@vcs2.savannah.gnu.org>
2023-11-01  3:05   ` [elpa] externals/org ee0961ba31: lisp/org-table.el: fix warning about `eq' usage Stefan Monnier
2023-11-01  6:07     ` Karl Fogel [this message]
2023-11-01  9:04       ` Bastien
2023-11-01 11:31         ` Stefan Monnier
2023-11-01 16:22           ` Karl Fogel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pm0u9fbd.fsf@red-bean.com \
    --to=kfogel@red-bean.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.