🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Doug Puchalski Tue, 10 Aug 1993 13:57
Looking for some epoch code
#800
Author: Doug Puchalski
Date: Tue, 10 Aug 1993 13:57
5 lines
769 bytes
I'm looking for lisp code that
 - Shows line & col when I click the mouse
 - Won't let me add lines to the end of a file with the down arrow

Can someone post it?
Re: Looking for some epoch code
#806
Author: Mark D. Baushke
Date: Tue, 10 Aug 1993 20:40
91 lines
3863 bytes
On Tue, 10 Aug 93 13:57:20 GMT, drp@dvorak.amd.com (Doug Puchalski) said:

doug> I'm looking for lisp code that
doug>  - Shows line & col when I click the mouse

I don't have one off hand, but you should be able to bind the mouse to
do a (what-cursor-position) for you.

doug>  - Won't let me add lines to the end of a file with the down arrow

See next-line-noextend.el after my .signature (it works for emacs
18.55 through 18.59 and all versions of epoch).

doug> Can someone post it?

	-- Mark
	mdb@cisco.com

;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: Emacs-Lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
;; next-line-noextend.el --- do not let C-n add lines to a file
;; 
;; Author          : Mark D. Baushke
;; Created On      : Mon Mar  6 14:13:27 1989
;; Last Modified By: Mark D. Baushke
;; Last Modified On: Thu May 24 23:49:11 1990
;; Update Count    : 2
;; Status          : Works for me with GNU Emacs 18.55
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;
;; Ever feel like not adding lots of blank lines to the end of a file?
;;
(defun next-line-noextend (arg)
  "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 and the last line
does not end in a newline character,
a newline character is inserted to create a line
and the cursor moves to that line.
Otherwise, a warning message is generated.

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 (not (eq (preceding-char) ?\n))
	    (insert ?\n)
	  (if (= opoint (point))
	      (progn
		(beep)
		(message "End of buffer"))
	    (goto-char opoint)
	    (line-move arg))))
    (line-move arg))
  nil)
(substitute-key-definition 'next-line 'next-line-noextend global-map)
(substitute-key-definition 'next-line 'next-line-noextend esc-map)
(substitute-key-definition 'next-line 'next-line-noextend ctl-x-map)

(defun line-move (arg)
  (if (not (or (eq last-command 'next-line)
	       (eq last-command 'next-line-noextend)
	       (eq last-command 'previous-line)))
      (setq temporary-goal-column
	    (if (and track-eol (eolp))
		9999
	      (current-column))))
  (if (not (integerp selective-display))
      (forward-line arg)
    ;; Move by arg lines, but ignore invisible ones.
    (while (> arg 0)
      (vertical-motion 1)
      (forward-char -1)
      (forward-line 1)
      (setq arg (1- arg)))
    (while (< arg 0)
      (vertical-motion -1)
      (beginning-of-line)
      (setq arg (1+ arg))))
  (move-to-column (or goal-column temporary-goal-column))
  nil)
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