Thread View: fj.editor.mule
4 messages
4 total messages
Started by IIJIMA 'Delmonta' Hiromitsu
Mon, 24 May 1999 00:00
物理行単位でのカーソル移動について
Author: IIJIMA 'Delmonta' Hiromitsu
Date: Mon, 24 May 1999 00:00
Date: Mon, 24 May 1999 00:00
49 lines
3035 bytes
3035 bytes
こんにちは。いいじま@東大文学部と申します。 Emacs(Mule) 上で、カーソルを物理行(画面上の 1 行)単位で 移動するマクロに、いいものはないでしょうか。 物理行単位というのは、要するに、 |いろはにほへとちりぬるを わかよたれ\| |そつねならむ | |ABCDEFGHIJKLMNOPQRSTUVWXYZ の「と」の位置にカーソルがあったときに、 「む」隣の位置にカーソルを移動するという機能がほしいのです。 #通常の next-line コマンドでは「M」の位置にいって #しまいますよね? すでに、FAQ に「picture-mode にすれば OK」という記述がある ことは確認しておりますが、fundamental-mode で使いたいのです。 #私の auto-mode-alist は nil にしてあります(^^;) ☆ Emacs Lisp Reference Manual で、自分でプログラムを組むために 必要と思われる関数等は目星がついていますが、できれば自分で作る 前に先例を探したいというのが投稿意図です。 ちなみに、www.goo.ne.jp で「emacs」と「物理行」をキーに探した ところ、http://www.d-sys.co.jp/~kano/physical.el が見つかり ましたが、けっこう大がかりなので、もっとエレガントなものがないか、 と考えています。 ついでに、位置の復帰、つまり、上の例で言えば「を」から行末に 移って、さらに物理行移動コマンドを実行したときに、「M」ではなく 「W」か「X」に移ってほしいということを考えています。 動作環境としては、Mule 2.3 based on Emacs 19.34.1 で動くことが 絶対条件ですが、できればバージョン依存の少ないものを希望します。 P.S. 実は、この話は signature に書いてあるサイトのネタにしようとも 考えています(^^;)ので、よろしければどうぞ。 ☆-- 飯嶋 浩光 ----------------------------------------------☆ |IIJIMA 'Delmonta' Hiromitsu an der Universitaet Tokyo | ☆-----------------------------------------------------------☆ |【宣伝】EmacsのVZ+ATOK+カナ入力化など外道カスタマイズの数々| | http://user.ecc.u-tokyo.ac.jp/~g740564/emacs/ | ☆------------------------- g740564@mail.ecc.u-tokyo.ac.jp --☆
Re: 物理行単位でのカーソル移動について
Author: Inaba Hiroto
Date: Tue, 25 May 1999 00:00
Date: Tue, 25 May 1999 00:00
25 lines
1558 bytes
1558 bytes
稲葉です。 IIJIMA 'Delmonta' Hiromitsu wrote: > > こんにちは。いいじま@東大文学部と申します。 > > Emacs(Mule) 上で、カーソルを物理行(画面上の 1 行)単位で > 移動するマクロに、いいものはないでしょうか。 window-lines.elというものがあります。 自分がsaveしたものは ;; basic cursor moving commands based on window lines ;; Copyright (C) 1990 enami tsugutomo (enami@ptgd.sony.co.jp) : ;; $Id: window-lines.el,v 1.15 90/04/26 19:54:59 enami Rel $ となっています。かなり古いですが、emacs-20.3でもとりあえず動くようです。 > ついでに、位置の復帰、つまり、上の例で言えば「を」から行末に > 移って、さらに物理行移動コマンドを実行したときに、「M」ではなく > 「W」か「X」に移ってほしいということを考えています。 ちょっとやって見たところではそのように動くように見えます。 -- 稲葉 浩人 <inaba@st.rim.or.jp>
Re: 物理行単位でのカーソル移動について
Author: Seiichi Namba
Date: Tue, 25 May 1999 00:00
Date: Tue, 25 May 1999 00:00
111 lines
5049 bytes
5049 bytes
$BFqGH$H$b$&$7$^$9!#(B
IIJIMA 'Delmonta' Hiromitsu <g740564@komaba.ecc.u-tokyo.ac.jp> $B$5$s(B writes:
> $B$3$s$K$A$O!#$$$$$8$^!wElBgJ83XIt$H?=$7$^$9!#(B
>
> Emacs(Mule) $B>e$G!"%+!<%=%k$rJ*M}9T!J2hLL>e$N(B 1 $B9T!KC10L$G(B
> $B0\F0$9$k%^%/%m$K!"$$$$$b$N$O$J$$$G$7$g$&$+!#(B
>
> $BJ*M}9TC10L$H$$$&$N$O!"MW$9$k$K!"(B
$B;d$N463P$G$O!VJ*M}9T!W$H!VO@M}9T!W$N0UL#$,$*$C$7$c$C$F$$$k$N$H5U$J$s$G$9$,!"(B
$B$3$N%0%k!<%W$G2?EY$+F1<q;]$N5-;v$r8+$?$3$H$,$"$k$N$H!"K?=j$G65$o$C$?(B
$B%3!<%I$+$i<!$N$h$&$J$b$N$r=q$$$F$_$^$7$?!#(B
(defun virtual-next-line (&optional arg)
"Virtual version of next-line. Accepts LINES as arg"
(interactive "p")
(let ((goalx (- (current-column)
(save-excursion (vertical-motion 0) (current-column)))))
(vertical-motion arg)
;; (vertical-motion 0) ; Perhaps not required (I forgot).
(move-to-column (+ (current-column) goalx))))
(DOS $B5/8;$N%F%-%9%H%U%!%$%k$J$I$O$"$i$+$8$a2~9T$7$F$7$^$C$F$+$i:n6H$9(B
$B$k$N$,>u67E*$K5v$5$l$F$$$k$N$G(B)$B$3$N<o$N$b$N$O<BMQ$7$F$J$$$N$G$9$,!#(B
$B@^$j$+$($7$,B?$/!"JT=8$b5v$5$l$J$$>l9g$O!"(B
(defun truncate-lines (arg)
"If ARG, setq truncate-lines to t, if not nil"
(interactive "P")
(setq truncate-lines arg))
$B$N$h$&$J$3$H$r$7$F$$$^$9!#(B
$B$=$N>l9g!"?eJ?0\F0$O%-!<%\!<%I$G$d$k$N$,I8=`$N%-!<%P%$%s%I$G$O(B
$B62$7$/LLE]$J$N$G(B
/usr/local/emacs-20.2/share/emacs/20.2/lisp/mouse-drag.el
$B$H$$$&$N$r;H$C$F$^$9(B($B$3$l$O(B 19.28/19.34 $B$G$b$=$N$^$^F0$/(B)$B!#(B
mouse-drag $B$O0lIt$*$+$7$$$3$H$m$,$"$C$?$N$G!"%Q%C%A$r(B
http://www.asahi-net.or.jp/~pi9s-nnb/dired-dd-home.html
$B$KCV$$$?(B tarball $B$K<}G<$7$F$"$C$?$h$&$J5$$,$7$^$9!#(B
$B$D$$$G$K!"(Bmouse-drag $B$r;H$&$J$i!"(B
/usr/local/emacs-19.34/share/emacs/19.34/lisp/mldrag.el
$B$bF1;~$K;H$&$H%P%i%s%9$,NI$$$+$b$7$l$^$;$s(B($B$3$l$O(B 19.x $B$K$b$"$k(B)$B!#(B
$BOC$,$:$l$9$.$^$7$?$G$7$g$&$+!D!)(B
> $B!t;d$N(B auto-mode-alist $B$O(B nil $B$K$7$F$"$j$^$9(B(^^;)
picture $B%b!<%I$O;H$$$?$/$J$$!"$H$$$&0UL#$G$9$+!#3N$+$KIaDL$NJ8>O(B
$B$G$O$A$g$$$H$o$:$o$i$7$$$G$9$M!#(B
> $B!y(B
>
> Emacs Lisp Reference Manual $B$G!"<+J,$G%W%m%0%i%`$rAH$`$?$a$K(B
> $BI,MW$H;W$o$l$k4X?tEy$OL\@1$,$D$$$F$$$^$9$,!"$G$-$l$P<+J,$G:n$k(B
> $BA0$K@hNc$rC5$7$?$$$H$$$&$N$,Ej9F0U?^$G$9!#(B
$B$A$J$_$K!"(B
Host ftp.eos.hokudai.ac.jp
Location: /pub/GNU/emacs/elisp
FILE -r--r--r-- 15989 Jan 8 1997 c-quick.tgz
Location: /pub/emacs/elisp
FILE -r--r--r-- 15989 Jan 8 1997 c-quick.tgz
$B$H$$$&$b$N$,$"$C$F!"$3$l$O3N$+8f=jK>$N5!G=$rM-$7$F$$$?$H5-21$7$^$9!#(B
> $B$A$J$_$K!"(Bwww.goo.ne.jp $B$G!V(Bemacs$B!W$H!VJ*M}9T!W$r%-!<$KC5$7$?(B
> $B$H$3$m!"(Bhttp://www.d-sys.co.jp/~kano/physical.el $B$,8+$D$+$j(B
> $B$^$7$?$,!"$1$C$3$&Bg$,$+$j$J$N$G!"$b$C$H%(%l%,%s%H$J$b$N$,$J$$$+!"(B
> $B$H9M$($F$$$^$9!#(B
c-quick $B$b!"$3$N<q;]<+BN$,L\E*$G$O$J$+$C$?$H;W$$$^$9!#(B
> $B$D$$$G$K!"0LCV$NI|5"!"$D$^$j!">e$NNc$G8@$($P!V$r!W$+$i9TKv$K(B
> $B0\$C$F!"$5$i$KJ*M}9T0\F0%3%^%s%I$r<B9T$7$?$H$-$K!"!V(BM$B!W$G$O$J$/(B
> $B!V(BW$B!W$+!V(BX$B!W$K0\$C$F$[$7$$$H$$$&$3$H$r9M$($F$$$^$9!#(B
$B$3$3$O!"!V9TKv$K0\F0!W$9$kJ}K!$,$h$/H=$i$J$$$N$G$9$,(B C-e $B$H$+$G$7$g$&$+!#(B
C-e $B$7$?8e!"$=$N?eJ?0LCV$,J]B8$5$l$J$$!"$H$$$&$N$O;EMM>e$"$^$j;H$$(B
$B$h$/$J$$$h$&$J5$$b$7$^$9$M!#$^$?!"DL>o$N(B C-n $B$H$N6hJL$r$I$&$D$1$k$N$+!"(B
$B$H$$$&$N$b$"$k$+$J!D!#$*9M$($K$J$C$F$$$k;v$O$J$s$H$J$/H=$k$N$G$9$,!D!#(B
$B$J$*!"=D0\F0$G!"?eJ?0LCV$rJ]B8$9$k$+H]$+!"$H$$$&JQ?t$,2?$+$"$C$?$h$&$K(B
$B5-21$7$^$9$,!":#;W$$=P$9$3$H$,$G$-$^$;$s!#(B
> $BF0:n4D6-$H$7$F$O!"(BMule 2.3 based on Emacs 19.34.1 $B$GF0$/$3$H$,(B
> $B@dBP>r7o$G$9$,!"$G$-$l$P%P!<%8%g%s0MB8$N>/$J$$$b$N$r4uK>$7$^$9!#(B
$B$3$NDxEY$@$H%P!<%8%g%s$K$O0MB8$9$k$h$&$JLdBj$OL5$$$h$&$J5$$,$7$^$9!#(B
$B$"!"$G$b9T!JKv!K4X78$G$O!"(Bdo-auto-fill $B$NJV$jCM$,(B 19.28 $B$H(B 19.34 $B$G0c(B
$B$&!"$H$$$&$N$,$"$C$?$+$J(B ($B$G!"(Bskk-9.6m $B$G2~9T$,F~$i$J$$!"$H$$$&!#$3$l(B
$B$O(B skk-ml $B$K%Q%C%A$rEj$2$^$7$?(B)$B!D!#(B
PS.
$B8=:_!"A4$F$N5-;v$r<hF@$7$-$l$J$$>u67$J$N$G!"=EMW$J%3%a%s%H$O(B Cc:
$B$7$FBW$1$l$P9,$$$G$9!#(B
$BFqGH@60l!wEl5~J]C+;T(B (http://www.asahi-net.or.jp/~pi9s-nnb/)
NAMBA Seiichi / sn@asahi-net.email.ne.jp
Re: 物理行単位でのカーソル移動について
Author: Inaba Hiroto
Date: Sat, 29 May 1999 00:00
Date: Sat, 29 May 1999 00:00
241 lines
8522 bytes
8522 bytes
This is a multi-part message in MIME format.
--------------1701AF4A89A4355EDA5272E1
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
$B0pMU$G$9!#(B
Inaba Hiroto wrote:
> IIJIMA 'Delmonta' Hiromitsu wrote:
> > Emacs(Mule) $B>e$G!"%+!<%=%k$rJ*M}9T!J2hLL>e$N(B 1 $B9T!KC10L$G(B
> > $B0\F0$9$k%^%/%m$K!"$$$$$b$N$O$J$$$G$7$g$&$+!#(B
>
> window-lines.el$B$H$$$&$b$N$,$"$j$^$9(I!(B $B<+J,$,(Bsave$B$7$?$b$N$O(B
>
> ;; basic cursor moving commands based on window lines
> ;; Copyright (C) 1990 enami tsugutomo (enami@ptgd.sony.co.jp)
> $B!'(B
> ;; $Id: window-lines.el,v 1.15 90/04/26 19:54:59 enami Rel $
$B$3$l$K$D$$$F!"8+$D$1$i$l$J$$$H$N%a!<%k$r$"$kJ}$+$i$$$?$@$-$^$7$?!#(B
$BB>$K$b6=L#$r;}$?$l$?J}$b$$$k$+$b$7$l$^$;$s$7!"(BGPL$B$K$h$j:FG[I[2DG=!"(B
$B$+$DC;$$$b$N$G$9$N$G!"$3$N5-;v$K$D$1$FAw$j$^$9(I!(B
# $B:#$J$i(Bminor mode$B$H$7$F<BAu$9$Y$-$J$s$G$7$g$&$M!#C/$+$K(BVersion Up$B$7$F(B
# $BD:$1$l$P$H$N4|BT$b9~$a$F$$$^$9(I!(B
--
$B0pMU(B $B9@?M(B <inaba@st.rim.or.jp>
--------------1701AF4A89A4355EDA5272E1
Content-Type: text/plain; charset=iso-2022-jp; name="window-lines.el"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="window-lines.el"
;; basic cursor moving commands based on window lines
;; Copyright (C) 1990 enami tsugutomo (enami@ptgd.sony.co.jp)
;; This file is not a part of GNU Emacs.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY. No author or distributor
;; accepts responsibility to anyone for the consequences of using it
;; or for whether it serves any particular purpose or works at all,
;; unless he says so in writing. Refer to the GNU Emacs General Public
;; License for full details.
;; Everyone is granted permission to copy, modify and redistribute
;; This file, but only under the conditions described in the
;; GNU Emacs General Public License. A copy of this license is
;; supposed to have been given to you along with GNU Emacs so you
;; can know your rights and responsibilities. It should be in a
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
;;
;; $Id: window-lines.el,v 1.15 90/04/26 19:54:59 enami Rel $
;;
(defvar cursor-move-window-line nil "*T if cursor move on window lines.")=
(defun window-line-move (arg)
(if (not (memq last-command
;; Do you think also need next-line and previous-line ? =
'(window-next-line window-previous-line) ))
;; update temporary-goal-column
(setq temporary-goal-column
(if (and track-eol (eolp))
9999
(current-window-column) )))
;; move vertically
(forward-window-line arg)
;; adjust column
(move-to-window-column (or goal-column temporary-goal-column))
nil)
=0C
;;;
;;; basic functions
;;;
(defun beginning-of-window-line ()
"Goto beginning of current window line."
(vertical-motion 0))
(defun end-of-window-line ()
"Goto beginning of current window line."
(if (eobp)
nil ; already on eol.
(vertical-motion 1)
;; never back if last line ends without LFD.
(if (or (not (eobp))
(=3D (current-column) 0)) ; If !0, it means was on last line
; and reach to end of buffer
; Attention that not on the eob
; at first.
(forward-char -1) )))
(defun current-window-column ()
"Return the horisontal position of point on window."
(let* ((ccol (current-column))
;; left column
(lcol (save-excursion
;; moves left edge of current line
(beginning-of-window-line)
(current-column) )))
;; if selective-display some times become negative, incorrect value
;; is returne but no way to get correct value, I think ... :-<
(- ccol lcol) ))
(defun move-to-window-column (col)
"Move point to column COLUMN in the current window line."
(let* ((beg (progn
(beginning-of-window-line)
(current-column)))
(lim (save-excursion
(end-of-window-line)
(current-window-column) )))
(and (< col 0) (setq col 0))
(and (< lim col)
(< 0 lim) ; for selective display. DOUBTFUL.
(setq col lim))
(move-to-column (+ beg col)) ))
(defun forward-window-line (args)
"Move ARGS line on window with preserving current window column."
(if (/=3D args 0)
(let* ((cwcol (current-window-column)))
(vertical-motion args)
(move-to-window-column cwcol) )))
=0C
;;;
;;; editing commands
;;;
(defun window-next-line (arg)
"Move ARGs line down. Almost same as next-line but move on window line=
=2E"
(interactive "p")
(if (and cursor-move-window-line (not truncate-lines))
(if (/=3D arg 1)
(window-line-move arg)
;; arg is 1. special case.
(let* ((point (point)))
(window-line-move 1)
;; (window-line-move 1) doesn't move if on the last line.
(if (/=3D point (point))
nil
;; on the last line
(end-of-window-line)
(insert ?\n) )))
(setq this-command 'next-line) ;for line-move
(next-line arg) ))
=
(defun window-previous-line (arg)
"Move ARGs line up. Almost same as previous-line but move on window li=
ne."
(interactive "p")
(if (and cursor-move-window-line (not truncate-lines))
(window-line-move (- arg))
(setq this-command 'previous-line) ;for line-move
(previous-line arg) ))
(defun window-beginning-or-end-of-line (new org arg)
(if (not cursor-move-window-line)
(funcall org arg)
;; first move (1- arg) line forward
(forward-window-line (1- arg))
(funcall new)))
(defun window-beginning-of-line (arg)
"Move to beginning of line. See also the documentation of
beginning-of-line."
(interactive "p")
(window-beginning-or-end-of-line
'beginning-of-window-line 'beginning-of-line arg))
(defun window-end-of-line (arg)
"Move to end of line. See also the documentation of end-of-line."
(interactive "p")
(window-beginning-or-end-of-line
'end-of-window-line 'end-of-line arg))
=0C
;;
;; minor mode definitions
;;
(or (assq 'cursor-move-window-line minor-mode-alist)
(setq minor-mode-alist
(cons '(cursor-move-window-line " WLine")
minor-mode-alist) ))
(defvar window-line-mode-hook
(list (function
(lambda ()
(and cursor-move-window-line
(mapcar
(function (lambda (pair) =
(apply (function substitute-all-key-definition)
pair) ))
'((next-line window-next-line)
(previous-line window-previous-line)
(beginning-of-line window-beginning-of-line)
(end-of-line window-end-of-line)) )))))
"List of hook variable which value is called as no arg function
when window-line-mode is executed.")
(defun substitute-all-key-definition (olddef newdef)
"Replace OLDDEF with NEWDEF by defining local key map."
(let* (map key (keys (where-is-internal olddef (current-local-map))))
(while keys
(setq key (car keys)
keys (cdr keys))
(local-set-key key newdef) )))
(defun window-line-mode (&optional arg)
"Toggle window line mode. With positive ARGument, turn on, else off.
At the end, window-line-mode-hook is called. See run-hooks for hook vari=
able."
(interactive "P")
(make-local-variable 'cursor-move-window-line)
(setq cursor-move-window-line
(if (null arg)
(not cursor-move-window-line)
(< 0 (prefix-numeric-value arg)) ))
(set-buffer-modified-p (buffer-modified-p)) ; update mode-line
(run-hooks 'window-line-mode-hook) )
=0C
(mapcar (function
(lambda (args)
(global-set-key (car args) (cdr args))))
'(("\C-a" . window-beginning-of-line)
("\C-e" . window-end-of-line)
("\C-n" . window-next-line)
("\C-p" . window-previous-line)
))
--------------1701AF4A89A4355EDA5272E1--
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