Re: default dir when save for first time is not cwd

2017-05-10 Thread Scott Kostyshak
On Wed, May 10, 2017 at 08:51:21AM +1200, Andrew Parsloe wrote:
> 
> This is too late to be relevant but just for the record, on my system when
> the Working Directory is not explicitly specified (or is .) both 2.1.5 and
> 2.2.2 exhibit the same behaviour as 2.3: they open to 2.x/bin (windows 7). I
> hadn't noticed before because I always explicitly specify the Working
> Directory.

I see. The main difference is that 2.3 chooses a different default (e.g.
if you do not set the preferences manually). I think we have fixed the
regression in master now (by reverting).

Thanks for your testing,

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-09 Thread Andrew Parsloe


On 9/05/2017 11:04 p.m., Scott Kostyshak wrote:


If the Working Directory slot is not filled on Windows (or if it contains
just a period)  File > Open opens to LyX 2.3/bin which seems dangerous to
me.


I agree it should not open to 2.3/bin.


I imagine it should be the My Documents folder.


Is this what it was on 2.2.x?

Scott

This is too late to be relevant but just for the record, on my system 
when the Working Directory is not explicitly specified (or is .) both 
2.1.5 and 2.2.2 exhibit the same behaviour as 2.3: they open to 2.x/bin 
(windows 7). I hadn't noticed before because I always explicitly specify 
the Working Directory.


Andrew


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



Re: default dir when save for first time is not cwd

2017-05-09 Thread Scott Kostyshak
On Tue, May 09, 2017 at 04:44:11PM +0200, Stephan Witt wrote:
> Am 09.05.2017 um 15:39 schrieb Scott Kostyshak :
> > 
> > On Tue, May 09, 2017 at 02:38:10PM +0200, Stephan Witt wrote:
> > 
> >> Thank you too. Code-wise I think it’s ok now. No regression anymore.
> >> But UI-wise the translation is not ok. I have both versions here. First
> >> the german and after it the english one - frankly said, I don’t know how
> >> to fix it. I’m attaching a screen shot instead :)
> > 
> > Fixed at f8ffc2c5 :)
> 
> I fixed the fix at e51ccbf, thanks anyway. Now I know it better. :)

Oops, thanks.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-09 Thread Stephan Witt
Am 09.05.2017 um 15:39 schrieb Scott Kostyshak :
> 
> On Tue, May 09, 2017 at 02:38:10PM +0200, Stephan Witt wrote:
> 
>> Thank you too. Code-wise I think it’s ok now. No regression anymore.
>> But UI-wise the translation is not ok. I have both versions here. First
>> the german and after it the english one - frankly said, I don’t know how
>> to fix it. I’m attaching a screen shot instead :)
> 
> Fixed at f8ffc2c5 :)

I fixed the fix at e51ccbf, thanks anyway. Now I know it better. :)

Stephan

Re: default dir when save for first time is not cwd

2017-05-09 Thread Scott Kostyshak
On Tue, May 09, 2017 at 02:38:10PM +0200, Stephan Witt wrote:

> Thank you too. Code-wise I think it’s ok now. No regression anymore.
> But UI-wise the translation is not ok. I have both versions here. First
> the german and after it the english one - frankly said, I don’t know how
> to fix it. I’m attaching a screen shot instead :)

Fixed at f8ffc2c5 :)

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-09 Thread Scott Kostyshak
On Tue, May 09, 2017 at 01:36:16PM +0200, Stephan Witt wrote:
> Am 09.05.2017 um 13:04 schrieb Scott Kostyshak :
> > 
> > On Mon, May 08, 2017 at 10:42:42PM +0200, Stephan Witt wrote:
> > 
> >> The culprit in my case on Mac was the missing entry for document_dir (aka 
> >> Working Directory).
> >> If I fill it with the name of my real document directory (e.g. 
> >> /Users/stephan/Documents) then
> >> it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences 
> >> and uses the platform
> >> specific default value from Qt in this case.
> > 
> > Stephan, do you think the easiest thing to do is just revert 892593fb?
> > I'm fine with that.
> 
> This probably would solve the problem too. And I’m not that confident
> it is only Windows or Mac platform having this problem. If a Linux desktop
> manager software programmer decides it would be correct to start programs
> from menu or desktop icons at some arbitrary directory like / or /var/private
> or so we have the same problem on Linux.

Good point. I agree.

> Your goal was to start LyX from terminal with current directory as document 
> dir.

Yes.

> Wouldn’t it be better to provide a command line option to choose the initial
> document dir explicitly?

I don't know. Reverting 892593fb doesn't affect me since I have '.' in
my personal preferences file. I made that change because I thought the
default would be more reasonable for everyone, but I was wrong. And if
someone does like the behavior of '.', I think the GUI of the paths tab
makes it clear how to achieve that behavior.

Reverted at 638020ab.

Thanks for the discussion. Let me know if you think anything further
needs to be done.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-09 Thread Stephan Witt
Am 09.05.2017 um 13:04 schrieb Scott Kostyshak :
> 
> On Mon, May 08, 2017 at 10:42:42PM +0200, Stephan Witt wrote:
> 
>> The culprit in my case on Mac was the missing entry for document_dir (aka 
>> Working Directory).
>> If I fill it with the name of my real document directory (e.g. 
>> /Users/stephan/Documents) then
>> it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences 
>> and uses the platform
>> specific default value from Qt in this case.
> 
> Stephan, do you think the easiest thing to do is just revert 892593fb?
> I'm fine with that.

This probably would solve the problem too. And I’m not that confident
it is only Windows or Mac platform having this problem. If a Linux desktop
manager software programmer decides it would be correct to start programs
from menu or desktop icons at some arbitrary directory like / or /var/private
or so we have the same problem on Linux.

Your goal was to start LyX from terminal with current directory as document dir.
Wouldn’t it be better to provide a command line option to choose the initial
document dir explicitly?

Stephan

Re: default dir when save for first time is not cwd

2017-05-09 Thread Scott Kostyshak
On Mon, May 08, 2017 at 10:42:42PM +0200, Stephan Witt wrote:

> The culprit in my case on Mac was the missing entry for document_dir (aka 
> Working Directory).
> If I fill it with the name of my real document directory (e.g. 
> /Users/stephan/Documents) then
> it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences and 
> uses the platform
> specific default value from Qt in this case.

Stephan, do you think the easiest thing to do is just revert 892593fb?
I'm fine with that.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-09 Thread Scott Kostyshak
On Tue, May 09, 2017 at 10:36:02AM +1200, Andrew Parsloe wrote:
> 
> 
> On 9/05/2017 8:42 a.m., Stephan Witt wrote:
> > Am 08.05.2017 um 22:26 schrieb Andrew Parsloe :
> > > 
> > > On 9/05/2017 2:41 a.m., Scott Kostyshak wrote:
> > > > On Mon, May 08, 2017 at 12:14:02PM +1200, Andrew Parsloe wrote:
> > > > 
> > > > > On windows 7, alpha1-1, the Open dialogue displays the CWD.
> > > > 
> > > > For alpha1-1, if you open LyX from the GUI (the Start menu?), and you
> > > > create a new document, type something, and go to save or save as, where
> > > > is the location in the dialog? i.e. what is the CWD in this case?
> > > > 
> > > > Is that experience any different from 2.2.x?
> > > > 
> > > > Thanks for testing,
> > > > 
> > > > Scott
> > > > 
> > > As far as I can tell from brief testing with LyX 2.1.3, 2.2.2, and 
> > > alpha1-1, nothing has changed. Saving a new document in a just-opened LyX 
> > > offers the directory set in Tools > Preferences > Paths > Working 
> > > Directory, say D:/Documents.
> > 
> > The culprit in my case on Mac was the missing entry for document_dir (aka 
> > Working Directory).
> > If I fill it with the name of my real document directory (e.g. 
> > /Users/stephan/Documents) then
> > it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences 
> > and uses the platform
> > specific default value from Qt in this case.
> > 
> > Stephan
> > 
> If the Working Directory slot is not filled on Windows (or if it contains
> just a period)  File > Open opens to LyX 2.3/bin which seems dangerous to
> me.

I agree it should not open to 2.3/bin.

> I imagine it should be the My Documents folder.

Is this what it was on 2.2.x?

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-08 Thread Andrew Parsloe



On 9/05/2017 8:42 a.m., Stephan Witt wrote:

Am 08.05.2017 um 22:26 schrieb Andrew Parsloe :


On 9/05/2017 2:41 a.m., Scott Kostyshak wrote:

On Mon, May 08, 2017 at 12:14:02PM +1200, Andrew Parsloe wrote:


On windows 7, alpha1-1, the Open dialogue displays the CWD.


For alpha1-1, if you open LyX from the GUI (the Start menu?), and you
create a new document, type something, and go to save or save as, where
is the location in the dialog? i.e. what is the CWD in this case?

Is that experience any different from 2.2.x?

Thanks for testing,

Scott


As far as I can tell from brief testing with LyX 2.1.3, 2.2.2, and alpha1-1, nothing has 
changed. Saving a new document in a just-opened LyX offers the directory set in Tools 
> Preferences > Paths > Working Directory, say D:/Documents.


The culprit in my case on Mac was the missing entry for document_dir (aka 
Working Directory).
If I fill it with the name of my real document directory (e.g. 
/Users/stephan/Documents) then
it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences and 
uses the platform
specific default value from Qt in this case.

Stephan

If the Working Directory slot is not filled on Windows (or if it 
contains just a period)  File > Open opens to LyX 2.3/bin which seems 
dangerous to me. I imagine it should be the My Documents folder.


Andrew

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



Re: default dir when save for first time is not cwd

2017-05-08 Thread Stephan Witt
Am 08.05.2017 um 22:26 schrieb Andrew Parsloe :
> 
> On 9/05/2017 2:41 a.m., Scott Kostyshak wrote:
>> On Mon, May 08, 2017 at 12:14:02PM +1200, Andrew Parsloe wrote:
>> 
>>> On windows 7, alpha1-1, the Open dialogue displays the CWD.
>> 
>> For alpha1-1, if you open LyX from the GUI (the Start menu?), and you
>> create a new document, type something, and go to save or save as, where
>> is the location in the dialog? i.e. what is the CWD in this case?
>> 
>> Is that experience any different from 2.2.x?
>> 
>> Thanks for testing,
>> 
>> Scott
>> 
> As far as I can tell from brief testing with LyX 2.1.3, 2.2.2, and alpha1-1, 
> nothing has changed. Saving a new document in a just-opened LyX offers the 
> directory set in Tools > Preferences > Paths > Working Directory, say 
> D:/Documents.

The culprit in my case on Mac was the missing entry for document_dir (aka 
Working Directory).
If I fill it with the name of my real document directory (e.g. 
/Users/stephan/Documents) then
it works for me too. The 2.2.3 LyX doesn’t need that entry in preferences and 
uses the platform
specific default value from Qt in this case.

Stephan

> If I save to a particular subdirectory like D:/Documents/Testing and then 
> click on File > Open, I'm presented with D:/Documents/Testing in all three 
> LyX versions.
> 
> Andrew
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 



Re: default dir when save for first time is not cwd

2017-05-08 Thread Andrew Parsloe

On 9/05/2017 2:41 a.m., Scott Kostyshak wrote:

On Mon, May 08, 2017 at 12:14:02PM +1200, Andrew Parsloe wrote:


On windows 7, alpha1-1, the Open dialogue displays the CWD.


For alpha1-1, if you open LyX from the GUI (the Start menu?), and you
create a new document, type something, and go to save or save as, where
is the location in the dialog? i.e. what is the CWD in this case?

Is that experience any different from 2.2.x?

Thanks for testing,

Scott

As far as I can tell from brief testing with LyX 2.1.3, 2.2.2, and 
alpha1-1, nothing has changed. Saving a new document in a just-opened 
LyX offers the directory set in Tools > Preferences > Paths > Working 
Directory, say D:/Documents. If I save to a particular subdirectory like 
D:/Documents/Testing and then click on File > Open, I'm presented with 
D:/Documents/Testing in all three LyX versions.


Andrew

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



Re: default dir when save for first time is not cwd

2017-05-08 Thread Scott Kostyshak
On Mon, May 08, 2017 at 12:14:02PM +1200, Andrew Parsloe wrote:

> On windows 7, alpha1-1, the Open dialogue displays the CWD.

For alpha1-1, if you open LyX from the GUI (the Start menu?), and you
create a new document, type something, and go to save or save as, where
is the location in the dialog? i.e. what is the CWD in this case?

Is that experience any different from 2.2.x?

Thanks for testing,

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-07 Thread Andrew Parsloe



On 8/05/2017 10:52 a.m., Scott Kostyshak wrote:

On Sat, May 06, 2017 at 11:54:56PM +0200, Stephan Witt wrote:

Am 12.10.2016 um 04:30 schrieb Scott Kostyshak :


On Tue, Oct 11, 2016 at 12:27:51PM -0400, Richard Heck wrote:


Looks fine to me.


It's in at 892593f.


Hi Scott, I’m sorry to say that I missed the consequence of this change.
On Mac the initial value for CWD of a program started from Desktop is
the root directory. So, the document directory of non-configured LyX
has effectively changed from $HOME/Documents to / and one is forced
to configure the ancient default value explicitly in the preferences.
It wouldn’t be a big deal to place it in "development/MacOSX/lyxrc.dist.in“
but the dynamic value retrieval in get_document_dir() was not bad either.


I'm glad that you realized this. I can see how this behavior is a
regression.


What should we do now? What do you think?

Solution 1: Make it platform specific in LyX::init()
Solution 2: Runtime check for writable CWD in LyX::init()


Might not be a bad idea in general (although we should think carefully),
but even if we did this the user probably does not want to have the CWD
set to root. Also, suppose the CWD is not writable, where do we go? I
guess the fallback would be the user directory?


Solution 3: Provide the mentioned lyxrc.dist.in change for Mac


I'm fine with either Solution 1 or 3 so whatever you feel is best is
fine with me. I can't help with Solution 3, but if you want me to take a
look at implementing Solution 1, let me know.

I wonder if the situation is similar on Windows. Does anyone know?

Thanks,

Scott


On windows 7, alpha1-1, the Open dialogue displays the CWD.

Andrew

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



Re: default dir when save for first time is not cwd

2017-05-07 Thread Scott Kostyshak
On Sat, May 06, 2017 at 11:54:56PM +0200, Stephan Witt wrote:
> Am 12.10.2016 um 04:30 schrieb Scott Kostyshak :
> > 
> > On Tue, Oct 11, 2016 at 12:27:51PM -0400, Richard Heck wrote:
> > 
> >> Looks fine to me.
> > 
> > It's in at 892593f.
> 
> Hi Scott, I’m sorry to say that I missed the consequence of this change.
> On Mac the initial value for CWD of a program started from Desktop is
> the root directory. So, the document directory of non-configured LyX
> has effectively changed from $HOME/Documents to / and one is forced
> to configure the ancient default value explicitly in the preferences.
> It wouldn’t be a big deal to place it in "development/MacOSX/lyxrc.dist.in“
> but the dynamic value retrieval in get_document_dir() was not bad either.

I'm glad that you realized this. I can see how this behavior is a
regression.

> What should we do now? What do you think?
> 
> Solution 1: Make it platform specific in LyX::init()
> Solution 2: Runtime check for writable CWD in LyX::init()

Might not be a bad idea in general (although we should think carefully),
but even if we did this the user probably does not want to have the CWD
set to root. Also, suppose the CWD is not writable, where do we go? I
guess the fallback would be the user directory?

> Solution 3: Provide the mentioned lyxrc.dist.in change for Mac

I'm fine with either Solution 1 or 3 so whatever you feel is best is
fine with me. I can't help with Solution 3, but if you want me to take a
look at implementing Solution 1, let me know.

I wonder if the situation is similar on Windows. Does anyone know?

Thanks,

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2017-05-06 Thread Stephan Witt
Am 12.10.2016 um 04:30 schrieb Scott Kostyshak :
> 
> On Tue, Oct 11, 2016 at 12:27:51PM -0400, Richard Heck wrote:
> 
>> Looks fine to me.
> 
> It's in at 892593f.

Hi Scott, I’m sorry to say that I missed the consequence of this change.
On Mac the initial value for CWD of a program started from Desktop is
the root directory. So, the document directory of non-configured LyX
has effectively changed from $HOME/Documents to / and one is forced
to configure the ancient default value explicitly in the preferences.
It wouldn’t be a big deal to place it in "development/MacOSX/lyxrc.dist.in“
but the dynamic value retrieval in get_document_dir() was not bad either.

What should we do now? What do you think?

Solution 1: Make it platform specific in LyX::init()
Solution 2: Runtime check for writable CWD in LyX::init()
Solution 3: Provide the mentioned lyxrc.dist.in change for Mac

Stephan



Re: default dir when save for first time is not cwd

2016-10-11 Thread Scott Kostyshak
On Tue, Oct 11, 2016 at 12:27:51PM -0400, Richard Heck wrote:

> Looks fine to me.

It's in at 892593f.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-10-11 Thread Richard Heck
On 10/10/2016 12:32 AM, Scott Kostyshak wrote:
> On Fri, Jul 29, 2016 at 01:30:25PM -0400, Scott Kostyshak wrote:
>
>> I plan to soon propose to change the default of the working directory to
>> '.', as this thread originally started out as. I would like to test a
>> bit and take a look at where else that path is used besides creating a
>> new file.
> Patch attached.

Looks fine to me.

Richard




Re: default dir when save for first time is not cwd

2016-10-09 Thread Scott Kostyshak
On Fri, Jul 29, 2016 at 01:30:25PM -0400, Scott Kostyshak wrote:

> I plan to soon propose to change the default of the working directory to
> '.', as this thread originally started out as. I would like to test a
> bit and take a look at where else that path is used besides creating a
> new file.

Patch attached.

Scott
From 22ee499acedca55a94b326e2422ef79022bdc32f Mon Sep 17 00:00:00 2001
From: Scott Kostyshak 
Date: Sat, 8 Oct 2016 20:59:54 -0400
Subject: [PATCH] Change default working directory from ~/ to "."

Note that the lyxrc.document_path variable corresponds to what we
call the "Working directory" in the GUI preferences dialog.

Setting document_path to "." makes it so when LyX is started from a
directory, that directory is the default path for many of LyX's
operations, such as the following:

- new file, new from template
- adding a custom BibTeX file
- GUI compare dialog
- local layout button in document settings
- external material file browser
- graphics browser, include browser

The best guess for where the user wants to save or find files is the
directory the user started LyX from. Before, the default was always
the home directory. If desired, the old behavior can be restored by
changing the default path in Preferences > "Working directory".

This commit takes advantage of 9b64d7bd, which allows the use of a
relative path for path preferences.
---
 src/LyX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/LyX.cpp b/src/LyX.cpp
index fec8281..047e265 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -831,7 +831,7 @@ bool LyX::init()
 #endif
 
lyxrc.tempdir_path = package().temp_dir().absFileName();
-   lyxrc.document_path = package().document_dir().absFileName();
+   lyxrc.document_path = ".";
 
if (lyxrc.example_path.empty()) {
lyxrc.example_path = 
addPath(package().system_support().absFileName(),
-- 
2.7.4



signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-29 Thread Scott Kostyshak
On Tue, Jul 19, 2016 at 09:16:04PM -0400, Scott Kostyshak wrote:

> Attached is an updated patch distinguishing TEXINPUTS.

The patch is in at 9b64d7bd. If someone prefers for me to implement
Guillaume's idea to reduce the size of the explanatory text, I am happy
to do so.

I plan to soon propose to change the default of the working directory to
'.', as this thread originally started out as. I would like to test a
bit and take a look at where else that path is used besides creating a
new file.

Thanks for the comments,

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-19 Thread Scott Kostyshak
On Mon, Jul 18, 2016 at 04:28:11PM +0100, Guillaume Munch wrote:
> Le 18/07/2016 06:02, Scott Kostyshak a écrit :
> > Attached is a patch with a detailed commit message, and a screenshot of
> > the paths preferences tab with the patch.
> > 
> > Any thoughts?
> > 
> 
> Regarding the help text, one could just display the first sentence and
> have the rest in a tooltip. A "?" icon could let the user know that
> there is more information in the tooltip (see e.g.
> https://ux.stackexchange.com/a/76155). Just a thought.

Interesting idea. I like the idea for our current tooltips, because it
is impossible currently to know which of our widgets have a tooltip
associated with them. Just to take an example, in the preferences paths
tab, only the PATH prefix and TEXINPUTS prefix have tooltips, but there
is nothing that tells the user this. Further, the user has to know to
place the mouse over the text field. This makes sense, but I made the
mistake of first putting the mouse of the label.

As for this patch, I will put that in if others want it. I'm undecided.
On the one hand, it would save space. On the other hand, the space taken
up by the current description is not used by anything else. I'm open to
whatever others prefer.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-18 Thread Richard Heck
On 07/18/2016 02:16 AM, Jean-Marc Lasgouttes wrote:
> Le 18/07/2016 07:53, Scott Kostyshak a écrit :
>> On Mon, Jul 18, 2016 at 07:37:07AM +0200, Jean-Marc Lasgouttes wrote:
>>
>>> Shouldn't you make a difference in the help string?
>>
>> If that is the case then definitely yes. And that also diminishes one of
>> the advantages of consistency I claimed.
>
> Well, this is what the previous tooltip claimed, and you did not
> change this code AFAICS. Moreover, having TEXINPUTS relative to
> document makes sense.

In a way, this is a completly different case, since TEXINPUTS is an
environment variable and is not interpreted by LyX itself.

Richard



Re: default dir when save for first time is not cwd

2016-07-18 Thread Guillaume Munch

Le 18/07/2016 06:02, Scott Kostyshak a écrit :

Attached is a patch with a detailed commit message, and a screenshot of
the paths preferences tab with the patch.

Any thoughts?



Regarding the help text, one could just display the first sentence and
have the rest in a tooltip. A "?" icon could let the user know that
there is more information in the tooltip (see e.g.
https://ux.stackexchange.com/a/76155). Just a thought.




Re: default dir when save for first time is not cwd

2016-07-18 Thread Scott Kostyshak
On Mon, Jul 18, 2016 at 08:16:42AM +0200, Jean-Marc Lasgouttes wrote:
> Le 18/07/2016 07:53, Scott Kostyshak a écrit :
> > On Mon, Jul 18, 2016 at 07:37:07AM +0200, Jean-Marc Lasgouttes wrote:
> > 
> > > Shouldn't you make a difference in the help string?
> > 
> > If that is the case then definitely yes. And that also diminishes one of
> > the advantages of consistency I claimed.
> 
> Well, this is what the previous tooltip claimed, and you did not change this
> code AFAICS.

Correct. I was not careful about this.

> Moreover, having TEXINPUTS relative to document makes sense.

Agreed.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-18 Thread Jean-Marc Lasgouttes

Le 18/07/2016 07:53, Scott Kostyshak a écrit :

On Mon, Jul 18, 2016 at 07:37:07AM +0200, Jean-Marc Lasgouttes wrote:


Shouldn't you make a difference in the help string?


If that is the case then definitely yes. And that also diminishes one of
the advantages of consistency I claimed.


Well, this is what the previous tooltip claimed, and you did not change 
this code AFAICS. Moreover, having TEXINPUTS relative to document makes 
sense.


JMarc



Re: default dir when save for first time is not cwd

2016-07-17 Thread Scott Kostyshak
On Mon, Jul 18, 2016 at 07:37:07AM +0200, Jean-Marc Lasgouttes wrote:

> Shouldn't you make a difference in the help string?

If that is the case then definitely yes. And that also diminishes one of
the advantages of consistency I claimed.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-17 Thread Jean-Marc Lasgouttes

Le 18/07/2016 07:02, Scott Kostyshak a écrit :

Attached is a patch with a detailed commit message, and a screenshot of
the paths preferences tab with the patch.

Any thoughts?


It looks to me that the meaning of "." in TEXINPUTS is relative to 
current document, while other variables are relative to cwd when LyX is 
started. Shouldn't you make a difference in the help string?


JMarc



Re: default dir when save for first time is not cwd

2016-07-17 Thread Scott Kostyshak
Attached is a patch with a detailed commit message, and a screenshot of
the paths preferences tab with the patch.

Any thoughts?

Scott
From a2cb63c10cc6a7978c914ff50ff45db97598d9d5 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak 
Date: Sun, 17 Jul 2016 04:57:39 -0400
Subject: [PATCH 1/2] Rel. path in paths prefs preserved as rel. paths

Before this commit, in the paths preferences tab if you put a
relative path, LyX would convert it behind the scenes to an absolute
path by evaluating the relative path with respect to the working
directory of the LyX instance where the preference change is taking
place. This seems confusing because (1) it is done behind the scenes
(after the preferences dialog is closed) and (2) if the user chooses
to enter a relative path, the safest thing to do is to preserve it
as a relative path, instead of making the assumption that the user
intended for it to be expanded to an absolute path.

Because the behavior of paths is consistent for all paths, we do not
need an explanation for idiosyncratic treatment of paths in
individual tooltips, thus the tooltip for TEXINPUTS prefix is
simplified. An explanation of how relative paths are handled is
given at the bottom of the paths tab. Note that the height/width of
the preferences window is not changed as a result of adding this
explanatory comment because the height of the preferences dialog is
already stretched by other tabs.

Another dimension of consistency that is achieved with this commit
is that the behavior of LyX is now the same when a relative path is
specified in the preferences dialog as when it is manually specified
in the preferences file. Before, if the preferences file were
manually edited and a relative path were inserted, the next time the
user made a change to preferences with the GUI (even if the
preference change was a different preference, e.g. instant preview),
the relative path would be silently converted to an absolute path,
evaluated with respect to the working directory of that instance.

Beyond improving clarity and consistency (IMO), this commit allows
for a new feature to be implemented of using relative paths in the
paths preferences. For example, the user may now enter '.' as the
"Working directory" path and now whenever they start LyX from a
directory and create a new file, the default location of the file
will be the directory from which they started LyX, instead of the
user's home directory, which is LyX's default and is less intuitive.

No prefs2prefs work is needed because if a relative path were
entered in the preferences dialog before this commit, it was
converted to an absolute path before being stored in preferences. If
a relative path were specified by manually editing the preferences
file, then (unless the path were already automatically converted to
an absolute path by a GUI preferences change, as described above)
the behavior will be the same (the path will be treated as a
relative path).

For related discussion, see the lyx-devel thread here:
https://www.mail-archive.com/search?l=mid=20160616003010.bnymtcouar7g55ti%40cotopaxi

This commit removes the last use of lyx::support::expandPath() in
LyX's sources.
---
 src/LyXRC.cpp   | 32 
 src/frontends/qt4/ui/PrefPathsUi.ui | 20 +++-
 2 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 8b7c3b3..4f5516a 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -632,45 +632,33 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool 
check_format)
break;
 
case RC_DOCUMENTPATH:
-   if (lexrc.next()) {
+   if (lexrc.next())
document_path = 
os::internal_path(lexrc.getString());
-   document_path = expandPath(document_path);
-   }
break;
 
case RC_EXAMPLEPATH:
-   if (lexrc.next()) {
+   if (lexrc.next())
example_path = 
os::internal_path(lexrc.getString());
-   example_path = expandPath(example_path);
-   }
break;
 
case RC_TEMPLATEPATH:
-   if (lexrc.next()) {
+   if (lexrc.next())
template_path = 
os::internal_path(lexrc.getString());
-   template_path = expandPath(template_path);
-   }
break;
 
case RC_TEMPDIRPATH:
-   if (lexrc.next()) {
+   if (lexrc.next())
tempdir_path = 
os::internal_path(lexrc.getString());
-   tempdir_path = expandPath(tempdir_path);
-   }
break;
 

Re: default dir when save for first time is not cwd

2016-07-02 Thread Scott Kostyshak
On Sat, Jul 02, 2016 at 11:57:14PM +0200, Guillaume Munch wrote:

> I only have an opinion for the working directory. Also I do not
> understand which path field you are referring to (lost in translation).

It is the first one in the paths tab. In English "Working directory", in
French "Répertoire de travail". Is that what you were asking about?

> > > If all, then instead of a tool tip since
> > > the behavior would be consistent for all the paths we could put a note
> > > at the top/bottom explaining something like "you may use relative paths
> > > or absolute paths. Relative paths will be expanded with respect to the
> > > directory you start LyX from, and thus could change each LyX session".
> 
> I see other paths that do not make much sense as relative directories.

Agreed. Let's take an example, e.g. "Thesaurus dictionaries". It would
be strange to use '.' intending for it to be a relative path. But I also
think it would be strange to use '.' the way that '.' is currently
interpreted (which is that '.' is immediately substituted for the current
working directory and that absolute path is then stored in preferences).
Thus, because both scenarios are strange, I do not think that users who
enter '.' will be confused by the new behavior.

> However this could provide a more uniform interface. I already read for
> the "TEXINPUTS prefix" tooltip: ". designates the current directory".
> What you suggest would be less hidden and more uniform.

Yes this is indeed the advantage.

In the end, I don't have a strong opinion on this. If others would
prefer making the change only for "Working directory", I'm fine with
that.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-07-02 Thread Guillaume Munch

Le 01/07/2016 03:01, Scott Kostyshak a écrit :

On Fri, Jun 17, 2016 at 07:21:32PM -0400, Scott Kostyshak wrote:

On Fri, Jun 17, 2016 at 10:33:03AM +0200, Jean-Marc Lasgouttes wrote:

Le 17/06/2016 à 10:10, Scott Kostyshak a écrit :

I guess the main question is: do you think a user would enter a relative
path in that dialog intending for it to be immediately converted to an
absolute path? The more I think about it, I cannot think of such a case
for any of the fields (although I agree that for some of the fields a
relative path would not makes much sense, like the templates path).


I like the idea. We can have a tooltip explaining how it works.


Do you support allowing relative paths for all the fields in the paths
tab or only working directory?


I only have an opinion for the working directory. Also I do not
understand which path field you are referring to (lost in translation).


If all, then instead of a tool tip since
the behavior would be consistent for all the paths we could put a note
at the top/bottom explaining something like "you may use relative paths
or absolute paths. Relative paths will be expanded with respect to the
directory you start LyX from, and thus could change each LyX session".


I see other paths that do not make much sense as relative directories.
However this could provide a more uniform interface. I already read for
the "TEXINPUTS prefix" tooltip: ". designates the current directory".
What you suggest would be less hidden and more uniform.




Re: default dir when save for first time is not cwd

2016-06-30 Thread Scott Kostyshak
On Fri, Jun 17, 2016 at 07:21:32PM -0400, Scott Kostyshak wrote:
> On Fri, Jun 17, 2016 at 10:33:03AM +0200, Jean-Marc Lasgouttes wrote:
> > Le 17/06/2016 à 10:10, Scott Kostyshak a écrit :
> > > I guess the main question is: do you think a user would enter a relative
> > > path in that dialog intending for it to be immediately converted to an
> > > absolute path? The more I think about it, I cannot think of such a case
> > > for any of the fields (although I agree that for some of the fields a
> > > relative path would not makes much sense, like the templates path).
> > 
> > I like the idea. We can have a tooltip explaining how it works.
> 
> Do you support allowing relative paths for all the fields in the paths
> tab or only working directory? If all, then instead of a tool tip since
> the behavior would be consistent for all the paths we could put a note
> at the top/bottom explaining something like "you may use relative paths
> or absolute paths. Relative paths will be expanded with respect to the
> directory you start LyX from, and thus could change each LyX session".

Bump.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-06-17 Thread Scott Kostyshak
On Fri, Jun 17, 2016 at 10:33:03AM +0200, Jean-Marc Lasgouttes wrote:
> Le 17/06/2016 à 10:10, Scott Kostyshak a écrit :
> > I guess the main question is: do you think a user would enter a relative
> > path in that dialog intending for it to be immediately converted to an
> > absolute path? The more I think about it, I cannot think of such a case
> > for any of the fields (although I agree that for some of the fields a
> > relative path would not makes much sense, like the templates path).
> 
> I like the idea. We can have a tooltip explaining how it works.

Do you support allowing relative paths for all the fields in the paths
tab or only working directory? If all, then instead of a tool tip since
the behavior would be consistent for all the paths we could put a note
at the top/bottom explaining something like "you may use relative paths
or absolute paths. Relative paths will be expanded with respect to the
directory you start LyX from, and thus could change each LyX session".

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-06-17 Thread Jean-Marc Lasgouttes

Le 17/06/2016 à 10:10, Scott Kostyshak a écrit :

I guess the main question is: do you think a user would enter a relative
path in that dialog intending for it to be immediately converted to an
absolute path? The more I think about it, I cannot think of such a case
for any of the fields (although I agree that for some of the fields a
relative path would not makes much sense, like the templates path).


I like the idea. We can have a tooltip explaining how it works.

JMarc


Re: default dir when save for first time is not cwd

2016-06-17 Thread Scott Kostyshak
On Thu, Jun 16, 2016 at 11:04:10AM -0700, Pavel Sanda wrote:
> Guillaume Munch wrote:
> > Le 16/06/2016 01:30, Scott Kostyshak a écrit :
> >> Currently if you start a new document and save, the default directory in
> >> the save dialog is the home directory. This is true even if I start lyx
> >> from a different directory. I would prefer for the default directory to
> >> be the current working directory.
> >>
> >
> > +1
> 
> +1

The default directory can actually be configured. In Preferences on the
Paths tab, you can set the "Working directory" and this is the directory
first proposed to save files. However, if you enter '.' it is converted
immediately (save and reopen preferences to see what I mean). If you
enter it directly in the preferences file, everything works as expected.

The attached patch makes it so you can enter it in the GUI. Basically
what it does is say "do not convert a relative path to an absolute path
before storing the path in preferences". That seems reasonable to me.
Looking at the other paths in that dialog, I can imagine use cases where
one would prefer a relative path also for the backup directory and
temporary directory.

I guess the main question is: do you think a user would enter a relative
path in that dialog intending for it to be immediately converted to an
absolute path? The more I think about it, I cannot think of such a case
for any of the fields (although I agree that for some of the fields a
relative path would not makes much sense, like the templates path).

Scott
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 8b7c3b3..b50cfd0 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -634,7 +634,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool 
check_format)
case RC_DOCUMENTPATH:
if (lexrc.next()) {
document_path = 
os::internal_path(lexrc.getString());
-   document_path = expandPath(document_path);
}
break;
 


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-06-17 Thread Scott Kostyshak
On Thu, Jun 16, 2016 at 07:27:37PM +, Paul A. Rubin wrote:
> Scott Kostyshak  lyx.org> writes:
> 
> > 
> > Currently if you start a new document and save, the default directory in
> > the save dialog is the home directory. This is true even if I start lyx
> > from a different directory. I would prefer for the default directory to
> > be the current working directory.
> > 
> > Has this been discussed before?
> > 
> > Scott
> > 
> 
> Is it the case under all operating systems that running LyX from a system
> menu (Windows Start menu, Ubuntu whatchamacallit, ...) treats the user's
> home directory as the current working directory? That seems to be true for
> Linux Mint (just tested it), so probably for Ubuntu. If globally true, I see
> no harm in the change. We just need to be careful not to ambush anyone.

Good question, Paul. I agree that it seems to be true but I don't know
about other OS's.

Scott


signature.asc
Description: PGP signature


Re: default dir when save for first time is not cwd

2016-06-16 Thread Paul A . Rubin
Scott Kostyshak  lyx.org> writes:

> 
> Currently if you start a new document and save, the default directory in
> the save dialog is the home directory. This is true even if I start lyx
> from a different directory. I would prefer for the default directory to
> be the current working directory.
> 
> Has this been discussed before?
> 
> Scott
> 

Is it the case under all operating systems that running LyX from a system
menu (Windows Start menu, Ubuntu whatchamacallit, ...) treats the user's
home directory as the current working directory? That seems to be true for
Linux Mint (just tested it), so probably for Ubuntu. If globally true, I see
no harm in the change. We just need to be careful not to ambush anyone.

Paul





Re: default dir when save for first time is not cwd

2016-06-16 Thread Pavel Sanda
Guillaume Munch wrote:
> Le 16/06/2016 01:30, Scott Kostyshak a écrit :
>> Currently if you start a new document and save, the default directory in
>> the save dialog is the home directory. This is true even if I start lyx
>> from a different directory. I would prefer for the default directory to
>> be the current working directory.
>>
>
> +1

+1
p


Re: default dir when save for first time is not cwd

2016-06-16 Thread Guillaume Munch

Le 16/06/2016 01:30, Scott Kostyshak a écrit :

Currently if you start a new document and save, the default directory in
the save dialog is the home directory. This is true even if I start lyx
from a different directory. I would prefer for the default directory to
be the current working directory.



+1




default dir when save for first time is not cwd

2016-06-15 Thread Scott Kostyshak
Currently if you start a new document and save, the default directory in
the save dialog is the home directory. This is true even if I start lyx
from a different directory. I would prefer for the default directory to
be the current working directory.

Has this been discussed before?

Scott


signature.asc
Description: PGP signature