Re: [DISCUSSION] Possible inclusion of org-capture.el into Emacs core (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-31 Thread Richard Stallman
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

NOTE: Is it absolute;y necessary to cross post to emacs-devel and
emacs-orgmode?

  > Similar to jami-bot providing a dbus interface for Jami to interact with
  > Emacs, Org mode has org-protocol.el providing command line and URL
  > handler interface that is nearly independent of Org mode itself in its
  > core function:

Could you please explain in a few lines what sort of jobs org-protocol.el does?
The doc you sent

;;   1.) Add this to your init file (.emacs probably):
;;
;;   (require 'org-protocol)
;;
;;   3.) Ensure emacs-server is up and running.
...

describes in a low-level way _how_ to use it, but in order to think
about that, the first thing I need to know is _what jobs it can do_.

  > With org-protocol, one can also make Emacs receive data from browser and
  > perform any action defined by custom handler function - all fully
  > configurable and not necessarily related to Org mode.

Could you state a few examples?

Also, how is this related to Org mode?  Why call it "org-protocol" rather
tham some other name?

  > 17.16.3 The open-source protocol
  > ... The open-source handler is designed to help with editing local
  > sources when reading a document..

What document does that come from?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





Re: [DISCUSSION] Possible inclusion of org-capture.el into Emacs core (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-31 Thread Richard Stallman
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Similar to jami-bot providing a dbus interface for Jami to interact with
  > Emacs, Org mode has org-protocol.el providing command line and URL
  > handler interface that is nearly independent of Org mode itself in its
  > core function:

Could you please explain in a few lines what sort of jobs org-protocol.el does?
The doc you sent

;;   1.) Add this to your init file (.emacs probably):
;;
;;   (require 'org-protocol)
;;
;;   3.) Ensure emacs-server is up and running.
...

describes in a low-level way _how_ to use it,
but in order to think about it, the first thing I need to know
is _what it can do_.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





Elisp function to get the upcoming event with the closest scheduled date

2023-12-31 Thread Rodrigo Morales
I just learned that it is possible to add functions to tab-bar-format,
which is the variable that controls the information that is shown in the
tab-bar.

I want to write a function that gets the upcoming event with the closest
scheduled date so that it is shown in the tab-bar. I want to know if
someone has written a function that accomplishes the described
behavior. If not, does anyone have some tips for writing such function?



Re: [PATCH] Set Python shell in Org edit buffer

2023-12-31 Thread Jack Kamm
Ihor Radchenko  writes:

>> I agree that `python-shell-buffer-name' should be set according to the
>> :session header, and that Liu's patch fixes a problem in ob-python.
>>
>> Is there any objection if I go ahead and apply it?
>
> Because I am still thinking about the idea with global customization and
> `org-babel--associate-session'.

It's great that you're thinking about this -- it would be nice to have
better consistency between ob-R, ob-python, etc, and to have better
configurability on this. In particular, ob-R's behavior to automatically
start a session is annoying for me, especially when editing on my HPC's
login node which forbids starting R, python, etc outside of slurm.

However, the most recent version of Liu's patch is very small, and the
changes should be easy to modify in future, whatever your conclusion on
`org-babel--associate-session'. So I would suggest not to let it
be blocked by this for too long.



Re: Month-week and quarter-week datetrees (RFC and package announcement)

2023-12-31 Thread Jack Kamm
Ihor Radchenko  writes:

>> https://gitlab.com/jackkamm/org-grouped-weektree
>>
>> I'd appreciate feedback on 2 points:
>>
>> 1. Are any of these datetree formats worth upstreaming into org-mode
>>proper?
>
> That would make sense.
>
>> 2. Can we add a public interface for `org-datetree--find-create', and
>>are there any suggestions on how to do it?
>>
>> Regarding #2, an ugly aspect of my current implementation is the abuse
>> of the private function `org-datetree--find-create'. I also pass in
>> the week or quarter for the DAY and MONTH arguments of this function,
>> though I note that `org-datetree-find-iso-week-create' does something
>> similar in its implementation.
>
> The API of `org-datetree--find-create' is generally very limiting.
> It would be nice to come up with something less limiting.

Thanks for the feedback -- I'll start working on something along these
lines.  Though this might take me a little while since the holiday is
ending soon :''-(



Re: [PATCH] Set Python shell in Org edit buffer

2023-12-31 Thread Jack Kamm
Ihor Radchenko  writes:

> python.el is convenient as it allows setting the session buffer name in
> advance via buffer-local variable. Then, all the normal python-mode
> commands, including `run-python' or `python-shell-send-region' will work
> as expected. However, other babel backends like ob-R do not have such a
> luxury (see the dance with renaming R process buffer in
> `org-babel-R-initiate-session').

For R specifically, using `ess-gen-proc-buffer-name-function' might
simplify things. Though of course this doesn't solve the problem more
generally for other languages.



Re: [DISCUSSION] org-capture.el vs remember.el (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-31 Thread Adam Porter

If this works (big if since given all this is vapourware), we'll
finally have found good use for indirect buffers :-)


FWIW, I use indirect buffers constantly through 
`org-tree-to-indirect-buffer', which is also called from several of my 
tools like org-ql, org-bookmark-heading, etc.  Largely, I treat my ~/org 
directory as a database, and when I open an entry from a search result 
or a bookmark in an indirect buffer, I don't even care what file/buffer 
it's actually in; the indirect buffer offers the illusion that it's in a 
file of its own, without any other content around it.




Re: Adding functionality to org-latex-classes

2023-12-31 Thread Pedro Andres Aranda Gutierrez
That’s what I’m looking at these days :-) 
Just trying to provide a proof of concept 
It helps me coping with my grinchiness 
PA
Enviado desde mi iPhone

> El 31 dic 2023, a las 15:37, Ihor Radchenko  escribió:
> 
> Pedro Andres Aranda Gutierrez  writes:
> 
>> I was just wondering whether it would be possible to add further
>> functionality to org-latex-classes and would like to start a discussion ;-)
>> 
>> My use case is the following:
>> 
>> The document class is tightly coupled with  ~org-latex-subtitle-format~
>> and  ~org-latex-subtitle-separate~. Koma-script classes, for example, need
>> those variables to be defined with file or directory local variables in
>> order to take full profit of the layouts. If we found a way of
>> accommodating them in the class definitions, the fuzz of the extra
>> variables could easily be overcome.
> 
> We may extend `org-latex-classes' to allow custom backend option values.
> For example,
> 
>  (latex-subtitle-format . value)
>  (latex-subtitle-separate . value)
> 
> Then, we can use these values as the overrides when the variables are
> not set explicitly as buffer-locals or as in-buffer/subtree export
> keywords.
> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



[PATCH] doc/org-manual.org (Summary): Clarify the Org markup is human-readable

2023-12-31 Thread Ihor Radchenko

I'd like to amend the Org manual introduction as in the attached patch.
The idea is to highlight that Org markup is designed to be
human-readable first and foremost rather than just computer-readable.

This is the first section of the manual. Most of the new users will see
it. So, I'd like to hear any objections before installing the patch.

>From f97e3d9b7e346506f0a87b98f4809e612d7e78b6 Mon Sep 17 00:00:00 2001
Message-ID: 
From: Ihor Radchenko 
Date: Sun, 31 Dec 2023 16:20:24 +0100
Subject: [PATCH] doc/org-manual.org (Summary): Clarify the Org markup is
 human-readable

Readability of raw Org text is one of the core principles we maintain
when designing Org markup language.  Let's state it explicitly in the
manual.
---
 doc/org-manual.org | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index ff1b9cffb..3ddce7d41 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -22,6 +22,10 @@ ** Summary
 It relies on a lightweight plain-text markup language used in files
 with the =.org= extension.
 
+Org files can be viewed using any text editor.  You can read and
+understand raw Org markup with a naked eye.  Although authoring Org
+files is best-supported inside Emacs.
+
 As an authoring tool, Org helps you write structured documents and
 provides exporting facilities. Org files can also be used for literate
 programming and reproducible research.  As a TODO lists manager, Org
-- 
2.42.0


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 


Re: Should org-link-parser add type "file" when link has no "file:" prefix?

2023-12-31 Thread Ihor Radchenko
Joseph Turner  writes:

>> It would be more reliable to provide a separate link type.
>> We might even extend the special file+application: link type syntax that
>> already allows special behavior for opening file links.
>
> Thank you!  Would you explain about extending file+application syntax?

See `org-open-file' IN-EMACS argument - we may use different handlers
to open file links. Currently, IN-EMACS can be 'system or 'emacs. But
nothing stops us from adding more options.

> hyperdrive.el does add a separate "hyper://" link type which is used to
> link to a hyperdrive file or directory by its "full" URL:
>
> hyper://aaj45d88g4eenu76rpmwzjiabsof1w8u6fufq6oogyhjk1ubygxy/hyperdrive/hyperdrive-manual.org
>
> Additionally, we want to make it possible for users to copy ("mirror") a
> directory of Org mode documents into a hyperdrive for other users to
> view and link to.  Ideally, when users upload a set of files to a
> hyperdrive, the relative and absolute links between those files within
> the same hyperdrive work without modification.
>
> We also wanted users to be able to link to files on the local filesystem
> from within a hyperdrive.  Firefox and Chrome treat prefix-less links as
> pointers to files on the same webserver and "file:" links as pointers to
> files on the filesystem.  We thought that we could do the same thing in
> hyperdrive.el: [[/README.org]] could point to a file in the same
> hyperdrive while [[file:/README.org]] could point to a local file.

This will cause major issues when trying to export such links.
Except for HTML export that utilizes `org-html-link-use-abs-url', but
only for relative links.

Why not make [[hyper:/README.org]] use the "default" hyperdrive the
Org file belongs to.

> Would you be open to changing Org mode so that prefix-less links could
> be handled in a special way by certain modes?  Here's an idea:
>
> - Add a buffer-local variable `org-current-uri-scheme' which could be
> set to a string like "hyper".
>
> - When handling "file" type links, check if `org-current-uri-scheme'
> matches one of the keys in `org-link-parameters', and use the
> appropriate handler instead of the "file" handler.  (see attached patch
> for an example usage in `org-link-open')
>
> What do you think?

IMHO, it is too specific for Org core.
What we might do is allow setting :follow function for file: links. We
generally aim to remove hard-coded link types from `org-link-open',
exposing them to `org-link-set-parameters'.

For example, see WIP patch where we expose setting id: link properties:
https://list.orgmode.org/orgmode/c98a38b0-6dea-4b5c-b00f-a39ea9225...@app.fastmail.com/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Month-week and quarter-week datetrees (RFC and package announcement)

2023-12-31 Thread Ihor Radchenko
Jack Kamm  writes:

> https://gitlab.com/jackkamm/org-grouped-weektree
>
> I'd appreciate feedback on 2 points:
>
> 1. Are any of these datetree formats worth upstreaming into org-mode
>proper?

That would make sense.

> 2. Can we add a public interface for `org-datetree--find-create', and
>are there any suggestions on how to do it?
>
> Regarding #2, an ugly aspect of my current implementation is the abuse
> of the private function `org-datetree--find-create'. I also pass in
> the week or quarter for the DAY and MONTH arguments of this function,
> though I note that `org-datetree-find-iso-week-create' does something
> similar in its implementation.

The API of `org-datetree--find-create' is generally very limiting.
It would be nice to come up with something less limiting.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Suggestion to add hook to be run when org-indent completes a buffer's initialization

2023-12-31 Thread Ihor Radchenko
dark.key8...@151e.ai writes:

> Although there are some workarounds for the particular issue above, a cleaner 
> solution would be org-indent calling some hook at the end of the preparation. 
> As per link above, jdtsmith proposes to add such call in 
> org-indent-initialize-buffer:
>
>  ;; Job is complete: un-agentize buffer.
>(unless interruptp
>  (setq org-indent-agentized-buffers
>(delq buffer org-indent-agentized-buffers))
>(run-hook-with-args 'org-indent-buffer-init-finished buffer)) ;; 
> <-- added

I do not see why we shouldn't add such a hook. Patches welcome!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Adding functionality to org-latex-classes

2023-12-31 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> I was just wondering whether it would be possible to add further
> functionality to org-latex-classes and would like to start a discussion ;-)
>
> My use case is the following:
>
> The document class is tightly coupled with  ~org-latex-subtitle-format~
> and  ~org-latex-subtitle-separate~. Koma-script classes, for example, need
> those variables to be defined with file or directory local variables in
> order to take full profit of the layouts. If we found a way of
> accommodating them in the class definitions, the fuzz of the extra
> variables could easily be overcome.

We may extend `org-latex-classes' to allow custom backend option values.
For example,

  (latex-subtitle-format . value)
  (latex-subtitle-separate . value)

Then, we can use these values as the overrides when the variables are
not set explicitly as buffer-locals or as in-buffer/subtree export
keywords.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug

2023-12-31 Thread Ihor Radchenko
Morgan Smith  writes:

> lisp/org-agenda.el (org-agenda-get-scheduled): Consolidate deadline
> fetching code.  Don't check if deadline is shown when
> 'org-agenda-skip-scheduled-if-deadline-is-shown' has a value of
> 'repeated-after-deadline'.
>
> Currently when 'org-agenda-skip-scheduled-if-deadline-is-shown' has a
> value of 'repeated-after-deadline' then there is no effect.  This is
> because when 'org-agenda-get-scheduled' is run on later dates, the
> previous deadlines are not put in 'deadline-pos'.

May you please provide a detailed reproducer demonstrating the bug you
are trying to fix? Such reproducer could be a basis of a new test.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] org-babel-demarcate-block: duplicate switches too

2023-12-31 Thread Ihor Radchenko
gerard.vermeu...@posteo.net writes:

> The purpose of this patch is to duplicate switches when 
> org-babel-demarcate-block
> duplicates headers (meaning point in the source block when demarcating).

Thanks for the patch!
Would you mind also adding a test for `org-babel-demarcate-block' in
testing/lisp/test-ob.el?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] M-x org-lint gives spurious warning when file contains a link with percent-encoded url [9.6.13 ( @ /home/user/.emacs.d/elpa/org-9.6.13/)]

2023-12-31 Thread Ihor Radchenko
Suhail Singh  writes:

> Running M-x org-lint on an org file with below contents results in a
> spurious "Link escaped with obsolete percent-encoding syntax" warning.
>
> #+begin_src org
> * org-lint url percent-encoding syntax warning
> [[https://www.example.com?param=hello%20world][test url]]
> #+end_src
>
> I would expect the above org file to not yield any warnings.

This is because spaces do not have to be escaped in the link path.
The warning is to assist users of the pre Org 9.3 link syntax.
See https://orgmode.org/worg/org-release-notes.html#orgbb3ee64

Please note that this link warning is marked as low-trust. So, if you
use percent-escaped syntax deliberately (as in the example), you may
ignore this warning ("i" in org-lint buffer).

Not a bug.
Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Set Python shell in Org edit buffer

2023-12-31 Thread Ihor Radchenko
Jack Kamm  writes:

>> What might be more robust is to provide an explicit "start session
>> from Org Src buffer" command for ob-python and re-bind `run-python' to
>> this command in Org Src buffers.
>
> We could refactor `org-babel-python-initiate-session-by-key' to call a
> separate `org-babel-python-run-python' interactive command that wraps
> `run-python', and then rebind `run-python' to it in a local minor mode
> for ob-python Src buffers, which could be started in
> `org-babel-edit-prep:python'.
>
> But I'm not sure if it's worth the hassle, or if d0d838b02 already
> addresses the concern sufficiently?

For ob-python, there is little difference. I am thinking in a more
general context of all the babel backends that support sessions.

python.el is convenient as it allows setting the session buffer name in
advance via buffer-local variable. Then, all the normal python-mode
commands, including `run-python' or `python-shell-send-region' will work
as expected. However, other babel backends like ob-R do not have such a
luxury (see the dance with renaming R process buffer in
`org-babel-R-initiate-session').

That's why I thought about remapping `run-python' and all the equivalent
commands for other backends.

However, as in the above example, `run-python' is not the only mean to
initiate session in various major modes - sending a line or region at
point is another common command; and they might be others. Not to
mention that re-binding is not panacea - people may still run the
original commands via M-x.

So, re-binding is probably not the best idea.
In other words, `org-babel-python-run-python' is not necessary.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Change default ob-python session command to match run-python

2023-12-31 Thread Ihor Radchenko
Jack Kamm  writes:

> Thanks for the feedback! I attach a followup patch in response. If all
> looks good, I will squash before applying.

LGTM.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at