summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-09 10:20:48 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-09 10:22:51 +0200
commit657ed58eac696ef1e9803925b5983188efb849a7 (patch)
treef24e017b89a302a0272ef63bbd2071e5b618166a
parent54344574c62eb7cfc58096bb7aec39174296f23d (diff)
downloadorg-mode-657ed58eac696ef1e9803925b5983188efb849a7.tar.gz
org-macro: Fix incomplete docstring
* lisp/org-macro.el (org-macro--counter-increment): Fix incomplete docstring. Small refactoring.
-rw-r--r--lisp/org-macro.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index dcf4e6e..96461f9 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -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)