branch: externals/org commit 7c19c4d4333be7a6e7f23c1f3f0191aafd8f788f Author: Stefan Kangas <stefankan...@gmail.com> Commit: Kyle Meyer <k...@kyleam.com>
Backport commit 9efd11e5f from Emacs * lisp/org-capture.el (org-capture-escaped-%): * lisp/org-element-ast.el (org-element-create): * lisp/org-macro.el (org-macro-extract-arguments): * lisp/org-persist.el (org-persist--get-collection): * lisp/ox-odt.el (org-odt-get-table-cell-styles): * lisp/ox.el (org-export--dispatch-ui): Prefer 'cl-evenp/'cl-oddp' to free-coding them in some files that already depend on cl-lib in run-time. Prefer cl-evenp/cl-oddp in some places 9efd11e5fd4324fb1686b802c15ae36046b0939a Stefan Kangas Mon Feb 17 02:00:51 2025 +0100 --- lisp/org-capture.el | 2 +- lisp/org-element-ast.el | 2 +- lisp/org-macro.el | 2 +- lisp/org-persist.el | 2 +- lisp/ox-odt.el | 8 ++++---- lisp/ox.el | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 0720ad53cc..d4ae0207c3 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1920,7 +1920,7 @@ placeholder to check." (goto-char (match-beginning 0)) (let ((n (abs (skip-chars-backward "\\\\")))) (delete-char (/ (1+ n) 2)) - (= (% n 2) 1)))) + (cl-oddp n)))) (defun org-capture-expand-embedded-elisp (&optional mark) "Evaluate embedded elisp %(sexp) and replace with the result. diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el index b91cf9fc65..2322bc69fc 100644 --- a/lisp/org-element-ast.el +++ b/lisp/org-element-ast.el @@ -734,7 +734,7 @@ string. Alternatively, TYPE can be a string. When TYPE is nil or (cl-assert ;; FIXME: Just use `plistp' from Emacs 29 when available. (let ((len (proper-list-p props))) - (and len (zerop (% len 2))))) + (and len (cl-evenp len)))) ;; Assign parray. (when (and props (not (stringp type)) (not (eq type 'plain-text))) (let ((node (list 'dummy props))) diff --git a/lisp/org-macro.el b/lisp/org-macro.el index 66ae4d7af6..500dfbc545 100644 --- a/lisp/org-macro.el +++ b/lisp/org-macro.el @@ -329,7 +329,7 @@ Return a list of arguments, as strings. This is the opposite of (lambda (str) (let ((len (length (match-string 1 str)))) (concat (make-string (/ len 2) ?\\) - (if (zerop (mod len 2)) "\000" ",")))) + (if (cl-evenp len) "\000" ",")))) s nil t) "\000")) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 104ad86d52..16ac13ae87 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -594,7 +594,7 @@ MISC, if non-nil will be appended to the collection. It must be a plist." (unless (and (listp container) (listp (car container))) (setq container (list container))) (setq associated (org-persist--normalize-associated associated)) - (when (and misc (or (not (listp misc)) (= 1 (% (length misc) 2)))) + (when (and misc (or (not (listp misc)) (cl-oddp (length misc)))) (error "org-persist: Not a plist: %S" misc)) (or (org-persist--find-index `( :container ,(org-persist--normalize-container container) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index ba8b4d9d3b..04c70c5b56 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -3293,13 +3293,13 @@ styles congruent with the ODF-1.2 specification." (= (1+ r) (car table-dimensions))) "LastRow") ((and (cdr (assq 'use-banding-rows-styles cell-style-selectors)) - (= (% r 2) 1)) "EvenRow") + (cl-oddp r)) "EvenRow") ((and (cdr (assq 'use-banding-rows-styles cell-style-selectors)) - (= (% r 2) 0)) "OddRow") + (cl-evenp r)) "OddRow") ((and (cdr (assq 'use-banding-columns-styles cell-style-selectors)) - (= (% c 2) 1)) "EvenColumn") + (cl-oddp c)) "EvenColumn") ((and (cdr (assq 'use-banding-columns-styles cell-style-selectors)) - (= (% c 2) 0)) "OddColumn") + (cl-evenp c)) "OddColumn") (t "")))) (concat template-name cell-type))))) diff --git a/lisp/ox.el b/lisp/ox.el index 7f3f66a6f2..a2a21a72c4 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -7287,14 +7287,14 @@ back to standard interface." (lambda (sub-entry) (cl-incf index) (format - (if (zerop (mod index 2)) " [%s] %-26s" + (if (cl-evenp index) " [%s] %-26s" "[%s] %s\n") (funcall fontify-key (char-to-string (car sub-entry)) top-key) (nth 1 sub-entry))) sub-menu "") - (when (zerop (mod index 2)) "\n")))))))) + (when (cl-evenp index) "\n")))))))) entries "")) ;; Publishing menu is hard-coded. (format "\n[%s] Publish