"flatten" branch insets

Scott Kostyshak skostysh at lyx.org
Sat Apr 2 14:31:15 UTC 2022


On Thu, Mar 31, 2022 at 06:42:47PM +0200, Jean-Marc Lasgouttes wrote:
> Le 31/03/2022 à 17:03, Scott Kostyshak a écrit :
> > I have some documents with many branches. For example, when I write a
> > recommendation letter there are some shared elements across my letters
> > where I describe the class the student took with me, etc. The branches
> > handle which class the student took for me, whether they are undergrads
> > or grads, and whether they are applying to graduate programs or jobs.
> > 
> > My workflow is to copy a "base" letter, activate the relevant branchs,
> > and to then write the elements of the letter that are specific to the
> > student. In this workflow, I would find it useful to be able to
> > "flatten" the document, in the sense of deleting all branch insets that
> > are not activated, and dissolving all branch insets that are activated.
> > Note that this would work on the branch *inset* level since some insets
> > of the same branch might be activated and others not because of our
> > "invert" feature.
> > 
> > Would anyone else have use for such a workflow? I would guess not. But
> > would a patch likely be accepted that just implements the LFUN? I could
> > use the patch locally, so if someone prefers not to add such an uncommon
> > feature, I would understand.
> 
> If we decided to have branch inset layout() return Branch:<name>:active or
> Branch:<name>:inactive, one could do that with something like
> inset-forall Branch:*:active inset-dissolve
> inset-forall Branch:*:inactive char-delete-forward
> 
> I guess there are some part of code that are not ready for that, but in
> general it should work.
> 
> And branches could have a color/font that depends on the state.

That would indeed be nice! I will hold off on the proposed LFUN since
your proposal is much more elegant and useful. There's no hurry.

I think that your proposal would actually work for Pavel's intended
workflow as well. Pavel, do I understand correctly that

  inset-forall Branch:*:active inset-toggle toggle

would do what you want?

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220402/a64d40fb/attachment.asc>


More information about the lyx-devel mailing list