jed-users mailing list

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

Re: A collection of little macros


Hi Dave,

On 12.05.04, Dave Kuhlman wrote:
> I've collected a few macros that I find especially useful and
> described them at my Web site,...
>      http://www.rexx.com/~dkuhlman/jed_macros.html
> 
> If you have comments or suggestions, please send them my way.

These are my thoughts...

Generally: I like the clear and comprehensive documentation. 

For easier use a downloadable file, say kuhlmacros.sl, with all of them
would be an idea. 

Putting the keybindings at one place will make them more easily
configurable.  Commenting them out prevents accidential overwriting other
keybinding-sets (ide- or cua-emulation, say).

Ultimatively, this would include tm-documentation
suited for inclusion in the jed online help...
(You could announce it on jedmodes as well.)

Switch to Previous and Next Buffer
==================================

A slightly different version is in cuamisc.sl jedmodes.sf.net/mode/cuamisc/
Hopefully (and probabely), it will be included in the next version of jed.

The difference is, that I keep the "* *" buffers on the list (as I keep
using it to  cycle to "*traceback*", say. I can, however imagine that this
will be inconvenient to others, so a custom_variable 
Next_Buffer_Skip_Pattern or so might be an idea here...

BTW: Do you know about numbuf.sl (jedmodes.sf.net/mode/numbuf/)?


Jump to Previous and Next Word
==============================

I would change the heading to 

Jump to Previous/Next Occurence of Current Word
-----------------------------------------------
as otherwise it would hint to skip_word() and bskip_word().

If you give the full URL for txtutils, people will find it faster:

You can find txtutils at http://jedmodes.sourceforge.net/mode/txtutils/

(And the navigation menu will still invite them to browse the site...)

Copy Word or Line
=================

Only works with 
  autoload("get_word", "txtutils");

Once you are at it, you can shorten the code by using mark_word (with the
advantage of sensitivity to buffer-local wordchar setting).


define copy_word_as_kill()
    {
        variable s1;
        push_spot();
        mark_word();
        () = dupmark();
        s1 = bufsubstr();
        yp_copy_region_as_kill();
        pop_spot();
        message("\"" + s1 + "\" copied to kill ring");
    }

or even

define copy_word_as_kill()
    {
        push_spot();
        mark_word();
        () = dupmark();
        message("\"" + bufsubstr() + "\" copied to kill ring");
        yp_copy_region_as_kill();
        pop_spot();
    }

% version 1: keep point at current collumn
define duplicate_line()
{
    push_spot();
    variable line = line_as_string();
    insert("\n"+line);
    pop_spot();
    call("next_line_cmd");
}

% version 2: move point to eol
define duplicate_line()
{
    variable line = line_as_string();
    insert("\n"+line);
}

Macros for Docutils/reST
========================

Ultimately, these should go to a reStructured-Text mode, with mode menu
for the people that do not want to learn all the keybindings in
advance...

BTW: I have an unfinished structured text mode as well. So my
text_mode_hook definition goes
  autoload("text_mode_hook", "structured_text");


IMHO, the use of a text_mode_hook() is easier than a global_mode_hook()
with a lot of else-ifs..

To install these for JED's text mode, add something like the
following to your ``text_mode_hook``. 
Again, choose your own key bindings.

::
    define text_mode_hook ()
    {
       local_setkey("txt_adorn_title", "\ezt");
       set_buffer_hook ("wrap_hook", &text_mode_wrap_hook);
       % add your code...
    }

Günter


-- 
G.Milde at web.de

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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