From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: counter macro doesn't increment when additional macro is on same line Date: Sat, 26 Aug 2017 17:09:16 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1144b00c6dbd520557ae79b3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dliKX-0003Z0-JS for emacs-orgmode@gnu.org; Sat, 26 Aug 2017 17:09:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dliKW-0005k8-5I for emacs-orgmode@gnu.org; Sat, 26 Aug 2017 17:09:21 -0400 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]:32849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dliKV-0005jY-TX for emacs-orgmode@gnu.org; Sat, 26 Aug 2017 17:09:20 -0400 Received: by mail-pf0-x22e.google.com with SMTP id r62so5131238pfj.0 for ; Sat, 26 Aug 2017 14:09:18 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --001a1144b00c6dbd520557ae79b3 Content-Type: text/plain; charset="UTF-8" the {{{n}}} macro seems to reset to "1" if it is located on the same line as another macro that I've defined. I'm not sure if it's error with my macro or some kind or race condition-ish problem in macro expansion. Here's a minimal example: -------- #+MACRO: ts (eval (get-ts+7)) #+BEGIN_SRC emacs-lisp (defun mwp-add-week-to-next-ts () (interactive ) (save-excursion (re-search-forward org-ts-regexp) (let ((base (match-string 0))) (message base) (message (format-time-string "<%Y-%m-%d %a>" (time-add (date-to-time base) (days-to-time (1+ 7))))) (replace-match (format-time-string "<%Y-%m-%d %a>" (time-add (date-to-time base) (seconds-to-time (1+(* 7 60 60 24))))) nil nil nil nil)))) #+END_SRC (week {{{n(w)}}}) (week {{{n(w)}}}) (week {{{n(w)}}}) ** <2017-09-12 Tue> (Week {{{n(w)}}}) Hacking History in the Himalaya ** {{{ts}}} (Week {{{n(w)}}}) Language of the Web ----------------- And here's the ASCII export: ------ Matt Price ,---- | (defun mwp-add-week-to-next-ts () | (interactive ) | (save-excursion | (re-search-forward org-ts-regexp) | | (let ((base (match-string 0))) | (message base) | (message (format-time-string "<%Y-%m-%d %a>" | (time-add (date-to-time base) (days-to-time (1+ 7))))) | | (replace-match (format-time-string "<%Y-%m-%d %a>" | (time-add (date-to-time base) (seconds-to-time (1+(* 7 60 60 24))))) nil nil nil nil)))) `---- 1 2 3 <2017-09-12 Tue> (Week 4) Hacking History in the Himalaya ========================================================== <2017-09-19 Tue> (Week 1) Language of the Web ============================================== ----------------- Any thoughts? thank you! --001a1144b00c6dbd520557ae79b3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdj48YnI+PC9kaXY+PGRpdj50aGUge3t7bn19fSBtYWNybyBzZWVt cyB0byByZXNldCB0byAmcXVvdDsxJnF1b3Q7IGlmIGl0IGlzIGxvY2F0ZWQgb24gdGhlIHNhbWUg bGluZSBhcyBhbm90aGVyIG1hY3JvIHRoYXQgSSYjMzk7dmUgZGVmaW5lZC7CoCBJJiMzOTttIG5v dCBzdXJlIGlmIGl0JiMzOTtzIGVycm9yIHdpdGggbXkgbWFjcm8gb3Igc29tZSBraW5kIG9yIHJh Y2UgY29uZGl0aW9uLWlzaCBwcm9ibGVtIGluIG1hY3JvIGV4cGFuc2lvbi7CoCBIZXJlJiMzOTtz IGEgbWluaW1hbCBleGFtcGxlOjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+LS0tLS0tLS08L2Rp dj48ZGl2PiMrTUFDUk86IHRzIChldmFsIChnZXQtdHMrNykpPGJyPjxicj4jK0JFR0lOX1NSQyBl bW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