平衡点


2014/06/02

_ Elscreen から Tabbar へ移行

Elscreen に特に不満があるわけではないのだけれど.

# source: scheme
  (unless (locate-library "tabbar")
    (el-get 'sync '(tabbar)))
  (require 'tabbar nil 'noerror)
  ;; 有効化
  (tabbar-mode 1)
  ;; キーバインド: C-o で screen 風 <-- elscreen の挙動に似せる
  (global-unset-key (kbd "C-o") )
  (global-set-key (kbd "C-o n") 'tabbar-forward)
  (global-set-key (kbd "C-o p") 'tabbar-backward)
  ;; elscreen で新たに screen を作成した場合には *scratch* で開いていたので,
  ;; それっぽくしてみた.
  (global-set-key (kbd "C-o c") (lambda()(interactive)(switch-to-buffer "*scratch*")))
  (global-set-key (kbd "C-o C-c") (lambda()(interactive)(switch-to-buffer "*scratch*")))
  (global-set-key (kbd "C-o k") (lambda()(interactive)(kill-buffer)))
  ;; C-o number で tab 移動
  (require 'cl)
  (defun my:tabbar-select-tab-by-number (n)
    "Select Nth tab."
    (interactive "p")
    (let* ((tabset (tabbar-current-tabset t))
           (tab (tabbar-selected-tab tabset))
           previous)
      (when (and tabset (numberp n) (<= 1 n))
        (while (setq previous (tabbar-tab-next tabset tab t))
          (setq tab previous))
        (loop for i from 1 below n
              do (setq tab (tabbar-tab-next tabset tab))
              unless (tabbar-tab-next tabset tab) return nil)
        (tabbar-click-on-tab tab))))
  (loop for i from 1 to 9
        for fn = (intern (format "my:tabbar-select-tab-%d" i))
        do
        (fset fn `(lambda ()
                    (interactive)
                    (my:tabbar-select-tab-by-number ,i)))
        (global-set-key (read-kbd-macro (format "C-o %d" i)) fn))
  ;; タブ上でマウスホイールを使わない
  (tabbar-mwheel-mode nil)
  ;; button 無効化
  (dolist (btn '( ; tabbar-buffer-home-button
                 tabbar-scroll-left-button
                 tabbar-scroll-right-button))
    (set btn (cons (cons "" nil)
                   (cons "" nil))))
  ;; Group 無効化
  (setq tabbar-buffer-groups-function nil)
  ;; 表示設定
  (defvar my:tabbar-include-buffer-regex
    (format ".*%s.*" (regexp-opt '("*scratch*")))
    "Regexps match buffers always included tabs")
  (defvar my:tabbar-exclude-buffer-regex
    (format "%s.*" (regexp-opt '(" *" "*")))
    "Regexps match buffers always hide tabs")
  (setq tabbar-buffer-list-function
        (lambda ()
          (remove-if
           (lambda (buffer)
             (and (not (string-match my:tabbar-include-buffer-regex (buffer-name buffer)))
                  (string-match my:tabbar-exclude-buffer-regex (buffer-name buffer))))
           (buffer-list))))
  ;; 省略表示
  (setq tabbar-auto-scroll-flag nil)
  ;; tab と tab の間の幅
  (setq tabbar-separator '(1.2))

とりあえず, 今のところ不満は無い. tabbar-buffer-list-function が頭悪いので, なんとかしたいのだけれど.


2014/06/30

_ squid3.service

systemd用に squid3.service を書いてみた. 通常の用途では multi-user.target/etc/init.d/squid3 を呼んで起動する ので良いのだろうけれど, resolvconf が入っていると, 初回 boot 時に

...
811 ?        Ss     0:00 /bin/sh /etc/init.d/dnsmasq systemd-start-resolvconf
821 ?        S      0:00  \_ run-parts --arg=-a --arg=lo.dnsmasq /etc/resolvconf/update.d
863 ?        S      0:00      \_ run-parts /etc/resolvconf/update-libc.d
901 ?        S      0:00          \_ /bin/sh /etc/resolvconf/update-libc.d/squid3
902 ?        S      0:00              \_ /bin/sh /usr/sbin/invoke-rc.d squid3 reload
936 ?        S      0:00                  \_ systemctl reload squid3.service
...

となって, 上手く起動しなかった.

中身は以下の通り:

% cat /lib/systemd/system/squid3.service
[Unit]
Description=Full featured Web Proxy cache (HTTP proxy)
Before=resolvconf.service

[Service]
Type=forking
PIDFile=/run/squid3.pid
ExecStartPre=/usr/sbin/squid3 -z -f /etc/squid3/squid.conf
ExecStart=/usr/sbin/squid3 -YC -f /etc/squid3/squid.conf
ExecReload=/usr/sbin/squid3 -k reconfigure

[Install]
WantedBy=network.target

一応(個人的には)幸せにはなったが, これで良いのかどうかは定かではない.


連絡先など
最近の日記
一覧
2006|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|02|03|04|08|09|10|11|12|
2013|01|02|03|04|05|06|08|09|10|11|12|
2014|01|02|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|09|10|
2016|02|03|
2017|01|02|03|05|06|07|09|11|12|
2018|03|06|07|10|11|12|
2019|01|02|03|04|05|07|10|12|
2020|01|02|03|04|05|08|09|10|11|12|
2021|01|02|03|05|06|07|08|09|11|12|
2022|01|02|03|04|05|06|08|10|11|12|
2023|02|03|04|06|08|09|11|12|
2024|01|02|03|
Back to Top ▲