Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Any review comments about this patch?

I have sent the following comment shortly after your followup:

"Christopher M. Miles"  writes:

> +   ;; variable's value is a list from org-mode passed table 
> or list.
> +(if (listp (cdr (car vars)))
> ...
> +   (format "(let [%s]\n%s)"
> +   (mapconcat
> +(lambda (var)
> +  (format "%S '%S" (car var) (cdr var)))
> +vars
> +"\n  ")

Do I miss something, or you only test the first variable assignment here?
What if there are multiple assignments (:var a=X,b=Y)?

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



Re: Transclusion of SVG files in org-export?

2022-10-28 Thread Ihor Radchenko
"Zoe Piel"  writes:

> I use interactive SVG elements in my org notes and wish to have these 
> elements embedded in the HTML export. There has been previous discussion 
> about how SVG elements should be handled in ox-html. For my needs, neither 
>  nor  is desirable, because while they show the graphical 
> component of SVG, they break other SVG functionality like hyperlinks.
>
> Until recently, a function I found on Stack Overflow 
> (https://emacs.stackexchange.com/questions/29871/how-to-embed-svg-output-of-org-mode-src-block-as-inline-svg-in-html-export)
>  was working well to transclude the full SVG source into the HTML when 
> exporting (e.g. this page: 
> http://magicscience.info/20210821080707-how_to_embed_handwritten_content_in_your_org_roam_site.html)
>  
>
> However, when I went to rebuild the site recently, the resulting HTML no 
> longer includes the SVG source inline. Instead, there is a line of text with 
> an href to the file. 
>
> Were changes made to org export recently that would have broken the SVG 
> embedding function I was using?

Sorry for the late reply.
I suspect that you experienced the same issue with discussed in
https://list.orgmode.org/orgmode/87o7uhp1n7@lrde.epita.fr/

If not, please provide some more details. See
https://orgmode.org/manual/Feedback.html#Feedback

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



Re: issue using org-export-before-parsing-hook in a src-block

2022-10-28 Thread Ihor Radchenko
John Kitchin  writes:

> If I run this block in an org file:
>
> #+BEGIN_SRC emacs-lisp
> (let ((org-export-before-parsing-hook '((lambda (_backend) nil
>   (org-org-export-as-org))
> #+END_SRC
>
> I get a traceback that starts with
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>   goto-char(nil)
>   (if existing-result (goto-char existing-result) (goto-char
> (org-element-property :end inline)) (skip-chars-backward " \11"))
>
> that seems to originate in
>
>   org-babel-insert-result(# ("value" "replace")
> ("emacs-lisp" "(let ((org-export-before-parsing-hook '((lambda (_..."
> ((:colname-names) (:rowname-names) (:result-params "value" "replace")
> (:result-type . value) (:results . "value replace") (:exports . "both")
> (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no")
> (:tangle . "no") (:eval . "never-export")) "" nil 1 "(ref:%s)") nil
> "emacs-lisp")
>
> If I put :results silent that doesn't happen. Is this a bug?

Thanks for reporting, and sorry for the late reply.
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c70a422082eca3545adc73ba4905360bb6d371b7

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



Re: [BUG] Org mode treat tags as links

2022-10-28 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> I defined a custom link type "video:".
>
> And when I added tag "video" in tags like bellowing:
>
> #+begin_src org
> * headline 1 :tag1:video:hello
> #+end_src

Note that this particular example actually contains a link. Because you
forgot the closing ":" in the tags.

I guess you meant

* headline 1 :tag1:video:hello:

> It caused the tag ":video:" parsed and recognized as link. Here is the 
> screenshot:
> I suppose the link parsing need to be improved.

This is fontification error.
You can examine the parser state by issuing M-: (org-element-context) with
point at the "link". It is correctly recognized as a headline with no link.

The error is due to limitations in our current implementation of
fontification. Will be fixed in
https://orgmode.org/list/87ee7c9quk.fsf@localhost

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



Re: [BUG] ob-octave.el

2022-10-28 Thread Ihor Radchenko
Tobias Zawada  writes:

> Currently, evaluating the Org-mode source block
>
> #+NAME: bug
> #+BEGIN_SRC octave :exports results
> ["one"; "two"; "three"]
> #+END_SRC
>
> gives
>
> #+RESULTS: bug
> : ottnwheor  e  e
>
> Substituting ~fprintf~ in ~org-babel-octave-wrapper-method~ with ~fdisp~ 
> changes the output to
>
> #+NAME: bug
> #+BEGIN_SRC octave :exports results
> ["one"; "two"; "three"]
> #+END_SRC
>
> #+RESULTS: bug
> | one   |
> | two   |
> | three |
>
> which is more adequate.

Thanks for reporting, and sorry for the late reply.
Your suggestion looks fine, although I am a bit concerned if the
trailing newline in the old version was significant.

Can you please test the attached patch when the output long and occupies
multiple lines? (I am not familiar with octave)

Best,
Ihor

>From ac15cc43b0f755da186301c826c74a8010b3f8a9 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sat, 29 Oct 2022 13:48:45 +0800
Subject: [PATCH] ob-octave: Fix octave :results value parsing

* lisp/ob-octave.el (org-babel-octave-wrapper-method): Use fdisp
instead of fprintf.

Reported-by: Alexandre Duret-Lutz 
Link: https://orgmode.org/list/217078597.347872.1639979694...@email.ionos.de
---
 lisp/ob-octave.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 55926b789..b0a7767ec 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -61,7 +61,7 @@ (defvar org-babel-matlab-emacs-link-wrapper-method
 ")
 (defvar org-babel-octave-wrapper-method
   "%s
-if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
+if ischar(ans), fid = fopen('%s', 'w'); fdisp(fid, ans); fclose(fid);
 else, dlmwrite('%s', ans, '\\t')
 end")
 
-- 
2.35.1



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


Re: couldn't org-table-create-with-table\.el respect hline

2022-10-28 Thread Ihor Radchenko
Uwe Brauer  writes:

>>> Couldn't in the last step the hlines be respected?
>
>> That would not make sense.
>> AFAIK, table.el has no notion of hlines. The +---+ separators in
>> table.el tables mark cell boundaries, not hlines.
>
> It would make sense if I later want to export the final table (after 
> converting org-->table-->org

org-->table conversion is not reversible. hlines are not part of
table.el syntax and cannot be retained.

> To say latex. There the hlines make a difference, that is why I am asking

I recommend using native Org tables.

Do you need a specific table.el feature that you miss in native Org tables?

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



Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Christopher M. Miles

Any review comments about this patch?

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> I bellowing example:
>
> #+begin_src org
> ,#+NAME: ob-clojure-table-test
> | a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
>
> ,#+NAME: ob-clojure-table-test-2
> | a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
>
> ,#+begin_src clojure :var kk=ob-clojure-table-test :var 
> kk2=ob-clojure-table-test-2 :results output
> (println kk2)
> (println kk)
> ,#+end_src
>
> #+end_src
>
> Without this patch, it will report error "class java.lang.ClassCastException" 
> from CIDER.
>
> This patch added if condition to handle this table, list type data.
>
> From 948e8c1ff2c9ba1d9c0fe26f9bdaa096bef80a9d Mon Sep 17 00:00:00 2001
> From: stardiviner 
> Date: Sat, 9 Apr 2022 21:14:22 +0800
> Subject: [PATCH] ob-clojure.el: Fix header argument :var binding passed table
>  or list data
>
> * lisp/ob-clojure.el (org-babel-expand-body:clojure): Add if condition
> to handle source block :var passed org-mode table or list data for
> clojure let-binding to avoid java.lang.ClassCastException.
> ---
>  lisp/ob-clojure.el | 25 ++---
>  1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
> index 5a44b6487..e6614b2d9 100644
> --- a/lisp/ob-clojure.el
> +++ b/lisp/ob-clojure.el
> @@ -101,13 +101,24 @@
>(and (cdr (assq :ns params)) (format "(ns %s)\n" ns))
>;; Variables binding.
>(if (null vars) (org-trim body)
> -(format "(let [%s]\n%s)"
> -(mapconcat
> - (lambda (var)
> -   (format "%S %S" (car var) (cdr var)))
> - vars
> - "\n  ")
> -body))
> +   ;; variable's value is a list from org-mode passed table 
> or list.
> +(if (listp (cdr (car vars)))
> +   (format "(let [%s]\n%s)"
> +   (mapconcat
> +(lambda (var)
> +  (format "%S '%S" (car var) (cadr var)))
> +vars
> +"\n  ")
> +   body)
> + ;; else, the header argument variable's value is not a 
> list.
> + (format "(let [%s]\n%s)"
> + (mapconcat
> +  (lambda (var)
> +(format "%S %S" (car var) (cdr var)))
> +  vars
> +  "\n  ")
> + body)
> + ))
>  (if (or (member "code" result-params)
>   (member "pp" result-params))
>   (format "(clojure.pprint/pprint (do %s))" body)
> -- 
> 2.35.1
>
> [5. text/x-patch; 
> 0001-ob-clojure.el-Fix-header-argument-var-binding-passed.patch]...


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

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


signature.asc
Description: PGP signature


Re: when exporting to odt or html, latex equations are not exported when in soure block: BUG?

2022-10-28 Thread Ihor Radchenko
Uwe Brauer  writes:

> So what shall I do then? I have an org file with matlab source code and latex 
> formula, having the latex formula surrounded by a block as in 
> #+begin_src latex :results latex replace :exports results :eval t
> \begin{equation}
> \label{eq:windeln-29-08-22:1}
> \int
> \end{equation}
> #+end_src
>
> Results in nice fortification. However sometimes I need to export the org 
> file to odt/html and would like to have the mathematical formula translated, 
> so what would be the best strategy?

Just use :results raw. Org understands latex environments natively.
See 12.5.1 LaTeX fragments section of the manual.

-- 
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-set-tags-command active region bug

2022-10-28 Thread Ihor Radchenko
Alex Giorev  writes:

> When `org-loop-over-headlines-in-active-region' is 'start-level, the
> command should loop only over the headings having the same level as the
> first one, but it loops over all headings in the region. This patch fixes
> the issue.

Thanks for reporting and providing the patch!
I have applied an equivalent patch that uses the code style more similar
to other places in Org where `org-loop-over-headlines-in-active-region'
is handled.

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=78806952218e87f4a413a29c908161f97572f97d

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



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Max Nikulin

On 29/10/2022 06:07, Samuel Wales wrote:

i am still lost in this and it will take me a while.

..

it is not a top priority for me at this time as long as the ff
org-capture extension works


Samuel, feel free came back with this question when you will have enough 
spare time and motivation to continue. Currently I am unsure with which 
pieces of the puzzle you still have difficulties.


I would separate the following cases:
- Emacs
- Application having dedicated plugins (Firefox works if I got it right)
- Other applications

As to Emacs, perhaps emacs-help mailing list is the appropriate place to 
ask how to add global mouse action. E.g. is it possible to add a button 
to modeline? If I am not mistaken, Emacs-28 has an option to enable 
right click menu similar to other applications.


For other applications, since you have a requirement of maximized 
application window and purely mouse action, I am unsure if you managed 
to configure fluxbox to add a custom menu entry accessible in such 
layout. By default only window and toolbar menu are available.


A tiny custom application displaying a tray icon might be a way to 
initiate capture through mouse click. Unsure if Emacs can add such icon.






Re: ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)

2022-10-28 Thread Ihor Radchenko
Daniel Kraus  writes:

> Looking in the history, Christopher added session support 5 years ago,
> then (3 years ago) I see Bastien also adding something with initiate-session 
> but
> then removing all session support the following commit.
> I guess something was broken and got removed but stayed in the test?
>
> Does anyone remember what's the status of ob-clojure session support?

We have documented session support in
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
Therefore, Org users assume that sessions are supported.

If Bastien removed session support, and you do not see any justification,
it was most likely an oversight. We generally avoid feature regressions:
https://bzg.fr/en/the-software-maintainers-pledge/

So, if sessions are currently not supported, it should be considered a
bug and fixed. Let me know if you need any help with the fix.

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



Re: [PATCH] lisp/ob-tangle.el, lisp/ob-core.el: Add strip-tangle noweb option

2022-10-28 Thread Ihor Radchenko
Daniel Ziltener  writes:

>> Could you please follow
>> https://orgmode.org/worg/org-contribute.html#commit-messages for the
>> commit log entries?
> I tried to follow that. To follow it "more" I guess I have to make one 
> commit per file I changed? There isn't an example for multiple files, so 
> I was not sure how exactly to follow it.

See https://orgmode.org/worg/org-contribute.html#org5bd92c9. Basically,
you need to provide changed function/variable/section name in the
changelog.

When you make the same change in multiple files, just do something like

* lisp/org-capture.el (org-capture-set-plist):
* doc/org.texi (Capture): .

>> Also, do you have FSF copyright assignment? If no, you also need to add
>> TINYCHANGE cookie to the commit message. See
>> https://orgmode.org/worg/org-contribute.html#first-patch
> I do, yes, I sent in the signed form on Wednesday as requested by the FSF.

Great!
They should reply within 5 working days. If they don't, you can followup
with them and wait another 5 days. If that also does not work, let us
know.

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



[BUG] Org mode treat tags as links

2022-10-28 Thread Christopher M. Miles

I defined a custom link type "video:".

And when I added tag "video" in tags like bellowing:

#+begin_src org
* headline 1 :tag1:video:hello
#+end_src

It caused the tag ":video:" parsed and recognized as link. Here is the 
screenshot:


I suppose the link parsing need to be improved.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

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


signature.asc
Description: PGP signature


Re: [PATCH] Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-28 Thread Ihor Radchenko
Max Nikulin  writes:

> On 28/10/2022 10:15, Ihor Radchenko wrote:
>> 
>> See the attached tentative patch.
>> I tried to balance between annoying users with query and not evaluating
>> unsafe code: '-quoted lists and symbols are still evaluated without
>> prompt.
>> 
>> Let me know if you see any potential issues.
>
> If I got it right, it prompt user for every variable. I believed that 
> single prompt is enough for both header arguments and body evaluation. 
> Maybe I missed some issue with dependent code blocks. If I remember 
> correctly, each block causes a prompt and I am not going to dispute such 
> behavior. Unsure if early prompt may increase user confusion since some 
> blocks will be evaluated not immediately after related prompt but 
> perhaps after some delay to confirm dependent code.

You are right that a separate prompt will be shown for each eval form,
even when multiple :var assignments are present in the header arguments.

I could try to patch the higher-level function that is causing the
"pwned" in your example, but I figured that org-babel-read is actually
used in many more places and thus similar issue could occur in different
scenarios. Displaying prompt in org-babel-read is the safest approach I
managed to come up with.

What can help here is the feature request about bulk-yes/bulk-no code
prompts:
https://list.orgmode.org/orgmode/l-mfSe5KD9g7LPdD7qHPtqtjBD45DK8OeOqO6ybMWqoXG-oEQAFjlW1V1N1NtJQBWM_A4CeGT_92rpSKF7Aq0KRzsNmMZfAJnAbyVWeCjoA=@protonmail.ch/

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



Re: [PATCH v2 1/2] lisp/org-clock.el: Make switching states on clock-in/-out easier

2022-10-28 Thread Ihor Radchenko
"Samuel W. Flint"  writes:

> IR> Before we continue, could you please confirm if you have FSF copyright
> IR> assignment? My records show that you have made two commits to Org mode
> IR> previously, and they total LOC is 15, which is maximum allowed
> IR> contribution that does not require copyright assignment. See
> IR> https://orgmode.org/worg/org-contribute.html#copyright
>
> I've sent in the assignment, but I'm waiting on the FSF's response & a
> waiver/documentation from my employer.

Good to hear. Note that FSF should reply within 5 working days.

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



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Max Nikulin

On 29/10/2022 09:59, Ihor Radchenko wrote:

Max Nikulin writes:


%(org-get-x-clipboard 'PRIMARY)
"
  :immediate-finish t)

However to be at the safe side I would check if (org-get-x-clipboard
'PRIMARY) value is not nil at first.


My approach to this is simply showing a popup with captured heading
after capture. If anything is wrong, I can quickly notice.

Not sure if it is suitable for Samuel though.


I started with a small wrapper that checks if Emacs server is running 
and creates a new frame if it does not exist yet. So I avoided a pitfall 
with empty string instead of selection. I intentionally do not use 
:immediate-finish to inspect capture and to add some comment.


Samuel wish to have minimal distraction: no sound, no popup window, 
Emacs window is not raised in front of current application, visual 
notification should disappear after some pause.


That is why I believe that additional checks are required in such silent 
workflow to avoid missed data in notes.






Re: Org 9.6-pre and Bash sessions

2022-10-28 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

>> I do not think that it is a good idea.  Code block execution may
>> involve a whole chain of blocks when expanding references. If we wipe
>> the error buffer and multiple blocks are failing, some errors may go
>> unnoticed by the user.
>
> In that case, can we prepend a newline instead of appending it?  That
> way, the tests would look "more normal" and the buffer content would
> have the content one would expect, with no "hanging whitespace".

Feel free to change it in the patch together with tests.

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



[FR] Display stderr contents after executing shell blocks (even when stdout :results output is requested) (was: Org 9.6-pre and Bash sessions)

2022-10-28 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> I do not think that it make sense to display that buffer when the code
>> finishes successfully. I can see this kind of behaviour
>> breaking/spamming automated scripts or export---code working in the
>> past may throw error output into unsuspecting users.
>
> But the exit code has nothing to do with the standard error.
>
> Unix programs can, and often do, halt with non-zero exit codes while
> producing error output containing important information, such as
> deprecation warnings.  Further, many programs use error output as the
> alternative "anything but the result" stream.
>
> Preserving user data, instead of trashing it, data does not count as
> "spamming ... unsuspected users".  On the contrary!
>
> For example, I use a program for work that uploads data to a certain
> 3rd-party server.  It exits with a zero code but also shows extremely
> important notices on error output.  As an "unsuspecting user", if I used
> Babel to run the program, I would end up in a trouble.
>
> So, we should never implicitly trash user-generated data, let alone
> based on a "completely made up" belief that a non-zero exit code somehow
> implies "no important error output".  It does not.
>
> (I speak only about Unix-like systems here.  Perhaps on other operating
> systems, things work differently.)

Dear All,

As explained in the above quote, it may be reasonable to display stderr
in the shell (and possibly other) src blocks upon execution.

+ Stderr may contain important information even if the code block
  succeeds
- Displaying stderr will raise *Error* buffer, which may or may not be
  expected or desired.

What do you think?

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



Re: [PATCH] two small fixes for org-fast-tag-selection

2022-10-28 Thread Ihor Radchenko


Thanks for the patches, and sorry for the late reply.

Alex Giorev  writes:

> - The first patch fixes the problem of TODO keywords and tags sharing keys
> when they are automatically generated and when
> `org-fast-tag-selection-include-todo' is set.

Could you please show minimal examples that demonstrate the problem you
are trying to fix?

> - The problem solved by the second patch is the following: when invoking
> the fast selection interface, and pressing the key of a tag, the tag is
> highlighted to indicate it has been selected, but pressing the key again
> doesn't unhighlight it.

On my side, the tag does get unenlightened even without the patch (on
the latest main).

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



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Ihor Radchenko
Samuel Wales  writes:

> not sure i am following everything but it seems a popup that goes away
> after a very short period of time shows adequately that first contact
> was made with emacs.  then, including the captured text shows that
> there isn't another issue?

Let me elaborate.

What I have in mind is org-capture-before-finalize-hook.
Functions in this hook is executed at the end of the capture process
before the capture buffer is killed. You may reasonably assume that the
capture is successful if the hook is run.

Functions in org-capture-before-finalize-hook have access to the
contents of the capture buffer text. So, one can call `start-process' to
run notify-send shell command and put the actual captured text into the
notification (displayed briefly or for longer time according to the
switches passed to notify-send).

When notify-send displays notification, you can quickly eyeball if the
captured text is what you intended to capture without opening Emacs.

Hope it is more clear.

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



Re: incorrect indentation of new item inserted with capture template

2022-10-28 Thread Ihor Radchenko
Ian Garmaise  writes:

> I have had this problem for several months.
>
> I keep a daily journal.  Each morning I add a new entry in a journal file
> using a capture template.  The journal file is always loaded.
> On some occasions the indentation of the new entry is incorrect.
>
> Here's an example of incorrect indentation:
>
> *** 2021-12-05 Sunday
>
> - item 1
> - item 2
>
> * 2021-12-06 Monday
>
> What I usually do is undo the insertion and reissue the command.
> This always works.

Sorry for the late reply.
I am unable to reproduce the problem of the latest main.

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



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Samuel Wales
not sure i am following everything but it seems a popup that goes away
after a very short period of time shows adequately that first contact
was made with emacs.  then, including the captured text shows that
there isn't another issue?

On 10/28/22, Ihor Radchenko  wrote:
> Max Nikulin  writes:
>
>> %(org-get-x-clipboard 'PRIMARY)
>> "
>>  :immediate-finish t)
>>
>> However to be at the safe side I would check if (org-get-x-clipboard
>> 'PRIMARY) value is not nil at first.
>
> My approach to this is simply showing a popup with captured heading
> after capture. If anything is wrong, I can quickly notice.
>
> Not sure if it is suitable for Samuel though.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Ihor Radchenko
Max Nikulin  writes:

> %(org-get-x-clipboard 'PRIMARY)
> "
>  :immediate-finish t)
>
> However to be at the safe side I would check if (org-get-x-clipboard 
> 'PRIMARY) value is not nil at first.

My approach to this is simply showing a popup with captured heading
after capture. If anything is wrong, I can quickly notice.

Not sure if it is suitable for Samuel though.

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



Re: org-x11idle-exists-p with emacs --daemon

2022-10-28 Thread Ihor Radchenko
Julien Cubizolles  writes:

> Ihor Radchenko  writes:
>
>> Does the attached patch work for you?
>
> Yes it does, thanks.

Thanks for testing!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a51bb2c448bab7665667471aa227e3e25dbbdced

> Also, org-user-idle-seconds uses (eq window-system 'x) which according
> to its docstring should be replaced by (display-graphic-p).

I do not think so.
org-user-idle-seconds is not about graphics, but about the window
system being used. Now, we have special handling for Mac and X11 and
fall back to universally working, though not accurate,
`org-emacs-idle-seconds'.

> I've tested
> the change and it's working, with the added advantage that it works
> both in a X11 and in a wayland session (provided your
> org-clock-x11idle-program-name works in both, mine does).

Is there a way to detect wayland build? Does window-system have any
special value on the gtk build? If yes, we can introduce
wayland-specific variable.

> There is another use of window-sytem in the org-mode source, namely in
> org-get-x-clipboard in org-compat.el, but I don't know if it's safe to
> make the switch there.

AFAIR, clipboard in Wayland is not the same as in X and might have bugs
https://orgmode.org/list/1902025.jDVfpnRRgo@pluto

I am not sure if `gui-get-selection' is going to work on Wayland. The
docstring says:

 Return the value of an X Windows selection.

Wayland is not X Windows...

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



Re: Line breaks and brackets in LaTeX export

2022-10-28 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Then [0pt] should it be. At least for now, before we have a cleaner
> solution.
>
> See the attached patch.

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b93a61af9c93d21c56cf883630e52f36076e40bd

I will look into filtering out unnecessary [0pt] instances later.
The patch here is more urgent as it avoids the known case of breakage.

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



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Samuel Wales
i am still lost in this and it will take me a while.  although it
would be great to have everywhere, such as in emacs also with r click,
it is not a top priority for me at this time as long as the ff
org-capture extension works [i wrote the original when it did not work
for me] beecuse ff is the biggest plaec i need it and it would make a
good backup system and i hope i did not give the impression that it is
an urgent need.

as for fluxbox, it is just the .menu file and not a tray application.
pretty straightforward.  :)

On 10/28/22, Max Nikulin  wrote:
> On 28/10/2022 15:39, Dr. Arne Babenhauserheide wrote:
>> Max Nikulin writes:
>>
>>> Then you should always have an X11 Emacs frame, maybe behind other
>>> windows
>>
>> This sounds like a tray application. Do you know whether something like
>> that already exitst (mark one frame as system tray entry)?
>
> I was trying to say that Samuel should not be affected by the case when
> X selection can not be obtained from Emacs due to absence of frames
> (terminals) having type "x".
>
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Org 9.6-pre and Bash sessions

2022-10-28 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> I do not think that it make sense to display that buffer when the code
> finishes successfully. I can see this kind of behaviour
> breaking/spamming automated scripts or export---code working in the
> past may throw error output into unsuspecting users.

But the exit code has nothing to do with the standard error.

Unix programs can, and often do, halt with non-zero exit codes while
producing error output containing important information, such as
deprecation warnings.  Further, many programs use error output as the
alternative "anything but the result" stream.

Preserving user data, instead of trashing it, data does not count as
"spamming ... unsuspected users".  On the contrary!

For example, I use a program for work that uploads data to a certain
3rd-party server.  It exits with a zero code but also shows extremely
important notices on error output.  As an "unsuspecting user", if I used
Babel to run the program, I would end up in a trouble.

So, we should never implicitly trash user-generated data, let alone
based on a "completely made up" belief that a non-zero exit code somehow
implies "no important error output".  It does not.

(I speak only about Unix-like systems here.  Perhaps on other operating
systems, things work differently.)

> I do not think that it is a good idea.  Code block execution may
> involve a whole chain of blocks when expanding references. If we wipe
> the error buffer and multiple blocks are failing, some errors may go
> unnoticed by the user.

In that case, can we prepend a newline instead of appending it?  That
way, the tests would look "more normal" and the buffer content would
have the content one would expect, with no "hanging whitespace".

Rudy
-- 
"Genius is 1% inspiration and 99% perspiration."
p-- Thomas Alva Edison, 1932

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: Org mode, Org Mode, Org-mode or Org-Mode?

2022-10-28 Thread Ihor Radchenko
Marcin Borkowski  writes:

> What is the "official" version?  I found at least two spelling on
> orgmode.org...

If we look into doc/Documentation_Standards.org:

- Prefer "Org mode" to "Org-mode" or "org-mode".  This is simply
  because it reflects an existing convention in [[info:emacs:Top][The Emacs 
Manual]] which
  consistently documents mode names in this form - "Text mode",
  "Outline mode", "Mail mode", etc.

It is _the_ convention.

Another question is whether we actually follow it everywhere...

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



Re: org-x11idle-exists-p with emacs --daemon

2022-10-28 Thread Julien Cubizolles
Ihor Radchenko  writes:

> Does the attached patch work for you?

Yes it does, thanks.

Also, org-user-idle-seconds uses (eq window-system 'x) which according
to its docstring should be replaced by (display-graphic-p). I've tested
the change and it's working, with the added advantage that it works
both in a X11 and in a wayland session (provided your
org-clock-x11idle-program-name works in both, mine does).

There is another use of window-sytem in the org-mode source, namely in
org-get-x-clipboard in org-compat.el, but I don't know if it's safe to
make the switch there.
-- 
Julien Cubizolles




Re: Org mode, Org Mode, Org-mode or Org-Mode?

2022-10-28 Thread Kaushal Modi
On Fri, Oct 28, 2022, 4:25 PM Marcin Borkowski  wrote:

> What is the "official" version?  I found at least two spelling on
> orgmode.org...
>
> TIA,
>

Here's my personal take on that topic:
https://scripter.co/how-do-i-write-org-mode/

>


Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Daniel Kraus


Bastien  writes:

> Daniel Kraus  writes:
>> I would set it to (and (executable-find "bb") 'babashka) so it's still nil
>> when babashka is installed?
> (You mean "not installed", right?)

Of course.

>> Or we could even test more available backends like
>>
>> (cond
>>  ((executable-find "bb") 'babashka)
>>  ((executable-find "nbb") 'nbb)
>>  ((featurep 'cider) 'cider)
>>  ((featurep 'inf-clojure) 'inf-clojure)
>>  ((featurep 'slime) 'slime))
>>
>> Or is that too much "magic" in that on some systems the default is bb
>> and in others it's cider etc?
>
> I think this is acceptable magic: perhaps we should first check what
> is done in other Babel languages and align with their level of magic
> for guessing the correct executable -- but I suspect Clojure is a bit
> special here, in that it has a lot of different options.

I looked around a bit but couldn't find another babel package with a
similar problems, i.e. that some backends are completely different
and not just changing the name of the executable.

I think I'll go with the big `cond` above to auto-detect what's
installed. That's probably the best out-of-the-box experience.

Cheers,
  Daniel



Re: Org mode, Org Mode, Org-mode or Org-Mode?

2022-10-28 Thread Juan Manuel Macías
Marcin Borkowski writes:

> What is the "official" version?  I found at least two spelling on
> orgmode.org...

Interesting question. When I don't write carelessly I try to write "Org
Mode", but it's more out of habit. The wikipedia entry says "Org-mode".
The Google entry for orgmode.org says "Org mode", however the title of
the website says "Org Mode".

I imagine this disparity is also shared by other famous Emacs modes,
where you see them written in various ways...

Best regards,

Juan Manuel 



Org mode, Org Mode, Org-mode or Org-Mode?

2022-10-28 Thread Marcin Borkowski
What is the "official" version?  I found at least two spelling on
orgmode.org...

TIA,

-- 
Marcin Borkowski
http://mbork.pl



Re: Still prob the I cannot solve....

2022-10-28 Thread Bruno Barbier
Renato Pontefice  writes:

>
> So, now I’m sure about what what file are executed. But unsure what could be 
> the prob!
..
> What does they means?

Like Ihor told you in your other thread, you have a mistake in your
init.el.

Maybe somebody could help you if you show us your init.el.

The problem is at the position 972 (char position).

Brunp



Re: [PATCH] Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-28 Thread Max Nikulin

On 28/10/2022 10:15, Ihor Radchenko wrote:


See the attached tentative patch.
I tried to balance between annoying users with query and not evaluating
unsafe code: '-quoted lists and symbols are still evaluated without
prompt.

Let me know if you see any potential issues.


If I got it right, it prompt user for every variable. I believed that 
single prompt is enough for both header arguments and body evaluation. 
Maybe I missed some issue with dependent code blocks. If I remember 
correctly, each block causes a prompt and I am not going to dispute such 
behavior. Unsure if early prompt may increase user confusion since some 
blocks will be evaluated not immediately after related prompt but 
perhaps after some delay to confirm dependent code.



diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 518831ec6..e10ab401c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -3165,7 +3165,16 @@ (defun org-babel-read (cell  inhibit-lisp-eval)
((and (not inhibit-lisp-eval)
  (or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
  (string= cell "*this*")))
-(eval (read cell) t))
+ ;; Prevent arbitrary function calls.
+ (if (and (memq (string-to-char cell) '(?\( ?`))
+  (not (org-babel-confirm-evaluate
+  ;; See `org-babel-get-src-block-info'.
+  (list "emacs-lisp" (format "%S" cell)
+'((:eval . yes)) nil (format "%S" cell)
+nil nil
+ ;; Not allowed.
+ (user-error "Evaluation of elisp code %S aborted." cell)
+  (eval (read cell) t)))
((save-match-data
(and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
 (not (string-match "[^\\]\"" (match-string 1 cell)








Still prob the I cannot solve....

2022-10-28 Thread Renato Pontefice
When I start emacs, now I receive this messages:

Warning (initialization): An error occurred while loading 
‘/Users/renatopontefice/.emacs.d/init.el’:

Symbol's value as variable is void: Enable

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
Disable logging
——

So, now I’m sure about what what file are executed. But unsure what could be 
the prob!
I’ve started it with the digested option (—debug-init) and I’ve received that 
messages…

Debugger entered--Lisp error: (void-variable Enable)
  eval-buffer(# nil "/Users/renatopontefice/.emacs.d/init.el" 
nil t)  ; Reading at buffer position 972
  load-with-code-conversion("/Users/renatopontefice/.emacs.d/init.el" 
"/Users/renatopontefice/.emacs.d/init.el" t t)
  load("/Users/renatopontefice/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #) #f(compiled-function () #) t)
  command-line()


What does they means?


Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Max Nikulin

On 28/10/2022 15:39, Dr. Arne Babenhauserheide wrote:

Max Nikulin writes:


Then you should always have an X11 Emacs frame, maybe behind other
windows


This sounds like a tray application. Do you know whether something like
that already exitst (mark one frame as system tray entry)?


I was trying to say that Samuel should not be affected by the case when 
X selection can not be obtained from Emacs due to absence of frames 
(terminals) having type "x".






Re: [PATCH v2 1/2] lisp/org-clock.el: Make switching states on clock-in/-out easier

2022-10-28 Thread Samuel W. Flint
> Ihor Radchenko writes:

IR> "Samuel W. Flint"  writes:
>> * lisp/org-clock.el (org-clock-in-switch-to-state,
>> org-clock-out-switch-to-state): Allow
>> `org-clock-{in,out}-switch-to-state` to be an alist of
>> current/next-state pairs.
>> 
>> (org-clock-in, org-clock-out): Add logic to handle
>> `org-clock-{in,out}-switch-to-state` as alists.

IR> Thanks!

IR> Before we continue, could you please confirm if you have FSF copyright
IR> assignment? My records show that you have made two commits to Org mode
IR> previously, and they total LOC is 15, which is maximum allowed
IR> contribution that does not require copyright assignment. See
IR> https://orgmode.org/worg/org-contribute.html#copyright

I've sent in the assignment, but I'm waiting on the FSF's response & a
waiver/documentation from my employer.

>> "Set task to a special todo state while clocking it.
>> The value should be the state to which the entry should be
>> -switched.  If the value is a function, it must take one
>> -parameter (the current TODO state of the item) and return the
>> -state to switch it to."
>> +switched.  It may also be an alist of `(CURRENT . NEXT)' pairs.

IR> Maybe "`(CURRENT . NEXT)' TODO state pairs"? It will be slightly more
IR> clear.

>> (defcustom org-clock-out-switch-to-state nil
>> "Set task to a special todo state after clocking out.
>> The value should be the state to which the entry should be
>> -switched.  If the value is a function, it must take one
>> -parameter (the current TODO state of the item) and return the
>> -state to switch it to."

IR> Same here.

I can adjust that as well.  That would definitely clarify the documentation

IR> The rest looks good.

IR> If you can, please also add tests.

I'll try my hand at it!

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

Sam

-- 
Samuel W. Flint
4096R/FA13D704
  (F50D 862B 4F65 5943 A8C2  EF0E 86C9 3E7A FA13 D704)
λs.(s s) λs.(s s)
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



Re: couldn't org-table-create-with-table\.el respect hline

2022-10-28 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> I start with 
>> 
>> 
>> 
>> | Example | Text| Dates| other   |
>> |-+-+--+-|
>> | this| comment | <2022-01-28 vie> | nothing |
>> 
>> 
>> That is converted to 
>> 
>> 
>> 
>> +-+-+--+-+
>> | Example | Text| Dates| other   |
>> +-+-+--+-+
>> | this| comment | <2022-01-28 vie> | nothing |
>> +-+-+--+-+
>> 
>> 
>> And is converted back to 
>> 
>> 
>> | Example | Text| Dates| other   |
>> | this| comment | <2022-01-28 vie> | nothing |
>> 
>> 
>> Couldn't in the last step the hlines be respected?

> That would not make sense.
> AFAIK, table.el has no notion of hlines. The +---+ separators in
> table.el tables mark cell boundaries, not hlines.

It would make sense if I later want to export the final table (after converting 
org-->table-->org

To say latex. There the hlines make a difference, that is why I am asking

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/


smime.p7s
Description: S/MIME cryptographic signature


Re: when exporting to odt or html, latex equations are not exported when in soure block: BUG?

2022-10-28 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> Hi 
>> 
>> I run a relative recent GNU Emacs and org master, however please
>> consider the following example:
>> 
>> When exporting to html or odt (using dvipng in both cases) the first set
>> of equations in the source block are ignored.
>> 
>> Can somebody please confirm this, and tell me whether I should open a
>> BUG report.
>> ...
>> * A source block provides to export latex equations
>> #+begin_src latex :results latex replace :exports results :eval t

> Of course, the source block is ignored.
> According to 16.6 Results of Evaluation section of the manual,

> ‘latex’
>  Results enclosed in a ‘BEGIN_EXPORT latex’ block.  Usage example:
>  ‘:results value latex’.

> So, you are exporting results of the evaluation, which is latex export
> block. Such block will only get exported to latex. By definition.

So what shall I do then? I have an org file with matlab source code and latex 
formula, having the latex formula surrounded by a block as in 
#+begin_src latex :results latex replace :exports results :eval t
\begin{equation}
\label{eq:windeln-29-08-22:1}
\int
\end{equation}
#+end_src

Results in nice fortification. However sometimes I need to export the org file 
to odt/html and would like to have the mathematical formula translated, so what 
would be the best strategy?

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/


smime.p7s
Description: S/MIME cryptographic signature


Re: org roam database not available

2022-10-28 Thread Fraga, Eric
On Friday, 28 Oct 2022 at 13:32, Ihor Radchenko wrote:
> Looking into the code, I'd expect such message when SQLite compilation
> fails. Try to run (emacsql-sqlite-compile 2) directly. The errors should
> become visible then.

Thank you.  This was very helpful.

The backtrace on failure told me that updating a package on MELPA
doesn't necessarily re-initialise the package and so some variables
point to the wrong place, emacsql-sqlite-data-root in particular in this
case.  I had to re-start Emacs, something I'm loathe to do very
often; okay, I guess I didn't actually have to re-start as I could
have re-compiled the files in the emacsql-sqlite package... ;-)

Thanks again,
eric

-- 
: Eric S Fraga, with org release_9.5.5-1028-gcd835d in Emacs 29.0.50


Re: org roam database not available

2022-10-28 Thread Ihor Radchenko
"Fraga, Eric"  writes:

> anybody else experiencing any problem with org roam, specifically
> getting the following error message?
>
> ,
> | emacsql-sqlite-ensure-binary: No EmacSQL SQLite binary available, aborting
> `
>
> I have re-installed emacs-sqlite from MELPA but it doesn't build the
> database executable.  What am I missing?

Looking into the code, I'd expect such message when SQLite compilation
fails. Try to run (emacsql-sqlite-compile 2) directly. The errors should
become visible then.

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



Re: Org 9.6-pre and Bash sessions

2022-10-28 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

>>> 1. ob-shell/error-output-after-success
>>>
>>>We seem to trash error output, such as warnings, on success.  I
>>>think we should not do this.  Now, on the execution of "echo X
>>>&>2", Org says "Code block produced no output."  But that does
>>>hold true.  The block did produce output, just on the other output
>>>stream, namely error output.
>
>> Trashing error output is expected by default. [...] I suggest you to
>> read through [...] ob-shell follows the spec here.
>
> I get that ':results output' makes Org capture standard output, but not
> error output, for its #+RESULTS.  However, if you look at the test in
> question, you will see that it expects error output in the *Org-Babel
> Error Output* buffer, not in the #+RESULTS.  We should not trash error
> output; it belongs in the *Org-Babel Error Output* buffer.

I do not think that it make sense to display that buffer when the code
finishes successfully. I can see this kind of behaviour breaking/spamming
automated scripts or export---code working in the past may throw error
output into unsuspecting users.

>>> 3. ob-shell/exit-codes
>>>
>>>Should we add a newline after the exit code message?
>
>> Done.
>
> I updated the tests and now every string needs a final newline, which
> does not seem correct.  If we let the tests guide our design, all
> becomes clear.  Buffers that use the 'compilation-mode' never append
> data on re-execution.  Instead, they clear the buffer.
>
> Thus, we should
>
>   1. undo this change and instead
>   2. call 'org-babel-eval-wipe-error-buffer' before execution.

I do not think that it is a good idea.
Code block execution may involve a whole chain of blocks when expanding
references. If we wipe the error buffer and multiple blocks are failing,
some errors may go unnoticed by the user.

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



org roam database not available

2022-10-28 Thread Fraga, Eric
Hello all,

anybody else experiencing any problem with org roam, specifically
getting the following error message?

,
| emacsql-sqlite-ensure-binary: No EmacSQL SQLite binary available, aborting
`

I have re-installed emacs-sqlite from MELPA but it doesn't build the
database executable.  What am I missing?

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.5-1028-gcd835d in Emacs 29.0.50


Re: Org 9.6-pre and Bash sessions

2022-10-28 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

>> 1. ob-shell/error-output-after-success
>>
>>We seem to trash error output, such as warnings, on success.  I
>>think we should not do this.  Now, on the execution of "echo X
>>&>2", Org says "Code block produced no output."  But that does
>>hold true.  The block did produce output, just on the other output
>>stream, namely error output.

> Trashing error output is expected by default. [...] I suggest you to
> read through [...] ob-shell follows the spec here.

I get that ':results output' makes Org capture standard output, but not
error output, for its #+RESULTS.  However, if you look at the test in
question, you will see that it expects error output in the *Org-Babel
Error Output* buffer, not in the #+RESULTS.  We should not trash error
output; it belongs in the *Org-Babel Error Output* buffer.

>> 2. ob-shell/error-output-after-failure

> Now done in [...]

Thanks!  This works *correctly* now.

>> 3. ob-shell/exit-codes
>>
>>Should we add a newline after the exit code message?

> Done.

I updated the tests and now every string needs a final newline, which
does not seem correct.  If we let the tests guide our design, all
becomes clear.  Buffers that use the 'compilation-mode' never append
data on re-execution.  Instead, they clear the buffer.

Thus, we should

  1. undo this change and instead
  2. call 'org-babel-eval-wipe-error-buffer' before execution.

Rudy
-- 
"The whole science is nothing more than a refinement of everyday
thinking."
-- Albert Einstein, 1879-1955

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: Error on opening emacs

2022-10-28 Thread Ihor Radchenko
Renato Pontefice  writes:

> When I run emacs, I receive the following error:
> Warning (initialization): An error occurred while loading 
> ‘/Users/renatopontefice/.emacs.d/init.el’:
>
> Symbol's value as variable is void: Enable

There is something wrong (most likely, some stray text) inside your
init.el (configuration file).
It would help if you can share it.

> To ensure normal operation, you should investigate and remove the
> cause of the error in your initialization file.  Start Emacs with
> the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
> Disable logging
>
> So I open it wit the sidestep option .
> —debug-init. ùAnd I receive the following message

You missed "--". Should be --debug-init, not -debug-init.

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



Re: Hoe cs Idetect wich emacs is links on my dock?

2022-10-28 Thread Ihor Radchenko
Renato Pontefice  writes:

> But now I don’t know wich emacs run on my emac. I would find wich on is 
> because I would  substitute the init.el of the present emacs, with the one 
> I’ve customized  it this time
> How can I retrive the right emacs I use?

If you have an Emacs running, you can always type M-x emacs-version to
find out the Emacs version.

You can also find which configuration file is being used by checking the
value of user-init-file variable (C-h v user-init-file ).

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



Error on opening emacs

2022-10-28 Thread Renato Pontefice
When I run emacs, I receive the following error:
Warning (initialization): An error occurred while loading 
‘/Users/renatopontefice/.emacs.d/init.el’:

Symbol's value as variable is void: Enable

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
Disable logging

So I open it wit the sidestep option .
—debug-init. ùAnd I receive the following message


Debugger entered--Lisp error: (void-variable Enable)
  eval-buffer(# nil "/Users/renatopontefice/.emacs.d/init.el" 
nil t)  ; Reading at buffer position 972
  load-with-code-conversion("/Users/renatopontefice/.emacs.d/init.el" 
"/Users/renatopontefice/.emacs.d/init.el" t t)
  load("/Users/renatopontefice/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #) #f(compiled-function () #) t)
  command-line()
  normal-top-level()


Cn someone tell me where I the error?

TIA

Renato


Hoe cs Idetect wich emacs is links on my dock?

2022-10-28 Thread Renato Pontefice
Hi,
With the prob I have had yesterday, I’ve deleted emacs and reinstall (brew…
But now I don’t know wich emacs run on my emac. I would find wich on is because 
I would  substitute the init.el of the present emacs, with the one I’ve 
customized  it this time
How can I retrive the right emacs I use?

Thank you


T
Remato


Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Bastien
Hi Daniel,

Daniel Kraus  writes:

> I would set it to (and (executable-find "bb") 'babashka) so it's still nil
> when babashka is installed?

(You mean "not installed", right?)

> Or we could even test more available backends like
>
> (cond
>  ((executable-find "bb") 'babashka)
>  ((executable-find "nbb") 'nbb)
>  ((featurep 'cider) 'cider)
>  ((featurep 'inf-clojure) 'inf-clojure)
>  ((featurep 'slime) 'slime))
>
> Or is that too much "magic" in that on some systems the default is bb
> and in others it's cider etc?

I think this is acceptable magic: perhaps we should first check what
is done in other Babel languages and align with their level of magic
for guessing the correct executable -- but I suspect Clojure is a bit
special here, in that it has a lot of different options.

Thanks for taking care of this,

-- 
 Bastien



Re: ob-clojure session support

2022-10-28 Thread Bastien Guerry
Hi Daniel,

Daniel Kraus  writes:

> Does anyone remember what's the status of ob-clojure session
> support?

I'm randomly connected for the next days so I won't risk a reply here,
I hope others can help.

-- 
 Bastien



Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Daniel Kraus
Hi!

Bastien Guerry  writes:
> For now `org-babel-clojure-backend' is nil.
>
> I suggest to set it to babashka by default: babashka is stable and
> well established now, it is by far the most efficient way to run
> Clojure code.  Also, it is particularily suitable for Babel use.
>
> What do you think?

Sounds good.
I would set it to (and (executable-find "bb") 'babashka) so it's still nil
when babashka is installed?

Or we could even test more available backends like

(cond
 ((executable-find "bb") 'babashka)
 ((executable-find "nbb") 'nbb)
 ((featurep 'cider) 'cider)
 ((featurep 'inf-clojure) 'inf-clojure)
 ((featurep 'slime) 'slime))

Or is that too much "magic" in that on some systems the default is bb
and in others it's cider etc?

Cheers,
  Daniel



ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)

2022-10-28 Thread Daniel Kraus


Ihor Radchenko  writes:

> make test BTEST_POST="-L /path/to/cider.el" BTEST_OB_LANGUAGES="clojure" 
> BTEST_RE="ob-clojure"
>
> Note that our tests demand cider executable and library.
> Testing with external libraries is a bit manual.

Thanks. I think cider is falsely required in the test.
It tests session support which I don't think ob-clojure has.

Looking in the history, Christopher added session support 5 years ago,
then (3 years ago) I see Bastien also adding something with initiate-session but
then removing all session support the following commit.
I guess something was broken and got removed but stayed in the test?

Does anyone remember what's the status of ob-clojure session support?

Cheers,
  Daniel



Re: Error opening an .org file

2022-10-28 Thread Tim Cross


Juan Manuel Macías  writes:

> Renato Pontefice writes:
>
>> I’ve edited and commented all the lines of it. And The error
>> persist. So (was you told)maybe the error is not of init.el
>> But I’m unable to run emacs from termnal.
>> How can I do?
>> I’m in Mac osx 12.6.1 where do I can find emacs?
>
> Renato, I'm not a Mac user, but I imagine it will be like any other
> Unix: you have to launch a terminal from your desktop (i guess there
> will be in macos an app called "terminal" or something like that), and
> once inside the terminal, just type:
>
> emacs --debug-init
>
> and press enter. Emacs (GUI) will open and you should pay attention to
> the error messages that Emacs will show you. That will give you a clue
> as to where the error is in your Emacs startup.
>

It has been a while since I used macOS. However, how you start emacs in
a terminal depends on how emacs was installed and which version of
emacs.

Note that the emacs which macOS includes is VERY old (I think it is
Emacs 21). This is really too old to be useful these days. You need to
install a current version of Emacs. My recommendation would be to use
homebrew to do this. However, I fear, based on the questions ask, the
OPs familiarity of the OS is likely to make installing homebrew and then
emacs a bit challenging to do via email. Certainly would be off topic
for the org mode list. Possibly better help would be available via the
emacs help list. I would try to help further, but I don't have a working
macOS system at present, so cannot refresh/verify the steps to get
sufficient clarity to be helpful. 



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-28 Thread Dr. Arne Babenhauserheide

Max Nikulin  writes:

> Then you should always have an X11 Emacs frame, maybe behind other
> windows

This sounds like a tray application. Do you know whether something like
that already exitst (mark one frame as system tray entry)? Code the
other way round (emacs *as* system tray) seems to already exist in EXWM:
https://wiki.archlinux.org/title/EXWM#System_tray

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-28 Thread Bastien Guerry
Hi Daniel,

Daniel Kraus  writes:

> Just in case you want to play around with Clojure, installing
> babashka (https://github.com/babashka/babashka) is a single binary
> and very simple to install.

For now `org-babel-clojure-backend' is nil.

I suggest to set it to babashka by default: babashka is stable and
well established now, it is by far the most efficient way to run
Clojure code.  Also, it is particularily suitable for Babel use.

What do you think?

-- 
 Bastien



Re: Tikz ugly hack

2022-10-28 Thread edgar

On 2022-10-26 09:58, Fraga, Eric wrote:
I wonder if, instead of a new LaTeX command you create a new 
environment

which you can then invoke using org special blocks?  For instance,

#+begin_BoundingBox

#+attr_latex: :height 1cm
[[image file]]

#+end_BoundingBox

--- snip 8< ---


Oh, I don't know how to do that, but it's good to know that at some 
point I can create it. Thanks!




Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-28 Thread Dr. Arne Babenhauserheide

Ihor Radchenko  writes:

> "Dr. Arne Babenhauserheide"  writes:
>
>> One idea that could work well is to add an explicit allow-list
>> trusted-sources-to-allow-unsafe-modes with entries of domain and
>> path-prefix where people can add trusted sources.
>>
>> If for example my server were draketo.de,¹ I could set this list to
>>
>> '(("https://www.draketo.de; "/software"))
>>
>> and when I would then open a link like
>>
>>   https://www.draketo.de/software/advent-of-wisp-code-2021.org
>>
>> with eww, it would directly switch to org-mode.
>
> I am a bit lost about the aim of this tread, but let me share some
> existing remote resource controls we have employed on the latest Org:

> (defun org--safe-remote-resource-p (uri)
>   "Return non-nil if URI is considered safe.
> This checks every pattern in `org-safe-remote-resources', and
> returns non-nil if any of them match."

> You can check the implementation at
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el#n4540

That’s pretty awesome! Thank you!

So we could have companywide shared setupfiles without granting
ssh-access to machines …

… and to the topic: this may be something that could be re-used in eww.
Though I would prefer having a less-intrusive notification than a y-n
question; maybe just a message in the echo area that with a specific
command this uri could be marked as safe and then get interpreted as org
right away.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: [PATCH] lisp/ob-tangle.el, lisp/ob-core.el: Add strip-tangle noweb option

2022-10-28 Thread Daniel Ziltener

Am 28.10.22 um 04:19 schrieb Ihor Radchenko:

dzilte...@lyrion.ch writes:


From: Daniel Ziltener 

* ob-tangle.el, ob-core.el, test-ob-tangle.el, org-manual.org: Add a
"strip-tangle" noweb option to strip the noweb tags when tangling, but
keep and expand them otherwise.

Thanks for the patch!

If I understand correctly, you are suggesting

Could you please follow
https://orgmode.org/worg/org-contribute.html#commit-messages for the
commit log entries?
I tried to follow that. To follow it "more" I guess I have to make one 
commit per file I changed? There isn't an example for multiple files, so 
I was not sure how exactly to follow it.

Also, do you have FSF copyright assignment? If no, you also need to add
TINYCHANGE cookie to the commit message. See
https://orgmode.org/worg/org-contribute.html#first-patch

I do, yes, I sent in the signed form on Wednesday as requested by the FSF.

+- =strip-tangle= ::
+
+  Expansion of noweb syntax references in the body of the code block
+  when evaluating or exporting. Removes noweb syntax references
+  when tangling.

This is a new feature and thus should also be mentioned in etc/NEWS.

Also, please use double space between sentences. See
doc/Documentation_Standards.org.

Noted, I'll do both of these.

(let ((allowed-values (cl-case context
- (:tangle '("yes" "tangle" "no-export" "strip-export"))
- (:eval   '("yes" "no-export" "strip-export" "eval"))
- (:export '("yes")
+ (:tangle '("yes" "tangle" "no-export" "strip-export" 
"strip-tangle"))
+ (:eval   '("yes" "no-export" "strip-export" "eval" 
"strip-tangle"))
+ (:export '("yes" "strip-tangle")

AFAIU, you are suggesting a new value for :noweb header argument.
But this function has nothing to do with :noweb. This change will check
for :tangle strip-tangle, :eval strip-tangle, and :export strip-tangle.
What is the purpose?
I suppose then I made a mistake there. My intention was what you mention 
next:

Also, the allowed values of standard header args are defined in
org-babel-common-header-args-w-values, which you did not change.

I will adjust that one instead.


OpenPGP_0x752C7F031AADF16F.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-28 Thread Jean Louis
* Ihor Radchenko  [2022-10-28 06:19]:
> Jean Louis  writes:
> 
> > * Max Nikulin  [2022-10-27 06:21]:
> >> Expected result:
> >> No code from the Org buffer and linked files is executed prior to
> >> confirmation from the user.
> >
> > Should that be or is it a general policy for Org mode?
> 
> Yes, it is a general policy.
> Org should not execute arbitrary Elisp without confirmation, unless the
> user customizes the confirmation query to non-default.

✔️ That is nice to know. It opens doors for browsing Org files within Emacs.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/