From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bijan Soleymani Newsgroups: gmane.emacs.help Subject: Re: true "word wrap" Date: 07 Dec 2002 18:45:05 -0500 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87lm31wfzy.fsf@server.crasseux.com> References: <8765u94qep.fsf@squeaker.lickey.com> <87hedqh638.fsf@tc-1-100.kawasaki.gol.ne.jp> <84el8tsyp4.fsf@lucy.cs.uni-dortmund.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1039305141 5470 80.91.224.249 (7 Dec 2002 23:52:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 7 Dec 2002 23:52:21 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18Kok8-0001Px-00 for ; Sun, 08 Dec 2002 00:52:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18Kodf-0002m9-07 for gnu-help-gnu-emacs@m.gmane.org; Sat, 07 Dec 2002 18:45:39 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!wesley.videotron.net!wagner.videotron.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 16 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-NNTP-Posting-Host: 24.203.44.117 Original-X-Complaints-To: abuse@videotron.ca Original-X-Trace: wagner.videotron.net 1039304601 24.203.44.117 (Sat, 07 Dec 2002 18:43:21 EST) Original-NNTP-Posting-Date: Sat, 07 Dec 2002 18:43:21 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:107865 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4413 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4413 --=-=-= Michael Herman writes: I'm working on this idea of having commands to move by screen lines instead of logical lines. I have implemented an ugly hack version, but it assumes that every character has the same width, which is not correct for control chars. But as long as there aren't any it works fine. And even with control chars it works more or less. The only exceptions being stuff like .elc files or general binary files, where everything show up as control chars. I've attached my small file. It remaps C-n and C-p to work by screen lines instead of logical lines. I know I should make this into a minor mode, but I am a relative newbie to emacs lisp. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=scrmotion.el Content-Description: hack to have screen motion (setq screen-column-miss 0) (setq screen-point-last 0) (setq cache-long-line-scans 1) ; speeds this up for line longs (defun screen-move-to-column (column) (while (and (> column 0) (not (eolp))) (forward-char) (setq column (- column 1)))) (defun screen-forward-line () (interactive) ;;;save value of screen column (setq screen-point-first (point)) (vertical-motion 0) (setq screen-column-original (- screen-point-first (point))) (if (and (not (= screen-column-miss 0)) (= screen-point-first screen-point-last)) (setq screen-column-original screen-column-miss) (setq screen-column-miss 0)) (vertical-motion 1) (screen-move-to-column screen-column-original) ;;;find new column (setq screen-point-last (point)) (vertical-motion 0) (setq screen-column-new (- screen-point-last (point))) (screen-move-to-column screen-column-new) (if (> screen-column-original screen-column-new) (setq screen-column-miss screen-column-original) (setq screen-column-miss 0))) (defun screen-backward-line () (interactive) ;;;save value of screen column (setq screen-point-first (point)) (vertical-motion 0) (setq screen-column-original (- screen-point-first (point))) (if (and (not (= screen-column-miss 0)) (= screen-point-first screen-point-last)) (setq screen-column-original screen-column-miss) (setq screen-column-miss 0)) (vertical-motion -1) (screen-move-to-column screen-column-original) ;;;find new column (setq screen-point-last (point)) (vertical-motion 0) (setq screen-column-new (- screen-point-last (point))) (screen-move-to-column screen-column-new) (if (> screen-column-original screen-column-new) (setq screen-column-miss screen-column-original) (setq screen-column-miss 0))) (global-set-key "\C-n" 'screen-forward-line) (global-set-key "\C-p" 'screen-backward-line) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnu-emacs --=-=-=--