Browse Source

org-macro: Fix incomplete docstring

* lisp/org-macro.el (org-macro--counter-increment): Fix incomplete
  docstring.  Small refactoring.
Nicolas Goaziou 8 years ago
parent
commit
657ed58eac
1 changed files with 11 additions and 11 deletions
  1. 11 11
      lisp/org-macro.el

+ 11 - 11
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)
 (defun org-macro--counter-increment (name &optional reset)
   "Increment counter NAME.
   "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)
 (provide 'org-macro)