Switch from paco to porg
Ubuntuでソースコードからインストールしたパッケージは pacoで管理していたんですが, Ubuntu16.10で pacoが削除されてしまったため porgへ移行しました.
データベースの移管
paco2porgを使う. pacoをインストールして dist-upgradeした場合 paco2porgが自動で入っているようです. しかし porg自体はインストールされないので, インストールする必要がありました.
% sudo paco2porg % sudo apt install porg
paco2porg後 porgコマンドでインストール一覧を見られることを確認します. porg -a
で一覧が見られれば OKです.
% porg -a cmigemo emacs-devel global-6.5.4
コマンド利用例
パッケージ追加と削除だけ. コマンド体系はほとんど同じですが, 微妙に異なるものもあります. 詳しくは manなどで確認してください.
パッケージ追加
# パッケージ名を明示的にしている場合 % sudo porg -l --package=emacs-devel make install # パッケージ名としてディレクトリ名を使う場合 % sudo porg -l -D make install
パッケージ削除
% sudo porg -r emacs-devel
zsh補完
オプションが覚えられないので書きました. よろしければどうぞ.
おわりに
ソースからいろいろ入れるなら Archとか Gentooを使うべきですね...
Patch for building Emacs on Ubuntu 16.10
I upgraded my server Ubuntu from 16.04 to 16.10. Then I couldn't build Emacs. I got following error at make
Dumping under the name emacs Makefile:736: recipe for target 'bootstrap-emacs' failed make[1]: *** [bootstrap-emacs] Segmentation fault (core dumped) make[1]: Leaving directory '/home/syohei/src/tmp/emacs-25.1/src' Makefile:398: recipe for target 'src' failed make: *** [src] Error 2
Patch(for Emacs 25.1)
NOTE: Git master branch already fixed this issue. You don't need patch if you use it.
diff --git a/configure.ac b/configure.ac index cd4d1c0..3dfb25d 100644 --- a/configure.ac +++ b/configure.ac @@ -5159,25 +5159,29 @@ case "$opsys" in *) LD_SWITCH_SYSTEM_TEMACS= ;; esac -# -nopie fixes a temacs segfault on Gentoo, OpenBSD, and other systems -# with "hardened" GCC configurations for some reason (Bug#18784). -# We don't know why -nopie works, but not segfaulting is better than -# segfaulting. Use ac_c_werror_flag=yes when trying -nopie, otherwise -# clang keeps warning that it does not understand -nopie, and pre-4.6 -# GCC has a similar problem (Bug#20338). -AC_CACHE_CHECK([whether $CC accepts -nopie], - [emacs_cv_prog_cc_nopie], +# -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD, +# Ubuntu, and other systems with "hardened" GCC configurations for +# some reason (Bug#18784). We don't know why this works, but not +# segfaulting is better than segfaulting. Use ac_c_werror_flag=yes +# when trying the option, otherwise clang keeps warning that it does +# not understand it, and pre-4.6 GCC has a similar problem +# (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the +# spelling used by GCC 6.1.0 and later (Bug#24682). +AC_CACHE_CHECK( + [for $CC option to disable position independent executables], + [emacs_cv_prog_cc_no_pie], [emacs_save_c_werror_flag=$ac_c_werror_flag emacs_save_LDFLAGS=$LDFLAGS ac_c_werror_flag=yes - LDFLAGS="$LDFLAGS -nopie" - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [emacs_cv_prog_cc_nopie=yes], - [emacs_cv_prog_cc_nopie=no]) + for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do + test $emacs_cv_prog_cc_no_pie = no && break + LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break]) + done ac_c_werror_flag=$emacs_save_c_werror_flag LDFLAGS=$emacs_save_LDFLAGS]) -if test "$emacs_cv_prog_cc_nopie" = yes; then - LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -nopie" +if test "$emacs_cv_prog_cc_no_pie" != no; then + LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie" fi if test x$ac_enable_profiling != x ; then
% patch -p1 < emacs-25.1.patch
Regenerate configure
% ./autogen.sh
Build Emacs
% ./configure --with-modules % make % sudo make install
libpcre binding of Emacs Lisp
I'm writing libpcre binding of Emacs Lisp. Most of programmers is not familiar with Emacs Lisp regular expression because regular expression function or library of many languages has compatibility of Perl regular expression. I suppose such people writes regular expression easily with this library.
Repository
Sample code
(let ((input "https://example.com/foo/bar/baz.txt") (regexp " ^ # backslash is not necessary for grouping (https?): # $1 schema // ([^/]+) # $2 host (/.*) # $3 path $ ")) (when (pcre-string-match regexp input '(extended)) ;; extends flag allows space/comment in regular expression (message "schema:%s, host:%s, path:%s" (match-string 1 input) (match-string 2 input) (match-string 3 input)))) ;; "schema:https, host:example.com, path:/foo/bar/baz.txt"
Interfaces
https://github.com/syohex/emacs-pcre/blob/master/README.md
I design this library same as Emacs regular expression interfaces, signature, behavior etc. For example case sensitive or insensitive searching is decided by current case-fold-search
value.
Issues or any suggestions
Please report me if you have any suggestions via github issue.
Get key binding from command
Sometimes I want to get key bindings of command for implementing like following command. Please see mini-buffer.
(where-is-internal func &optional map ...)
where-is-internal
returns list of keys of command(func
) from map. For example
(where-is-internal 'next-line global-map) ;; => ([14] [down])
[14]
is Control-n
and [down]
is down arrow key. Type of return value is list of key vector. It should be converted to human readable style.
(key-description key-vector)
key-description
returns a pretty description of key-sequence. For example
(key-description [14]) ;; => "C-n"
Write function
So we can write the function which returns human readable key sequence from the command
(cl-defun function-to-keybinds (func &optional (map global-map)) (key-description (car-safe (where-is-internal func map)))) (function-to-keybinds #'next-line) ;; => "C-n" (function-to-keybinds #'python-shell-send-string python-mode-map) ;; => "C-c C-s"
visible-bellの画像を差し替える
Emacs 25から Macの visible-bellが画像を表示するようになったのでデフォルトの画像から差し替えてみた.
パッチ
Emacs25.1-RC1に対するパッチです.
diff --git a/src/nsterm.m b/src/nsterm.m index e6a10b8..9a54886 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1318,7 +1318,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, NSRectFill(NSMakeRect(0, 0, 32, 32)); [self.image unlockFocus]; #else - self.image = [NSImage imageNamed:NSImageNameCaution]; + self.image = [NSImage imageNamed:@"visible-bell.png"]; [self.image setSize:NSMakeSize(self.image.size.width * 5, self.image.size.height * 5)]; #endif
ビルド & インストール
% ./configure --with-ns --without-x % make % make install % cp -r nextstep/Emacs.app /Applications
画像を置く
適当な画像を Resources
以下に置く. Objective-Cやら Macのことがよくわかっていないのですが, ドット絵的なものでないとうまく表示されない印象. 普通のアニメの絵とかだとだいぶ潰れてしまう. また画像は小さめのものがいいです. 64x64とか(このあたりは Macに詳しければなんとかなるのかもしれないですが...)
% cp foobar.png /Applications/Emacs.app/Contents/Resources/visible-bell.png
設定
visible-bell
を有効にする
(setq visible-bell t)
結果
Ctrl-gなどを押すたびに好きな画像が見れます.
DeNAに入社しました
7月 1日から DeNAで働くことになりました. オフィスは渋谷オフィスです.
きっかけは私がストレス溜まりまくっていた時期に Twitterの名前欄に「求職中」と書いていた(非常識な行為で, 前の会社には申し訳なく思います)ときにお声がけをいただいたことです. 働いてみたいと思った理由は尊敬するエンジニアも多く, 多くの刺激を受けられ, 今の自分にとって非常に良い環境だと思ったからです. (もちろん環境はあくまで環境なので伸びるかどうかは自分次第だと思っていますが)
その他の理由としては
- お金がある会社での働き方を知りたかった
- マネージメントの行われ方を知りたかった
前の会社ではお金がないということで従業員一同様々なことで苦労しました. 一人あたりの仕事の量であったり, 携わる仕事の内容であったり. 結局お金がないとそこまでやりたくない仕事も(少ないお金で)やらないといけないし, 新しいこともできない, やりたいこともできなかったので, お金があることでどういう風な仕事をできる, どういう風に新しいことにチャレンジできるというのが知りたかったということがあります. (仕事的なこととしては今までの仕事とやっていることも随分違うので, 働きながら見つけていければと思っています)
また前職ではマネージメントらしきものはほとんどありませんでした. 基本的には個人個人に仕事があり, その裁量はすべて担当者に任されるという具合でした. これはこれで人によってはメリットだと思うのですが, 私は悪い方がでかかったんじゃないかなと思いました. そこで本を何冊か買ってこうしたらいいんじゃないかというのを自分なりにいくつか考えてみたんですが, それが良いという確証もなかったので上に相談することもなく自分の中でとどめていました. なんで, ちゃんとマネージメントがちゃんと行われている会社での働き方, それが個々の仕事にどのような影響を与えるかということを知りたかった. 私は(一応)技術のスペシャリストを目指していますが, もしマネージメント方面で面白みを感じる(そもそもほとんど知らないので)ことができればそちらに進むのもいいのではないかと考えています.
ついでに東京に出れた理由(院卒から昨年まで実家を離れられなかった)としては
- 両親の主要な借金・ローンを返済した(といっても 400万強でそこまでの額ではなかったですが)
- 奨学金をすべて返済した
- 祖母, ペットの介護が終了した
年齢的にも完全な自由が効く最後かなと思ったので, 特に働く地域の制限を設けず転職活動を行い DeNAに決めました. 昨日仕事の話を少し聞いてなかなか大変そうだと感じていますが, しっかりやっていければと思います. また今まで学んだ自分の知識(Web系とは異なる知識)というのもうまく活かせていければと思います.
今後とも, よろしくお願いします.