From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id hw3nJ33TxF7qYwAA0tVLHw (envelope-from ) for ; Wed, 20 May 2020 06:51:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ng9CI33TxF7sAgAA1q6Kng (envelope-from ) for ; Wed, 20 May 2020 06:51:41 +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 BD8E094038F for ; Wed, 20 May 2020 06:51:40 +0000 (UTC) Received: from localhost ([::1]:41160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbIZk-0001XP-UY for larch@yhetil.org; Wed, 20 May 2020 02:51:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbIXf-0001XC-Se for emacs-orgmode@gnu.org; Wed, 20 May 2020 02:49:27 -0400 Received: from mout.web.de ([212.227.17.12]:58363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbIXe-00015b-LT for emacs-orgmode@gnu.org; Wed, 20 May 2020 02:49:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1589957360; bh=gLtQIO9iQWclhqu33HS8QntnDsuvu405vw+mU2SdlWc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=NmyrXALsIasdLHucfAsmtWsLaOToJNtdWDt382Ay2+RBgXiljo4lCejGe7yarnx+j o450pBem3MnZ/wcaWDNdEdN4TEo5d9XAFOYbBlqrlt5QX8CSt38eKUOuKmgA17EA6h Yu1/7R3RKlKhF4+P46S7LEnSX/wLotf6IfoHvlj4= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [37.228.141.26] ([37.228.141.26]) by web-mail.web.de (3c-app-webde-bap22.server.lan [172.19.172.22]) (via HTTP); Wed, 20 May 2020 08:49:20 +0200 MIME-Version: 1.0 Message-ID: From: "Nils Schween" To: "Kyle Meyer" Subject: Aw: Re: Capture Template Diary Entry: file+datetree+prompt use the prompted timestamp including the time when time is specified Content-Type: text/plain; charset=UTF-8 Date: Wed, 20 May 2020 08:49:20 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <87lflns17d.fsf@kyleam.com> References: <87lflns17d.fsf@kyleam.com> Content-Transfer-Encoding: quoted-printable X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:viAYR2/P+hyTFxyastUtMXalrZOfJ3n/bX95MLt9GU98aq0u8QSh4JCScY6o3Hkryj13c VFUrci8nREhiPDMv4tcF1s6P+G66/qZGmnpcyOXJ/E7Yhyr3qtKgIDq21YRrS1OO4TJe4g7Asn6U t+vqPAoJrs0wBi11gr+YGo23ip96lnA0AYuk6EveGdKlI/TR/NY4yBMkfvmY56u0b5ojT7CNqAGZ sPtV2DAnGjI3cwMCJ1/yq6n0vV4EDUxNtEJm9GTOlHJT4U+xH0iyxRtj6VrveRrdr3U9gBaR+zQ0 S4= X-UI-Out-Filterresults: notjunk:1;V03:K0:GEarCSSWXOk=:g27GYbKllO97CjXCGF6f0O cLWewLCoQl0KQC5JSKDFKj4pDk7/7SuxcIdN4/JNCQ7g6aLNONl2eCOaBvkKkm3X6gtXwDr+Y VhtQ4+zpfv0wWnqzw1Fe/WnpN33d33abnh9b8fSEBN9LKAwXTShm3GEdtodiyf9uuU7yEzn2C 7cUsdSFcKC4vap6ARUqwkS0ekGsDMxwxBU0g6WwFl11jXFGSrpZoel7eu9HNiWi0+uuPLE9yz Gma1o1x394IRt6C7M8PTvO9ydINc/8Pi+SYs2oK1+8IMZCnAqD3he1y4ypZohf7S5Qbie4jow byFX0l7OBSzZ6JeI0OBpA6UiFNSZcaYe3dhBs1WP4txlLd/by0+AfqTvljBC9JyAGHPtOuic2 nrdVsiFcKKYGlo1OpWnIGxG85B+s4NYlf5+sqthw9iATu9+Fpxlrh73oZeH1ILmgevFyYHex/ h+cySLI9HNyuoaujwVzofPNLA5LLZ576E7sEx+dCgc3t/QHNDIiP+Ys2wnSOiy4TfTQpAYxFI 6yUAALHWesYAvYR9svhcNou6gjOXLAg513UWV/mjZmvRYXNSDiiSoqgArZK3mrjEF9xSuXn9z +LbWnPHe9N/DEYLNuidlLgTp5LIVQ5I1rW1/s4qDw3D+MkyM6N65c2+rRLEYgiCNnI4PhG+w8 z+qnxvW99u0e7ZnEFL8db1IPWGYlufcg5rBIdIo3mBlBClFqHZ0tLVC95a6mNrQXSQcE= Received-SPF: pass client-ip=212.227.17.12; envelope-from=nils.schween@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 02:49:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=web.de header.s=dbaedf251592 header.b=NmyrXALs; 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: -0.71 X-TUID: G+hwPY4vyZpT Hi Kyle, =C2=A0 thanks a lot for your workaround! I just tested it and it almost does what= I am looking for=2E The only thing that does not work is to give a range of time, i=2Ee=2E 10:= 00-12:00=2E And looking at your code it is clear, that this cannot work bec= ause neither "%t" nor "%T" can do this=2E=20 I guess in the long run, it would make sense to adapt the template expansi= on "%t" to behave like the function "org-time-stamp"=2E=20 Such an adaption would create more consistent behaviour for org users and = does not break any former usage=2E I checked the the part in org-capture=2Eel and it looks like this=20 ((or "t" "T" "u" "U") ;; These are the date/time related ones=2E (let* ((upcase? (equal (upcase key) key)) (org-end-time-was-given nil) (time (org-read-date upcase? t nil prompt))) (org-insert-time-stamp time (or org-time-was-given upcase?) (member key '("u" "U")) nil nil (list org-end-time-was-given)))) But unfortunately, I am not an elisp programmer and I cannot do the adapti= on myself=2E I am sorry for that=2E Once more, thanks=2E Nils Gesendet:=C2=A0Mittwoch, 20=2E Mai 2020 um 06:02 Uhr Von:=C2=A0"Kyle Meyer" An:=C2=A0"Nils Schween" Cc:=C2=A0emacs-orgmode@gnu=2Eorg Betreff:=C2=A0Re: Capture Template Diary Entry: file+datetree+prompt use t= he prompted timestamp including the time when time is specified Nils Schween writes: > ("d" "Diary entry" entry (file+datetree+prompt "~/MPIK-Nextcloud/emacs/= =2Eorg/kalender=2Eorg") > "* %i%?\n %T") > > And it works as expected: When calling the capture template, I am prompt= ed for a > date and I can also type a time, and on saving everything is stored at t= he > correct location in the datetree=2E Perfect=2E But in case I do not ente= r a time, > 00:00 is inserted=2E This is unfortunate=2E Okay, I can replace "%T" in = the template > with "%t", but then any specification of time is ignored=2E > > Instead, I would love to mimic the behaviour of the function "org-time-s= tamp"=2E Calling it > prompts for a date, and if I do not specify a time, only the date is ins= erted=2E > In case I specify a time or a range (i=2Ee=2E 10:00-12:00) the timestamp= is > supplemented with this additional information=2E > > I tried a lot to get the desired behaviour by testing variants of the fo= llowing > combination of org-mode functions and variables=2E > %(org-insert-time-stamp (org-read-date nil t org-read-date-final-answer)= t) > > I was not able to produce what I wanted=2E > > Does anyone have a workaround or an idea how I could implement the descr= ibed and > wished behaviour? Thanks=2E I'm not aware of any built-in way to do what you want=2E For either implementing or working around, org-capture-set-target-location and org-capture-fill-template are the two places you'd probably want to look=2E As a start of a hacky workaround, with an entry like ("d" "Diary entry" entry (file+datetree "/tmp/scratch=2Eorg") "* %i%?\n %T" :time-prompt t) you should be able to get the time/no time behavior you're after with (advice-add 'org-capture-fill-template :around (lambda (fn &optional template &rest args) (let ((template (and (not org-time-was-given) (replace-regexp-in-string "%T" "%t" (org-capture-get :template) t)))) (apply fn template args))) '((name =2E "org-capture-hack")))