emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix some emacs-30 byte-compile warnings
@ 2023-01-23 13:57 Robert Pluim
  2023-01-23 14:04 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2023-01-23 13:57 UTC (permalink / raw)
  To: emacs-orgmode


The emacs 30 byte-compiler warns about uses of `eq'
and similar with constant strings which might have unintended
semantics. Patch is against emacs master.

-- >8 --
* lisp/org/ob-octave.el (org-babel-octave-evaluate-session): Use
`delete' instead of `delq' when deleting a constant string.
* lisp/org/org-agenda.el (org-agenda-format-item): Use `string=' when
comparing to a constant string.
* lisp/org/org-element.el (org-element-cache-map): Use `equal' when
comparing to a constant list.
* lisp/org/org-table.el (org-table-make-reference): Use `string=' when
comparing to a constant string.
---
diff --git c/lisp/org/ob-octave.el i/lisp/org/ob-octave.el
index 9bf16b9849..e411961e92 100644
--- c/lisp/org/ob-octave.el
+++ i/lisp/org/ob-octave.el
@@ -243,7 +243,7 @@ org-babel-octave-evaluate-session
       (`output
        (setq results
 	     (if matlabp
-		 (cdr (reverse (delq "" (mapcar #'org-strip-quotes
+		 (cdr (reverse (delete "" (mapcar #'org-strip-quotes
 						(mapcar #'org-trim raw)))))
 	       (cdr (member org-babel-octave-eoe-output
 			    (reverse (mapcar #'org-strip-quotes
diff --git c/lisp/org/org-agenda.el i/lisp/org/org-agenda.el
index 2d194ad341..b0587d5d92 100644
--- c/lisp/org/org-agenda.el
+++ i/lisp/org/org-agenda.el
@@ -7326,7 +7326,7 @@ org-agenda-format-item
 			      (let ((s (org-format-outline-path (org-get-outline-path)
 								(1- (frame-width))
 								nil org-agenda-breadcrumbs-separator)))
-				(if (eq "" s) "" (concat s org-agenda-breadcrumbs-separator))))))
+				(if (string= "" s) "" (concat s org-agenda-breadcrumbs-separator))))))
 	(setq time (cond (s2 (concat
 			      (org-agenda-time-of-day-to-ampm-maybe s1)
 			      "-" (org-agenda-time-of-day-to-ampm-maybe s2)
diff --git c/lisp/org/org-element.el i/lisp/org/org-element.el
index 389acf8250..e427966f57 100644
--- c/lisp/org/org-element.el
+++ i/lisp/org/org-element.el
@@ -7558,7 +7558,7 @@ org-element-cache-map
                  ;; beginning.
                  (next-element-re (pcase granularity
                                     ((or `headline
-                                         (guard (eq '(headline)
+                                         (guard (equal '(headline)
                                                     restrict-elements)))
                                      (cons
                                       (org-with-limited-levels
@@ -7566,7 +7566,7 @@ org-element-cache-map
                                       'match-beg))
                                     (`headline+inlinetask
                                      (cons
-                                      (if (eq '(inlinetask) restrict-elements)
+                                      (if (equal '(inlinetask) restrict-elements)
                                           (org-inlinetask-outline-regexp)
                                         org-element-headline-re)
                                       'match-beg))
diff --git c/lisp/org/org-table.el i/lisp/org/org-table.el
index 5116b1127f..fbfdc253f9 100644
--- c/lisp/org/org-table.el
+++ i/lisp/org/org-table.el
@@ -2861,7 +2861,7 @@ org-table-make-reference
       (if lispp
 	  (if (eq lispp 'literal)
 	      elements
-	    (if (and (eq elements "") (not keep-empty))
+	    (if (and (string= elements "") (not keep-empty))
 		""
 	      (prin1-to-string
 	       (if numbers (string-to-number elements) elements))))

Robert
-- 


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

* Re: [PATCH] Fix some emacs-30 byte-compile warnings
  2023-01-23 13:57 [PATCH] Fix some emacs-30 byte-compile warnings Robert Pluim
@ 2023-01-23 14:04 ` Ihor Radchenko
  2023-01-23 17:28   ` Robert Pluim
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-01-23 14:04 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-orgmode

Robert Pluim <rpluim@gmail.com> writes:

> The emacs 30 byte-compiler warns about uses of `eq'
> and similar with constant strings which might have unintended
> semantics. Patch is against emacs master.

Thanks, but it will break some tests:

3 unexpected results:
   FAILED  test-org-table/copy-field
   FAILED  test-org-table/references/mode-string-N
   FAILED  test-org-table/references/mode-string-none

-- 
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] 5+ messages in thread

* Re: [PATCH] Fix some emacs-30 byte-compile warnings
  2023-01-23 14:04 ` Ihor Radchenko
@ 2023-01-23 17:28   ` Robert Pluim
  2023-02-17 14:08     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2023-01-23 17:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

>>>>> On Mon, 23 Jan 2023 14:04:42 +0000, Ihor Radchenko <yantar92@posteo.net> said:

    Ihor> Robert Pluim <rpluim@gmail.com> writes:
    >> The emacs 30 byte-compiler warns about uses of `eq'
    >> and similar with constant strings which might have unintended
    >> semantics. Patch is against emacs master.

    Ihor> Thanks, but it will break some tests:

    Ihor> 3 unexpected results:
    Ihor>    FAILED  test-org-table/copy-field
    Ihor>    FAILED  test-org-table/references/mode-string-N
    Ihor>    FAILED  test-org-table/references/mode-string-none

Hmm, at least the first one is because the code in the 't' branch of
	    (if (and (eq elements "") (not keep-empty))

in org-table-make-reference now runs, and it results in

(eval '(identity))'

Of course fixing that causes other problems <sigh>

Iʼll get back to this maybe tomorrow.

Robert
-- 


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

* Re: [PATCH] Fix some emacs-30 byte-compile warnings
  2023-01-23 17:28   ` Robert Pluim
@ 2023-02-17 14:08     ` Ihor Radchenko
  2023-02-17 15:33       ` Robert Pluim
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-02-17 14:08 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-orgmode

Robert Pluim <rpluim@gmail.com> writes:

>     Ihor> 3 unexpected results:
>     Ihor>    FAILED  test-org-table/copy-field
>     Ihor>    FAILED  test-org-table/references/mode-string-N
>     Ihor>    FAILED  test-org-table/references/mode-string-none
>
> Hmm, at least the first one is because the code in the 't' branch of
> 	    (if (and (eq elements "") (not keep-empty))
>
> in org-table-make-reference now runs, and it results in
>
> (eval '(identity))'
>
> Of course fixing that causes other problems <sigh>

Meanwhile, I fixed all the other warnings.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eea8da0315b4d9c43272f4ee87d752e651f1a0c0
Now, only this org-table problem remains.

It is clearly a bug of some kind - the code is not doing what it
intended originally. But we need to understand org-table.el better to
fix this...

-- 
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] 5+ messages in thread

* Re: [PATCH] Fix some emacs-30 byte-compile warnings
  2023-02-17 14:08     ` Ihor Radchenko
@ 2023-02-17 15:33       ` Robert Pluim
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Pluim @ 2023-02-17 15:33 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

>>>>> On Fri, 17 Feb 2023 14:08:04 +0000, Ihor Radchenko <yantar92@posteo.net> said:

    Ihor> Robert Pluim <rpluim@gmail.com> writes:
    Ihor> 3 unexpected results:
    Ihor> FAILED  test-org-table/copy-field
    Ihor> FAILED  test-org-table/references/mode-string-N
    Ihor> FAILED  test-org-table/references/mode-string-none
    >> 
    >> Hmm, at least the first one is because the code in the 't' branch of
    >> (if (and (eq elements "") (not keep-empty))
    >> 
    >> in org-table-make-reference now runs, and it results in
    >> 
    >> (eval '(identity))'
    >> 
    >> Of course fixing that causes other problems <sigh>

    Ihor> Meanwhile, I fixed all the other warnings.
    Ihor> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eea8da0315b4d9c43272f4ee87d752e651f1a0c0
    Ihor> Now, only this org-table problem remains.

    Ihor> It is clearly a bug of some kind - the code is not doing what it
    Ihor> intended originally. But we need to understand org-table.el better to
    Ihor> fix this...

Iʼve not had time to look at it further (probably my subconscious not
wanting to deal with org-table.el :-))

Robert
-- 


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

end of thread, other threads:[~2023-02-17 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 13:57 [PATCH] Fix some emacs-30 byte-compile warnings Robert Pluim
2023-01-23 14:04 ` Ihor Radchenko
2023-01-23 17:28   ` Robert Pluim
2023-02-17 14:08     ` Ihor Radchenko
2023-02-17 15:33       ` Robert Pluim

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).