Re: Unicode TODO keyword issues in agenda search leading to org-scan-tags regex

2022-09-06 Thread Marcel Lauhoff



> On 2022-09-05, at 12:54, Ihor Radchenko  wrote:
> 
> Marcel Lauhoff  writes:
> 
>>> Oops. You are indeed right. I forgot to remove the 'words argument. Now
>>> fixed (hopefully).
>>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eeb4fa8c09e6e21b86bec51328e53b4adf662945
>> 
>> I think it should be
>> 
>> " *\\(" (regexp-opt org-todo-keywords-1 t) "\\)?"
>> 
>> 1. Without the 3rd argument regexp-opt generates a non-capturing group. 
>> 'word generates a capturing group.
>> 2. With the additional space in " \\" I'm no longer able to match any todo 
>> in my org files.
> 
> Yeah. I indeed missed the match group change.
> Your variant, however, will match things like
> * TODObut not really
> 
> Can you try again with the latest main?


Just tried the latest main (a3788bd8b). Tag todo searches work now with my 
unicode TODO keywords. 
Awesome! Thank you!


Re: Manual Ordering and Dynamic Priority

2022-09-06 Thread Eduardo Suárez
Thanks a lot for all your answers. I've been thinking about it and I've come up
with another solution.

My main problem is, given a file with lots of tasks, to create a "preorder" of
tasks to avoid the fear of missing out tasks when planning or selecting the top
priority tasks. To review the full list of tasks takes very long (my estimate
is O(n^2)). Reordering the current hierarchy is not an option because the file
has already a predefined (deep) structure.

So my solution is simple: create another top level heading in the file named
planning and create a hierarchy of links to tasks in it. Something like this:

* Planning
- [[#task4][My task 4 header]]
  - [[#task5][My task 5 header]]
  - [[#task1][My task 1 header]]
- [[#task2][My task 2 header]]
  - [[#task7][My task 7 header]]
- [[#task6][My task 6 header]]
  - [[#task3][My task 3 header]]

So I can preorder using dependencies like org mode natural TODO dependencies,
and I get something like a gantt chart (without dates and planning). Moreover,
it looks simple to create a template to add a task to this list. I can even
document the relationship between tasks and priorities there.

Then, it is straightforward to select top priority tasks in this file.
Repeating the same for every agenda file, I can easily select a small list of
tasks to work with (e.g. assigning priorities or a TODO keyword).




Re: [PATCH] org.el: Preserve case for link subgroups from `org-file-apps'

2022-09-06 Thread Ihor Radchenko
Max Nikulin  writes:

> Debugging `org-file-apps' and `org-open-file' regexp subgroups I noticed 
> an issue: the code distorts case of the link components making them 
> invalid. The patch to fix the bug is attached, the commit message 
> contains an example of the problem.
>
> Maybe I break some use case, but I am unaware when namely downcased link 
> must be used.

I tracked this dlink business down to
75563bf71e6df356a5ae77a93152fcf913378107.
The relevant ML discussion is in
https://orgmode.org/list/4b51d104.9090...@jboecker.de

Carsten replied (in
https://list.orgmode.org/orgmode/9771a876-82d8-4755-9ec4-f951ea9fe...@gmail.com/):

>> Hi Jan,
>> 
>> I have now applied this patch.
>> 
>> Hi everyone,
>> 
>> I am not sure if I completely understood every part of it,  so if
>> anyone finds strange behavior of links, make sure to report it so
>> that we (Jan, that is :-) gets a chance to fix it.

I do not see much of discussion relevant to downcasing the links.
I also do not see a clear reason why downcasing is necessary.
So, it is probably safe to drop it, especially if tests are passing.

>   ;; First, try matching against apps-dlink if we
>   ;; get a match here, store the match data for
>   ;; later.
> - (let ((match (assoc-default dlink apps-dlink
> - 'string-match)))
> + (let* ((case-fold-search t)
> +   (match (assoc-default link apps-dlink
> + 'string-match)))

With this patch, `apps-dlink' name becomes completely confusing.
Is there any way to get rid of it as well? (or maybe rename to something
more reasonable).

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: Secrets in org-babel

2022-09-06 Thread Ihor Radchenko
Felix Dorner  writes:

> New org user, fascinated by org-babel, but stumbled over something I have
> no good solution for: I have mostly shell blocks, and very often have to
> retrieve secrets from aws secretsmanager before I can do anything useful,
> e.g. query a database in several places. What I've been doing is to put the
> secret retrieval into a named block and can then inject the secret into
> other blocks with a parameter that calls that block. But then, the secret
> value is also echoed to the messages buffer, which I'd like to avoid? I'd
> also like to avoid repeating the secrets-retrieval code all over the place.
> Thanks for any tips.

:results none or :results silent will not echo the output.
Also, you may find https://www.kpassa.me/posts/literate2/ useful.
Finally, you may put your named secret block inside encrypted heading
via org-crypt (https://orgmode.org/manual/Org-Crypt.html#Org-Crypt).

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Agenda 'Org view' (org-projection?)

2022-09-06 Thread Eduardo Suarez
Based on my previous mail "Manual Ordering and Dynamic Priority" I would like
also to comment about this related idea.

In Agenda, it is possible to generate different views. I wonder whether it
would be possible to generate an "org mode" view. That is, a buffer in org-mode
format with all the tasks from our agenda query (no really a sparse tree view).
Then that file could be edited and reordered to create a planning. If the file
could also sync with new queries that would be great. I think of that maybe as
a package called 'org-projection' (project org into org).

With such feature, I could have a general org file e.g. for a working project,
and then a planning (projected) file in association with it. I would add the
latter to the Agenda files.

I can't do lisp development and have no idea if that makes sense, but I just
wanted to share this idea with you.




Re: Org-Crypt usage questions

2022-09-06 Thread Ihor Radchenko
David Masterson  writes:

>> Yes. AFAIK, the symmetric password is never reused. Though it may depend
>> on your gpg settings.
>
> Hmm.  During the save of a file with an entry with "crypt" tag, I was
> asked for a symmetric passwd.  The file was saved okay and the entry was
> encrypted properly.  After reading the file back in, org-decrypt-entry
> asked for the symmetric passwd and decrypted properly.  Later,
> org-encrypt-entry did *not* ask for the passwd -- it just encrypted with
> the previous passwd.  Then org-decrypt-entry also did *not* ask for the
> passwd and decrypted properly.
>
> What GPG settings would cause this?

Probably 
https://www.gnu.org/software/emacs/manual/html_node/pgg/Caching-passphrase.html


-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-06 Thread Ihor Radchenko
Fedja Beader  writes:

> Pressing C-c C-c in a code block asks the user whether to
> execute that code block or not. This soon becomes annoying.
> To remedy this, org-mode provides us the variable
> org-confirm-babel-evaluate. But this is not very user friendly.
>
> Additionally, as per documentation, this variable only controls
> whether org-mode (babel? Forgive me, I am sort of a new user of
> Emacs) will execute the code block without asking, or ask.
>
> What I would like to have, to safely and easily use org-mode
> as an interactive notebook, is to not have to overload this
> function and to be asked only once per buffer/file whether to:
> 1) Unconditionally allow executing all code blocks
> 2) Unconditionally disallow executing all code blocks
> 3) Ask for every block.
>
> Particularly the second case is the one that cannot be
> supported by simply defining org-confirm-babel-evaluate.

1) You can set org-confirm-babel-evaluate buffer-locally
2) Same or set :eval no header arg. (see 
https://orgmode.org/org.html#Evaluating-Code-Blocks)
3) You can set :eval query header arg.


-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: Org Publish HTML and PDF With GPG Files

2022-09-06 Thread Ihor Radchenko
l...@tosk.in writes:

> Is there a specific way of setting this in the config?
> I tried adding `(add-hook 'org-export-before-processing-hook 
> #'org-decrypt-entries)` to my init.el, but publishing fails with the error 
> "run-hook-with-args: Wrong number of arguments: (0 . 0), 1"

This is abnormal hook and the added functions must accept a single
argument - the export backend symbol (see the docstring).

It is indeed confusing. On main, I changed
`org-export-before-processing-hook' to
`org-export-before-processing-functions' to indicate that it is abnormal
hook.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fe90cab9564bd6fa08c9abe0882e0e06cc5626f9

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: Agenda 'Org view' (org-projection?)

2022-09-06 Thread Juan Manuel Macías
Hi, Eduardo:

Eduardo Suarez writes:

> Based on my previous mail "Manual Ordering and Dynamic Priority" I would like
> also to comment about this related idea.
>
> In Agenda, it is possible to generate different views. I wonder whether it
> would be possible to generate an "org mode" view. That is, a buffer in 
> org-mode
> format with all the tasks from our agenda query (no really a sparse tree 
> view).
> Then that file could be edited and reordered to create a planning. If the file
> could also sync with new queries that would be great. I think of that maybe as
> a package called 'org-projection' (project org into org).
>
> With such feature, I could have a general org file e.g. for a working project,
> and then a planning (projected) file in association with it. I would add the
> latter to the Agenda files.
>
> I can't do lisp development and have no idea if that makes sense, but I just
> wanted to share this idea with you.

I think this is not 100% related to what you're proposing, but if it
helps, I use the excellent org-super-agenda package a lot, which allows
you to sort and compose the agenda view according to many parameters:
tags, priorities, properties, etc:

https://github.com/alphapapa/org-super-agenda

Best regards,

Juan Manuel 

-- 
--
--
Juan Manuel Macías 

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com





ido, org-insert-link, and completion based on link description

2022-09-06 Thread Max Nikulin

Hi,

Does anyone have an idea why it was necessary to drop completion of 
stored links based on their description for the sake of ido?


I am not an ido user, so I am surprised that such feature negatively 
affected usability. I mean the commit


7f096ad37 2012-10-12 14:39:53 +1100 Tony Day: org-insert-link: Use ido 
when inserting links

https://list.orgmode.org/04d0e787-a8a1-4246-8dd2-d607e38d6...@gmail.com/T/#u


- (mapcar 'cadr org-stored-links))


If I read the code correctly, Bastien added this line to include link 
descriptions to the completion list in response to


Yagnesh Raghava Yakkala. #+LABEL and CUSTOM_ID with reftex. Mon, 21 May 
2012 04:45:29 +0900

https://list.orgmode.org/877gw6ocva@okhotsk19.lowtem.hokudai.ac.jp/T/#u

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=1e34c5d34
2012-08-03 14:08:20 +0200 Bastien Guerry: org.el: Fontify links to 
current buffer when inserting a link.


The only issue I suspect is that `org-store-link' may add to the list of 
stored links entries with identical path and description causing 
duplicated completion options, but it may be solved in another way.


From my point of view, currently the code of `org-insert-link' related 
to `auto-desc' is completely confusing. It was added to allow 
description completion, but it was not removed in the commit related to 
ido. It is rather inconsistent, so it may be unintentional.



P.S. My question is related to the following threads:
- Carlos Pita. Adding target and custom id links doesn't ask for 
description. Tue, 2 Aug 2022 14:44:58 -0300. 
https://list.orgmode.org/d99a712c-18d1-4a4f-8093-35a0bfb46...@gmail.com
- Max Nikulin. Re: Bug: org-store-link uses CUSTOM_ID instead of target 
point. Sat, 6 Nov 2021 19:51:29 +0700. 
https://list.orgmode.org/e2c807a7-1924-6f08-9e63-4f70aee9d...@gmail.com


I decided to start a new thread to concentrate on ido, link completion 
by their description, and the `auto-desc' variable.





Re: [BUG] ob-shell: cmdline and stdin broken when used with TRAMP

2022-09-06 Thread Bruno Barbier


Bastien Guerry  writes:

> I confirm Bruno is on the list of FSF-signed contributors, 
> I updated the Worg page.  Bruno, thanks in advance for your
> contributions!

Thanks Bastien.



Re: [BUG] ob-shell: cmdline and stdin broken when used with TRAMP

2022-09-06 Thread Bruno Barbier


Ihor Radchenko  writes:

> LGTM now. Thanks!
> Applied onto main with minor amendments in formatting.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=8151d52574f525fd922aadc43544688004cb7d14

Thanks Ihor!



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-06 Thread Greg Minshall
Fedja,

> What I would like to have, to safely and easily use org-mode
> as an interactive notebook, is to not have to overload this
> function and to be asked only once per buffer/file whether to:
> 1) Unconditionally allow executing all code blocks
> 2) Unconditionally disallow executing all code blocks
> 3) Ask for every block.

i think that is an interesting idea, and maybe a more pleasant user
interface than what we currently have.  

probably, for me, it would allow me to drop a number of buffer-local
variable customizations, as i'm typically evaluating code in a given
buffer over and over again (and, so, would be happy to pay the price of
saying "yes" once per buffer (per emacs instance).

i'd be curious to hear what the downsides might be, especially anyone
who sees security-related downsides.

Ihor,

> 1) You can set org-confirm-babel-evaluate buffer-locally
> 2) Same or set :eval no header arg. (see
> https://orgmode.org/org.html#Evaluating-Code-Blocks)
> 3) You can set :eval query header arg.

for me the use case is 1) disabling all (or setting to "query") when,
e.g., you are exporting some file you received via e-mail and so trust
*none* of the code blocks; 2) enabling all for some file that you
yourself maintain, and so trust *all* the code blocks.  at least
initially, this seems a nice direction.

cheers, Greg



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-06 Thread Steven Harris
There is a neat solution to this problem using

* Local Variables :noexport:

see the discussion at stackoverflow


Cheers,

Steven


On Wed, 7 Sept 2022 at 05:07, Greg Minshall  wrote:

> Fedja,
>
> > What I would like to have, to safely and easily use org-mode
> > as an interactive notebook, is to not have to overload this
> > function and to be asked only once per buffer/file whether to:
> > 1) Unconditionally allow executing all code blocks
> > 2) Unconditionally disallow executing all code blocks
> > 3) Ask for every block.
>
> i think that is an interesting idea, and maybe a more pleasant user
> interface than what we currently have.
>
> probably, for me, it would allow me to drop a number of buffer-local
> variable customizations, as i'm typically evaluating code in a given
> buffer over and over again (and, so, would be happy to pay the price of
> saying "yes" once per buffer (per emacs instance).
>
> i'd be curious to hear what the downsides might be, especially anyone
> who sees security-related downsides.
>
> Ihor,
>
> > 1) You can set org-confirm-babel-evaluate buffer-locally
> > 2) Same or set :eval no header arg. (see
> > https://orgmode.org/org.html#Evaluating-Code-Blocks)
> > 3) You can set :eval query header arg.
>
> for me the use case is 1) disabling all (or setting to "query") when,
> e.g., you are exporting some file you received via e-mail and so trust
> *none* of the code blocks; 2) enabling all for some file that you
> yourself maintain, and so trust *all* the code blocks.  at least
> initially, this seems a nice direction.
>
> cheers, Greg
>
>


Re: org-babel-load-languages usability issue

2022-09-06 Thread Ihor Radchenko
Tim Cross  writes:

>> Well. There are actually languages below if you look into the source
>> code. Indeed, it is confusing in the help/customize buffer. We can fix
>> this, say, by adding the language list into the docstring itself. Though
>> it will not cover third-party ob-*.el modules.
>
> Maybe only add/list those languages 'bundled' with Emacs or perhaps just
> add a link to the worg page listing all the supported languages. I'm
> reluctant to add the list to the doc string as it will make it even
> longer and there will always be the issue of it not being current as
> languages are added/removed (I find doc string drift out more than code,
> where people tend to update/fix code more readily). 

We have [[info:org#Languages]] linking to
https://orgmode.org/worg/org-contrib/babel/languages/index.html
I guess we can simply add the manual link to the docstring. Would it be
sufficient?

>> The primary goal of this variable is reducing startup time. Loading all
>> the 44 built-in babel backends would be slow.
>
> Would it load them if the default values for all the languages which
> have bundleed modes in Emacs were set to nil rather than t?

I am not sure if it is a good idea.
I am now looking at the usage of org-babel-load-languages in the code,
and I am seeing `org-lint-wrong-header-argument',
`org-babel-demarcate-block' ignoring difference between (lang . nil) and
(lang .t).

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: Manual Ordering and Dynamic Priority

2022-09-06 Thread Ihor Radchenko
Eduardo Suárez  writes:

> My main problem is, given a file with lots of tasks, to create a "preorder" of
> tasks to avoid the fear of missing out tasks when planning or selecting the 
> top
> priority tasks. To review the full list of tasks takes very long (my estimate
> is O(n^2)). Reordering the current hierarchy is not an option because the file
> has already a predefined (deep) structure.

If you really have so many tasks, something is not right. Normally, most
of the tasks are really optional and do not need to be reviewed often.
Only really important tasks should be reviewed regularly. Those can be
marked, say, as [#A] priority and reviewed in special agenda view/sparse
tree.

I also find it useful to apply spaced repetition for some lower-priority
tasks I really do not want to forget by accident.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



Re: Agenda 'Org view' (org-projection?)

2022-09-06 Thread Ihor Radchenko
Eduardo Suarez  writes:

> In Agenda, it is possible to generate different views. I wonder whether it
> would be possible to generate an "org mode" view. That is, a buffer in 
> org-mode
> format with all the tasks from our agenda query (no really a sparse tree 
> view).
> Then that file could be edited and reordered to create a planning. If the file
> could also sync with new queries that would be great. I think of that maybe as
> a package called 'org-projection' (project org into org).

Not exactly what you are asking for, but there is
org-agenda-entry-text-mode (bound to E in agenda).

You can also re-order tasks in agenda.

Finally, there is https://github.com/alphapapa/org-quick-peek

As for your specific request, there is
https://github.com/nobiot/org-transclusion, though it does not really
support creating dynamic buffers. However, I do not see why
org-transclusion cannot do it - most of the features are already in
place. You may consider opening a feature request in org-transclusion
GitHub repo.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92