package CountChars; use BarnOwl::Editwin qw(:all); sub count_chars { my $text = save_excursion { move_to_buffer_start(); set_mark(); move_to_buffer_end(); get_region(); }; BarnOwl::message(length $text); } BarnOwl::new_command('count-chars' => \&count_chars); BarnOwl::bindkey(edit => "C-\\" => command => 'count-chars');