Max Nikulin writes:
>> I have a concern about this test - it will not work on windows or in
>
> I do not mind to add
>
> (skip-unless (not (memq system-type '(ms-dos windows-nt
>
>> non-standard system shells. We should probably disable the test unless
>> "printf" can be evaluated in the
Max Nikulin writes:
>> I have incorporated the above suggestions into the attached version of
>> the patch.
>
> Thanks, I have not tried the updated patch in action, but it looks like
> what I expect.
> I would consider explicit mention of stripping quotes
> ...
I incorporated your suggestions
On 31/03/2024 15:27, Ihor Radchenko wrote:
Max Nikulin writes:
+(ert-deftest test-org/format-latex-as-html ()
+ "Test shell special characters escaping in `org-format-latex-as-html'."
+ (let ((org-latex-to-html-convert-command
+ "printf \"\" %i"))
I have a concern about this test -
On 31/03/2024 15:25, Ihor Radchenko wrote:
Max Nikulin writes:
I think it is in the right direction.
- Manual needs update as well.
- I would explicitly stress that quotes causes undefined or even
dangerous behavior. See e.g. the last paragraph
https://specifications.freedesktop.org/desktop-ent
Max Nikulin writes:
> Is second attachment appropriate to fix the issue or it has some
> undesired effects.
Thanks!
> +(ert-deftest test-org/format-latex-as-html ()
> + "Test shell special characters escaping in `org-format-latex-as-html'."
> + (let ((org-latex-to-html-convert-command
> +
Max Nikulin writes:
>> Attaching tentative patch that fixes the problem.
>
> I think it is in the right direction.
> - Manual needs update as well.
> - I would explicitly stress that quotes causes undefined or even
> dangerous behavior. See e.g. the last paragraph
> https://specifications.freede
Max Nikulin writes:
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b338a9069
>
> `with-temp-buffer' makes `kill-buffer' unnecessary.
Oops.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4f548f948
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn mo
On 19/03/2024 21:49, Ihor Radchenko wrote:
but I do not see downsides of
using `insert-file-contents' instead of `find-file-noselect' and not
running `find-file-hook' in this particular case (other cases in Org
tree appears to be fine from a quick glance).
https://git.savannah.gnu.org/cgit/ema
Ihor Radchenko writes:
>> It is a bug in Org that some hooks are called when just file content is
>> necessary.
>
> I would not necessarily call it a bug, but I do not see downsides of
> using `insert-file-contents' instead of `find-file-noselect' and not
> running `find-file-hook' in this parti
Max Nikulin writes:
>>> On 12/03/2024 20:03, Ihor Radchenko wrote:
>>> - '%i' and "%i" in any position including e.g. --option='%i' and
>>> protocol:"%i"
>>> - 'something%i' and "something%i" surrounded by spaces or at the end of
>>> command but with no spaces in "something".
>>
>> I am not conf
On 15/03/2024 20:49, Ihor Radchenko wrote:
Max Nikulin writes:
On 12/03/2024 20:03, Ihor Radchenko wrote:
- '%i' and "%i" in any position including e.g. --option='%i' and
protocol:"%i"
- 'something%i' and "something%i" surrounded by spaces or at the end of
command but with no spaces in "somethin
Max Nikulin writes:
> On 12/03/2024 20:03, Ihor Radchenko wrote:
>> Max Nikulin writes:
>>> It is trivial to cause shell failure when single quotes are used around
>>> %i. I am in doubts concerning double quotes. Perhaps stripping them is
>>> more reliable.
>>
>> May you list the cases to you pr
On 12/03/2024 20:03, Ihor Radchenko wrote:
Max Nikulin writes:
It is trivial to cause shell failure when single quotes are used around
%i. I am in doubts concerning double quotes. Perhaps stripping them is
more reliable.
May you list the cases to you propose to recognize?
Sun, 25 Feb 2024 17
Max Nikulin writes:
>> Even stripping quotes is unreliable when we use the example from
>> docstring: 'literal:%i'.
>
> My idea is to recognize this case. If stripping is not performed then it
> is necessary to detect if user command is safe. Otherwise apostrophe in
> a formula (even after esca
On 09/03/2024 22:23, Max Nikulin wrote:
On 08/03/2024 18:16, Ihor Radchenko wrote:
Attaching tentative patch that fixes the problem.
I propose to add unit tests, see first attachment.
I have tried to add some unit tests, but I faced an issue with
`org-create-math-formula'. It creates tempor
On 08/03/2024 18:16, Ihor Radchenko wrote:
Max Nikulin writes:
I decided not to introduce stdin. User can always use echo %i | ... instead.
printf "%%s" %i
should be safer. However in this particular case, input that may be
recognized like echo options ("-n") should be wrapped with LaTeX del
Max Nikulin writes:
>>> It should be more reliable to pass fragment to command stdin. It can be
>>> done if %i is missed in `org-latex-to-html-convert-command'.
>>
>> I agree that it will be more reliable to shell-escape argument.
>> However, I am concerned that escaping may break certain uses l
On 25/02/2024 17:41, Max Nikulin wrote:
Max Nikulin writes:
So `shell-quote-argument' is necessary and quotes around %i must be
stripped similar to %s in mailcap entries in `org-open-file'.
...
Please, revert the commit that added a misleading recommendation.
...
It should be more reliable
On 26/02/2024 17:48, Ihor Radchenko wrote:
Max Nikulin writes:
Something weird may be executed in the case of sufficiently complex
equations.
It should be more reliable to pass fragment to command stdin. It can be
done if %i is missed in `org-latex-to-html-convert-command'.
I agree that it
Max Nikulin writes:
> (let ((org-latex-to-html-convert-command
> "printf '%%s' '%i'"))
>(org-format-latex-as-html "$f' = df/dx$"))
> "/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
> "
>
> Something weird may be executed in the case of sufficiently complex
> equ
On 23/02/2024 19:46, Ihor Radchenko wrote:
Max Nikulin writes:
On 19/02/2024 02:36, Martin Edström wrote:
+Since this is a shell-command, remember to use single-quotes
+around \\='%i\\=', not double-quotes! Else a math fragment such
+as \"$y = 200$\" gets butchered into only \" = 200\"."
I
Ah yes. My custom Node script (which I hope it's OK to paste below) strips
the beginnings and ends of the input. I suppose that it could be done
already on the Elisp side, which would take care of interpreting the
$-signs as envvars too.
const katex = require('katex')
let input = process.argv[2].t
And ignore my suggestion about stripping input on the Elisp side.
Didn't think that through.
On Wed, 21 Feb 2024 at 16:04, Martin Edström wrote:
>
> Actually, I agree about your test case, that looks like it'd cause a problem.
>
> So we patch the function to use `shell-quote-argument'?
>
> On Wed
Actually, I agree about your test case, that looks like it'd cause a problem.
So we patch the function to use `shell-quote-argument'?
On Wed, 21 Feb 2024 at 15:38, Max Nikulin wrote:
>
> On 19/02/2024 02:36, Martin Edström wrote:
> > +Since this is a shell-command, remember to use single-quotes
Max Nikulin writes:
> On 19/02/2024 02:36, Martin Edström wrote:
>> +Since this is a shell-command, remember to use single-quotes
>> +around \\='%i\\=', not double-quotes! Else a math fragment such
>> +as \"$y = 200$\" gets butchered into only \" = 200\"."
>
> I am afraid, the code, not the docs
On 19/02/2024 02:36, Martin Edström wrote:
+Since this is a shell-command, remember to use single-quotes
+around \\='%i\\=', not double-quotes! Else a math fragment such
+as \"$y = 200$\" gets butchered into only \" = 200\"."
I am afraid, the code, not the docstring must be fixed. I have not t
Martin Edström writes:
> Tests passed (14 SKIPPED), compiled fine. I've made no prior
> contributions and this changes 5 lines. I'm ok if you want to rephrase
> it in any way.
Applied onto main, with amendments.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a8443f2c7
Thanks fo
Here you go!
Tests passed (14 SKIPPED), compiled fine. I've made no prior
contributions and this changes 5 lines. I'm ok if you want to rephrase
it in any way.
Martin
On Sun, 18 Feb 2024 at 19:56, Martin Edström wrote:
>
> I will try to do a patch, thanks for the link. Stay tuned.
>
> On Sun,
I will try to do a patch, thanks for the link. Stay tuned.
On Sun, Feb 18, 2024 at 15:06 Ihor Radchenko wrote:
> Martin Edström writes:
>
> > I've just been struggling with my custom setting for
> > `org-latex-to-html-convert-command` outputting many math snippets
> > wrong. The fault was mine:
Martin Edström writes:
> I've just been struggling with my custom setting for
> `org-latex-to-html-convert-command` outputting many math snippets
> wrong. The fault was mine: I didn't correctly shell-quote the input.
> I propose to add a warning in the docstring, because many people will
> trip t
I've just been struggling with my custom setting for
`org-latex-to-html-convert-command` outputting many math snippets
wrong. The fault was mine: I didn't correctly shell-quote the input.
I propose to add a warning in the docstring, because many people will
trip the same problem.
The thing is that
31 matches
Mail list logo