From: Karl Fogel <kfogel@red-bean.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix warning about using `eq' to compare strings.
Date: Mon, 30 Oct 2023 11:08:19 -0500 [thread overview]
Message-ID: <875y2oxfd8.fsf@red-bean.com> (raw)
[-- 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
next reply other threads:[~2023-10-30 16:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 16:08 Karl Fogel [this message]
2023-10-31 20:40 ` [PATCH] Fix warning about using `eq' to compare strings 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
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=875y2oxfd8.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=emacs-orgmode@gnu.org \
/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.