Re: [PATCH] ox-icalendar.el: create alarm at event time

2021-12-28 Thread Mikhail Skorzhinskii
Hi Nicolas,

Thank you for the review, appreciate your comments. I've applied your
suggestions. Please find the fixed file in the attachment to this
letter.

There is one important note that about this patch. There is one corner
case: when we've set org-icalendar-force-alarm variable to nil, org-
icalendar-alarm-time variable to non-nil and the APPT_WARNTIME property
is set to 0, then, with my code, the value of the org-icalendar-alarm-
time would be used.

Basically if user is not forcing the 'zero alarms', and has some non-
zero default value for alarms, the APPT_WARNTIME property will use
default alarm. Which is something, I would say, unexpected. I would
expect that alarm will be shut-off.

However I am just keeping the previous behaviour. I think its worth
fixing, but I'd say we do this in a separate patch.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:22 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set
> > alarm
> > even if alarm time is set to zero.
> > * lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at
> > the
> > event start if the alarm time is set to zero and
> > `org-icalendar-force-alarm' is set to true.
> 
> Thanks. Some comments follow.
> 
> > +(defcustom org-icalendar-force-alarm nil
> > +  "Non-nil means alarm will be created even if is set to zero.
> > +
> > +This overrides default behaviour where zero means no alarm. With
>  ^^^
> You need two spaces after full stop.
> 
> > +this set to non-nil and alarm set to zero, alarm will be created
> > +and will fire at the event start."
> > +  :group 'org-export-icalendar
> > +  :type 'bool)
> 
> `boolean' is the valid type.
> 
> You also need to add :package-version '(Org . "9.6") and :safe
> #'booleanp.
> > +    (if org-icalendar-force-alarm
> > +    (if alarm-time
> > +    alarm-time
> > +  org-icalendar-alarm-time)
> > +  (if (zerop alarm-time)
> > +  org-icalendar-alarm-time
> > +    alarm-time))
> 
> I suggest to refactor the above into something like:
> 
> (cond
>  ((> alarm-time 0) alarm-time)
>  ((and (= 0 alarm-time) org-icalendar-force-alarm) alarm-time)
>  (t org-icalendar-alarm-time))
> 
> Could you send an updated patch?
> 
> Regards,
> -- 
> Nicolas Goaziou
From 39b0df3309607f61d108402748d6646939f98696 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:52:39 +0200
Subject: [PATCH 4/5] ox-icalendar.el: create alarm at event time

* lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set alarm
even if alarm time is set to zero.
* lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at the
event start if the alarm time is set to zero and
`org-icalendar-force-alarm' is set to true.
---
 lisp/ox-icalendar.el | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 189e35946..1870a72b8 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -66,6 +66,17 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm.  With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'boolean
+  :package-version '(Org . "9.6")
+  :safe #'booleanp)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -807,8 +818,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
   (let ((alarm-time
 	 (let ((warntime
 		(org-element-property :APPT_WARNTIME entry)))
-	   (if warntime (string-to-number warntime) 0
-(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+	   (if warntime (string-to-number warntime) nil
+(and (or (and alarm-time
+		  (> alarm-time 0))
+	 (> org-icalendar-alarm-time 0)
+	 org-icalendar-force-alarm)
 	 (org-element-property :hour-start timestamp)
 	 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -816,8 +830,10 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 		 summary
-		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
-
+ (cond
+  ((and alarm-time org-icalendar-force-alarm) alarm-time)
+  ((and alarm-time (not (zerop alarm-time))) alarm-time)
+  (t org-icalendar-alarm-time))
 
  Template
 
-- 
2.32.0



Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix

2021-12-28 Thread Mikhail Skorzhinskii
Hi Nicolas,

Thank you for the reviewing my suggestions. I've fixed issues you've
listed. I've attached new patch to this email.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:26 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Thanks. Some comments follow.
> 
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
> > configurable prefix for the scheduled headlines
> 
> "New variable" is enough.
> 
> > * lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
> > configurable prefix for the headlines with a deadline
> 
> Ditto.
> 
> > +(defcustom org-icalendar-scheduled-summary-prepend "S: "
> > +  "String used for prepending summary in exported scheduled
> > headlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> > +
> > +(defcustom org-icalendar-deadline-summary-prepend "DL: "
> > +  "String used for prepending summary in exported deadlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> 
> Could you add missing :safe and :package-version keywords?
> 
> Regards,
From 6849f0dde1cc8fefbfea0271039e5066a3cb2746 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 3/5] ox-icalendar.el: customizable vevent summary prefix

* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-entry): use a configurable
headline prefixes (see above) instead of hardcoded ones
---
 lisp/ox-icalendar.el | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 68c5679ea..189e35946 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -84,6 +84,21 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prepend "S: "
+  "String used for prepending summary in exported scheduled headlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
+
+(defcustom org-icalendar-deadline-summary-prepend "DL: "
+  "String used for prepending summary in exported deadlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -607,7 +622,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-deadline)))
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
-		  (concat "DL: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-deadline-summary-prepend summary) loc desc cat tz class)))
 	  (let ((scheduled (org-element-property :scheduled entry))
 		(use-scheduled (plist-get info :icalendar-use-scheduled)))
 	(and scheduled
@@ -618,7 +633,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-scheduled)))
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
-		  (concat "S: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-scheduled-summary-prepend summary) loc desc cat tz class)))
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
-- 
2.32.0



Re: [PATCH] org-agenda.el: customise outline path in echo area

2021-12-28 Thread Mikhail Skorzhinskii
Hi Ihor,

Thank you for your comments once again. I've changed string= to eq and
it appears to be working OK.

I've also renamed "title" variable to "title-prop" for better
readability. The -prop suffix should show the reader that it was
extracted from the file, and thus cost some CPU/IO.

I've attached an updated version to this email. Would love to hear what
you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 21:44 +0800, Ihor Radchenko wrote:
> Mikhail Skorzhinskii  writes:
> 
> Thanks for the patch! The addition looks reasonable to me.
> 
> > +    (title (when (and file-or-title (string= file-or-title
> > 'title))
> > ...
> > +  (and file-or-title bfn (concat (if (and (string= file-
> > or-
> > title 'title) title)
> 
> (string= file-or-title 'title) will match FILE-OR-TITLE values
> "title"
> and 'title. I am not sure if it is what you intended to achieve.
> Probably, a simple (eq file-or-title 'title) would be sufficient.
> 
> Best,
> Ihor
From 1a09ea522b51f2a418b58f0f6122c578a836f69f Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:10:05 +0200
Subject: [PATCH 1/5] org-agenda.el: customize outline path in echo area

* lisp/org-agenda.el (org-agenda-show-outline-path): add an option to
show document title in outline path (instead of file name)
* lisp/org.el (org-get-title-from-file): a function to collect the
document title from the org-mode file
* lisp/org.el (org-display-outline-path): add logic that will collect a
document title and put it into the outline path if
org-agenda-show-outline-path set to 'title
---
 lisp/org-agenda.el | 11 ---
 lisp/org.el| 25 ++---
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 721ef2ced..817354659 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1045,9 +1045,14 @@ current item's tree, in an indirect buffer."
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-nil means show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion.
+
+If set to 'title, show document title."
   :group 'org-agenda-startup
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Don't show outline path in agenda view." nil)
+	  (const :tag "Show outline path with prepended file name." t)
+	  (const :tag "Show outline path with prepended document title. Fallback to file name is no title is present." title)))
 
 (defcustom org-agenda-start-with-entry-text-mode nil
   "The initial value of entry-text-mode in a newly created agenda window."
@@ -9354,7 +9359,7 @@ When called with a prefix argument, include all archive files as well."
 	   (org-agenda-tree-to-indirect-buffer nil)
 	 (org-agenda-show)))
   (and org-agenda-show-outline-path
-	   (org-with-point-at m (org-display-outline-path t))
+	   (org-with-point-at m (org-display-outline-path org-agenda-show-outline-path))
 
 (defun org-agenda-show-tags ()
   "Show the tags applicable to the current item."
diff --git a/lisp/org.el b/lisp/org.el
index ce4e08eab..8790c72ab 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8166,10 +8166,24 @@ the default is \"/\"."
 	(setf (substring fpath (- width 2)) "..")))
 fpath))
 
-(defun org-display-outline-path ( file current separator just-return-string)
+(defun org-get-title-from-file (file)
+  "Collect tilte from the provided `org-mode' FILE."
+  (let (title)
+(when file
+  (with-current-buffer
+	  (get-file-buffer file)
+	(pcase (org-collect-keywords '("TITLE"))
+	  (`(("TITLE" . ,val))
+	   (setq title (car val)
+  title)))
+
+
+(defun org-display-outline-path ( file-or-title current separator just-return-string)
   "Display the current outline path in the echo area.
 
-If FILE is non-nil, prepend the output with the file name.
+If FILE-OR-TITLE is 'title, prepend outline with file title.  If
+it is non-nil or title is not present in document, prepend
+outline path with the file name.
 If CURRENT is non-nil, append the current heading to the output.
 SEPARATOR is passed through to `org-format-outline-path'.  It separates
 the different parts of the path and defaults to \"/\".
@@ -8177,6 +8191,8 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message."
   (interactive "P")
   (let* (case-fold-search
 	 (bfn (buffer-file-name (buffer-base-buffer)))
+	 (title-prop (when (and file-or-title (eq file-or-title 'title))
+		  (org-get-title-from-file bfn)))
 	 (path (and (derived-mode-p 'org-mode) (org-get-outline-path)))
 	 res)
 (when current (setq path (append path
@@ -8188,7 +8204,10 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a 

Re: [PATCH] org-refile.el: show refile targets with doc. title

2021-12-28 Thread Mikhail Skorzhinskii
Hi Ihor,

Thank you for reviewing the changes. Sorry for the sloppy patch, I've
retested everything and added a few additional fixes, there were more
problems.

I've added a couple of test cases too. (BTW, test framework is awesome
and really easy to use!)

I've attached new patch to this email. Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 21:59 +0800, Ihor Radchenko wrote:
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/org-refile.el (org-refile-use-outline-path): add an option
> > 'title
> 
> This is an interesting idea. However, your patch may break things
> quite
> badly. Look at `org-refile-get-location'. It expects a very specific
> format for the refile targets and treats 'file/'full-file-path values
> specially.
> 
> Can you add tests for your new value of org-refile-use-outline-path
> and
> make sure that they do not fail after applying your patch?
> 
> Best,
> Ihor
> 
> 
From e6d3aae4a75e50423924e0eacbcd94cdea7dafe8 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Mon, 21 Sep 2020 14:53:13 +0200
Subject: [PATCH 2/5] org-refile.el: show refile targets with doc. title

* lisp/org-refile.el (org-refile-use-outline-path): add an option 'title
* lisp/org-refile.el (org-refile-get-targets): start refile target
outline with document title (#+title) instead of file name
---
 lisp/org-refile.el   | 18 +++---
 testing/lisp/test-org.el | 29 -
 2 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 678759e10..644e9f497 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -158,7 +158,8 @@ When `buffer-name', use the buffer name."
 	  (const :tag "Yes" t)
 	  (const :tag "Start with file name" file)
 	  (const :tag "Start with full file path" full-file-path)
-	  (const :tag "Start with buffer name" buffer-name)))
+	  (const :tag "Start with buffer name" buffer-name)
+	  (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +318,9 @@ converted to a headline before refiling."
 		 (push (list (and (buffer-file-name (buffer-base-buffer))
   (file-truename (buffer-file-name (buffer-base-buffer
  f nil nil) tgs))
+	   (when (eq org-refile-use-outline-path 'title)
+		 (push (list (or (org-get-title-from-file (file-truename (buffer-file-name (buffer-base-buffer
+ (and f (file-name-nondirectory f))) f nil nil) tgs))
 	   (org-with-wide-buffer
 		(goto-char (point-min))
 		(setq org-outline-path-cache nil)
@@ -343,7 +347,15 @@ converted to a headline before refiling."
(and (buffer-file-name (buffer-base-buffer))
 (file-name-nondirectory
  (buffer-file-name (buffer-base-buffer))
-   (`full-file-path
+   (`title (list
+(or
+ (org-get-title-from-file
+  (file-truename
+   (buffer-file-name (buffer-base-buffer
+ (and (buffer-file-name (buffer-base-buffer))
+ (file-name-nondirectory
+  (buffer-file-name (buffer-base-buffer)))
+   (`full-file-path
 (list (buffer-file-name
 	   (buffer-base-buffer
    (`buffer-name
@@ -631,7 +643,7 @@ this function appends the default value from
 	 (tbl (mapcar
 	   (lambda (x)
 		 (if (and (not (member org-refile-use-outline-path
-   '(file full-file-path)))
+   '(file full-file-path title)))
 			  (not (equal filename (nth 1 x
 		 (cons (concat (car x) extra " ("
    (file-name-nondirectory (nth 1 x)) ")")
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 056ea7d87..a6df00baf 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -6435,7 +6435,34 @@ Paragraph"
(org-test-with-temp-text "* H1"
  (let* ((org-refile-use-outline-path 'buffer-name)
 	(org-refile-targets `((nil :level . 1
-   (member (buffer-name) (mapcar #'car (org-refile-get-targets)))
+   (member (buffer-name) (mapcar #'car (org-refile-get-targets))
+  ;; When `org-refile-use-outline-path' is `title', return extracted
+  ;; document title
+  (should
+   (equal '("T" "T/H1")
+  (org-test-with-temp-text-in-file "#+ti

[PATCH] ox-icalendar.el: customizable vevent summary prefix

2021-12-25 Thread Mikhail Skorzhinskii


* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
configurable prefix for the scheduled headlines
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
configurable prefix for the headlines with a deadline
* lisp/ox-icalendar.el (org-icalendar-entry): use a configurable
headline prefixes (see above) instead of hardcoded ones
---
 lisp/ox-icalendar.el | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 68c5679ea..0a56e08e5 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -84,6 +84,17 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prepend "S: "
+  "String used for prepending summary in exported scheduled
headlines."
+  :group 'org-export-icalendar
+  :type 'string)
+
+
+(defcustom org-icalendar-deadline-summary-prepend "DL: "
+  "String used for prepending summary in exported deadlines."
+  :group 'org-export-icalendar
+  :type 'string)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -607,7 +618,7 @@ inlinetask within the section."
   (_ (memq 'event-if-not-todo use-deadline)))
 (org-icalendar--vevent
  entry deadline (concat "DL-" uid)
- (concat "DL: " summary) loc desc cat tz class)))
+ (concat org-icalendar-deadline-summary-prepend
summary) loc desc cat tz class)))
  (let ((scheduled (org-element-property :scheduled entry))
(use-scheduled (plist-get info :icalendar-use-
scheduled)))
    (and scheduled
@@ -618,7 +629,7 @@ inlinetask within the section."
   (_ (memq 'event-if-not-todo use-scheduled)))
 (org-icalendar--vevent
  entry scheduled (concat "SC-" uid)
- (concat "S: " summary) loc desc cat tz class)))
+ (concat org-icalendar-scheduled-summary-prepend
summary) loc desc cat tz class)))
  ;; When collecting plain timestamps from a headline and its
  ;; title, skip inlinetasks since collection will happen once
  ;; ENTRY is one of them.




[PATCH] ox-icalendar.el: create alarm at event time

2021-12-25 Thread Mikhail Skorzhinskii


* lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set alarm
even if alarm time is set to zero.
* lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at the
event start if the alarm time is set to zero and
`org-icalendar-force-alarm' is set to true.
---
 lisp/ox-icalendar.el | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 0a56e08e5..15b5e3e37 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -66,6 +66,15 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm. With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'bool)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda
files."
   :group 'org-export-icalendar
@@ -803,8 +812,11 @@ Return VALARM component as a string, or nil if it
isn't allowed."
   (let ((alarm-time
 (let ((warntime
(org-element-property :APPT_WARNTIME entry)))
-  (if warntime (string-to-number warntime) 0
-    (and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+  (if warntime (string-to-number warntime) nil
+    (and (or (and alarm-time
+ (> alarm-time 0))
+    (> org-icalendar-alarm-time 0)
+    org-icalendar-force-alarm)
 (org-element-property :hour-start timestamp)
 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -812,7 +824,13 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 summary
-    (if (zerop alarm-time) org-icalendar-alarm-time alarm-
time)
+    (if org-icalendar-force-alarm
+    (if alarm-time
+    alarm-time
+  org-icalendar-alarm-time)
+  (if (zerop alarm-time)
+  org-icalendar-alarm-time
+    alarm-time))
 
 
  Template




[PATCH] org-refile.el: show refile targets with doc. title

2021-12-25 Thread Mikhail Skorzhinskii


* lisp/org-refile.el (org-refile-use-outline-path): add an option
'title
* lisp/org-refile.el (org-refile-get-targets): start refile target
outline with document title (#+title) instead of file name
---
 lisp/org-refile.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 678759e10..8ff1b2f5b 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -158,7 +158,8 @@ When `buffer-name', use the buffer name."
  (const :tag "Yes" t)
  (const :tag "Start with file name" file)
  (const :tag "Start with full file path" full-file-path)
- (const :tag "Start with buffer name" buffer-name)))
+ (const :tag "Start with buffer name" buffer-name)
+ (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +318,8 @@ converted to a headline before refiling."
 (push (list (and (buffer-file-name (buffer-base-
buffer))
   (file-truename (buffer-file-name
(buffer-base-buffer
  f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'title)
+    (push (list (org-get-title-from-file (file-truename
(buffer-file-name (buffer-base-buffer f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)




[PATCH] org-agenda.el: customise outline path in echo area

2021-12-25 Thread Mikhail Skorzhinskii


* lisp/org-agenda.el (org-agenda-show-outline-path): add an option to
show document title in outline path (instead of file name)
* lisp/org.el (org-get-title-from-file): a function to collect the
document title from the org-mode file
* lisp/org.el (org-display-outline-path): add logic that will collect a
document title and put it into the outline path if
org-agenda-show-outline-path set to 'title
---
 lisp/org-agenda.el | 11 ---
 lisp/org.el    | 25 ++---
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 721ef2ced..817354659 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1045,9 +1045,14 @@ current item's tree, in an indirect buffer."
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-nil means show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion.
+
+If set to 'title, show document title."
   :group 'org-agenda-startup
-  :type 'boolean)
+  :type '(choice
+ (const :tag "Don't show outline path in agenda view." nil)
+ (const :tag "Show outline path with prepended file name." t)
+ (const :tag "Show outline path with prepended document title.
Fallback to file name is no title is present." title)))
 
 (defcustom org-agenda-start-with-entry-text-mode nil
   "The initial value of entry-text-mode in a newly created agenda
window."
@@ -9354,7 +9359,7 @@ When called with a prefix argument, include all
archive files as well."
   (org-agenda-tree-to-indirect-buffer nil)
 (org-agenda-show)))
   (and org-agenda-show-outline-path
-  (org-with-point-at m (org-display-outline-path t))
+  (org-with-point-at m (org-display-outline-path org-agenda-
show-outline-path))
 
 (defun org-agenda-show-tags ()
   "Show the tags applicable to the current item."
diff --git a/lisp/org.el b/lisp/org.el
index ce4e08eab..eab3aed3c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8166,10 +8166,24 @@ the default is \"/\"."
(setf (substring fpath (- width 2)) "..")))
 fpath))
 
-(defun org-display-outline-path ( file current separator
just-return-string)
+(defun org-get-title-from-file (file)
+  "Collect tilte from the provided `org-mode' FILE."
+  (let (title)
+    (when file
+  (with-current-buffer
+ (get-file-buffer file)
+   (pcase (org-collect-keywords '("TITLE"))
+ (`(("TITLE" . ,val))
+  (setq title (car val)
+  title)))
+
+
+(defun org-display-outline-path ( file-or-title current
separator just-return-string)
   "Display the current outline path in the echo area.
 
-If FILE is non-nil, prepend the output with the file name.
+If FILE-OR-TITLE is 'title, prepend outline with file title.  If
+it is non-nil or title is not present in document, prepend
+outline path with the file name.
 If CURRENT is non-nil, append the current heading to the output.
 SEPARATOR is passed through to `org-format-outline-path'.  It
separates
 the different parts of the path and defaults to \"/\".
@@ -8177,6 +8191,8 @@ If JUST-RETURN-STRING is non-nil, return a
string, don't display a message."
   (interactive "P")
   (let* (case-fold-search
 (bfn (buffer-file-name (buffer-base-buffer)))
+    (title (when (and file-or-title (string= file-or-title
'title))
+ (org-get-title-from-file bfn)))
 (path (and (derived-mode-p 'org-mode) (org-get-outline-path)))
 res)
 (when current (setq path (append path
@@ -8188,7 +8204,10 @@ If JUST-RETURN-STRING is non-nil, return a
string, don't display a message."
  (org-format-outline-path
   path
   (1- (frame-width))
-  (and file bfn (concat (file-name-nondirectory bfn)
separator))
+  (and file-or-title bfn (concat (if (and (string= file-or-
title 'title) title)
+ title
+   (file-name-nondirectory
bfn))
+    separator))
   separator))
 (add-face-text-property 0 (length res)
    `(:height ,(face-attribute 'default
:height))




[PATCH] org-agenda.el: agenda*: add lost argument

2021-12-25 Thread Mikhail Skorzhinskii


* lisp/org-agenda.el (org-agenda): add lost argument for agenda*
---
 lisp/org-agenda.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 817354659..564cdd331 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2953,7 +2953,7 @@ Pressing `<' twice means to restrict to the
current subtree or region
  (`agenda
   (org-agenda-list current-prefix-arg))
  (`agenda*
-  (org-agenda-list current-prefix-arg nil nil t))
+  (org-agenda-list current-prefix-arg nil nil nil t))
  (`alltodo
   (org-todo-list current-prefix-arg))
  (`search
@@ -3300,7 +3300,7 @@ s   Search for keywords M   Like
m, but only TODO entries
  (`agenda
   (call-interactively 'org-agenda-list))
  (`agenda*
-  (funcall 'org-agenda-list nil nil t))
+  (funcall 'org-agenda-list nil nil nil t))
  (`alltodo
   (call-interactively 'org-todo-list))
  (`search




Re: [PATCH] Adaptive Org faces in headings?

2020-09-21 Thread Mikhail Skorzhinskii
Hi,

I've also tried to apply this patch and see if it will work on my, heavily 
customized in terms of theming, setup. It didn't spot any new issues. Instead 
it fixed face inheritance bugs with following elements:

1. Tags with customised faces;
2. Links;
3. Ellipsis;
4. TODO keywords;
5. Priority cookies;

Thank you all for you work!

Mikhail Skorzhinskii

On Thursday, September 17, 2020 10:25:17 AM CEST Ihor Radchenko wrote:
> The attached patch seems to fix the issue.
> Can anyone test?
> 
> Best,
> Ihor







Re: [PATCHES 1, 2/2] allow to use document title in agenda and refile outline paths

2020-09-21 Thread Mikhail Skorzhinskii
... and of course I forgot to attach actual patches.

On Monday, September 21, 2020 3:09:58 PM CEST Mikhail Skorzhinskii wrote:
> Hello everyone,
> 
> I've already submitted these features to the mailing list:
> 
>   https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00628.html
> 
> But even if these changes are really tiny and minor, they are touching very
> different functionality of org-mode. It wasn't good mixing my suggestions
> for agenda and for ox-icalendar. So I'm starting a separate mail thread.
> 
> Changes since v1:
>   - Allow to customise title path for the refile targets also (thanks to
> Ihor Radchenko for suggestion); - Turn separate option into just an
> additional value for org-agenda-show-outline-path.
> 
> Kind regards,
> Mikhail Skorzhinskii

>From ecdf571291c3a598fa1c767c6a73604ab95bfd02 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Mon, 21 Sep 2020 14:53:13 +0200
Subject: [PATCH 2/2] org-refile.el: allow to start refile targets with
 document title

---
 etc/ORG-NEWS   | 2 ++
 lisp/org-refile.el | 5 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e30336f45..6d3945d91 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -16,7 +16,9 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 When set to 'title, will show document title in outline path in echo
 area instead of file name.
+*** New option value for ~org-refile-use-outline-path~
 
+When set to 'title, will show document title in outline path of refile targets.
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 7eb0a9643..e3d17bc35 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -158,7 +158,8 @@ When `buffer-name', use the buffer name."
 	  (const :tag "Yes" t)
 	  (const :tag "Start with file name" file)
 	  (const :tag "Start with full file path" full-file-path)
-	  (const :tag "Start with buffer name" buffer-name)))
+	  (const :tag "Start with buffer name" buffer-name)
+	  (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -315,6 +316,8 @@ converted to a headline before refiling."
 		 (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
 	   (when (eq org-refile-use-outline-path 'full-file-path)
 		 (push (list (file-truename (buffer-file-name (buffer-base-buffer))) f nil nil) tgs))
+	   (when (eq org-refile-use-outline-path 'title)
+		 (push (list (org-get-title-from-file (file-truename (buffer-file-name (buffer-base-buffer)))
 	   (org-with-wide-buffer
 		(goto-char (point-min))
 		(setq org-outline-path-cache nil)
-- 
2.28.0

>From 4eb0c3011fecb69c6ac5867970e033c62352c2b2 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:10:05 +0200
Subject: [PATCH 1/2] org-agenda.el: allow to customize outline path in echo
 area

Some of the org-mode data bases auto-generate file names, so they don't
carry a lot of information and can be noisy. Allowing user to show
document titles instead could be useful. Showing titles is disabled by
default.
---
 etc/ORG-NEWS   |  6 ++
 lisp/org-agenda.el | 11 ---
 lisp/org.el| 25 ++---
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 0ed626fb7..e30336f45 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -11,6 +11,12 @@ See the end of the file for license conditions.
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.5 (not yet released)
+** New options and settings
+*** New option value for ~org-agenda-show-outline-path~
+
+When set to 'title, will show document title in outline path in echo
+area instead of file name.
+
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 82fe6091c..17e189317 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1040,9 +1040,14 @@ current item's tree, in an indirect buffer."
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-nil means show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion.
+
+If set to 'title, show document title."
   :group 'org-agenda-startup
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Don't show outline path in agenda view." nil)
+	  (const :tag "Show outline path with prepended file name." t)
+	  (const :tag "Show outline path with prepended document title. Fallback to file name is no title is present." title)))
 
 (defcustom org-agenda-start-with-

[PATCHES 1, 2/2] allow to use document title in agenda and refile outline paths

2020-09-21 Thread Mikhail Skorzhinskii
Hello everyone,

I've already submitted these features to the mailing list:

  https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00628.html

But even if these changes are really tiny and minor, they are touching very 
different functionality of org-mode. It wasn't good mixing my suggestions for 
agenda and for ox-icalendar. So I'm starting a separate mail thread.

Changes since v1:
  - Allow to customise title path for the refile targets also (thanks to Ihor 
Radchenko for suggestion);
  - Turn separate option into just an additional value for 
org-agenda-show-outline-path.

Kind regards,
Mikhail Skorzhinskii





[PATCHES 1, 2/2 v2] ox-icalendar: add customisations for summary cookies and allow zero alarm

2020-09-21 Thread Mikhail Skorzhinskii
Hello forum,

I've already submitted these features to the mailing list:

  https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00628.html

But even if these changes are really tiny and minor, they are touching very 
different functionality of org-mode. It wasn't good mixing my suggestions for 
agenda and for ox-icalendar. So I'm starting a separate mail thread for my 
suggestions.

Changes since v1:
  - Add missing group and type to org-icalendar-*-summary-prepend defcustoms;

Kind regards,
Mikhail Skorzhinskii>From ecc65f713ff3efdfc40e90141dc070fc291d599f Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:52:39 +0200
Subject: [PATCH 2/2] ox-icalendar.el: introduce setting to force alarms

This is a new setting for icalendar exports to allow users set alarms
exactly at the event start. With this setting set to non-nil and alarm
set to zero (by global setting or APPT_WARNTIME property) it will create
an alarm at the event start.

Note, that zero alarm set as APPT_WARNTIME property will override
default warning time.
---
 etc/ORG-NEWS | 10 ++
 lisp/ox-icalendar.el | 24 +---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index cc471e20b..0fd3d8792 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -22,6 +22,16 @@ area instead of file name.
 Through these new options for icalendar export, one can customise the
 looks of summary lines in exported events.
 
+*** New option ~org-icalendar-force-alarm~
+
+This is a new setting for icalendar exports to allow users set alarms
+exactly at the event start. With this setting set to non-nil and alarm
+set to zero (by global setting or APPT_WARNTIME property) it will
+create an alarm at the event start.
+
+Note, that zero alarm set as =APPT_WARNTIME= property will override
+default warning time.
+
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 39807c7c2..9ac6435a6 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm. With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'bool)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -802,8 +811,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
   (let ((alarm-time
 	 (let ((warntime
 		(org-element-property :APPT_WARNTIME entry)))
-	   (if warntime (string-to-number warntime) 0
-(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+	   (if warntime (string-to-number warntime) nil
+(and (or (and alarm-time
+		  (> alarm-time 0))
+	 (> org-icalendar-alarm-time 0)
+	 org-icalendar-force-alarm)
 	 (org-element-property :hour-start timestamp)
 	 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -811,7 +823,13 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 		 summary
-		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
+		 (if org-icalendar-force-alarm
+		 (if alarm-time
+			 alarm-time
+		   org-icalendar-alarm-time)
+		   (if (zerop alarm-time)
+		   org-icalendar-alarm-time
+		 alarm-time))
 
 
  Template
-- 
2.28.0

>From 90bce01b8e97943ba90c7a9c720350bc04951a27 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 1/2] ox-icalendar.el: allow to customise deadline and
 scheduled items summary

In some of export schemes these cookies at the start of each event can
be a distraction rather then storage of useful information.
---
 etc/ORG-NEWS |  5 +
 lisp/ox-icalendar.el | 15 +--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e30336f45..cc471e20b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -17,6 +17,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 When set to 'title, will show document title in outline path in echo
 area instead of file name.
 
+*** New options ~org-icalendar-scheduled-summary-prepend~ and ~org-icalendar-deadline-summary-prepend~
+
+Through these new options for icalendar export, one can customise the
+looks of summary lines in exported events.
+
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 0f890534a..39807c7c2 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar

Re: [PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-21 Thread Mikhail Skorzhinskii
Resending the patch. There were missing parenthesis. And I didn't test build 
after modification. Fixed and retested.

Mikhail

On Monday, September 21, 2020 10:23:39 AM CEST Mikhail Skorzhinskii wrote:
> On Wednesday, September 16, 2020 4:15:20 AM CEST Ihor Radchenko wrote:
> > > 1. Show document title instead of file name in org-agenda;
> > > 
> > > This should be useful for any users of org-roam package or anyone who
> > > autogenerate file names and uses document titles instead for navigation.
> > 
> > Interesting idea. This may also be useful as an option to
> > `org-refile-use-outline-path'. Currently, its value may be 'file to
> > prepend file names to the outline paths in refile targets. Using
> > document title (i.e. when the variable is set to 'title) in the refile
> > paths may also be handy.
> 
> This is indeed better way.
> 
> Fixed.
> 
> Thanks,
> Mikhail
> 
> > Best,
> > Ihor
> > 
> > Mikhail Skorzhinskii  writes:
> > > Hello forum,
> > > 
> > > I'd like to introduce three new features and request to merge the with
> > > current master:
> > > 
> > > 1. Show document title instead of file name in org-agenda;
> > > 
> > > This should be useful for any users of org-roam package or anyone who
> > > autogenerate file names and uses document titles instead for navigation.
> > > 
> > > 2. Customise summary lines of exported events in ox-icalendar
> > > 
> > > I personally export deadlines and scheduled items to the separate files
> > > so
> > > I don't need these cookies and they consume precious space of summary
> > > line. So I prefer them be disabled. This should be possible to do now
> > > with only customisation setting.
> > > 
> > > 3. Force creation of an alarm when exporting event in ox-icalendar
> > > 
> > > Sometimes I prefer to create icalendar alarms exactly at the event
> > > start,
> > > but it's not possible since alarm set to zero means that alarm will be
> > > disabled. Forcing alarm creation will now create alarm no matter the
> > > setting.
> > > 
> > > I've updated news files and attempted to replicate the style of
> > > submissions, but I admit that I didn't read much beyond CONTRIBUTE file.
> > > Please point me to the right direction in case of any issues I can fix.
> > > 
> > > Kind regards,
> > > Mikhail Skorzhinskii
> > > 
> > > From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
> > > From: Mikhail Skorzhinskii 
> > > Date: Sat, 12 Sep 2020 18:52:39 +0200
> > > Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms
> > > 
> > > This is a new setting for icalendar exports to allow users set alarms
> > > exactly at the event start. With this setting set to non-nil and alarm
> > > set to zero (by global setting or APPT_WARNTIME property) it will create
> > > an alarm at the event start.
> > > 
> > > Note, that zero alarm set as APPT_WARNTIME property will override
> > > default warning time.
> > > ---
> > > 
> > >  etc/ORG-NEWS | 10 ++
> > >  lisp/ox-icalendar.el | 24 +---
> > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> > > index b912e807d..eb950d934 100644
> > > --- a/etc/ORG-NEWS
> > > +++ b/etc/ORG-NEWS
> > > @@ -23,6 +23,16 @@ path.
> > > 
> > >  Through these new options for icalendar export, one can customise the
> > >  looks of summary lines in exported events.
> > > 
> > > +*** New option ~org-icalendar-force-alarm~
> > > +
> > > +This is a new setting for icalendar exports to allow users set alarms
> > > +exactly at the event start. With this setting set to non-nil and alarm
> > > +set to zero (by global setting or APPT_WARNTIME property) it will
> > > +create an alarm at the event start.
> > > +
> > > +Note, that zero alarm set as =APPT_WARNTIME= property will override
> > > +default warning time.
> > > +
> > > 
> > >  * Version 9.4
> > >  ** Incompatible changes
> > >  *** Possibly broken internal file links: please check and fix
> > > 
> > > diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
> > > index f110a4b2b..baed925e8 100644
> > > --- a/lisp/ox-icalendar.el
> > > +++ b/lisp/ox-icalendar.el
&

Re: [PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-21 Thread Mikhail Skorzhinskii
On Wednesday, September 16, 2020 4:15:20 AM CEST Ihor Radchenko wrote:
> > 1. Show document title instead of file name in org-agenda;
> > 
> > This should be useful for any users of org-roam package or anyone who
> > autogenerate file names and uses document titles instead for navigation.
> 
> Interesting idea. This may also be useful as an option to
> `org-refile-use-outline-path'. Currently, its value may be 'file to
> prepend file names to the outline paths in refile targets. Using
> document title (i.e. when the variable is set to 'title) in the refile
> paths may also be handy.

This is indeed better way.

Fixed.

Thanks,
Mikhail

> Best,
> Ihor
> 
> Mikhail Skorzhinskii  writes:
> > Hello forum,
> > 
> > I'd like to introduce three new features and request to merge the with
> > current master:
> > 
> > 1. Show document title instead of file name in org-agenda;
> > 
> > This should be useful for any users of org-roam package or anyone who
> > autogenerate file names and uses document titles instead for navigation.
> > 
> > 2. Customise summary lines of exported events in ox-icalendar
> > 
> > I personally export deadlines and scheduled items to the separate files so
> > I don't need these cookies and they consume precious space of summary
> > line. So I prefer them be disabled. This should be possible to do now
> > with only customisation setting.
> > 
> > 3. Force creation of an alarm when exporting event in ox-icalendar
> > 
> > Sometimes I prefer to create icalendar alarms exactly at the event start,
> > but it's not possible since alarm set to zero means that alarm will be
> > disabled. Forcing alarm creation will now create alarm no matter the
> > setting.
> > 
> > I've updated news files and attempted to replicate the style of
> > submissions, but I admit that I didn't read much beyond CONTRIBUTE file.
> > Please point me to the right direction in case of any issues I can fix.
> > 
> > Kind regards,
> > Mikhail Skorzhinskii
> > 
> > From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
> > From: Mikhail Skorzhinskii 
> > Date: Sat, 12 Sep 2020 18:52:39 +0200
> > Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms
> > 
> > This is a new setting for icalendar exports to allow users set alarms
> > exactly at the event start. With this setting set to non-nil and alarm
> > set to zero (by global setting or APPT_WARNTIME property) it will create
> > an alarm at the event start.
> > 
> > Note, that zero alarm set as APPT_WARNTIME property will override
> > default warning time.
> > ---
> > 
> >  etc/ORG-NEWS | 10 ++
> >  lisp/ox-icalendar.el | 24 +---
> >  2 files changed, 31 insertions(+), 3 deletions(-)
> > 
> > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> > index b912e807d..eb950d934 100644
> > --- a/etc/ORG-NEWS
> > +++ b/etc/ORG-NEWS
> > @@ -23,6 +23,16 @@ path.
> > 
> >  Through these new options for icalendar export, one can customise the
> >  looks of summary lines in exported events.
> > 
> > +*** New option ~org-icalendar-force-alarm~
> > +
> > +This is a new setting for icalendar exports to allow users set alarms
> > +exactly at the event start. With this setting set to non-nil and alarm
> > +set to zero (by global setting or APPT_WARNTIME property) it will
> > +create an alarm at the event start.
> > +
> > +Note, that zero alarm set as =APPT_WARNTIME= property will override
> > +default warning time.
> > +
> > 
> >  * Version 9.4
> >  ** Incompatible changes
> >  *** Possibly broken internal file links: please check and fix
> > 
> > diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
> > index f110a4b2b..baed925e8 100644
> > --- a/lisp/ox-icalendar.el
> > +++ b/lisp/ox-icalendar.el
> > @@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
> > 
> >:version "24.1"
> >:type 'integer)
> > 
> > +(defcustom org-icalendar-force-alarm nil
> > +  "Non-nil means alarm will be created even if is set to zero.
> > +
> > +This overrides default behaviour where zero means no alarm. With
> > +this set to non-nil and alarm set to zero, alarm will be created
> > +and will fire at the event start."
> > +  :group 'org-export-icalendar
> > +  :type 'bool)
> > +
> > 
> >  (defcustom org-icalendar-combined-name "OrgMode"
> >  
> >"Calendar name for the combi

[PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-15 Thread Mikhail Skorzhinskii
Hello forum,

I'd like to introduce three new features and request to merge the with current 
master:

1. Show document title instead of file name in org-agenda;

This should be useful for any users of org-roam package or anyone who 
autogenerate file names and uses document titles instead for navigation.

2. Customise summary lines of exported events in ox-icalendar

I personally export deadlines and scheduled items to the separate files so I 
don't need these cookies and they consume precious space of summary line. So I 
prefer them be disabled. This should be possible to do now with only 
customisation setting.

3. Force creation of an alarm when exporting event in ox-icalendar

Sometimes I prefer to create icalendar alarms exactly at the event start, but 
it's not possible since alarm set to zero means that alarm will be disabled. 
Forcing alarm creation will now create alarm no matter the setting.

I've updated news files and attempted to replicate the style of submissions, 
but I admit that I didn't read much beyond CONTRIBUTE file. Please point me to 
the right direction in case of any issues I can fix.

Kind regards,
Mikhail Skorzhinskii

>From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:52:39 +0200
Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms

This is a new setting for icalendar exports to allow users set alarms
exactly at the event start. With this setting set to non-nil and alarm
set to zero (by global setting or APPT_WARNTIME property) it will create
an alarm at the event start.

Note, that zero alarm set as APPT_WARNTIME property will override
default warning time.
---
 etc/ORG-NEWS | 10 ++
 lisp/ox-icalendar.el | 24 +---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b912e807d..eb950d934 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -23,6 +23,16 @@ path.
 Through these new options for icalendar export, one can customise the
 looks of summary lines in exported events.
 
+*** New option ~org-icalendar-force-alarm~
+
+This is a new setting for icalendar exports to allow users set alarms
+exactly at the event start. With this setting set to non-nil and alarm
+set to zero (by global setting or APPT_WARNTIME property) it will
+create an alarm at the event start.
+
+Note, that zero alarm set as =APPT_WARNTIME= property will override
+default warning time.
+
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index f110a4b2b..baed925e8 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm. With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'bool)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -797,8 +806,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
   (let ((alarm-time
 	 (let ((warntime
 		(org-element-property :APPT_WARNTIME entry)))
-	   (if warntime (string-to-number warntime) 0
-(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+	   (if warntime (string-to-number warntime) nil
+(and (or (and alarm-time
+		  (> alarm-time 0))
+	 (> org-icalendar-alarm-time 0)
+	 org-icalendar-force-alarm)
 	 (org-element-property :hour-start timestamp)
 	 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -806,7 +818,13 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 		 summary
-		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
+		 (if org-icalendar-force-alarm
+		 (if alarm-time
+			 alarm-time
+		   org-icalendar-alarm-time)
+		   (if (zerop alarm-time)
+		   org-icalendar-alarm-time
+		 alarm-time))
 
 
  Template
-- 
2.28.0

>From 1c30be14e2e7a6774d499388ec207b1950963746 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 2/3] ox-icalendar.el: allow to customise deadline and
 scheduled items summary

In some of export schemes these cookies at the start of each event can
be a distraction rather then storage of useful information.
---
 etc/ORG-NEWS |  5 +
 lisp/ox-icalendar.el | 10 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 32f64d84e..b912e807d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -18,6 +18,11 @@ When set to 'titl

Re: Capture with (moving) attachment?

2020-07-28 Thread Mikhail Skorzhinskii
Hi Tim,

I tried to solve the similar problem and come up with the solution with 
external script to do this. This is basically only tested in Linux with KDEv5 
environment, but could be extended to any other DE or to work solely in emacs.

Anyway, the idea of the solution is to provide an interface to the graphical 
file manager, so you can select files and just "send them" to org-mode. For 
this I wrote elisp function that do the attaching on files you provided, then a 
script that pass arguments to this function via emacslcient and then a module 
for file manager for menu to appear.

1. Elsip function for the attaching:

(defun org-user/move-to-file-storage (files)
  "Move FILES at my file system to annex/org file storage."
(save-excursion
  (let ((org-capture-templates org-file-capture-templates)) ;; << don't use 
org-file-capture-template if you don't want separate capture templates variable 
for this
(org-capture))
  ;; Create as many new headings as it need to be created
  (when (> (length files) 1)
(save-excursion
  (org-clone-subtree-with-time-shift (- (length files) 1) '(4
  ;; Edit these headings and attach files to them
  (dolist (file files)
(when (file-exists-p file)
  ;; Just some sane name should be enough
  (org-edit-headline (concat "File: " (file-name-nondirectory file)))
  ;; Attach file to the storage room
  (org-attach-attach file nil 'mv)
  ;; Edit headline once again with the stored file
  (let* ((attach-dir (org-attach-dir))
 (files (org-attach-file-list attach-dir))
 (file (pop files)))
(org-edit-headline
 (format "[[attachment:%s][%s]]" file (org-get-heading t t t t
  ;; Go to the next free heading
  (org-next-visible-heading 1)))
  ;; Make sure that we didn't cancel capture with file that was already 
moved
  (org-capture-finalize)
  ;; Go to the file if we want to say something about it
  (org-capture-goto-last-stored)
  ;; Save buffer just in case
  (save-buffer)))

Function implementation is very far from ideal, but it is working to some 
extent. There is a bug with this function: it inserts one empty headline. 
Should be easy to fix, sorry about that.

2. Define your capture templates

Just like the normal capture templates.

(setq org-file-capture-templates ... )

Now calling this function externally will attach files you provided, save org 
buffers immediately after and leave the frame open on last attached item. Every 
attached file will have separate heading. And every heading will be a link to 
the attached file.

3. Store this script somewhere in your $PATH

#!/bin/bash

# Author: Mikhail Skorzhinskii 
#
# Description: Attach file to the org-mode file storage

files=

for file in "$@"; do
files="${files} \"${file}\""
done;

emacsclient -a "" -c -F '((name . "doom-capture"))' \
-e "(org-user/move-to-file-storage (list ${files}))"

If you save it as "org-attach-files.sh" then you can call it like 

  org-attach-files.sh file1 file2 file3

But make sure to pass absolute paths, as emacs executable will probably 
operating in different directory. I personally don't care as file manager 
always call it with full paths. But easy to fix with readlink -e call. (i.e. 
file=`readlink -e ${file}` before putting it to ${files}.

4. Place this module to .local/share/kservices5/ServiceMenus/emacs.desktop

End name can be anything of course.

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
Actions=org-attach-mv;
X-KDE-Priority=TopLevel

[Desktop Action org-attach-mv]
Name=Send to git-annex
Exec=emacs-org-attach-file %U
Icon=cloud-download

This should work in KDE files managers (like Dolphin). Right-click the file and 
you will have "Send to git annex" menu item.

Mikhail Skorzhinskii

On Wednesday, July 22, 2020 11:48:24 PM CEST Tim Landscheidt wrote:
> Hi,
> 
> I have a capture template to file items to a list:
> | ("i" "inventory" entry
> | 
> |  (file "~/Desktop/Agenda/Inventar.org")
> |  "* %^{Name}" :immediate-finish t)
> 
> Currently, when I want to file an item with an associated
> image, I open the directory of the images with dired, visit
> the image file, use the capture to add an item, kill the im-
> age buffer, use M-0 w in dired to copy the file's name,
> switch to the org file, use C-c C-a m to attach the image by
> moving the file, and then switch back to the dired buffer.
> Lather, rinse, repeat, until the directory with the images
> is empty.
> 
> What I want to do instead is open the image file (via dir-
> ed), have the capture do the attaching by itself (if it is
> called in an image-mode

Re: Multiply alerts for icalendar export

2020-02-13 Thread Mikhail Skorzhinskii
Fraga, Eric  writes:
> Noting, of course, that you can have multiple time stamps (active ones
> in this case) associated with a single heading.  I do this every so
> often.

Although it would be wonderful thing to have, but it does not affect
exported icalendar file. I was expecting that multiply time stamps will
result into multiply icalendar entries with different times, but instead
I got two entries with bottom time.

I.e. this:

#+begin_example
,* some entry
SCHEDULED: <2020-02-13 Thu 07:30>
SCHEDULED: <2020-02-13 Thu 07:20>
#+end_example

Will result into two icalendar entries:

1. some entry with time 07:20
2. some entry with time 07:20

Bastien  writes:
> Perhaps adding three different appointments to get three alerts is
> good enough?
>
> 2 cents of course...

Yes, I resolved this by having sub-headings with the reminders. This way
I liked it even more then just casually having multiply reminders.

1. I can name each reminder individually. This way it takes no effort to
undetrstand what this alarm is about.

2. Every heading can carry individual notes. And since these reminders
are time dependent, notes that are really relevant right now are more
accessible.

This is especially valuable when you're in hurry and don't have much
time to go through your notes. Just tap to the calendar entry and carry
on.

3. Since calendars are stored locally, you don't need internet to have
all this information and to recieve these reminders. (This is complain
about some city commuting applications and the way how push
notifications work).

4. For events that are often recurring this function is very helpful:
~(org-clone-subtree-with-time-shift)~ (aka ~C-c C-x c~). It fixes times
not only on top-most heading but in all sub-headings as well.

And unlike recurring timestamps, this way every event can have some
slight differences for this specific day: changes in time table,
location or even complete cancelation.

Here is an example for the reference. I'm trying to show most of the
possibilties of this approach.

#+begin_example
,* Flight to Wonderland :transport:
SCHEDULED: <2020-02-13 Thu 10:00-12:30>

Terminal 2

Bookin code: AABBCC

,** Train to airport

,*** Route S9
SCHEDULED: <2020-02-13 Thu 06:50>
,*** Route S9
SCHEDULED: <2020-02-13 Thu 07:10>

,** Bus to train station

,*** Bus 512 [bus stop: Fluffy road]
SCHEDULED: <2020-02-13 Thu 06:30>

,*** Bus 1024 [bus stop: Cozy park]
SCHEDULED: <2020-02-13 Thu 06:45>

,** Taxi from airport
SCHEDULED: <2020-02-13 Thu 12:30-13:30>
;; :LOCATION: will be exported as a special field and you can later click and 
choose which app to use: maps \ taxi app \ public transport app \ etc
:PROPERTIES:
:LOCATION: Кримс, Замок Красной Королевы, 12, кв. 7
:END:

Should be around 20€ \ 1400₽

Crims, Fortress of the Red Queen, 12, apt. 7

,** Lecture
SCHEDULED: <2020-02-13 Thu 14:00-17:00>
;; Phone numbers usually can be also clicked in most apps. Helpful if you don't 
want to pollute your phone book
Prof. Fortran 

Room 404
#+end_example



Re: Set heading text from elisp?

2019-11-13 Thread Mikhail Skorzhinskii


I am not sure if this is exactly what you're asking, but for programatic heading edits I am using this snippet:



(let ((headline-only-text (org-get-heading t t t t)))
  (org-edit-headline (concat "Web-page: " headline-only-text)))



Probably the better way is to use org element API, but for small, rarely executed personal helpers I think this is OK.

I'm Wondering If There's Builtin Support For Editing Components Of The Heading? I'm Trying To Set The Text Component (I.E. `(Nth 4 (Org-Heading-Components))`) Without Altering Anything Else And While I Can Obviously Achieve This With Generic Elisp I Wanted To Be Sure I Had To.I'm wondering if there's builtin support for editing components of the heading? I'm trying to set the text component (i.e. `(nth 4 (org-heading-components))`) without altering anything else and while I can obviously achieve this with generic elisp I wanted to be sure I had to.The cleanest elisp I came up with was:```(save-excursion  (org-back-to-heading t)  (let (case-fold-search)    (looking-at org-complex-heading-regexp)    (replace-match text t t nil 4)    (org-align-tags)))```--In Christ,Timmy V.https://blog.twonegatives.comhttps://five.sentenc.es

Re: Exporting agendas as org-mode files?

2019-11-13 Thread Mikhail Skorzhinskii
Adam Porter  writes:

 > org-ql would make this pretty easy, I think.  Use an org-ql query to
 > select entries, and for the :action function, use a simple function that
 > copies the entry or subtree and yanks it into a buffer.  Then save that
 > buffer to a file.

Yes, it is.

Although just picking some entries from huge org-mode base and write
them into separate file is a base feature of org-mode itself. org-ql
package just making the process of finding entries of interest much
easier and faster.

John Sturdy  writes:

  > I'd like to be able to export agendas as org-mode files

If you're looking into the pure org-mode approach, then what you're
looking for ~org-agenda-write~ function or custom agenda view written
with exporting in mind. In order to export to org all you need to do is
to specify .org extension.

  https://orgmode.org/manual/Exporting-agenda-views.html

I was using this small snippet to export some of my agenda seacrhes:

#+begin_src emacs-lisp
  (org-agenda nil "a")
  (org-agenda-write "~/example.org" nil t "*Org Agenda*")
#+end_src

Be aware that this will regenerate your *Org Agenda* buffer, so either
use sticky agendas or export agendas in separate emacs process.


But I would highly recommend using org-ql for these purpouses. Besides
pretty solid and easy-to-use interface it is noticably faster.

Here is the snippet I am currently using to export all subtress directly
tagged with :info: to the separate file. (Sorry for the lack of proper
parametrisation).

#+begin_src emacs-lisp
(defun org-user/store-info ()
  (let ((file "~/org/cals/info.org")
(heading (org-format-outline-path (org-get-outline-path t
(save-excursion
  (org-copy-subtree)
  (find-file file)
  (end-of-buffer)
  (org-paste-subtree)
  (org-edit-headline heading

(defun org-user/export-info ()
  "Export all information entries into one file."
  (find-file "~/org/cals/info.org")
  (erase-buffer)
  (insert "#+TITLE: Information")
  (org-ql-select
(org-agenda-files)
'(tags-local "info")
:action #'org-user/store-info)
  (save-buffer))
#+end_src

You need to invoke (org-user/export-info), obviosuly.



Re: [O] ANN: org-ql agenda block support

2019-09-12 Thread Mikhail Skorzhinskii
Great overview, thanks a lot.

So I give it a try and completely fell in love. On my data set it is
visibly faster then org-agenda. I also wrote a lot of code around
org-agenda over the years to support my sometimes awkward needs. And now
I just threw all this ugly code away!

That was very emotional moment for me, very good job, kind sir.

Adam Porter  writes:

 > Mikhail Skorzhinskii  writes:
 >
 > > Adam Porter  writes:
 > >  > However, the org-ql-block version runs in about 1/5th the time (0.7
 > >  > seconds compared to 3.45 seconds on my collection of org-agenda-files).
 > >
 > > For some reason I thought that on average org-ql package is working
 > > slower then native org-agenda searches. Probably because there are more
 > > control and interface is much more simpler and cleaner and nothing
 > > comes free of charge. That sort of thing. :-)
 >
 > Well, it might also be because it used to be generally slower, and I
 > tried to be clear about that whenever I mentioned it.  :)  But I've
 > applied a lot of optimizations to it over the past few months, so it's
 > generally pretty fast now, sometimes much faster.  It's hard to make a
 > direct comparison in some cases, depending on the complexity of the
 > query.  I plan to continue optimizing it as I'm able, so hopefully it
 > will continue improving.
 >
 > > I am really glad that I was mistaken. Care to drop a few thoughts on why
 > > this is the case? This is applicable only for ql-block or other org-ql
 > > functions are a bit faster too?
 >
 > Well, it's a completely different implementation.  It has two main
 > features which attempt to make it fast: it uses regexp searches across
 > buffers as much as possible, similar to org-agenda.el but in a more
 > flexible way (though there's still room for improvement here, especially
 > with complex queries); and it caches results keyed on the query, buffer,
 > and narrowing (cached results are discarded when a buffer is modified),
 > which avoids re-running the same queries for unmodified buffers.  Oh,
 > and it also byte-compiles query predicates and action functions to eke
 > out a bit more speed.
 >
 > And in general, I run benchmarks and try to improve performance when
 > possible; you can see some of the benchmark results in the notes.org
 > file in the repo (not all of which are up-to-date with current org-ql
 > code).
 >
 > org-ql-block is just a way to make use of the results returned by org-ql
 > queries; other ways include org-ql-agenda, org-ql-search, and of course
 > you can use the raw results however you like, including calling whatever
 > :action function you like at matching entries, to return whatever kind
 > of data you need, or even perform actions directly on entries.
 >
 > In other words, the querying code is separate from the display-related
 > code, so all org-ql-block, org-ql-agenda, org-ql-search, etc. do is
 > format results from org-ql queries and display them.
 >
 > Upcoming features include an org-ql-sparse-tree command, like
 > org-sparse-tree but using org-ql queries; recursive queries; and
 > probably a timeline view like I recently posted about.
 >
 > Please let me know if you have any feedback!



[O] Multiply alerts for icalendar export

2019-09-09 Thread Mikhail Skorzhinskii
Hi,

I am user of ox-icalendar package and I have a question about generating
reminders in icalendar files. Documentation says that proper way to
configure reminders is using org-icalendar-alarm-time variable and
setting APPT_WARNTIME property in cases when pre-entry customization
required.

I am happy with current functionality but in rare cases I'd like to have
more reminders per entry. Like many other PIMs allows this
today. E.g. I'd like to have at least 3 reminders for my flight
appointments. So to be extra sure and do not to miss my plain :-)

My reading of ox-icalendar code clearly indicates that there no easy way
to achieve that. It looks like ox-icalendar always generate only one
reminder or no reminders at all.

But I am not an expert of org-mode export engine and possibly there are
ways to do this? May be somehow extending this export engine?

Also may be there any thrid-party org to icalenadar export engines that
are a bit more flexible and configurable on that matter?

Mikhail Skorzhinskii



Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Mikhail Skorzhinskii
Adam Porter  writes:
 > However, the org-ql-block version runs in about 1/5th the time (0.7
 > seconds compared to 3.45 seconds on my collection of org-agenda-files).

For some reason I thought that on average org-ql package is working
slower then native org-agenda searches. Probably because there are more
control and interface is much more simpler and cleaner and nothing
comes free of charge. That sort of thing. :-)

I am really glad that I was mistaken. Care to drop a few thoughts on why
this is the case? This is applicable only for ql-block or other org-ql
functions are a bit faster too?

Mikhail Skorzhinskii



Re: [O] orgmode for many continuous tasks?

2017-09-25 Thread Mikhail Skorzhinskii
Oh sorry accidently sent a draft :(

Short story:

1. Try org-clock-budget;
2. Try to use ESTIMATE property and agenda span with more then a day;
3. Try to use clock table mode, which will summarize time in agenda;

The (3) have many caveates, actually, so I prefer doing this
calculations by myself and inserting them in agenda-finallize hook.  I
can share my code snippets if you want.

Mikhail

On 2017-09-25T23:28:45+0300, Mikhail Skorzhinskii wrote:

>Hi, Mycroft,
>
>I've tried to find/hack something similar to what you're describing.
>
>1) Clock budgets:
>
>  https://github.com/Fuco1/org-clock-budget
>
>The tool mostly about comparison your clocked time and clocking
>budget. But may be you find it usefull. I'm personally use this tool
>when I'm planning my week.
>
>2)
>
>Also for planning work for the future week, I'm using ESTIMATE property
>with a bit custom lisp. I.e. my setup is looking like this:
>
>1. Super-agenda with different ca
>
>On 2017-09-25T10:21:51+0300, Mycroft Jones wrote:
>>I'm wondering if org-mode can do this:
>>
>>I have many tasks.  Some are one off.  But many are tasks that will take a
>>period of time, days, weeks, months.  I need to schedule a bit of time every
>>day.  Over time I can complete the tasks by plugging away.  But I have so 
>>many.
>>Half hour chunks work for some tasks, 1 or 2 or 3 hour chunks work best for
>>others.
>>
>>1) writing 3 different books
>>2) learning 2 different languages
>>3) 2 different types of exercise exercise
>>4) 3 different ongoing tasks at work
>>5) watching videos that friends send me
>>6) reading books on my night stand
>>7) various one-off tasks
>>8) scheduled items, where I have to do them at a scheduled time.
>>
>>So, for each broad category of task, there are subtasks.  So far, it looks 
>>like
>>orgmode is good.  But, what I'd like is to automatically generate scheduling
>>suggestions for the day.  For instance, if I've been putting too much time 
>>into
>>languages, then schedule more time for writing the books.  And if I've focused
>>too much on one book, remind me to put time into another book.  I'd like the
>>scheduler to be a sort of time-accounting system that suggests work for the 
>>day
>>in a way that balances the tree.
>>
>>Within each branch of the tree, I'd like the branches to be allocated roughly
>>equal time, over a period of weeks and months, on a day to day basis.
>>
>>Is there a simple workflow in orgmode that can do this?  I haven't done elisp
>>for 10 years, but I'm comfortable with it.  Would this be simple to implement?
>>
>>Mycroft
>>
>
>
>--
>Thanks,
>Skorzhinskii Mikhail
>


--
Thanks,
Skorzhinskii Mikhail



Re: [O] orgmode for many continuous tasks?

2017-09-25 Thread Mikhail Skorzhinskii
Hi, Mycroft,

I've tried to find/hack something similar to what you're describing.

1) Clock budgets:

  https://github.com/Fuco1/org-clock-budget

The tool mostly about comparison your clocked time and clocking
budget. But may be you find it usefull. I'm personally use this tool
when I'm planning my week.

2) 

Also for planning work for the future week, I'm using ESTIMATE property
with a bit custom lisp. I.e. my setup is looking like this:

1. Super-agenda with different ca

On 2017-09-25T10:21:51+0300, Mycroft Jones wrote:
>I'm wondering if org-mode can do this:
>
>I have many tasks.  Some are one off.  But many are tasks that will take a
>period of time, days, weeks, months.  I need to schedule a bit of time every
>day.  Over time I can complete the tasks by plugging away.  But I have so many.
>Half hour chunks work for some tasks, 1 or 2 or 3 hour chunks work best for
>others.
>
>1) writing 3 different books
>2) learning 2 different languages
>3) 2 different types of exercise exercise
>4) 3 different ongoing tasks at work
>5) watching videos that friends send me
>6) reading books on my night stand
>7) various one-off tasks
>8) scheduled items, where I have to do them at a scheduled time.
>
>So, for each broad category of task, there are subtasks.  So far, it looks like
>orgmode is good.  But, what I'd like is to automatically generate scheduling
>suggestions for the day.  For instance, if I've been putting too much time into
>languages, then schedule more time for writing the books.  And if I've focused
>too much on one book, remind me to put time into another book.  I'd like the
>scheduler to be a sort of time-accounting system that suggests work for the day
>in a way that balances the tree.
>
>Within each branch of the tree, I'd like the branches to be allocated roughly
>equal time, over a period of weeks and months, on a day to day basis.
>
>Is there a simple workflow in orgmode that can do this?  I haven't done elisp
>for 10 years, but I'm comfortable with it.  Would this be simple to implement?
>
>Mycroft
>


--
Thanks,
Skorzhinskii Mikhail