♻️ Favor cl- functions
When requiring `rpgdm.el` and it's "child" packages, I encounter the following warnings: > Warning: ‘destructuring-bind’ is an obsolete alias (as of 27.1); use > ‘cl-destructuring-bind’ instead. > > Warning: ‘incf’ is an obsolete alias (as of 27.1); use ‘cl-incf’ > instead. > > Warning: ‘decf’ is an obsolete alias (as of 27.1); use ‘cl-decf’ > instead. > > Warning: ‘defstruct’ is an obsolete alias (as of 27.1); use > ‘cl-defstruct’ instead. Since we've already required the `cl` package, this should be a noop change.
This commit is contained in:
parent
5c5f17e7a6
commit
25c282c094
6 changed files with 8 additions and 8 deletions
|
|
@ -46,7 +46,7 @@ For instance, Xanathar's Guide to Everything, a Dungeons and Dragons supplement
|
|||
To represent these types of tables, we create a special type, called a =dice-table=. Where the first "slot" is the dice expression (or the number of sides of a dice to roll), and an associative list of result values and the choice.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :results silent
|
||||
(defstruct dice-table dice rows)
|
||||
(cl-defstruct dice-table dice rows)
|
||||
#+END_SRC
|
||||
|
||||
How is this used to render the example table above?
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ decrement the ROLL value."
|
|||
;; (message "Comparing %d <= %d for %s" roll num-elems tag)
|
||||
(if (<= roll num-elems)
|
||||
(return tag)
|
||||
(decf roll num-elems))))
|
||||
(cl-decf roll num-elems))))
|
||||
|
||||
(ert-deftest rpgdm-tables--find-tag-test ()
|
||||
(let ((weighted-tags
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ This really tests the `rpgdm--test-rolls' function."
|
|||
(8 1 8)
|
||||
(20 1 20)
|
||||
(100 1 100)))
|
||||
(destructuring-bind (die lowest highest) test-data
|
||||
(cl-destructuring-bind (die lowest highest) test-data
|
||||
(rpgdm--test-rolls #'rpgdm--roll-die (list die) lowest highest))))
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
|
|
@ -155,7 +155,7 @@ average value of AVG, if given."
|
|||
((3 6 4) 7 22)
|
||||
((4 6 4 "-") 0 20))))
|
||||
(dolist (test-seq test-data)
|
||||
(destructuring-bind (dice-args lowest highest) test-seq
|
||||
(cl-destructuring-bind (dice-args lowest highest) test-seq
|
||||
(rpgdm--test-roll-series 'rpgdm--roll dice-args lowest highest)))))
|
||||
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ the following:
|
|||
("2d12" 2 24)
|
||||
("3d6+2" 5 20))))
|
||||
(dolist (test-data test-cases)
|
||||
(destructuring-bind (dice-expression lowest highest) test-data
|
||||
(cl-destructuring-bind (dice-expression lowest highest) test-data
|
||||
(rpgdm--test-roll-series 'rpgdm--roll-expression (list dice-expression) lowest highest)))))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(defstruct dice-table dice rows)
|
||||
(cl-defstruct dice-table dice rows)
|
||||
|
||||
(defun rpgdm-tables--choose-dice-table (table)
|
||||
"Choose a string from a random dice table."
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ decrement the ROLL value."
|
|||
;; (message "Comparing %d <= %d for %s" roll num-elems tag)
|
||||
(if (<= roll num-elems)
|
||||
(return tag)
|
||||
(decf roll num-elems))))
|
||||
(cl-decf roll num-elems))))
|
||||
|
||||
(ert-deftest rpgdm-tables--find-tag-test ()
|
||||
(let ((weighted-tags
|
||||
|
|
|
|||
2
rpgdm.el
2
rpgdm.el
|
|
@ -109,7 +109,7 @@ and ARGS are substitued values."
|
|||
Meant to be used with `rpgdm-last-results-previous'."
|
||||
(interactive)
|
||||
(when (> rpgdm-last-results-ptr 0)
|
||||
(decf rpgdm-last-results-ptr))
|
||||
(cl-decf rpgdm-last-results-ptr))
|
||||
(message "%d> %s" rpgdm-last-results-ptr (ring-ref rpgdm-last-results rpgdm-last-results-ptr)))
|
||||
|
||||
(defun rpgdm-paste-last-message ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue