[comp.emacs] commands wanted

kautz@allegra.UUCP (Henry Kautz) (11/23/87)

Anybody written any of the following commands?  If so, please
mail/post, thanks.
1. move cursor to top of window
2. move cursor to bottom of window
3. scroll window so line cursor is on is at top of window
4. scroll window so line cursor is on is at bottom of window

---- Henry Kautz
:uucp:	allegra!kautz		
:arpa: or :csnet: kautz@allegra.att.com
:old style csnet: kautz%allegra@btl.csnet
:mail:  AT&T Bell Laboratories	
	Room 3C-402A
	600 Mountain Ave.	
	Murray Hill, N.J. 07974	
:office phone: (201) 582-2815	

barmar@think.COM (Barry Margolin) (11/24/87)

In article <8711240526.AA17515@EDDIE.MIT.EDU> kautz@allegra.UUCP (Henry Kautz) writes:
>Anybody written any of the following commands?

Yes, most EMACS implementors have.  They are part of the general EMACS
command set.  I'll describe them in terms of the GNU EMACS command
names (you didn't specify what EMACS dialect you are interested in, so
I'll assume GNU).

>1. move cursor to top of window

M-0 M-r (M-r is move-to-window-line, the numeric argument is the
0-relative line number).

>2. move cursor to bottom of window

M-minus M-r (a negative argument counts from the bottom).

>3. scroll window so line cursor is on is at top of window

M-0 C-l (a numeric argument to recenter means to move the cursor's
line to the specified window line).

>4. scroll window so line cursor is on is at bottom of window

M-minus C-l (again, a negative arg means from the bottom).

---
Barry Margolin
Thinking Machines Corp.

barmar@think.com
seismo!think!barmar

wohler@SPAM.ISTC.SRI.COM (Bill Wohler) (11/24/87)

     1. move cursor to top of window

  C-u 0 M-r

     2. move cursor to bottom of window

  C-u -1 M-r
  
  see also M-r (move-to-window-line).  i'm glad you asked this
  question since i didn't know how to do it before.  an apropos on
  "window" produced the answer.

     3. scroll window so line cursor is on is at top of window

  C-u 0 C-l
  
     4. scroll window so line cursor is on is at bottom of window

  C-u -1 C-l

  see the documentation for C-l (recenter).

						--bw

mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) (11/24/87)

> Anybody written any of the following commands?  If so, please
> mail/post, thanks.
> 1. move cursor to top of window
> 2. move cursor to bottom of window

Look in vip.el (GNU Emacs) to see how it implements vi's  "H" and "L"
commands.

Mike Khaw
-- 
internet:  mkhaw@teknowledge-vaxc.arpa
usenet:	   {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
USnail:	   Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303

pinkas@cadeos.intel.com (Israel Pinkas ~) (11/25/87)

In article <8711240526.AA17515@EDDIE.MIT.EDU> kautz@allegra.UUCP (Henry Kautz) writes:
>Anybody written any of the following commands?  If so, please
>mail/post, thanks.
>1. move cursor to top of window
>2. move cursor to bottom of window
>3. scroll window so line cursor is on is at top of window
>4. scroll window so line cursor is on is at bottom of window

I responded to the poster separately.  This is a general flame, and is not
directed specifically at Henry.

What version of Emacs?  Which Emacs?  Are you running Emacs at all?

I personally have 4 different Emacses that I have played around with, and
there are a few that I don't use.  I have GNU Emacs, Micro Emacs, Micro-GNU
Emacs, and Epsilon.  I have also used Mince (not a product anymore).  In
addition, I have seen Jove.

All of these are constantly refered to in this group.  If you have a
question about an Emacs (generic), you will get better answers if you state
(1) Which Emacs (GNU Emacs), (2) What version (18.49), and (3) your
machine/OS (Ultrix 2.0 on a GPX).  Other pertinent info would help.  (I
noticed that the 3 or 4 answers posted all assumed that Henry had GNU
Emacs.  Due to the fact that GNU has an apropos command that would have
answered it, I suspect that he has something else, like the recently posted
Micro Emacs.)

Sorry for the flame, but I see too many questions like this.

-Israel

----------------------------------------------------------------------
Disclaimer: The above are my personal opinions, and in no way represent
the opinions of Intel Corporation.  In no way should the above be taken
to be a statement of Intel.

UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!cadev4!pinkas
ARPA:	pinkas%cadev4.intel.com@relay.cs.net
CSNET:	pinkas%cadev4.intel.com

---------
"You can do more with a kind word and a gun than with just a kind word"

			-Al Capone

kyle@xanth.UUCP (11/25/87)

> Anybody written any of the following commands?  If so, please
> mail/post, thanks.

Written long ago for a Gosmacs emulation package...

> 1. move cursor to top of window

(defun beginning-of-window () (interactive) (goto-char (window-start)))

> 2. move cursor to bottom of window

(defun end-of-window () (interactive)
  (goto-char (window-start))
  (end-of-line (- (nth 3 (window-edges)) (nth 1 (window-edges)) 1)))

> 3. scroll window so line cursor is on is at top of window

Command exists already as (recenter), type ESC 0 C-l (ell not one).

> 4. scroll window so line cursor is on is at bottom of window

Command exists already againas (recenter), type ESC - 1 C-l.

kyle jones  <kyle@odu.edu>  old dominion university, norfolk, va  usa

ellis@ultra.dec.com (David Ellis) (11/25/87)

Henry Kautz (allegra!kautz) wants EMACS commands for:

1. move cursor to top of window
2. move cursor to bottom of window
3. scroll window so line cursor is on is at top of window
4. scroll window so line cursor is on is at bottom of window
 
For the first two, the function move-to-window-line does the job when given
a zero or negative argument, respectively.  Default binding is ESC-r.

For the last two, again a zero or negative argument does the job when applied
to the function named recenter, default binding CTRL-L.

----
David Ellis
Digital Equipment Corporation -- LTN2-2/C08 
305 Foster Street, Littleton MA 01460 -- (617)486-6784 
Usenet:  {ucbvax,allegra,decvax}!decwrl!ultra.dec.com!ellis
ARPA:    ellis%ultra.dec@decwrl.dec.com

pem@cadnetix.UUCP (Paul Meyer) (11/26/87)

[]
I hope this isn't one of a flurry of followups, but as my mail utilities are
currently unusable I can't mail this.  In any case, Henry Kautz writes

>Anybody written any of the following commands?  If so, please
>mail/post, thanks.
>1. move cursor to top of window
>2. move cursor to bottom of window
>3. scroll window so line cursor is on is at top of window
>4. scroll window so line cursor is on is at bottom of window

These requests are trivially easy, but I had to figure them out for
myself when we first got GNU emacs, so here they are:

; number 1

(fset 'top-of-window "\C-u0\er")	; move-to-window-line 0

; number 2

(fset 'bottom-of-window "\C-u-1\er")	; move-to-window-line -1

; number 3

(fset 'line-to-top-of-window "\C-u0\C-l") ; recenter 0

; number 4

(fset 'line-to-bottom-of-window "\C-u-1\C-l") ; recenter -1

These macros could also be replaced by real defuns, like
(defun top-of-window nil
  "Move the cursor to the top of the current window."
  (interactive)
  (move-to-window-line 0))

-- 
pem@cadnetix.UUCP  (hao!isis!ico!cadnetix!pem)

knutson@milano.UUCP (12/10/87)

What I would really like to have is a function called
set-default-file-mode or set-umask whichever you like to call it.
Currently, I have to keep seperate emacs processes running with
different umasks so that I can edit my personal, system, and shared files
differently.  It would seem that this would be a desirable feature in
an editor that tends to hang around rather than getting restarted on
each file you edit.

Jim Knutson
knutson@sw.mcc.com