Re: text after sub headings?

2021-12-25 Thread Ihor Radchenko
Max Nikulin  writes:

> * Topic 2
>some general notes
> *** Note 2.1...
> *** Note 2.2...
>[[#note_from_other_topic1]]
>contains some interesting details

This reminds me of org-transclusion.

Best,
Ihor



bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-25 Thread Berry, Charles
Rudy,

Thanks for the comment, but ...

> On Dec 25, 2021, at 1:37 PM, Rudolf Adamkovič  wrote:
> 
> I think we look at the problem from two different perspectives.  You
> look at the problem from the "how" perspective, whereas I look at it
> from the "why" perspective.  Sure, we can work around everything in Org.
> Now, does that mean that Org should try to execute BibTeX blocks when
> executing a buffer?  I do not think so.

Using standard features (properties, header-args) in a standard way does not 
strike me as a `work around'.

You have not made a clear case that src blocks are even needed to support your 
use case. It may well be that export blocks (which never execute) would work 
just as well.  But with no ECM, one can only guess.

I'm still inclined to call this a feature request, not a bug. And decisions 
about adding complexity to an already complicated code base should take that 
point of view, IMO.

Best,

Chuck

bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-25 Thread General discussions about Org-mode.
Ihor Radchenko  writes:

> And we do not have to force the users adding trivial things like
> bibtex. Bibtex may be one of the defaults.

I see. In effect, Org would not try to "execute BibTeX" when executing a
buffer. That makes sense!

Rudy
-- 
"I love deadlines. I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-25 Thread General discussions about Org-mode.
"Berry, Charles"  writes:

> The problem cited here *only* exists for execution using
> org-babel-execute-buffer or similar functions.
>
> For that case, setting buffer or heading properties, such as […]
> resolves the issue.
>
> So the user needs to add just one-line per language to set this up.

I think we look at the problem from two different perspectives.  You
look at the problem from the "how" perspective, whereas I look at it
from the "why" perspective.  Sure, we can work around everything in Org.
Now, does that mean that Org should try to execute BibTeX blocks when
executing a buffer?  I do not think so.

Rudy

-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't. That's logic.'"
-- Lewis Carroll, Through the Looking Glass

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





bug#52778: 29.0.50; refill-mode issues in org-mode

2021-12-25 Thread General discussions about Org-mode.
Ihor Radchenko  writes:

> Could you kindly use M-x org-submit-bug-report to prepare your
> future bug reports related to Org mode?

Oh, I apologize.  I did not know that Org has its own command to report
bugs.  In the future, I will use M-x org-submit-bug-report.

Rudy
-- 
"I love deadlines. I love the whooshing noise they make as they go by." -- 
Douglas Adams, The Salmon of Doubt

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





Re: [BUG] org-element-cache bug: org-persist-read persists seemingly forever

2021-12-25 Thread Ihor Radchenko
Samuel Wales  writes:

> 20051 135025 938122 other--a.org
>
> this is a smallish to middling file for me.  my largest is 4x larger.
> i haven't gotten new org to work yet so i haven't revisited this yet.

This is odd. It only takes 2 sec to write caches for my largest 15Mb
file. Though I have SSD.

I just pushed a change to org-persist. Now, Org will show a message with
some info about read/write duration when the duration is >0.5 sec. If
you see messages from org-persist can you report them?

Best,
Ihor



[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: text after sub headings?

2021-12-25 Thread Max Nikulin

On 25/12/2021 03:17, Juan Manuel Macías wrote:

Max Nikulin writes:


It may have larger margins, smaller font, distinct font face,
another background color, box around or just rule at some side, so
readers have clear notion where it ends and main material continues.


This is complex layout, something that DTP programs (InDesign, Quark,
Scribus) do very well as they work on the concept of multiple threads of
connected text boxes.


It is not necessary complex layout. It is a decoration similar to 
pictures in fiction books. Unlike figures such additions are not 
strictly important to understand material. In printed form it is like 
figures however. Insets are appropriate in particular places, but 
tolerate some shift due to paging.


This particular examples has internal structure:
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf#page=135

Book reader on small phone screen might require a tap to show all 
additional material. On wide screen in may appear on margins and visible 
by default. In Org it migh remain collapsed when heading is expanded 
while text around is visible.


I have not worked with complex documents in DTP programs. In my opinion, 
LaTeX deals much better with figures (plots, drawings) in scientific 
papers than office software. When users complains that LaTeX puts at 
their figures and table at the end of the document it usually means that 
they copy-pasted markup explicitly forbidding most of usual places for 
floats (e.g. page completely filled with figures).


It is possible to create insets in Org Mode document, but it is not 
native support.


In a bit broader sense insets do not violates tree structure

- Branch: Section Heading
  - Leaf: section text
  - Branch: Inset section Heading
- Leaf: inset section text
- Branch: Inset Subsection Heading 1
  - Leaf: Inset subsection 1 text
- Branch: Inset Subsection Heading 2
  - Leaf: Inset subsection 2 text
  - Leaf: section text continues

Another example when it is convenient to have text itermixed with 
headings is notes. Tree structure is too rigid, particular note may be 
appropriate to several topics. Important point that sometimes it is 
better to have particular order within some topic, if ordering is not 
required than all links may appear before subheadings. So not text is 
put to one topic, other ones contains links. Ideally it should appear like


* Topic 2
  some general notes
*** Note 2.1...
*** Note 2.2...
  [[#note_from_other_topic1]]
  contains some interesting details
*** Note 2.4...
  [[#note_from_other_topic2]]
  contains other interesting details
*** Note 2.6...

It would be nice to have links visually distinct from headings and there 
is no real reason to collapse link if description text is just a couple 
of line.


I do not ask to change anything. I admit that nobody has bright idea how 
to properly implement it. I am just against statements that Org is ideal 
in respect to sectioning and covers all use cases. My opinion that it is 
limitation, there are some workarounds and trade-offs for each 
particular case. Anyway there is no unambiguously better tool.