🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: fj.editor.mule
22 messages
22 total messages Started by Kiuchi Kan Thu, 05 Oct 2000 04:20
muleで行番号表示
#263
Author: Kiuchi Kan
Date: Thu, 05 Oct 2000 04:20
19 lines
1336 bytes
はじめまして大阪市立大学の木内と申します。

mule の行番号表示を表示させたいのですがどのようにすれば
よろしいでしょうか?

理想としては
1 ほげ
2 はげ
3 ほげ

と表示させたいと思っているのですが。

M-x what-lineとする方法や反転部の行数を見ると言うのは調べた
のですが理想には遠く、setnu.elなるものを使用すれば理想に
近いものが出来ると言ううわさを聞いたのですが、やり方がわかり
ません。

よろしければsetnu.elの使い方かもっとスマートなやり方をご存知
の方ご教授頂けませんでしょうか?
Re: muleで行番号表示
#266
Author: Osamu Nakamura
Date: Thu, 05 Oct 2000 00:00
21 lines
1585 bytes
中村といいます。

# わたしも、たまにvi的行番号表示をさせたいと思うことがあったので、
# さっそく試用させていただきました。m_o_m

At 05 Oct 2000 14:51:58 +0900,
Tsuyoshi AKIHO <akiho@media.osaka-cu.ac.jp> wrote:
> 使い方なのですが、Emacs 20.7 だと簡単に動いたんですが、
> (load "setnu") して、 M-x setnu-mode すれば良かった。
> Mule 2.3 (GNU Emacs 19.28) だと動かなかった。

ちなみに、FreeBSD 3.5.1 で ports からインストールしたMule
"GNU Emacs 19.34.1 (i386--freebsd3.5, X toolkit)"
では、とりあえず動作しました。(簡単に cut / paste してみただけ)

# 行数が多い(5000行)と、行番号表示の切替にかなり時間がかかるのが難点?
# (PentiumII 300MHz の場合)

御参考まで。

--
Re: muleで行番号表示
#264
Author: Tsuyoshi AKIHO
Date: Thu, 05 Oct 2000 05:51
31 lines
2243 bytes
秋保です。

>>>>> In <8rgvhm$be4$1@suminoe.ex.media.osaka-cu.ac.jp> 
>>>>>	nak-k@aat.mtci.ne.jp (Kiuchi Kan) wrote:

nak-k> のですが理想には遠く、setnu.elなるものを使用すれば理想に
nak-k> 近いものが出来ると言ううわさを聞いたのですが、やり方がわかり
nak-k> ません。

nak-k> よろしければsetnu.elの使い方かもっとスマートなやり方をご存知
nak-k> の方ご教授頂けませんでしょうか?

setnu.el は、
http://www.wonderworks.com/

から取得できるのですね。VM の Kyle Jones 作だそうな。

使い方なのですが、Emacs 20.7 だと簡単に動いたんですが、
(load "setnu") して、 M-x setnu-mode すれば良かった。
Mule 2.3 (GNU Emacs 19.28) だと動かなかった。
ちょっと見てみたところ僕には手におえそうにない。
overlay のところがおかしいようだけど。

;; mode lineに行番号を表示
(line-number-mode t)

を ~/.emacs に入れるというのでは、ダメなのですね。

-- 
Tsuyoshi AKIHO
akiho@media.osaka-cu.ac.jp
Re: muleで行番号表示
#265
Author: Kiuchi Kan
Date: Thu, 05 Oct 2000 06:34
26 lines
1762 bytes
In article <8rh4t0$p19$1@ocusv4.bb.osaka-cu.ac.jp>, 
akiho@media.osaka-cu.ac.jp says...
>
>秋保です。
あれま、よろしくお願いいたします。

>(load "setnu") して、 M-x setnu-mode すれば良かった。

この当たり参考になるページとかございましたら。

>Mule 2.3 (GNU Emacs 19.28) だと動かなかった。
>ちょっと見てみたところ僕には手におえそうにない。
>overlay のところがおかしいようだけど。

setnu.elは使えないと。

>;; mode lineに行番号を表示
>(line-number-mode t)
>を ~/.emacs に入れるというのでは、ダメなのですね。

これだと行番号を見るためにいちいち反転部を見なきゃいけませんよね。
その手間すら省くために左横に行数表示が欲しいなと。。

Loadと言うのはモジュールをセットアップする事なのでしょうか?
その当たり良く理解していないのです。自分でも調べてみますが
もし参考になるようなページなどございましたら。
Re: mule で行番号表示
#272
Author: Tsuyoshi AKIHO
Date: Fri, 06 Oct 2000 00:00
45 lines
3188 bytes
秋保です。(メールで来たので、メールに先に返事を出してNetNews
に出すのを忘れてました)

>>>>> In <200010060510.OAA08297@abiko.ex.media.osaka-cu.ac.jp> 
>>>>>	a96c035@ex.media.osaka-cu.ac.jp (Kiuchi Kan) wrote:
a96c035> > fj.editor.mule ということなので、Mule は、大学の NeXTSTEP 上
a96c035> > の GNU Emacs 19.28 base で動いてほしいということなのでしょう
a96c035> > か。

a96c035> 冒頭に述べた環境で自宅にて使用しているmuleの環境を改善したいのです。

M-x emacs-version で調べることができます。ちなみに M-x
mule-version では、Mule の version がわかります。

a96c035> > 使用する Emacs を変更できるというのであれば、setnu.el が動く
a96c035> > んですけど。
a96c035> Winからtelnetして日本語通ればいいんですけど。
a96c035> 日本語に関してはイマイチという噂を聞いているのでmuleを習得しようと
a96c035> 思っています。 いまだに迷っているのですが。

Mule 2.3 (GNU Emacs 19.31 base)よりも Emacs 20 の方が断然よ
いと思います。というのも、最近の Emacs Lisp のソフトの対象が
新しい Emacs でしか動かないことが多いので。

日本語関係に関しては、Mule 2.3 とひけを取らないというか上を
いっているはずです(4.0 (HANANOEN) と version 名が上だから,
と思うんだけど)。ただ、Mule と同じように初期設定がなっていな
いからとか、command の配置が変更されているとか、いままで動い
ている elisp が動かないとかの理由で、いまでも Mule 2.3 を使っ
ているんじゃないのかな。

イマイチという噂の出所を教えて頂けると幸いです。

Emacs 20 では、 M-x set-terminal-coding-system [RET]
shift_jis [RET] すれば、表示が sjis になります。
また、 M-x set-keyboard-coding-system  [RET]
shift_jis [RET] すれば、MS-IME などから日本語入力ができます。

Mule 2.3 だったら、
set-terminal-coding-system -> set-display-coding-system 
で OK 。

-- 
Tsuyoshi AKIHO
akiho@media.osaka-cu.ac.jp
Re: mule で行番号表示
#273
Author: Kiuchi Kan
Date: Fri, 06 Oct 2000 00:00
23 lines
1578 bytes
In article <8rjv9l$6qt$1@ocusv4.bb.osaka-cu.ac.jp>, 
akiho@media.osaka-cu.ac.jp says...
>
>秋保です。(メールで来たので、メールに先に返事を出してNetNews
>に出すのを忘れてました)

> Emacs 20 の方が断然よいと思います。
なぬ。。そう言う事ならEmacsにしよう。と言うかほとんどいっしょですよね。

>イマイチという噂の出所を教えて頂けると幸いです。

知人から1年ほど前に聞いたのですが情報が古すぎたようです。

>Emacs 20 では、 M-x set-terminal-coding-system [RET]
>shift_jis [RET] すれば、表示が sjis になります。
>また、 M-x set-keyboard-coding-system  [RET]
>shift_jis [RET] すれば、MS-IME などから日本語入力ができます。
>
>Mule 2.3 だったら、
>set-terminal-coding-system -> set-display-coding-system 
>で OK 。

丁寧にありがとうございました。
Re: muleで行番号表示
#268
Author: Kazuhiko Kuratani
Date: Fri, 06 Oct 2000 03:11
36 lines
2867 bytes
倉谷と申します。

nak-k@aat.mtci.ne.jp (Kiuchi Kan) writes:
> mule の行番号表示を表示させたいのですがどのようにすれば
> よろしいでしょうか?

以前、Emacs-lispの勉強のために、行番号を付加するプログラム
を書いたことがあります。

下記のソースを.emacsに追加して、M-x kk-insert-line-numberと
打鍵すれば行番号を付加できます。確認は、Meadow 1.00(GNU
Emacs 20.2.1相当)でしております。

これでどうでしょうか?

---- ここから ---- ここから ---- ここから ---- ここから ---- 

;;; 行番号を付加する関数
(defun kk-insert-line-number()                                         
"バッファに行番号を自動的に付加する命令。プログラムソース出力に使う。"
(interactive)                                                          
(save-excursion                                                        
; 1行目の処理                                                         
  (goto-char(point-min))                    ; バッファの最前行へ移動
; 2行目以降                                                           
(setq kk-counter 1)                         ; カウンタ初期化
  (while(bolp)                              ; 行の最初であるならループ続行
       (beginning-of-line)                  ; 行頭にカーソルを移動
       (insert (format "%3d " kk-counter))  ;フォーマット変換             
       (forward-line 1)                     ; 一行進める                      
       (setq kk-counter (+ kk-counter 1))))); カウンタのインクリメント

---- ここまで ---- ここまで ---- ここまで ---- ここまで ---- 

# 改善したらよい点などを指摘をしてください > 上級者の方
Re: muleで行番号表示
#270
Author: Tsuyoshi AKIHO
Date: Fri, 06 Oct 2000 03:33
83 lines
4329 bytes
秋保です。

>>>>> In <8rh7d0$edr$1@suminoe.ex.media.osaka-cu.ac.jp> 
>>>>>	nak-k@aat.mtci.ne.jp (Kiuchi Kan) wrote:

nak-k> >(load "setnu") して、 M-x setnu-mode すれば良かった。

nak-k> この当たり参考になるページとかございましたら。

うーん。一般的なファイル一つの elisp のインストールは、
適当な場所に、*.el ファイルを置く。そのディレクトリ(例えば
/home/akiho/elisp/setnu に setnu.el ファイルを置く場合)の場
所を ~/.emacs に

(setq load-path (cons "/home/akiho/elisp/setnu" load-path))
(load "setnu")

と書くと起動時に、setnu.elc があれば、それを評価し、.elc
ファイルがなければ、setnu.el が評価されます。.el ファイルは、
Emasc Lisp というプログラミング言語で書かれたプログラムのソー
スファイルです。それで、評価というのは、プログラムを実行する
ことを言います。

.elc というファイルは、バイトコンパイルされた ファイルで、
Emacs が理解しやすいので実行速度も速くなる形式で人間には読め
ない形式です。

単純に ファイル一つだったら、
(load "/home/akiho/elisp/setnu/setnu.el")
でも構わないですね。

nak-k> >Mule 2.3 (GNU Emacs 19.28) だと動かなかった。
nak-k> >ちょっと見てみたところ僕には手におえそうにない。
nak-k> >overlay のところがおかしいようだけど。

nak-k> setnu.elは使えないと。

いま、setnu.el を見かえしたら、
;;; vi-style line number mode for Emacs
;;; (requires Emacs 19.29 or later, or XEmacs 19.11 or later)
              ^^^^^^^^^^^
と書いてあるではないか。ファイル一つみたいな単純な .el ファ
イルだったら、ファイルの先頭あたりに使い方が書いてあります。

;; M-x setnu-mode toggles the line number mode on and off.

みたいに。

nak-k> >;; mode lineに行番号を表示
nak-k> >(line-number-mode t)
nak-k> >を ~/.emacs に入れるというのでは、ダメなのですね。

nak-k> これだと行番号を見るためにいちいち反転部を見なきゃいけませんよね。
nak-k> その手間すら省くために左横に行数表示が欲しいなと。。

反転部って何のことかなぁと思っていたのですが、モードラインの
ことなのですね。

nak-k> Loadと言うのはモジュールをセットアップする事なのでしょうか?
nak-k> その当たり良く理解していないのです。自分でも調べてみますが
nak-k> もし参考になるようなページなどございましたら。

とりあえず、

http://www.ex.media.osaka-cu.ac.jp/pub/EmacsLisp/tips.html#books

に大学内にあるEmacs 関連の本を紹介してますので、
そこらあたりで調べる方が速いと思います。

『GNU Emacs : UNIX text processing』

だったら、書いてありそう。

fj.editor.mule ということなので、Mule は、大学の NeXTSTEP 上
の GNU Emacs 19.28 base で動いてほしいということなのでしょう
か。

使用する Emacs を変更できるというのであれば、setnu.el が動く
んですけど。

-- 
Tsuyoshi AKIHO
akiho@media.osaka-cu.ac.jp
Re: mule で行番号表示
#271
Author: Kiuchi Kan
Date: Fri, 06 Oct 2000 05:10
75 lines
3876 bytes
In <8rjh4p$1d3$1@ocusv4.bb.osaka-cu.ac.jp> Tsuyoshi AKIHO wrote:
> 秋保です。

どうも、木内です。

環境を書いていませんでした。申し訳ありません。

debian/linux ver2.1
mule 2.3だったとおもうのですが、バージョンは正確ではありません。

> Emasc Lisp というプログラミング言語で書かれたプログラムのソー
> スファイルです。それで、評価というのは、プログラムを実行する
> ことを言います。

なるほど理解しました。elっていう拡張子は何?
とか思っていましたたのでスッキリいたしました。
使い方はパスの通ったdirに置けばよいと言う事ですね。
 
> .elc というファイルは、バイトコンパイルされた ファイルで、
> Emacs が理解しやすいので実行速度も速くなる形式で人間には読め
> ない形式です。

ふむふむ 
 

> いま、setnu.el を見かえしたら、
> ;;; vi-style line number mode for Emacs
> ;;; (requires Emacs 19.29 or later, or XEmacs 19.11 or later)               
^^^^^^^^^^^
> と書いてあるではないか。ファイル一つみたいな単純な .el ファ
> イルだったら、ファイルの先頭あたりに使い方が書いてあります。
> 
> ;; M-x setnu-mode toggles the line number mode on and off.
> 
> みたいに。

了解しました。見ときます。

> nak-k> これだと行番号を見るためにいちいち反転部を見なきゃいけませんよね。
> nak-k> その手間すら省くために左横に行数表示が欲しいなと。。
> 
> 反転部って何のことかなぁと思っていたのですが、モードラインの
> ことなのですね。

そうです。
 
> nak-k> Loadと言うのはモジュールをセットアップする事なのでしょうか?
> nak-k> その当たり良く理解していないのです。自分でも調べてみますが
> nak-k> もし参考になるようなページなどございましたら。
> とりあえず、
> http://www.ex.media.osaka-cu.ac.jp/pub/EmacsLisp/tips.html#books
> に大学内にあるEmacs 関連の本を紹介してますので、
> そこらあたりで調べる方が速いと思います。

多謝多謝、授業が終わり次第しらべて見ます。

> fj.editor.mule ということなので、Mule は、大学の NeXTSTEP 上
> の GNU Emacs 19.28 base で動いてほしいということなのでしょう
> か。

冒頭に述べた環境で自宅にて使用しているmuleの環境を改善したいのです。

> 使用する Emacs を変更できるというのであれば、setnu.el が動く
> んですけど。
Winからtelnetして日本語通ればいいんですけど。
日本語に関してはイマイチという噂を聞いているのでmuleを習得しようと
思っています。 いまだに迷っているのですが。


--
      。  ボーっとする事は生きる為に必要です。
     。  a96c035@ex.media.osaka-cu.ac.jp
    。  kan kiuchi
   。  木内 完
(- -)  寝るって幸せ、、、、、、
Re: muleで行番号表示
#275
Author: calo
Date: Fri, 06 Oct 2000 21:25
27 lines
1934 bytes
calo @ elisp見習い です。

At 06 Oct 2000 12:11:54 +0900,
Kazuhiko Kuratani <BZN02473@nifty.ne.jp> wrote:
> # 改善したらよい点などを指摘をしてください > 上級者の方

kk-counter がグローバル変数になってしまいます。

(defun kk-insert-line-number()                                         
 "バッファに行番号を自動的に付加する命令。プログラムソース出力に使う。"
 (interactive)                                                          
 (let (kk-counter 1)
   ...
   ))

インクリメントは、
 (setq x (1+ x))
がよいでしょう。

行数は 3桁とは限りません。

C-x h M-C-\ cat -n RET
なんてのはどう?

# bolp 関数初めて知りました (^^;
--
  calo
Re: mule で行番号表示
#276
Author: calo
Date: Fri, 06 Oct 2000 21:44
31 lines
2185 bytes
At 6 Oct 2000 05:10:26 GMT,
a96c035@ex.media.osaka-cu.ac.jp (Kiuchi Kan) wrote:
> 
> In <8rjh4p$1d3$1@ocusv4.bb.osaka-cu.ac.jp> Tsuyoshi AKIHO wrote:
> > 秋保です。
> 
> どうも、木内です。
> 
> 環境を書いていませんでした。申し訳ありません。
> 
> debian/linux ver2.1
> mule 2.3だったとおもうのですが、バージョンは正確ではありません。

私も Debian GNU/Linux ですが、Emacs20 を使ってます。
slink(2.1) には Mule は無かったのじゃぁ?
potato(2.2) から Mule が入ったように思いますが…

 # apt-get install emacs-lisp-intro-ja emacs-manual-ja elisp-manual-ja
として、

emacs 上で、
 M-: (info "emacs-lisp-insro-ja")
or
 M-: (info "elisp-ja")
or
 M-: (info "emacs-ja")

試してください。

--
  calo
Re: muleで行番号表示
#277
Author: Chee
Date: Fri, 06 Oct 2000 22:03
5 lines
1570 bytes
cheeです。こんにちは。

Meadow 1.13 beta1 (Emacs 20.6.1) で perl-mode-hookに入れて
使ってます(何千行にもならないので快適)ですが、複数行の
リージョンペースト後に表示が崩れてしまうのが残念ですね。
Re: mule で行番号表示
#278
Author: IIJIMA 'Delmonta' Hiromitsu
Date: Sat, 07 Oct 2000 00:00
63 lines
4555 bytes
いいじま@東大文学部です。

秋保> Mule 2.3 (GNU Emacs 19.31 base)よりも Emacs 20 の方が断然よ
秋保> いと思います。というのも、最近の Emacs Lisp のソフトの対象が
秋保> 新しい Emacs でしか動かないことが多いので。
	(中略)
秋保> ただ、Mule と同じように初期設定がなっていな
秋保> いからとか、command の配置が変更されているとか、いままで動い
秋保> ている elisp が動かないとかの理由で、いまでも Mule 2.3 を使っ
秋保> ているんじゃないのかな。

	ここは同感です。ま、私もいまだに 19.34 をメインにしていて、
	それで不便していないのですが。

	#あ、ちなみに、Mule 2.3 のベースは Emacs 19.28 か 19.34 で、
	#寡聞にして 19.31 ベースというのはききません…単なる間違い
	#でしょうか。

Kiuchi> 日本語に関してはイマイチという噂を聞いているのでmuleを習得しようと
Kiuchi> 思っています。 いまだに迷っているのですが。

秋保> 日本語関係に関しては、Mule 2.3 とひけを取らないというか上を
秋保> いっているはずです(4.0 (HANANOEN) と version 名が上だから,
秋保> と思うんだけど)。
	(中略)
秋保> イマイチという噂の出所を教えて頂けると幸いです。

	えっと、Emacs 20(Mule 3、Mule 4)の日本語処理は、たしかに
	バージョン番号は上がっていますが、Mule 2.3 の完全上位互換では
	ありません。

	具体的に例を挙げると Wnn、Canna のサポートが、Emacs 単体には
	なくて、使いたければ emcws(EMacs+Canna+Wnn+Sj3)というパッチを
	当ててコンパイルするか、Tamago 4 というパッケージを入れる必要が
	あります。今のところ Tamago 4 にはポーティングされていない機能が
	たくさんあるので、当分は emcws の天下でしょう。

	どうしてこうなったかというと、ご存じの通り、Mule 2.3 までは
	本家 Emacs はLatin 1 専用で、それにたいするパッチという形で
	Mule が存在していたのが、多国語処理が本家に統合された、という
	事情があります。知人(XEmacs の開発に関わっている人です)曰く、
	Emacs 20 の日本語処理については、Mule 2.3 の機能のうち、本家の
	開発者である Richard Stallman 氏が理解できた部分だけが採用され、
	Stallman 氏が理解できなかった(あるいは必要性を認めなかった?)
	部分は削られたんだそうです。

秋保> Emacs 20 では、 M-x set-terminal-coding-system [RET]
秋保> shift_jis [RET] すれば、表示が sjis になります。
秋保> また、 M-x set-keyboard-coding-system  [RET]
秋保> shift_jis [RET] すれば、MS-IME などから日本語入力ができます。
秋保> Mule 2.3 だったら、
秋保> set-terminal-coding-system -> set-display-coding-system
秋保> で OK 。

	補足すると、Mule 2.3 だったらついでに shift_jis のところを
	*sjis* に変える必要があるはずです。

☆-- 飯嶋 浩光 ----------------------------------------------☆
|IIJIMA 'Delmonta' Hiromitsu an der Universitaet Tokyo      |
☆-----------------------------------------------------------☆
|【宣伝】EmacsのVZ+ATOK+カナ入力化など外道カスタマイズの数々|
|  http://user.ecc.u-tokyo.ac.jp/~l94102/emacs/             |
☆-------------------------- L94102@mail.ecc.u-tokyo.ac.jp --☆
Re: muleで行番号表示
#279
Author: Naoki Nakamura
Date: Sat, 07 Oct 2000 17:59
462 lines
23123 bytes
  初めまして.
  nakamura といいます.


At Sat, 07 Oct 2000 07:03:05 +0900,
Chee <chee@subdimension.com> wrote:
> 
> Meadow 1.13 beta1 (Emacs 20.6.1) で perl-mode-hookに入れて
> 使ってます(何千行にもならないので快適)ですが、複数行の
> リージョンペースト後に表示が崩れてしまうのが残念ですね。
> 

  setnu.el に関して, 複数行を yank したときの動作が私も気になっていたの
で, その辺を改良して今使っています. よかったらどうぞ.

  一応, 区別しておくために接頭辞に my- を付けてます.

  何千行にもなるコードだとやっぱり最初に開くとき時間かかるんですよね.
  fast-lock みたいにキャッシュに保存できたりしたら速くなるかな?



-- code 

;;; Original author: Kyle E. Jones  --  kyle@wonderworks.com
;;; Additional code by: Naoki Nakamura <naoki.y.nakamura@nifty.com>

(provide 'my-setnu)

(defconst my-setnu-on-xemacs
  (or (string-match "XEmacs" emacs-version)
      (string-match "Lucid" emacs-version)))

(defconst my-setnu-mode-version "1.0"
  "Version number for this release of my-setnu-mode.")

(defvar my-setnu-mode nil
  "Non-nil if my-setnu-mode is active in the current buffer.")
(make-variable-buffer-local 'my-setnu-mode)

(defvar my-setnu-start-extent nil
  "First extent of a chain of extents used by my-setnu-mode.
Each line has its own extent.  Each line extent has a
`my-setnu-next-extent' property that points to the next extent in
the chain, which is the extent for the next line in the buffer.
There is also a `my-setnu-prev-extent' that points at the previous
extent in the chain.  To distinguish them from other extents the
my-setnu-mode extents all have a non-nil `my-setnu' property.")
(make-variable-buffer-local 'my-setnu-start-extent)

(defvar my-setnu-glyph-obarray (make-vector 401 0)
  "Obarray of symbols whose values are line number glyphs.
Each symbol name is the string represnetation of a number, perhaps
passed with spaces.  The value of the symbol is a glyph that can
be made the begin glyph of an extent to display as a line number.")

(defvar my-setnu-begin-glyph-property (if (fboundp 'extent-property)
				       'begin-glyph
				     'before-string)
  "Property name to use to set the begin glyph of an extent.")

(defvar my-setnu-line-number-format (if my-setnu-on-xemacs "%4d" "%4d|")
  "String suitable for `format' that will generate a line number string.
`format' will be called with this string and one other argument
which will be an integer, the line number.")

(defvar my-setnu-line-number-face 'bold
  "*Face used to display the line numbers.
Currently this works for XEmacs 19.12 and later versions only.")

(defun my-setnu-mode (&optional arg)
  "Toggle my-setnu-mode.
With prefix argument, turn my-setnu-mode on if argument is positive.
When my-setnu-mode is enabled, a line number will appear at the left
margin of each line."
  (interactive "P")
  (let ((oldmode (not (not my-setnu-mode)))
        (inhibit-quit t))
    (setq my-setnu-mode (or (and arg (> (prefix-numeric-value arg) 0))
                            (and (null arg) (null my-setnu-mode))))
    (if (not (eq oldmode my-setnu-mode))
        (if my-setnu-mode
            (my-setnu-mode-on)
          (my-setnu-mode-off)))))

(defun turn-on-my-setnu-mode ()
  "Turn on my-setnu-mode.
Useful for adding to a major-mode hook variable.
Example:
    (add-hook 'text-mode-hook 'turn-on-my-setnu-mode)
to automatically turn on line numbering when enterting text-mode."
  (my-setnu-mode 1))

;;; Internal functions

;;; The program is written using XEmacs terminology,
;;; e.g. extents, glyphs, etc.  Functions are defined to twist
;;; the FSF Emacs overlay API into the XEmacs model.

(if my-setnu-on-xemacs
    (progn
      (fset 'my-setnu-make-extent 'make-extent)
      (fset 'my-setnu-delete-extent 'delete-extent)
      (fset 'my-setnu-extent-property 'extent-property)
      (fset 'my-setnu-set-extent-property 'set-extent-property)
      (fset 'my-setnu-set-extent-endpoints 'set-extent-endpoints)
      (fset 'my-setnu-extent-end-position 'extent-end-position)
      (fset 'my-setnu-extent-start-position 'extent-start-position)
      (defun my-setnu-set-extent-begin-glyph (e g)
        (set-extent-begin-glyph e g 'outside-margin)))
  (progn
    (fset 'my-setnu-make-extent 'make-overlay)
    (fset 'my-setnu-delete-extent 'delete-overlay)
    (fset 'my-setnu-extent-property 'overlay-get)
    (fset 'my-setnu-set-extent-property 'overlay-put)
    (fset 'my-setnu-set-extent-endpoints 'move-overlay)
    (fset 'my-setnu-extent-end-position 'overlay-end)
    (fset 'my-setnu-extent-start-position 'overlay-start)
    (defun my-setnu-set-extent-begin-glyph (e g)
      (overlay-put e my-setnu-begin-glyph-property g))))
    
(fset 'my-setnu-make-glyph (if my-setnu-on-xemacs 'make-glyph 'identity))

(cond ((and my-setnu-on-xemacs (fboundp 'set-glyph-face))
       (fset 'my-setnu-set-glyph-face 'set-glyph-face))
      (my-setnu-on-xemacs
       (fset 'my-setnu-set-glyph-face 'ignore))
      (t                                ; FSF Emacs
       (defun my-setnu-set-glyph-face (g face)
         (put-text-property 0 (length g) 'face face g))))

(defun my-setnu-mode-off ()
  "Internal shutdown of my-setnu-mode.
Deletes the extents associated with my-setnu-mode."
  (if (and my-setnu-on-xemacs
           (fboundp 'remove-specifier))
      (remove-specifier left-margin-width (current-buffer)))
  (let ((match-data (match-data))
        e ee)
    (unwind-protect
        (save-excursion
          (save-restriction
            (widen)
            (setq e (overlays-in (point-min) (point-max)))
            (while e
              (setq ee (car e))
              (if (my-setnu-extent-property ee 'my-setnu)
                  (my-setnu-delete-extent ee) nil)
              (setq e (cdr e)))))
      (store-match-data match-data) ))
  (setq my-setnu-start-extent nil))

(defun my-setnu-mode-on ()
  "Internal startup of my-setnu-mode.
Sets up the extents associated with my-setnu-mode."
  (if (and my-setnu-on-xemacs
           (fboundp 'set-specifier))
      (set-specifier left-margin-width 6 (current-buffer)))
  (let ((done nil)
        (curr-e nil)
        (n 1)
        (match-data (match-data))
        e start numstr)
    (unwind-protect
        (save-excursion
          (save-restriction
            (widen)
            (goto-char (point-min))
            (setq start (point))
            (while (not done)
              (setq done (null (search-forward "\n" nil 0)))
              (setq e (my-setnu-make-my-setnu-extent start (point)))
              (if (null my-setnu-start-extent)
                  (setq my-setnu-start-extent e
                        curr-e e)
                (my-setnu-set-extent-property curr-e 'my-setnu-next-extent e)
                (my-setnu-set-extent-property e 'my-setnu-prev-extent curr-e)
                (setq curr-e e))
              (setq numstr (format my-setnu-line-number-format n))
              (my-setnu-set-extent-property e 'line-number numstr)
              (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
              (setq n (1+ n)
                    start (point)))))
      (store-match-data match-data))))


(defvar my-setnu-del-lf-flag nil)
(make-variable-buffer-local 'my-setnu-del-lf-flag)
(defvar my-setnu-start-e nil)
(make-variable-buffer-local 'my-setnu-start-e)
(defvar my-setnu-end-e nil)
(make-variable-buffer-local 'my-setnu-end-e)
(defvar my-setnu-saved-next nil)
(make-variable-buffer-local 'my-setnu-saved-next)

(defun my-setnu-before-change-function (start end)
  "Before change function for my-setnu-mode.
Notices when a delete is about to delete some lines and adjusts
the line number extents accordingly."
  (if (or (not my-setnu-mode) (= start end))
      ();; not in my-setnu-mode or this is an insertion
    (let ((inhibit-quit t)
          (match-data (match-data)))
      (unwind-protect
          (save-excursion
            (save-restriction
              (widen)
              (goto-char start)
              (if (search-forward "\n" end t)
                  (progn
                    (setq my-setnu-del-lf-flag t)
                    (setq my-setnu-start-e (my-setnu-extent-at-create start nil)
                          my-setnu-saved-next (my-setnu-extent-property
                                               my-setnu-start-e
                                               'my-setnu-next-extent))
                    (setq my-setnu-end-e (my-setnu-extent-at-create end nil)))
                (setq my-setnu-del-lf-flag nil))))
        (store-match-data match-data)))))

(defun my-setnu-after-change-function (start end length)
  "After change function for my-setnu-mode.
Notices when an insert has added some lines and adjusts
the line number extents accordingly."
  (if my-setnu-mode
      (if (= start end)
          ;; this is a deletion
          (if my-setnu-del-lf-flag
              (let ((inhibit-quit t)
                    (start-e nil)
                    (match-data (match-data))
                    end-e saved-next e ee)
                (unwind-protect
                    (save-excursion
                      (save-restriction
                        (widen)
                        (goto-char start)
                        (if my-setnu-start-e
                            (progn
                              (my-setnu-set-extent-endpoints
                               my-setnu-start-e
                               (my-setnu-extent-start-position my-setnu-start-e)
                               (my-setnu-extent-end-position my-setnu-end-e))
                              (my-setnu-set-extent-property
                               my-setnu-start-e 'my-setnu-next-extent
                               (my-setnu-extent-property my-setnu-end-e 'my-setnu-next-extent))
                              (setq e (my-setnu-extent-property my-setnu-start-e 'my-setnu-next-extent)
                                    ee my-setnu-saved-next)
                              (while (and e (my-setnu-extent-property e 'my-setnu-next-extent))
                                (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
                                      ee (my-setnu-extent-property ee 'my-setnu-next-extent)))
                              (while (and e (not (eq ee my-setnu-start-e)))
                                (my-setnu-set-extent-begin-glyph
                                 e (my-setnu-extent-property ee 'before-string))
                                (my-setnu-set-extent-property
                                 e 'line-number (my-setnu-extent-property ee 'line-number))
                                (setq e (my-setnu-extent-property e 'my-setnu-prev-extent)
                                      ee (my-setnu-extent-property ee 'my-setnu-prev-extent)))
                              (setq my-setnu-end-e (my-setnu-extent-property my-setnu-start-e
                                                                             'my-setnu-next-extent))
                              (and my-setnu-end-e
                                   (my-setnu-set-extent-property my-setnu-end-e
                                                                 'my-setnu-prev-extent
                                                                 my-setnu-start-e))
                              (setq e my-setnu-saved-next)
                              (while (not (eq e my-setnu-end-e))
                                (setq ee e
                                      e (my-setnu-extent-property e 'my-setnu-next-extent))
                                (my-setnu-delete-extent ee))))
                        (setq my-setnu-start-e nil)))
                  (store-match-data match-data))))
        ;; this is a insertion
        (let ((inhibit-quit t)
              (ee nil)
              (match-data (match-data))
              (new-lines 0)
              start-e e saved-end saved-next n numstr)
          (unwind-protect
              (save-excursion
                (save-restriction
                  (widen)
                  (setq start-e (my-setnu-extent-at-create start nil))
                  (if (< (my-setnu-extent-end-position start-e) (point))
                      ;; bogus!  insertion didn't put the text into
                      ;; the extent because,
                      ;; a. the extent was zero length or
                      ;; b. this is FSF Emacs which means chars
                      ;;    inserted at the end position of an extent
                      ;;    are not inserted into the extent.
                      (my-setnu-set-extent-endpoints
                       start-e
                       (my-setnu-extent-start-position start-e)
                       end))
                  (setq saved-next (my-setnu-extent-property start-e
                                                             'my-setnu-next-extent)
                        saved-end (my-setnu-extent-end-position start-e)
                        e start-e)
                  (goto-char start)
                  (while (search-forward "\n" end 0)
                    (my-setnu-set-extent-endpoints e
                                                   (my-setnu-extent-start-position e)
                                                   (point))
                    (setq ee (my-setnu-make-my-setnu-extent (point) (point)))
                    (my-setnu-set-extent-property e 'my-setnu-next-extent ee)
                    (my-setnu-set-extent-property ee 'my-setnu-prev-extent e)
                    (setq e ee new-lines (1+ new-lines)))
                  (if ee
                      (progn
                        (my-setnu-set-extent-endpoints
                         e (my-setnu-extent-start-position e) saved-end)
                        (my-setnu-set-extent-property e 'my-setnu-next-extent saved-next)
                        (and saved-next
                             (my-setnu-set-extent-property
                              saved-next 'my-setnu-prev-extent e))
                        (setq e (my-setnu-extent-property start-e 'my-setnu-next-extent)
                              ee saved-next)
                        (while ee
                          (my-setnu-set-extent-begin-glyph
                           e (my-setnu-extent-property ee my-setnu-begin-glyph-property))
                          (my-setnu-set-extent-property
                           e 'line-number (my-setnu-extent-property ee 'line-number))
                          (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
                                ee (my-setnu-extent-property ee 'my-setnu-next-extent)))
                        (setq n (1+ (string-to-int
                                     (my-setnu-extent-property
                                      (my-setnu-extent-property e 'my-setnu-prev-extent)
                                      'line-number))))
                        (while e
                          (setq numstr (format my-setnu-line-number-format n))
                          (my-setnu-set-extent-property e 'line-number numstr)
                          (my-setnu-set-extent-begin-glyph
                           e (my-setnu-number-glyph numstr))
                          (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
                                n (1+ n)))))))
            (store-match-data match-data))))))

(defun my-setnu-number-glyph (number-string)
  (let ((sym (intern number-string my-setnu-glyph-obarray)))
    (if (boundp sym)
        (symbol-value sym)
      (let ((g (my-setnu-make-glyph number-string)))
        (set sym g)
        (my-setnu-set-glyph-face g my-setnu-line-number-face)
        g ))))

(defun my-setnu-make-my-setnu-extent (beg end)
  "Create an extent and set some properties that all my-setnu extents have."
  (let ((e (my-setnu-make-extent beg end)))
    (my-setnu-set-extent-property e 'my-setnu t)
    (my-setnu-set-extent-property e 'priority 0)
    ;;    (my-setnu-set-extent-property e 'begin-glyph-layout 'outside-margin)
    (my-setnu-set-extent-property e 'detachable nil)
    (my-setnu-set-extent-property e 'evaporate nil)
    e ))

(cond ((fboundp 'overlays-in);; expect to see this in 19.30
       (defun my-setnu-extent-at (pos buf)
         "Finds the my-setnu extent at the position POS in the buffer BUF."
         (catch 'done
           (save-excursion
             (and buf (set-buffer buf))
             (let ((o-list (overlays-in pos (1+ pos))))
               (while o-list
                 (if (overlay-get (car o-list) 'my-setnu)
                     (throw 'done (car o-list)))
                 (setq o-list (cdr o-list)))
               nil )))))
      ((fboundp 'overlays-at)
       (defun my-setnu-extent-at (pos buf)
         "Finds the my-setnu extent at the position POS in the buffer BUF."
         (catch 'done
           (save-excursion
             (and buf (set-buffer buf))
             (let ((o-list (overlays-at pos)) o-lists)
               ;; search what overlays-at returns first.  for all
               ;; but zero length extents this will return the
               ;; extent we want.
               (while o-list
                 (if (overlay-get (car o-list) 'my-setnu)
                     (throw 'done (car o-list)))
                 (setq o-list (cdr o-list)))
               ;; No luck.  Search the lists returned by
               ;; overlay-lists.  Use overlays-recenter so we only
               ;; have to search the `before' lobe of the return
               ;; value.
               (overlay-recenter (1- pos))
               (setq o-lists (overlay-lists))
               (setq o-list (cdr o-lists))
               (while o-list
                 (if (and (overlay-get (car o-list) 'my-setnu)
                          (or (and (= pos (overlay-start (car o-list)))
                                   (= pos (overlay-end (car o-list))))
                              (and (>= pos (overlay-start (car o-list)))
                                   (< pos (overlay-end (car o-list))))))
                     (throw 'done (car o-list)))
                 (setq o-list (cdr o-list)))
               nil )))))
      ((fboundp 'map-extents)
       (defun my-setnu-extent-at (pos buf)
         "Finds the my-setnu extent at the position POS in the buffer BUF."
         (map-extents (function (lambda (e maparg)
                                  (if (my-setnu-extent-property e 'my-setnu)
                                      e
                                    nil)))
                      buf pos pos)))
      (t (error "can't find overlays-in, overlays-at, or map-extents!")))

(defun my-setnu-extent-at-create (pos buf)
  "Like `my-setnu-extent-at' except if an extent isn't found, then
it is created based on where the extent failed to be found."
  (let ((e (my-setnu-extent-at pos buf)) ee beg numstr)
    (if e
        e
      ;; no extent found so one must be created.
      (save-excursion
        (goto-char pos)
        (beginning-of-line)
        (setq e (my-setnu-extent-at (point) buf))
        (cond (e
               ;; found one.  extend it to cover this whole line.
               ;; this takes care of zero length extents that
               ;; might exist at bob or eob that can't be
               ;; inserted into.
               (setq beg (point))
               (forward-line 1)
               (my-setnu-set-extent-endpoints e beg (point))
               e )
              ((bobp)
               ;; we are at bob and there's no extent.
               ;;
               ;; this is because the extent that was there got
               ;; detached because all the text in the buffer was
               ;; deleted.  so we create a new extent and make it
               ;; contain the whole buffer, since there can be no
               ;; other attached extents.
               (setq e (my-setnu-make-my-setnu-extent (point-min) (point-max))
                     numstr (format my-setnu-line-number-format 1))
               (my-setnu-set-extent-property e 'line-number numstr)
               (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
               (setq my-setnu-start-extent e)
               e )
              (t
               ;; we must be at eob and there's no extent.
               ;; 
               ;; this is because the extent that was there
               ;; shrank to zero length and was detached.  create
               ;; a new extent that contains all text from point
               ;; to pos.
               (setq e (my-setnu-make-my-setnu-extent (point) pos))
               (setq ee (my-setnu-extent-at (1- (point)) buf))
               (my-setnu-set-extent-property e 'my-setnu-prev-extent ee)
               (my-setnu-set-extent-property ee 'my-setnu-next-extent e)
               (setq numstr
                     (format my-setnu-line-number-format
                             (1+ (string-to-int
                                  (my-setnu-extent-property ee 'line-number)))))
               (my-setnu-set-extent-property e 'line-number numstr)
               (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
               e ))))))

(add-hook 'before-change-functions 'my-setnu-before-change-function)
(add-hook 'after-change-functions 'my-setnu-after-change-function)
Re: muleで行番号表示
#280
Author: Kiuchi Kan
Date: Wed, 11 Oct 2000 00:00
14 lines
1188 bytes
In article <m3d7hcmt0o.wl@news.nifty.com>, naoki.y.nakamura@nifty.com says...
>
>
>  初めまして.
>  nakamura といいます.

はじめまして木内と申します。

>  setnu.el に関して, 複数行を yank したときの動作が私も気になっていたの
>で, その辺を改良して今使っています. よかったらどうぞ.
貴重なコードをありがとうございます。
とりあえず使い方がわからないのと対応しているかどうかわからないので、
Emacs2.0以上にしてから再び参上したいと思います。
そのときは活用したいと思います。どうもありがとうございました。
Re: muleで行番号表示
#281
Author: Kiuchi Kan
Date: Wed, 11 Oct 2000 00:00
19 lines
1112 bytes
In article <wkk8bmy879.fsf@nifty.ne.jp>, BZN02473@nifty.ne.jp says...
>
>
>倉谷と申します。

はじめまして、木内と申します。


>nak-k@aat.mtci.ne.jp (Kiuchi Kan) writes:
>> mule の行番号表示を表示させたいのですがどのようにすれば
>> よろしいでしょうか?
>
>以前、Emacs-lispの勉強のために、行番号を付加するプログラム
>を書いたことがあります。

貴重なコードありがとうございます。
使い方がわからないのと、対応しているかどうかわからないので
Emacs2.0以上に上げてから参上したいと思います。
ありがとうございました。
Re: mule で行番号表示
#283
Author: Okabe Katsuya
Date: Thu, 12 Oct 2000 00:00
16 lines
1847 bytes
IIJIMA 'Delmonta' Hiromitsu <L94102@mail.ecc.u-tokyo.ac.jp> writes:

> 	#あ、ちなみに、Mule 2.3 のベースは Emacs 19.28 か 19.34 で、
> 	#寡聞にして 19.31 ベースというのはききません…単なる間違い
> 	#でしょうか。

私が昔所属していた研究室では, 長い間, 19.31 ベースの Mule が使われてい
ました.
確か, 他の版をベースにしたものもあったと記憶しています.
# もちろん, 19.28 ベース以外のものは, 公式にリリースされたものでは無かっ
# たと思いますが.

-- 
    岡部克也
    e-mail: okabek@guitar.ocn.ne.jp
------------------------------------------------
Re: muleで行番号表示
#284
Author: Chee
Date: Thu, 12 Oct 2000 00:00
469 lines
23914 bytes
cheeです。

好意でせっかくアップしていただいたものに、難癖つけるようで
気がひけてしまうのですが、WindowsのMeadow(MULE/4.1 相当)では
Undoの際に表示が崩れてしまいました。単独でyankの操作は
うまくいきました。

At Sun, 08 Oct 2000 02:59:51 +0900, Naoki Nakamura wrote >
>   初めまして.
>   nakamura といいます.


> At Sat, 07 Oct 2000 07:03:05 +0900,
> Chee <chee@subdimension.com> wrote:
>> 
>> Meadow 1.13 beta1 (Emacs 20.6.1) で perl-mode-hookに入れて
>> 使ってます(何千行にもならないので快適)ですが、複数行の
>> リージョンペースト後に表示が崩れてしまうのが残念ですね。
>> 

>   setnu.el に関して, 複数行を yank したときの動作が私も気になっていたの
> で, その辺を改良して今使っています. よかったらどうぞ.

>   一応, 区別しておくために接頭辞に my- を付けてます.

>   何千行にもなるコードだとやっぱり最初に開くとき時間かかるんですよね.
>   fast-lock みたいにキャッシュに保存できたりしたら速くなるかな?



> -- code 

> ;;; Original author: Kyle E. Jones  --  kyle@wonderworks.com
> ;;; Additional code by: Naoki Nakamura <naoki.y.nakamura@nifty.com>

> (provide 'my-setnu)

> (defconst my-setnu-on-xemacs
>   (or (string-match "XEmacs" emacs-version)
>       (string-match "Lucid" emacs-version)))

> (defconst my-setnu-mode-version "1.0"
>   "Version number for this release of my-setnu-mode.")

> (defvar my-setnu-mode nil
>   "Non-nil if my-setnu-mode is active in the current buffer.")
> (make-variable-buffer-local 'my-setnu-mode)

> (defvar my-setnu-start-extent nil
>   "First extent of a chain of extents used by my-setnu-mode.
> Each line has its own extent.  Each line extent has a
> `my-setnu-next-extent' property that points to the next extent in
> the chain, which is the extent for the next line in the buffer.
> There is also a `my-setnu-prev-extent' that points at the previous
> extent in the chain.  To distinguish them from other extents the
> my-setnu-mode extents all have a non-nil `my-setnu' property.")
> (make-variable-buffer-local 'my-setnu-start-extent)

> (defvar my-setnu-glyph-obarray (make-vector 401 0)
>   "Obarray of symbols whose values are line number glyphs.
> Each symbol name is the string represnetation of a number, perhaps
> passed with spaces.  The value of the symbol is a glyph that can
> be made the begin glyph of an extent to display as a line number.")

> (defvar my-setnu-begin-glyph-property (if (fboundp 'extent-property)
> 				       'begin-glyph
> 				     'before-string)
>   "Property name to use to set the begin glyph of an extent.")

> (defvar my-setnu-line-number-format (if my-setnu-on-xemacs "%4d" "%4d|")
>   "String suitable for `format' that will generate a line number string.
> `format' will be called with this string and one other argument
> which will be an integer, the line number.")

> (defvar my-setnu-line-number-face 'bold
>   "*Face used to display the line numbers.
> Currently this works for XEmacs 19.12 and later versions only.")

> (defun my-setnu-mode (&optional arg)
>   "Toggle my-setnu-mode.
> With prefix argument, turn my-setnu-mode on if argument is positive.
> When my-setnu-mode is enabled, a line number will appear at the left
> margin of each line."
>   (interactive "P")
>   (let ((oldmode (not (not my-setnu-mode)))
>         (inhibit-quit t))
>     (setq my-setnu-mode (or (and arg (> (prefix-numeric-value arg) 0))
>                             (and (null arg) (null my-setnu-mode))))
>     (if (not (eq oldmode my-setnu-mode))
>         (if my-setnu-mode
>             (my-setnu-mode-on)
>           (my-setnu-mode-off)))))

> (defun turn-on-my-setnu-mode ()
>   "Turn on my-setnu-mode.
> Useful for adding to a major-mode hook variable.
> Example:
>     (add-hook 'text-mode-hook 'turn-on-my-setnu-mode)
> to automatically turn on line numbering when enterting text-mode."
>   (my-setnu-mode 1))

> ;;; Internal functions

> ;;; The program is written using XEmacs terminology,
> ;;; e.g. extents, glyphs, etc.  Functions are defined to twist
> ;;; the FSF Emacs overlay API into the XEmacs model.

> (if my-setnu-on-xemacs
>     (progn
>       (fset 'my-setnu-make-extent 'make-extent)
>       (fset 'my-setnu-delete-extent 'delete-extent)
>       (fset 'my-setnu-extent-property 'extent-property)
>       (fset 'my-setnu-set-extent-property 'set-extent-property)
>       (fset 'my-setnu-set-extent-endpoints 'set-extent-endpoints)
>       (fset 'my-setnu-extent-end-position 'extent-end-position)
>       (fset 'my-setnu-extent-start-position 'extent-start-position)
>       (defun my-setnu-set-extent-begin-glyph (e g)
>         (set-extent-begin-glyph e g 'outside-margin)))
>   (progn
>     (fset 'my-setnu-make-extent 'make-overlay)
>     (fset 'my-setnu-delete-extent 'delete-overlay)
>     (fset 'my-setnu-extent-property 'overlay-get)
>     (fset 'my-setnu-set-extent-property 'overlay-put)
>     (fset 'my-setnu-set-extent-endpoints 'move-overlay)
>     (fset 'my-setnu-extent-end-position 'overlay-end)
>     (fset 'my-setnu-extent-start-position 'overlay-start)
>     (defun my-setnu-set-extent-begin-glyph (e g)
>       (overlay-put e my-setnu-begin-glyph-property g))))
    
> (fset 'my-setnu-make-glyph (if my-setnu-on-xemacs 'make-glyph 'identity))

> (cond ((and my-setnu-on-xemacs (fboundp 'set-glyph-face))
>        (fset 'my-setnu-set-glyph-face 'set-glyph-face))
>       (my-setnu-on-xemacs
>        (fset 'my-setnu-set-glyph-face 'ignore))
>       (t                                ; FSF Emacs
>        (defun my-setnu-set-glyph-face (g face)
>          (put-text-property 0 (length g) 'face face g))))

> (defun my-setnu-mode-off ()
>   "Internal shutdown of my-setnu-mode.
> Deletes the extents associated with my-setnu-mode."
>   (if (and my-setnu-on-xemacs
>            (fboundp 'remove-specifier))
>       (remove-specifier left-margin-width (current-buffer)))
>   (let ((match-data (match-data))
>         e ee)
>     (unwind-protect
>         (save-excursion
>           (save-restriction
>             (widen)
>             (setq e (overlays-in (point-min) (point-max)))
>             (while e
>               (setq ee (car e))
>               (if (my-setnu-extent-property ee 'my-setnu)
>                   (my-setnu-delete-extent ee) nil)
>               (setq e (cdr e)))))
>       (store-match-data match-data) ))
>   (setq my-setnu-start-extent nil))

> (defun my-setnu-mode-on ()
>   "Internal startup of my-setnu-mode.
> Sets up the extents associated with my-setnu-mode."
>   (if (and my-setnu-on-xemacs
>            (fboundp 'set-specifier))
>       (set-specifier left-margin-width 6 (current-buffer)))
>   (let ((done nil)
>         (curr-e nil)
>         (n 1)
>         (match-data (match-data))
>         e start numstr)
>     (unwind-protect
>         (save-excursion
>           (save-restriction
>             (widen)
>             (goto-char (point-min))
>             (setq start (point))
>             (while (not done)
>               (setq done (null (search-forward "\n" nil 0)))
>               (setq e (my-setnu-make-my-setnu-extent start (point)))
>               (if (null my-setnu-start-extent)
>                   (setq my-setnu-start-extent e
>                         curr-e e)
>                 (my-setnu-set-extent-property curr-e 'my-setnu-next-extent e)
>                 (my-setnu-set-extent-property e 'my-setnu-prev-extent curr-e)
>                 (setq curr-e e))
>               (setq numstr (format my-setnu-line-number-format n))
>               (my-setnu-set-extent-property e 'line-number numstr)
>               (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
>               (setq n (1+ n)
>                     start (point)))))
>       (store-match-data match-data))))


> (defvar my-setnu-del-lf-flag nil)
> (make-variable-buffer-local 'my-setnu-del-lf-flag)
> (defvar my-setnu-start-e nil)
> (make-variable-buffer-local 'my-setnu-start-e)
> (defvar my-setnu-end-e nil)
> (make-variable-buffer-local 'my-setnu-end-e)
> (defvar my-setnu-saved-next nil)
> (make-variable-buffer-local 'my-setnu-saved-next)

> (defun my-setnu-before-change-function (start end)
>   "Before change function for my-setnu-mode.
> Notices when a delete is about to delete some lines and adjusts
> the line number extents accordingly."
>   (if (or (not my-setnu-mode) (= start end))
>       ();; not in my-setnu-mode or this is an insertion
>     (let ((inhibit-quit t)
>           (match-data (match-data)))
>       (unwind-protect
>           (save-excursion
>             (save-restriction
>               (widen)
>               (goto-char start)
>               (if (search-forward "\n" end t)
>                   (progn
>                     (setq my-setnu-del-lf-flag t)
>                     (setq my-setnu-start-e (my-setnu-extent-at-create start nil)
>                           my-setnu-saved-next (my-setnu-extent-property
>                                                my-setnu-start-e
>                                                'my-setnu-next-extent))
>                     (setq my-setnu-end-e (my-setnu-extent-at-create end nil)))
>                 (setq my-setnu-del-lf-flag nil))))
>         (store-match-data match-data)))))

> (defun my-setnu-after-change-function (start end length)
>   "After change function for my-setnu-mode.
> Notices when an insert has added some lines and adjusts
> the line number extents accordingly."
>   (if my-setnu-mode
>       (if (= start end)
>           ;; this is a deletion
>           (if my-setnu-del-lf-flag
>               (let ((inhibit-quit t)
>                     (start-e nil)
>                     (match-data (match-data))
>                     end-e saved-next e ee)
>                 (unwind-protect
>                     (save-excursion
>                       (save-restriction
>                         (widen)
>                         (goto-char start)
>                         (if my-setnu-start-e
>                             (progn
>                               (my-setnu-set-extent-endpoints
>                                my-setnu-start-e
>                                (my-setnu-extent-start-position my-setnu-start-e)
>                                (my-setnu-extent-end-position my-setnu-end-e))
>                               (my-setnu-set-extent-property
>                                my-setnu-start-e 'my-setnu-next-extent
>                                (my-setnu-extent-property my-setnu-end-e 'my-setnu-next-extent))
>                               (setq e (my-setnu-extent-property my-setnu-start-e 'my-setnu-next-extent)
>                                     ee my-setnu-saved-next)
>                               (while (and e (my-setnu-extent-property e 'my-setnu-next-extent))
>                                 (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
>                                       ee (my-setnu-extent-property ee 'my-setnu-next-extent)))
>                               (while (and e (not (eq ee my-setnu-start-e)))
>                                 (my-setnu-set-extent-begin-glyph
>                                  e (my-setnu-extent-property ee 'before-string))
>                                 (my-setnu-set-extent-property
>                                  e 'line-number (my-setnu-extent-property ee 'line-number))
>                                 (setq e (my-setnu-extent-property e 'my-setnu-prev-extent)
>                                       ee (my-setnu-extent-property ee 'my-setnu-prev-extent)))
>                               (setq my-setnu-end-e (my-setnu-extent-property my-setnu-start-e
>                                                                              'my-setnu-next-extent))
>                               (and my-setnu-end-e
>                                    (my-setnu-set-extent-property my-setnu-end-e
>                                                                  'my-setnu-prev-extent
>                                                                  my-setnu-start-e))
>                               (setq e my-setnu-saved-next)
>                               (while (not (eq e my-setnu-end-e))
>                                 (setq ee e
>                                       e (my-setnu-extent-property e 'my-setnu-next-extent))
>                                 (my-setnu-delete-extent ee))))
>                         (setq my-setnu-start-e nil)))
>                   (store-match-data match-data))))
>         ;; this is a insertion
>         (let ((inhibit-quit t)
>               (ee nil)
>               (match-data (match-data))
>               (new-lines 0)
>               start-e e saved-end saved-next n numstr)
>           (unwind-protect
>               (save-excursion
>                 (save-restriction
>                   (widen)
>                   (setq start-e (my-setnu-extent-at-create start nil))
>                   (if (< (my-setnu-extent-end-position start-e) (point))
>                       ;; bogus!  insertion didn't put the text into
>                       ;; the extent because,
>                       ;; a. the extent was zero length or
>                       ;; b. this is FSF Emacs which means chars
>                       ;;    inserted at the end position of an extent
>                       ;;    are not inserted into the extent.
>                       (my-setnu-set-extent-endpoints
>                        start-e
>                        (my-setnu-extent-start-position start-e)
>                        end))
>                   (setq saved-next (my-setnu-extent-property start-e
>                                                              'my-setnu-next-extent)
>                         saved-end (my-setnu-extent-end-position start-e)
>                         e start-e)
>                   (goto-char start)
>                   (while (search-forward "\n" end 0)
>                     (my-setnu-set-extent-endpoints e
>                                                    (my-setnu-extent-start-position e)
>                                                    (point))
>                     (setq ee (my-setnu-make-my-setnu-extent (point) (point)))
>                     (my-setnu-set-extent-property e 'my-setnu-next-extent ee)
>                     (my-setnu-set-extent-property ee 'my-setnu-prev-extent e)
>                     (setq e ee new-lines (1+ new-lines)))
>                   (if ee
>                       (progn
>                         (my-setnu-set-extent-endpoints
>                          e (my-setnu-extent-start-position e) saved-end)
>                         (my-setnu-set-extent-property e 'my-setnu-next-extent saved-next)
>                         (and saved-next
>                              (my-setnu-set-extent-property
>                               saved-next 'my-setnu-prev-extent e))
>                         (setq e (my-setnu-extent-property start-e 'my-setnu-next-extent)
>                               ee saved-next)
>                         (while ee
>                           (my-setnu-set-extent-begin-glyph
>                            e (my-setnu-extent-property ee my-setnu-begin-glyph-property))
>                           (my-setnu-set-extent-property
>                            e 'line-number (my-setnu-extent-property ee 'line-number))
>                           (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
>                                 ee (my-setnu-extent-property ee 'my-setnu-next-extent)))
>                         (setq n (1+ (string-to-int
>                                      (my-setnu-extent-property
>                                       (my-setnu-extent-property e 'my-setnu-prev-extent)
>                                       'line-number))))
>                         (while e
>                           (setq numstr (format my-setnu-line-number-format n))
>                           (my-setnu-set-extent-property e 'line-number numstr)
>                           (my-setnu-set-extent-begin-glyph
>                            e (my-setnu-number-glyph numstr))
>                           (setq e (my-setnu-extent-property e 'my-setnu-next-extent)
>                                 n (1+ n)))))))
>             (store-match-data match-data))))))

> (defun my-setnu-number-glyph (number-string)
>   (let ((sym (intern number-string my-setnu-glyph-obarray)))
>     (if (boundp sym)
>         (symbol-value sym)
>       (let ((g (my-setnu-make-glyph number-string)))
>         (set sym g)
>         (my-setnu-set-glyph-face g my-setnu-line-number-face)
>         g ))))

> (defun my-setnu-make-my-setnu-extent (beg end)
>   "Create an extent and set some properties that all my-setnu extents have."
>   (let ((e (my-setnu-make-extent beg end)))
>     (my-setnu-set-extent-property e 'my-setnu t)
>     (my-setnu-set-extent-property e 'priority 0)
>     ;;    (my-setnu-set-extent-property e 'begin-glyph-layout 'outside-margin)
>     (my-setnu-set-extent-property e 'detachable nil)
>     (my-setnu-set-extent-property e 'evaporate nil)
>     e ))

> (cond ((fboundp 'overlays-in);; expect to see this in 19.30
>        (defun my-setnu-extent-at (pos buf)
>          "Finds the my-setnu extent at the position POS in the buffer BUF."
>          (catch 'done
>            (save-excursion
>              (and buf (set-buffer buf))
>              (let ((o-list (overlays-in pos (1+ pos))))
>                (while o-list
>                  (if (overlay-get (car o-list) 'my-setnu)
>                      (throw 'done (car o-list)))
>                  (setq o-list (cdr o-list)))
>                nil )))))
>       ((fboundp 'overlays-at)
>        (defun my-setnu-extent-at (pos buf)
>          "Finds the my-setnu extent at the position POS in the buffer BUF."
>          (catch 'done
>            (save-excursion
>              (and buf (set-buffer buf))
>              (let ((o-list (overlays-at pos)) o-lists)
>                ;; search what overlays-at returns first.  for all
>                ;; but zero length extents this will return the
>                ;; extent we want.
>                (while o-list
>                  (if (overlay-get (car o-list) 'my-setnu)
>                      (throw 'done (car o-list)))
>                  (setq o-list (cdr o-list)))
>                ;; No luck.  Search the lists returned by
>                ;; overlay-lists.  Use overlays-recenter so we only
>                ;; have to search the `before' lobe of the return
>                ;; value.
>                (overlay-recenter (1- pos))
>                (setq o-lists (overlay-lists))
>                (setq o-list (cdr o-lists))
>                (while o-list
>                  (if (and (overlay-get (car o-list) 'my-setnu)
>                           (or (and (= pos (overlay-start (car o-list)))
>                                    (= pos (overlay-end (car o-list))))
>                               (and (>= pos (overlay-start (car o-list)))
>                                    (< pos (overlay-end (car o-list))))))
>                      (throw 'done (car o-list)))
>                  (setq o-list (cdr o-list)))
>                nil )))))
>       ((fboundp 'map-extents)
>        (defun my-setnu-extent-at (pos buf)
>          "Finds the my-setnu extent at the position POS in the buffer BUF."
>          (map-extents (function (lambda (e maparg)
>                                   (if (my-setnu-extent-property e 'my-setnu)
>                                       e
>                                     nil)))
>                       buf pos pos)))
>       (t (error "can't find overlays-in, overlays-at, or map-extents!")))

> (defun my-setnu-extent-at-create (pos buf)
>   "Like `my-setnu-extent-at' except if an extent isn't found, then
> it is created based on where the extent failed to be found."
>   (let ((e (my-setnu-extent-at pos buf)) ee beg numstr)
>     (if e
>         e
>       ;; no extent found so one must be created.
>       (save-excursion
>         (goto-char pos)
>         (beginning-of-line)
>         (setq e (my-setnu-extent-at (point) buf))
>         (cond (e
>                ;; found one.  extend it to cover this whole line.
>                ;; this takes care of zero length extents that
>                ;; might exist at bob or eob that can't be
>                ;; inserted into.
>                (setq beg (point))
>                (forward-line 1)
>                (my-setnu-set-extent-endpoints e beg (point))
>                e )
>               ((bobp)
>                ;; we are at bob and there's no extent.
>                ;;
>                ;; this is because the extent that was there got
>                ;; detached because all the text in the buffer was
>                ;; deleted.  so we create a new extent and make it
>                ;; contain the whole buffer, since there can be no
>                ;; other attached extents.
>                (setq e (my-setnu-make-my-setnu-extent (point-min) (point-max))
>                      numstr (format my-setnu-line-number-format 1))
>                (my-setnu-set-extent-property e 'line-number numstr)
>                (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
>                (setq my-setnu-start-extent e)
>                e )
>               (t
>                ;; we must be at eob and there's no extent.
>                ;; 
>                ;; this is because the extent that was there
>                ;; shrank to zero length and was detached.  create
>                ;; a new extent that contains all text from point
>                ;; to pos.
>                (setq e (my-setnu-make-my-setnu-extent (point) pos))
>                (setq ee (my-setnu-extent-at (1- (point)) buf))
>                (my-setnu-set-extent-property e 'my-setnu-prev-extent ee)
>                (my-setnu-set-extent-property ee 'my-setnu-next-extent e)
>                (setq numstr
>                      (format my-setnu-line-number-format
>                              (1+ (string-to-int
>                                   (my-setnu-extent-property ee 'line-number)))))
>                (my-setnu-set-extent-property e 'line-number numstr)
>                (my-setnu-set-extent-begin-glyph e (my-setnu-number-glyph numstr))
>                e ))))))

> (add-hook 'before-change-functions 'my-setnu-before-change-function)
> (add-hook 'after-change-functions 'my-setnu-after-change-function)
Re: mule で行番号表示
#282
Author: Tsuyoshi AKIHO
Date: Thu, 12 Oct 2000 02:05
19 lines
2259 bytes
秋保です。

>>>>> In <39DE897B.A8F2294D@mail.ecc.u-tokyo.ac.jp> 
>>>>>	IIJIMA 'Delmonta' Hiromitsu <L94102@mail.ecc.u-tokyo.ac.jp> wrote:
IIJIMA> いいじま@東大文学部です。

秋保> Mule 2.3 (GNU Emacs 19.31 base)よりも Emacs 20 の方が断然よ
秋保> いと思います。というのも、最近の Emacs Lisp のソフトの対象が

IIJIMA> 	#あ、ちなみに、Mule 2.3 のベースは Emacs 19.28 か 19.34 で、
IIJIMA> 	#寡聞にして 19.31 ベースというのはききません…単なる間違い
IIJIMA> 	#でしょうか。

19.28 のつもりで書いてたのですけど、 31 になってしまっている...
GNU Emacs 19.34 base の Mule は見ただけで、使ったことがありません。

-- 
Tsuyoshi AKIHO
akiho@media.osaka-cu.ac.jp
Re: muleで行番号表示
#285
Author: Naoki Nakamura
Date: Fri, 13 Oct 2000 17:09
47 lines
3412 bytes
  nakamura です.


At Thu, 12 Oct 2000 20:09:30 +0900,
Chee <chee@subdimension.com> wrote:
> 
> cheeです。
> 
> 好意でせっかくアップしていただいたものに、難癖つけるようで
> 気がひけてしまうのですが、WindowsのMeadow(MULE/4.1 相当)では
> Undoの際に表示が崩れてしまいました。単独でyankの操作は
> うまくいきました。

  改善点を指摘されるのは難癖などではなく貴重な意見だと思います.
  どのような操作を Undo したときに起ったのでしょうか.
  Meadow 1.10 では, 普通に yank & Undo では変らなかったです.

  ただ, 脆い面があるのは事実ですね.
  fill-paragraph とかやるとどうしようもなく崩れます.
  一度切って, 再び on にするしかないようです.

  そもそも, setnu.el のソースを読んだときは, これで上手くいかない筈が
ない, と正直思いました. なんで表示がおかしくなるのかなと自分なりに調べ
たところ, setnu-before-change-function が before-change-functions から
ちゃんと引数を貰えていないように見えたのです. 実際, 始点と終点の値が
正確には渡されていませんでした. setnu.el が最後にメンテされたのがだい
ぶ前のようなので, 19.x な emacs では普通に動いていたのだろうか.
  before-change-functions という重要なフックが emacs20.x の内部的な問題で
誤動作しているのかどうかはわかりません. これ使ってる elisp って結構多
い筈だし. 結果, これ以上は分からなかったので, 回避策として自分で少し
書き直したまでです. ソース見たら決して美しくない方法なのがわかるでしょ
う... 他に良い方法があれば私も是非教えてほしいです.

  左に行番号表示させる話って, 今まであまりなかったのでしょうか.
  emacs を常用するプログラマの方はそんなもの要らないって思ってるのかな.






まだまだ勉強中...
http://homepage1.nifty.com/blankspace/emacs/emacs.html
--
  _/_/   Nakamura Naoki
_/_/   naoki.y.nakamura@nifty.com
Re: muleで行番号表示
#286
Author: Hiromichi Yamada
Date: Sun, 15 Oct 2000 00:00
20 lines
2076 bytes
At Sat, 14 Oct 2000 02:09:54 +0900,
Naoki Nakamura <naoki.y.nakamura@nifty.com> wrote:
>   左に行番号表示させる話って, 今まであまりなかったのでしょうか.
>   emacs を常用するプログラマの方はそんなもの要らないって思ってるのかな.

私がMuleを使い始めたころ、Windowsのエディタにはたいてい
行番号表示があったので、なぜEmacsやMuleにはそれがないのかと思いました。
しかし先輩に goto-line を教えてもらって、キーに割り当ててみると
目的の行に一発で移動できるので、なるほどこれなら
常に行番号を表示する必要はないのだな、と思いました。

そういえばリターンやタブの記号(↓とか→とか)もemacsには
ありませんね。makefile-mode でタブを打ったときに色が付くくらいでしょう。

手元の
GNU Emacs 20.7.1 (sparc-sun-solaris2.6, X toolkit, emcws)
では、標準のバインドではgoto-lineはどのキーにもなく

XEmacs 20.4 "Emerald" [Lucid] (sparc-sun-solaris2.6, Mule)
では、M-gにバインドされていました。
Re: mule で行番号表示
#128
Author: KATAYAMA Yoshio
Date: Tue, 17 Oct 2000 05:50
35 lines
2822 bytes
$BJR;3!w(B Tamago Project $B%a%s%P!<$N0l?M$G$9!#(B

In article <39DE897B.A8F2294D@mail.ecc.u-tokyo.ac.jp>,
	IIJIMA 'Delmonta' Hiromitsu <L94102@mail.ecc.u-tokyo.ac.jp> writes:

>	$B$($C$H!"(BEmacs 20$B!J(BMule 3$B!"(BMule 4$B!K$NF|K\8l=hM}$O!"$?$7$+$K(B
>	$B%P!<%8%g%sHV9f$O>e$,$C$F$$$^$9$,!"(BMule 2.3 $B$N40A4>e0L8_49$G$O(B
>	$B$"$j$^$;$s!#(B

Emacs 20 $B$KF~$i$J$+$C$?5!G=$H$7$F(B Bi-Directional $B$,$"$j$^$9!#(B

>	$B6qBNE*$KNc$r5s$2$k$H(B Wnn$B!"(BCanna $B$N%5%]!<%H$,!"(BEmacs $BC1BN$K$O(B
>	$B$J$/$F!";H$$$?$1$l$P(B emcws$B!J(BEMacs+Canna+Wnn+Sj3$B!K$H$$$&%Q%C%A$r(B
>	$BEv$F$F%3%s%Q%$%k$9$k$+!"(BTamago 4 $B$H$$$&%Q%C%1!<%8$rF~$l$kI,MW$,(B
>	$B$"$j$^$9!#:#$N$H$3$m(B Tamago 4 $B$K$O%]!<%F%#%s%0$5$l$F$$$J$$5!G=$,(B
>	$B$?$/$5$s$"$k$N$G!"EvJ,$O(B emcws $B$NE72<$G$7$g$&!#(B

(_ _;;;

>	Emacs 20 $B$NF|K\8l=hM}$K$D$$$F$O!"(BMule 2.3 $B$N5!G=$N$&$A!"K\2H$N(B
>	$B3+H/<T$G$"$k(B Richard Stallman $B;a$,M}2r$G$-$?ItJ,$@$1$,:NMQ$5$l!"(B
>	Stallman $B;a$,M}2r$G$-$J$+$C$?!J$"$k$$$OI,MW@-$rG'$a$J$+$C$?!)!K(B
>	$BItJ,$O:o$i$l$?$s$@$=$&$G$9!#(B

$B;~4VE*$JLdBj$@$HJ9$$$F$$$^$9!#$?$^$4$N>l9g$K$O!"(B

    $B%i%$%;%s%9$,ITL@NF$J%i%$%V%i%j$rAH$_F~$l$kI,MW$,$"$k(B
    $B0?$O!"%@%$%J%_%C%/%m!<%G%#%s%0!J$3$l$O(B RMS $B$,H?BP!K$,I,MW(B

$B$H$$$&LdBj$,$"$j!"(BElisp $B$@$1$G=q$-D>$9$3$H$K$J$C$?$N$,Bg$-$+$C$?(B
$B$H;W$$$^$9!#(B

$B!t>\$7$$$3$H$OCN$i$J$$$N$G!"H>ED$5$s$K8fEP>l4j$&$N$,$h$5$=$&!"!"!"(B
--
$BJR;3!w#P#F#U(B
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads