[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Weechat-dev] [task #12869] weechat.look.hotlit_sort option allowing jum
From: |
squirrel |
Subject: |
[Weechat-dev] [task #12869] weechat.look.hotlit_sort option allowing jumping to the buffer with a *higher* number, etc |
Date: |
Fri, 18 Oct 2013 02:26:50 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0 |
Follow-up Comment #1, task #12869 (project weechat):
arza wrote a plugin for this!
(this has to be in the core tho)
# jump_smart_higher.pl for WeeChat by arza <address@hidden>, distributed freely
and without any warranty, licensed under GPL3
<http://www.gnu.org/licenses/gpl.html>
# Jump to a higher buffer with activity, similar to /input smart_jump (alt-a)
but jump to a buffer with higher number if possible
weechat::register('jump_smart_higher', 'arza <address@hidden>', '0.1', 'GPL3',
'Jump to a higher buffer with activity', '', '');
weechat::hook_command('jump_smart_higher',
"Jump to the buffer that
1. has the highest activity
2. is after current buffer if possible
3. has the lowest number",
'', '', '', 'command', '');
sub command { my $buffer=$_[1];
my $max_priority = 0;
my $min_number = 1000000;
my $current_number = weechat::buffer_get_integer($buffer, 'number');
my $number = 0;
my $priority = 0;
my $infolist = weechat::infolist_get('hotlist', '', '');
while(weechat::infolist_next($infolist)){
$number = weechat::infolist_integer($infolist, 'buffer_number');
$priority = weechat::infolist_integer($infolist, 'priority');
if($priority > $max_priority){ $max_priority = $priority;
$min_number =
1000000; }
elsif($priority < $max_priority){ next; }
if($number < $current_number){ $number += 10000; }
if($number < $min_number){ $min_number = $number; }
}
weechat::infolist_free($infolist);
weechat::command($buffer, "/buffer " . $min_number % 10000);
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/task/?12869>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Weechat-dev] [task #12869] weechat.look.hotlit_sort option allowing jumping to the buffer with a *higher* number, etc,
squirrel <=