Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar

2022-01-03 Thread Ian Garmaise
Hi Detlef, this is mentioned in the docs but IMHO isn't strongly emphasized
enough:

When installing or upgrading org-mode always run emacs -q to avoid loading
init.  I had a lot of trouble when switching to elpa and this was the only
way to get it to work.  In the end to be sure I deleted the old org-mode
library from the disk  (using list-packages) and made doubly sure that
there were no remnants.  Then restart with emacs -q and install from
list-packages from elpa.

If you don't do this you run a strong risk of getting a mixed install.


> --
>
> Message: 9
> Date: Mon, 3 Jan 2022 08:41:41 +0100
> From: Detlef Steuer 
> To: emacs-orgmode@gnu.org
> Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar
> Message-ID: <20220103084141.72d2f...@hsu-hh.de>
> Content-Type: text/plain; charset="us-ascii"
>
> Thank you for the hints.
>
> Attached a diff -u version.
>
> The patch in principle is unrelated to nextcloud. That's just my
> use case. The addiditional TTL setting gives a hint to clients
> when to reload an imported ics file that was exported from org.
>
> Is there any document how to setup an org-mode developer environment?
> Normally I use git, but I even struggled to use org from elpa instead
> of the built-in version, so I avoided touching this house of cards :-)
>
> Probably I should use a git clone instead of elpa, if I want to work
> on org?
>
> Thx for the feedback!
> Detlef
>
>
> --
=
Ian Garmaise
Consultant
Phorix Solutions Group
ia...@phorixsol.com
Toronto cell: 416.432.2251 (also on Whatsapp)

https://www.linkedin.com/in/igarmaise/

http://www.PhorixSol.com


Re: Raw Org AST snippets for "impossible" markup

2022-01-03 Thread Max Nikulin

On 10/12/2021 05:27, Juan Manuel Macías wrote:

Juan Manuel Macías writes:


Jumping into the "real world", how about these two examples of nested emphasis?


By the way, what do you think about allowing the use of some kind of
aliases, so that the aspect is less verbose?


I have no particular opinion concerning aliases, but certainly they 
should not work through string search and replace when parsed tree is 
available.



   (defun orgia--transform-path (path)
 (with-temp-buffer
   (insert path)
   (mapc (lambda (el)
  (orgia-replace (concat "(" (car el) "::") (concat "(" (cadr el) " () 
")))


By the way, is there any problem with `replace-regexp-in-string'?

See the attached file for definitions of some helper functions. Final setup:

#+begin_src elisp :results silent
  (setq orgia-demo-alias-alist
'((b . bold)
  (i . italic)
  (s . strike-through)
  (_ . underline)))

  (defun orgia-demo-alias-post-filter (node  _children)
(when (listp node)
  (let ((sym (and (symbolp (car node))
  (assq (car node) orgia-demo-alias-alist
(when sym
  (setcar node (cdr sym)
node)

  (defun orgia-demo-alias (tree)
(orgia-transform-tree-deep tree nil #'orgia-demo-alias-post-filter))
#+end_src

#+begin_src elisp :results silent
  (require 'ox)
  (add-to-list 'org-export-filter-parse-tree-functions 
#'orgia-parse-tree-filter)

  (org-link-set-parameters "orgia")

  (require 'ob-org)
  (add-to-list 'orgia-transform-functions #'orgia-demo-alias)
#+end_src

And a bit modified your test sample:

#+begin_src org :results latex :results replace
  [[orgia:(i nil "The English versions of the " (b nil (i () "Iliad")) 
" and the " (b () (i ()

  "Odyssey")))]]
#+end_src

#+RESULTS:
#+begin_export latex
\emph{The English versions of the \textbf{\emph{Iliad}} and the 
\textbf{\emph{Odyssey}}}

#+end_export
(defvar orgia-transform-functions nil)

(defun orgia-default-pre-filter (node)
  "Returns (node . children)"
  (if (listp node)
  (cons node node)
(cons node nil)))

(defun orgia-transform-tree-deep (tree  pre-filter post-filter)
  "Deep-first walk."
  ;; Queue items: ((node-cell . children) . next-list)
  (let* ((pre-filter (or pre-filter #'orgia-default-pre-filter))
	 (top (list tree))
	 (queue (list (cons (cons top top) top
(while queue
  (let* ((item (pop queue))
	 (next-list (cdr item)))
	(if (not next-list)
	;; post; skip POST-FILTER for the list wrapping TREE
	(when (and queue post-filter)
	  (let* ((node-cell-children (car item))
		 (children (cdr node-cell-children)))
		(setcar (car node-cell-children)
			(funcall post-filter
 (caar node-cell-children)
 children
	  ;; pre
	  (setcdr item (cdr next-list))
	  (push item queue)
	  (let* ((node-children
		  (funcall pre-filter (car next-list)))
		 (node (car node-children))
		 (children (cdr node-children)))
		(setcar next-list node)
		(push (cons (cons next-list children) children) queue)
(car top)))

(defun orgia-element-replace (current new destructive?)
  (if (eq current new)
  current
(let* ((lst? (and (listp new) (not (symbolp (car new)
	   (new-lst (if lst?
			(if destructive? (nconc new) (reverse new))
		  (list new
  (dolist (element new-lst)
	(org-element-insert-before element current)))
(org-element-extract-element current)
new))

(defun orgia--transform-link (data)
  (if (not (string-equal "orgia" (org-element-property :type data)))
  data
(let* ((path (org-element-property :path data)))
  (if (not (eq ?\( (aref path 0)))
	  (or path (org-element-contents data))
	(let ((tree (read path)))
	  (dolist (f orgia-transform-functions tree)
	(setq tree (funcall f tree

(defun orgia-parse-tree-filter (data _backend info)
  (org-element-map data 'link
(lambda (data)
  (orgia-element-replace data (orgia--transform-link data) t))
info nil nil t)
  data)


Re: [patch] improved: add TTL as defcustom to ox-icalendar

2022-01-03 Thread Detlef Steuer
Am Mon, 3 Jan 2022 18:23:43 +0700
schrieb Max Nikulin :

> On 03/01/2022 14:41, Detlef Steuer wrote:
> > 
> > The patch in principle is unrelated to nextcloud. That's just my
> > use case. The addiditional TTL setting gives a hint to clients
> > when to reload an imported ics file that was exported from org.  
> 
> I think, it is better to wait for comments from an ox-icalendar user.

Sure.

> I am afraid, you will be tired trying to convince me that TTL should
> be overridden for all users (not to say that I am not a maintainer).

No, that wasn't my intention. Just tried to explain.

> I assume that some of them might have reasonable default in their
> server configuration.
> 
> > Is there any document how to setup an org-mode developer
> > environment? Normally I use git, but I even struggled to use org
> > from elpa instead of the built-in version, so I avoided touching
> > this house of cards :-)  
> 
> - info "(org) Installation"
> https://orgmode.org/manual/Installation.html
> - info "(org) Feedback" https://orgmode.org/manual/Feedback.html
> 
> After "make autoloads" I usually run
>  emacs -Q -L ~/src/org-mode/lisp test.org
> 
> In addition, I have a LXC container to run tests (and check for
> compile warnings) in an isolated environment.
> 
> > Probably I should use a git clone instead of elpa, if I want to work
> > on org?  
> 
> Maintainers prefer patches generated using "git format-patch".
>

Ok, thx for the hints.

> >> https://orgmode.org/worg/org-contribute.html for some hints
> >> addressed to contributors.  
> 
> I am not completely sure, but you patch may exceed "TINYCHANGE"
> limit, so signing FSF copyright papers may be a prerequisite to
> accept your patch.
>

Hmm, probably a good idea anyway.

Regards
Detlef


> 
> 




Re: [patch] improved: add TTL as defcustom to ox-icalendar

2022-01-03 Thread Max Nikulin

On 03/01/2022 14:41, Detlef Steuer wrote:


The patch in principle is unrelated to nextcloud. That's just my
use case. The addiditional TTL setting gives a hint to clients
when to reload an imported ics file that was exported from org.


I think, it is better to wait for comments from an ox-icalendar user. I 
am afraid, you will be tired trying to convince me that TTL should be 
overridden for all users (not to say that I am not a maintainer). I 
assume that some of them might have reasonable default in their server 
configuration.



Is there any document how to setup an org-mode developer environment?
Normally I use git, but I even struggled to use org from elpa instead
of the built-in version, so I avoided touching this house of cards :-)


- info "(org) Installation" https://orgmode.org/manual/Installation.html
- info "(org) Feedback" https://orgmode.org/manual/Feedback.html

After "make autoloads" I usually run
emacs -Q -L ~/src/org-mode/lisp test.org

In addition, I have a LXC container to run tests (and check for compile 
warnings) in an isolated environment.



Probably I should use a git clone instead of elpa, if I want to work
on org?


Maintainers prefer patches generated using "git format-patch".


https://orgmode.org/worg/org-contribute.html for some hints addressed
to contributors.


I am not completely sure, but you patch may exceed "TINYCHANGE" limit, 
so signing FSF copyright papers may be a prerequisite to accept your patch.






Re: [PATCH] Re: Escaping org mode date properties

2022-01-03 Thread Eduardo Suarez-Santana
On Mon, Jan 03, 2022 at 11:39:19AM +0800, Ihor Radchenko wrote:
> Eduardo Suarez-Santana  writes:
> 
> > However, how about next cases?
> >
> > * an example block
> > #+begin_example
> > SCHEDULED: <2015-02-16 Mon .+2d>
> > #+end_example
> 
> I am unable to reproduce this using Org 9.5.2
> Can you provide concrete steps starting from bare Emacs how to reproduce
> the inconsistency you are seeing?
> 
> > * an example with colon
> > : SCHEDULED: <2015-02-16 Mon .+2d>
> > I think they behave the same way as 'begin_src'.
> 
> If you mean that adding example/fixed-width environment does not make
> disappear, I am unable to reproduce.
> 
> However, the second case is wrongly recognised as a heading with timestamp.
> 
> Can you try the attached patch? (on top of previous)
> 

I hope this helps:

1. I removed my '~/.emacs.d' directory.

2. I started emacs.

3. I installed org-9.5.2 via 'list-packages' and the user interface.

4. I closed emacs.

5. I moved '~/.emacs' to '~/.emacs.d/init.el'.

6. I edited ~/.emacs.d/init.el' with the following contents.

BEGIN Contents of '~/.emacs.d/init.el'

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(org)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(setq org-agenda-files
  '("~/sample.org"))

END Contents of '~/.emacs.d/init.el'

7. I created '~/sample.org' with the following contents.

BEGIN Contents of '~/sample.org'

* TODO begin_src scheduled entry
#+begin_src org
SCHEDULED: <2022-01-03 Mon>
#+end_src

* TODO colon scheduled entry 
: SCHEDULED: <2022-01-03 Mon>

* TODO begin_example scheduled entry
#+begin_example
SCHEDULED: <2022-01-03 Mon>
#+end_example

END Contents of '~/sample.org'

8. I started emacs.

9. I run 'M-x org-agenda' and then 'a' (agenda week view), and got next result
in the agenda buffer:

BEGIN Contents of '*Org Agenda*'

Week-agenda (W01):
Monday  3 January 2022 W01
  sample: TODO begin_src scheduled entry
  sample: TODO colon scheduled entry
  sample: TODO begin_example scheduled entry
Tuesday 4 January 2022
Wednesday   5 January 2022
Thursday6 January 2022
Friday  7 January 2022
Saturday8 January 2022
Sunday  9 January 2022

END Contents of '*Org Agenda*'

10. I closed emacs, applied *first patch* in this thread to
'~/.emacs.d/elpa/org-9.5.2/org.el'.

11. I removed '~/.emacs.d/elpa/org-9.5.2/org.elc'.

12. I started emacs and run 'M-x org-agenda' and then 'a' (agenda week view),
and got next result:

BEGIN Contents of '*Org Agenda*'

Week-agenda (W01):
Monday  3 January 2022 W01
  sample: TODO colon scheduled entry
  sample: TODO begin_example scheduled entry
Tuesday 4 January 2022
Wednesday   5 January 2022
Thursday6 January 2022
Friday  7 January 2022
Saturday8 January 2022
Sunday  9 January 2022

END Contents of '*Org Agenda*'

13. I closed emacs, applied *second patch* in this thread to
'~/.emacs.d/elpa/org-9.5.2/org-agenda.el'.

14. I removed '~/.emacs.d/elpa/org-9.5.2/org-agenda.elc'.

15. I started emacs and run 'M-x org-agenda' and then 'a' (agenda week view),
and got next result:

BEGIN Contents of '*Org Agenda*'

Week-agenda (W01):
Monday  3 January 2022 W01
Tuesday 4 January 2022
Wednesday   5 January 2022
Thursday6 January 2022
Friday  7 January 2022
Saturday8 January 2022
Sunday  9 January 2022

END Contents of '*Org Agenda*'

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30)
 of 2021-10-20
Package: Org mode version 9.5.2 (9.5.2-gfbff08 @ 
/home/eduardo/.emacs.d/elpa/org-9.5.2/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '(org-display-inline-images)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-agenda-files '("~/sample.org")
 org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-show-all append local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all 
append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook