Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
daa37602
Commit
daa37602
authored
Jun 24, 1992
by
Jim Blandy
Browse files
*** empty log message ***
parent
a4275ad1
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
402 additions
and
345 deletions
+402
-345
lib-src/etags.c
lib-src/etags.c
+14
-6
lisp/emacs-lisp/autoload.el
lisp/emacs-lisp/autoload.el
+37
-7
lisp/emacs-lisp/edebug.el
lisp/emacs-lisp/edebug.el
+24
-8
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/lisp-mode.el
+12
-8
lisp/frame.el
lisp/frame.el
+4
-2
lisp/play/blackbox.el
lisp/play/blackbox.el
+3
-2
lisp/progmodes/compile.el
lisp/progmodes/compile.el
+16
-11
lisp/progmodes/etags.el
lisp/progmodes/etags.el
+22
-2
lisp/progmodes/inf-lisp.el
lisp/progmodes/inf-lisp.el
+130
-50
lisp/simple.el
lisp/simple.el
+8
-1
lisp/term/x-win.el
lisp/term/x-win.el
+13
-3
lisp/textmodes/text-mode.el
lisp/textmodes/text-mode.el
+2
-14
src/.gdbinit
src/.gdbinit
+7
-1
src/alloc.c
src/alloc.c
+1
-1
src/eval.c
src/eval.c
+28
-14
src/fns.c
src/fns.c
+15
-194
src/keyboard.c
src/keyboard.c
+7
-3
src/search.c
src/search.c
+39
-16
src/xdisp.c
src/xdisp.c
+12
-0
src/xfns.c
src/xfns.c
+8
-2
No files found.
lib-src/etags.c
View file @
daa37602
...
...
@@ -410,7 +410,7 @@ DEFINEST definedef;
* for self-documentation only.
*/
#define LEVEL_OK_FOR_FUNCDEF() \
(level==0 || c_ext && level==1 && structdef==sinbody)
(level==0 ||
(
c_ext && level==1 && structdef==sinbody)
)
/*
* next_token_is_func
...
...
@@ -1283,7 +1283,7 @@ put_entries (node)
fprintf
(
stdout
,
"%s %s %d
\n
"
,
node
->
name
,
node
->
file
,
(
node
->
lno
+
63
)
/
64
);
else
fprintf
(
stdout
,
"%-16s
%4
d %-16s %s
\n
"
,
fprintf
(
stdout
,
"%-16s
%3
d %-16s %s
\n
"
,
node
->
name
,
node
->
lno
,
node
->
file
,
node
->
pat
);
/* Output subentries that follow this one */
...
...
@@ -1468,7 +1468,8 @@ C_entries (c_ext)
{
if
(
c
==
'"'
)
inquote
=
FALSE
;
continue
;
else
if
(
c
==
'\\'
)
c
=
*
lp
++
;
}
else
if
(
inchar
)
{
...
...
@@ -1493,7 +1494,8 @@ C_entries (c_ext)
}
else
if
(
c_ext
&&
*
lp
==
'/'
)
{
c
=
0
;
/* C++ comment: skip rest of line */
c
=
0
;
break
;
}
continue
;
case
'#'
:
...
...
@@ -1886,7 +1888,10 @@ consider_token (c, lpp, tokp, is_func, c_ext, level)
/* Detect GNUmacs's function-defining macros. */
if
(
definedef
==
dnone
)
{
if
(
strneq
(
tokp
->
p
,
"DEF"
,
3
))
if
(
strneq
(
tokp
->
p
,
"DEF"
,
3
)
||
strneq
(
tokp
->
p
,
"ENTRY"
,
5
)
||
strneq
(
tokp
->
p
,
"SYSCALL"
,
7
)
||
strneq
(
tokp
->
p
,
"PSEUDO"
,
6
))
{
next_token_is_func
=
TRUE
;
goto
badone
;
...
...
@@ -2084,7 +2089,10 @@ getit ()
while
(
isspace
(
*
dbp
))
dbp
++
;
if
(
*
dbp
==
0
||
(
!
isalpha
(
*
dbp
))
&&
(
*
dbp
!=
'_'
)
&&
(
*
dbp
!=
'$'
))
if
(
*
dbp
==
0
||
(
!
isalpha
(
*
dbp
)
&&
*
dbp
!=
'_'
&&
*
dbp
!=
'$'
))
return
;
for
(
cp
=
dbp
+
1
;
*
cp
&&
(
isalpha
(
*
cp
)
||
isdigit
(
*
cp
)
||
(
*
cp
==
'_'
)
||
(
*
cp
==
'$'
));
cp
++
)
...
...
lisp/emacs-lisp/autoload.el
View file @
daa37602
...
...
@@ -59,14 +59,29 @@ the section of autoloads for a file.")
(
defconst
generate-autoload-section-trailer
"\n;;;***\n"
"String which indicates the end of the section of autoloads for a file."
)
;; Forms which have doc-strings which should be printed specially.
;; A doc-string-elt property of ELT says that (nth ELT FORM) is
;; the doc-string in FORM.
;; Note: defconst and defvar should NOT be marked in this way.
;; We don't want to produce defconsts and defvars that make-docfile can
;; grok, because then it would grok them twice, once in foo.el (where they
;; are given with ;;;###autoload) and once in loaddefs.el.
;;; Forms which have doc-strings which should be printed specially.
;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
;;; the doc-string in FORM.
;;;
;;; There used to be the following note here:
;;; ;;; Note: defconst and defvar should NOT be marked in this way.
;;; ;;; We don't want to produce defconsts and defvars that
;;; ;;; make-docfile can grok, because then it would grok them twice,
;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
;;; ;;; once in loaddefs.el.
;;;
;;; Counter-note: Yes, they should be marked in this way.
;;; make-docfile only processes those files that are loaded into the
;;; dumped Emacs, and those files should never have anything
;;; autoloaded here. The above-feared problem only occurs with files
;;; which have autoloaded entries *and* are processed by make-docfile;
;;; there should be no such files.
(
put
'autoload
'doc-string-elt
3
)
(
put
'defun
'doc-string-elt
3
)
(
put
'defvar
'doc-string-elt
3
)
(
put
'defconst
'doc-string-elt
3
)
(
put
'defmacro
'doc-string-elt
3
)
(
defun
generate-file-autoloads
(
file
)
"Insert at point a loaddefs autoload section for FILE.
...
...
@@ -86,6 +101,21 @@ are used."
(
floating-output-format
"%20e"
)
(
done-any
nil
)
output-end
)
;; If the autoload section we create here uses an absolute
;; pathname for FILE in its header, and then Emacs is installed
;; under a different path on another system,
;; `update-autoloads-here' won't be able to find the files to be
;; autoloaded. So, if FILE is in the same directory or a
;; subdirectory of the current buffer's file, we'll make it
;; relative to the current buffer's directory.
(
setq
file
(
expand-file-name
file
))
(
if
(
and
(
<
(
length
default-directory
)
(
length
file
))
(
string=
default-directory
(
substring
file
0
(
length
default-directory
))))
(
progn
(
setq
file
(
substring
file
(
length
default-directory
)))))
(
message
"Generating autoloads for %s..."
file
)
(
save-excursion
(
set-buffer
inbuf
)
...
...
lisp/emacs-lisp/edebug.el
View file @
daa37602
...
...
@@ -175,7 +175,6 @@
;; Put edebug.el in some directory in your load-path and byte-compile it.
;; Put the following forms in your .emacs file.
;; (setq edebug-global-prefix "...whatever you want") ; default is C-xX
;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun)
;; (autoload 'edebug-defun "edebug")
;; (autoload 'edebug-debug "edebug")
...
...
@@ -459,17 +458,32 @@ if an error occurs, point is left at the error."
))
;; The standard eval-current-buffer doesn't use eval-region.
(
if
(
not
(
fboundp
'edebug-emacs-eval-current-buffer
))
(
fset
'edebug-emacs-eval-current-buffer
(
symbol-function
'eval-current-buffer
)))
;; (fset 'eval-current-buffer (symbol-function 'edebug-emacs-eval-current-buffer))
(
defun
eval-current-buffer
(
&optional
edebug-e-c-b-output
)
(
defun
edebug-eval-current-buffer
(
&optional
edebug-e-c-b-output
)
"Call eval-region on the whole buffer."
(
interactive
)
(
eval-region
(
point-min
)
(
point-max
)
edebug-e-c-b-output
))
(
defun
edebug-eval-buffer
(
&optional
buffer
edebug-e-c-b-output
)
"Call eval-region on the whole buffer."
(
interactive
"bEval buffer: "
)
(
save-excursion
(
set-buffer
buffer
)
(
eval-region
(
point-min
)
(
point-max
)
edebug-e-c-b-output
)))
;; The standard eval-current-buffer doesn't use eval-region.
(
if
(
and
(
fboundp
'eval-current-buffer
)
(
not
(
fboundp
'edebug-emacs-eval-current-buffer
)))
(
progn
(
fset
'edebug-emacs-eval-current-buffer
(
symbol-function
'eval-current-buffer
))
(
fset
'eval-current-buffer
'edebug-eval-current-buffer
)))
(
if
(
and
(
fboundp
'eval-buffer
)
(
not
(
fboundp
'edebug-emacs-eval-buffer
)))
(
progn
(
fset
'edebug-emacs-eval-buffer
(
symbol-function
'eval-buffer
))
(
fset
'eval-buffer
'edebug-eval-buffer
)))
;;;======================================================================
...
...
@@ -498,6 +512,7 @@ if an error occurs, point is left at the error."
;;; for more details.
;;;###autoload
(
defun
edebug-defun
()
"Evaluate defun or defmacro, like eval-defun, but with edebug calls.
Print its name in the minibuffer and leave point after any error it finds,
...
...
@@ -2416,6 +2431,7 @@ Global commands prefixed by global-edbug-prefix:
;; Note that debug and its utilities must be byte-compiled to work, since
;; they depend on the backtrace looking a certain way.
;;;###autoload
(
defun
edebug-debug
(
&rest
debugger-args
)
"Replacement for debug.
If an error or quit occurred and we are running an edebugged function,
...
...
lisp/emacs-lisp/lisp-mode.el
View file @
daa37602
...
...
@@ -490,9 +490,11 @@ of the start of the containing expression."
If optional arg ENDPOS is given, indent each line, stopping when
ENDPOS is encountered."
(
interactive
)
(
let
((
indent-stack
(
list
nil
))
(
next-depth
0
)
last-depth
bol
outer-loop-done
inner-loop-done
state
this-indent
(
last-point
(
point
)))
(
let
((
indent-stack
(
list
nil
))
(
next-depth
0
)
(
starting-point
(
point
))
(
last-point
(
point
))
last-depth
bol
outer-loop-done
inner-loop-done
state
this-indent
)
;; Get error now if we don't have a complete sexp after point.
(
save-excursion
(
forward-sexp
1
))
(
save-excursion
...
...
@@ -529,10 +531,12 @@ ENDPOS is encountered."
(
setcar
(
nthcdr
5
state
)
nil
))
(
setq
inner-loop-done
t
)))
(
and
endpos
(
while
(
<=
next-depth
0
)
(
setq
indent-stack
(
append
indent-stack
(
list
nil
)))
(
setq
next-depth
(
1+
next-depth
))
(
setq
last-depth
(
1+
last-depth
))))
(
<=
next-depth
0
)
(
progn
(
setq
indent-stack
(
append
indent-stack
(
make-list
(
-
next-depth
)
nil
))
last-depth
(
-
last-depth
next-depth
)
next-depth
0
)))
(
or
outer-loop-done
(
setq
outer-loop-done
(
<=
next-depth
0
)))
(
if
outer-loop-done
...
...
@@ -557,7 +561,7 @@ ENDPOS is encountered."
(
setq
this-indent
(
car
indent-stack
))
(
let
((
val
(
calculate-lisp-indent
(
if
(
car
indent-stack
)
(
-
(
car
indent-stack
))
la
st-point
))))
st
arting
-point
))))
(
if
(
integerp
val
)
(
setcar
indent-stack
(
setq
this-indent
val
))
...
...
lisp/frame.el
View file @
daa37602
...
...
@@ -264,8 +264,10 @@ under the X Window System."
(
list
(
cons
'horizontal-scroll-bar
toggle
))))
;;;; Key bindings
(
define-prefix-command
'ctl-x-5-map
)
(
define-key
ctl-x-map
"5"
'ctl-x-5-map
)
(
defvar
ctl-x-5-map
(
make-sparse-keymap
)
"Keymap for screen commands."
)
(
fset
'ctl-x-5-prefix
ctl-x-5-map
)
(
define-key
ctl-x-map
"5"
'ctl-x-5-prefix
)
(
define-key
ctl-x-5-map
"2"
'new-screen
)
(
define-key
ctl-x-5-map
"0"
'delete-screen
)
...
...
lisp/play/blackbox.el
View file @
daa37602
;;; blackbox.el --- blackbox game in Emacs Lisp
;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1986, 1987
, 1992
Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version
1
, or (at your option)
;; the Free Software Foundation; either version
2
, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
...
...
@@ -114,6 +114,7 @@ The usual mnemonic keys move the cursor around the box.
(
setq
major-mode
'blackbox-mode
)
(
setq
mode-name
"Blackbox"
))
;;;###autoload
(
defun
blackbox
(
num
)
"Play blackbox. Optional prefix argument is the number of balls;
the default is 4.
...
...
lisp/progmodes/compile.el
View file @
daa37602
;;; compile.el --- run compiler as inferior of Emacs,
and
parse
its
error messages.
;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
;;;!!! dup removal is broken.
...
...
@@ -84,21 +84,24 @@ are found.")
(
"^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]"
1
2
)
;; 4.3BSD lint pass 2
;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
(
"[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]+[ \t]*\\([0-9]+\\)[:) \t]*$"
1
2
)
(
"[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]
*(
+[ \t]*\\([0-9]+\\)
)
[:) \t]*$"
1
2
)
;; 4.3BSD lint pass 3
;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
(
"[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+"
1
2
)
;; This used to be
;; ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
;; which is regexp Impressionism - it matches almost anything!
(
"([ \t]*\\([^:( \t\n]+\\)[ \t]*[:(][ \t]*\\([0-9]+\\))"
1
2
)
;; Line 45 of "foo.c": bloofel undefined (who does this?)
(
"^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"]+\\)\":"
2
1
)
(
"^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"
\n
]+\\)\":"
2
1
)
;; Apollo cc, 4.3BSD fc
;; "foo.f", line 3: Error: syntax error near end of statement
(
"^\"\\([^\"]+\\)\", line \\([0-9]+\\):"
1
2
)
(
"^\"\\([^\"
\n
]+\\)\", line \\([0-9]+\\):"
1
2
)
;; HP-UX 7.0 fc
;; foo.f :16 some horrible error message
(
"\\([^ \t:]+\\)[ \t]*:\\([0-9]+\\)"
1
2
)
(
"
^
\\([^ \t
\n
:]+\\)[ \t]*:\\([0-9]+\\)"
1
2
)
;; IBM AIX PS/2 C version 1.1
;; ****** Error number 140 in line 8 of file errors.c ******
(
"in line \\([0-9]+\\) of file \\([^ ]+[^. ]\\)\\.? "
2
1
)
(
"in line \\([0-9]+\\) of file \\([^
\n
]+[^.
\n
]\\)\\.? "
2
1
)
;; IBM AIX lint is too painful to do right this way. File name
;; prefixes entire sections rather than being on each line.
)
...
...
@@ -132,18 +135,18 @@ Typically \"grep -n\" or \"egrep -n\".
\(The \"-n\" option tells grep to output line numbers.)"
)
(
defconst
compilation-enter-directory-regexp
": Entering directory `\\
\
(.*\\
\
)'$"
": Entering directory `\\(.*\\)'$"
"Regular expression for a line in the compilation log that
changes the current directory. This must contain one \\
\
(,
\
\\) pair
changes the current directory. This must contain one \\(, \\) pair
around the directory name.
The default value matches lines printed by the `-w' option of GNU Make."
)
(
defconst
compilation-leave-directory-regexp
": Leaving directory `\\
\
(.*\\
\
)'$"
": Leaving directory `\\(.*\\)'$"
"Regular expression for a line in the compilation log that
changes the current directory to a previous value. This may
contain one \\
\
(,
\
\\) pair around the name of the directory
contain one \\(, \\) pair around the name of the directory
being moved from. If it does not, the last directory entered
\(by a line matching `compilation-enter-directory-regexp'\) is assumed.
...
...
@@ -343,6 +346,8 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
(
setq
omax
(
point-max
)
opoint
(
point
))
(
goto-char
omax
)
;; Record where we put the message, so we can ignore it
;; later on.
(
insert
?\n
mode-name
" "
msg
)
(
forward-char
-1
)
(
insert
" at "
(
substring
(
current-time-string
)
0
19
))
...
...
lisp/progmodes/etags.el
View file @
daa37602
;;; etags.el --- tags facility for Emacs.
;; Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1986, 1988
, 1992
Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version
1
, or (at your option)
;; the Free Software Foundation; either version
2
, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
...
...
@@ -244,6 +244,26 @@ See documentation of variable tags-file-name."
;;;###autoload
(
define-key
ctl-x-4-map
"."
'find-tag-other-window
)
;;;###autoload
(
defun
find-tag-other-frame
(
tagname
&optional
next
)
"Find tag (in current tag table) whose name contains TAGNAME.
Selects the buffer that the tag is contained in in another frame
and puts point at its definition.
If TAGNAME is a null string, the expression in the buffer
around or before point is used as the tag name.
If second arg NEXT is non-nil (interactively, with prefix arg),
searches for the next tag in the tag table
that matches the tagname used in the previous find-tag.
See documentation of variable tags-file-name."
(
interactive
(
if
current-prefix-arg
'
(
nil
t
)
(
find-tag-tag
"Find tag other window: "
)))
(
let
((
pop-up-screens
t
))
(
find-tag
tagname
next
t
)))
;;;###autoload
(
define-key
ctl-x-5-map
"."
'find-tag-other-frame
)
(
defvar
next-file-list
nil
"List of files for next-file to process."
)
...
...
lisp/progmodes/inf-lisp.el
View file @
daa37602
...
...
@@ -100,11 +100,8 @@
;;; c-m-x lisp-eval-defun This binding is a gnu convention.
;;; c-c c-e lisp-eval-defun Send the current defun to Lisp process.
;;; c-x c-e lisp-eval-last-sexp Send the previous sexp to Lisp process.
;;; c-c m-e lisp-eval-defun-and-go After sending the defun, switch-to-lisp.
;;; c-c c-r lisp-eval-region Send the current region to Lisp process.
;;; c-c m-r lisp-eval-region-and-go After sending the region, switch-to-lisp.
;;; c-c c-c lisp-compile-defun Compile the current defun in Lisp process.
;;; c-c m-c lisp-compile-defun-and-go After compiling defun, switch-to-lisp.
;;; c-c c-z switch-to-lisp Switch to the Lisp process buffer.
;;; c-c c-l lisp-load-file (See above. In a Lisp file buffer, default
;;; c-c c-k lisp-compile-file is to load/compile the current file.)
...
...
@@ -115,7 +112,6 @@
;;; cmulisp Fires up the Lisp process.
;;; lisp-compile-region Compile all forms in the current region.
;;; lisp-compile-region-and-go After compiling region, switch-to-lisp.
;;;
;;; CMU Lisp Mode Variables:
;;; cmulisp-filter-regexp Match this => don't get saved on input hist
...
...
@@ -154,11 +150,8 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
(
define-key
lisp-mode-map
"\M-\C-x"
'lisp-eval-defun
)
; Gnu convention
(
define-key
lisp-mode-map
"\C-x\C-e"
'lisp-eval-last-sexp
)
; Gnu convention
(
define-key
lisp-mode-map
"\C-c\C-e"
'lisp-eval-defun
)
(
define-key
lisp-mode-map
"\C-c\M-e"
'lisp-eval-defun-and-go
)
(
define-key
lisp-mode-map
"\C-c\C-r"
'lisp-eval-region
)
(
define-key
lisp-mode-map
"\C-c\M-r"
'lisp-eval-region-and-go
)
(
define-key
lisp-mode-map
"\C-c\C-c"
'lisp-compile-defun
)
(
define-key
lisp-mode-map
"\C-c\M-c"
'lisp-compile-defun-and-go
)
(
define-key
lisp-mode-map
"\C-c\C-z"
'switch-to-lisp
)
(
define-key
lisp-mode-map
"\C-c\C-l"
'lisp-load-file
)
(
define-key
lisp-mode-map
"\C-c\C-k"
'lisp-compile-file
)
; "kompile" file
...
...
@@ -168,6 +161,37 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
(
define-key
lisp-mode-map
"\C-c\C-v"
'lisp-show-variable-documentation
)
;;; This function exists for backwards compatibility.
;;; Previous versions of this package bound commands to C-c <letter>
;;; bindings, which is not allowed by the gnumacs standard.
(
defun
cmulisp-install-letter-bindings
()
"This function binds many cmulisp commands to C-c <letter> bindings,
where they are more accessible. C-c <letter> bindings are reserved for the
user, so these bindings are non-standard. If you want them, you should
have this function called by the cmulisp-load-hook:
(setq cmulisp-load-hook '(cmulisp-install-letter-bindings))
You can modify this function to install just the bindings you want."
(
define-key
lisp-mode-map
"\C-ce"
'lisp-eval-defun-and-go
)
(
define-key
lisp-mode-map
"\C-cr"
'lisp-eval-region-and-go
)
(
define-key
lisp-mode-map
"\C-cc"
'lisp-compile-defun-and-go
)
(
define-key
lisp-mode-map
"\C-cz"
'switch-to-lisp
)
(
define-key
lisp-mode-map
"\C-cl"
'lisp-load-file
)
(
define-key
lisp-mode-map
"\C-ck"
'lisp-compile-file
)
(
define-key
lisp-mode-map
"\C-ca"
'lisp-show-arglist
)
(
define-key
lisp-mode-map
"\C-cd"
'lisp-describe-sym
)
(
define-key
lisp-mode-map
"\C-cf"
'lisp-show-function-documentation
)
(
define-key
lisp-mode-map
"\C-cv"
'lisp-show-variable-documentation
)
(
define-key
cmulisp-mode-map
"\C-cl"
'lisp-load-file
)
(
define-key
cmulisp-mode-map
"\C-ck"
'lisp-compile-file
)
(
define-key
cmulisp-mode-map
"\C-ca"
'lisp-show-arglist
)
(
define-key
cmulisp-mode-map
"\C-cd"
'lisp-describe-sym
)
(
define-key
cmulisp-mode-map
"\C-cf"
'lisp-show-function-documentation
)
(
define-key
cmulisp-mode-map
"\C-cv"
'lisp-show-variable-documentation
))
(
defvar
inferior-lisp-program
"lisp"
"*Program name for invoking an inferior Lisp with `cmulisp'."
)
...
...
@@ -220,9 +244,9 @@ Lisp source.
lisp-eval-region sends the current region to the Lisp process.
lisp-compile-region compiles the current region.
lisp-eval-defun-and-go,
lisp-compile-defun
-and-go,
lisp-eval-region-and-go, and lisp-compile-region-and-go
switch to the Lisp process buffer after sending their
text.
Prefixing the
lisp-
eval/
compile-defun
/region commands with
a \\[universal-argument] causes a switch to the Lisp process buffer after sending
the
text.
Commands:
Return after the end of the process' output sends the text from the
...
...
@@ -262,54 +286,87 @@ to continue it."
"Don't save anything matching cmulisp-filter-regexp"
(
not
(
string-match
cmulisp-filter-regexp
str
)))
(
defun
cmulisp
()
(
defun
cmulisp
(
cmd
)
"Run an inferior Lisp process, input and output via buffer *cmulisp*.
If there is a process already running in *cmulisp*, just switch to that buffer.
Takes the program name from the variable inferior-lisp-program.
With argument, allows you to edit the command line (default is value
of inferior-lisp-program). Runs the hooks from cmulisp-mode-hook (after the
comint-mode-hook is run).
\(Type \\[describe-mode] in the process buffer for a list of commands.)"
(
interactive
)
(
cond
((
not
(
comint-check-proc
"*cmulisp*"
))
(
set-buffer
(
make-comint
"cmulisp"
inferior-lisp-program
))
(
interactive
(
list
(
if
current-prefix-arg
(
read-string
"Run lisp: "
inferior-lisp-program
)
inferior-lisp-program
)))
(
if
(
not
(
comint-check-proc
"*cmulisp*"
))
(
let
((
cmdlist
(
cmulisp-args-to-list
cmd
)))
(
set-buffer
(
apply
(
function
make-comint
)
"cmulisp"
(
car
cmdlist
)
nil
(
cdr
cmdlist
)))
(
cmulisp-mode
)))
(
setq
cmulisp-buffer
"*cmulisp*"
)
(
switch-to-buffer
"*cmulisp*"
))
(
defun
lisp-eval-region
(
start
end
)
"Send the current region to the inferior Lisp process."
(
interactive
"r"
)
;;; Break a string up into a list of arguments.
;;; This will break if you have an argument with whitespace, as in
;;; string = "-ab +c -x 'you lose'".
(
defun
cmulisp-args-to-list
(
string
)
(
let
((
where
(
string-match
"[ \t]"
string
)))
(
cond
((
null
where
)
(
list
string
))
((
not
(
=
where
0
))
(
cons
(
substring
string
0
where
)
(
tea-args-to-list
(
substring
string
(
+
1
where
)
(
length
string
)))))
(
t
(
let
((
pos
(
string-match
"[^ \t]"
string
)))
(
if
(
null
pos
)
nil
(
cmulsip-args-to-list
(
substring
string
pos
(
length
string
)))))))))
(
defun
lisp-eval-region
(
start
end
&optional
and-go
)
"Send the current region to the inferior Lisp process.
Prefix argument means switch-to-lisp afterwards."
(
interactive
"r\nP"
)
(
comint-send-region
(
cmulisp-proc
)
start
end
)
(
comint-send-string
(
cmulisp-proc
)
"\n"
))
(
comint-send-string
(
cmulisp-proc
)
"\n"
)
(
if
and-go
(
switch-to-lisp
t
)))
(
defun
lisp-eval-defun
()
"Send the current defun to the inferior Lisp process."
(
interactive
)
(
defun
lisp-eval-defun
(
&optional
and-go
)
"Send the current defun to the inferior Lisp process.
Prefix argument means switch-to-lisp afterwards."
(
interactive
"P"
)
(
save-excursion
(
end-of-defun
)
(
let
((
end
(
point
)))
(
beginning-of-defun
)
(
lisp-eval-region
(
point
)
end
))))
(
end-of-defun
)
(
skip-chars-backward
" \t\n\r\f"
)
; Makes allegro happy
(
let
((
end
(
point
)))
(
beginning-of-defun
)
(
lisp-eval-region
(
point
)
end
)))
(
if
and-go
(
switch-to-lisp
t
)))
(
defun
lisp-eval-last-sexp
()
"Send the previous sexp to the inferior Lisp process."
(
interactive
)
(
lisp-eval-region
(
save-excursion
(
backward-sexp
)
(
point
))
(
point
)))
(
defun
lisp-eval-last-sexp
(
&optional
and-go
)
"Send the previous sexp to the inferior Lisp process.
Prefix argument means switch-to-lisp afterwards."
(
interactive
"P"
)
(
lisp-eval-region
(
save-excursion
(
backward-sexp
)
(
point
))
(
point
)
and-go
))
;;; CommonLisp COMPILE sux.
(
defun
lisp-compile-region
(
start
end
)
"Compile the current region in the inferior Lisp process."
(
interactive
"r"
)
;;; Common Lisp COMPILE sux.
(
defun
lisp-compile-region
(
start
end
&optional
and-go
)
"Compile the current region in the inferior Lisp process.
Prefix argument means switch-to-lisp afterwards."
(
interactive
"r\nP"
)
(
comint-send-string
(
cmulisp-proc
)
(
format
"(funcall (compile nil `(lambda () (progn 'compile %s))))\n"
(
buffer-substring
start
end
))))
(
buffer-substring
start
end
)))
(
if
and-go
(
switch-to-lisp
t
)))
(
defun
lisp-compile-defun
()
"Compile the current defun in the inferior Lisp process."
(
interactive
)
(
defun
lisp-compile-defun
(
&optional
and-go
)
"Compile the current defun in the inferior Lisp process.
Prefix argument means switch-to-lisp afterwards."
(
interactive
"P"
)
(
save-excursion
(
end-of-defun
)
(
skip-chars-backward
" \t\n\r\f"
)
; Makes allegro happy
(
let
((
e
(
point
)))
(
beginning-of-defun
)
(
lisp-compile-region
(
point
)
e
))))
(
lisp-compile-region
(
point
)
e
)))
(
if
and-go
(
switch-to-lisp
t
)))
(
defun
switch-to-lisp
(
eob-p
)
"Switch to the inferior Lisp process buffer.
...
...
@@ -322,33 +379,35 @@ With argument, positions cursor at end of buffer."
(
push-mark
)
(
goto-char
(
point-max
)))))
;;; Now that lisp-compile/eval-defun/region takes an optional prefix arg,
;;; these commands are redundant. But they are kept around for the user
;;; to bind if he wishes, for backwards functionality, and because it's
;;; easier to type C-c e than C-u C-c C-e.
(
defun
lisp-eval-region-and-go
(
start
end
)
"Send the current region to the inferior Lisp,
and switch to the process buffer."
(
interactive
"r"
)
(
lisp-eval-region
start
end
)
(
switch-to-lisp
t
))
(
lisp-eval-region
start
end
t
))
(
defun
lisp-eval-defun-and-go
()
"Send the current defun to the inferior Lisp,
and switch to the process buffer."
(
interactive
)
(
lisp-eval-defun
)
(
switch-to-lisp
t
))
(
lisp-eval-defun
t
))
(
defun
lisp-compile-region-and-go
(
start
end
)
"Compile the current region in the inferior Lisp,
and switch to the process buffer."
(
interactive
"r"
)
(
lisp-compile-region
start
end
)
(
switch-to-lisp
t
))
(
lisp-compile-region
start
end
t
))
(
defun
lisp-compile-defun-and-go
()
"Compile the current defun in the inferior Lisp,
and switch to the process buffer."
(
interactive
)
(
lisp-compile-defun
)
(
switch-to-lisp
t
))
(
lisp-compile-defun
t
))
;;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
;(defun lisp-compile-sexp (start end)
...
...
@@ -406,7 +465,8 @@ Used by these commands to determine defaults.")
(
setq
lisp-prev-l/c-dir/file
(
cons
(
file-name-directory
file-name
)
(
file-name-nondirectory
file-name
)))
(
comint-send-string
(
cmulisp-proc
)
(
format
inferior-lisp-load-command
file-name
)))
(
format
inferior-lisp-load-command
file-name
))
(
switch-to-lisp
t
))
(
defun
lisp-compile-file
(
file-name
)
...
...
@@ -419,7 +479,8 @@ Used by these commands to determine defaults.")
(
file-name-nondirectory
file-name
)))