summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-07-25 16:34:48 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-07-25 17:10:53 +0200
commitc4da20a2f33a3e859df6a5d9d8f95e3a46e453ec (patch)
treef6357250e127883011ca80081bb30dcb72cf3450
parent2d9b20a57d5e6a9feb4aab697a9e6e2c9a99ca27 (diff)
downloadorg-mode-c4da20a2f33a3e859df6a5d9d8f95e3a46e453ec.tar.gz
Silence byte-compiler
* lisp/ob-core.el (org-babel-process-params): Silence byte-compiler. * lisp/ob-groovy.el (org-babel-groovy-evaluate): * lisp/ob-haskell.el (org-babel-execute:haskell): * lisp/ob-io.el (org-babel-io-evaluate): * lisp/ob-octave.el (org-babel-octave-evaluate-external-process): (org-babel-octave-evaluate-session): * lisp/ob-perl.el (org-babel-perl-evaluate): * lisp/ob-python.el (org-babel-python-evaluate-external-process): (org-babel-python-evaluate-session): * lisp/ob-ruby.el (org-babel-ruby-pp-wrapper-method): (org-babel-ruby-evaluate): * lisp/ob-scala.el: * lisp/ob-tangle.el: (org-babel-tangle-collect-blocks): * lisp/org-agenda.el (org-agenda-get-category-icon): (org-agenda-todo-yesterday): * lisp/org-bbdb.el (org-bbdb-anniv-extract-date): (org-bbdb-make-anniv-hash): (org-bbdb-anniversaries-future): * lisp/org-bibtex.el (org-bibtex-fleshout): (org-bibtex-read): (org-bibtex-write): * lisp/org-capture.el (org-capture-set-target-location): (org-capture-get-indirect-buffer): (org-mks): * lisp/org-clock.el (org-clock--oldest-date): (org-clock-resolve): (org-clock-sum): (org-clock-special-range): (org-clocktable-steps): * lisp/org-ctags.el (org-ctags-create-tags): * lisp/org-element.el (org-element--interpret-affiliated-keywords): (org-element--cache-shift-positions): (org-element--cache-sync): (org-element--cache-submit-request): * lisp/org-habit.el (org-habit-parse-todo): * lisp/org-inlinetask.el (org-inlinetask-hide-tasks): * lisp/org-lint.el (org-lint--generate-reports): * lisp/org-mouse.el (org-mouse-get-context): * lisp/org-plot.el (org-plot/gnuplot-to-grid-data): (org-plot/gnuplot): * lisp/ox-ascii.el (org-ascii--current-text-width): (org-ascii--current-justification): (org-ascii--build-caption): (org-ascii--checkbox): (org-ascii-item): * lisp/ox-html.el (org-html-footnote-section): * lisp/ox-latex.el (org-latex--make-option-string): * lisp/ox-odt.el (org-odt-toc): (org-odt-add-automatic-style): (org-odt-format-label): (org-odt-link--inline-image): (org-odt--render-image/formula): (org-odt--enumerable-image-p): (org-odt--enumerable-latex-image-p): (org-odt--enumerable-formula-p): (org-odt-do-format-code): (org-odt-table-cell): Silence byte-compiler.
-rw-r--r--lisp/ob-core.el4
-rw-r--r--lisp/ob-groovy.el8
-rw-r--r--lisp/ob-haskell.el6
-rw-r--r--lisp/ob-io.el20
-rw-r--r--lisp/ob-octave.el41
-rw-r--r--lisp/ob-perl.el6
-rw-r--r--lisp/ob-python.el46
-rw-r--r--lisp/ob-ruby.el28
-rw-r--r--lisp/ob-scala.el14
-rw-r--r--lisp/ob-tangle.el4
-rw-r--r--lisp/org-agenda.el7
-rw-r--r--lisp/org-bbdb.el55
-rw-r--r--lisp/org-bibtex.el17
-rw-r--r--lisp/org-capture.el8
-rw-r--r--lisp/org-clock.el82
-rw-r--r--lisp/org-ctags.el2
-rw-r--r--lisp/org-element.el27
-rw-r--r--lisp/org-habit.el2
-rw-r--r--lisp/org-inlinetask.el6
-rw-r--r--lisp/org-lint.el5
-rw-r--r--lisp/org-mouse.el4
-rw-r--r--lisp/org-plot.el11
-rw-r--r--lisp/ox-ascii.el36
-rw-r--r--lisp/ox-html.el10
-rw-r--r--lisp/ox-latex.el7
-rw-r--r--lisp/ox-odt.el33
26 files changed, 251 insertions, 238 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 6e4362a..a059247 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1529,8 +1529,8 @@ shown below.
(list
(cons :colname-names (or (cdr (assoc :colname-names params))
(cadr vars-and-names)))
- (cons :rowname-names (or (cdr (assoc :rowname-names params))
- (caddr vars-and-names)))
+ (cons :rowname-names (or (cdr (assq :rowname-names params))
+ (cl-caddr vars-and-names)))
(cons :result-params result-params)
(cons :result-type (cond ((member "output" result-params) 'output)
((member "value" result-params) 'value)
diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
index e421ae8..fc1367f 100644
--- a/lisp/ob-groovy.el
+++ b/lisp/ob-groovy.el
@@ -76,19 +76,19 @@ println(new Runner().run())
(defun org-babel-groovy-evaluate
- (session body &optional result-type result-params)
+ (session body &optional result-type result-params)
"Evaluate BODY in external Groovy process.
If RESULT-TYPE equals `output' then return standard output as a string.
If RESULT-TYPE equals `value' then return the value of the last statement
in BODY as elisp."
(when session (error "Sessions are not (yet) supported for Groovy"))
- (case result-type
- (output
+ (pcase result-type
+ (`output
(let ((src-file (org-babel-temp-file "groovy-")))
(progn (with-temp-file src-file (insert body))
(org-babel-eval
(concat org-babel-groovy-command " " src-file) ""))))
- (value
+ (`value
(let* ((src-file (org-babel-temp-file "groovy-"))
(wrapper (format org-babel-groovy-wrapper-method body)))
(with-temp-file src-file (insert wrapper))
diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el
index 1d7cff1..cee4749 100644
--- a/lisp/ob-haskell.el
+++ b/lisp/ob-haskell.el
@@ -79,9 +79,9 @@
(reverse (mapcar #'org-trim raw)))))))
(org-babel-reassemble-table
(let ((result
- (case result-type
- (output (mapconcat #'identity (reverse (cdr results)) "\n"))
- (value (car results)))))
+ (pcase result-type
+ (`output (mapconcat #'identity (reverse (cdr results)) "\n"))
+ (`value (car results)))))
(org-babel-result-cond (cdr (assoc :result-params params))
result (org-babel-script-escape result)))
(org-babel-pick-name (cdr (assoc :colname-names params))
diff --git a/lisp/ob-io.el b/lisp/ob-io.el
index f79559c..f432009 100644
--- a/lisp/ob-io.el
+++ b/lisp/ob-io.el
@@ -73,22 +73,22 @@ If RESULT-TYPE equals `output' then return standard output as a string.
If RESULT-TYPE equals `value' then return the value of the last statement
in BODY as elisp."
(when session (error "Sessions are not (yet) supported for Io"))
- (case result-type
- (output
+ (pcase result-type
+ (`output
(if (member "repl" result-params)
(org-babel-eval org-babel-io-command body)
(let ((src-file (org-babel-temp-file "io-")))
(progn (with-temp-file src-file (insert body))
(org-babel-eval
(concat org-babel-io-command " " src-file) "")))))
- (value (let* ((src-file (org-babel-temp-file "io-"))
- (wrapper (format org-babel-io-wrapper-method body)))
- (with-temp-file src-file (insert wrapper))
- (let ((raw (org-babel-eval
- (concat org-babel-io-command " " src-file) "")))
- (org-babel-result-cond result-params
- raw
- (org-babel-script-escape raw)))))))
+ (`value (let* ((src-file (org-babel-temp-file "io-"))
+ (wrapper (format org-babel-io-wrapper-method body)))
+ (with-temp-file src-file (insert wrapper))
+ (let ((raw (org-babel-eval
+ (concat org-babel-io-command " " src-file) "")))
+ (org-babel-result-cond result-params
+ raw
+ (org-babel-script-escape raw)))))))
(defun org-babel-prep-session:io (_session _params)
diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index deef582..4a0b324 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -177,9 +177,9 @@ value of the last statement in BODY, as elisp."
(let ((cmd (if matlabp
org-babel-matlab-shell-command
org-babel-octave-shell-command)))
- (case result-type
- (output (org-babel-eval cmd body))
- (value (let ((tmp-file (org-babel-temp-file "octave-")))
+ (pcase result-type
+ (`output (org-babel-eval cmd body))
+ (`value (let ((tmp-file (org-babel-temp-file "octave-")))
(org-babel-eval
cmd
(format org-babel-octave-wrapper-method body
@@ -188,17 +188,17 @@ value of the last statement in BODY, as elisp."
(org-babel-octave-import-elisp-from-file tmp-file))))))
(defun org-babel-octave-evaluate-session
- (session body result-type &optional matlabp)
+ (session body result-type &optional matlabp)
"Evaluate BODY in SESSION."
(let* ((tmp-file (org-babel-temp-file (if matlabp "matlab-" "octave-")))
(wait-file (org-babel-temp-file "matlab-emacs-link-wait-signal-"))
(full-body
- (case result-type
- (output
+ (pcase result-type
+ (`output
(mapconcat
#'org-babel-chomp
(list body org-babel-octave-eoe-indicator) "\n"))
- (value
+ (`value
(if (and matlabp org-babel-matlab-with-emacs-link)
(concat
(format org-babel-matlab-emacs-link-wrapper-method
@@ -231,21 +231,20 @@ value of the last statement in BODY, as elisp."
org-babel-octave-eoe-output)
t full-body)
(insert full-body) (comint-send-input nil t)))) results)
- (case result-type
- (value
+ (pcase result-type
+ (`value
(org-babel-octave-import-elisp-from-file tmp-file))
- (output
- (progn
- (setq results
- (if matlabp
- (cdr (reverse (delq "" (mapcar
- #'org-babel-octave-read-string
- (mapcar #'org-trim raw)))))
- (cdr (member org-babel-octave-eoe-output
- (reverse (mapcar
- #'org-babel-octave-read-string
- (mapcar #'org-trim raw)))))))
- (mapconcat #'identity (reverse results) "\n"))))))
+ (`output
+ (setq results
+ (if matlabp
+ (cdr (reverse (delq "" (mapcar
+ #'org-babel-octave-read-string
+ (mapcar #'org-trim raw)))))
+ (cdr (member org-babel-octave-eoe-output
+ (reverse (mapcar
+ #'org-babel-octave-read-string
+ (mapcar #'org-trim raw)))))))
+ (mapconcat #'identity (reverse results) "\n")))))
(defun org-babel-octave-import-elisp-from-file (file-name)
"Import data from FILE-NAME.
diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el
index ba91d28..4445f8c 100644
--- a/lisp/ob-perl.el
+++ b/lisp/ob-perl.el
@@ -135,13 +135,13 @@ return the value of the last statement in BODY, as elisp."
(tmp-babel-file (org-babel-process-file-name
tmp-file 'noquote)))
(let ((results
- (case result-type
- (output
+ (pcase result-type
+ (`output
(with-temp-file tmp-file
(insert
(org-babel-eval org-babel-perl-command body))
(buffer-string)))
- (value
+ (`value
(org-babel-eval org-babel-perl-command
(format org-babel-perl-wrapper-method
body tmp-babel-file))))))
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index d50da9c..475af3e 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -254,26 +254,26 @@ If RESULT-TYPE equals `output' then return standard output as a
string. If RESULT-TYPE equals `value' then return the value of the
last statement in BODY, as elisp."
(let ((raw
- (case result-type
- (output (org-babel-eval org-babel-python-command
- (concat (if preamble (concat preamble "\n"))
- body)))
- (value (let ((tmp-file (org-babel-temp-file "python-")))
- (org-babel-eval
- org-babel-python-command
- (concat
- (if preamble (concat preamble "\n") "")
- (format
- (if (member "pp" result-params)
- org-babel-python-pp-wrapper-method
- org-babel-python-wrapper-method)
- (mapconcat
- (lambda (line) (format "\t%s" line))
- (split-string (org-remove-indentation (org-trim body))
- "[\r\n]")
- "\n")
- (org-babel-process-file-name tmp-file 'noquote))))
- (org-babel-eval-read-file tmp-file))))))
+ (pcase result-type
+ (`output (org-babel-eval org-babel-python-command
+ (concat (if preamble (concat preamble "\n"))
+ body)))
+ (`value (let ((tmp-file (org-babel-temp-file "python-")))
+ (org-babel-eval
+ org-babel-python-command
+ (concat
+ (if preamble (concat preamble "\n") "")
+ (format
+ (if (member "pp" result-params)
+ org-babel-python-pp-wrapper-method
+ org-babel-python-wrapper-method)
+ (mapconcat
+ (lambda (line) (format "\t%s" line))
+ (split-string (org-remove-indentation (org-trim body))
+ "[\r\n]")
+ "\n")
+ (org-babel-process-file-name tmp-file 'noquote))))
+ (org-babel-eval-read-file tmp-file))))))
(org-babel-result-cond result-params
raw
(org-babel-python-table-or-string (org-trim raw)))))
@@ -303,8 +303,8 @@ last statement in BODY, as elisp."
(split-string body "[\r\n]"))
(funcall send-wait)))
(results
- (case result-type
- (output
+ (pcase result-type
+ (`output
(mapconcat
#'org-trim
(butlast
@@ -315,7 +315,7 @@ last statement in BODY, as elisp."
(insert org-babel-python-eoe-indicator)
(funcall send-wait))
2) "\n"))
- (value
+ (`value
(let ((tmp-file (org-babel-temp-file "python-")))
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator nil body)
diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index 84d974b..6d5c682 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -185,26 +185,26 @@ end
")
(defun org-babel-ruby-evaluate
- (buffer body &optional result-type result-params)
+ (buffer body &optional result-type result-params)
"Pass BODY to the Ruby process in BUFFER.
If RESULT-TYPE equals `output' then return a list of the outputs
of the statements in BODY, if RESULT-TYPE equals `value' then
return the value of the last statement in BODY, as elisp."
(if (not buffer)
;; external process evaluation
- (case result-type
- (output (org-babel-eval org-babel-ruby-command body))
- (value (let ((tmp-file (org-babel-temp-file "ruby-")))
- (org-babel-eval
- org-babel-ruby-command
- (format (if (member "pp" result-params)
- org-babel-ruby-pp-wrapper-method
- org-babel-ruby-wrapper-method)
- body (org-babel-process-file-name tmp-file 'noquote)))
- (org-babel-eval-read-file tmp-file))))
+ (pcase result-type
+ (`output (org-babel-eval org-babel-ruby-command body))
+ (`value (let ((tmp-file (org-babel-temp-file "ruby-")))
+ (org-babel-eval
+ org-babel-ruby-command
+ (format (if (member "pp" result-params)
+ org-babel-ruby-pp-wrapper-method
+ org-babel-ruby-wrapper-method)
+ body (org-babel-process-file-name tmp-file 'noquote)))
+ (org-babel-eval-read-file tmp-file))))
;; comint session evaluation
- (case result-type
- (output
+ (pcase result-type
+ (`output
(let ((eoe-string (format "puts \"%s\"" org-babel-ruby-eoe-indicator)))
;; Force the session to be ready before the actual session
;; code is run. There is some problem in comint that will
@@ -231,7 +231,7 @@ return the value of the last statement in BODY, as elisp."
"conf.prompt_mode=_org_prompt_mode;conf.echo=true"
eoe-string)))
"\n") "[\r\n]") 4) "\n")))
- (value
+ (`value
(let* ((tmp-file (org-babel-temp-file "ruby-"))
(ppp (or (member "code" result-params)
(member "pp" result-params))))
diff --git a/lisp/ob-scala.el b/lisp/ob-scala.el
index de8295c..ded1108 100644
--- a/lisp/ob-scala.el
+++ b/lisp/ob-scala.el
@@ -74,19 +74,19 @@ print(str_result)
(defun org-babel-scala-evaluate
- (session body &optional result-type result-params)
+ (session body &optional result-type result-params)
"Evaluate BODY in external Scala process.
If RESULT-TYPE equals `output' then return standard output as a string.
If RESULT-TYPE equals `value' then return the value of the last statement
in BODY as elisp."
(when session (error "Sessions are not (yet) supported for Scala"))
- (case result-type
- (output
+ (pcase result-type
+ (`output
(let ((src-file (org-babel-temp-file "scala-")))
- (progn (with-temp-file src-file (insert body))
- (org-babel-eval
- (concat org-babel-scala-command " " src-file) ""))))
- (value
+ (with-temp-file src-file (insert body))
+ (org-babel-eval
+ (concat org-babel-scala-command " " src-file) "")))
+ (`value
(let* ((src-file (org-babel-temp-file "scala-"))
(wrapper (format org-babel-scala-wrapper-method body)))
(with-temp-file src-file (insert wrapper))
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 33ffe07..75672cc 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -26,6 +26,8 @@
;; Extract the code from source blocks out into raw source-code files.
;;; Code:
+
+(require 'cl-lib)
(require 'org-src)
(declare-function make-directory "files" (dir &optional parents))
@@ -410,7 +412,7 @@ can be used to limit the collected code blocks by target file."
(let ((current-heading-pos
(org-with-wide-buffer
(org-with-limited-levels (outline-previous-heading)))))
- (if (eq last-heading-pos current-heading-pos) (incf counter)
+ (if (eq last-heading-pos current-heading-pos) (cl-incf counter)
(setq counter 1)
(setq last-heading-pos current-heading-pos)))
(unless (org-in-commented-heading-p)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ea2fa48..6581895 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6442,8 +6442,8 @@ The flag is set if the currently compiled format contains a `%b'.")
(dolist (entry org-agenda-category-icon-alist)
(when (string-match-p (car entry) category)
(if (listp (cadr entry))
- (return (cadr entry))
- (return (apply 'create-image (cdr entry)))))))
+ (cl-return (cadr entry))
+ (cl-return (apply #'create-image (cdr entry)))))))
(defun org-agenda-format-item (extra txt &optional level category tags dotime
remove-re habitp)
@@ -10168,8 +10168,7 @@ when defining today."
"Like `org-agenda-todo' but the time of change will be 23:59 of yesterday."
(interactive "P")
(let* ((org-use-effective-time t)
- (hour (third (decode-time
- (org-current-time))))
+ (hour (nth 2 (decode-time (org-current-time))))
(org-extend-today-until (1+ hour)))
(org-agenda-todo arg)))
diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index 5f3971b..75d19b0 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -281,14 +281,11 @@ italicized, in all other cases it is left unchanged."
"Convert YYYY-MM-DD to (month date year).
Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted
it will be considered unknown."
- (multiple-value-bind (a b c) (values-list (org-split-string time-str "-"))
- (if (eq c nil)
- (list (string-to-number a)
- (string-to-number b)
- nil)
- (list (string-to-number b)
- (string-to-number c)
- (string-to-number a)))))
+ (pcase (org-split-string time-str "-")
+ (`(,a ,b nil) (list (string-to-number a) (string-to-number b) nil))
+ (`(,a ,b ,c) (list (string-to-number b)
+ (string-to-number c)
+ (string-to-number a)))))
(defun org-bbdb-anniv-split (str)
"Split multiple entries in the BBDB anniversary field.
@@ -326,9 +323,9 @@ The anniversaries are assumed to be stored `org-bbdb-anniversary-field'."
(bbdb-split "\n" annivs)))
(while annivs
(setq split (org-bbdb-anniv-split (pop annivs)))
- (multiple-value-bind (m d y)
- (values-list (funcall org-bbdb-extract-date-fun (car split)))
- (setq tmp (gethash (list m d) org-bbdb-anniv-hash))
+ (pcase-let ((`(,m ,d ,y) (funcall org-bbdb-extract-date-fun
+ (car split))))
+ (setq tmp (gethash (list m d) org-bbdb-anniv-hash))
(puthash (list m d) (cons (list y
(bbdb-record-name rec)
(cadr split))
@@ -420,33 +417,41 @@ This is used by Org to re-create the anniversary hash table."
"Return list of anniversaries for today and the next n-1 days (default n=7)."
(let ((n (or n 7)))
(when (<= n 0)
- (error "The (optional) argument of `org-bbdb-anniversaries-future' must be positive"))
+ (error "The (optional) argument of `org-bbdb-anniversaries-future' \
+must be positive"))
(let (
;; List of relevant dates.
(dates (org-bbdb-date-list date n))
- ;; Function to annotate text of each element of l with the anniversary date d.
+ ;; Function to annotate text of each element of l with the
+ ;; anniversary date d.
(annotate-descriptions
(lambda (d l)
(mapcar (lambda (x)
- ;; The assumption here is that x is a bbdb link of the form
- ;; [[bbdb:name][description]].
- ;; This function rather arbitrarily modifies the description
- ;; by adding the date to it in a fixed format.
+ ;; The assumption here is that x is a bbdb link
+ ;; of the form [[bbdb:name][description]].
+ ;; This function rather arbitrarily modifies
+ ;; the description by adding the date to it in
+ ;; a fixed format.
(string-match "]]" x)
- (replace-match (format " -- %d-%02d-%02d\\&" (third d) (first d) (second d))
+ (replace-match (format " -- %d-%02d-%02d\\&"
+ (nth 2 d)
+ (nth 0 d)
+ (nth 1 d))
nil nil x))
l))))
- ;; Map a function that generates anniversaries for each date over the dates
- ;; and nconc the results into a single list. When it is no longer necessary
- ;; to support older versions of emacs, this can be done with a cl-mapcan;
- ;; for now, we use the (apply #'nconc ...) method for compatibility.
+ ;; Map a function that generates anniversaries for each date
+ ;; over the dates and nconc the results into a single list. When
+ ;; it is no longer necessary to support older versions of Emacs,
+ ;; this can be done with a cl-mapcan; for now, we use the (apply
+ ;; #'nconc ...) method for compatibility.
(apply #'nconc
(mapcar
(lambda (d)
(let ((date d))
- ;; Rebind 'date' so that org-bbdb-anniversaries will be
- ;; fooled into giving us the list for the given date
- ;; and then annotate the descriptions for that date.
+ ;; Rebind 'date' so that org-bbdb-anniversaries will
+ ;; be fooled into giving us the list for the given
+ ;; date and then annotate the descriptions for that
+ ;; date.
(funcall annotate-descriptions d (org-bbdb-anniversaries))))
dates)))))
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index e740353..298556d 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -434,10 +434,11 @@ With optional argument OPTIONAL, also prompt for optional fields."
(funcall val :required (funcall val type org-bibtex-types)))
(when optional (funcall val :optional (funcall val type org-bibtex-types)))))
(when (consp field) ; or'd pair of fields e.g., (:editor :author)
- (let ((present (first (remove
+ (let ((present (nth 0 (remove
nil
(mapcar
- (lambda (f) (when (org-bibtex-get (funcall name f)) f))
+ (lambda (f)
+ (when (org-bibtex-get (funcall name f)) f))
field)))))
(setf field (or present (funcall keyword
(completing-read
@@ -627,9 +628,9 @@ This uses `bibtex-parse-entry'."
(interactive)
(let ((keyword (lambda (str) (intern (concat ":" (downcase str)))))
(clean-space (lambda (str) (replace-regexp-in-string
- "[[:space:]\n\r]+" " " str)))
+ "[[:space:]\n\r]+" " " str)))
(strip-delim
- (lambda (str) ; strip enclosing "..." and {...}
+ (lambda (str) ; strip enclosing "..." and {...}
(dolist (pair '((34 . 34) (123 . 125)))
(when (and (> (length str) 1)
(= (aref str 0) (car pair))
@@ -638,10 +639,10 @@ This uses `bibtex-parse-entry'."
(push (mapcar
(lambda (pair)
(cons (let ((field (funcall keyword (car pair))))
- (case field
+ (pcase field
(:=type= :type)
(:=key= :key)
- (otherwise field)))
+ (_ field)))
(funcall clean-space (funcall strip-delim (cdr pair)))))
(save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry)))
org-bibtex-entries)))
@@ -682,7 +683,7 @@ Return the number of saved entries."
(org-bibtex-put org-bibtex-type-property-name
(downcase (funcall val :type)))
(dolist (pair entry)
- (case (car pair)
+ (pcase (car pair)
(:title nil)
(:type nil)
(:key (org-bibtex-put org-bibtex-key-property (cdr pair)))
@@ -694,7 +695,7 @@ Return the number of saved entries."
"[^[:alnum:]_@#%]" ""
(replace-regexp-in-string "[ \t]+" "_" kw))))
(org-bibtex-put (car pair) (cdr pair))))
- (otherwise (org-bibtex-put (car pair) (cdr pair)))))
+ (_ (org-bibtex-put (car pair) (cdr pair)))))
(mapc togtag org-bibtex-tags)))
(defun org-bibtex-yank ()
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index c7b83c6..925664d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -954,7 +954,9 @@ Store them in the capture property list."
(not org-time-was-given))
(not (= (time-to-days prompt-time) (org-today))))
;; Use 00:00 when no time is given for another date than today?
- (apply 'encode-time (append '(0 0 0) (cdddr (decode-time prompt-time)))))
+ (apply #'encode-time
+ (append '(0 0 0)
+ (cl-cdddr (decode-time prompt-time)))))
((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer)
;; Replace any time range by its start
(apply 'encode-time
@@ -1412,7 +1414,7 @@ Use PREFIX as a prefix for the name of the indirect buffer."
(let ((n 1) (base (buffer-name buffer)) bname)
(setq bname (concat prefix "-" base))
(while (buffer-live-p (get-buffer bname))
- (setq bname (concat prefix "-" (number-to-string (incf n)) "-" base)))
+ (setq bname (concat prefix "-" (number-to-string (cl-incf n)) "-" base)))
(condition-case nil
(make-indirect-buffer buffer bname 'clone)
(error
@@ -1467,7 +1469,7 @@ only the bare key is returned."
(cond
((and (= 2 (length (car tbl))) (= (length (caar tbl)) 1))
;; This is a description on this level
- (setq dkey (caar tbl) ddesc (cadar tbl))
+ (setq dkey (caar tbl) ddesc (cl-cadar tbl))
(pop tbl)
(push dkey des-keys)
(push dkey allowed-keys)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 03e6a2c..ac7cd6c 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -465,7 +465,7 @@ to add an effort property.")
(let* ((dichotomy
(lambda (min max pred)
(if (funcall pred min) min
- (incf min)
+ (cl-incf min)
(while (> (- max min) 1)
(let ((mean (+ (ash min -1) (ash max -1) (logand min max 1))))
(if (funcall pred mean) (setq max mean) (setq min mean)))))
@@ -984,7 +984,7 @@ The format of clock is (CONS MARKER START-TIME), where MARKER
identifies the buffer and position the clock is open at (and
thus, the heading it's under), and START-TIME is when the clock
was started."
- (assert clock)
+ (cl-assert clock)
(let* ((ch
(save-window-excursion
(save-excursion
@@ -1848,8 +1848,8 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(when (or (> t1 0) (> (aref ltimes level) 0))
(when (or headline-included headline-forced)
(if headline-included
- (loop for l from 0 to level do
- (aset ltimes l (+ (aref ltimes l) t1))))
+ (cl-loop for l from 0 to level do
+ (aset ltimes l (+ (aref ltimes l) t1))))
(setq time (aref ltimes level))
(goto-char (match-beginning 0))
(put-text-property (point) (point-at-eol)
@@ -1864,8 +1864,8 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(point) (point-at-eol)
:org-clock-force-headline-inclusion t))))))
(setq t1 0)
- (loop for l from level to (1- lmax) do
- (aset ltimes l 0)))))))
+ (cl-loop for l from level to (1- lmax) do
+ (aset ltimes l 0)))))))
(setq org-clock-file-total-minutes (aref ltimes 0))))))
(defun org-clock-sum-current-item (&optional tstart)
@@ -2182,22 +2182,22 @@ have priority."
(when (and (memq key '(quarter thisq)) (> shift 0))
(error "Looking forward with quarters isn't implemented"))))
(when (= shift 0)
- (case key
- (yesterday (setq key 'today shift -1))
- (lastweek (setq key 'week shift -1))
- (lastmonth (setq key 'month shift -1))
- (lastyear (setq key 'year shift -1))
- (lastq (setq key 'quarter shift -1))))
+ (pcase key
+ (`yesterday (setq key 'today shift -1))
+ (`lastweek (setq key 'week shift -1))
+ (`lastmonth (setq key 'month shift -1))
+ (`lastyear (setq key 'year shift -1))
+ (`lastq (setq key 'quarter shift -1))))
;; Prepare start and end times depending on KEY's type.
- (case key
- ((day today) (setq m 0 h 0 h1 24 d (+ d shift)))
- ((week thisweek)
+ (pcase key
+ ((or `day `today) (setq m 0 h 0 h1 24 d (+ d shift)))
+ ((or `week `thisweek)
(let* ((ws (or wstart 1))
(diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))))
(setq m 0 h 0 d (- d diff) d1 (+ 7 d))))
- ((month thismonth)
+ ((or `month `thismonth)
(setq h 0 m 0 d (or mstart 1) month (+ month shift) month1 (1+ month)))
- ((quarter thisq)
+ ((or `quarter `thisq)
;; Compute if this shift remains in this year. If not, compute
;; how many years and quarters we have to shift (via floor*) and
;; compute the shifted years, months and quarters.
@@ -2220,35 +2220,35 @@ have priority."
(setq shiftedy y)
(let ((qshift (* 3 (1- (+ q shift)))))
(setq m 0 h 0 d 1 month (+ 1 qshift) month1 (+ 4 qshift))))))
- ((year thisyear)
+ ((or `year `thisyear)
(setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y)))
- ((interactive untilnow)) ; Special cases, ignore them.
- (t (user-error "No such time block %s" key)))
+ ((or `interactive `untilnow)) ; Special cases, ignore them.
+ (_ (user-error "No such time block %s" key)))
;; Format start and end times according to AS-STRINGS.
- (let* ((start (case key
- (interactive (org-read-date nil t nil "Range start? "))
- (untilnow org-clock--oldest-date)
- (t (encode-time 0 m h d month y))))
- (end (case key
- (interactive (org-read-date nil t nil "Range end? "))
- (untilnow (current-time))
- (t (encode-time 0
+ (let* ((start (pcase key
+ (`interactive (org-read-date nil t nil "Range start? "))
+ (`untilnow org-clock--oldest-date)
+ (_ (encode-time 0 m h d month y))))
+ (end (pcase key
+ (`interactive (org-read-date nil t nil "Range end? "))
+ (`untilnow (current-time))
+ (_ (encode-time 0
(or m1 m)
(or h1 h)
(or d1 d)
(or month1 month)
(or y1 y)))))
(text
- (case key
- ((day today) (format-time-string "%A, %B %d, %Y" start))
- ((week thisweek) (format-time-string "week %G-W%V" start))
- ((month thismonth) (format-time-string "%B %Y" start))
- ((year thisyear) (format-time-string "the year %Y" start))
- ((quarter thisq)
+ (pcase key
+ ((or `day `today) (format-time-string "%A, %B %d, %Y" start))
+ ((or `week `thisweek) (format-time-string "week %G-W%V" start))
+ ((or `month `thismonth) (format-time-string "%B %Y" start))
+ ((or `year `thisyear) (format-time-string "the year %Y" start))
+ ((or `quarter `thisq)
(concat (org-count-quarter shiftedq)
" quarter of " (number-to-string shiftedy)))
- (interactive "(Range interactively set)")
- (untilnow "now"))))
+ (`interactive "(Range interactively set)")
+ (`untilnow "now"))))
(if (not as-strings) (list start end text)
(let ((f (cdr org-time-stamp-formats)))
(list (format-time-string f start)
@@ -2698,16 +2698,16 @@ LEVEL is an integer. Indent by two spaces per level above 1."
te (nth 1 cc)))
(cond
((numberp ts)
- ;; If ts is a number, it's an absolute day number from org-agenda.
- (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts)
+ ;; If ts is a number, it's an absolute day number from
+ ;; org-agenda.
+ (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
(setq ts (float-time (encode-time 0 0 0 day month year)))))
(ts
- (setq ts (float-time
- (apply #'encode-time (org-parse-time-string ts))))))
+ (setq ts (float-time (apply #'encode-time (org-parse-time-string ts))))))
(cond
((numberp te)
;; Likewise for te.
- (destructuring-bind (month day year) (calendar-gregorian-from-absolute te)
+ (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
(setq te (float-time (encode-time 0 0 0 day month year)))))
(te
(setq te (float-time (apply #'encode-time (org-parse-time-string te))))))
diff --git a/lisp/org-ctags.el b/lisp/org-ctags.el
index 51b5663..92409c1 100644
--- a/lisp/org-ctags.el
+++ b/lisp/org-ctags.el
@@ -474,7 +474,7 @@ end up in one file, called TAGS, located in the directory. This
function may take several seconds to finish if the directory or
its subdirectories contain large numbers of taggable files."
(interactive)
- (assert (buffer-file-name))
+ (cl-assert (buffer-file-name))
(let ((dir-name (or directory-name
(file-name-directory (buffer-file-name))))
(exitcode nil))
diff --git a/lisp/org-element.el b/lisp/org-element.el
index a4a2cc3..3bb1391 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4554,14 +4554,14 @@ If there is no affiliated keyword, return the empty string."
;; List all ELEMENT's properties matching an attribute line or an
;; affiliated keyword, but ignore translated keywords since they
;; cannot belong to the property list.
- (loop for prop in (nth 1 element) by 'cddr
- when (let ((keyword (upcase (substring (symbol-name prop) 1))))
- (or (string-match "^ATTR_" keyword)
- (and
- (member keyword org-element-affiliated-keywords)
- (not (assoc keyword
- org-element-keyword-translation-alist)))))
- collect prop)
+ (cl-loop for prop in (nth 1 element) by 'cddr
+ when (let ((keyword (upcase (substring (symbol-name prop) 1))))
+ (or (string-match "^ATTR_" keyword)
+ (and
+ (member keyword org-element-affiliated-keywords)
+ (not (assoc keyword
+ org-element-keyword-translation-alist)))))
+ collect prop)
"")))
;; Because interpretation of the parse tree must return the same
@@ -5092,8 +5092,8 @@ Properties are modified by side-effect."
(not (eq (org-element-type (plist-get properties :parent))
'item)))
(dolist (item (plist-get properties :structure))
- (incf (car item) offset)
- (incf (nth 6 item) offset)))
+ (cl-incf (car item) offset)
+ (cl-incf (nth 6 item) offset)))
(dolist (key '(:begin :contents-begin :contents-end :end :post-affiliated))
(let ((value (and (or (not props) (memq key props))
(plist-get properties key))))
@@ -5132,7 +5132,7 @@ updated before current modification are actually submitted."
;; Request processed. Merge current and next offsets and
;; transfer ending position.
(when next
- (incf (aref next 3) (aref request 3))
+ (cl-incf (aref next 3) (aref request 3))
(aset next 2 (aref request 2)))
(setq org-element--cache-sync-requests
(cdr org-element--cache-sync-requests))))
@@ -5608,7 +5608,7 @@ change, as an integer."
;; Current changes can be merged with first sync request: we
;; can save a partial cache synchronization.
(progn
- (incf (aref next 3) offset)
+ (cl-incf (aref next 3) offset)
;; If last change happened within area to be removed, extend
;; boundaries of robust parents, if any. Otherwise, find
;; first element to remove and update request accordingly.
@@ -5658,7 +5658,8 @@ change, as an integer."
;; No element to remove. No need to re-parent either.
;; Simply shift additional elements, if any, by OFFSET.
(when org-element--cache-sync-requests
- (incf (aref (car org-element--cache-sync-requests) 3) offset)))))))
+ (cl-incf (aref (car org-element--cache-sync-requests) 3)
+ offset)))))))
;;;; Public Functions
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 341133f..868b425 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -168,7 +168,7 @@ Returns a list with the following elements:
This list represents a \"habit\" for the rest of this module."
(save-excursion
(if pom (goto-char pom))
- (assert (org-is-habit-p (point)))
+ (cl-assert (org-is-habit-p (point)))
(let* ((scheduled (org-get-scheduled-time (point)))
(scheduled-repeat (org-get-repeat org-scheduled-string))
(end (org-entry-end-position))
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 25e36c1..5f14d50 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -320,15 +320,15 @@ If the task has an end part, also demote it."
(defun org-inlinetask-hide-tasks (state)
"Hide inline tasks in buffer when STATE is `contents' or `children'.
This function is meant to be used in `org-cycle-hook'."
- (case state
- (contents
+ (pcase state
+ (`contents
(let ((regexp (org-inlinetask-outline-regexp)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(org-inlinetask-toggle-visibility)
(org-inlinetask-goto-end)))))
- (children
+ (`children
(save-excursion
(while (and (outline-next-heading) (org-inlinetask-at-task-p))
(org-inlinetask-toggle-visibility)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index ca69e9d..330eef9 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -1072,14 +1072,15 @@ for `tabulated-list-printer'."
(mapcar
(lambda (report)
(list
- (incf id)
+ (cl-incf id)
(apply #'vector
(cons
(progn
(goto-char (car report))
(beginning-of-line)
(prog1 (number-to-string
- (incf last-line (count-lines last-pos (point))))
+ (cl-incf last-line
+ (count-lines last-pos (point))))
(setf last-pos (point))))
(cdr report)))))
;; Insert trust level in generated reports. Also sort them
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 4bc4a2c..7c150fd 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -556,8 +556,8 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
(let ((contextdata (assq context contextlist)))
(when contextdata
(save-excursion
- (goto-char (second contextdata))
- (re-search-forward ".*" (third contextdata))))))
+ (goto-char (nth 1 contextdata))
+ (re-search-forward ".*" (nth 2 contextdata))))))
(defun org-mouse-for-each-item (funct)
;; Functions called by `org-apply-on-list' need an argument.
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 3a13faf..c8894e5 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -137,7 +137,7 @@ and dependant variables."
(deps (if (plist-member params :deps)
(mapcar (lambda (val) (- val 1)) (plist-get params :deps))
(let (collector)
- (dotimes (col (length (first table)))
+ (dotimes (col (length (nth 0 table)))
(setf collector (cons col collector)))
collector)))
(counter 0)
@@ -155,7 +155,7 @@ and dependant variables."
table)))
;; write table to gnuplot grid datafile format
(with-temp-file data-file
- (let ((num-rows (length table)) (num-cols (length (first table)))
+ (let ((num-rows (length table)) (num-cols (length (nth 0 table)))
(gnuplot-row (lambda (col row value)
(setf col (+ 1 col)) (setf row (+ 1 row))
(format "%f %f %f\n%f %f %f\n"
@@ -289,12 +289,13 @@ line directly before or after the table."
;; collect table and table information
(let* ((data-file (make-temp-file "org-plot"))
(table (org-table-to-lisp))
- (num-cols (length (if (eq (first table) 'hline) (second table)
- (first table)))))
+ (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
+ (nth 0 table)))))
(run-with-idle-timer 0.1 nil #'delete-file data-file)
(while (eq 'hline (car table)) (setf table (cdr table)))
(when (eq (cadr table) 'hline)
- (setf params (plist-put params :labels (first table))) ; headers to labels
+ (setf params
+ (plist-put params :labels (nth 0 table))) ; headers to labels
(setf table (delq 'hline (cdr table)))) ; clean non-data from table
;; Collect options.
(save-excursion (while (and (equal 0 (forward-line -1))
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index 33ef9a4..f5e797e 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -549,17 +549,17 @@ INFO is a plist used as a communication channel."
(defun org-ascii--current-text-width (element info)
"Return maximum text width for ELEMENT's contents.
INFO is a plist used as a communication channel."
- (case (org-element-type element)
+ (pcase (org-element-type element)
;; Elements with an absolute width: `headline' and `inlinetask'.
- (inlinetask (plist-get info :ascii-inlinetask-width))
- (headline
+ (`inlinetask (plist-get info :ascii-inlinetask-width))
+ (`headline
(- (plist-get info :ascii-text-width)
(let ((low-level-rank (org-export-low-level-p element info)))
(if low-level-rank (* low-level-rank 2)
(plist-get info :ascii-global-margin)))))
;; Elements with a relative width: store maximum text width in
;; TOTAL-WIDTH.
- (otherwise
+ (_
(let* ((genealogy (org-element-lineage element nil t))
;; Total width is determined by the presence, or not, of an
;; inline task among ELEMENT parents.
@@ -635,9 +635,9 @@ Return value is a symbol among `left', `center', `right' and
(let (justification)
(while (and (not justification)
(setq element (org-element-property :parent element)))
- (case (org-element-type element)
- (center-block (setq justification 'center))
- (special-block
+ (pcase (org-element-type element)
+ (`center-block (setq justification 'center))
+ (`special-block
(let ((name (org-element-property :type element)))
(cond ((string= name "JUSTIFYRIGHT") (setq justification 'right))
((string= name "JUSTIFYLEFT") (setq justification 'left)))))))
@@ -735,9 +735,9 @@ caption keyword."
(org-export-get-ordinal
element info nil 'org-ascii--has-caption-p))
(title-fmt (org-ascii--translate
- (case (org-element-type element)
- (table "Table %d:")
- (src-block "Listing %d:"))
+ (pcase (org-element-type element)
+ (`table "Table %d:")
+ (`src-block "Listing %d:"))
info)))
(org-ascii--fill-string
(concat (format title-fmt reference)
@@ -950,10 +950,10 @@ channel."
"Return checkbox string for ITEM or nil.
INFO is a plist used as a communication channel."
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
- (case (org-element-property :checkbox item)
- (on (if utf8p "☑ " "[X] "))
- (off (if utf8p "☐ " "[ ] "))
- (trans (if utf8p "☒ " "[-] ")))))
+ (pcase (org-element-property :checkbox item)
+ (`on (if utf8p "☑ " "[X] "))
+ (`off (if utf8p "☐ " "[ ] "))
+ (`trans (if utf8p "☒ " "[-] ")))))
@@ -1431,12 +1431,12 @@ contextual information."
;; First parent of ITEM is always the plain-list. Get
;; `:type' property from it.
(org-list-bullet-string
- (case list-type
- (descriptive
+ (pcase list-type
+ (`descriptive
(concat checkbox
(org-export-data (org-element-property :tag item) info)
": "))
- (ordered
+ (`ordered
;; Return correct number for ITEM, paying attention to
;; counters.
(let* ((struct (org-element-property :structure item))
@@ -1448,7 +1448,7 @@ contextual information."
(org-list-prevs-alist struct)
(org-list-parents-alist struct)))))))
(replace-regexp-in-string "[0-9]+" num bul)))
- (t (let ((bul (org-element-property :bullet item)))
+ (_ (let ((bul (org-element-property :bullet item)))
;; Change bullets into more visible form if UTF-8 is active.
(if (not utf8p) bul
(replace-regexp-in-string
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index cbcd65e..6c5bfeb 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1728,11 +1728,11 @@ Replaces invalid characters with \"_\"."
INFO is a plist used as a communication channel."
(let* ((fn-alist (org-export-collect-footnote-definitions info))
(fn-alist
- (loop for (n _type raw) in fn-alist collect
- (cons n (if (eq (org-element-type raw) 'org-data)
- (org-trim (org-export-data raw info))
- (format "<div class=\"footpara\">%s</div>"
- (org-trim (org-export-data raw info))))))))
+ (cl-loop for (n _type raw) in fn-alist collect
+ (cons n (if (eq (org-element-type raw) 'org-data)
+ (org-trim (org-export-data raw info))
+ (format "<div class=\"footpara\">%s</div>"
+ (org-trim (org-export-data raw info))))))))
(when fn-alist
(format
(plist-get info :html-footnotes-section)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 991d527..1a303a0 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1451,9 +1451,10 @@ OPTIONS is an alist where the key is the options keyword as
a string, and the value a list containing the keyword value, or
nil."
(mapconcat (lambda (pair)
- (concat (first pair)
- (when (> (length (second pair)) 0)
- (concat "=" (second pair)))))
+ (pcase-let ((`(,keyword ,value) pair))
+ (concat keyword
+ (and (> (length value) 0)
+ (concat "=" value)))))
options
","))
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 469d6ad..2eb6295 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -1160,7 +1160,7 @@ DEPTH is an integer specifying the depth of the table. INFO is
a plist containing current export properties. Optional argument
SCOPE, when non-nil, defines the scope of the table. Return the
table of contents as a string, or nil."
- (assert (wholenump depth))
+ (cl-assert (wholenump depth))
;; When a headline is marked as a radio target, as in the example below:
;;
;; ** <<<Some Heading>>>
@@ -1207,7 +1207,7 @@ Use `org-odt-object-counters' to generate an automatic
OBJECT-NAME and STYLE-NAME. If OBJECT-PROPS is non-nil, add a
new entry in `org-odt-automatic-styles'. Return (OBJECT-NAME
. STYLE-NAME)."
- (assert (stringp object-type))
+ (cl-assert (stringp object-type))
(let* ((object (intern object-type))
(seqvar object)
(seqno (1+ (or (plist-get org-odt-object-counters seqvar) 0)))
@@ -2070,7 +2070,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Links :: Label references
(defun org-odt--enumerate (element info &optional predicate n)
- (when predicate (assert (funcall predicate element info)))
+ (when predicate (cl-assert (funcall predicate element info)))
(let* ((--numbered-parent-headline-at-<=-n
(lambda (element n info)
(cl-loop for x in (org-element-lineage element)
@@ -2117,7 +2117,7 @@ the generated string.
Return value is a string if OP is set to `reference' or a cons
cell like CAPTION . SHORT-CAPTION) where CAPTION and
SHORT-CAPTION are strings."
- (assert (memq (org-element-type element) '(link table src-block paragraph)))
+ (cl-assert (memq (org-element-type element) '(link table src-block paragraph)))
(let* ((element-or-parent
(cl-case (org-element-type element)
(link (org-export-get-parent-element element))
@@ -2148,9 +2148,10 @@ SHORT-CAPTION are strings."
(t (error "Don't know how to format label for element type: %s"
(org-element-type element)))))
seqno)
- (assert default-category)
- (destructuring-bind (counter label-style category predicate)
- (assoc-default default-category org-odt-category-map-alist)
+ (cl-assert default-category)
+ (pcase-let
+ ((`(,counter ,label-style ,category ,predicate)
+ (assoc-default default-category org-odt-category-map-alist)))
;; Compute sequence number of the element.
(setq seqno (org-odt--enumerate element info predicate))
;; Localize category string.
@@ -2277,7 +2278,7 @@ SHORT-CAPTION are strings."
"Return ODT code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel."
- (assert (eq (org-element-type element) 'link))
+ (cl-assert (eq (org-element-type element) 'link))
(let* ((src (let* ((type (org-element-property :type element))
(raw-path (org-element-property :path element)))
(cond ((member type '("http" "https"))
@@ -2485,8 +2486,8 @@ used as a communication channel."
(lambda (default user)
"Merge default and user frame params."
(if (not user) default
- (assert (= (length default) 3))
- (assert (= (length user) 3))
+ (cl-assert (= (length default) 3))
+ (cl-assert (= (length user) 3))
(cl-loop for u in user
for d in default
collect (or u d)))))))
@@ -2540,7 +2541,7 @@ used as a communication channel."
(org-element-property :name p))))
;; Link should point to an image file.
(lambda (l)
- (assert (eq (org-element-type l) 'link))
+ (cl-assert (eq (org-element-type l) 'link))
(org-export-inline-image-p l (plist-get info :odt-inline-image-rules)))))
(defun org-odt--enumerable-latex-image-p (element info)
@@ -2555,7 +2556,7 @@ used as a communication channel."
(org-element-property :name p))))
;; Link should point to an image file.
(lambda (l)
- (assert (eq (org-element-type l) 'link))
+ (cl-assert (eq (org-element-type l) 'link))
(org-export-inline-image-p l (plist-get info :odt-inline-image-rules)))))
(defun org-odt--enumerable-formula-p (element info)
@@ -2567,7 +2568,7 @@ used as a communication channel."
(org-element-property :name p)))
;; Link should point to a MathML or ODF file.
(lambda (l)
- (assert (eq (org-element-type l) 'link))
+ (cl-assert (eq (org-element-type l) 'link))
(org-export-inline-image-p l (plist-get info :odt-inline-formula-rules)))))
(defun org-odt--standalone-link-p (element _info &optional
@@ -3127,7 +3128,7 @@ and prefix with \"OrgSrc\". For example,
(par-style (if use-htmlfontify-p "OrgSrcBlock"
"OrgFixedWidthBlock"))
(i 0))
- (assert (= code-length (length (org-split-string code "\n"))))
+ (cl-assert (= code-length (length (org-split-string code "\n"))))
(setq code
(org-export-format-code
code
@@ -3140,7 +3141,7 @@ and prefix with \"OrgSrc\". For example,
(setq loc (funcall fontifier loc))
(when ref
(setq loc (org-odt--target loc (concat "coderef-" ref))))
- (assert par-style)
+ (cl-assert par-style)
(setq loc (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
par-style loc))
(if (not line-num) loc
@@ -3347,7 +3348,7 @@ channel."
(1+ horiz-span))))))
(unless contents (setq contents ""))
(concat
- (assert paragraph-style)
+ (cl-assert paragraph-style)
(format "\n<table:table-cell%s>\n%s\n</table:table-cell>"
cell-attributes
(let ((table-cell-contents (org-element-contents table-cell)))