Re: [PATCH] Always use \newcommandx instead of \def

2023-10-18 Thread Richard Kimberly Heck

On 10/17/23 14:50, Enrico Forestieri wrote:

On Tue, Oct 17, 2023 at 08:29:12PM +0200, Enrico Forestieri wrote:


On Tue, Oct 17, 2023 at 01:10:23PM -0400, Richard Kimberly Heck wrote:


On 10/16/23 21:22, Isaac Oscar Gariano wrote:
Currently \def is used for all math macros that have no option 
arguments. This has caused me hard to debug errors because it 
silently clobbers pre-existing LaTeX commands. On the other hand, 
\newcommandx is used if there are optional arguments, and this 
gives a helpful error message if the command is already defined. 
(if you really do want to override the command, you can just put 
\let\mycommand=\undefined in your LaTeX preamble, although with 
unicode-math I often have to put this in an \AtBeginDocument).


This very simple patch just makes LyX always output \newcommandx 
instead of \def for math macros.
Unfortunately, this means if you want to have any math macros 
you'll always need the xargs package (but it's a small package 
release all they way back in 2008 and is included in TeXlive), 
hopefully this won't annoy users too much.


Since we already depend upon xargs, this won't be a problem.


However, I think this might count as a format change, because it 
changes the exported LaTeX. If so, then it would have to wait for 
2.5.0. But I'm not sure about this, and perhaps the people who 
actually know about this will think it's safe. I'd like to hear.


Independently from that, this is a change that needs a lot of testing 
and it is risky to perform near a release.


Yes, I decided not to mention that, since the format change decides it 
anyway.


It's unfortunate, but perhaps we can get 2.5.0 out sooner...

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Always use \newcommandx instead of \def

2023-10-18 Thread Scott Kostyshak
On Wed, Oct 18, 2023 at 03:35:33PM +, Isaac Oscar Gariano wrote:
> The new.lyx and renew.lyx files won't load if you haven't applied my patch to 
> the master branch  and recompiled lyx.
> 
> The def.lyx file should however not require my patch (at least on the version 
> of master I had checked out)

Ah, I understand now. Thanks!

> And if you're happy to handle the tests, that would be great.

OK, I'll be happy to handle them once the patch is figured out. I still don't 
understand the technical details of it.

> I should probably learn how to do it eventually though if I keep making 
> changes to LyX, but I am actually supposed to be doing work at the moment.

:)


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Always use \newcommandx instead of \def

2023-10-18 Thread Isaac Oscar Gariano
The new.lyx and renew.lyx files won't load if you haven't applied my patch to 
the master branch  and recompiled lyx.

The def.lyx file should however not require my patch (at least on the version 
of master I had checked out)

And if you're happy to handle the tests, that would be great. I should probably 
learn how to do it eventually though if I keep making changes to LyX, but I am 
actually supposed to be doing work at the moment.

— Isaac Oscar Gariano
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Always use \newcommandx instead of \def

2023-10-18 Thread Scott Kostyshak
On Wed, Oct 18, 2023 at 02:05:51AM +, Isaac Oscar Gariano wrote:

> I've attached three example lyx files that try and redefine the \section​ 
> command; the only difference between def.lyx​ and new.lyx​ is whether the 
> checkbox is checked or not; renew.lyx​ shows how to suecesfully do the 
> redefinition.

Thanks for these example files! For some reason I get a "header error" when I 
try to open them in LyX.

> I'm happy to integrate this with whatever automated testing setup LyX has, if 
> someone could point me to any documentation for it, that would be greatly 
> appreciated!.

I can take care of this. The testing system is a bit complicated. If you are 
very curious, I can direct you to the documentation, but otherwise I will save 
you the trouble.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fixup 65cb9fa4: avoid extra spacing when selecting math

2023-10-18 Thread Scott Kostyshak
On Wed, Oct 18, 2023 at 11:10:31AM +0200, Jean-Marc Lasgouttes wrote:
> commit 99ecdd6cebaaaf6bf8e8123411475d26df9c358c
> Author: Jean-Marc Lasgouttes 
> Date:   Wed Oct 18 12:28:47 2023 +0200
> 
> Fixup 65cb9fa4: avoid extra spacing when selecting math
> 
> This was happening whenever a selection started/ended after a fraction
> inset.
> ---

I think this commit fixed an issue that I was about to bisect. The issue
is fixed now, but since it seems the issue is tricky I thought I would
attach another case since it doesn't have to do with a fraction inset.
Perhaps that helps to narrow in on the issue.

To reproduce (before your fix), I would put the cursor before "=" and
hold shift and do  and then .

Scott


equals-extra-space.23.lyx
Description: application/lyx


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel