Article View: gnu.emacs.help
Article #188833Re: End of file detection
From: kpc
Date: Sat, 15 Jun 1991 09:03
Date: Sat, 15 Jun 1991 09:03
42 lines
2268 bytes
2268 bytes
here is a change to have C-n not move past eob. put it in your .emacs
if you like it. use C-xC-e at the end of it to try it for the rest of
your emacs session.
p.s. symbolics machines use keywords to allow this. will elisp gain
keywords?
(defun next-line (arg)
"Local version of the command. Does not insert newlines. Only one line
has changed.
Move cursor vertically down ARG lines.
If there is no character in the target line exactly under the current column,
the cursor is positioned after the character in that line which spans this
column, or at the end of the line if it is not long enough.
If there is no line in the buffer after this one,
a newline character is inserted to create a line
and the cursor moves to that line.
The command \\[set-goal-column] can be used to create
a semipermanent goal column to which this command always moves.
Then it does not try to move vertically.
If you are thinking of using this in a Lisp program, consider
using `forward-line' instead. It is usually easier to use
and more reliable (no dependence on goal column, etc.)."
(interactive "p")
(if (= arg 1)
(let ((opoint (point)))
(forward-line 1)
(if (or (= opoint (point))
(not (eq (preceding-char) ?\n)))
;was: (insert ?\n)
nil ;placeholder. as
;it is, it shouldn't
;matter what its value is
(goto-char opoint)
(line-move arg)))
(line-move arg))
nil)
--
Tweety is a bird. Socrates is a man. John loves Mary. Mary is tall.
Technical Details
Message-ID:
<KPC.91Jun15020359@kronos-fi.arc.nasa.gov>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!ptolemy-ri!pluto.arc.nasa.gov!kpcReferences:
<B=C-A-+@engin.umich.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,aede17fcc792d7dd X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-06-15 08:33:03 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!ptolemy-ri!pluto.arc.nasa.gov!kpc From: kpc@pluto.arc.nasa.gov (kpc) Newsgroups: gnu.emacs.help Subject: Re: End of file detection Message-ID: <KPC.91Jun15020359@kronos-fi.arc.nasa.gov> Date: 15 Jun 91 09:03:59 GMT References: <B=C-A-+@engin.umich.edu> Sender: usenet@ptolemy-ri.arc.nasa.gov Organization: Sterling at NASA Ames Research Center Artificial Intelligence applications Lines: 42 In-reply-to: lowrie@shear.engin.umich.edu's message of 13 Jun 91 21:26:12 GMT