Re: LyX efficient language/spell-check toggle

2015-08-26 Thread Jean-Marc Lasgouttes

Le 25/08/2015 17:33, Guenter Milde a écrit :

OTOH, if you know tie the system-keybord-layout and the text language in LyX¹
it should be fairly easy: "language greek" when the keybord layout is set to
Greek, "language english" (or whatever you use as secondary language), else.
It may become a problem if you use several non-Greek languages or language
variants.


This bug is #6450 on the tracker. It has not got a lot of love in the 
last 6 years, so anyone with some motivation would be welcome to tackle 
it out, it cannot be that difficult to achieve...


JMarc



Re: LyX efficient language/spell-check toggle

2015-08-26 Thread Jean-Marc Lasgouttes

Le 25/08/2015 17:33, Guenter Milde a écrit :

OTOH, if you know tie the system-keybord-layout and the text language in LyX¹
it should be fairly easy: language greek when the keybord layout is set to
Greek, language english (or whatever you use as secondary language), else.
It may become a problem if you use several non-Greek languages or language
variants.


This bug is #6450 on the tracker. It has not got a lot of love in the 
last 6 years, so anyone with some motivation would be welcome to tackle 
it out, it cannot be that difficult to achieve...


JMarc



Re: LyX efficient language/spell-check toggle

2015-08-25 Thread Guenter Milde
On 2015-08-19, alex wrote:
 I have managed to write a serviceable script that uses LyX server and 
 LFUNs and toggles between languages only with the shortcut Alt + Shift. 
 I am quite pleased with the result, but I have come up with a slight 
 improvement, that can be achieved by tracking the current language used 
 to spell check in LyX. However, all the LFUNs seem to be 
 one-directional, that is they transfer information from the external 
 application to LyX. Is there a way (for example, a get-language LFUN 
 that I am missing) to echo the current LyX language in the terminal, so 
 that I can use it in a script?

I don't know of any. Did you have a look in the HelpLfuns (or what it is
called in English or Greek) manual?

OTOH, if you know tie the system-keybord-layout and the text language in LyX¹
it should be fairly easy: language greek when the keybord layout is set to
Greek, language english (or whatever you use as secondary language), else.
It may become a problem if you use several non-Greek languages or language
variants.

Günter




¹ not only used for spellchecking, but also for hyphenation and
  auto-generated strings.



Re: LyX efficient language/spell-check toggle

2015-08-25 Thread Guenter Milde
On 2015-08-19, alex wrote:
> I have managed to write a serviceable script that uses LyX server and 
> LFUNs and toggles between languages only with the shortcut Alt + Shift. 
> I am quite pleased with the result, but I have come up with a slight 
> improvement, that can be achieved by tracking the current language used 
> to spell check in LyX. However, all the LFUNs seem to be 
> "one-directional", that is they transfer information from the external 
> application to LyX. Is there a way (for example, a get-language LFUN 
> that I am missing) to echo the current LyX language in the terminal, so 
> that I can use it in a script?

I don't know of any. Did you have a look in the Help>Lfuns (or what it is
called in English or Greek) manual?

OTOH, if you know tie the system-keybord-layout and the text language in LyX¹
it should be fairly easy: "language greek" when the keybord layout is set to
Greek, "language english" (or whatever you use as secondary language), else.
It may become a problem if you use several non-Greek languages or language
variants.

Günter




¹ not only used for spellchecking, but also for hyphenation and
  auto-generated strings.



Re: LyX efficient language/spell-check toggle

2015-08-19 Thread alex
I have managed to write a serviceable script that uses LyX server and 
LFUNs and toggles between languages only with the shortcut Alt + Shift. 
I am quite pleased with the result, but I have come up with a slight 
improvement, that can be achieved by tracking the current language used 
to spell check in LyX. However, all the LFUNs seem to be 
one-directional, that is they transfer information from the external 
application to LyX. Is there a way (for example, a get-language LFUN 
that I am missing) to echo the current LyX language in the terminal, so 
that I can use it in a script?


Cheers.


Re: LyX efficient language/spell-check toggle

2015-08-19 Thread Guenter Milde
On 2015-08-18, alex wrote:

...

 However, I still cannot find a way for a single shortcut to do exactly
 what I want.
 That is because LyX does not capture shortcuts used for system keyboard
 layout toggle.

Exactly. Changing the keyboard layout and changing the text language in
LyX are two completely different actions. (Think of the language change
in LyX like of inserting span language=greek in the document...)

 So, it's not possible to set a shortcut of Alt + Shift - language toggle.
 I would not mind having to use another shortcut, as long as it's only 1,
 to have the appropriate results.

 For example, something like that would require an lfun sequence like:
layout toggle ; language toggle.
 I still cannot achieve the layout toggle.
 I checked out keyboard mappings a bit, but to no avail.

This is one option: leave the system kbd-layout at English and activate a
LyX-specific kmap for Greek.

The existing greek.kmap is not the best example to build on, as it only
adds some small modifications (assuming that the system kmap is already
Greek).

A better example for a to-be-written Greek on top of English kmap would
be, e.g., /usr/share/lyx/kbd/czech-prg.kmap. Generally, it would be a major
task, writing \kmap pairs for almost every key.

 Another thing that caught my eye is that you can control LyX from other
 programs using lfuns. So, I though as a last resort solution to write a
 bash script that senses the layout toggle and sends the appropriate
 lfun to LyX. However, in the lfuns manual, I only found a small
 reference to that feature at the beginning. Is there any detailed
 documentation about this?

There is some documentation on the LyX wiki. Once upon a time, I even
wrote a Python package providing an interface to the LyXserver and
uploaded it there.

Günter





 On 08/18/2015 11:21 PM, Richard Heck wrote:
 On 08/18/2015 12:39 PM, alex wrote:
 Hello everyone.

 I have been using LyX as my LaTeX editor of choice for quite some
 time now, and I have found it to be quite helpful. I have also
 managed to set up spell checking for both the languages that I am
 interested in, English and Greek. However, the way that I currently
 toggle between those languages is quite inconvenient. That is, I use
 Alt + Shift to toggle between languages (as I usually do), which
 achieves the transition from one language to another. However, that's
 not enough to get LyX to toggle to the latter language. LyX keeps
 spell-checking using the former language. I have to use a second
 keyboard shortcut to get LyX to switch languages, as far as
 spell-checking goes. For example, I have to use 2 keyboard shortcuts
 in order to go from writing English characters with English
 spell-checking to writing Greek characters with Greek spell-checking,
 and vice versa. Obviously, those are one too many shortcuts.

 So, my question is: can LyX be configured so that toggling between
 languages is made by one keyboard shortcut, or maybe so that LyX
 senses the keyboard layout (GR or US) in use and spell-checks
 appropriately?

 A single shortcut can do more than one thing, if you use the
 command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:
 command-sequence buffer-begin ; buffer-end-select
 which has the effect of selecting the whole buffer.

 See the documentation for command-sequence under Help LyX Functions.

 Richard




Re: LyX efficient language/spell-check toggle

2015-08-19 Thread Guenter Milde
On 2015-08-18, alex wrote:

...

> However, I still cannot find a way for a single shortcut to do exactly
> what I want.
> That is because LyX does not capture shortcuts used for system keyboard
> layout toggle.

Exactly. Changing the keyboard layout and changing the text language in
LyX are two completely different actions. (Think of the language change
in LyX like of inserting  in the document...)

> So, it's not possible to set a shortcut of Alt + Shift -> language toggle.
> I would not mind having to use another shortcut, as long as it's only 1,
> to have the appropriate results.

> For example, something like that would require an lfun sequence like:
> ; .
> I still cannot achieve the layout toggle.
> I checked out keyboard mappings a bit, but to no avail.

This is one option: leave the system kbd-layout at English and activate a
LyX-specific "kmap" for Greek.

The existing "greek.kmap" is not the best example to build on, as it only
adds some small modifications (assuming that the system kmap is already
Greek).

A better example for a to-be-written "Greek on top of English" kmap would
be, e.g., /usr/share/lyx/kbd/czech-prg.kmap. Generally, it would be a major
task, writing \kmap pairs for almost every key.

> Another thing that caught my eye is that you can control LyX from other
> programs using lfuns. So, I though as a last resort solution to write a
> bash script that senses the layout toggle and sends the appropriate
> lfun to LyX. However, in the lfuns manual, I only found a small
> reference to that feature at the beginning. Is there any detailed
> documentation about this?

There is some documentation on the LyX wiki. Once upon a time, I even
wrote a Python package providing an interface to the LyXserver and
uploaded it there.

Günter





> On 08/18/2015 11:21 PM, Richard Heck wrote:
>> On 08/18/2015 12:39 PM, alex wrote:
>>> Hello everyone.

>>> I have been using LyX as my LaTeX editor of choice for quite some
>>> time now, and I have found it to be quite helpful. I have also
>>> managed to set up spell checking for both the languages that I am
>>> interested in, English and Greek. However, the way that I currently
>>> toggle between those languages is quite inconvenient. That is, I use
>>> Alt + Shift to toggle between languages (as I usually do), which
>>> achieves the transition from one language to another. However, that's
>>> not enough to get LyX to toggle to the latter language. LyX keeps
>>> spell-checking using the former language. I have to use a second
>>> keyboard shortcut to get LyX to switch languages, as far as
>>> spell-checking goes. For example, I have to use 2 keyboard shortcuts
>>> in order to go from writing English characters with English
>>> spell-checking to writing Greek characters with Greek spell-checking,
>>> and vice versa. Obviously, those are one too many shortcuts.

>>> So, my question is: can LyX be configured so that toggling between
>>> languages is made by one keyboard shortcut, or maybe so that LyX
>>> senses the keyboard layout (GR or US) in use and spell-checks
>>> appropriately?

>> A single shortcut can do more than one thing, if you use the
>> command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:
>> command-sequence buffer-begin ; buffer-end-select
>> which has the effect of selecting the whole buffer.

>> See the documentation for command-sequence under Help> LyX Functions.

>> Richard




Re: LyX efficient language/spell-check toggle

2015-08-19 Thread alex
I have managed to write a serviceable script that uses LyX server and 
LFUNs and toggles between languages only with the shortcut Alt + Shift. 
I am quite pleased with the result, but I have come up with a slight 
improvement, that can be achieved by tracking the current language used 
to spell check in LyX. However, all the LFUNs seem to be 
"one-directional", that is they transfer information from the external 
application to LyX. Is there a way (for example, a get-language LFUN 
that I am missing) to echo the current LyX language in the terminal, so 
that I can use it in a script?


Cheers.


Re: LyX efficient language/spell-check toggle

2015-08-18 Thread Richard Heck

On 08/18/2015 12:39 PM, alex wrote:

Hello everyone.

I have been using LyX as my LaTeX editor of choice for quite some time 
now, and I have found it to be quite helpful. I have also managed to 
set up spell checking for both the languages that I am interested in, 
English and Greek. However, the way that I currently toggle between 
those languages is quite inconvenient. That is, I use Alt + Shift to 
toggle between languages (as I usually do), which achieves the 
transition from one language to another. However, that's not enough to 
get LyX to toggle to the latter language. LyX keeps spell-checking 
using the former language. I have to use a second keyboard shortcut to 
get LyX to switch languages, as far as spell-checking goes. For 
example, I have to use 2 keyboard shortcuts in order to go from 
writing English characters with English spell-checking to writing 
Greek characters with Greek spell-checking, and vice versa. Obviously, 
those are one too many shortcuts.


So, my question is: can LyX be configured so that toggling between 
languages is made by one keyboard shortcut, or maybe so that LyX 
senses the keyboard layout (GR or US) in use and spell-checks 
appropriately?


A single shortcut can do more than one thing, if you use the 
command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:

command-sequence buffer-begin ; buffer-end-select
which has the effect of selecting the whole buffer.

See the documentation for command-sequence under Help LyX Functions.

Richard



Re: LyX efficient language/spell-check toggle

2015-08-18 Thread alex



Thanks, Richard.

That seems like a step in the right direction.
In the LyX functions user guide I indeed read about command sequences.
One interesting point is that you can toggle between languages using the
language lfun,
with no arguments.
However, I still cannot find a way for a single shortcut to do exactly
what I want.
That is because LyX does not capture shortcuts used for system keyboard
layout toggle.
So, it's not possible to set a shortcut of Alt + Shift - language toggle.
I would not mind having to use another shortcut, as long as it's only 1,
to have the appropriate results.
For example, something like that would require an lfun sequence like:
layout toggle ; language toggle.
I still cannot achieve the layout toggle.
I checked out keyboard mappings a bit, but to no avail.

Another thing that caught my eye is that you can control LyX from other
programs using lfuns.
So, I though as a last resort solution to write a bash script that
senses the layout toggle and sends
the appropriate lfun to LyX. However, in the lfuns manual, I only found
a small reference to that feature
at the beginning. Is there any detailed documentation about this?

Cheers.






On 08/18/2015 11:21 PM, Richard Heck wrote:

On 08/18/2015 12:39 PM, alex wrote:

Hello everyone.

I have been using LyX as my LaTeX editor of choice for quite some
time now, and I have found it to be quite helpful. I have also
managed to set up spell checking for both the languages that I am
interested in, English and Greek. However, the way that I currently
toggle between those languages is quite inconvenient. That is, I use
Alt + Shift to toggle between languages (as I usually do), which
achieves the transition from one language to another. However, that's
not enough to get LyX to toggle to the latter language. LyX keeps
spell-checking using the former language. I have to use a second
keyboard shortcut to get LyX to switch languages, as far as
spell-checking goes. For example, I have to use 2 keyboard shortcuts
in order to go from writing English characters with English
spell-checking to writing Greek characters with Greek spell-checking,
and vice versa. Obviously, those are one too many shortcuts.

So, my question is: can LyX be configured so that toggling between
languages is made by one keyboard shortcut, or maybe so that LyX
senses the keyboard layout (GR or US) in use and spell-checks
appropriately?


A single shortcut can do more than one thing, if you use the
command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:
command-sequence buffer-begin ; buffer-end-select
which has the effect of selecting the whole buffer.

See the documentation for command-sequence under Help LyX Functions.

Richard







Re: LyX efficient language/spell-check toggle

2015-08-18 Thread Richard Heck

On 08/18/2015 12:39 PM, alex wrote:

Hello everyone.

I have been using LyX as my LaTeX editor of choice for quite some time 
now, and I have found it to be quite helpful. I have also managed to 
set up spell checking for both the languages that I am interested in, 
English and Greek. However, the way that I currently toggle between 
those languages is quite inconvenient. That is, I use Alt + Shift to 
toggle between languages (as I usually do), which achieves the 
transition from one language to another. However, that's not enough to 
get LyX to toggle to the latter language. LyX keeps spell-checking 
using the former language. I have to use a second keyboard shortcut to 
get LyX to switch languages, as far as spell-checking goes. For 
example, I have to use 2 keyboard shortcuts in order to go from 
writing English characters with English spell-checking to writing 
Greek characters with Greek spell-checking, and vice versa. Obviously, 
those are one too many shortcuts.


So, my question is: can LyX be configured so that toggling between 
languages is made by one keyboard shortcut, or maybe so that LyX 
senses the keyboard layout (GR or US) in use and spell-checks 
appropriately?


A single shortcut can do more than one thing, if you use the 
command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:

command-sequence buffer-begin ; buffer-end-select
which has the effect of selecting the whole buffer.

See the documentation for command-sequence under Help> LyX Functions.

Richard



Re: LyX efficient language/spell-check toggle

2015-08-18 Thread alex



Thanks, Richard.

That seems like a step in the right direction.
In the LyX functions user guide I indeed read about command sequences.
One interesting point is that you can toggle between languages using the
language lfun,
with no arguments.
However, I still cannot find a way for a single shortcut to do exactly
what I want.
That is because LyX does not capture shortcuts used for system keyboard
layout toggle.
So, it's not possible to set a shortcut of Alt + Shift -> language toggle.
I would not mind having to use another shortcut, as long as it's only 1,
to have the appropriate results.
For example, something like that would require an lfun sequence like:
 ; .
I still cannot achieve the layout toggle.
I checked out keyboard mappings a bit, but to no avail.

Another thing that caught my eye is that you can control LyX from other
programs using lfuns.
So, I though as a last resort solution to write a bash script that
senses the layout toggle and sends
the appropriate lfun to LyX. However, in the lfuns manual, I only found
a small reference to that feature
at the beginning. Is there any detailed documentation about this?

Cheers.






On 08/18/2015 11:21 PM, Richard Heck wrote:

On 08/18/2015 12:39 PM, alex wrote:

Hello everyone.

I have been using LyX as my LaTeX editor of choice for quite some
time now, and I have found it to be quite helpful. I have also
managed to set up spell checking for both the languages that I am
interested in, English and Greek. However, the way that I currently
toggle between those languages is quite inconvenient. That is, I use
Alt + Shift to toggle between languages (as I usually do), which
achieves the transition from one language to another. However, that's
not enough to get LyX to toggle to the latter language. LyX keeps
spell-checking using the former language. I have to use a second
keyboard shortcut to get LyX to switch languages, as far as
spell-checking goes. For example, I have to use 2 keyboard shortcuts
in order to go from writing English characters with English
spell-checking to writing Greek characters with Greek spell-checking,
and vice versa. Obviously, those are one too many shortcuts.

So, my question is: can LyX be configured so that toggling between
languages is made by one keyboard shortcut, or maybe so that LyX
senses the keyboard layout (GR or US) in use and spell-checks
appropriately?


A single shortcut can do more than one thing, if you use the
command-sequence LFUN. E.g., Ctrl-Alt-A is bound to:
command-sequence buffer-begin ; buffer-end-select
which has the effect of selecting the whole buffer.

See the documentation for command-sequence under Help> LyX Functions.

Richard