Re: Issues with nested begin..end blocks in inline math environments

2019-12-15 Thread Nicolas Goaziou
Hello,

Matt Huszagh  writes:

> I'm submitting this as a patch. I've used it on hundreds of latex
> fragments over the past week or so and haven't experienced any issues
> (which is expected since the change is small).
>
> From a699b699ed4132839c39f1152868bb13364422c7 Mon Sep 17 00:00:00 2001
> From: Matt Huszagh 
> Date: Sat, 14 Dec 2019 19:54:41 -0800
> Subject: [PATCH] org-element.el: allow environment blocks in math delimiters
>
> * lisp/org-element.el (org-element--latex-begin-environment): Add a
> non-capturing block for `\(' or `$' so that previously recognized
> latex environments can also appear within an inline math environment.
>
> * lisp/org-element.el (org-element--latex-end-environment): Match the
> begin environment noncapturing block with `$' or `\)'.

I don't think this patch is a good idea, as it mixes elements from
different types: LaTeX fragment (inline), and LaTeX environment (block).
For example, the regexp you modify is used as a paragraph separator,
which doesn't make sense for inline LaTeX.

As a reminder, Org does not claim to support raw LaTeX syntax besides
very simple constructs. If you want to insert elaborate LaTeX code, you
can always use:

#+begin_export latex
...
#+end_export

Regards,

-- 
Nicolas Goaziou



Re: Removing horizontal space in latex fragments

2019-12-15 Thread Nicolas Goaziou
Hello,

Matt Huszagh  writes:

> My vote goes for keeping the newlines to improve readability in the
> generated tex file. But, again, I'm more than happy to be overuled.

[...]

> I've attached an updated patch.

Applied. Thank you.

I added TINYCHANGE at the end of the commit message since I don't know
if you have signed the FSF papers. If you did, please let me know.

Regards,

-- 
Nicolas Goaziou



Re: [Idea] Org Collections

2019-12-15 Thread tbanelwebmin

  
  
Interesting idea!
  
  Is everyone aware of Emacs Projectile?
  https://github.com/bbatsov/projectile
  
  Not exactly the Org Collections you talks about, Gustav,
  but somehow related.
  
  Projectile manages collections of files that belong
  together. They may be anything (Org Mode, Python, C++, HTML,
LibreOffice, anything). It is most often
  zero-configuration: if a directory contains a .git or .bzr
  sub-directory, it is a Projectile project. A Maven
  project is a Projectile project, and so on. If the
  directory is not of a known type, just adding and empty .projectile
  sub-directory makes it a Projectile project.
  
  Quite handy.
  
  Could your Org Collections idea be a Projectile
  add-on?
  
  As an example, there is such an add-on: org-projectile
  https://github.com/IvanMalison/org-projectilehttps://github.com/IvanMalison/org-projectile
  "org-projectile provides functions for the creation of org-mode
TODOs that are associated with projectile projects."
  
  Regards
  

Le 14/12/2019 à 18:32, Gustav Wikström
  a écrit :


  Hi list and all honored readers!

I have an idea. One that I've mentioned before in side notes. And I want to emphasize that this still only is an idea. But I want to present this idea to you. As a way to gather feedback and get input. Maybe the idea is stupid!? Maybe you think it's already solved? Or maybe it's not, and lots of you resonate with it as well. In any case, please let me know what you think on the piece below!



 ORG MODE: COLLECTIONS/PROJECTS

Gustav Wikström



  




Re: [O] FW: [RFC] Link-type for attachments, more attach options

2019-12-15 Thread stardiviner


Gustav Wikström  writes:

> FYI, pushed to master. Commit 26ace9004
>

After update, I found the new attachment link type can't display inline image
now. Maybe should keep *both* original ~file:~ link type and new ~attachment:~ 
link
type in stored link? WDYT, Gustav?

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



RE: [O] FW: [RFC] Link-type for attachments, more attach options

2019-12-15 Thread Gustav Wikström
Hmm, inline images work for attachment links on my side on Org mode master.

I considered keeping the file link option but ruled against it in the end. I 
could remove some complexity from the code in the end due to it.

Don't know why attachments aren’t expanded as images for you...

/G 

> -Original Message-
> From: stardiviner 
> Sent: den 15 december 2019 10:29
> To: Gustav Wikström 
> Cc: numbch...@gmail.com; emacs-orgmode@gnu.org
> Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
> 
> 
> Gustav Wikström  writes:
> 
> > FYI, pushed to master. Commit 26ace9004
> >
> 
> After update, I found the new attachment link type can't display inline
> image now. Maybe should keep *both* original ~file:~ link type and new
> ~attachment:~ link type in stored link? WDYT, Gustav?
> 
> --
> [ stardiviner ]
>I try to make every word tell the meaning what I want to express.
> 
>Blog: https://stardiviner.github.io/
>IRC(freenode): stardiviner, Matrix: stardiviner
>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
> 


Re: [Idea] Org Collections

2019-12-15 Thread Adam Porter
How does this idea compare with Akira Komamura's org-starter package?

https://github.com/akirak/org-starter

Its readme begins:

> Org-starter is a framework for basic configuration of Emacs Org
> Mode. It allows you to configure Org Mode easily even with many files
> and directories.

> The standard way to configure Org Mode is set a bunch of variables
> such as org-agenda-files and org-refile-targets. This makes it hard to
> add/delete files to/from the configuration. Org-starter lets you
> configure Org Mode in a file-centric and incremental manner, which
> scales well especially if you have many Org files and sometimes have
> to tweak the file list.

> In other words, org-starter allows you to configure Org Mode in a
> manner similar to use-package. The following is an example file
> configuration with org-starter:

>(org-starter-define-file "subjects.org"
>  :agenda t
>  :refile '(:maxlevel . 9))




Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Diego Zamboni
Hi Ihor,

On Thu, Dec 12, 2019 at 4:00 PM Ihor Radchenko  wrote:

> See the relevant code from my config below. Let me know if you have any
> questions or suggestions.
>

Thank you, this was extremely helpful. I am now using a modified version of
your code (see below) with the following comments/questions:

- For me, the tangle works if I only load the org library in the
sub-process, so I disabled the loading of my config. I guess this depends
heavily and what other configuration one has loaded, but I think for
tangling, not much else is needed :)

- In you code, the process-list variable was not actually being modified
since plist-put returns the new value but does not modify the variable. I
tried a few variations wrapping the plist-put in (setq ...), and adding
corresponding code to clear the element after the tangle was finished, but
could not get it to work. As this is not really critical for me, I just
removed the whole process-checking code, significantly simplifying the rest.

- I wanted my code to report the time the tangle took. This works well by
passing the time as the result of the initial lambda. Interestingly, it
works if I return the time already formatted as a string (as in my code)
but not if I return the result of (float-time ..) directly.

Here's my code:

  #+begin_src emacs-lisp
(defun zz/org-babel-tangle-async (file)
  "Invoke `org-babel-tangle-file' asynchronously."
  (message "Tangling %s..." (buffer-file-name))
  (async-start
   (let ((args (list file)))
 `(lambda ()
(require 'org)
;;(load "~/.emacs.d/init.el")
(let ((start-time (current-time)))
  (apply #'org-babel-tangle-file ',args)
  (format "%.2f" (float-time (time-since start-time))
   (let ((message-string (format "Tangling %S completed after " file)))
 `(lambda (tangle-time)
(message (concat ,message-string
 (format "%s seconds" tangle-time)))

(defun zz/org-babel-tangle-current-buffer-async ()
  "Tangle current buffer asynchronously."
  (zz/org-babel-tangle-async (buffer-file-name)))
#+end_src

Thanks again for your help, and for the inspiration to finally get this
done, it had been bugging me for a while :)

--Diego



> Also, my config is written in the way that everything related to user
> interaction can be disabled if I load emacs for tangling
> (with org-tangle-flag). This is to speed up the async process.
>
> #+begin_src emacs-lisp
> (defvar yant/org-babel-tangle-async-process-list nil
>   "Plist of (file . process) for all the currently running async tangle
> processes.")
>
>
> (defun yant/org-babel-tangle-async (file &optional target-file lang)
>   "Invoke `org-babel-tangle-file' asynchronously."
>   (require 'async)
>   (let ((oldproc (plist-get yant/org-babel-tangle-async-process-list
> file)))
> (when (or (not oldproc)
>   (async-wait oldproc))
>   (message "Tangling %s..." (buffer-file-name))
>   (plist-put yant/org-babel-tangle-async-process-list
>  file
>  (async-start
>   (let ((args (list file target-file lang)))
> `(lambda ()
>(require 'org)
>(setq org-tangle-flag t)
>(load "~/.emacs.d/config.el")
>(apply #'org-babel-tangle-file ',args)))
>   (let ((message-string (format "Tangling (%S %S %S)
> completed." file target-file lang)))
> `(lambda (result) (message ,message-string
>
> (defvar yant/auto-tangle-list nil
>   "List of files, which can be safely tangled on save.
> The list is saved between Emacs sessions.")
>
> (when init-flag
>   (use-package savehist
> :config
> (add-to-list 'savehist-additional-variables 'yant/auto-tangle-list))
>   (savehist-mode +1)
>   (defun yant/toggle-buffer-auto-tangle (arg)
> "Toggle auto tangling of a buffer."
> (interactive "P")
> (if (not (eq major-mode 'org-mode))
> (message "Org-mode is not active in buffer \"%s\"" (buffer-name))
>   (cond ((not arg)
>  (if (member (buffer-file-name) yant/auto-tangle-list)
>  (progn (setq yant/auto-tangle-list (delete
> (buffer-file-name) yant/auto-tangle-list))
> (message "Auto tangling disabled for %s"
> (buffer-file-name)))
>(add-to-list 'yant/auto-tangle-list (buffer-file-name))
>(message "Auto tangling enabled for %s"
> (buffer-file-name
> ((or (and (not (listp arg)) (> arg 0))
>  (equal arg '(4)))
>  (add-to-list 'yant/auto-tangle-list (buffer-file-name))
>  (message "Auto tangling enabled for %s" (buffer-file-name)))
> (t
>  (setq yant/auto-tangle-list (delete (buffer-file-name)
> yant/auto-tangle-list))
>  (message "Auto tangling dis

Re: [Idea] Org Collections

2019-12-15 Thread John Sturdy
That seems hierarchical, which is ok (as in org-mode itself) but how about
implementing a more general graph mechanism, which could be used to do this
but more flexibly?

On Sat, 14 Dec 2019, 21:04 Gustav Wikström,  wrote:

> Hi list and all honored readers!
>
> I have an idea. One that I've mentioned before in side notes. And I want
> to emphasize that this still only is an idea. But I want to present this
> idea to you. As a way to gather feedback and get input. Maybe the idea is
> stupid!? Maybe you think it's already solved? Or maybe it's not, and lots
> of you resonate with it as well. In any case, please let me know what you
> think on the piece below!
>
> 
>
>  ORG MODE: COLLECTIONS/PROJECTS
>
> Gustav Wikström
> 
>
>
> Table of Contents
> _
>
> 1. Motivation
> 2. Idea
> 3. Benefit
> .. 1. For the user
> .. 2. For the developer
> 4. Example use cases
> .. 1. Separate actions from reference
> .. 2. Work / Personal separation
> .. 3. Separated book library
> .. 4. More?
> 5. Risks and challenges
> .. 1. Which configuration to use?
> .. 2. Should project config allow local variables?
> . 1. How to initialize the local variables?
> .. 3. Conflict with other customizations
> .. 4. Files that belong to multiple collections
> .. 5. Dynamic lists of files and folders for a collection?
> 6. Alternatives
> 7. References
>
>
> 1 Motivation
> 
>
>   Org mode is more than a major mode for emacs buffers. That has been
>   clear for quite some time. Org mode can operate on sets of files.
>   Consolidate TODO's and calendar information into custom views. Publish
>   sets of files. To do this Org mode assumes that the user has a
>   configuration for each of those features. Each feature is responsible
>   for maintaining its own context. And almost all of that context has
>   to be set globally. So even though Org mode has commands and features
>   that operate on sets of files and folders it has not yet developed
>   that in a congruent, extensible and composable way. Thus, for the
>   sanity of our users and developers I think it's time to ... introduce
>   another concept! One that hopefully can simplify things both for users
>   and developers.
>
>
> 2 Idea
> ==
>
>   I propose to introduce `Collection' as a concept in the realm of Org
>   mode. [1]
>
>   An Org mode collection is defined as the combination of:
>   1. A short name and description
>   2. A collection of Org mode documents
>   3. A collection of files and/or folders called attachments and
>  attachment-locations for the project
>   4. A collection of configurations for the given project
>
>   Globally available collections are defined in a list,
>   `org-collections'. Org mode should include a safe parameter that can
>   be set as a folder customization to the local active project,
>   `org-collections-active'. The default should be to the first entry in
>   `org-collections' unless customized. This local parameter would be
>   used to instruct Emacs and Org mode on which collection is active.
>   Only one collection at a time can be active.
>
>   Org agenda should use `org-collections-active' as default for the
>   collection of Org mode documents to operate on. Org agenda should get
>   a new command to switch between active projects.
>
>   I'm thinking that there could be a special Emacs major mode for the
>   collection as well, called "Org collections mode". Not sure exactly
>   what to display and how to represent the project there... But
>   certainly some kind of list of included documents and attachments.
>   When in that mode there should possibly be single key
>   keyboard-shortcuts to the most important features that operate on the
>   collection. And switch between them.
>
>
> 3 Benefit
> =
>
> 3.1 For the user
> 
>
>   A user would gain mainly two benefits as I can see right now:
>   1. The ability to clearly define (multiple) collections of files that
>  belong together across org mode, with unique configurations.
>   2. Less global configuration state to manage and worry about!
>
>   The second point might not look like much but is sooo important! Most
>   programmers know that global state should be avoided. Putting things
>   in a context most of the time makes things better. And if we can
>   configure Org mode connected to a context it makes it much more useful
>   for those who use Org mode for multiple purposes.
>
>   The first point is equally important in my opinion. Today one must
>   configure Org mode per feature. If you want to configure publishing
>   you do that globally. If you want to configure the agenda, you have to
>   do that globally as well. If you want to define a location for
>   attachments, do it globally! What about custom TODO-keywords? Do it
>   globally! Track ID-locations? Define a loc

RE: [Idea] Org Collections

2019-12-15 Thread Gustav Wikström
Yes, aware at least. I’m sure there is a big overlap in what I’m trying to 
achieve and what projectile tries to achieve. Not sure if an Org collection 
should be a Projectile add-on, or if it should be a facility inside Org mode 
that projectile could attach to. I think the second option would be better. But 
not sure yet how to realize it. Thinking in progress.

Thanks
Gustav

From: Emacs-orgmode  On Behalf Of 
tbanelwebmin
Sent: den 15 december 2019 10:08
To: emacs-orgmode@gnu.org
Subject: Re: [Idea] Org Collections


Interesting idea!

Is everyone aware of Emacs Projectile?
https://github.com/bbatsov/projectile

Not exactly the Org Collections you talks about, Gustav, but somehow related.

Projectile manages collections of files that belong together. They may be 
anything (Org Mode, Python, C++, HTML, LibreOffice, anything). It is most often 
zero-configuration: if a directory contains a .git or .bzr sub-directory, it is 
a Projectile project. A Maven project is a Projectile project, and so on. If 
the directory is not of a known type, just adding and empty .projectile 
sub-directory makes it a Projectile project.

Quite handy.

Could your Org Collections idea be a Projectile add-on?

As an example, there is such an add-on: org-projectile
https://github.com/IvanMalison/org-projectilehttps://github.com/IvanMalison/org-projectile
"org-projectile provides functions for the creation of org-mode TODOs that are 
associated with projectile projects."

Regards
Le 14/12/2019 à 18:32, Gustav Wikström a écrit :

Hi list and all honored readers!



I have an idea. One that I've mentioned before in side notes. And I want to 
emphasize that this still only is an idea. But I want to present this idea to 
you. As a way to gather feedback and get input. Maybe the idea is stupid!? 
Maybe you think it's already solved? Or maybe it's not, and lots of you 
resonate with it as well. In any case, please let me know what you think on the 
piece below!







 ORG MODE: COLLECTIONS/PROJECTS



Gustav Wikström




RE: [Idea] Org Collections

2019-12-15 Thread Gustav Wikström
Hi Adam,

> -Original Message-
> From: Emacs-orgmode  On
> Behalf Of Adam Porter
> Sent: den 15 december 2019 12:01
> To: emacs-orgmode@gnu.org
> Subject: Re: [Idea] Org Collections
> 
> How does this idea compare with Akira Komamura's org-starter package?
> 
> https://github.com/akirak/org-starter

Haven't looked much at that project before. Interesting, but not quite
what I have in mind here. That project seems like a transpose of Org
mode configurations into something that is file centric. If I play
with the thought of Org collections already being available then I
think org-starter could use that concept to, in a file centric way,
declare if a file belongs to one or multiple collections instead of
(or as a complement to...) belonging to the (default) Org agenda.

Thanks for the pointer
Gustav


Org agenda -- checking for invisible tasks after filtering...

2019-12-15 Thread Christian Schwarzgruber
Hey!

I'm a contributor of `org-super-agenda`
https://github.com/alphapapa/org-super-agenda, `org-super-agenda` lets you group
tasks into blocks. However, `org-super-agenda` doesn't consider filtering, which
might leave you with empty groups.

To solve that, I created a PR 
(https://github.com/alphapapa/org-super-agenda/pull/77)
which advices `org-agenda-filter-apply` and `org-agenda-finalize`
(https://github.com/alphapapa/org-super-agenda/pull/77/files#diff-465f82cd8ad2c42f0cebb190be6f58abR305).

Both are calling the same function `org-super-agenda--hide-or-show-groups`
(https://github.com/alphapapa/org-super-agenda/pull/77/files#diff-465f82cd8ad2c42f0cebb190be6f58abR1114).

In that function I check for the property `'invisible`. If all tasks in a group 
are
invisible the group gets hidden too.

The question is now, is it possible to further reduce the advised functions to
just one advised function.


best,

Christian



RE: [Idea] Org Collections

2019-12-15 Thread Gustav Wikström
Hi!

Hmm, not sure if this would classify as something hierarchical. I’d classify it 
as something set-based. It would allow “many to many” relations between files 
and collections, with definitions of the relation being declared per 
collection. I.e. a collection is a set of files. I haven’t thought of adding 
hierarchical relations between collections. I also haven’t thought of adding 
arbitrary named relations between collections (i.e. creating a graph). So this, 
in my mind, is orthogonal to hierarchies and graphs. I haven’t thought of what 
relations between collections should mean. And haven’t thought that there 
should be a syntax for that either.

But please explain more on what you think, if I misunderstood you!

/Gustav

From: John Sturdy 
Sent: den 15 december 2019 13:14
To: Gustav Wikström 
Cc: emacs-orgmode@gnu.org
Subject: Re: [Idea] Org Collections

That seems hierarchical, which is ok (as in org-mode itself) but how about 
implementing a more general graph mechanism, which could be used to do this but 
more flexibly?

On Sat, 14 Dec 2019, 21:04 Gustav Wikström, 
mailto:gus...@whil.se>> wrote:
Hi list and all honored readers!

I have an idea. One that I've mentioned before in side notes. And I want to 
emphasize that this still only is an idea. But I want to present this idea to 
you. As a way to gather feedback and get input. Maybe the idea is stupid!? 
Maybe you think it's already solved? Or maybe it's not, and lots of you 
resonate with it as well. In any case, please let me know what you think on the 
piece below!



 ORG MODE: COLLECTIONS/PROJECTS

Gustav Wikström


…


Re: Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Ihor Radchenko
Thanks for the feedback.

> - For me, the tangle works if I only load the org library in the
> sub-process, so I disabled the loading of my config. I guess this depends
> heavily and what other configuration one has loaded, but I think for
> tangling, not much else is needed :)

Note that your version tangling may not work as expected if your
init file changes any default headers args affecting the tangling.
For example, I set (:comments . "link") in my init file. Not loading
init file would disallow detangling in my case. 

> - In you code, the process-list variable was not actually being modified
> since plist-put returns the new value but does not modify the
> variable.

(facepalm)

> I
> tried a few variations wrapping the plist-put in (setq ...), and adding
> corresponding code to clear the element after the tangle was finished, but
> could not get it to work. 

Well. Things did not work because plist-put compares keys by #'eq, which
returns nil on equal strings.

> - I wanted my code to report the time the tangle took. This works well by
> passing the time as the result of the initial lambda. Interestingly, it
> works if I return the time already formatted as a string (as in my code)
> but not if I return the result of (float-time ..) directly.

Thanks for this neat idea. Will also grab it to my config.

float-time did not work because of bug in async.el. It uses
backward-sexp to find the returned value of the lambda (in the process
buffer). But backwards-sexp fails on float (it moves point just after
the point).  

Best,
Ihor


Diego Zamboni  writes:

> Hi Ihor,
>
> On Thu, Dec 12, 2019 at 4:00 PM Ihor Radchenko  wrote:
>
>> See the relevant code from my config below. Let me know if you have any
>> questions or suggestions.
>>
>
> Thank you, this was extremely helpful. I am now using a modified version of
> your code (see below) with the following comments/questions:
>
> - For me, the tangle works if I only load the org library in the
> sub-process, so I disabled the loading of my config. I guess this depends
> heavily and what other configuration one has loaded, but I think for
> tangling, not much else is needed :)
>
> - In you code, the process-list variable was not actually being modified
> since plist-put returns the new value but does not modify the variable. I
> tried a few variations wrapping the plist-put in (setq ...), and adding
> corresponding code to clear the element after the tangle was finished, but
> could not get it to work. As this is not really critical for me, I just
> removed the whole process-checking code, significantly simplifying the rest.
>
> - I wanted my code to report the time the tangle took. This works well by
> passing the time as the result of the initial lambda. Interestingly, it
> works if I return the time already formatted as a string (as in my code)
> but not if I return the result of (float-time ..) directly.
>
> Here's my code:
>
>   #+begin_src emacs-lisp
> (defun zz/org-babel-tangle-async (file)
>   "Invoke `org-babel-tangle-file' asynchronously."
>   (message "Tangling %s..." (buffer-file-name))
>   (async-start
>(let ((args (list file)))
>  `(lambda ()
> (require 'org)
> ;;(load "~/.emacs.d/init.el")
> (let ((start-time (current-time)))
>   (apply #'org-babel-tangle-file ',args)
>   (format "%.2f" (float-time (time-since start-time))
>(let ((message-string (format "Tangling %S completed after " file)))
>  `(lambda (tangle-time)
> (message (concat ,message-string
>  (format "%s seconds" tangle-time)))
>
> (defun zz/org-babel-tangle-current-buffer-async ()
>   "Tangle current buffer asynchronously."
>   (zz/org-babel-tangle-async (buffer-file-name)))
> #+end_src
>
> Thanks again for your help, and for the inspiration to finally get this
> done, it had been bugging me for a while :)
>
> --Diego
>
>
>
>> Also, my config is written in the way that everything related to user
>> interaction can be disabled if I load emacs for tangling
>> (with org-tangle-flag). This is to speed up the async process.
>>
>> #+begin_src emacs-lisp
>> (defvar yant/org-babel-tangle-async-process-list nil
>>   "Plist of (file . process) for all the currently running async tangle
>> processes.")
>>
>>
>> (defun yant/org-babel-tangle-async (file &optional target-file lang)
>>   "Invoke `org-babel-tangle-file' asynchronously."
>>   (require 'async)
>>   (let ((oldproc (plist-get yant/org-babel-tangle-async-process-list
>> file)))
>> (when (or (not oldproc)
>>   (async-wait oldproc))
>>   (message "Tangling %s..." (buffer-file-name))
>>   (plist-put yant/org-babel-tangle-async-process-list
>>  file
>>  (async-start
>>   (let ((args (list file target-file lang)))
>> `(lambda ()
>>(require 'org)
>>  

Re: Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Ihor Radchenko


Thanks for the feedback.

> - For me, the tangle works if I only load the org library in the
> sub-process, so I disabled the loading of my config. I guess this depends
> heavily and what other configuration one has loaded, but I think for
> tangling, not much else is needed :)

Note that your version tangling may not work as expected if your
init file changes any default headers args affecting the tangling.
For example, I set (:comments . "link") in my init file. Not loading
init file would disallow detangling in my case. 

> - In you code, the process-list variable was not actually being modified
> since plist-put returns the new value but does not modify the
> variable.

(facepalm)

> I
> tried a few variations wrapping the plist-put in (setq ...), and adding
> corresponding code to clear the element after the tangle was finished, but
> could not get it to work. 

Well. Things did not work because plist-put compares keys by #'eq, which
returns nil on equal strings.

> - I wanted my code to report the time the tangle took. This works well by
> passing the time as the result of the initial lambda. Interestingly, it
> works if I return the time already formatted as a string (as in my code)
> but not if I return the result of (float-time ..) directly.

Thanks for this neat idea. Will also grab it to my config.

float-time did not work because of bug in async.el. It uses
backward-sexp to find the returned value of the lambda (in the process
buffer). But backwards-sexp fails on float (it moves point just after
the point).  

P.S. I just noticed that async tangle fails when I try to tangle into
"/sudo::filename". Not even sure how to fix it. 

Best,
Ihor


Diego Zamboni  writes:

> Hi Ihor,
>
> On Thu, Dec 12, 2019 at 4:00 PM Ihor Radchenko  wrote:
>
>> See the relevant code from my config below. Let me know if you have any
>> questions or suggestions.
>>
>
> Thank you, this was extremely helpful. I am now using a modified version of
> your code (see below) with the following comments/questions:
>
> - For me, the tangle works if I only load the org library in the
> sub-process, so I disabled the loading of my config. I guess this depends
> heavily and what other configuration one has loaded, but I think for
> tangling, not much else is needed :)
>
> - In you code, the process-list variable was not actually being modified
> since plist-put returns the new value but does not modify the variable. I
> tried a few variations wrapping the plist-put in (setq ...), and adding
> corresponding code to clear the element after the tangle was finished, but
> could not get it to work. As this is not really critical for me, I just
> removed the whole process-checking code, significantly simplifying the rest.
>
> - I wanted my code to report the time the tangle took. This works well by
> passing the time as the result of the initial lambda. Interestingly, it
> works if I return the time already formatted as a string (as in my code)
> but not if I return the result of (float-time ..) directly.
>
> Here's my code:
>
>   #+begin_src emacs-lisp
> (defun zz/org-babel-tangle-async (file)
>   "Invoke `org-babel-tangle-file' asynchronously."
>   (message "Tangling %s..." (buffer-file-name))
>   (async-start
>(let ((args (list file)))
>  `(lambda ()
> (require 'org)
> ;;(load "~/.emacs.d/init.el")
> (let ((start-time (current-time)))
>   (apply #'org-babel-tangle-file ',args)
>   (format "%.2f" (float-time (time-since start-time))
>(let ((message-string (format "Tangling %S completed after " file)))
>  `(lambda (tangle-time)
> (message (concat ,message-string
>  (format "%s seconds" tangle-time)))
>
> (defun zz/org-babel-tangle-current-buffer-async ()
>   "Tangle current buffer asynchronously."
>   (zz/org-babel-tangle-async (buffer-file-name)))
> #+end_src
>
> Thanks again for your help, and for the inspiration to finally get this
> done, it had been bugging me for a while :)
>
> --Diego
>
>
>
>> Also, my config is written in the way that everything related to user
>> interaction can be disabled if I load emacs for tangling
>> (with org-tangle-flag). This is to speed up the async process.
>>
>> #+begin_src emacs-lisp
>> (defvar yant/org-babel-tangle-async-process-list nil
>>   "Plist of (file . process) for all the currently running async tangle
>> processes.")
>>
>>
>> (defun yant/org-babel-tangle-async (file &optional target-file lang)
>>   "Invoke `org-babel-tangle-file' asynchronously."
>>   (require 'async)
>>   (let ((oldproc (plist-get yant/org-babel-tangle-async-process-list
>> file)))
>> (when (or (not oldproc)
>>   (async-wait oldproc))
>>   (message "Tangling %s..." (buffer-file-name))
>>   (plist-put yant/org-babel-tangle-async-process-list
>>  file
>>  (async-start
>>   (let ((ar

org2blog fails during upload with: org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

2019-12-15 Thread Steinar Bang
Platform: Windows 10,
  GNU Emacs 26.3 (build 1, i686-w64-mingw32) of 2019-08-29
  Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
c:/ProgramFiles/emacs-26.3-i686/share/emacs/26.3/lisp/org/)
  Org2Blog Runtime: Org2Blog 1.1.1, MetaWeblog 1.1.1, XML-RPC 1.6.12

I've installed org2blog from melpa stable following the instructions in
 https://github.com/org2blog/org2blog#using-a-package

I've created a template article and have successfully logged in to the
blog
 https://github.com/org2blog/org2blog#make-your-first-post-in-less-5-minutes

However exporting buffer fails with the error message
 org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

I have googled the error message and found this old thread:
 https://www.mail-archive.com/emacs-orgmode@gnu.org/msg105337.html

I have manually loaded ox-org as suggested in the thread, but that
didn't make the problem go away.
 https://www.mail-archive.com/emacs-orgmode@gnu.org/msg105374.html

Does anyone know what the problem might be?

Thanks!

Stack trace from the error message:
Debugger entered--Lisp error: (error "Unknown \"nil\" back-end: Aborting 
export")
  signal(error ("Unknown \"nil\" back-end: Aborting export"))
  error("Unknown \"%s\" back-end: Aborting export" nil)
  org-export-barf-if-invalid-backend(nil)
  org-export-as(wp nil nil t (:section-numbers nil :with-priority nil 
:with-sub-superscript nil :with-toc nil :with-tags nil :with-todo-keywords nil 
:wp-keep-new-lines nil :wp-latex t :wp-shortcode nil :tags-as-categories nil 
:wp-shortcode-langs-map nil))
  org-export-to-buffer(wp "*Org WordPress Export*" nil nil nil t 
(:section-numbers nil :with-priority nil :with-sub-superscript nil :with-toc 
nil :with-tags nil :with-todo-keywords nil :wp-keep-new-lines nil :wp-latex t 
:wp-shortcode nil :tags-as-categories nil :wp-shortcode-langs-map nil) 
#f(compiled-function () #))
  ox-wp-export-as-wordpress(nil nil (:section-numbers nil :with-priority nil 
:with-sub-superscript nil :with-toc nil :with-tags nil :with-todo-keywords nil 
:wp-keep-new-lines nil :wp-latex t :wp-shortcode nil :tags-as-categories nil 
:wp-shortcode-langs-map nil))
  ox-wp-export-as-string(nil nil (:section-numbers nil :with-priority nil 
:with-sub-superscript nil :with-toc nil :with-tags nil :with-todo-keywords nil 
:wp-keep-new-lines nil :wp-latex t :wp-shortcode nil :tags-as-categories nil 
:wp-shortcode-langs-map nil))
  (org-no-properties (ox-wp-export-as-string nil subtree-p export-options))
  (org2blog--upload-files-replace-urls (org-no-properties 
(ox-wp-export-as-string nil subtree-p export-options)))
  (save-excursion (org2blog--upload-files-replace-urls (org-no-properties 
(ox-wp-export-as-string nil subtree-p export-options
  (let ((result (save-excursion (org2blog--upload-files-replace-urls 
(org-no-properties (ox-wp-export-as-string nil subtree-p export-options)) 
result)
  org2blog--export-as-html(nil (:section-numbers nil :with-priority nil 
:with-sub-superscript nil :with-toc nil :with-tags nil :with-todo-keywords nil 
:wp-keep-new-lines nil :wp-latex t :wp-shortcode nil :tags-as-categories nil 
:wp-shortcode-langs-map nil))
  (setcdr (assoc "description" post) (org2blog--export-as-html subtree-p 
export-options))
  (let ((post (if subtree-p (org2blog--parse-subtree-entry) 
(org2blog--parse-buffer-entry (if tags-as-categories (progn (setcdr (assoc 
"categories" post) (cdr (assoc "tags" post))) (setcdr (assoc "tags" post) 
nil))) (setcdr (assoc "date" post) (org2blog--convert-timestamp-to-iso 
(org2blog--insert-current-time subtree-p (cdr (assoc "date" post) (setcdr 
(assoc "description" post) (org2blog--export-as-html subtree-p export-options)) 
post)
  (save-restriction (let ((post (if subtree-p (org2blog--parse-subtree-entry) 
(org2blog--parse-buffer-entry (if tags-as-categories (progn (setcdr (assoc 
"categories" post) (cdr (assoc "tags" post))) (setcdr (assoc "tags" post) 
nil))) (setcdr (assoc "date" post) (org2blog--convert-timestamp-to-iso 
(org2blog--insert-current-time subtree-p (cdr (assoc "date" post) (setcdr 
(assoc "description" post) (org2blog--export-as-html subtree-p export-options)) 
post))
  (save-excursion (save-restriction (let ((post (if subtree-p 
(org2blog--parse-subtree-entry) (org2blog--parse-buffer-entry (if 
tags-as-categories (progn (setcdr (assoc "categories" post) (cdr (assoc "tags" 
post))) (setcdr (assoc "tags" post) nil))) (setcdr (assoc "date" post) 
(org2blog--convert-timestamp-to-iso (org2blog--insert-current-time subtree-p 
(cdr (assoc "date" post) (setcdr (assoc "description" post) 
(org2blog--export-as-html subtree-p export-options)) post)))
  (let* ((export-options (org2blog--collect-export-options)) 
(tags-as-categories (plist-get export-options :tags-as-categories))) 
(save-excursion (save-restriction (let ((post (if subtree-p 
(org2blog--parse-subtree-entry) (org2blog--parse-buffer-entry (if 
tags-as-categories (progn (setcdr (assoc "ca

Re: [O] FW: [RFC] Link-type for attachments, more attach options

2019-12-15 Thread stardiviner


Gustav Wikström  writes:

> Hmm, inline images work for attachment links on my side on Org mode master.
>
> I considered keeping the file link option but ruled against it in the end. I 
> could remove some complexity from the code in the end due to it.
>
> Don't know why attachments aren’t expanded as images for you...
>

I figured out why on my side inline image does not work.

When have link with description, the inline image does not work. When has no
link description, inline image works.

Here is an example:

#+begin_src org
# link work for inline image
[[attachment:screenshot.png]]

# inline image does not work
[[attachment:screenshot.png][description]]
#+end_src

I tested by EMC, found this is caused by some option. I will figure it out. 
Thanks!

-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: org2blog fails during upload with: org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

2019-12-15 Thread Steinar Bang
> Steinar Bang :

> Platform: Windows 10,
> GNU Emacs 26.3 (build 1, i686-w64-mingw32) of 2019-08-29
>   Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
> c:/ProgramFiles/emacs-26.3-i686/share/emacs/26.3/lisp/org/)
>   Org2Blog Runtime: Org2Blog 1.1.1, MetaWeblog 1.1.1, XML-RPC 1.6.12

> I've installed org2blog from melpa stable following the instructions in
>  https://github.com/org2blog/org2blog#using-a-package

> I've created a template article and have successfully logged in to the
> blog
>  https://github.com/org2blog/org2blog#make-your-first-post-in-less-5-minutes

> However exporting buffer fails with the error message
>  org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

> I have googled the error message and found this old thread:
>  https://www.mail-archive.com/emacs-orgmode@gnu.org/msg105337.html

> I have manually loaded ox-org as suggested in the thread, but that
> didn't make the problem go away.
>  https://www.mail-archive.com/emacs-orgmode@gnu.org/msg105374.html

I read the source code and manually loaded ox-wp:
 M-x load-library ox-wp RET

And then "Save post draft" saved the article.

Now I have to figure out why installing the package from melpa statble
wasn't enough. 



[PATCH] org-screen.el: replace obsolete function

2019-12-15 Thread Gregor Zattler
* contrib/lisp/org-screen.el (org-screen): replace obsolete function
`insert-string' with `insert'.
---
 contrib/lisp/org-screen.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-screen.el b/contrib/lisp/org-screen.el
index 6b870f229..948e93adf 100644
--- a/contrib/lisp/org-screen.el
+++ b/contrib/lisp/org-screen.el
@@ -64,7 +64,7 @@
   (interactive "MScreen name: ")
   (save-excursion
 (org-screen-helper name "-S"))
-  (insert-string (concat "[[screen:" name "]]")))
+  (insert (concat "[[screen:" name "]]")))

 (defun org-screen-buffer-name (name)
   "Returns the buffer name corresponding to the screen name given."
--
2.11.0




RE: [O] FW: [RFC] Link-type for attachments, more attach options

2019-12-15 Thread Gustav Wikström
> -Original Message-
> From: Emacs-orgmode  On
> Behalf Of stardiviner
> Sent: den 15 december 2019 15:26
> To: Gustav Wikström 
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
> 
> ...
> 
> I figured out why on my side inline image does not work.
> 
> When have link with description, the inline image does not work. When has
> no link description, inline image works.
> 
> Here is an example:
> 
> #+begin_src org
> # link work for inline image
> [[attachment:screenshot.png]]
> 
> # inline image does not work
> [[attachment:screenshot.png][description]]
> #+end_src
> 
> I tested by EMC, found this is caused by some option. I will figure it
> out. Thanks!

FWIW, I see the same behavior as you do when I add descriptions. The same seems 
to 
apply for file-links. I haven't looked it up to see if that's intended though. 
Just 
wanted to share how it works for me, if you're scratching you're head over this!

Actually... Not wanting to push the "Send" button without looking into the 
manual, I 
found the following in the "Images" section:

"An image is a link to an image file(1) that does not have a 
description part"

See [[info:org#Images]]

Regards
Gustav


where is org-at-target-p ?

2019-12-15 Thread Scott Otterson
For years, I've used the function, org-at-target-p to detect when the
cursor is on a dedicated target.  Recently, org-at-target-p disappeared
from elpa -- for example, it's not in the org.el included in
org-plus-contrib-20191209.

Was its removal intentional, and if so, is there a new function with
equivalent behavior?

Thanks,

Scott


Babel: Set org-babel-min-lines-for-block-output for single code block?

2019-12-15 Thread Nathan Neff
Hello all,

I just found the org-babel-min-lines-for-block-output variable.

I have a table like this:

#+RESULTS: people-table
| User  | ID | Homepage |
|---++--|
| Bob   |  1 | http://example.com/bob   |
| Steve |  2 | http://example.com/steve |

And a code block like this:

#+begin_src python :var people=people-table :results output
for i, person in enumerate(people):
print('- ' + person[0])
print("  " + person[2])
#+end_src

I would like to set org-babel-min-lines-for-block-output variable for
only the above code block.  Is this possible using #+property or something
like that?
Or do I need to have a "wrapper" elisp block around my python code?

Thanks,
--Nate


Re: Emacs bug 37890; killing capture buffer

2019-12-15 Thread Michael Heerdegen
Adam Porter  writes:

> Michael Heerdegen  writes:
>
> > Or (really better IMHO) consider a different implementation where the
> > original buffer is not modified until the user explicitly confirms the
> > stuff to capture with C-c C-c.
>
> That would be helpful in some ways, but harmful in others.  For example,
> consider a capture that is started while in a meeting, on a phone call,
> away from one's desk, etc., with some notes in it, clock start time,
> etc.  (You can find examples of this workflow in, e.g. Bernt Hansen's
> Org config.)  If Emacs were interrupted (crash, power failure, reboot,
> etc), the un-finalized capture would still be present in the auto-save
> file and could be recovered when restarting Emacs and finding the file
> again.

A legitimate objection.

> The way Org uses indirect, narrowed buffers for capturing is an
> elegant use of Emacs features that helps protect user data from
> accidental loss.

Let me rethink from the other side: how could the issue I described
(globbered org file) be prevented?  If you happen to kill the capture
buffer or forget about it, is there any indication left that there is a
problem?  A modified buffer visiting the org file is left, but as soon
as you successfully capture something else Org happily saves both edits
to the file.

So maybe we could prevent the user from doing something wrong?  Maybe
like this:

 - kill-buffer-hook in the capture buffer could be used to prevent the
 user from killing such a buffer by accident.  Or it could be made
 configurable what to do (e.g. undo the change with or without user
 prompting, ask for what to do, etc.)

 - kill-emacs-hook could be used to register a function that warns when
 any capture buffers are left when Emacs is to be killed.  That would
 make a difference if you have captured more stuff after having
 forgotten about a former capture buffer.  The user would be guided to
 finish what he would otherwise have forgotten.

That would improve security even further without getting in the way in
the normal workflow.


Michael.



Re: where is org-at-target-p ?

2019-12-15 Thread John Kitchin
I have it in org-9.2.3 from org-plus-contrib-20190402, and it is
in org-plus-contrib-20191028 too. It is gone from org-plus-contrib-20191209.

It is pretty simple. Maybe you can just add it to your init file if you use
it.

(defun org-at-target-p ()
  (or (org-in-regexp org-radio-target-regexp)
  (org-in-regexp org-target-regexp)))


John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sun, Dec 15, 2019 at 4:52 PM Scott Otterson  wrote:

> For years, I've used the function, org-at-target-p to detect when the
> cursor is on a dedicated target.  Recently, org-at-target-p disappeared
> from elpa -- for example, it's not in the org.el included in
> org-plus-contrib-20191209.
>
> Was its removal intentional, and if so, is there a new function with
> equivalent behavior?
>
> Thanks,
>
> Scott
>


Babel: Store script in external file

2019-12-15 Thread Nathan Neff
Hello all,

I think I'm missing something basic:  I'd like to have something like this:

#+begin_src python
#+filename: foo.py

Instead of storing my Python code in the current org file, I would like
Babel to read foo.py and execute it, as if it was inside the .org file.

The foo.py mentioned above is fairly large, and I would like the code
to be stored in a different file than my .org file, for brevity.

Any ideas?  I feel like I'm missing something obvious.

Thanks,
--Nate


Re: [O] FW: [RFC] Link-type for attachments, more attach options

2019-12-15 Thread stardiviner


Gustav Wikström  writes:

>> -Original Message-
>> From: Emacs-orgmode  On
>> Behalf Of stardiviner
>> Sent: den 15 december 2019 15:26
>> To: Gustav Wikström 
>> Cc: emacs-orgmode@gnu.org
>> Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
>> 
>> ...
>> 
>> I figured out why on my side inline image does not work.
>> 
>> When have link with description, the inline image does not work. When has
>> no link description, inline image works.
>> 
>> Here is an example:
>> 
>> #+begin_src org
>> # link work for inline image
>> [[attachment:screenshot.png]]
>> 
>> # inline image does not work
>> [[attachment:screenshot.png][description]]
>> #+end_src
>> 
>> I tested by EMC, found this is caused by some option. I will figure it
>> out. Thanks!
>
> FWIW, I see the same behavior as you do when I add descriptions. The same 
> seems to 
> apply for file-links. I haven't looked it up to see if that's intended 
> though. Just 
> wanted to share how it works for me, if you're scratching you're head over 
> this!
>
> Actually... Not wanting to push the "Send" button without looking into the 
> manual, I 
> found the following in the "Images" section:
>
>   "An image is a link to an image file(1) that does not have a 
> description part"
>
> See [[info:org#Images]]
>
> Regards
> Gustav

I read Org Info manual before, forgot most things, just put memory into
usual behavior now. I will read Org Info manual again. :) glade you figure
out my wrong point, thanks.


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: Bug: Orgguide missing in Org-9.3 package [9.3 (9.3-elpa @ /home/David/.emacs.d/elpa/org-9.3/)]

2019-12-15 Thread Kyle Meyer
Nicolas Goaziou  writes:

>> Sorry, I don't have write access.  But this issue seems to be about the
>> Org ELPA tarball, so I don't understand how it'd be related to the
>> recent Org sync with the Emacs repo.
>
> That's because I misread the bug report and though it was related to
> Emacs master branch.
>
> In any case, Org ELPA tarball and files merged with Emacs are two
> different things. IOW, even if ELPA tarball contains the Org guide, it
> is not sufficient for Emacs to ship it, too. So this also needs to be
> fixed on the Emacs' side, AFAIU.

Agreed, we should include orgguide.texi alongside org.tex in Emacs's
doc/misc/.  I've cc'd Bastien in case he'd like to adjust the latest
sync, though, given that orgguide has existed for a long time and has
never been included in the Emacs repo (AFAICS), I also don't see a
problem with waiting for the next sync until handling it.

>> Assuming there's not a good reason that orgguide is omitted, I think
>> fixing this is just a matter of adding orgguide to server.mk's
>> ORGELPA variable.
>
> I have no objection, but, per above, we should check if there's
> something to do in the Emacs repository, too.

OK, I'll apply that patch.

Thanks.



Re: Include lines in setupfile are not evaluated: bug or feature?

2019-12-15 Thread Jarmo Hurri


Greetings again.

Nicolas Goaziou  writes:

>> Ok. As a programmer I was hoping to mix them, because it would be
>> logical to have _one_ header file that defines all the common things
>> for a set of related files.
>
> Again, there is no overlap between the two keywords. SETUPFILE is what
> you want. INCLUDE is only meaningful during export (and is only
> documented there). I cannot think of a real situation where you would
> need both for the same file.

I have such documents regularly.
1. One type is a handout containing common contents at the beginning
   (included) and settings (setup).
2. The other case is a set of files sharing setup info and code (babel
   blocks, included).

>> Do I understand correctly: the description in the documentation is
>> not correct in the sense that not all contents from SETUPFILE is
>> evaluated as if it were included in the buffer?
>
> I think the document is correct, although I understand it can be
> misleading: it uses the verb "to include", but with a different
> meaning than INCLUDE keyword. It includes in-buffer settings, not full
> contents.
>
>> I am just trying to think about how this limitation, if it exists,
>> should be expressed in documentation. Shall I give it a try?
>
> Sure, but please do not mix SETUPFILE and INCLUDE, which are
> unrelated.

I will give it a try during the Christmas break.

All the best,

Jarmo




Re: Asynchronous org-agenda-redo

2019-12-15 Thread Ihor Radchenko


> So, of course, you can call custom
> functions in queries, even your own skip functions (with `not', of
> course), but in most cases, they can be covered with built-in
> predicates.

Unfortunately, it does not seem to be the case for me.
My main agenda view needs to  take into account multiple properties,
which cannot be handled within framework of built-in org-ql predicates
(AFAIK):

- =:SHOWFROMTIME:= (always inheriting) :: The purpose of this is to be
 able to assign specific projects for different days of week or,
 say, show the home items only in the evening of weekdays and not
 annoy me at work when I cannot do it any way. Hence, I can focus on
 the items I really need to do now in this agenda. Additionally, the
 time of the day after midnight is treated specially here. If
 =org-extend-today-until= is not 0 and the current time is before
 its value, the current time is still considered to be yesterday.
- =:SHOWFROMDATE:= :: The purpose of this is to be able to postpone the
 scheduled tasks for future if I cannot do it. The property is
 formatted as an org date. This property is especially useful if
 there is something more pressing, so that there is a temptation to
 reschedule less pressing event to another day. If the more pressing
 task is done earlier than expected, the postponed tasks can be
 still find in normal agenda view (not in the
 [[id:ff70b03f-3876-4b2b-9aab-c3209bd31cb8][focused]] one).
- =:SHOWDATES:= (always inheriting) :: It contains dairy =sexps= to set
 when the project should be shown. For example, I may want to work on
 Saturday once or twice, but the working items should not be shown on
 weekend normally. Hence, I can define it. Or some things can only be
 done on specific dates (say, going to some shop, which is open few
 days a week only)

> org-entry-get is only called for the (property) predicate.  It's the
> correct way to get Org properties, because it handles special
> properties, inheritance, etc.  However, when possible, queries are
> optimized to a whole-buffer regexp search that finds possible matches.
> So, for example, a query like '(property "owner" "yantar") would be
> optimized to a whole-buffer regexp search that would be very fast.  See
> function org-ql--query-preamble.

Thanks for the info! I did not know about this optimisation in org-ql.
org-entry-get consumes most of cpu time while building my agenda views.
Though I don't think that there will be much difference for me since
most of my property conditions in agenda involve inherited properties.

Regards,
Ihor

Adam Porter  writes:

> Ihor Radchenko  writes:
>
>>> org-ql doesn't use skip functions, just queries.
>>
>> Skip functions are essentially used-defined queries as soon as the
>> queries are tested against every headline.
>
> Skip functions aren't necessary with org-ql, because the query itself
> can have arbitrary Lisp code.  So, of course, you can call custom
> functions in queries, even your own skip functions (with `not', of
> course), but in most cases, they can be covered with built-in
> predicates.
>
>> I can rewrite my skip functions into queries, but I don't expect much
>> improvement since org-ql seems to use org-entry-get, which is the main
>> performance bottleneck for my agenda generation.
>
> org-entry-get is only called for the (property) predicate.  It's the
> correct way to get Org properties, because it handles special
> properties, inheritance, etc.  However, when possible, queries are
> optimized to a whole-buffer regexp search that finds possible matches.
> So, for example, a query like '(property "owner" "yantar") would be
> optimized to a whole-buffer regexp search that would be very fast.  See
> function org-ql--query-preamble.
>
>
>