平衡点
2016/03/02
_ Emacs に powerline.el を入れた.
あるいは モードラインのダイエット(3/n)
...現実逃避以外の何者でもない.
Powerline の説明は以下:
導入して,default のテーマを有効にしてみた.確かに見た目は綺麗.
しかしながら,やはり SKK の indicator が気になってしまう. 何が気になるか,といえば:
ということで. つまるところSKK の有効or無効にかかわらず左側にASCII 二文字分の幅で状態を表示させておきたい, という欲求であるわけです.
どうするか?
安直にやります.
;; ddskk の状態を左側に表示したい (defun my:skk-modeline-input-mode () "skk が読み込まれていない場合でも skk-modeline-input-mode に文字を入れて返す" (cond ((not (boundp 'skk-modeline-input-mode)) (setq skk-modeline-input-mode "--[--]:")) (t skk-modeline-input-mode))) ;; skk の on/off で modeline に状態が挿入されるので,それを止める. (defadvice skk-setup-modeline (around my:disable-skk-setup-modeline activate) "skk-setup-modeline による modeline の更新を無効化" (setq skk-indicator-alist (skk-make-indicator-alist)) (force-mode-line-update t))
として,powerline の theme 指定で
(defun my:powerline-theme () "my powerline theme." (interactive) (my:skk-modeline-input-mode) (setq-default mode-line-format '("%e" (:eval (let* ((active (powerline-selected-window-active)) (mode-line (if active 'mode-line 'mode-line-inactive)) (face1 (if active 'powerline-active1 'powerline-inactive1)) (face2 (if active 'powerline-active2 'powerline-inactive2)) (separator-left (intern (format "powerline-%s-%s" (powerline-current-separator) (car powerline-default-separator-dir)))) (separator-right (intern (format "powerline-%s-%s" (powerline-current-separator) (cdr powerline-default-separator-dir)))) (lhs (list (powerline-raw (substring skk-modeline-input-mode 2 -1) nil 'l) (powerline-raw "%*" nil 'l) ... 以下略
としました.
まとめ
まあ,これで良いかな,と.常に ddskk のモードが左側に同じ幅で出ているので良しとします.
あ,minor-mode の省略表示には diminish が良いのでは?
...現実逃避以外の何者でもない(大事なことなので二度ry.
2020/03/02
_ automaticruby を設定したり
昨今の情勢を鑑みるに, イロイロなイベントが中止になるのはしょうがないと思ったりもするわけですが.
口頭通知とか紙の回覧よりはマシではあるし, 一応メールでの通知も設定できるのだけれども, 情報は結局内部回線から接続する必要があるわけで, 面倒な事この上ない.
内部サイトの情報を取得整形して通知することを目的として, 久々に Plagger なんてひっぱりだしたが, 昔の記憶が定かでないうえに, Perl脳が衰退していて, まったく上手く動かせない(まあ, 元データが Shift-JIS
だったりするのもアレなんだけど).
まあ, 今時 Plagger かよ, という意見もあるわけだが
Plagger は諦めて
を使ってみたら, さっくりと動いて感動したり.
メール通知が欲しいので Publish::Sendmail
をでっちあげた.
# -*- coding: utf-8 -*-
# Name:: Automatic::Plugin::Publish::Sendmail
# Author:: Youhei SASAKI <uwabami@gfd-dennou.org>
# Created:: Mar 02, 2020
# Updated:: Mar 02, 2020
# Copyright:: Copyright (c) 2020 Youhei SASAKI <uwabami@gfd-dennou.org>
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
module Automatic::Plugin
class PublishSendmail
require 'pp'
require 'nkf'
require 'time'
def initialize(config, pipeline=[])
@config = config
@pipeline = pipeline
end
def run
@from = @config['from']
@rcpt = @config['rcpt']
@sendmail = @config['command'] || '/usr/sbin/sendmail'
@pipeline.each {|feeds|
unless feeds.nil?
feeds.items.each {|feed|
IO.popen(@sendmail<<' -t','w') do |p|
p.print <<EOT
From: #{@from}
To: #{@rcpt}
Subject: #{NKF.nkf('-WjMm0',feed.title)}
Date: #{Time.parse(feed.dc_date.to_s).strftime("%a, %d %b %Y %X %z")}
Mime-version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"></head><body>
#{feed.description.gsub(/[\s ]/,'')}
</body></html>
EOT
end
}
end
}
@pipeline
end
end
end
あとはこれを cron でまわしておくなど.