org-macro: Fix incomplete docstring

* lisp/org-macro.el (org-macro--counter-increment): Fix incomplete
  docstring.  Small refactoring.
This commit is contained in:
Nicolas Goaziou 2017-06-09 10:20:48 +02:00
parent 54344574c6
commit 657ed58eac
1 changed files with 11 additions and 11 deletions

View File

@ -321,17 +321,17 @@ Return a list of arguments, as strings. This is the opposite of
(defun org-macro--counter-increment (name &optional reset)
"Increment counter NAME.
NAME is a string identifying the counter. If optional argument
RESET is a non-empty string, reset the counter instead."
(if (org-string-nw-p reset)
(let ((new-value (if (string-match-p "\\`[ \t]*[0-9]+[ \t]*\\'" reset)
(string-to-number reset)
1)))
(puthash name new-value org-macro--counter-table))
(let ((value (gethash name org-macro--counter-table)))
(puthash name
(if (null value) 1 (1+ value))
org-macro--counter-table))))
NAME is a string identifying the counter. When non-nil, optional
argument RESET is a string. If it represents an integer, set the
counter to this number. Any other non-empty string resets the
counter to 1."
(puthash name
(cond ((not (org-string-nw-p reset))
(1+ (gethash name org-macro--counter-table 0)))
((string-match-p "\\`[ \t]*[0-9]+[ \t]*\\'" reset)
(string-to-number reset))
(t 1))
org-macro--counter-table))
(provide 'org-macro)