From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CNNKOVL3oF8vTAAA0tVLHw (envelope-from ) for ; Tue, 03 Nov 2020 06:23:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qIJ4NFL3oF8LVwAAbx9fmQ (envelope-from ) for ; Tue, 03 Nov 2020 06:23:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8E0C19402A9 for ; Tue, 3 Nov 2020 06:23:13 +0000 (UTC) Received: from localhost ([::1]:44244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZpiq-0001wG-21 for larch@yhetil.org; Tue, 03 Nov 2020 01:23:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZpiP-0001uc-Nx for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 01:22:45 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:64359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZpiL-0007KV-Tl for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 01:22:44 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 537A7A5066; Tue, 3 Nov 2020 01:22:39 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=pMH4HWAJ8NhBg61GoIK/SQAJDS8=; b=JFn4bS L0bacuQ3oquVt58viQQoJHW5HLjgZknaSqXZ0i5Ef7yEO9oZmY0DXJjvJAHwhwEo liy6vM0ifXe3Bu2Qd9OFoiMQ4hu1Tv974TPHtVfPW6RwMeKsAexg0eS0YirXGndX FVpngBIiqoF9Q1eH6m5ihyuZxSeQsqUORbrQU= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4C9D5A5065; Tue, 3 Nov 2020 01:22:39 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=ahVa4WYj7CMLnVD+VF3zoiY3OiibyL3o8zz2xAmKV5k=; b=xWtHLZ6p0jyS3jBX9O3NOSGIynmK3UYg95UCtoIFLa5a4JtvBxr4reqUgZJ1wgiYgoAy6b9LeEa3foRI1wLli4bBvjQa0Tzesl8gE0zPt8IIxWSC9TXmfw09j7cOCD3xxtTOG3Jvfke7mNjDMaSyR/1LbTMW0tY/d5/HJFDUr5o= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id C113FA5064; Tue, 3 Nov 2020 01:22:38 -0500 (EST) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Martin Rottensteiner Subject: Re: S-left / S-right with (double) prefix C-u without scheduled time (only date) In-Reply-To: References: Date: Tue, 03 Nov 2020 01:22:38 -0500 Message-ID: <87y2jjnemp.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: F89D0C2A-1D9C-11EB-8E24-D152C8D8090B-24757444!pb-smtp1.pobox.com Received-SPF: pass client-ip=64.147.108.70; envelope-from=kyle@kyleam.com; helo=pb-smtp1.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/03 01:22:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=JFn4bS L; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=xWtHLZ6p; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: 5fvELBwC+KR5 Martin Rottensteiner writes: > In my setup in org 9.4 the behaviour is like this for a scheduled date > without scheduled time (for example SCHEDULED: <2020-10-27>: > C-u S-left: Date changes to date before (26th) > C-u S-right: Date does not change > C-u C-u S-left: Date changes to date before (26th) > C-u C-u: S-right: Date does not change Hmph, that discrepancy between left and right is odd... Underneath org-timestamp-change is being called with WHAT as hour or minute. Regardless of whether the timestamp has a time, it's doing (setq time (apply #'encode-time (or (car time0) 0) (+ (if (eq timestamp? 'minute) n 0) (nth 1 time0)) (+ (if (eq timestamp? 'hour) n 0) (nth 2 time0)) (+ (if (eq timestamp? 'day) n 0) (nth 3 time0)) (+ (if (eq timestamp? 'month) n 0) (nth 4 time0)) (+ (if (eq timestamp? 'year) n 0) (nth 5 time0)) (nthcdr 6 time0))) So that explains why left shifts the date, as it's essentially starting from 00:00. > I would prefer this behaviour instead (my proposal): > C-u S-left: Add a default time (e.g. 6:00) > C-u S-right: Add a default time (e.g. 6:00) > C-u C-u S-left: Add a default time (e.g. 6:00) > C-u C-u: S-right: Add a default time (e.g. 6:00) C-u+ is an explicit request to operate on a time part, so that sounds sensible to me. > Scheduled date+time Timestamps can afterwards be changed as expected with > C-u prefix(es). Yes, and, based on the current design, it should even work without a prefix for successive calls. > What I found out until now: > ( org-schedule nil "12:00" ) adds a time 12:00 to a SCHEDULED date property. > (if (< (length (org-entry-get nil "SCHEDULED")) 16) (print > 'scheduled_time_missing) (print 'scheduled_time_existent)) > org-timestamp-has-time-p: could maybe better be used instead for finding > out if time is not present. > > I think this would be a better default behaviour or the current behaviour > might even be a bug. I think the current behavior falls into the oversight/bug category, especially given the left/right discrepancy. Here's a minimal fix that results in your desired behavior (assuming you don't have a preference for any particular range of initial times). diff --git a/lisp/org.el b/lisp/org.el index 03df139fb..04089c6ec 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -14964,7 +14964,8 @@ (defun org-timestamp-change (n &optional what updown suppress-tmp-delay) (setq extra (match-string 1 ts)) (when suppress-tmp-delay (setq extra (replace-regexp-in-string " --[0-9]+[hdwmy]" "" extra)))) - (when (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) + (when (or (memq what '(hour minute)) + (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)) (setq with-hm t)) (setq time0 (org-parse-time-string ts)) (when (and updown