読者です 読者をやめる 読者になる 読者になる

Release Mouse v2.4.4

https://metacpan.org/release/SYOHEX/Mouse-v2.4.4

Mouse with threads did not work on Perl 5.22.0 or higher version. This makes Text::Xslate test failure for a long time. This version fixed the issue and works with threads. Please upgrade for newer perl users.

Example

We expects $foo->syntax is "Kolon" but $foo->syntax is undef with older Mouse on Perl 5.22.0 or higher. This test is passed with Mouse v2.4.4.

#!perl
package Foo;
use Mouse;

has syntax => (
    is      => 'rw',
    isa     => 'Str',
    default => 'Kolon',
);

package main;
use strict;
use warnings;
use threads;

use Test::More;

my $foo = Foo->new;
is $foo->syntax, "Kolon";

threads->create(sub{
    is $foo->syntax, "Kolon";
})->join();

done_testing;

evil-textobj-line

evil-textobj-line is Emacs port of @kana1's vim-textobj-line. evil-text-obj-line provides functions which select portion of current line.

Repository

https://github.com/syohex/evil-textobj-line

Demo a line("val")

a-line selects whole current line

f:id:syohex:20150731140024g:plain

Demo inner line("vil")

inner-line selects current line excepts both leading spaces and trailing spaces.

f:id:syohex:20150731140054g:plain

atomを起動できない問題の workaround

atomを使ってみようと, Ubuntu 15.04に公式 debパッケージを使って, インストールして起動しようとしてみたが以下のエラーが出て起動しない.

line 98:  8076 Aborted                 (core dumped) nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1
[8076:0727/230141:ERROR:browser_main_loop.cc(170)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[libprotobuf FATAL ../../third_party/protobuf/src/google/protobuf/stubs/common.cc:61] This program requires version 2.6.0 of the Protocol Buffer runtime library, but the installed version is 2.5.0.  Please update your library.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "gen/proto_out/session/candidates.pb.cc".)
Failed to get crash dump id.
Report Id:

Ubuntu 14.04ではなんともなかったのだが, 起動さえもできなくなってしまった. Protocol Bufferライブラリのバージョンについて怒られているが, インストールしているバージョンは 2.6台でそこに問題はない(はず).

Workaround

環境変数 GTK_IM_MODULE(KDE等の Qt環境では QT_IM_MODULE)と XMODIFIERSを無効にして起動すれば問題ないことがわかった.( 参考). 以下のようなスクリプトを /usr/binより優先される PATHに置き, 実行すればとりあえず起動できることはわかった. インプットメソッドは起動できないので日本語は打てないが, 必要ないのでとりあえずいいでしょう.

#!/bin/sh

set -e

unset GTK_IM_MODULE
unset XMODIFIERS
/usr/bin/atom $@

Implement my own simple helm-find-files

f:id:syohex:20150715144102p:plain

helm-find-files is useful command for opening files in current directory. However I have some complaints for it. - I want to see only files, not directories(., .. etc). - I don't want to open binary files - I use only some actions(open file, open file in other window, insert file)

Here is code. To collect files is following step - Collect all files/directory in current directory by glob('* .*') - filter them by -T file flag - -T file flag returns true if argument is text file.

(defun my/helm-find-files-init ()
  (with-current-buffer (helm-candidate-buffer 'global)
    (unless (zerop (process-file "perl" nil t nil "-wE" "say for grep {-T $_} glob('* .*')"))
      (error "Failed: collect files"))))

(defvar my/helm-source-find-files
  (helm-build-in-buffer-source "Find Files"
    :init 'my/helm-find-files-init
    :action '(("Find File" . find-file)
              ("Find File other window" . find-file-other-window)
              ("Insert File" . insert-file))))

(defun my/helm-find-files ()
  (interactive)
  (helm :sources '(my/helm-source-find-files) :buffer "*Helm Find Files*"))

This is a little slow because Perl is not so fast language :-(

How to disassemble MacOSX binary(O-Mach) on Linux

f:id:syohex:20150713165520p:plain

Download Binutils

Download Binutils

% curl -LO http://ftp.jaist.ac.jp/pub/GNU/binutils/binutils-2.25.tar.bz2

Configuration

Change --prefix as you like.

% tar xf binutils-2.25.tar.bz2
% cd binutils-2.25
% mkdir build
% cd build
% ../configure --prefix=/opt/mac --target=x86_64-apple-darwin --enable-64-bit-bfd --disable-nls

Build and Install

% make
% sudo make install

Set PATH environment variable to the --prefix directory. In this case, export PATH=/opt/mac/bin:$PATH

Disassemble

% x86_64-apple-darwin-objdump -d peco |less

quickrun.el 2.2.4 released

I released quickrun 2.2.4

This version fixes quickrun-shell command. It was broken long time ago. Sorry I didn't realize it because I didn't use it. quickrun-shell executes buffer with eshell, it supports interactive program which reads something from STDIN etc. Here is a quickrun-shell demo.

f:id:syohex:20150710210829g:plain

Please report me if you have any quickrun issues or suggestions.