diff options
| author | Allen Li | 2018-10-24 20:44:01 -0600 |
|---|---|---|
| committer | Eli Zaretskii | 2018-11-10 11:41:51 +0200 |
| commit | 5578112e182e20661783a1fef2c779b8844cf082 (patch) | |
| tree | f7ab48c6949bf6b0598ed705578a4cacae554207 /doc/lispref | |
| parent | 705adc237629a78c10165f9a3b3260cb56242cda (diff) | |
| download | emacs-5578112e182e20661783a1fef2c779b8844cf082.tar.gz emacs-5578112e182e20661783a1fef2c779b8844cf082.zip | |
Add 'ring-resize' function
* lisp/emacs-lisp/ring.el (ring-resize): New function. (Bug#32849)
* doc/lispref/sequences.texi (Rings): Document new function 'ring-resize'.
* etc/NEWS: Document new function 'ring-resize'.
* test/lisp/emacs-lisp/ring-tests.el (ring-test-ring-resize): New tests.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/sequences.texi | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 554716084ee..955ad669b80 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -1777,6 +1777,11 @@ If the ring is full, this function removes the newest element to make | |||
| 1777 | room for the inserted element. | 1777 | room for the inserted element. |
| 1778 | @end defun | 1778 | @end defun |
| 1779 | 1779 | ||
| 1780 | @defun ring-resize ring size | ||
| 1781 | Set the size of @var{ring} to @var{size}. If the new size is smaller, | ||
| 1782 | then the oldest items in the ring are discarded. | ||
| 1783 | @end defun | ||
| 1784 | |||
| 1780 | @cindex fifo data structure | 1785 | @cindex fifo data structure |
| 1781 | If you are careful not to exceed the ring size, you can | 1786 | If you are careful not to exceed the ring size, you can |
| 1782 | use the ring as a first-in-first-out queue. For example: | 1787 | use the ring as a first-in-first-out queue. For example: |