Re: shortcuts for entering dates in emacs?

2017-09-20 Thread David Glasser
Now that I'm trying to switch away from my old habits of MM/DD with the Y
command, is there a way to make ledger error out if I accidentally leave
off a year?

On Mon, Aug 7, 2017 at 1:10 AM, David Glasser 
wrote:

> On Tue, Aug 1, 2017 at 3:18 PM, David Glasser 
> wrote:
> > - automatically adding years to all my existing transactions (I can write
> > some scripts to do it for sure, but if somebody already did then that's
> nice
> > :) )
>
> Handled that part myself:
>
> $ perl -pi -e '/^Y (\d\d\d\d)/ and $y = $1; s!^(\d\d?[-/]\d\d?
> )!$y/$1!' personal.ledger
>
> (You have to be careful with includes, but that wasn't relevant for me.)
>
> --
> glas...@davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/
>



-- 
glas...@davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-07 Thread David Glasser
On Tue, Aug 1, 2017 at 3:18 PM, David Glasser  wrote:
> - automatically adding years to all my existing transactions (I can write
> some scripts to do it for sure, but if somebody already did then that's nice
> :) )

Handled that part myself:

$ perl -pi -e '/^Y (\d\d\d\d)/ and $y = $1; s!^(\d\d?[-/]\d\d?
)!$y/$1!' personal.ledger

(You have to be careful with includes, but that wasn't relevant for me.)

-- 
glas...@davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-04 Thread Yuri Khan
On Wed, Aug 2, 2017 at 12:13 PM, Yuri Khan  wrote:

> I think I might like Tab to autocomplete and canonicalize dates. The
> idea is that if you typed a single number at the beginning of line and
> pressed Tab, it would expand to the date in the current or last month;
> two numbers with a separator would expand to the date in the current
> or last year; and separators would be normalized according to
> ledger-default-date-format. (The “current or last” in both cases would
> resolve to yield a date that is not in the future.)

My attempt at implementing this is here:

https://github.com/ledger/ledger-mode/pull/48

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-03 Thread Yuri Khan
On Fri, Aug 4, 2017 at 1:55 AM, Marcin Borkowski  wrote:

>> - making it faster in emacs to enter dates (other than today, I already
>> have an insert current date keybinding)?
>
> How about org-read-date?

It’s a good facility, however, from its docstring:

Furthermore, the command prefers the future,
so if you are giving a date where the year is not given, and the day-month
combination is already past in the current year, it will assume you
mean next year.

This makes sense when planning future events as might be the primary
use case with org-mode; but my gut feeling is that in ledger-mode one
normally records past events, so the opposite logic should apply.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-03 Thread Marcin Borkowski

On 2017-08-02, at 00:18, David Glasser  wrote:

> - making it faster in emacs to enter dates (other than today, I already
> have an insert current date keybinding)?

How about org-read-date?

> --dave

Hth,

-- 
Marcin Borkowski

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-02 Thread John Wiegley
> "DG" == David Glasser  writes:

GD> Hmm, doesn't look like print --raw adds years to dates, and it also drops
DG> a lot of my comments.

Ah, right, the whole job of --raw is to preserve your input formatting as much
as possible, so my mistake. And yes, printing always drops comments (there is
nowhere to keep them in the internal data structures).

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-02 Thread David Glasser
Ooh, I'd definitely use that!

On Tue, Aug 1, 2017 at 10:13 PM, Yuri Khan  wrote:

> On Wed, Aug 2, 2017 at 5:18 AM, David Glasser 
> wrote:
>
> > Anybody have advice on either:
> >
> > - making it faster in emacs to enter dates (other than today, I already
> have
> > an insert current date keybinding)?
>
> I think I might like Tab to autocomplete and canonicalize dates. The
> idea is that if you typed a single number at the beginning of line and
> pressed Tab, it would expand to the date in the current or last month;
> two numbers with a separator would expand to the date in the current
> or last year; and separators would be normalized according to
> ledger-default-date-format. (The “current or last” in both cases would
> resolve to yield a date that is not in the future.)
>
> Example: On 2018-01-03, you enter "30" at the start of line, press
> Tab, and it expands to 2017-12-30.
>
> I will try implementing that if anyone else thinks it would be a good idea.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ledger-cli+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
glas...@davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-01 Thread Yuri Khan
On Wed, Aug 2, 2017 at 5:18 AM, David Glasser  wrote:

> Anybody have advice on either:
>
> - making it faster in emacs to enter dates (other than today, I already have
> an insert current date keybinding)?

I think I might like Tab to autocomplete and canonicalize dates. The
idea is that if you typed a single number at the beginning of line and
pressed Tab, it would expand to the date in the current or last month;
two numbers with a separator would expand to the date in the current
or last year; and separators would be normalized according to
ledger-default-date-format. (The “current or last” in both cases would
resolve to yield a date that is not in the future.)

Example: On 2018-01-03, you enter "30" at the start of line, press
Tab, and it expands to 2017-12-30.

I will try implementing that if anyone else thinks it would be a good idea.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-01 Thread David Glasser
Hmm, doesn't look like print --raw adds years to dates, and it also drops a
lot of my comments.

On Tue, Aug 1, 2017 at 3:23 PM, John Wiegley  wrote:

> > "DG" == David Glasser  writes:
>
> GD> - automatically adding years to all my existing transactions (I can
> write
> GD> some scripts to do it for sure, but if somebody already did then that's
> GD> nice :) )
>
> ledger print --raw is designed to reproduce your input file as closely as
> possible (minus placement of automated transactions and such).
>
> --
> John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2
>



-- 
glas...@davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-01 Thread Craig Earls
I will admit that I haven't been particularly stringent in my change
reviews. I remember someone try to "fix" something in the date regex it
must have broken this case.

I will look.

On Tue, Aug 1, 2017 at 15:23 John Wiegley  wrote:

> > "DG" == David Glasser  writes:
>
> GD> - automatically adding years to all my existing transactions (I can
> write
> GD> some scripts to do it for sure, but if somebody already did then that's
> GD> nice :) )
>
> ledger print --raw is designed to reproduce your input file as closely as
> possible (minus placement of automated transactions and such).
>
> --
> John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ledger-cli+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Craig, Corona De Tucson, AZ
[image: missile_flyout]
enderw88.wordpress.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: shortcuts for entering dates in emacs?

2017-08-01 Thread John Wiegley
> "DG" == David Glasser  writes:

GD> - automatically adding years to all my existing transactions (I can write
GD> some scripts to do it for sure, but if somebody already did then that's
GD> nice :) )

ledger print --raw is designed to reproduce your input file as closely as
possible (minus placement of automated transactions and such).

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.