Re: bi-lingual text

2023-03-11 Thread Uwe Brauer

> Uwe Brauer  writes:

Hi


> `2C-mode' might be what you want.  Be warned, though, that it might be
> confusing when first using it, and that there might be missing
> information since I have just begun to explore it because of your
> message.

> (Also, there doesn't seem to be much documentation on 2C at all, except
> for in its source code?)

> Two caveats:

> 1.  Whenever you split using  s (M-x 2C-split RET), the split will
> happen at the current column, while *consuming* the previous char.  You
> can experiment with the command and see what I mean.

Thanks, 

> 2.  Currently, when you use  1 (M-x 2C-merge RET), the associated
> buffer is only minimised at the right side.  If a user wants to reuse
> the same assoc buffer when typing  s again, the user first has to
> hide the buffer (at least in my experience).

> What I tried:

> In "bilingual.org", type the following:

> * Bilingual
> Hello world.|!
> Good night.


> Here, "!" its not a character but means the cursor; "|" is the character
> before point, and will be used as the separator for the buffers.

> Then, run  s (M-x 2C-split RET).

> There should now be two buffers side-by-side.  Go to the right buffer
> and start typing.


> Bienvenue tout le monde.
> Bonne nuit.


> Then (in either buffer) run  1 (M-x 2C-merge RET).  Now the
> remaining buffer should read:

> * Bilingual
> Hello world.  |Bienvenue tout le monde.
> Good night.   |Bonne nuit.

> Hopefully this helps -- not only for you, but for those who, like me an
> hour ago, accidentally discovered 2C-mode but did not understand how to
> use it.

Very nice, I played around with a paragraph that contained longer
sentences. So one has however to be it careful with the length of the
lines. It might be wise to set fill column to something like 60.

But thanks for pointing this out to me, it remains me a bit of
scroll-all-mode, but this is definitely much nicer and more suited.

Uwe Brauer



-- 
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: bi-lingual text

2023-03-11 Thread General discussions about Org-mode.


Uwe Brauer  writes:

> Hi
>
> I would like to have a sort of side by side, paragraph based,
> representation of text in two languages, say Spanish and English, best
> would be org based of course.
>
> It does not to have to be anything fancy like inter-linear, I could use
> a simple table but that looks cumbersome.
>
> I searched the package system but could not really find anything.

`2C-mode' might be what you want.  Be warned, though, that it might be
confusing when first using it, and that there might be missing
information since I have just begun to explore it because of your
message.

(Also, there doesn't seem to be much documentation on 2C at all, except
for in its source code?)

Two caveats:

1.  Whenever you split using  s (M-x 2C-split RET), the split will
happen at the current column, while *consuming* the previous char.  You
can experiment with the command and see what I mean.

2.  Currently, when you use  1 (M-x 2C-merge RET), the associated
buffer is only minimised at the right side.  If a user wants to reuse
the same assoc buffer when typing  s again, the user first has to
hide the buffer (at least in my experience).

What I tried:

In "bilingual.org", type the following:

--8<---cut here---start->8---
* Bilingual
Hello world.|!
Good night.
--8<---cut here---end--->8---

Here, "!" its not a character but means the cursor; "|" is the character
before point, and will be used as the separator for the buffers.

Then, run  s (M-x 2C-split RET).

There should now be two buffers side-by-side.  Go to the right buffer
and start typing.

--8<---cut here---start->8---

Bienvenue tout le monde.
Bonne nuit.
--8<---cut here---end--->8---

Then (in either buffer) run  1 (M-x 2C-merge RET).  Now the
remaining buffer should read:

--8<---cut here---start->8---
* Bilingual
Hello world.  |Bienvenue tout le monde.
Good night.   |Bonne nuit.
--8<---cut here---end--->8---

Hopefully this helps -- not only for you, but for those who, like me an
hour ago, accidentally discovered 2C-mode but did not understand how to
use it.

--
Best,


RY



org-noter

2023-03-11 Thread Peter Mao
Dear Org maintainers:

I don't think org-noter is part of any official org distribution, having
been a MELPA-distributed package since inception (2017), but in the course
of discussing transfer of maintenance duties with Jonas Bernoulli (in his
MELPA-maintainer role), he suggested that we inform you of the impending
change to the maintenance of this package.

In short, Dmitry and I have stabilized new features brought into the code
since Gonçalos' last commit in 2019 and brought in CI and a few new
features ourselves.  We have tried to contact Gonçalos since early Dec
2022, but have not heard from him.

Here are links to the relevant "issue" tickets on MELPA and the original
org-noter repository where we have made our proposal to maintain the
project:
https://github.com/weirdNox/org-noter/issues/173
https://github.com/melpa/melpa/issues/8413

No action is needed on your part, but comments and suggestions are welcomed.

Peter


Re: [BUG] Inconsistent global/local :var assignments in ob-* for lisps and non-lisps (was: org-babel guile source block bug in handling multiple values)

2023-03-11 Thread Zelphir Kaltstahl

On 3/11/23 10:58, Ihor Radchenko wrote:

Zelphir Kaltstahl  writes:


The issue is not with defining via (define ...) inside a (let ...) in Guile. It
is about importing macros at the time, when the body of the (let ...) is already
evaluated, which is at a later phase than macro expansion. By wrapping inside a
(let ...) org has moved the import to a later phase, which causes the macro
(let-values ...) to not be expanded.

I see.
AFAIK, Elisp does not have this problem.


As far as I know, (defun ...) and (defvar ...) are merely defining functions and
variables, not macros.

Same for defmacro in Elisp.


My point is, that imports are usually global for sessions. But :var decided for
let-wrapping, moving them to a different place. Just like imports are usually
global, I would expect (define ...)s to be global in the session, unless I put
them inside a narrowed scope like a (let ...) myself. The org generated (let
...) is invisible to the user and thus confusing, at least for GNU Guile.

For other Schemes it probably all depends on how their phases of expansion and
evaluation work. I don't know enough about the Scheme standards, to tell,
whether Guile has the correct behavior here or whether there is a correct
behavior defined in the Scheme standards. Maybe someone more knowledgeable can
chime in to comment on that.

When saying Guile I mean scheme. Remember that I am now looking from a
more general perspective of other ob-* libraries.

My conclusion so far is that it is not safe in ob-scheme to use
let-binding. Other ob-* lisp implementations may be OK (at least,
ob-emacs-lisp is OK).

Now, the main question is whether it is safe to use `define' in all the
scheme implementations. If it is, would you be interested in turning
your personal fix into a patch for ob-scheme?


Sure! Would need to familiarize myself with with process of doing that, but why 
not.

I guess it would be a safer bet to await, whether the patch is what the general 
solution should be. Or would a patch be good to have, regardless of whether the 
official implementation changes or not, so that others can apply it perhaps, 
instead of putting something in their personal init file?


--
repositories: https://notabug.org/ZelphirKaltstahl




bi-lingual text

2023-03-11 Thread Uwe Brauer



Hi

I would like to have a sort of side by side, paragraph based,
representation of text in two languages, say Spanish and English, best
would be org based of course.

It does not to have to be anything fancy like inter-linear, I could use
a simple table but that looks cumbersome.

I searched the package system but could not really find anything.

Any ideas

Thanks and regards

Uwe Brauer 

-- 
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/




Re: [PATCH] Fix ob-latex.el command injection vulnerability.

2023-03-11 Thread lux
On Sat, 2023-03-11 at 10:47 +, Ihor Radchenko wrote:
> 
> I am afraid that we cannot make things universally safe here without
> breaking changes. The best way will be treating :cmd and similar
> header
> args as unsafe and include them into the planned safety prompt system
> we
> discussed in https://orgmode.org/list/87edsd5o89.fsf@localhost
> 

Ok, I'll undo this part of the changes first, and repost patch.
From b48784a16c5806694498f072ffdd98e5a3c144b5 Mon Sep 17 00:00:00 2001
From: Xi Lu 
Date: Sat, 11 Mar 2023 18:53:37 +0800
Subject: [PATCH] * lisp/ob-latex.el: Fix command injection vulnerability

(org-babel-execute:latex):
Replaced the `(shell-command "mv BAR NEWBAR")' with `rename-file'.
---
 lisp/ob-latex.el | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index a2c24b3d9..ce39628d6 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -218,17 +218,14 @@ This function is called by `org-babel-execute-src-block'."
 	(if (string-suffix-p ".svg" out-file)
 		(progn
 		  (shell-command "pwd")
-		  (shell-command (format "mv %s %s"
-	 (concat (file-name-sans-extension tex-file) "-1.svg")
-	 out-file)))
+  (rename-file (concat (file-name-sans-extension tex-file) "-1.svg")
+   out-file t))
 	  (error "SVG file produced but HTML file requested")))
 	   ((file-exists-p (concat (file-name-sans-extension tex-file) ".html"))
 	(if (string-suffix-p ".html" out-file)
-		(shell-command "mv %s %s"
-			   (concat (file-name-sans-extension tex-file)
-   ".html")
-			   out-file)
-	  (error "HTML file produced but SVG file requested")
+(rename-file (concat (file-name-sans-extension tex-file) ".html")
+ out-file t)
+  (error "HTML file produced but SVG file requested")
 	 ((or (string= "pdf" extension) imagemagick)
 	  (with-temp-file tex-file
 	(require 'ox-latex)
-- 
2.39.2



Re: [PATCH] Fix ob-latex.el command injection vulnerability.

2023-03-11 Thread Ihor Radchenko
lux  writes:

>> However, for example, (shell-quote-argument "-enhance -strip") will
>> return "-enhance\\ -strip", which is not what we want.
>> 
>> Similar problem with other instances of `shell-command' in Org where
>> header args supply command line arguments. Like in :cmdline.
>> 
>
> I think there is only a need to deal with the problem of `\\ ', for
> example:
>
> (string-replace "\\ " " " (shell-quote-argument im-in-options))

No. Quoting will also affect '"' and other '\'. We must not try to be
smart here. It will miss edge cases and be fragile in general.

> Any better suggestions? Thanks.

I am afraid that we cannot make things universally safe here without
breaking changes. The best way will be treating :cmd and similar header
args as unsafe and include them into the planned safety prompt system we
discussed in https://orgmode.org/list/87edsd5o89.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] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]

2023-03-11 Thread Ihor Radchenko
Max Nikulin  writes:

>>[previous object ]
>
> Yes, you do.
>
> I expected some complications due to newline characters (not line break 
> markup objects), but they are not included in :post-blank and 
> represented as "\n" string objects.

Newlines are tricky. They may or may not be significant.
For example, in CJK paragraphs, newlines are to be stripped.

I think that a reasonable thing to do could be not adding newlines if
the previous object is a plain string ending with a newline.

> Actually there is an issue with newline characters and ox-latex. 
> Stripping footnotes splits single paragraphs into 2 ones:
>
>  >8 
> #+options: f:nil
> First
> [fn::foot]
> Second
>  8< 
>
> So newlines should be handled somehow. Earlier I faced a similar issue with
> @@comment:export snippets@@
> and ox-latex.

This is latex-specific.
See the attached tentative fix.

>From 92800f77ea6389b531c4d96cc4b32ed5557aa47a Mon Sep 17 00:00:00 2001
Message-Id: <92800f77ea6389b531c4d96cc4b32ed5557aa47a.1678531087.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 11 Mar 2023 11:34:45 +0100
Subject: [PATCH] org-latex-paragraph: Ensure that paragraphs are not split by
 empty lines

* lisp/ox-latex.el (org-latex-paragraph): If export creates single
paragraph contents with empty lines, remove the empty lines to ensure
that we retain a single paragraph.

Reported-by: Max Nikulin 
Link: https://orgmode.org/list/tufdb6$11h2$1...@ciao.gmane.io
---
 lisp/ox-latex.el | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index b84fe89db..f31d94da2 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2980,7 +2980,14 @@ (defun org-latex-paragraph (_paragraph contents _info)
   "Transcode a PARAGRAPH element from Org to LaTeX.
 CONTENTS is the contents of the paragraph, as a string.  INFO is
 the plist used as a communication channel."
-  contents)
+  ;; Ensure that we do not create multiple paragraphs, when a single
+  ;; paragraph is expected.
+  ;; Multiple newlines may appear in CONTENTS, for example, when
+  ;; certain objects are stripped from export, leaving single newlines
+  ;; before and after.
+  (replace-regexp-in-string
+   (rx (1+ (0+ space) "\n")) "\n"
+   contents))
 
 
  Plain List
-- 
2.39.1


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


Re: [PATCH] Don't reset `org-todo-keywords-for-agenda' when org-agenda-multi

2023-03-11 Thread Ihor Radchenko
Tim Ruffing  writes:

> Yep, I had seen that whitespace is the issue in my initial email, but I
> had not noticed that tabs are used. So here's a third attempt, sorry
> for the hiccups.

Thanks!
Applied, onto main. I did not risk bugfix, because it is agenda, which
is a mess.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f5987b37d

You are also now listed as Org contributor.
https://git.sr.ht/~bzg/worg/commit/58891803

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



Re: org-babel guile source block bug in handling multiple values

2023-03-11 Thread Ihor Radchenko
Zelphir Kaltstahl  writes:

>> This is expected. Noweb includes the src block code without altering it.
>> See 16.11 Noweb Reference Syntax
>>
>> We may probably clarify this in the manual. Would it be helpful?
> I think it would be helpful. I merely tried Python, because it was at hand 
> and 
> because I did not find ob-racket in M-x package-list RET and did not have 
> another Scheme installed. Cannot say, whether others find the behavior 
> confusing 
> or not, but I imagine I would find it helpful, if it was mentioned in the 
> docs.

See the attached tentative patch.

>From 26763df7de8f742e76f10f2e7603ed290b97df65 Mon Sep 17 00:00:00 2001
Message-Id: <26763df7de8f742e76f10f2e7603ed290b97df65.1678529850.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 11 Mar 2023 11:16:23 +0100
Subject: [PATCH] org-manual.org: Explain that noweb expansion does not carry
 over :var

* doc/org-manual.org (Noweb Reference Syntax): Provide an example
explaining that :var header arguments are not in effect when expanding
noweb reference.

Reported-by: Zelphir Kaltstahl 
Link: https://orgmode.org/list/46e6f579-9eca-e1da-06ea-f2478a603...@posteo.de
---
 doc/org-manual.org | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 1c97d6aa8..2c3ec46a4 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19117,6 +19117,32 @@ ** Noweb Reference Syntax
 ,#+END_SRC
 #+end_example
 
+Note that noweb expansion does not automatically carry over =var=
+header arguments.  In the following example, attempting to evaluate
+the second code block will give an error, because the variables
+defined in the first code block will not be defined in the second
+block.
+
+#+begin_example
+,#+NAME: get-prompt
+,#+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls"
+  (concat prompt command)
+,#+END_SRC
+
+,#+RESULTS: get-prompt
+: root> ls
+
+,#+BEGIN_SRC emacs-lisp :noweb yes
+  <>
+,#+END_SRC
+
+The previous block is expanded to
+
+,#+BEGIN_SRC emacs-lisp
+  (concat prompt command)
+,#+END_SRC
+#+end_example
+
 You may also include the contents of multiple blocks sharing a common
 =noweb-ref= header argument, which can be set at the file, subtree,
 or code block level.  In the example Org file shown next, the body of
-- 
2.39.1


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


Re: [BUG] Inconsistent global/local :var assignments in ob-* for lisps and non-lisps (was: org-babel guile source block bug in handling multiple values)

2023-03-11 Thread Ihor Radchenko
Zelphir Kaltstahl  writes:

> The issue is not with defining via (define ...) inside a (let ...) in Guile. 
> It 
> is about importing macros at the time, when the body of the (let ...) is 
> already 
> evaluated, which is at a later phase than macro expansion. By wrapping inside 
> a 
> (let ...) org has moved the import to a later phase, which causes the macro 
> (let-values ...) to not be expanded.

I see.
AFAIK, Elisp does not have this problem.

> As far as I know, (defun ...) and (defvar ...) are merely defining functions 
> and 
> variables, not macros.

Same for defmacro in Elisp.

> My point is, that imports are usually global for sessions. But :var decided 
> for 
> let-wrapping, moving them to a different place. Just like imports are usually 
> global, I would expect (define ...)s to be global in the session, unless I 
> put 
> them inside a narrowed scope like a (let ...) myself. The org generated (let 
> ...) is invisible to the user and thus confusing, at least for GNU Guile.
>
> For other Schemes it probably all depends on how their phases of expansion 
> and 
> evaluation work. I don't know enough about the Scheme standards, to tell, 
> whether Guile has the correct behavior here or whether there is a correct 
> behavior defined in the Scheme standards. Maybe someone more knowledgeable 
> can 
> chime in to comment on that.

When saying Guile I mean scheme. Remember that I am now looking from a
more general perspective of other ob-* libraries.

My conclusion so far is that it is not safe in ob-scheme to use
let-binding. Other ob-* lisp implementations may be OK (at least,
ob-emacs-lisp is OK).

Now, the main question is whether it is safe to use `define' in all the
scheme implementations. If it is, would you be interested in turning
your personal fix into a patch for ob-scheme?

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



Re: [BUG] Date prompt suggests yesterday when changing timestamp with org-extend-today-until set [9.6]

2023-03-11 Thread Ihor Radchenko
Tim Ruffing  writes:

> Sorry for the late reply. The patch solves the problem for me, thanks!
> Would be great to have this fixed.

Thanks for confirming!
Fixed, on main now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d6e75d0ee

> Unless you see a bug that I'm not seeing, the behavior looks correct to
> me (with the patch applied):

Good no know. I wanted to hear from an actual user of the
org-extend-today-until feature.

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



Re: How to build an agenda view showing all entries whose headlines match a given regex?

2023-03-11 Thread Marcin Borkowski


On 2023-02-23, at 18:14, Marcin Borkowski  wrote:

> Hi all,
>
> the topic says it all.  Is it possible?  If so, how?

So, I'm answering myself in case someone else also needs this.  Yes, it
is possible, and is now described here:
https://mbork.pl/2023-03-11_Adding_my_TODOs_to_agenda

Best,

-- 
Marcin Borkowski
http://mbork.pl