jed-users mailing list

[2011 Date Index] [2011 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [Jed-users-l] Stripping line endings


Hurray! It really works!

Thanks. I took your trick and Guenter's function.

On 12 January 2011 17:05, Manfred Hanke
<Manfred.Hanke@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Peter Bengtsson wrote:
>> How does "add_to_hooks()" work?
> Excuse me, I meant add_to_hook.
>
>> Do I need a module installed for that to work?
> (The correctly-spelled one is defined in $JED/src/hooks.c.)
>
> Cheers,
>
> Manfred
>
>
>> On 12 January 2011 12:45, Manfred Hanke
>> <Manfred.Hanke@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>> Hi Peter,
>>>
>>> Peter Bengtsson wrote:
>>>> When coding (Python) I often accidentally leave spaces trailing after
>>>> my lines. I would love for these to be automatically stripped when I
>>>> save the file. Is that possible?
>>> Sure. The following might do the job (if put in ~/.jedrc):
>>>
>>> define strip_line_endings(buf)
>>> {
>>>   push_spot();
>>>   bob();
>>>   while(re_fsearch(`[ \t]+$`) > 0)
>>>     replace_match("", 1);
>>>   pop_spot();
>>> }
>>> add_to_hooks("_jed_save_buffer_before_hooks", &strip_line_endings);
>>>
>>>
>>> Cheers,
>>>
>>> Manfred
>
> --
> Manfred Hanke      Manfred.Hanke(at)sternwarte.uni-erlangen.de
> Dr. Karl Remeis-Observatory,  University of Erlangen-Nuremberg
> Sternwartstrasse 7,      96049 Bamberg, Germany
> phone: ++49 951 95222-34                fax: ++49 951 95222-22
>   web: http://pulsar.sternwarte.uni-erlangen.de/hanke
> --
> _______________________________________________
> Jed-users-l mailing list
> Jed-users-l@xxxxxxxx
> http://mailman.jtan.com/mailman/listinfo/jed-users-l
>



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
fun crosstips.org
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


[2011 date index] [2011 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]