aboutsummaryrefslogtreecommitdiffstats
path: root/vimput.pl
diff options
context:
space:
mode:
authorTeddy Wing2017-12-16 21:55:53 +0100
committerTeddy Wing2017-12-16 21:57:09 +0100
commit374c20e1685092638f0b9f364823d69a818addac (patch)
treeb4f6213cfc0d6387462ab516fea3b5bb0de260d0 /vimput.pl
parent50016ba411c99415010bc47c42677acbbba8da4d (diff)
downloadirssi-vimput-374c20e1685092638f0b9f364823d69a818addac.tar.bz2
Get rid of old commented code
Now that we have a FIFO that works, we can obliterate the old failed tries, and a few frustration-fueled obscenities.
Diffstat (limited to 'vimput.pl')
-rw-r--r--vimput.pl136
1 files changed, 0 insertions, 136 deletions
diff --git a/vimput.pl b/vimput.pl
index 88df057..2114d00 100644
--- a/vimput.pl
+++ b/vimput.pl
@@ -48,111 +48,16 @@ sub open_tmux_split {
my $random_unused_filename = tmpnam();
- # my $command = "vim ${\vimput_file}";
my $command = "vim -c 'set buftype=acwrite' -c 'read ${\vimput_file}' -c '1 delete _' -c 'autocmd BufWriteCmd <buffer> :write $fifo | set nomodified' $random_unused_filename";
system('tmux', 'split-window', $command);
}
sub update_input_line_when_finished {
- # my ($handle, $filename) = tempfile();
- # print $filename;
- # my $tempdir = tempdir('vimput-XXXXXXXXXX');
- # my $fifo_path = "$tempdir/fifo";
- # my $fifo;
- # $fifo->autoflush(1);
-
- # my $pid = fork();
- # die $! if not defined $pid;
-
-# if ($pid == 0) { # child
- # my $fifo_path = tmpnam();
- # print 'F: ' . $fifo_path;
- #
- # mkfifo($fifo_path, 0600) or die $!;
-
- # my $tag;
- # my @args = ($fifo, \$tag);
- # $tag = Irssi::input_add(
- # fileno($fifo),
- # Irssi::INPUT_READ,
- # \&adljkhadhadfhjkl,
- # \@args
- # );
-
- # open $fifo, '<', $fifo_path or die $!;
- # open_tmux_split($fifo_path);
- #
- # $fifo->autoflush(1);
- # while (<$fifo>) {
- # # if ($_) {
- # # print 'hello';
- # print $_;
- # # }
- # }
- # close $fifo;
-
- # exit;
- # open $fifo, '<', $fifo_path or die $!;
- # my $x = 0;
- # while (<$fifo>) {
- # last if $x > 5;
- # print $_;
- # if ($_) {
- # print $_;
- # Irssi::gui_input_set($_);
- #
- # last;
- # }
- # sleep 2;
- # $x++;
- # }
- # close $fifo;
-# }
-# else {
-# Irssi::pidwait_add($pid);
-# }
-
-
- # open my $handle, "cat ${\vimput_file} |" or die $!;
- # while (<$handle>) {
- # print $_;
- # }
- # close $handle;
-
-
- # sub update_line {
- # open my $handle, '<', vimput_file or die $!;
- # while (<$handle>) {
- # Irssi::gui_input_set($_);
- # }
- # close $handle;
- # }
- #
- # my $tag = Irssi::timeout_add(1000, \&update_line);
-
-
- # my $fuckyoumotherfucker = '/tmp/fucking-fifo';
- # unlink $fuckyoumotherfucker;
- # open_tmux_split($fuckyoumotherfucker);
- #
- # mkfifo($fuckyoumotherfucker, 0600) or die $!;
- # open my $fifo, '<', $fuckyoumotherfucker, or die $!;
- # while (<$fifo>) {
- # print $_;
- # }
- # close $fifo;
- # unlink $fuckyoumotherfucker;
-
-
my ($read_handle, $write_handle, $command_handle, $fuckface);
pipe($read_handle, $write_handle);
pipe($fuckface, $command_handle);
- # pipe($read_handle, $command_handle);
-
- # $write_handle->autoflush(1);
- # $write_handle->blocking(0);
my $pid = fork();
@@ -166,28 +71,7 @@ sub update_input_line_when_finished {
}
if ($pid == 0) {
- # my $fuckyoumotherfucker = '/tmp/fucking-fifo';
- # unlink $fuckyoumotherfucker;
- #
- # # TODO: This needs to be done in the parent
- # open_tmux_split('/tmp/fucking-other-file', $fuckyoumotherfucker);
- #
- # mkfifo($fuckyoumotherfucker, 0600) or die $!;
- # open my $fifo, '<', $fuckyoumotherfucker, or die $!;
- # while (<$fifo>) {
- # chomp $_;
- # # Irssi::gui_input_set($_);
- # print $write_handle $_;
- # }
- # close $fifo;
- # unlink $fuckyoumotherfucker;
-
my $fifo_path = tmpnam();
- # my $tempdir = tempdir('vimput.XXXXXXXXXX', TMPDIR => 1, CLEANUP => 1);
- # my $fifo_path = "$tempdir/fifo";
-
- # print $write_handle VIMPUT_IPC_COMMAND_PREFIX . $fifo_path;
- # print $command_handle $fifo_path;
close $command_handle;
open_tmux_split($fifo_path);
@@ -203,25 +87,6 @@ if ($pid == 0) {
close $fifo;
- # my $socket_path = $fifo_path;
- #
- # my $socket = IO::Socket::UNIX->new(
- # Local => $socket_path,
- # Type => SOCK_STREAM,
- # Listen => 1,
- # ) or die "Failed to create socket: $!";
- #
- # # $socket->blocking(0);
- #
- # my $connection = $socket->accept();
- # $connection->autoflush(1);
- #
- # while (my $line = <$connection>) {
- # print $write_handle $line;
- # }
- #
- # close $socket;
-
close $write_handle;
POSIX::_exit(0);
@@ -289,7 +154,6 @@ Irssi::signal_add_last 'gui key pressed' => sub {
if ($key eq CTRL_X) {
write_input(Irssi::parse_special('$L', undef, 0));
- # open_tmux_split();
update_input_line_when_finished();
}
};