Alejandro Pérez Carballo <a...@umass.edu> writes: > With point on an entry containing a scheduled timestamp like “<2025-01-22 Wed > +1d --1d>”, calling `(org-entry-put nil "SCHEDULED" (org-entry-get nil > "SCHEDULED"))' results in the removal of the delay cookie "--1d". This > doesn’t happen if there is no repeater or if the delay cookie is of the form > "-1d". > > I’m assuming this is not the intended behavior. (As long as the current VAL > of PROP is not problematic in some sense, I’d expect “(org-entry-put nil PROP > (org-entry-get nil PROP))” to leave VAL intact.)
Confirmed. > As far as I can tell, the issue can be traced back to the way > `org--deadline-or-schedule' parses the ‘time’ argument: the variable > ‘repeater’ is set to “+1d -1d” if the TIME argument to > `org--deadline-or-schedule' is “+1d -1d” but set to “+1d” if it is “+1d --1d”. > > I’m guessing the wrinkle is in the regex here: > > “(string-match "\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\)" > time)” > > but I’m not sure how to modify it. (The first captured group is “+1d -1d” > when the input string is e.g. “<2025-01-22 Wed +1d -1d>” but “+1d” when it is > “<2025-01-22 Wed +1d --1d>”.) Ideally, we should simply use org-element API for this instead of rolling out a custom regexp-based parser for timestamps there. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>