Article View: fj.editor.xemacs
Article #306Re: スクロールの挙動
From: IMAI Hidetoshi
Date: Tue, 05 Jun 2001 17:36
Date: Tue, 05 Jun 2001 17:36
95 lines
4808 bytes
4808 bytes
今井です。
At 06 Jun 2001 01:51:29 +0900,
Seiichi Namba wrote:
>
> 難波です。
>
> c-quick.el も basic.el の smooth-scroll-up/down も mark に関しては何も
> 処理していないと思うので、「リージョンが指定できない」というのは解せな
> いように思います。
>
> 具体的に「このような動作を期待している」が「こうしかならない」という
> ように書いてみていただけますか。
>
> 手元では、C-SPC した後、smooth-scroll-down して先に進み、C-x C-x すれば
> 元の位置に戻るので、動作は正常に思えます。
編集したいファイルを開き、C-SPC でマークをする。
C-n で "smooth-scroll-down" を数回実行する。
このあと、C-w で kill-region を実行したい。
という作業をしたいのですが、kill-regionできません。
.emacsに書き加えた、basic.el の一部を添付します。
よろしくお願いします。
;--------------------------------------------------
;scrollの設定
;--------------------------------------------------
(defun current-line-in-window ()
"Returns line count of current line in current window. No arg."
(save-excursion
;; goto bol not to count \n at eol of this line...
(beginning-of-line)
(count-lines (point)
(save-excursion (move-to-window-line 0)
(point)))))
(defun smooth-scroll-up (arg)
"Moves cursor down keeping cursor within 1/3 to 2/3 area of current window.
Scroll the window in need.
It's convenient to bind this command to down arrow key."
(interactive "p")
(let* ((height (1- (window-height)))
(parity (% height 2))
(top-edge (/ (1- height) 4))
(btm-edge (+ (1+ parity) (* top-edge 3)))
(c-line (current-line-in-window))
(bob-not-shown;; var. to duck ding.
(not (pos-visible-in-window-p (point-min)))))
;; Old code.
;; (bob-not-shown (if (/= (point-min) ;; var. to duck ding.
;; (save-excursion
;; (move-to-window-line 0)
;; (point))) t nil)))
(if
;; Case cursor is within central area:
(or (and (> arg 0)
(<= c-line btm-edge)
(< (- btm-edge c-line) arg))
(and (< arg 0)
(>= c-line top-edge)
;;(< (- c-line top-edge) (- arg)) ;; old code for next line.
(> (- top-edge c-line) arg)
bob-not-shown))
(scroll-up arg)
;; else if cursor is in peripheral area:
;; re-calibrating cursor to central area.
(progn
(if (and (> arg 0)
(> c-line btm-edge))
(scroll-up (+ arg (- c-line btm-edge))))
(if (and (< arg 0)
(< c-line top-edge)
bob-not-shown)
(scroll-up (+ arg (- c-line top-edge))))))
(line-move arg)
(setq this-command 'next-line)))
(defun smooth-scroll-down (arg)
"Moves cursor up keeping cursor within 1/3 to 2/3 area of current wind
ow.
Scroll the window in need.
It's convenient to bind this command to up arrow key."
(interactive "p")
(smooth-scroll-up (- arg))
(setq this-command 'previous-line))
(global-set-key "\C-p" 'smooth-scroll-down)
(global-set-key [up] 'smooth-scroll-down)
(global-set-key "\C-n" 'smooth-scroll-up)
(global-set-key [down] 'smooth-scroll-up)
Technical Details
Message-ID:
<xl94rtuomm1.wl@cal.infonets.hiroshima-u.ac.jp>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.mesh.ad.jp!news-sv.sinet!east-news.csi.ad.jp!hiroshima-u!not-for-mailReferences:
<xl9d78jgki9.wl@cal.infonets.hiroshima-u.ac.jp> <9fj2mh$8o1$1@sn.asahi-net.email.ne.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 1107f7,bc01201f0ce88c8c X-Google-Attributes: gid1107f7,public X-Google-ArrivalTime: 2001-06-05 10:40:34 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.mesh.ad.jp!news-sv.sinet!east-news.csi.ad.jp!hiroshima-u!not-for-mail From: IMAI Hidetoshi <hidepin@infonets.hiroshima-u.ac.jp> Newsgroups: fj.editor.xemacs Subject: Re: スクロールの挙動 Date: Wed, 06 Jun 2001 02:36:06 +0900 Organization: Hiroshima University Lines: 96 Message-ID: <xl94rtuomm1.wl@cal.infonets.hiroshima-u.ac.jp> References: <xl9d78jgki9.wl@cal.infonets.hiroshima-u.ac.jp> <9fj2mh$8o1$1@sn.asahi-net.email.ne.jp> NNTP-Posting-Host: cal.infonets.hiroshima-u.ac.jp Mime-Version: 1.0 (generated by SEMI 1.13.7 - "Awazu") Content-Type: text/plain; charset=ISO-2022-JP X-Trace: news.hiroshima-u.ac.jp 991762477 16027 133.41.33.61 (5 Jun 2001 17:34:37 GMT) X-Complaints-To: news-admin@hiroshima-u.ac.jp NNTP-Posting-Date: 5 Jun 2001 17:34:37 GMT In-Reply-To: <9fj2mh$8o1$1@sn.asahi-net.email.ne.jp> User-Agent: Wanderlust/2.4.1 (Stand By Me) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd)