Re: [BUG] org-id-get-create creating property drawers after SCHEDULE and DEADLINE keywords [9.6 (release_9.6-3-ga4d38e @ /nix/store/zr2g5z2hbqxa93ndfkx6n0v489al6lfq-emacs-git-20221206.0/share/emacs/30

2023-02-19 Thread Jack Kamm
Ihor Radchenko  writes:

> Which is org-caldav's problem not recognizing Org syntax.

I don't think this is a bug in org-mode or org-caldav, nor has to do
with property drawers.

org-caldav just uses ox-icalendar.el to export to ICS, and by default
SCHEDULED timestamp is not exported to calendar VEVENTs. However, the
user can set org-icalendar-use-scheduled if they want to change this
behavior.



Re: [PATCH] Async evaluation in ob-shell

2023-02-19 Thread Matt

  On Fri, 17 Feb 2023 05:44:20 -0500  Ihor Radchenko  wrote --- 
 > What I mean is...

I follow you now.  Thank you.

I've attached a patch (with commit message) for adding async to ob-shell.  If 
it looks good, I can apply it to main.

0001-ob-shell-Add-async-evaluation.patch
Description: Binary data


Re: RFC on implementation adding buttons beside headings

2023-02-19 Thread Samuel Wales
at least for context menus or so it might or might not be useful to
install and modify org-mouse.  it allows you to do things like unfold,
check a list box, etc.

On 2/19/23, Ihor Radchenko  wrote:
> pareto optimal  writes:
>
>> I've recently been playing with emacs on Android and wanted an easier way
>> to clock in.
>>
>> My idea was to put buttons beside org headings that are TODO items. I do
>> this by:
>>
>> - removing clocking buttons on heading if present, then adding a clock in
>> button on 'org-after-todo-state-change-hook`
>> ...
>
> Alternatives can be:
> 1. Showing a side buffer with context-dependent buttons
> 2. Utilizing context menu
>
>> I'm new to using buttons and emacs and I found the only way to place the
>> button where I wanted was to insert some blank space after the heading. Is
>> that expected and best practice or is there some other way to do it?
>
> AFAIK, buttons must be on top of actual text.
> You can also use `insert-button'.
>
>> Would this be something useful in core org-mode? I know at least a few
>> friends who've asked me "why isn't there some button I can click by
>> headings to clock in" when I showed them how I use org-mode.
>
> Mobile support will certainly be useful.
>
> Though I'd prefer not to modify the buffer and instead use a
> side window. That way, you can write a minor mode that will create
> configurable buttons depending on major mode and cursor position in the
> buffer. The buttons will also have a fixed size, possibly utilizing
> larger fonts-a useful thing to have on smartphones.
>
> Such minor mode may then be not restricted to Org mode and could be
> used, say, in Org agenda or other major modes in Emacs.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



bug with org-agenda? Doesn't list matches for last entry in #+TODO

2023-02-19 Thread Kevin Layer
In the 2nd section

Global list of TODO items of type: ALL

I don't see items for @ERRANDS when #+TODO is defined like this:

#+TODO: @NOW @NEXT @WIP @PENDING @ERRANDS

but I do when it is defined like this

#+TODO: @NOW @NEXT @WIP @PENDING @ERRANDS @dummy

Additional info:

(setq org-agenda-custom-commands
  '(("n" "Agenda + TODOs" ((agenda "") (alltodo "")

display with (org-agenda nil "n").

I tried to debug it, but I got deep in the weeds and couldn't figure it out
after an hour or so.

Thanks.

Kevin


Re: How to avoid settings at the start of the file.

2023-02-19 Thread Ihor Radchenko
Ypo  writes:

> Is there a way to not having these kind of settings in the head of 
> org-buffers?

You can use top-level drawer.

> #+export_file_name: borrar
> #+SETUPFILE: ~\export.setup
> #+HTML_HEAD:  href="./export/latex-css/style.css" />

-- begin document --
:PROPERTIES:
:export_file_name: borrar
:export_html_head:  
href="./export/latex-css/style.css" /> 
:END:
#+SETUPFILE: ~\export.setup

Not SETUPFILE though.

> Could it be possible to add them in the .init file? Or to have them 
> inside a headline?

.init is also possible, but only for html_head -- see org-html-head.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: How to avoid settings at the start of the file.

2023-02-19 Thread Thomas S. Dye



Ypo  writes:


Hi

Is there a way to not having these kind of settings in the head 
of org-buffers?


#+export_file_name: borrar
#+SETUPFILE: ~\export.setup
#+HTML_HEAD: href="./export/latex-css/style.css" />


Could it be possible to add them in the .init file? Or to have 
them inside a headline?


The upper part of a buffer is very important to me, and I don't 
like to see those lines there...


I put my configuration under a heading at the bottom of the file.

hth,
Tom

--
Thomas S. Dye
https://tsdye.online/tsdye



Links to external targets with (or despite) org-ref

2023-02-19 Thread Sven Bretfeld
Hi everybody

I'm looking to create labels/links to specific text positions in org
files (not line number, not header).

I know that [[file:~/path_to_file::target]] can be used to jump to
<>. That would be fine and works for me -- IF I write the link
manually.

However, org-ref which I use for citations seems to overwrite the
default behaviour of org-store-link and org-insert-link. So when the
point is on <> and org-store-link is called (C-c l), I get a
prompt "Store link with (default org-ref-store-ref)". No alternatives
are offered when TAB is hit. Hiting RET saves the link as
"Crefrange:target". A corresponding org-insert-link (C-c C-l) produces
a link of the form [[Crefrange:target]] which, when in another file,
of course leads nowhere ("search failed"). How to get the file name
into these links without manually rewriting the link?

I couldn't find anything on this issue in the org-ref manual or on the
internet.

Thanks for help,

Sven



How to avoid settings at the start of the file.

2023-02-19 Thread Ypo

Hi

Is there a way to not having these kind of settings in the head of 
org-buffers?


#+export_file_name: borrar
#+SETUPFILE: ~\export.setup
#+HTML_HEAD: href="./export/latex-css/style.css" />



Could it be possible to add them in the .init file? Or to have them 
inside a headline?


The upper part of a buffer is very important to me, and I don't like to 
see those lines there...


Best regards!


Re: [PATCH] org-element-timestamp-interpreter: Return daterange anyway, if DATERANGE is non-nil

2023-02-19 Thread Ilya Chernyshov


I forgot to attach the patch :)

>From b47324bc804e64e6cef482ba4897a457252e803a Mon Sep 17 00:00:00 2001
From: Ilya Chernyshov 
Date: Sat, 18 Feb 2023 14:55:39 +0700
Subject: [PATCH] org-element-timestamp-interpreter: Return daterange anyway,
 if DATERANGE is non-nil

* lisp/org-element (org-element-timestamp-interpreter): Replace
silenced argument with optional argument DATERANGE which controls
whether to return daterange (even if dates in the range are equal) or
timerange (if it's possible). Refactor the code.

* lisp/org-element (org-element-planning-interpreter): Call
`org-element-timestamp-interpreter' without second argument.

* lisp/org-element (org-element-clock-interpreter): Call
`org-element-timestamp-interpreter' with DATERANGE set to t, because
clock entries only support daterange format.

* lisp/org-element (org-element-interpret-data): Call
`org-element-timestamp-interpreter' on timestamp object with DATERANGE
set to t, if it's inactive-range.

* testing/lisp/test-org-element
(test-org-element/timestamp-interpreter): Expect timerange returned
for timestamp of type active-range from
`org-element-timestamp-interpreter' and `org-test-parse-and-interpret'
calls. Add tests for `org-element-timestamp-interpreter' with
DATERANGE argument.
---
 lisp/org-element.el  | 180 ++-
 testing/lisp/test-org-element.el |  28 -
 2 files changed, 106 insertions(+), 102 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index d7847a678..9649c6951 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2042,7 +2042,7 @@ (defun org-element-clock-interpreter (clock _)
   "Interpret CLOCK element as Org syntax."
   (concat "CLOCK: "
 	  (org-element-timestamp-interpreter
-	   (org-element-property :value clock) nil)
+	   (org-element-property :value clock) t)
 	  (let ((duration (org-element-property :duration clock)))
 	(and duration
 		 (concat " => "
@@ -2673,15 +2673,15 @@ (defun org-element-planning-interpreter (planning _)
 	 (list (let ((deadline (org-element-property :deadline planning)))
 		 (when deadline
 		   (concat org-element-deadline-keyword " "
-			   (org-element-timestamp-interpreter deadline nil
+			   (org-element-timestamp-interpreter deadline
 	   (let ((scheduled (org-element-property :scheduled planning)))
 		 (when scheduled
 		   (concat org-element-scheduled-keyword " "
-			   (org-element-timestamp-interpreter scheduled nil
+			   (org-element-timestamp-interpreter scheduled
 	   (let ((closed (org-element-property :closed planning)))
 		 (when closed
 		   (concat org-element-closed-keyword " "
-			   (org-element-timestamp-interpreter closed nil))
+			   (org-element-timestamp-interpreter closed))
" "))
 
 
@@ -4020,100 +4020,79 @@ (defun org-element-timestamp-parser ()
 		 repeater-props
 		 warning-props))
 
-(defun org-element-timestamp-interpreter (timestamp _)
-  "Interpret TIMESTAMP object as Org syntax."
-  (let* ((repeat-string
-	  (concat
-	   (pcase (org-element-property :repeater-type timestamp)
-	 (`cumulate "+") (`catch-up "++") (`restart ".+"))
-	   (let ((val (org-element-property :repeater-value timestamp)))
-	 (and val (number-to-string val)))
-	   (pcase (org-element-property :repeater-unit timestamp)
-	 (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"
-	 (warning-string
-	  (concat
-	   (pcase (org-element-property :warning-type timestamp)
-	 (`first "--") (`all "-"))
-	   (let ((val (org-element-property :warning-value timestamp)))
-	 (and val (number-to-string val)))
-	   (pcase (org-element-property :warning-unit timestamp)
-	 (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"
-	 (build-ts-string
-	  ;; Build an Org timestamp string from TIME.  ACTIVEP is
-	  ;; non-nil when time stamp is active.  If WITH-TIME-P is
-	  ;; non-nil, add a time part.  HOUR-END and MINUTE-END
-	  ;; specify a time range in the timestamp.  REPEAT-STRING is
-	  ;; the repeater string, if any.
-	  (lambda (time activep  with-time-p hour-end minute-end)
-	(let ((ts (format-time-string
-   (org-time-stamp-format with-time-p)
-		   time)))
-	  (when (and hour-end minute-end)
-		(string-match "[012]?[0-9]:[0-5][0-9]" ts)
-		(setq ts
-		  (replace-match
-		   (format "\\&-%02d:%02d" hour-end minute-end)
-		   nil nil ts)))
-	  (unless activep (setq ts (format "[%s]" (substring ts 1 -1
-	  (dolist (s (list repeat-string warning-string))
-		(when (org-string-nw-p s)
-		  (setq ts (concat (substring ts 0 -1)
-   " "
-   s
-   (substring ts -1)
-	  ;; Return value.
-	  ts)))
-	 (type (org-element-property :type timestamp)))
-(pcase type
-  ((or `active `inactive)
-   (let* ((minute-start (org-element-property :minute-start timestamp))
-	  (minute-end (org-element-property :minute-end timestamp))
-	  (hour-start 

[PATCH] org-element-timestamp-interpreter: Return daterange anyway, if DATERANGE is non-nil

2023-02-19 Thread Ilya Chernyshov

Hello, guys

`org-element-timestamp-interpreter' function returns string of the 
form
"<2023-02-19 Sun 10:00>--<2023-02-19 Sun 10:30>" for a timestamp 
object
passed to it. The better result would be "<2023-02-19 Sun 
10:00-10:30>".


This function is also used for interpreting clock entries, which 
only
have the format of "[2023-02-19 Sun 10:00]--[2023-02-19 Sun 
10:30]".


So, an option is needed that controls whether to return a 
daterange
(even it's possible to return a timerange) or a timerange (if the 
dates

in the range are equal).

I wrote a patch that handles this problem, could you please review 
the

code and give some advice to improve it?

--
Best,
Ilya



Re: How to export org-agenda to ICS to show in iCal

2023-02-19 Thread Ihor Radchenko
Max Nikulin  writes:

>> In agenda buffer, M-x write-file  file-name.ics 
>
> Shouldn't it be `org-agenda-write', not `write-file'?

Yes, indeed.




Re: RFC on implementation adding buttons beside headings

2023-02-19 Thread Ihor Radchenko
pareto optimal  writes:

> I've recently been playing with emacs on Android and wanted an easier way to 
> clock in.
>
> My idea was to put buttons beside org headings that are TODO items. I do this 
> by:
>
> - removing clocking buttons on heading if present, then adding a clock in 
> button on 'org-after-todo-state-change-hook`
> ...

Alternatives can be:
1. Showing a side buffer with context-dependent buttons
2. Utilizing context menu

> I'm new to using buttons and emacs and I found the only way to place the 
> button where I wanted was to insert some blank space after the heading. Is 
> that expected and best practice or is there some other way to do it?

AFAIK, buttons must be on top of actual text.
You can also use `insert-button'.

> Would this be something useful in core org-mode? I know at least a few 
> friends who've asked me "why isn't there some button I can click by headings 
> to clock in" when I showed them how I use org-mode.

Mobile support will certainly be useful.

Though I'd prefer not to modify the buffer and instead use a
side window. That way, you can write a minor mode that will create
configurable buttons depending on major mode and cursor position in the
buffer. The buttons will also have a fixed size, possibly utilizing
larger fonts-a useful thing to have on smartphones.

Such minor mode may then be not restricted to Org mode and could be
used, say, in Org agenda or other major modes in Emacs.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at