[comp.emacs] Line numbers

jeff@uop.edu (Jeff Ferguson) (04/26/89)

	Hi kids,

	Is there any way to go to a specific line number?  When my
compiler tells me there is an error on line 33, I would like to know
where line 33 is.  I have looked everywhere but I cannot find what I
want.  Thank you for any help you can provide.

------------------------------------------------------------------------------
Jeff Ferguson                | jeff@uop.edu
Computer Science Department  | uop!jeff@ucdavis.edu
University of the Pacific    | cogent!uop!jeff@pacbell.com
Stockton, California, USA    |
95211                 /^^^\  | "Get me out of this cage!" -- Rael
(209) 944-7105       { o_o } |     .--------------------------.
                      \ o / ----> ( "KJEF does it with class!" )
---------------------mm---mm-------'--------------------------'---------------

dsill@RELAY.NSWC.NAVY.MIL (04/26/89)

>From: Jeff Ferguson <ucdavis!uop!jeff@ucbvax.berkeley.edu>
>
>	Hi kids,
>
>	Is there any way to go to a specific line number?  When my
>compiler tells me there is an error on line 33, I would like to know
>where line 33 is.  I have looked everywhere but I cannot find what I
>want.  Thank you for any help you can provide.

RULE #1: When asking how to do something in Emacs, be sure to
indentify *which* Emacs you're using.

In GNU Emacs, that would be `M-x goto-line <RET> [line_number] <RET>'.
But of course, you'd be using `M-x compile <RET>' to do the
compilation if you were using GNU Emacs so what you'd really want is
`next-error', which is normally bound to C-x `.

If you're not using GNU, I can't help you.

================================================================
"What I am is what I am."	-Edie Brickell
"I am what I am."		-Popeye

dpaulso@RELAY.NSWC.NAVY.MIL (04/26/89)

Jeff Ferguson <ucdavis!uop!jeff@ucbvax.berkeley.edu> writes:

>	Hi kids,
>
>	Is there any way to go to a specific line number?  When my
>compiler tells me there is an error on line 33, I would like to know
>where line 33 is.  I have looked everywhere but I cannot find what I
>want.  Thank you for any help you can provide.

the best thing to do is to run your compiles from inside emacs, using 
M-x compile.  documentation for this function follows:

  compile:
  Compile the program including the current buffer.  Default: run `make'.
  Runs COMMAND, a shell command, in a separate process asynchronously
  with output going to the buffer *compilation*.
  You can then use the command C-x ` to find the next error message
  and move to the source code that caused it.

This is especially nice if your emacs takes a while to fire up,
due to a hefty .emacs file

/dave

---
Dave Paulson	dpaulso@relay.nswc.navy.mil	(703)663-2137
"I've upped my standards; now up yours" -- Pat Paulsen

styborsk@hpspkla.HP.COM (Randy K. Styborski) (04/27/89)

Gnu Emacs provides the function 'goto-line', which is bound (in my case, at
least) to '\eg'.

sho@pur-phy (Sho Kuwamoto) (04/27/89)

In article <39135@bbn.COM> dpaulso@RELAY.NSWC.NAVY.MIL writes:
<Jeff Ferguson <ucdavis!uop!jeff@ucbvax.berkeley.edu> writes:
<<	Is there any way to go to a specific line number?  When my
<<compiler tells me there is an error on line 33, I would like to know
<<where line 33 is.  [...]
<
<the best thing to do is to run your compiles from inside emacs, using 
<M-x compile.  documentation for this function follows:
< [...]
<  You can then use the command C-x ` to find the next error message
<  and move to the source code that caused it.

This doesn't seem to work very well with TeX.  First, M-x compile
doesn't seem to run your compile in an interactive shell.  (could be
wrong about this one)  Second, it has trouble parsing the TeX error
messages.  I usually just run it in a shell window and use 
M-x < C-u # C-n.  Pretty gross, but it seems to work.

-Sho

maujt@warwick.ac.uk (Richard J Cox) (04/27/89)

In article <1824@uop.edu> jeff@uop.edu (Jeff Ferguson) writes:
>	Is there any way to go to a specific line number? 
This is esay.
	use M-x goto-line. 
This will prompt for a line. You can bind this to a key (I use C-xg).
If you are compilling use `comnpile' which will prompt you for the
compile command, (the default is `make -k' which can be added to) then
C-x` moves you to the next error (loading in the file if necessart and
put you on that line.

>Jeff Ferguson

- RC

/*--------------------------------------------------------------------------*/
JANET: maujt@uk.ac.warwick.cu BITNET: maujt%uk.ac.warwick.cu@nsfnet-relay.ac.uk
ARPA:  maujt@cu.warwick.ac.uk UUCP:   maujt%cu.warwick.ac.uk@ukc.uucp
Richard Cox, 84 St. Georges Rd, Coventry, CV1 2DL; UK PHONE: (0203) 520995

jr@bbn.com (John Robinson) (04/27/89)

In article <2201@pur-phy>, sho@pur-phy (Sho Kuwamoto) writes:
>In article <39135@bbn.COM> dpaulso@RELAY.NSWC.NAVY.MIL writes:
><the best thing to do is to run your compiles from inside emacs, using 
><M-x compile.  documentation for this function follows:
>< [...]
><  You can then use the command C-x ` to find the next error message
><  and move to the source code that caused it.
>
>This doesn't seem to work very well with TeX.  First, M-x compile
>doesn't seem to run your compile in an interactive shell.  (could be
>wrong about this one)  Second, it has trouble parsing the TeX error
>messages.  I usually just run it in a shell window and use 
>M-x < C-u # C-n.  Pretty gross, but it seems to work.
>
>-Sho

To integrate TeX with Emacs' compile/next-error mechanism:

(1) run TeX non-interactively:

\scrollmode or \batchmode near the top of the file;

(2) write the elisp code (non-trivial, I fear) to make next-error work
on TeX error output.

If you undertake #2, you might want to reorganize it to scan the
*shell* buffer instead, then you don't have to do #1, and can run TeX
interactively if you feel like it (or do part of it interactively).
--
/jr
jr@bbn.com or bbn!jr
C'mon big money!

rustcat@csli.Stanford.EDU (Vallury Prabhakar) (04/28/89)

In article <2201@pur-phy> sho@newton.physics.purdue.edu.UUCP (Sho Kuwamoto) 
writes:

 [Why the `compile' function doesn't appear to work with TeX]

Another option is to use the following environment variable,

setenv TEXEDIT "gnuemacs -l tex-start -e startline %d %s"

Having done this, typing 'e' at the TeX error message '?' will open up a
*new* emacs process and put you at the unpleasant line.  

It's not as useful as I would like it to be, since I'm not put back into
the TeX interactive session in exiting from emacs.  There must be a way
around that, but I have no idea how.  

Hope this helps.  Enjoy.

							-- Vallury

		

lynn@rave.UUCP (Lynn D. Newton) (04/28/89)

In article <1824@uop.edu> jeff@uop.edu (Jeff Ferguson) writes:
>
>	Hi kids,
>
>	Is there any way to go to a specific line number?  When my
>compiler tells me there is an error on line 33, I would like to know
>where line 33 is.  I have looked everywhere but I cannot find what I
>want.  Thank you for any help you can provide.
>
Use goto-line. You can bind it to a function key or C-c g or something.
It prompts you for the line number.

If you are using emacs to compile (I have compile bound to C-c C-c),
then errors are output in the *compilation* buffer. To find errors
listed in that buffer, execute next-error, usually bound to
C-x ` (backquote) which automatically takes you to the point
of the error, even when you use multiple files.

jr@bbn.com (John Robinson) (04/28/89)

In article <8716@csli.Stanford.ED
U>, rustcat@csli (Vallury Prabhakar) writes:
>Another option is to use the following environment variable,
>
>setenv TEXEDIT "gnuemacs -l tex-start -e startline %d %s"
>
>Having done this, typing 'e' at the TeX error message '?' will open up a
>*new* emacs process and put you at the unpleasant line.  
>
>It's not as useful as I would like it to be, since I'm not put back into
>the TeX interactive session in exiting from emacs.  There must be a way
>around that, but I have no idea how.  

I don't believe TeX is prepared to do this.  How is it supposed to
find its place in the file (plus any superior files that may be open)
assuming that you may go and modify them anywhere with the editor?

I think you may prefer to start an emacs server and send it a command
using emacsclient in your TEXEDIT envariable.  Assuming you are
running on a machine with job control or windows, that is.  Also,
isn't that syntax really for Gosling emacs?  In GNU, TeX-mode should
be entered automtically from auto-mode-alist (for any file *.tex), and
startline can be called goto-line (here we close the circle to the
beginning of this whole discussion ;-).  Better yet, however, is to
use emacs +%d switch.  Thus,

setenv TEXEDIT "gnuemacs %s +%d"

--
/jr
jr@bbn.com or bbn!jr
C'mon big money!

seung@husc8.HARVARD.EDU (Hyunjune Seung) (05/08/89)

I have been editing programs in GNU Emacs.  What I would like is
a mode that displays the line number for each line at the left of the
screen.  Could someone please help me?  I need this so that I can use
our symbolic debugger on an ASCII CRT.

thanks in advance.
Sebastian Seung

dsill@RELAY.NSWC.NAVY.MIL (05/08/89)

>From: Hyunjune Seung <husc8!seung@husc6.harvard.edu>
>I have been editing programs in GNU Emacs.  What I would like is
>a mode that displays the line number for each line at the left of the
>screen.

disp-ln-nos	  88-12-31
     Richard Mlynarik, <wheaties.ai.mit.edu!mly@eddie.mit.edu>
     Momentarily display line numbers.
line-numbers	  89-02-06
     Wayne Mesard, <Mesard@bbn.com>
     Two approaches to displaying line numbers.
show-lines	  88-12-26
     Nelson Beebe, <Beebe@science.utah.edu>
     Add and remove line numbers in a buffer.

-Dave (dsill@relay.nswc.navy.mil)

ram@imagen.com (m.v.s. ramanath) (04/23/91)

The recently posted minor mode for bilingual editing suggests a way to do
line numbers in emacs: split the window vertically into two with the left
window (or optionally the right) containing the line numbers. These then
would have to be kept in sync as the other window was scrolled.

Has this been done ? Any info is much appreciated. As a vi original sinner,
line numbers are the one feature of vi that I miss most in emacs.

Ram

===========================================================================
The opinions expressed above are mine alone and do not necessarily
represent those of QMS/Imagen