emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix warning about using `eq' to compare strings.
@ 2023-10-30 16:08 Karl Fogel
  2023-10-31 20:40 ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Karl Fogel @ 2023-10-30 16:08 UTC (permalink / raw)
  To: Org Mode

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

Hi, everyone.  Small fix attached -- it just makes a warning go 
away.

Best regards,
-Karl


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-table.el-fix-warning-about-eq-usage.patch --]
[-- Type: text/x-diff, Size: 1295 bytes --]

From a1a939191af1a195f260037510d407e7483ba05f Mon Sep 17 00:00:00 2001
From: Karl Fogel <kfogel@red-bean.com>
Date: Mon, 30 Oct 2023 10:33:29 -0500
Subject: [PATCH] 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.
---
 lisp/org-table.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index f5a433c7d..860d7720d 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2864,7 +2864,7 @@ list, `literal' is for the format specifier L."
       (if lispp
 	  (if (eq lispp 'literal)
 	      elements
-	    (if (and (eq elements "") (not keep-empty))
+	    (if (and (equal elements "") (not keep-empty))
 		""
 	      (prin1-to-string
 	       (if numbers (string-to-number elements) elements))))
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-10-30 16:08 [PATCH] Fix warning about using `eq' to compare strings Karl Fogel
@ 2023-10-31 20:40 ` Bastien
  2023-11-01  9:11   ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2023-10-31 20:40 UTC (permalink / raw)
  To: Karl Fogel; +Cc: Org Mode

Hi Karl,

Karl Fogel <kfogel@red-bean.com> writes:

> Hi, everyone.  Small fix attached -- it just makes a warning go
> away.

Applied against the main branch, thanks!

-- 
 Bastien


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-10-31 20:40 ` Bastien
@ 2023-11-01  9:11   ` Ihor Radchenko
  2023-11-01  9:16     ` Bastien
  2023-11-01 16:29     ` Karl Fogel
  0 siblings, 2 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-11-01  9:11 UTC (permalink / raw)
  To: Bastien; +Cc: Karl Fogel, Org Mode

Bastien <bzg@gnu.org> writes:

> Karl Fogel <kfogel@red-bean.com> writes:
>
>> Hi, everyone.  Small fix attached -- it just makes a warning go
>> away.
>
> Applied against the main branch, thanks!

Unfortunately, fixing this warning breaks org-table logic and tests.
See previous discussion in
https://list.orgmode.org/orgmode/20230827214320.46754-1-salutis@me.com/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01  9:11   ` Ihor Radchenko
@ 2023-11-01  9:16     ` Bastien
  2023-11-01  9:28       ` Ihor Radchenko
  2023-11-01 16:29     ` Karl Fogel
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2023-11-01  9:16 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Karl Fogel, Org Mode

Ihor Radchenko <yantar92@posteo.net> writes:

> Bastien <bzg@gnu.org> writes:
>
>> Karl Fogel <kfogel@red-bean.com> writes:
>>
>>> Hi, everyone.  Small fix attached -- it just makes a warning go
>>> away.
>>
>> Applied against the main branch, thanks!
>
> Unfortunately, fixing this warning breaks org-table logic and tests.
> See previous discussion in
> https://list.orgmode.org/orgmode/20230827214320.46754-1-salutis@me.com/

Ouch. Reverted.

I took back control over my zombie clone and put him back to sleep in
his coffin.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01  9:16     ` Bastien
@ 2023-11-01  9:28       ` Ihor Radchenko
  2023-11-01 10:00         ` Bastien Guerry
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2023-11-01  9:28 UTC (permalink / raw)
  To: Bastien; +Cc: Karl Fogel, Org Mode

Bastien <bzg@gnu.org> writes:

>> Unfortunately, fixing this warning breaks org-table logic and tests.
>> See previous discussion in
>> https://list.orgmode.org/orgmode/20230827214320.46754-1-salutis@me.com/
>
> Ouch. Reverted.

I added a FIXME explaining the issue to make the problem more clear. I
think this is the third attempted fix of this warning on the list :)

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=1ef9e144a

Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01  9:28       ` Ihor Radchenko
@ 2023-11-01 10:00         ` Bastien Guerry
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien Guerry @ 2023-11-01 10:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Karl Fogel, Org Mode

Ihor Radchenko <yantar92@posteo.net> writes:

> I added a FIXME explaining the issue to make the problem more clear.

Good idea, thanks!

-- 
 Bastien Guerry


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01  9:11   ` Ihor Radchenko
  2023-11-01  9:16     ` Bastien
@ 2023-11-01 16:29     ` Karl Fogel
  2023-11-01 17:59       ` tomas
  2023-11-02  8:14       ` Ihor Radchenko
  1 sibling, 2 replies; 9+ messages in thread
From: Karl Fogel @ 2023-11-01 16:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, Org Mode

On 01 Nov 2023, Ihor Radchenko wrote:
>Bastien <bzg@gnu.org> writes:
>> Karl Fogel <kfogel@red-bean.com> writes:
>>
>>> Hi, everyone.  Small fix attached -- it just makes a warning 
>>> go
>>> away.
>>
>> Applied against the main branch, thanks!
>
>Unfortunately, fixing this warning breaks org-table logic and 
>tests.
>See previous discussion in
>https://list.orgmode.org/orgmode/20230827214320.46754-1-salutis@me.com/

Oh my goodness.  That is... sigh.  Wow.

This is now beyond the "trivial fix" level of effort that I was 
prepared to invest to make this warning go away.  Like Rudolf 
Adamkovič and others before him, I now retire to my country 
estate, to simultaneously lick my wounds and rest on my laurels 
(which I guess is better than licking my laurels and resting on my 
wounds).

Thank you for noticing, and for adding the FIXME later.

Best regards,
-Karl


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01 16:29     ` Karl Fogel
@ 2023-11-01 17:59       ` tomas
  2023-11-02  8:14       ` Ihor Radchenko
  1 sibling, 0 replies; 9+ messages in thread
From: tomas @ 2023-11-01 17:59 UTC (permalink / raw)
  To: emacs-orgmode

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

On Wed, Nov 01, 2023 at 11:29:23AM -0500, Karl Fogel wrote:

> [...] (which I guess is better than licking my
> laurels and resting on my wounds).

Don't underestimate Medirerranean cooking. Laurels can be...
yummy :)

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix warning about using `eq' to compare strings.
  2023-11-01 16:29     ` Karl Fogel
  2023-11-01 17:59       ` tomas
@ 2023-11-02  8:14       ` Ihor Radchenko
  1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-11-02  8:14 UTC (permalink / raw)
  To: Karl Fogel; +Cc: Bastien, Org Mode

Karl Fogel <kfogel@red-bean.com> writes:

> This is now beyond the "trivial fix" level of effort that I was 
> prepared to invest to make this warning go away.  Like Rudolf 
> Adamkovič and others before him, I now retire to my country 
> estate, to simultaneously lick my wounds and rest on my laurels 
> (which I guess is better than licking my laurels and resting on my 
> wounds).

If you want to look into low-effort things to contribute, you may
consider helping to clean up https://tracker.orgmode.org/bugs. A number
of bugs there are already resolved or got no reply and should be closed
- see https://tracker.orgmode.org/howto

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-02  8:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 16:08 [PATCH] Fix warning about using `eq' to compare strings Karl Fogel
2023-10-31 20:40 ` Bastien
2023-11-01  9:11   ` Ihor Radchenko
2023-11-01  9:16     ` Bastien
2023-11-01  9:28       ` Ihor Radchenko
2023-11-01 10:00         ` Bastien Guerry
2023-11-01 16:29     ` Karl Fogel
2023-11-01 17:59       ` tomas
2023-11-02  8:14       ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).