[comp.emacs] Several questions

rbj@ICST-CMR.ARPA (Root Boy Jim) (01/27/88)

(1) Will Version 19 be out soon?
(2) What is the state of the GNU project? I have heard about gcc, gawk,
    gdb+, gcc+, and several other utilitys floating around. Are there
    any plans to put them on the tape? What about the OS?
(3) About the MScreen{Width,Length} in config.h. Why so big? Can RMS
    tell me where I can get a 300x300 terminal? :-) I set them lower.
(4) I find the lack of hex integers to be a problem. I just wrote a
    hex.el to convert a.out's to s-records (remember those?) and had
    to code my own string-to-hex. Any plans to include hex?
(5) Is thereany way to stop evaluating a .el file? I had to enclose
    several defuns in a (if noninteractive) and of course {beg,end}-of-defun
    don't work right on them if I indent them correctly.
(6) Is the elisp manual ever coming out? Can I get what's already
    available by subscribing to the gnu-manual list (whatever it's
    called or wherever it's located)? Does it still exist?
(7) How about splitting off GDB and CPP from the EMACS distribution?
    I really don't need to FTP that stuff each time.

	(Root Boy) Jim Cottrell	<rbj@icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
Don't worry, nobody really LISTENS to lectures in MOSCOW, either!
 ..  FRENCH, HISTORY, ADVANCED CALCULUS, COMPUTER PROGRAMMING,
 BLACK STUDIES, SOCIOBIOLOGY!..  Are there any QUESTIONS??

karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (02/02/88)

rbj@ICST-CMR.ARPA writes:
   (3) About the MScreen{Width,Length} in config.h. Why so big? Can RMS
       tell me where I can get a 300x300 terminal? :-)

Well, I'm using this Sun workstation with a Great Big Screen, and
every now and then, I use a 6-point font and edit files with lines
that are several hundred characters long.  It's nice to have the real
lines all fit on one screen line.  Cut these limits down if you like,
but it's nice having them large by default.

   (7) How about splitting off GDB and CPP from the EMACS distribution?
       I really don't need to FTP that stuff each time.

It's my understanding (having spent some time working with it) that
the cpp was put in there for the sake of old, OLD C compilers (such as
one finds in SysV.0, which I was using on a VAX when at Bell Labs)
which don't cope with arbitrarily-long identifiers - that cpp is used
with the stuff in the "shortnames" directory to hack up the original
source to something which the compiler could understand.  Given that
there are probably not a whole lot of V.0 systems out there these
days, it might be worth getting rid of the cpp and shortnames
subdirectories.  But as soon as you do that, you'll get a lot of
complaints from the folks who were depending on it.

Also, the cpp in the GNU Emacs distribution is not as recent as that
distributed with GCC.  The cpp used in GCC caused problems in sbrk()
on my V.0 VAX, and I never had time to chase down the problem.  As a
result, Richard reverted to the previous, working cpp for distribution
with Emacs, while going forward with the newer cpp in GCC
distributions.
-=-
Karl

rich@oxtrap.UUCP (K. Richard Magill) (02/05/88)

In article <8801261730.AA26717@icst-cmr.arpa.ARPA> rbj@ICST-CMR.ARPA (Root Boy Jim) writes:
>(3) About the MScreen{Width,Length} in config.h. Why so big? Can RMS
>    tell me where I can get a 300x300 terminal? :-) I set them lower.

sun 3/50 running X11: "emacs -fn micro &" (emacs speaks X, ask for the
micro font).

>(6) Is the elisp manual ever coming out? Can I get what's already
>    available by subscribing to the gnu-manual list (whatever it's
>    called or wherever it's located)? Does it still exist?

It still exists but there isn't much traffic.  Seems everyone wants to
edit, no on wants to write. (myself included).

>(7) How about splitting off GDB and CPP from the EMACS distribution?
>    I really don't need to FTP that stuff each time.

How about lumping *everything* together so I don't ftp numerous
versions of common sub-functions, etc.  (getting close to time for a
gnu directory structure rather than a forest of package structures).

Actually, I agree.  gdb & cpp belong in the gcc dist or independant
dists.

xoxorich.
----------
Prolonged input from wiped tape can produce hypnagogic hallucination.

liberte@uiucdcsb.cs.uiuc.edu (02/07/88)

> /* Written  2:36 pm  Feb  4, 1988 by rich@oxtrap.UUCP in uiucdcsb:comp.emacs */
> In article <8801261730.AA26717@icst-cmr.arpa.ARPA> rbj@ICST-CMR.ARPA (Root Boy Jim) writes:
> 
> >(6) Is the elisp manual ever coming out? Can I get what's already
> >    available by subscribing to the gnu-manual list (whatever it's
> >    called or wherever it's located)? Does it still exist?
> 
> It still exists but there isn't much traffic.  Seems everyone wants to
> edit, no one wants to write. (myself included).

Actually, several people started to write last summer, but then Bil Lewis
came forward with a large amount of material on almost everything.   This
is currently being reworked by Tom Scott at FSF.  Then, I expect several
more months of review and revision by the gnu-manual list.  

If you are desparate for documentation, you can still grab the refman
package by anonymous ftp on a.cs.uiuc.edu in pub/gnuemacs/doc/refman*.
This primarily pulls out the doc strings and organizes them by chapters.

Dan LaLiberte
liberte@a.cs.uiuc.edu
uiucdcs!liberte

jkh@pcsbst.UUCP (Jordan K. Hubbard) (10/19/88)

A couple of questions...

1. Has anyone written a reasonably intelligent C beautifier in elisp?
I'm talking about something that has some knowledge of C expressions
and operators and tries to do things like multi-expression lines
into single lines (I.E.: 	i = 0; b = 10; c = 20;  becomes:
	i = 0;
	b = 10;
	c = 20;
)
and proper spacing of operators (I.E. A[0]=f*(g-1) becomes A[0] = f * (g - 1)

Basically, electric-c enables one to tab things out nicely, but not
to do anything about basic form. I'd like something that would do
both. Has anyone written anything like this?

Question two... Is there any way to have more than one TAGS file
searched? I.E. I have some code that spans several directories (though
libraries and such) and it would be *real handy* to be able to click
on a tag and have it be found even if it's in a library somewhere.
It seems like such an obvious need that I'd be surprised if there was
no way of addressing it. Again, any clues?

Thanks much.

				Jordan Hubbard
				uunet!unido!pcsbst!jkh

wolfgang@mgm.mit.edu (Wolfgang Rupprecht) (10/22/88)

In article <670@pcsbst.UUCP> pcsbst!jkh@pcsbst.UUCP (Jordan K. Hubbard) writes:
>Has anyone written a reasonably intelligent C beautifier in elisp?
>I'm talking about something that has some knowledge of C expressions
>and operators and tries to do things like multi-expression lines into
>single lines [...] and proper spacing of operators (I.E. A[0]=f*(g-1)
>becomes A[0] = f * (g - 1)

Here is a function "M-x cindent" that should do the trick.  Basically
it calls Unix indent(1) on the buffer's file.  (I can't remember if
indent is included in System V(anilla), but if not, you might check to
see if Berkeley has released it into Generally-Useful-Domain yet.  I
have heard mumblings that lots of good code is being sprung free.)

-wolfgang

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;									     ;;
;;	File:     unix.el						     ;;
;;	Author:   Wolfgang Rupprecht					     ;;
;;	Created:  Wed Jan 20 12:24:16 EST 1988				     ;;
;;	Contents: some useful unix interface routines for gnueamcs           ;;
;;									     ;;
;;	Copyright (c) 1988 Wolfgang Rupprecht.				     ;;
;;									     ;;
;;	$Log$								     ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Copyright (c) 1988 Wolfgang Rupprecht

;; GNU Emacs and this file unix.el, are distributed in the hope
;; that they will be useful, but WITHOUT ANY WARRANTY.  No author or
;; distributor accepts responsibility to anyone for the consequences of
;; using them or for whether they serve any particular purpose or work at
;; all, unless he says so in writing.  Refer to the GNU Emacs General
;; Public License for full details.

;; Everyone is granted permission to copy, modify and redistribute GNU
;; Emacs and unix.el, but only under the conditions described in the
;; GNU Emacs General Public License.  A copy of this license is supposed
;; to have been given to you along with GNU Emacs so you can know your
;; rights and responsibilities.  It should be in a file named COPYING.
;; Among other things, the copyright notice and this notice must be
;; preserved on all copies.

(autoload 'compile1 "compile")

(defun lint (buffer)
  "Run lint(1) on specified buffer and collect output in a buffer.
While lint runs asynchronously, you can use the \\[next-error] command
to find the text that lint gripes refer to."
  (interactive "bbuffer to lint ")
  (save-excursion
    (switch-to-buffer buffer t)
    (save-buffer buffer)
    (compile1 (concat lint-command " " buffer-file-name)
	      "No more lint gripes" "lint")))

(defvar lint-command "lint -abchx"
  "The command and command-line switches that are passed to the shell
when lint-ing a buffer via the lint-buffer command.")

(defun cindent (buffer)
  "Reformat the specified BUFFER using the Unix indent(1) program.
Selects the specified buffer, and saves it to disk, displays new version.
M-x revert-buffer and M-x undo work as expected. User may opt not to save
the newly indented buffer."
  (interactive "bbuffer to indent ")
  (switch-to-buffer buffer)
  (let ((auto-save-file-name (make-auto-save-file-name))
	(opoint (point))
	;; /bin/csh doesn't work for the following line due to '#' beeing a 
	;; comment-start char. 'indent /tmp/foo.c /tmp/#foo.c#'
	;; best just to use the /bin/sh as the shell.
	(shell-file-name "/bin/sh"))	; shell-command uses shell-file-name
    (save-buffer)
    (shell-command  (concat cindent-command
			    " " buffer-file-name
			    " " auto-save-file-name) nil)
    (if (file-exists-p auto-save-file-name)
	(progn
	  (erase-buffer)
	  (insert-file auto-save-file-name)
	  (goto-char (min opoint (point-max))))
      (error "indent failed to produce the output file"))))

(defvar cindent-command "indent -l80 -bl -bc -v"
  "The command and command-line switches that are passed to the shell when
indenting a buffer via cindent-buffer.")

(defun diff (buf &optional nocontext) 
"Take the diff(1) of a BUFFER and its oldest backup file. With prefix
arg, (or optional flag if noninteractive) does an normal non-context
diff. This option is required for \\[show-diff]."
  (interactive "bBuffer: \nP")
  (switch-to-buffer buf)
  (let*
      ((file-base-name (file-name-nondirectory buffer-file-name))
       (back-list
	 (file-name-all-completions file-base-name default-directory))
       (back-name (oldest-file back-list)))
    (if (string-equal back-name file-base-name)
	(message "No older backup of %s found." file-base-name)
      (compile1 (format "diff %s %s %s"
			(if nocontext "-r" "-c")
			back-name file-base-name)
		"Use show-diff to move to diffs"
		"diff"))))

(defun oldest-file (list)
  "Return the oldest file, from the LIST of files."
  (let ((oldest (car list)))
    (if list (setq list (cdr list)))
    (while list
      (if (file-newer-than-file-p oldest (car list))
	  (setq oldest (car list)))
      (setq list (cdr list)))
    oldest))

(defun grep (command)
  "Run grep, with user-specified args, and collect output in a buffer.
While grep runs asynchronously, you can use the \\[next-error] command
to find the text that grep hits refer to."
  (interactive (list (read-input "Run grep (with args): "
				 (concat (symbol-around-point) " "
					 (other-possibly-interesting-files)))))
  (compile1 (concat "grep -n " command " /dev/null")
	    "No more grep hits" "grep"))

(defun gid (command)
  "Run gid, with user-specified args, and collect output in a buffer.
While gid runs asynchronously, you can use the \\[next-error] command
to find the text that gid hits refer to.  Gid is Greg Mcgary's
pre-digested-grep program, like ctags, but for grep."
  (interactive (list (read-input "Run gid (with args): "
				 (symbol-around-point))))
  (compile1 (concat "gid " command)
	    "No more gid hits" "gid"))

(defun other-possibly-interesting-files ()
  "Return a sh-regexp for other files that may be of interest for
the purpose of grep-ing."
  (if (equal major-mode 'c-mode)
      "*.h *.c"				;for .h and .c files
    (concat "*" 
	    (if buffer-file-name
		(let ((basename (file-name-sans-versions
				 (file-name-nondirectory buffer-file-name))))
		  (if (string-match "[^.]\\(\\.[^.]+\\)$" basename)
		      (substring basename
				 (match-beginning 1) (match-end 1)))
		  )))))

(defun word-around-point ()
  "Return the word around the point as a string."
  (save-excursion
    (let (beg)
      (if (not (looking-at "\\<"))
	  (forward-word -1))
      (setq beg (point))
      (forward-word 1)
      (buffer-substring beg (point)))))

(defun symbol-around-point ()
  "Return the symbol around the point as a string."
  (save-excursion
    (if (not (looking-at "\\s_\\|\\sw")) ; if not in a symbol
	(re-search-backward "\\s_\\|\\sw" nil t)) ; go into prev. one
    (buffer-substring
      (progn (forward-sexp 1) (point))
      (progn (backward-sexp 1) (point)))))


Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
TEL: (617) 267-4365	UUCP:  mit-eddie!mgm.mit.edu!wolfgang