[BUG] conda doesn't work in ob-shell sessions

2023-02-13 Thread Matt


  On Sun, 12 Feb 2023 22:16:16 -0500  Jack Kamm  wrote --- 
 
 > But I also noticed another prompt-related issue: conda doesn't seem to
 > work in ob-shell sessions anymore. That is a bigger problem for my use
 > case.

Could you elaborate?

It looks like conda has a new init (from what I remember) which requires users 
to run a `conda init ' command in order to create a new environment.  
For example, I needed to run `conda init bash.'  This added garbage to my 
.bashrc which automatically enabled the base environment.  I was able to do 
this from ob-shell, however it required me to reload the shell (I reloaded 
Emacs to be sure I got the latest environment variables).  After this, I was 
able to create and activate a new conda environment.

1. M-x shell
2. Executing the following in sequence:

#+begin_src emacs-lisp
(org-version nil t)
#+end_src

#+RESULTS:
: Org mode version 9.6.1 (release_9.6.1-250-ge6353d @ 
/home/user/Projects/org-mode/lisp/)

#+begin_src emacs-lisp
(org-babel-do-load-languages
  'org-babel-load-languages
  '((shell . t)))
#+end_src

#+begin_src sh :session *shell* :results output
conda create --yes --name myenv python=3.9
#+end_src

#+RESULTS:
#+begin_example


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

conda activate myenv

To deactivate an active environment, use

conda deactivate
#+end_example

#+begin_src sh :session *shell* :results output
conda activate myenv
#+end_src

#+RESULTS:

#+begin_src sh :session *shell* :results output
which python
#+end_src

#+RESULTS:
: /home/user/miniconda3/envs/myenv/bin/python

The *shell* buffer's prompt also showed the expected [myenv] prefix.



Re: [External] : [RFC] If you use Org 9.6, please share the output of M-x org-element-cache-hash-show-statistics

2023-02-13 Thread Daniel Ortmann

11.99% of cache searches hashed, 12.16% non-hashable.

13 hours, 20 minutes, 43 seconds

On 2/9/23 05:51, Ihor Radchenko wrote:

Hi,

I would like to assess the efficiency of one of search optimizations used
in org-element.el [1]

The statistics about efficiency is collected by Org, but obviously not
shared without your consent.

If you are ok with sharing the statistics, and you are running Emacs
session for at least few hours (using Org mode, obviously), please reply
sharing the output of
  M-x org-element-cache-hash-show-statistics 
  M-x emacs-uptime 

[1] Pugh [Information Processing Letters] (1990) Slow optimally balanced
  search strategies vs. cached fast uniformly balanced search strategies.
  
https://urldefense.com/v3/__http://dx.doi.org/10.1016/0020-0190(90)90130-P__;!!ACWV5N9M2RV99hQ!JwEvxu0CggVEXgYmfXdxPXq0nYdBMMbQ3NzQ6pTShxTfCLwft_6uaHlG2rbztwtljiKyvCyPZJDkkaaGDGJo$






Re: Problem with let/cl-letf binding stuff with org-capture

2023-02-13 Thread Bruno Barbier


Ihor Radchenko  writes:

> Note that Emacs 29 has `read-string-from-buffer'.

I completely missed the fact that it was already in Emacs.

I'll definitely use the string-edit version (the version
with callbacks).

Thanks Ihor.

Bruno



Re: Problem with let/cl-letf binding stuff with org-capture

2023-02-13 Thread Bruno Barbier
Arthur Miller  writes:

> Bruno Barbier  writes:
>
>>
>
> That looks very nice indeed. I am not aware of that package, I will definitely
> use it somewhere, sometime. But with that we are getting now into 1K extra 
> sloc
> solution. With this experiment, I was mostly interesting to see how I can 
> re-use
> what already is in Emacs. Lisps are great for prototyping and writing new
> software. Legend says that Steele was cranking out 10 intepreters a week at 
> his
> time :). I don't know how true it is, just read it in some blog, but the
> point is that we are rather typing fast new pieces instead of learning how
> to re-use stuff, which in the long run I believe is a bad habit, since we are
> debugging bits that does the same what someone else already debugged. Don't 
> get
> me wrong, I have nothing against using someones package, certainly not
> with-editor, seems like a good package; I am just talking about programming in
> general.

... And the piece of code, that I just wrote and sent, was already
available in Emacs (see Ihor's email). I've definitely failed to do my
research before coding ... I definitely get your point! :-)

> This was also me trying to get better in Emacs Lisp, but I have to admit I am 
> a
> bit dissapointed we can't just override function bindings with cl-flet. 
> Function
> slot is just another slot :).
>
> I am using cl-labels and cl-flet myself to introduce "local" functions, to not
> pollute global namespace (symbol table), which they are good for, and to keep
> code local where it is used, and I think they are also slightly more clear 
> then
> lambdas. They are good for that, unfortunately it is a bit of dissapoitment 
> that
> we can't locally bind functions slots other then actually overriding them 
> globally.

Since I've learned that cl-flet and cl-labels are local lexically, I'm
using them more and more: that removes lot of noisy funcalls, compare to
lambdas.


> And for the last time: I am not using this version of read-string, I don't 
> need
> it myself; it was just me thinking how to implement something after reading a
> blog post. Anyway, thanks for the input, it was valuable to me.

Got it. Thanks for your patience and your valuable inputs too.

And I'm definitely going to use the version that is in Emacs. Thanks for
this too.

best,

Bruno



[BUG] shell sessions started outside of Babel broken

2023-02-13 Thread Matt
  On Sat, 11 Feb 2023 15:56:00 -0500  Jack Kamm wrote --- 

 > By the way, I took a look at ob-shell for the first time in awhile, and
 > noticed that ob-shell now forces the prompt to be like:
 > 
 > org_babel_sh_prompt>
 > 
 > Which I think makes cleaning up the prompt markers a lot more
 > robust. But it is a bit ugly, and also seems to break working with shell
 > sessions started outside of Babel with M-x shell.

Can you please elaborate?

The following does what I expect it to:

1. M-x shell
2. Call `org-ctrl-c-ctrl-c' on the following block in a separate Org buffer:

#+begin_src sh :session *shell*
echo "hello, world!"
#+end_src

#+RESULTS:
| hello | world! |

Are you doing something different?



Link type in org-mode, but with org-roam ?

2023-02-13 Thread Cletip Cletip
Hello everyone.

I apologize in advance for :
- my org-mode philosophy (my ideas may be totally stupid, meaningless, or
even contrary to the original org-mode philosophy)
- my knowledge of the mailing-list (my mail may be badly organised, badly
indented, the code unclear etc)
- any other point that might irritate you because of my lack of knowledge
of certain things
- the length of this mail
- for my bad bad bad english

 I'm going to get straight to the point and try to be as concise as
possible, just for context: I've been using org-mode every day for at least
2 years. I want to make it my personal knowledge/information manager. I
understand code relatively quickly, I understand less when it comes to
writing it. I've done a lot of research on note-taking methods... well, you
can see my profile I think.
So, my goal: to make a concise system with org-mode, org-roam, org-attach,
org-agenda etc... a "classic" goal for some of us :).
I won't describe any of the tools mentioned here, it would make the mail
much too long.

The problem: need to make "queryable" notes to do more or less complex
operations. For example, run the code of all headings/notes that have the
tag "ubuntu", to allow me to reinstall my computer for example. This
problem is trivial to solve with tags (a simple "dolist" is enough), but
tags will not always be enough... So you need to be able to store
"value-key" data, in order to make "select me all the people with a phone
number starting with 06" queries. This works perfectly well with this:
https://github.com/d12frosted/vulpea#metadata.


This gives things of the following conceptual form:
note1(where the metadata is stored) -> relationship -> note2/OrValue.

What is stored in the database must be only the IDs (not the titles of the
note for example), but the description is there for the user. This allows
not to have a controlled vocabulary: when searching, we look for a note id,
and not a string. On the other hand, what is displayed to the user in the
notes is the description, which is very practical.

note1 is therefore the id of a note (in the org-roam sense).
Relation is the id of the "metadata"/type of the desired relation.
And note2/Value is the value of the relationship, which may be an id of
another note or just a value.
In practice, it is therefore in this form:
- [[id:20230112135328669948][Name you want, but respect the idea of the
concept behind the id]] :: [[id:20220617105453042719][Another note]]
- [[id:20230112135328669948][a metadata only with a value]] :: just a value

The concept is close to the "In-Buffer Settings", with a "#+": it's a
key-value. Except that In-Buffer Settings, org-mode can't understand that
there is a link or something else, org-mode understands just a string,
which will be parsed to modify org-mode's behaviour on that file, or for a
export, etc.

Concrete example: if I want to store all my music (eache music = a note
with an attached file), I have two choices:
- I put the tag "music", in the org-roam sense (i.e. "#+filetag: #music")
for each note.
- But, this amounts to writing: aMusic relation(here, "tagged with" for
example) note2 or in practice: - [[idOfTaggedwith][tag]]:
[[idOfTheConceptOfMusic][music]]. So we can make the following request:
give me the notes with the metadata "idOfTaggedwith" with the value
"idOfTheConceptOfMusic" (because, I remind you, only ids are stored. Just
make a convenient interface for the user, and he won't even need to think
about ids).

Conceptually and omitting the other usefulness of In-Buffer Settings, it's
exactly the same thing.

Furthermore, I think this problem is part of a more global problem: they
are "typed links". They can be called by many names: link tags
https://org-roam.discourse.group/t/add-link-tags-feature/171, link types,
relational links, etc. If someone has the "right" name to describe this...

And therein lies my real problem: I haven't found a single good solution to
achieve this. This problem is mostly related to org-roam, but org-roam is
based on org-mode, that's why I'm writing here.
I thought of the following solution, so I'd like to have some opinions.
Main idea: make a link type that would be recognized not by "X:path" with X
= link type, but by a regular expression, where if X respects a certain
format, it is recognized as a relationship.

As you know, external links can be of the form "X:path", where X equals id,
file, gnus etc. Note: Org-roam stores all types of links.
So we can make the following type of links:
[[A:B][description]]
where
- A is the id of a note known by org-roam
- B is the id of a note, or string, or numeric value, etc
- description is a description (what a precision)

This allows org-roam to store the type of the relationship, A, and the
value of the relationship, B. So we can make queries like: "all notes where
idOfTaggedwith = idOfTheConceptOfMusic".

Implementation (functional on my side. It took me a lot of time, because I
didn't know the org-mode code. But it's 

feature request - clock gaps and overlaps in different colors

2023-02-13 Thread Laurenz Wiskott
Dear All,

I have a suggestion that should be really easy to realize and help a lot.

In the agenda view one can show clock gaps and overlaps with the 'v c' command. 
 Both are
shown in the same color.  However, for me gaps occur very often and naturally 
and usually
don't hurt while overlaps really indicate an error.  I have recently gone 
through a whole
year to check for overlaps.  This would have been much easier if the colors 
would have
been different.  Gaps in blue, overlaps in red, for instance.  I know there are 
also
other events, such as 'No end time' or if the time is unusually long.  Maybe 
one could
use different color for all of these.

Best, Laurenz.




[FR] Use empty ***** heading to indicate folding depth in org-cycle for a subtree (was: new org mode, changed folding behavior could be improved / more consistent)

2023-02-13 Thread Ihor Radchenko


[ Adding Org ML back to CC ]

Please, use reply-all in future when replying to emails in the mailing
list. Otherwise, the discussion will not be seen by other Org developers
and interested users.

Laurenz Wiskott  writes:

>> #+STARTUP: show3levels
>
> trick does not seem to work with version 9.5.2 yet.  It would also open the 
> whole file.

Indeed, I am talking about the latest Org.

> But what I want is to TAB on a headline, and it only opens up to some 
> predefined depth.
> 'ESC 3 SHIFT-TAB' does the trick for level 3, for instance.  With my 
> proposal, using an
> initial line with three stars, I currently save the 'ESC 3 SHIFT-'.  I know 
> it is
> considered unintended behavior.  But nobody seems to have complained about 
> this 'bug',
> thus I suggest to just leave it in there and recover it also on the global 
> level, where
> it currently does not work anymore.  But anyhow, if you don't like it, I can 
> also live
> with 'ESC 3 SHIFT-TAB' instead of jut 'TAB'.

Note that you may achieve what you want in personal config with appropriate 
`org-cycle-hook'.

I am renaming this to feature request. I see not great need to add and
_maintain_ this feature, unless more people are interested.

The suggested idea, AFAIU, is

* Top heading
empty heading indicating to what level 'children cycle state is
revealing the headings.
***
** Sub 1 
*** Sub 1.1 
*** Sub 1.1.1 
** Sub 2 

If one starts from

* Top heading...

and 

it is suggested to display

* Top heading
empty heading indicating to what level 'children cycle state is
revealing the headings.
***
** Sub 1
*** Sub 1.1...
** Sub 2

instead of current behavior with

* Top heading
empty heading indicating to what level 'children cycle state is
revealing the headings.
***
** Sub 1...
** Sub 2

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



[FR] Side-by-side images during export (was: [BUG] Org-mode Side-by-Side Images [9.5.3 (release_9.5.3-3-gd54104)])

2023-02-13 Thread Ihor Radchenko
Gustaf Waldemarson  writes:

>   Does something like that already exist in org-mode? Alternatively,
>   what is the recommended and most portable approach to placing images
>   side-by-side?

No, AFAIK.

There are two problems:
1. We currently lack object-granular control over export attributes.
   Attributes for images are set for the whole paragraph and Org uses a
   paragraph starting with image as a special case, assigning paragraph
   to the image.
2. There is no easy universal way to create side-by-side images for all
   possible backends. The best thing we might provide is merging
   multiple images into one using, for example, a LaTeX minipage export
   to create merged image to be included into the exported document.

Patches welcome!
This feature is requested from time to time.

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