multi tty に即した変更を twittering-mode に加えませんか、という提案を
してみます。
emacs 23 から multi tty という機能が有効になり、ひとつの emacs session
内で graphic terminal と tty terminal の両方が使えるようになりました。
(この機能を未体験で試してみたい方は、X window で動かしている emacs で
M-x server-start としてから、kterm や xterm 等の適当な terminal emulator
上で emacsclient -t としてみてください。バッファを切り替えてみたりすれば、
ひとつの emacs の「中味」に X window と文字端末の両方からアクセスできる
ことがわかると思います。なお、NTEmacs はまだ multi tty には未対応のよう
です)
この状態で、twittering-mode の timeline をグラフィック端末の方で表示し
ておいて、tty terminal の方でしばらく作業していると、作業中に新たに取得
した tweets の表示が、以下のような点でしょぼくなってしまうのがちょっと悲
しいです。
o twittering-icon-mode をオンにしてあっても、アイコンがつかない
o ユーザー名やアカウント名、ハッシュタグに色が着かず、下線や太字等の代替
装飾による表示になってしまう
これは、tty で作業してる間は twmode に「使ってるのは文字端末である」と
判定されて、グラフィック端末用の装飾が新たに取得した tweets には適用され
ないためです(multi tty 機能が有効な emacs では、window-system の値は
emacs session ごとに一意に決まるものではなくなり、「評価時点で focus が
当たっているのがグラフィック端末か文字端末か」に依存して変わってしまうも
のになっている)。
添付のパッチは、これを解消する試みです。このようにすると、twmode のバッ
ファはグラフィック端末と文字端末のどちらで表示しても然るべき姿で表示され
ます。つまり、グラフィック端末上ではこれまで同様アイコンや色のついた文字
が表示され、文字端末上ではアイコンは省略されて色の代わりに下線や太字等の
代替装飾がつくようになります(グラフィック端末と文字端末で同時に表示する
ことも可能で、その場合はちゃんと別々の表示になる)。
よかったら取り込んでやって下さい。手許では数ヵ月使っていますが、特に問
題は発生していません(ただし試したのは emacs 24.4, 24.5 で、それ以前のバー
ジョンでの動作は未確認。一応、multi tty 未対応の場合も考慮した作りにはし
てありますが…)。また、twittering-****-face は defcustomでの定義は廃止
して defface に一本化してしまった(elisp reference に
People are sometimes tempted to create a variable whose value is a
face name. In the vast majority of cases, this is not necessary; the
usual procedure is to define a face with `defface', and then use its
name directly.
と書いてあったので)ので、変数としての twittering-****-face をカスタマイ
ズしていた人は face としてのカスタマイズをやり直すことになります。ただし、
プログラム中でこれらを実際に変数として使っていた箇所はごく僅かで、添付パッ
チで修正した twittering-timeline-{header,footer}-face の2ヶ所を除けばす
べて face がそのまま使用されていたので、この変更の影響はほとんどないと思
います。
また、twittering-icon-mode がオンのとき、文字端末上ではアイコン用のプ
レースホルダの「_」が表示されます。不格好だと思われる方は適当に修正して
ください。
井汲 景太
※ ちなみに、最初に emacs を起動するときに emacs --daemon とすると特に
frame を持たないサーバーモードで動き始め、その後で emacsclient を -c オ
プション、-t オプションをつけて実行する度にそのサーバーモードの単一の
emacs session にグラフィック端末と文字端末の frame をいくつでも attach
していけます。つまり、.emacs などの初期化コード内で「この emacs が動作し
ているのはグラフィック端末か文字端末か」を判定することは、もはやほとんど
意味がなくなってしまっています。
diff -r 2ce76db3418f twittering-mode.el
--- a/twittering-mode.el Wed Nov 26 22:25:30 2014 +0900
+++ b/twittering-mode.el Thu May 14 22:18:07 2015 +0900
@@ -89,7 +89,8 @@
(defgroup twittering-mode nil
"Settings for twittering-mode."
- :group 'hypermedia)
+ :group 'hypermedia
+ :link '(url-link "http://twmode.sf.net/"))
(defconst twittering-mode-version "HEAD")
(defconst twittering-mode-identity "$Id$")
@@ -681,14 +682,15 @@
(defvar twittering-timeline-data-table (make-hash-table :test 'equal))
-(defcustom twittering-username-face 'twittering-username-face
+(defface twittering-username-face
+ `((t :underline t :inherit ,(if (facep 'font-lock-string-face)
+ 'font-lock-string-face 'bold)))
"*Face used to display USERNAME."
- :type 'face
:group 'twittering-mode)
-(defcustom twittering-uri-face 'twittering-uri-face
+(defface twittering-uri-face
+ '((t :inherit underline))
"*Face used to display URIs."
- :type 'face
:group 'twittering-mode)
(defcustom twittering-use-native-retweet nil
@@ -771,18 +773,16 @@
'symbol)
:group 'twittering-mode)
-(defcustom twittering-timeline-header-face 'twittering-timeline-header-face
- "*Face for the header on `twittering-mode'.
-
-The face is used for rendering `twittering-timeline-header'."
- :type 'face
+(defface twittering-timeline-header-face
+ `((t :inherit ,(if (facep 'font-lock-preprocessor-face)
+ 'font-lock-preprocessor-face 'bold)))
+ "*Face for rendering `twittering-timeline-header'."
:group 'twittering-mode)
-(defcustom twittering-timeline-footer-face 'twittering-timeline-footer-face
- "*Face for the footer on `twittering-mode'.
-
-The face is used for rendering `twittering-timeline-footer'."
- :type 'face
+(defface twittering-timeline-footer-face
+ `((t :inherit ,(if (facep 'font-lock-preprocessor-face)
+ 'font-lock-preprocessor-face 'bold)))
+ "*Face for rendering `twittering-timeline-footer'."
:group 'twittering-mode)
(defcustom twittering-timeline-header "-- Press Enter here to update --\n"
@@ -9005,7 +9005,8 @@
(twittering-make-string-with-source-property
(cdr (assq 'source ,status-sym)) ,status-sym))
("i" .
- (when (and twittering-icon-mode window-system)
+ (when (and twittering-icon-mode
+ (or (featurep 'multi-tty) window-system))
(let ((url
(cond
((and twittering-use-profile-image-api
@@ -9585,7 +9586,7 @@
(mapconcat
(lambda (substr)
(propertize substr
- 'face twittering-timeline-footer-face))
+ 'face 'twittering-timeline-footer-face))
(split-string (or twittering-timeline-footer "") "\n")
"\n"))
(header
@@ -9593,7 +9594,7 @@
(mapconcat
(lambda (substr)
(propertize substr
- 'face twittering-timeline-header-face))
+ 'face 'twittering-timeline-header-face))
(split-string (or twittering-timeline-header "") "\n")
"\n")))
(twittering-render-a-field (point-min) footer-id footer t)
@@ -10473,26 +10474,6 @@
"Initialize global variables for `twittering-mode' if they have not
been initialized yet."
(unless twittering-initialized
- (defface twittering-username-face
- `((t ,(append '(:underline t)
- (face-attr-construct
- (if (facep 'font-lock-string-face)
- 'font-lock-string-face
- 'bold)))))
- "" :group 'faces)
- (defface twittering-uri-face `((t (:underline t))) "" :group 'faces)
- (defface twittering-timeline-header-face
- `((t ,(face-attr-construct
- (if (facep 'font-lock-preprocessor-face)
- 'font-lock-preprocessor-face
- 'bold))))
- "Timeline header on twittering-mode" :group 'faces)
- (defface twittering-timeline-footer-face
- `((t ,(face-attr-construct
- (if (facep 'font-lock-preprocessor-face)
- 'font-lock-preprocessor-face
- 'bold))))
- "Timeline footer on twittering-mode" :group 'faces)
(twittering-update-status-format)
(when twittering-use-convert
(if (null twittering-convert-program)
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
twmode-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/twmode-users