🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #188786

Re: next-line question

#188786
From: Paul Barton-Davis
Date: Tue, 09 Jul 1991 17:24
31 lines
2033 bytes
In article <3845@charon.cwi.nl> waal@cwi.nl (Peter de Waal) writes:
>In my .emacs file I have
>
>    (defun my-next-line (arg)
>      "doesn't next-line past end of buffer"
>      (interactive "p")
>      (if (not (eobp)) (next-line arg)))
>
>as an alternative for the standard 'next-line'. It has the advantage
>that it doesn't add new lines at the end of a buffer. The disadvantage
>is that is forgets the original column position of the cursor whenever
>you do a 'my-next-line' to a line that is shorter then the previous
>one.  In particular this means that doing a 'my-next-line' while
>crossing an empty line causes the cursor to end up in column 1 and
>stay there during subsequent my-next-lines. The original 'next-line',
>however, handles this correctly. Can anybody explain me why?  Does
>anybody know a cure?

This is "expensive", but works. I'd like a "cheaper" way, but I'm sure
one will show up ...

(defun only-next-line (&optional line)
  (interactive "p")
  (if (= 1 (save-excursion (forward-line 1)))
      (beep)
    (next-line line)))
-- 
"When in some obscure country town, the farmers come together to a special town
meeting, to express their opinion on some subject that is vexing the land, that
I think is the true Congress, and the most respectable one that is ever
assembled in the United States." - Thoreau
Technical Details
Message-ID: <1991Jul9.172453.26795@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!stowe.cs.washington.edu!pauld
References: <3845@charon.cwi.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,b8a9d8f033088283
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-07-09 13:46:48 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!stowe.cs.washington.edu!pauld
From: pauld@stowe.cs.washington.edu (Paul Barton-Davis)
Newsgroups: gnu.emacs.help
Subject: Re: next-line question
Message-ID: <1991Jul9.172453.26795@beaver.cs.washington.edu>
Date: 9 Jul 91 17:24:53 GMT
References: <3845@charon.cwi.nl>
Sender: news@beaver.cs.washington.edu (USENET News System)
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 31