summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/=cl.el3
-rw-r--r--lisp/=diary-lib.el5
-rw-r--r--lisp/=gnus.el3
-rw-r--r--lisp/=gnusmail.el3
-rw-r--r--lisp/=gnusmisc.el3
-rw-r--r--lisp/=gnuspost.el3
-rw-r--r--lisp/=mhspool.el3
-rw-r--r--lisp/=mim-mode.el5
-rw-r--r--lisp/=nnspool.el3
-rw-r--r--lisp/=nntp.el5
-rw-r--r--lisp/=superyank.el4
-rw-r--r--lisp/=timer.el1
-rw-r--r--lisp/abbrevlist.el7
-rw-r--r--lisp/calendar/holidays.el5
-rw-r--r--lisp/case-table.el19
-rw-r--r--lisp/chistory.el5
-rw-r--r--lisp/cmuscheme.el3
-rw-r--r--lisp/comint.el995
-rw-r--r--lisp/compare-w.el5
-rw-r--r--lisp/dabbrev.el5
-rw-r--r--lisp/disp-table.el6
-rw-r--r--lisp/ehelp.el5
-rw-r--r--lisp/electric.el4
-rw-r--r--lisp/emacs-lisp/backquote.el5
-rw-r--r--lisp/emacs-lisp/float.el5
-rw-r--r--lisp/emacs-lisp/helper.el3
-rw-r--r--lisp/emacs-lisp/lisp-mode.el5
-rw-r--r--lisp/emulation/mlsupport.el5
-rw-r--r--lisp/env.el5
-rw-r--r--lisp/find-dired.el4
-rw-r--r--lisp/float-sup.el5
-rw-r--r--lisp/flow-ctrl.el4
-rw-r--r--lisp/frame.el6
-rw-r--r--lisp/info.el5
-rw-r--r--lisp/mail/mail-utils.el5
-rw-r--r--lisp/mail/mailabbrev.el2
-rw-r--r--lisp/mail/rfc822.el4
-rw-r--r--lisp/mail/rmail.el5
-rw-r--r--lisp/mail/rmailsort.el3
-rw-r--r--lisp/mail/rnews.el5
-rw-r--r--lisp/mail/sendmail.el5
-rw-r--r--lisp/mouse.el5
-rw-r--r--lisp/play/gomoku.el5
-rw-r--r--lisp/play/life.el5
-rw-r--r--lisp/play/yow.el4
-rw-r--r--lisp/progmodes/etags.el5
-rw-r--r--lisp/progmodes/fortran.el4
-rw-r--r--lisp/progmodes/inf-lisp.el5
-rw-r--r--lisp/progmodes/scheme.el3
-rw-r--r--lisp/sort.el5
-rw-r--r--lisp/sun-curs.el4
-rw-r--r--lisp/sun-fns.el2
-rw-r--r--lisp/tar-mode.el11
-rw-r--r--lisp/telnet.el5
-rw-r--r--lisp/term/bg-mouse.el4
-rw-r--r--lisp/term/sun-mouse.el5
-rw-r--r--lisp/terminal.el3
-rw-r--r--lisp/textmodes/bib-mode.el5
-rw-r--r--lisp/textmodes/bibtex.el7
-rw-r--r--lisp/textmodes/picture.el5
-rw-r--r--lisp/textmodes/refbib.el3
-rw-r--r--lisp/textmodes/tex-mode.el4
-rw-r--r--lisp/textmodes/texinfo.el4
-rw-r--r--lisp/textmodes/texnfo-upd.el5
-rw-r--r--lisp/view.el5
65 files changed, 924 insertions, 370 deletions
diff --git a/lisp/=cl.el b/lisp/=cl.el
index a4386f3c8bb..723238aec2f 100644
--- a/lisp/=cl.el
+++ b/lisp/=cl.el
@@ -43,7 +43,6 @@
;;;; Bug reports, suggestions and comments,
;;;; to quiroz@cs.rochester.edu
-(provide 'cl)
(defvar cl-version "2.0 beta 29 October 1989")
@@ -3135,3 +3134,5 @@ Common-Lisp codes."
form)
;;;; end of cl.el
+
+(provide 'cl)
diff --git a/lisp/=diary-lib.el b/lisp/=diary-lib.el
index 26aa7f5d478..b196707f09f 100644
--- a/lisp/=diary-lib.el
+++ b/lisp/=diary-lib.el
@@ -28,8 +28,6 @@
;; Urbana, Illinois 61801
(require 'calendar)
-(provide 'diary)
-
(defun diary (&optional arg)
"Generate the diary window for ARG days starting with the current date.
If no argument is provided, the number of days of diary entries is governed
@@ -2125,3 +2123,6 @@ to the date indicated by point. Prefix arg will make the entry nonmarking."
(or (calendar-cursor-to-date)
(error "Cursor is not on a date!"))))))
arg)))
+
+(provide 'diary)
+
diff --git a/lisp/=gnus.el b/lisp/=gnus.el
index d37072dd6a6..977b0444f08 100644
--- a/lisp/=gnus.el
+++ b/lisp/=gnus.el
@@ -48,7 +48,6 @@
;; (3) Multi-GNUS (Talking to many hosts same time).
;; (4) Asynchronous transmission of large messages.
-(provide 'gnus)
(require 'nntp)
(require 'mail-utils)
@@ -6079,3 +6078,5 @@ Range of OBJ is expressed as `((beg1 . end1) (beg2 . end2) ...)."
;;Local variables:
;;eval: (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
;;end:
+
+(provide 'gnus)
diff --git a/lisp/=gnusmail.el b/lisp/=gnusmail.el
index 9bfedc89173..ad09ee98197 100644
--- a/lisp/=gnusmail.el
+++ b/lisp/=gnusmail.el
@@ -19,7 +19,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'gnusmail)
(require 'gnus)
;; Provides mail reply and mail other window command using usual mail
@@ -146,3 +145,5 @@ The command \\[mh-yank-cur-msg] yanks the original message into current buffer."
(mh-send-other-window to cc subject)
(setq mh-sent-from-folder (current-buffer))
(setq mh-sent-from-msg 1)))
+
+(provide 'gnusmail)
diff --git a/lisp/=gnusmisc.el b/lisp/=gnusmisc.el
index d133b63a30c..17238369da0 100644
--- a/lisp/=gnusmisc.el
+++ b/lisp/=gnusmisc.el
@@ -20,7 +20,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'gnusmisc)
(require 'gnus)
;;;
@@ -212,3 +211,5 @@ inserting it before the newsgroup on the line containging point."
(forward-line -1)
(search-forward ":" nil t)
))
+
+(provide 'gnusmisc)
diff --git a/lisp/=gnuspost.el b/lisp/=gnuspost.el
index d40982d1def..9538aeaea91 100644
--- a/lisp/=gnuspost.el
+++ b/lisp/=gnuspost.el
@@ -20,7 +20,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'gnuspost)
(require 'gnus)
(defvar gnus-organization-file "/usr/lib/news/organization"
@@ -670,3 +669,5 @@ containing the organization."
)))
(t organization))
))
+
+(provide 'gnuspost)
diff --git a/lisp/=mhspool.el b/lisp/=mhspool.el
index 4801579ecf7..f9ad802ec56 100644
--- a/lisp/=mhspool.el
+++ b/lisp/=mhspool.el
@@ -20,7 +20,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'mhspool)
(require 'nntp)
;; This package enables you to read mail or articles in MH folders, or
@@ -402,3 +401,5 @@ If the stream is opened, return T, otherwise return NIL."
(setq idx (1+ idx)))
string
))
+
+(provide 'mhspool)
diff --git a/lisp/=mim-mode.el b/lisp/=mim-mode.el
index 43e0c0118b4..b7aae0a6d19 100644
--- a/lisp/=mim-mode.el
+++ b/lisp/=mim-mode.el
@@ -19,8 +19,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'mim-mode)
-
(autoload 'fast-syntax-check-mim "mim-syntax"
"Checks Mim syntax quickly.
Answers correct or incorrect, cannot point out the error context."
@@ -839,3 +837,6 @@ You need type only enough of the name to be unambiguous."
(defun next-char (direction)
"Returns preceding-char if DIRECTION < 0, otherwise following-char."
(if (>= direction 0) (following-char) (preceding-char)))
+
+(provide 'mim-mode)
+
diff --git a/lisp/=nnspool.el b/lisp/=nnspool.el
index 8c5a36ca6ba..0cfa097d2f5 100644
--- a/lisp/=nnspool.el
+++ b/lisp/=nnspool.el
@@ -20,7 +20,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'nnspool)
(require 'nntp)
(defvar nnspool-inews-program news-inews-program
@@ -372,3 +371,5 @@ If the stream is opened, return T, otherwise return NIL."
(setq idx (1+ idx)))
string
))
+
+(provide 'nnspool)
diff --git a/lisp/=nntp.el b/lisp/=nntp.el
index 6bb7a741076..dd33902be77 100644
--- a/lisp/=nntp.el
+++ b/lisp/=nntp.el
@@ -42,8 +42,6 @@
;; system, please send me the diffs. I'll include some of them in the
;; future releases.
-(provide 'nntp)
-
(defvar nntp-server-hook nil
"*Hooks for the NNTP server.
If the kanji code of the NNTP server is different from the local kanji
@@ -665,3 +663,6 @@ defining this function as macro."
(signal (car errorcode) (cdr errorcode))))
))
))
+
+(provide 'nntp)
+
diff --git a/lisp/=superyank.el b/lisp/=superyank.el
index 4d16e6b5e5b..6319f9078d6 100644
--- a/lisp/=superyank.el
+++ b/lisp/=superyank.el
@@ -88,8 +88,6 @@
;; require and provide features
;;
(require 'sendmail)
-(provide 'superyank)
-
;;
;; ======================================================================
;;
@@ -1210,3 +1208,5 @@ inserts that many newlines."
(forward-line 1)
(setq arg (- arg 1))))))
+(provide 'superyank)
+
diff --git a/lisp/=timer.el b/lisp/=timer.el
index 7f71f784de9..905706f3ab7 100644
--- a/lisp/=timer.el
+++ b/lisp/=timer.el
@@ -25,6 +25,7 @@
;; rescheduling or people who otherwise expect to use the process frequently
"If non-nil, don't exit the timer process when no more events are pending.")
+;;;###autoload
(defun run-at-time (time repeat function &rest args)
"Run a function at a time, and optionally on a regular interval.
Arguments are TIME, REPEAT, FUNCTION &rest ARGS.
diff --git a/lisp/abbrevlist.el b/lisp/abbrevlist.el
index 554bacd645f..a7942248dde 100644
--- a/lisp/abbrevlist.el
+++ b/lisp/abbrevlist.el
@@ -1,5 +1,5 @@
;; List one abbrev table alphabetically ordered.
-;; Copyright (C) 1986 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1992 Free Software Foundation, Inc.
;; Suggested by a previous version by Gildea.
;; This file is part of GNU Emacs.
@@ -19,8 +19,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'abbrevlist)
-
(defun list-one-abbrev-table (abbrev-table output-buffer)
"Display alphabetical listing of ABBREV-TABLE in buffer OUTPUT-BUFFER."
(with-output-to-temp-buffer output-buffer
@@ -43,3 +41,6 @@
(insert (symbol-value (car abbrev-list)))
(setq first-column (+ first-column 40))
(setq abbrev-list (cdr abbrev-list)))))))
+
+(provide 'abbrevlist)
+
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 88185436778..ccc99f55eb2 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -33,8 +33,6 @@
;; pages 899-928.
(require 'calendar)
-(provide 'holidays)
-
(defun holidays ()
"Display the holidays for last month, this month, and next month.
This function is suitable for execution in a .emacs file."
@@ -585,3 +583,6 @@ checked. If nil, the holiday (car (cdr (cdr X))), if there, is checked."
(setq visible (append (list (car p)) visible)))
(setq p (cdr p)))
visible))
+
+(provide 'holidays)
+
diff --git a/lisp/case-table.el b/lisp/case-table.el
index f10580fe575..2de955de2cd 100644
--- a/lisp/case-table.el
+++ b/lisp/case-table.el
@@ -46,7 +46,7 @@
(defun invert-case (count)
"Change the case of the character just after point and move over it.
-With arg, applies to that many chars.
+With prefix arg, applies to that many chars.
Negative arg inverts characters before point but does not move."
(interactive "p")
(if (< count 0)
@@ -63,9 +63,8 @@ Negative arg inverts characters before point but does not move."
(defun set-case-syntax-delims (l r table)
"Make characters L and R a matching pair of non-case-converting delimiters.
-Sets the entries for L and R in standard-case-table,
-standard-syntax-table, and text-mode-syntax-table to indicate
-left and right delimiters."
+Sets the entries for L and R in `standard-case-table', `standard-syntax-table',
+and `text-mode-syntax-table' to indicate left and right delimiters."
(aset (car table) l l)
(aset (car table) r r)
(modify-syntax-entry l (concat "(" (char-to-string r) " ")
@@ -79,10 +78,10 @@ left and right delimiters."
(defun set-case-syntax-pair (uc lc table)
"Make characters UC and LC a pair of inter-case-converting letters.
-Sets the entries for characters UC and LC in
-standard-case-table, standard-syntax-table, and
-text-mode-syntax-table to indicate an (uppercase, lowercase)
-pair of letters."
+Sets the entries for characters UC and LC in `standard-case-table',
+`standard-syntax-table' and `text-mode-syntax-table' to indicate an
+(uppercase, lowercase) pair of letters."
+
(aset (car table) uc lc)
(modify-syntax-entry lc "w " (standard-syntax-table))
(modify-syntax-entry lc "w " text-mode-syntax-table)
@@ -91,8 +90,8 @@ pair of letters."
(defun set-case-syntax (c syntax table)
"Make characters C case-invariant with syntax SYNTAX.
-Sets the entries for character C in standard-case-table,
-standard-syntax-table, and text-mode-syntax-table to indicate this.
+Sets the entries for character C in `standard-case-table',
+`standard-syntax-table' and `text-mode-syntax-table' to indicate this.
SYNTAX should be \" \", \"w\", \".\" or \"_\"."
(aset (car table) c c)
(modify-syntax-entry c syntax (standard-syntax-table))
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 3a8bcb6d7c9..2dd78a1f558 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -19,8 +19,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'chistory)
-
;; This really has nothing to do with list-command-history per se, but
;; its a nice alternative to C-x ESC (repeat-complex-command) and
;; functions as a lister if given no pattern. It's not important
@@ -165,3 +163,6 @@ The Command History listing is recomputed each time this mode is invoked."
(list-command-history)
(pop-to-buffer "*Command History*")
(run-hooks 'command-history-hook))
+
+(provide 'chistory)
+
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index a2f4d0e7d88..b817b42e662 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -84,7 +84,6 @@
;;; *or* just delete the autoload declaration from scheme.el altogether,
;;; which will allow the autoload in your .emacs to have its say.
-(provide 'cmuscheme)
(require 'scheme)
(require 'comint)
@@ -428,3 +427,5 @@ This is a good place to put keybindings.")
;;; 3/12/90 Olin
;;; - scheme-load-file and scheme-compile-file no longer switch-to-scheme.
;;; Tale suggested this.
+
+(provide 'cmuscheme)
diff --git a/lisp/comint.el b/lisp/comint.el
index 31e8b40e1e7..ab52362b064 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1,6 +1,5 @@
;;; -*-Emacs-Lisp-*- General command interpreter in a window stuff
-;;; Copyright (C) 1989 Free Software Foundation, Inc.
-;;; Original author: Olin Shivers <olin.shivers@cs.cmu.edu> Aug 1988
+;;; Copyright Olin Shivers (1988).
;;; This file is part of GNU Emacs.
@@ -18,6 +17,13 @@
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;;; The changelog is at the end of this file.
+
+;;; Please send me bug reports, bug fixes, and extensions, so that I can
+;;; merge them into the master source.
+;;; - Olin Shivers (shivers@cs.cmu.edu)
+
+;;; This hopefully generalises shell mode, lisp mode, tea mode, soar mode,...
;;; This file defines a general command-interpreter-in-a-buffer package
;;; (comint mode). The idea is that you can build specific process-in-a-buffer
;;; modes on top of comint mode -- e.g., lisp, shell, scheme, T, soar, ....
@@ -25,19 +31,55 @@
;;; and a common set of bindings, which makes them easier to use (and
;;; saves code, implementation time, etc., etc.).
+;;; Several packages are already defined using comint mode:
+;;; - cmushell.el defines a shell-in-a-buffer mode.
+;;; - cmulisp.el defines a simple lisp-in-a-buffer mode.
+;;; Cmushell and cmulisp mode are similar to, and intended to replace,
+;;; their counterparts in the standard gnu emacs release (in shell.el).
+;;; These replacements are more featureful, robust, and uniform than the
+;;; released versions. The key bindings in lisp mode are also more compatible
+;;; with the bindings of Hemlock and Zwei (the Lisp Machine emacs).
+;;;
+;;; - The file cmuscheme.el defines a scheme-in-a-buffer mode.
+;;; - The file tea.el tunes scheme and inferior-scheme modes for T.
+;;; - The file soar.el tunes lisp and inferior-lisp modes for Soar.
+;;; - cmutex.el defines tex and latex modes that invoke tex, latex, bibtex,
+;;; previewers, and printers from within emacs.
+;;; - background.el allows csh-like job control inside emacs.
+;;; It is pretty easy to make new derived modes for other processes.
+
;;; For documentation on the functionality provided by comint mode, and
;;; the hooks available for customising it, see the comments below.
;;; For further information on the standard derived modes (shell,
;;; inferior-lisp, inferior-scheme, ...), see the relevant source files.
-;;; For hints on converting existing process modes to use comint-mode
+;;; For hints on converting existing process modes (e.g., tex-mode,
+;;; background, dbx, gdb, kermit, prolog, telnet) to use comint-mode
;;; instead of shell-mode, see the notes at the end of this file.
-(require 'history)
-(provide 'comint)
-(defconst comint-version "2.01")
+(defconst comint-version "2.02")
+;;; Brief Command Documentation:
+;;;============================================================================
+;;; Comint Mode Commands: (common to all derived modes, like cmushell & cmulisp
+;;; mode)
+;;;
+;;; m-p comint-previous-input Cycle backwards in input history
+;;; m-n comint-next-input Cycle forwards
+;;; m-s comint-previous-similar-input Previous similar input
+;;; c-c c-r comint-previous-input-matching Search backwards in input history
+;;; return comint-send-input
+;;; c-a comint-bol Beginning of line; skip prompt.
+;;; c-d comint-delchar-or-maybe-eof Delete char unless at end of buff.
+;;; c-c c-u comint-kill-input ^u
+;;; c-c c-w backward-kill-word ^w
+;;; c-c c-c comint-interrupt-subjob ^c
+;;; c-c c-z comint-stop-subjob ^z
+;;; c-c c-\ comint-quit-subjob ^\
+;;; c-c c-o comint-kill-output Delete last batch of process output
+;;; c-c c-r comint-show-output Show last batch of process output
+;;;
;;; Not bound by default in comint-mode
;;; send-invisible Read a line w/o echo, and send to proc
;;; (These are bound in shell-mode)
@@ -45,33 +87,26 @@
;;; comint-dynamic-list-completions List completions in help buffer.
;;; comint-replace-by-expanded-filename Expand and complete filename at point;
;;; replace with expanded/completed name.
-(defvar comint-mode-map nil)
+;;; comint-kill-subjob No mercy.
+;;; comint-continue-subjob Send CONT signal to buffer's process
+;;; group. Useful if you accidentally
+;;; suspend your process (with C-c C-z).
+;;;
+;;; These used to be bound for RMS -- I prefer the input history stuff,
+;;; but you might like 'em.
+;;; m-P comint-msearch-input Search backwards for prompt
+;;; m-N comint-psearch-input Search forwards for prompt
+;;; C-cR comint-msearch-input-matching Search backwards for prompt & string
+
+;;; comint-mode-hook is the comint mode hook. Basically for your keybindings.
+;;; comint-load-hook is run after loading in this package.
-(if comint-mode-map
- nil
- (setq comint-mode-map (make-sparse-keymap))
- (define-key comint-mode-map "\C-a" 'comint-bol)
- (define-key comint-mode-map "\C-d" 'comint-delchar-or-maybe-eof)
- (define-key comint-mode-map "\C-m" 'comint-send-input)
- (define-key comint-mode-map "\M-p" 'comint-previous-input)
- (define-key comint-mode-map "\M-n" 'comint-next-input)
- (define-key comint-mode-map "\M-s" 'comint-previous-similar-input)
- (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob) ; tty ^C
- (define-key comint-mode-map "\C-c\C-f" 'comint-continue-subjob) ; shell "fg"
- (define-key comint-mode-map "\C-c\C-l" 'comint-show-output)
- (define-key comint-mode-map "\C-c\C-o" 'comint-flush-output) ; tty ^O
- (define-key comint-mode-map "\C-c\C-r" 'comint-history-search-backward)
- (define-key comint-mode-map "\C-c\C-s" 'comint-history-search-forward)
- (define-key comint-mode-map "\C-c\C-u" 'comint-kill-input) ; tty ^U
- (define-key comint-mode-map "\C-c\C-w" 'backward-kill-word) ; tty ^W
- (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob) ; tty ^Z
- (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob)) ; tty ^\
;;; Buffer Local Variables:
;;;============================================================================
;;; Comint mode buffer local variables:
;;; comint-prompt-regexp - string comint-bol uses to match prompt.
-;;; comint-last-input-end - marker For comint-flush-output command
+;;; comint-last-input-end - marker For comint-kill-output command
;;; input-ring-size - integer For the input history
;;; input-ring - ring mechanism
;;; input-ring-index - marker ...
@@ -82,57 +117,78 @@
;;; comint-input-send - function
;;; comint-eol-on-send - boolean
-(make-variable-buffer-local
- (defvar comint-prompt-regexp "^"
- "*Regexp to recognise prompts in the inferior process. Defaults to \"^\".
+(defvar comint-prompt-regexp "^"
+ "Regexp to recognise prompts in the inferior process.
+Defaults to \"^\", the null string at BOL.
Good choices:
- Canonical Lisp: \"^[^> \n]*>+:? *\" (Lucid, Franz, KCL, T, cscheme, oaklisp)
+ Canonical Lisp: \"^[^> ]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp)
Lucid Common Lisp: \"^\\(>\\|\\(->\\)+\\) *\"
- Franz: \"^\\(->\\|<[0-9]*>:\\) *\"
- KCL and T: \"^>+ *\"
- shell: \"^[^#$%>\n]*[#$%>] *\"
+ franz: \"^\\(->\\|<[0-9]*>:\\) *\"
+ kcl: \"^>+ *\"
+ shell: \"^[^#$%>]*[#$%>] *\"
+ T: \"^>+ *\"
-This is a good thing to set in mode hooks."))
+This is a good thing to set in mode hooks.")
-(make-variable-buffer-local
- (defvar input-ring-size 30 "Size of input history ring."))
+(defvar input-ring-size 30
+ "Size of input history ring.")
;;; Here are the per-interpreter hooks.
-(make-variable-buffer-local
- (defvar comint-get-old-input (function comint-get-old-input-default)
- "Function that submits old text in comint mode.
+(defvar comint-get-old-input (function comint-get-old-input-default)
+ "Function that submits old text in comint mode.
This function is called when return is typed while the point is in old text.
It returns the text to be submitted as process input. The default is
comint-get-old-input-default, which grabs the current line, and strips off
-leading text matching comint-prompt-regexp."))
+leading text matching comint-prompt-regexp")
-(make-variable-buffer-local
- (defvar comint-input-sentinel (function ignore)
- "Called on each input submitted to comint mode process by comint-send-input.
-Thus it can, for instance, track cd/pushd/popd commands issued to the csh."))
+(defvar comint-input-sentinel (function ignore)
+ "Called on each input submitted to comint mode process by comint-send-input.
+Thus it can, for instance, track cd/pushd/popd commands issued to the csh.")
-(make-variable-buffer-local
- (defvar comint-input-filter
- (function (lambda (str) (not (string-match "\\`\\s *\\'" str))))
- "Predicate for filtering additions to input history.
+(defvar comint-input-filter
+ (function (lambda (str) (not (string-match "\\`\\s *\\'" str))))
+ "Predicate for filtering additions to input history.
Only inputs answering true to this function are saved on the input
-history list. Default is to save anything that isn't all whitespace"))
+history list. Default is to save anything that isn't all whitespace")
+
+(defvar comint-input-sender (function comint-simple-send)
+ "Function to actually send to PROCESS the STRING submitted by user.
+Usually this is just 'comint-simple-send, but if your mode needs to
+massage the input string, this is your hook. This is called from
+the user command comint-send-input. comint-simple-send just sends
+the string plus a newline.")
+
+(defvar comint-eol-on-send 'T
+ "If non-nil, then jump to the end of the line before sending input to process.
+See comint-send-input")
(defvar comint-mode-hook '()
- "Called upon entry into comint-mode")
+ "Called upon entry into comint-mode
+This is run before the process is cranked up.")
+
+(defvar comint-exec-hook '()
+ "Called each time a process is exec'd by comint-exec.
+This is called after the process is cranked up. It is useful for things that
+must be done each time a process is executed in a comint-mode buffer (e.g.,
+(process-kill-without-query)). In contrast, the comint-mode-hook is only
+executed once when the buffer is created.")
+
+(defvar comint-mode-map nil)
(defun comint-mode ()
"Major mode for interacting with an inferior interpreter.
Interpreter name is same as buffer name, sans the asterisks.
Return at end of buffer sends line as input.
Return not at end copies rest of line to end and sends it.
+Setting mode variable comint-eol-on-send means jump to the end of the line
+before submitting new input.
This mode is typically customised to create inferior-lisp-mode,
-shell-mode, et cetera. This can be done by setting the hooks
-comint-input-sentinel, comint-input-filter, and comint-get-old-input
-to appropriate functions, and the variable comint-prompt-regexp
-to the appropriate regular expression.
+shell-mode, etc.. This can be done by setting the hooks
+comint-input-sentinel, comint-input-filter, comint-input-sender and
+comint-get-old-input to appropriate functions, and the variable
+comint-prompt-regexp to the appropriate regular expression.
An input history is maintained of size input-ring-size, and
can be accessed with the commands comint-next-input [\\[comint-next-input]] and
@@ -145,58 +201,121 @@ to continue it.
\\{comint-mode-map}
-Entry to this mode runs the hooks on comint-mode-hook."
+Entry to this mode runs the hooks on comint-mode-hook"
(interactive)
- (kill-all-local-variables)
- (setq major-mode 'comint-mode
- mode-name "Comint"
- mode-line-process '(": %s"))
- (use-local-map comint-mode-map)
- (set (make-local-variable 'input-ring) (make-ring input-ring-size))
- (put 'input-ring 'preserved t)
- (set (make-local-variable 'comint-last-input-match) "")
- (set (make-local-variable 'comint-last-similar--string) "")
- (set (make-local-variable 'input-ring-index) 0)
- (set (make-local-variable 'comint-last-input-end) (make-marker))
- (set-marker comint-last-input-end (point-max))
- (run-hooks 'comint-mode-hook))
-
-(defun comint-check-proc (buffer-name)
- "True if there is a running or stopped process associated with BUFFER."
- (let ((proc (get-buffer-process buffer-name)))
- (and proc (memq (process-status proc) '(run stop)))))
+ (let ((old-ring (and (assq 'input-ring (buffer-local-variables))
+ (boundp 'input-ring)
+ input-ring))
+ (old-ptyp comint-ptyp)) ; preserve across local var kill. gross.
+; (kill-all-local-variables) ; Removed 1/15/90 Olin
+ (setq major-mode 'comint-mode)
+ (setq mode-name "Comint")
+ (setq mode-line-process '(": %s"))
+ (use-local-map comint-mode-map)
+ (make-local-variable 'comint-last-input-end)
+ (setq comint-last-input-end (make-marker))
+ (make-local-variable 'comint-last-input-match)
+ (setq comint-last-input-match "")
+ (make-local-variable 'comint-prompt-regexp) ; Don't set; default
+ (make-local-variable 'input-ring-size) ; ...to global val.
+ (make-local-variable 'input-ring)
+ (make-local-variable 'input-ring-index)
+ (setq input-ring-index 0)
+ (make-local-variable 'comint-get-old-input)
+ (make-local-variable 'comint-input-sentinel)
+ (make-local-variable 'comint-input-filter)
+ (make-local-variable 'comint-input-sender)
+ (make-local-variable 'comint-eol-on-send)
+ (make-local-variable 'comint-ptyp)
+ (setq comint-ptyp old-ptyp)
+ (run-hooks 'comint-mode-hook)
+ ;Do this after the hook so the user can mung INPUT-RING-SIZE w/his hook.
+ ;The test is so we don't lose history if we run comint-mode twice in
+ ;a buffer.
+ (setq input-ring (if (ring-p old-ring) old-ring
+ (make-ring input-ring-size)))))
+
+;;; The old-ptyp stuff above is because we have to preserve the value of
+;;; comint-ptyp across calls to comint-mode, in spite of the
+;;; kill-all-local-variables that it does. Blech. Hopefully, this will all
+;;; go away when a later release fixes the signalling bug.
+;;; (Later: I removed the kill-all-local-variables, but have left this
+;;; other code in place just in case I reverse myself.)
-(defun comint-mark ()
- ;; Returns the process-mark of the current-buffer
- (process-mark (get-buffer-process (current-buffer))))
+(if comint-mode-map
+ nil
+ (setq comint-mode-map (make-sparse-keymap))
+ (define-key comint-mode-map "\ep" 'comint-previous-input)
+ (define-key comint-mode-map "\en" 'comint-next-input)
+ (define-key comint-mode-map "\es" 'comint-previous-similar-input)
+ (define-key comint-mode-map "\C-m" 'comint-send-input)
+ (define-key comint-mode-map "\C-d" 'comint-delchar-or-maybe-eof)
+ (define-key comint-mode-map "\C-a" 'comint-bol)
+ (define-key comint-mode-map "\C-c\C-u" 'comint-kill-input)
+ (define-key comint-mode-map "\C-c\C-w" 'backward-kill-word)
+ (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob)
+ (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob)
+ (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob)
+ (define-key comint-mode-map "\C-c\C-o" 'comint-kill-output)
+ (define-key comint-mode-map "\C-\M-r" 'comint-previous-input-matching)
+ (define-key comint-mode-map "\C-c\C-r" 'comint-show-output)
+ ;;; prompt-search commands commented out 3/90 -Olin
+; (define-key comint-mode-map "\eP" 'comint-msearch-input)
+; (define-key comint-mode-map "\eN" 'comint-psearch-input)
+; (define-key comint-mode-map "\C-cR" 'comint-msearch-input-matching)
+ )
+
+
+;;; This function is used to make a full copy of the comint mode map,
+;;; so that client modes won't interfere with each other. This function
+;;; isn't necessary in emacs 18.5x, but we keep it around for 18.4x versions.
+(defun full-copy-sparse-keymap (km)
+ "Recursively copy the sparse keymap KM"
+ (cond ((consp km)
+ (cons (full-copy-sparse-keymap (car km))
+ (full-copy-sparse-keymap (cdr km))))
+ (t km)))
+
+(defun comint-check-proc (buffer)
+ "True if there is a process associated w/buffer BUFFER, and
+it is alive (status RUN or STOP). BUFFER can be either a buffer or the
+name of one"
+ (let ((proc (get-buffer-process buffer)))
+ (and proc (memq (process-status proc) '(run stop)))))
;;; Note that this guy, unlike shell.el's make-shell, barfs if you pass it ()
;;; for the second argument (program).
(defun make-comint (name program &optional startfile &rest switches)
- (let* ((buffer (get-buffer-create (concat "*" name "*")))
- (proc (get-buffer-process buffer)))
+ (let ((buffer (get-buffer-create (concat "*" name "*"))))
;; If no process, or nuked process, crank up a new one and put buffer in
;; comint mode. Otherwise, leave buffer and existing process alone.
(cond ((not (comint-check-proc buffer))
- (save-excursion
+ (save-excursion
(set-buffer buffer)
(comint-mode)) ; Install local vars, mode, keymap, ...
(comint-exec buffer name program startfile switches)))
buffer))
+(defvar comint-ptyp t
+ "True if communications via pty; false if by pipe. Buffer local.
+This is to work around a bug in emacs process signalling.")
+
(defun comint-exec (buffer name command startfile switches)
"Fires up a process in buffer for comint modes.
-Blasts any old process running in the buffer. Doesn't set the buffer mode.
-You can use this to cheaply run a series of processes in the same buffer."
- (or command (error "No program for comint process"))
+Blasts any old process running in the buffer. Doesn't set the buffer mode.
+You can use this to cheaply run a series of processes in the same comint
+buffer. The hook comint-exec-hook is run after each exec."
(save-excursion
(set-buffer buffer)
(let ((proc (get-buffer-process buffer))) ; Blast any old process.
(if proc (delete-process proc)))
;; Crank up a new process
(let ((proc (comint-exec-1 name buffer command switches)))
+ (make-local-variable 'comint-ptyp)
+ (setq comint-ptyp process-connection-type) ; T if pty, NIL if pipe.
;; Jump to the end, and set the process mark.
- (set-marker (comint-mark) (goto-char (point-max)))
+ (goto-char (point-max))
+ (set-marker (process-mark proc) (point)))
;; Feed it the startfile.
(cond (startfile
;;This is guaranteed to wait long enough
@@ -209,7 +328,8 @@ You can use this to cheaply run a series of processes in the same buffer."
(insert-file-contents startfile)
(setq startfile (buffer-substring (point) (point-max)))
(delete-region (point) (point-max))
- (comint-send-string proc startfile))))
+ (comint-send-string proc startfile)))
+ (run-hooks 'comint-exec-hook)
buffer))
;;; This auxiliary function cranks up the process for comint-exec in
@@ -228,6 +348,7 @@ You can use this to cheaply run a series of processes in the same buffer."
"TERM=emacs"
"EMACS=t"))))
(apply 'start-process name buffer command switches))
+
(let ((tcapv (getenv "TERMCAP"))
(termv (getenv "TERM"))
(emv (getenv "EMACS")))
@@ -240,6 +361,8 @@ You can use this to cheaply run a series of processes in the same buffer."
(setenv "TERMCAP" tcapv)
(setenv "TERM" termv)
(setenv "EMACS" emv)))))
+
+
;; This is just (append new old-env) that compresses out shadowed entries.
;; It's also pretty ugly, mostly due to elisp's horrible iteration structures.
@@ -254,42 +377,166 @@ You can use this to cheaply run a series of processes in the same buffer."
(var (and (string-match "^[^=]*=" vv)
(substring vv 0 (match-end 0)))))
(setq old-env (cdr old-env))
- (cond ((not (and var (member var vars)))
+ (cond ((not (and var (comint-mem var vars)))
(if var (setq var (cons var vars)))
(setq ans (cons vv ans))))))
(nreverse ans)))
+
+;;; This should be in emacs, but it isn't.
+(defun comint-mem (item list &optional elt=)
+ "Test to see if ITEM is equal to an item in LIST.
+Option comparison function ELT= defaults to equal."
+ (let ((elt= (or elt= (function equal)))
+ (done nil))
+ (while (and list (not done))
+ (if (funcall elt= item (car list))
+ (setq done list)
+ (setq list (cdr list))))
+ done))
+
+;;; Ring Code
+;;;============================================================================
+;;; This code defines a ring data structure. A ring is a
+;;; (hd-index tl-index . vector)
+;;; list. You can insert to, remove from, and rotate a ring. When the ring
+;;; fills up, insertions cause the oldest elts to be quietly dropped.
+;;;
+;;; HEAD = index of the newest item on the ring.
+;;; TAIL = index of the oldest item on the ring.
+;;;
+;;; These functions are used by the input history mechanism, but they can
+;;; be used for other purposes as well.
+
+(defun ring-p (x)
+ "T if X is a ring; NIL otherwise."
+ (and (consp x) (integerp (car x))
+ (consp (cdr x)) (integerp (car (cdr x)))
+ (vectorp (cdr (cdr x)))))
+
+(defun make-ring (size)
+ "Make a ring that can contain SIZE elts"
+ (cons 1 (cons 0 (make-vector (+ size 1) nil))))
+
+(defun ring-plus1 (index veclen)
+ "INDEX+1, with wraparound"
+ (let ((new-index (+ index 1)))
+ (if (= new-index veclen) 0 new-index)))
+
+(defun ring-minus1 (index veclen)
+ "INDEX-1, with wraparound"
+ (- (if (= 0 index) veclen index) 1))
+
+(defun ring-length (ring)
+ "Number of elts in the ring."
+ (let ((hd (car ring)) (tl (car (cdr ring))) (siz (length (cdr (cdr ring)))))
+ (let ((len (if (<= hd tl) (+ 1 (- tl hd)) (+ 1 tl (- siz hd)))))
+ (if (= len siz) 0 len))))
+
+(defun ring-empty-p (ring)
+ (= 0 (ring-length ring)))
+
+(defun ring-insert (ring item)
+ "Insert a new item onto the ring. If the ring is full, dump the oldest
+item to make room."
+ (let* ((vec (cdr (cdr ring))) (len (length vec))
+ (new-hd (ring-minus1 (car ring) len)))
+ (setcar ring new-hd)
+ (aset vec new-hd item)
+ (if (ring-empty-p ring) ;overflow -- dump one off the tail.
+ (setcar (cdr ring) (ring-minus1 (car (cdr ring)) len)))))
+
+(defun ring-remove (ring)
+ "Remove the oldest item retained on the ring."
+ (if (ring-empty-p ring) (error "Ring empty")
+ (let ((tl (car (cdr ring))) (vec (cdr (cdr ring))))
+ (set-car (cdr ring) (ring-minus1 tl (length vec)))
+ (aref vec tl))))
+
+;;; This isn't actually used in this package. I just threw it in in case
+;;; someone else wanted it. If you want rotating-ring behavior on your history
+;;; retrieval (analagous to kill ring behavior), this function is what you
+;;; need. I should write the yank-input and yank-pop-input-or-kill to go with
+;;; this, and not bind it to a key by default, so it would be available to
+;;; people who want to bind it to a key. But who would want it? Blech.
+(defun ring-rotate (ring n)
+ (if (not (= n 0))
+ (if (ring-empty-p ring) ;Is this the right error check?
+ (error "ring empty")
+ (let ((hd (car ring)) (tl (car (cdr ring))) (vec (cdr (cdr ring))))
+ (let ((len (length vec)))
+ (while (> n 0)
+ (setq tl (ring-plus1 tl len))
+ (aset ring tl (aref ring hd))
+ (setq hd (ring-plus1 hd len))
+ (setq n (- n 1)))
+ (while (< n 0)
+ (setq hd (ring-minus1 hd len))
+ (aset vec hd (aref vec tl))
+ (setq tl (ring-minus1 tl len))
+ (setq n (- n 1))))
+ (set-car ring hd)
+ (set-car (cdr ring) tl)))))
+
+(defun comint-mod (n m)
+ "Returns N mod M. M is positive. Answer is guaranteed to be non-negative,
+and less than m."
+ (let ((n (% n m)))
+ (if (>= n 0) n
+ (+ n
+ (if (>= m 0) m (- m)))))) ; (abs m)
+
+(defun ring-ref (ring index)
+ (let ((numelts (ring-length ring)))
+ (if (= numelts 0) (error "indexed empty ring")
+ (let* ((hd (car ring)) (tl (car (cdr ring))) (vec (cdr (cdr ring)))
+ (index (comint-mod index numelts))
+ (vec-index (comint-mod (+ index hd)
+ (length vec))))
+ (aref vec vec-index)))))
+
+
;;; Input history retrieval commands
;;; M-p -- previous input M-n -- next input
-;;; C-c r -- previous input matching
+;;; M-C-r -- previous input matching
;;; ===========================================================================
(defun comint-previous-input (arg)
"Cycle backwards through input history."
(interactive "*p")
(let ((len (ring-length input-ring)))
- (if (<= len 0) (error "Empty input ring"))
- (if (< (point) (comint-mark))
- (delete-region (comint-mark) (goto-char (point-max))))
- (cond ((eq last-command 'comint-previous-input)
- (delete-region (mark) (point)))
- ((eq last-command 'comint-previous-similar-input)
- (delete-region (comint-mark) (point)))
- (t
- (setq input-ring-index
- (if (> arg 0) -1
- (if (< arg 0) 1 0)))
- (push-mark (point))))
- (setq input-ring-index (comint-mod (+ input-ring-index arg) len))
- (message "%d" (1+ input-ring-index))
- (insert (ring-ref input-ring input-ring-index))
- (setq this-command 'comint-previous-input)))
-
+ (cond ((<= len 0)
+ (message "Empty input ring")
+ (ding))
+ ((not (comint-after-pmark-p))
+ (message "Not after process mark")
+ (ding))
+ (t
+ (cond ((eq last-command 'comint-previous-input)
+ (delete-region (mark) (point)))
+ ((eq last-command 'comint-previous-similar-input)
+ (delete-region
+ (process-mark (get-buffer-process (current-buffer)))
+ (point)))
+ (t
+ (setq input-ring-index
+ (if (> arg 0) -1
+ (if (< arg 0) 1 0)))
+ (push-mark (point))))
+ (setq input-ring-index (comint-mod (+ input-ring-index arg) len))
+ (message "%d" (1+ input-ring-index))
+ (insert (ring-ref input-ring input-ring-index))
+ (setq this-command 'comint-previous-input)))))
+
(defun comint-next-input (arg)
"Cycle forwards through input history."
(interactive "*p")
(comint-previous-input (- arg)))
+(defvar comint-last-input-match ""
+ "Last string searched for by comint input history search, for defaulting.
+Buffer local variable.")
+
(defun comint-previous-input-matching (str)
"Searches backwards through input history for substring match."
(interactive (let* ((last-command last-command) ; preserve around r-f-m
@@ -310,24 +557,84 @@ You can use this to cheaply run a series of processes in the same buffer."
(comint-previous-input (- n input-ring-index)))
(t (if (eq last-command 'comint-previous-input)
(setq this-command 'comint-previous-input))
- (error "Not found")))))
+ (message "Not found.")
+ (ding)))))
+
+
+;;; These next three commands are alternatives to the input history commands
+;;; -- comint-next-input, comint-previous-input and
+;;; comint-previous-input-matching. They search through the process buffer
+;;; text looking for occurrences of the prompt. Bound to M-P, M-N, and C-c R
+;;; (uppercase P, N, and R) for now. Try'em out. Go with what you like...
+
+;;; comint-msearch-input-matching prompts for a string, not a regexp.
+;;; This could be considered to be the wrong thing. I decided to keep it
+;;; simple, and not make the user worry about regexps. This, of course,
+;;; limits functionality.
+
+;;; These commands were deemed non-winning and have been commented out.
+;;; Feel free to re-enable them if you like. -Olin 3/91
+
+;(defun comint-psearch-input ()
+; "Search forwards for next occurrence of prompt and skip to end of line.
+;\(prompt is anything matching regexp comint-prompt-regexp)"
+; (interactive)
+; (if (re-search-forward comint-prompt-regexp (point-max) t)
+; (end-of-line)
+; (error "No occurrence of prompt found")))
+;
+;(defun comint-msearch-input ()
+; "Search backwards for previous occurrence of prompt and skip to end of line.
+;Search starts from beginning of current line."
+; (interactive)
+; (let ((p (save-excursion
+; (beginning-of-line)
+; (cond ((re-search-backward comint-prompt-regexp (point-min) t)
+; (end-of-line)
+; (point))
+; (t nil)))))
+; (if p (goto-char p)
+; (error "No occurrence of prompt found"))))
+;
+;(defun comint-msearch-input-matching (str)
+; "Search backwards for occurrence of prompt followed by STRING.
+;STRING is prompted for, and is NOT a regular expression."
+; (interactive (let ((s (read-from-minibuffer
+; (format "Command (default %s): "
+; comint-last-input-match))))
+; (list (if (string= s "") comint-last-input-match s))))
+;; (interactive "sCommand: ")
+; (setq comint-last-input-match str) ; update default
+; (let* ((r (concat comint-prompt-regexp (regexp-quote str)))
+; (p (save-excursion
+; (beginning-of-line)
+; (cond ((re-search-backward r (point-min) t)
+; (end-of-line)
+; (point))
+; (t nil)))))
+; (if p (goto-char p)
+; (error "No match"))))
;;;
;;; Similar input -- contributed by ccm and highly winning.
;;;
;;; Reenter input, removing back to the last insert point if it exists.
;;;
+(defvar comint-last-similar-string ""
+ "The string last used in a similar string search.")
(defun comint-previous-similar-input (arg)
"Reenters the last input that matches the string typed so far. If repeated
successively older inputs are reentered. If arg is 1, it will go back
in the history, if -1 it will go forward."
(interactive "p")
- (if (< (point) (comint-mark))
+ (if (not (comint-after-pmark-p))
(error "Not after process mark"))
(if (not (eq last-command 'comint-previous-similar-input))
(setq input-ring-index -1
- comint-last-similar-string
- (buffer-substring (comint-mark) (point))))
+ comint-last-similar-string
+ (buffer-substring
+ (process-mark (get-buffer-process (current-buffer)))
+ (point))))
(let* ((size (length comint-last-similar-string))
(len (ring-length input-ring))
(n (+ input-ring-index arg))
@@ -340,101 +647,139 @@ in the history, if -1 it will go forward."
(cond ((< n len)
(setq input-ring-index n)
(if (eq last-command 'comint-previous-similar-input)
- (delete-region (comint-mark) (point)))
+ (delete-region (mark) (point)) ; repeat
+ (push-mark (point))) ; 1st time
(insert (substring entry size)))
- (t (error "Not found")))))
+ (t (message "Not found.") (ding) (sit-for 1)))
+ (message "%d" (1+ input-ring-index))))
+
-(defun comint-send-input (&optional terminator delete)
- "Send input to process, followed by a linefeed or optional TERMINATOR.
-After the process output mark, sends all text from the process mark to
-end of buffer as input to the process. Before the process output mark, calls
-value of variable comint-get-old-input to retrieve old input, replaces it in
-the input region (from the end of process output to the end of the buffer) and
-then sends it. In either case, the value of variable comint-input-sentinel is
-called on the input before sending it. The input is entered into the input
-history ring, if value of variable comint-input-filter returns non-nil when
-called on the input.
-
-If optional second argument DELETE is non-nil, then the input is deleted from
-the end of the buffer. This is useful if the process unconditionally echoes
-input. Processes which use TERMINATOR or DELETE should have a command wrapper
-which provides them bound to RET; see telnet.el for an example.
+(defun comint-send-input ()
+ "Send input to process. After the process output mark, sends all text
+from the process mark to point as input to the process. Before the process
+output mark, calls value of variable comint-get-old-input to retrieve old
+input, copies it to the process mark, and sends it. A terminal newline is
+also inserted into the buffer and sent to the process. In either case, value
+of variable comint-input-sentinel is called on the input before sending it.
+The input is entered into the input history ring, if the value of variable
+comint-input-filter returns non-nil when called on the input.
+
+If variable comint-eol-on-send is non-nil, then point is moved to the end of
+line before sending the input.
comint-get-old-input, comint-input-sentinel, and comint-input-filter are chosen
-according to the command interpreter running in the buffer. For example,
-
+according to the command interpreter running in the buffer. E.g.,
If the interpreter is the csh,
- comint-get-old-input defaults: takes the current line, discard any
- initial string matching regexp comint-prompt-regexp.
- comint-input-sentinel: monitors input for \"cd\", \"pushd\", and \"popd\"
- commands. When it sees one, it changes the default directory of the buffer.
- comint-input-filter defaults: returns t if the input isn't all whitespace.
+ comint-get-old-input is the default: take the current line, discard any
+ initial string matching regexp comint-prompt-regexp.
+ comint-input-sentinel monitors input for \"cd\", \"pushd\", and \"popd\"
+ commands. When it sees one, it cd's the buffer.
+ comint-input-filter is the default: returns T if the input isn't all white
+ space.
If the comint is Lucid Common Lisp,
- comint-get-old-input: snarfs the sexp ending at point.
- comint-input-sentinel: does nothing.
- comint-input-filter: returns nil if the input matches input-filter-regexp,
+ comint-get-old-input snarfs the sexp ending at point.
+ comint-input-sentinel does nothing.
+ comint-input-filter returns NIL if the input matches input-filter-regexp,
which matches (1) all whitespace (2) :a, :c, etc.
-Similar functions are used for other process modes."
+Similarly for Soar, Scheme, etc.."
(interactive)
;; Note that the input string does not include its terminal newline.
- (if (not (get-buffer-process (current-buffer)))
- (error "Current buffer has no process")
- (let* ((pmark (comint-mark))
- (input (if (>= (point) pmark)
- (buffer-substring pmark (goto-char (point-max)))
- (let ((copy (funcall comint-get-old-input)))
- (delete-region pmark (goto-char (point-max)))
- (insert copy)
- copy))))
- (set-marker comint-last-input-end (point))
- (setq input-ring-index 0)
- (if (funcall comint-input-filter input) (ring-insert input-ring input))
- (funcall comint-input-sentinel input)
- (comint-send-string nil (concat input (or terminator "\n")))
- (if delete (delete-region mark (point))
- (insert "\n"))
- (set-marker (comint-mark) (point)))))
+ (let ((proc (get-buffer-process (current-buffer))))
+ (if (not proc) (error "Current buffer has no process")
+ (let* ((pmark (process-mark proc))
+ (pmark-val (marker-position pmark))
+ (input (if (>= (point) pmark-val)
+ (progn (if comint-eol-on-send (end-of-line))
+ (buffer-substring pmark (point)))
+ (let ((copy (funcall comint-get-old-input)))
+ (goto-char pmark)
+ (insert copy)
+ copy))))
+ (insert ?\n)
+ (if (funcall comint-input-filter input) (ring-insert input-ring input))
+ (funcall comint-input-sentinel input)
+ (funcall comint-input-sender proc input)
+ (set-marker (process-mark proc) (point))
+ (set-marker comint-last-input-end (point))))))
(defun comint-get-old-input-default ()
- "Default for comint-get-old-input: use the current line sans prompt."
+ "Default for comint-get-old-input: take the current line, and discard
+any initial text matching comint-prompt-regexp."
(save-excursion
- (comint-bol)
- (buffer-substring (point) (progn (end-of-line) (point)))))
+ (beginning-of-line)
+ (comint-skip-prompt)
+ (let ((beg (point)))
+ (end-of-line)
+ (buffer-substring beg (point)))))
+
+(defun comint-skip-prompt ()
+ "Skip past the text matching regexp comint-prompt-regexp.
+If this takes us past the end of the current line, don't skip at all."
+ (let ((eol (save-excursion (end-of-line) (point))))
+ (if (and (looking-at comint-prompt-regexp)
+ (<= (match-end 0) eol))
+ (goto-char (match-end 0)))))
+
+
+(defun comint-after-pmark-p ()
+ "Is point after the process output marker?"
+ ;; Since output could come into the buffer after we looked at the point
+ ;; but before we looked at the process marker's value, we explicitly
+ ;; serialise. This is just because I don't know whether or not emacs
+ ;; services input during execution of lisp commands.
+ (let ((proc-pos (marker-position
+ (process-mark (get-buffer-process (current-buffer))))))
+ (<= proc-pos (point))))
+
+(defun comint-simple-send (proc string)
+ "Default function for sending to PROC input STRING.
+This just sends STRING plus a newline. To override this,
+set the hook COMINT-INPUT-SENDER."
+ (comint-send-string proc string)
+ (comint-send-string proc "\n"))
(defun comint-bol (arg)
"Goes to the beginning of line, then skips past the prompt, if any.
-With a prefix argument, (\\[universal-argument]), then doesn't skip prompt.
+If a prefix argument is given (\\[universal-argument]), then no prompt skip
+-- go straight to column 0.
-The prompt skip is done by passing over text matching the regular expression
-comint-prompt-regexp, a buffer local variable."
+The prompt skip is done by skipping text matching the regular expression
+comint-prompt-regexp, a buffer local variable.
+
+If you don't like this command, reset c-a to beginning-of-line
+in your hook, comint-mode-hook."
(interactive "P")
(beginning-of-line)
- (or arg (if (looking-at comint-prompt-regexp) (goto-char (match-end 0)))))
+ (if (null arg) (comint-skip-prompt)))
;;; These two functions are for entering text you don't want echoed or
;;; saved -- typically passwords to ftp, telnet, or somesuch.
-;;; Just enter M-x send-invisible and type in your line.
+;;; Just enter m-x send-invisible and type in your line.
+
(defun comint-read-noecho (prompt)
- "Prompting with PROMPT, read a single line of text without echoing.
-The text can still be recovered (temporarily) with \\[view-lossage]. This
+ "Prompt the user with argument PROMPT. Read a single line of text
+without echoing, and return it. Note that the keystrokes comprising
+the text can still be recovered (temporarily) with \\[view-lossage]. This
may be a security bug for some applications."
(let ((echo-keystrokes 0)
(answ "")
tem)
(if (and (stringp prompt) (not (string= (message prompt) "")))
(message prompt))
- (while (not (or (= (setq tem (read-char)) ?\^m)
+ (while (not(or (= (setq tem (read-char)) ?\^m)
(= tem ?\n)))
(setq answ (concat answ (char-to-string tem))))
(message "")
answ))
(defun send-invisible (str)
- "Read a string without echoing, and send it to the current buffer's process.
-A newline is also sent. String is not saved on comint input history list.
-Security bug: your string can still be temporarily recovered with \\[view-lossage]."
+ "Read a string without echoing, and send it to the process running
+in the current buffer. A new-line is additionally sent. String is not
+saved on comint input history list.
+Security bug: your string can still be temporarily recovered with
+\\[view-lossage]."
; (interactive (list (comint-read-noecho "Enter non-echoed text")))
(interactive "P") ; Defeat snooping via C-x esc
(let ((proc (get-buffer-process (current-buffer))))
@@ -475,79 +820,72 @@ your process from hanging on long inputs. See comint-send-string."
;;; Random input hackage
-(defun comint-flush-output ()
+(defun comint-kill-output ()
"Kill all output from interpreter since last input."
(interactive)
- (save-excursion
- (goto-char (comint-mark))
- (beginning-of-line)
- (delete-region (1+ comint-last-input-end) (point))
- (insert "*** output flushed ***\n")))
+ (let ((pmark (process-mark (get-buffer-process (current-buffer)))))
+ (kill-region comint-last-input-end pmark)
+ (goto-char pmark)
+ (insert "*** output flushed ***\n")
+ (set-marker pmark (point))))
(defun comint-show-output ()
- "Start display of the current window at line preceding start of last output.
-\"Last output\" is considered to start at the line following the last command
-entered to the process."
+ "Display start of this batch of interpreter output at top of window.
+Also put cursor there."
(interactive)
(goto-char comint-last-input-end)
+ (backward-char)
(beginning-of-line)
(set-window-start (selected-window) (point))
- (comint-bol))
+ (end-of-line))
(defun comint-interrupt-subjob ()
- "Sent an interrupt signal to the current subprocess.
-If the process-connection-type is via ptys, the signal is sent to the current
-process group of the pseudoterminal which Emacs is using to communicate with
-the subprocess. If the process is a job-control shell, this means the
-shell's current subjob. If the process connection is via pipes, the signal is
-sent to the immediate subprocess."
+ "Interrupt the current subjob."
(interactive)
- (interrupt-process nil t))
+ (interrupt-process nil comint-ptyp))
(defun comint-kill-subjob ()
- "Send a kill signal to the current subprocess.
-See comint-interrupt-subjob for a description of \"current subprocess\"."
+ "Send kill signal to the current subjob."
(interactive)
- (kill-process nil t))
+ (kill-process nil comint-ptyp))
(defun comint-quit-subjob ()
- "Send a quit signal to the current subprocess.
-See comint-interrupt-subjob for a description of \"current subprocess\"."
+ "Send quit signal to the current subjob."
(interactive)
- (quit-process nil t))
+ (quit-process nil comint-ptyp))
(defun comint-stop-subjob ()
- "Stop the current subprocess.
-See comint-interrupt-subjob for a description of \"current subprocess\".
-
+ "Stop the current subjob.
WARNING: if there is no current subjob, you can end up suspending
-the top-level process running in the buffer. If you accidentally do
-this, use \\[comint-continue-subjob] to resume the process. (This is not a
-problem with most shells, since they ignore this signal.)"
+the top-level process running in the buffer. If you accidentally do
+this, use \\[comint-continue-subjob] to resume the process. (This
+is not a problem with most shells, since they ignore this signal.)"
(interactive)
- (stop-process nil t))
+ (stop-process nil comint-ptyp))
(defun comint-continue-subjob ()
- "Send a continue signal to current subprocess.
-See comint-interrupt-subjob for a description of \"current subprocess\".
+ "Send CONT signal to process buffer's process group.
Useful if you accidentally suspend the top-level process."
(interactive)
- (continue-process nil t))
+ (continue-process nil comint-ptyp))
(defun comint-kill-input ()
- "Kill from current command through point."
+ "Kill all text from last stuff output by interpreter to point."
(interactive)
- (let ((pmark (comint-mark)))
- (if (> (point) pmark)
- (kill-region pmark (point))
- (error "Nothing to kill"))))
+ (let* ((pmark (process-mark (get-buffer-process (current-buffer))))
+ (p-pos (marker-position pmark)))
+ (if (> (point) p-pos)
+ (kill-region pmark (point)))))
(defun comint-delchar-or-maybe-eof (arg)
"Delete ARG characters forward, or send an EOF to process if at end of buffer."
(interactive "p")
(if (eobp)
(process-send-eof)
- (delete-char arg)))
+ (delete-char arg)))
+
+
+
;;; Support for source-file processing commands.
;;;============================================================================
@@ -582,7 +920,7 @@ Useful if you accidentally suspend the top-level process."
;;; (COMINT-SOURCE-DEFAULT previous-dir/file source-modes)
;;;============================================================================
;;; This function computes the defaults for the load-file and compile-file
-;;; commands for tea, soar, lisp, and scheme modes.
+;;; commands for tea, soar, cmulisp, and cmuscheme modes.
;;;
;;; - PREVIOUS-DIR/FILE is a pair (directory . filename) from the last
;;; source-file processing command. NIL if there hasn't been one yet.
@@ -619,9 +957,10 @@ Useful if you accidentally suspend the top-level process."
(t
(cons default-directory nil))))
+
;;; (COMINT-CHECK-SOURCE fname)
;;;============================================================================
-;;; Prior to loading or compiling (or otherwise processing) a file (in the
+;;; Prior to loading or compiling (or otherwise processing) a file (in the CMU
;;; process-in-a-buffer modes), this function can be called on the filename.
;;; If the file is loaded into a buffer, and the buffer is modified, the user
;;; is queried to see if he wants to save the buffer before proceeding with
@@ -639,6 +978,7 @@ Useful if you accidentally suspend the top-level process."
(save-buffer)
(set-buffer old-buffer)))))
+
;;; (COMINT-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p)
;;;============================================================================
;;; COMINT-GET-SOURCE is used to prompt for filenames in command-interpreter
@@ -679,7 +1019,9 @@ Useful if you accidentally suspend the top-level process."
(let* ((def (comint-source-default prev-dir/file source-modes))
(stringfile (comint-extract-string))
(sfile-p (and stringfile
- (file-exists-p stringfile)
+ (condition-case ()
+ (file-exists-p stringfile)
+ (error nil))
(not (file-directory-p stringfile))))
(defdir (if sfile-p (file-name-directory stringfile)
(car def)))
@@ -693,6 +1035,14 @@ Useful if you accidentally suspend the top-level process."
mustmatch-p)))
(list (expand-file-name (substitute-in-file-name ans)))))
+;;; I am somewhat divided on this string-default feature. It seems
+;;; to violate the principle-of-least-astonishment, in that it makes
+;;; the default harder to predict, so you actually have to look and see
+;;; what the default really is before choosing it. This can trip you up.
+;;; On the other hand, it can be useful, I guess. I would appreciate feedback
+;;; on this.
+;;; -Olin
+
;;; Simple process query facility.
;;; ===========================================================================
@@ -742,23 +1092,37 @@ Useful if you accidentally suspend the top-level process."
;;; replace with expanded/completed name.
;;; These are not installed in the comint-mode keymap. But they are
-;;; available for people who want them. Shell-mode-map uses them, though.
+;;; available for people who want them. Shell-mode installs them:
+;;; (define-key cmushell-mode-map "\M-\t" 'comint-dynamic-complete)
+;;; (define-key cmushell-mode-map "\M-?" 'comint-dynamic-list-completions)))
+;;;
+;;; Commands like this are fine things to put in load hooks if you
+;;; want them present in specific modes. Example:
+;;; (setq cmushell-load-hook
+;;; '((lambda () (define-key lisp-mode-map "\M-\t"
+;;; 'comint-replace-by-expanded-filename))))
+;;;
+
(defun comint-match-partial-pathname ()
- "Returns the string of an existing filename or causes an error."
- (if (save-excursion (backward-char 1) (looking-at "\\s ")) ""
- (save-excursion
- (re-search-backward "[^~/A-Za-z0-9---_.$#,]+")
- (re-search-forward "[~/A-Za-z0-9---_.$#,]+")
- (substitute-in-file-name
- (buffer-substring (match-beginning 0) (match-end 0))))))
+ "Returns the filename at point or causes an error."
+ (save-excursion
+ (if (re-search-backward "[^~/A-Za-z0-9---_.$#,=]" nil 'move)
+ (forward-char 1))
+ ;; Anchor the search forwards.
+ (if (not (looking-at "[~/A-Za-z0-9---_.$#,=]")) (error ""))
+ (re-search-forward "[~/A-Za-z0-9---_.$#,=]+")
+ (substitute-in-file-name
+ (buffer-substring (match-beginning 0) (match-end 0)))))
+
(defun comint-replace-by-expanded-filename ()
- "Replace the filename at point with its expanded, canonicalised completion.
+"Replace the filename at point with an expanded, canonicalised, and
+completed replacement.
\"Expanded\" means environment variables (e.g., $HOME) and ~'s are
replaced with the corresponding directories. \"Canonicalised\" means ..
-and . are removed, and the filename is made absolute instead of relative.
-See functions expand-file-name and substitute-in-file-name. See also
+and \. are removed, and the filename is made absolute instead of relative.
+See functions expand-file-name and substitute-in-file-name. See also
comint-dynamic-complete."
(interactive)
(let* ((pathname (comint-match-partial-pathname))
@@ -767,15 +1131,17 @@ comint-dynamic-complete."
(completion (file-name-completion pathnondir
(or pathdir default-directory))))
(cond ((null completion)
- (error "No completions"))
+ (message "No completions of %s." pathname)
+ (ding))
((eql completion t)
- (message "Sole completion"))
+ (message "Unique completion."))
(t ; this means a string was returned.
(delete-region (match-beginning 0) (match-end 0))
(insert (expand-file-name (concat pathdir completion)))))))
+
(defun comint-dynamic-complete ()
- "Complete the filename at point.
+ "Dynamically complete the filename at point.
This function is similar to comint-replace-by-expanded-filename, except
that it won't change parts of the filename already entered in the buffer;
it just adds completion characters to the end of the filename."
@@ -783,18 +1149,19 @@ it just adds completion characters to the end of the filename."
(let* ((pathname (comint-match-partial-pathname))
(pathdir (file-name-directory pathname))
(pathnondir (file-name-nondirectory pathname))
- (completion (file-name-completion pathnondir
+ (completion (file-name-completion pathnondir
(or pathdir default-directory))))
(cond ((null completion)
- (error "No completions"))
+ (message "No completions of %s." pathname)
+ (ding))
((eql completion t)
- (error "Sole completion"))
+ (message "Unique completion."))
(t ; this means a string was returned.
(goto-char (match-end 0))
(insert (substring completion (length pathnondir)))))))
(defun comint-dynamic-list-completions ()
- "List all possible completions of the filename at point."
+ "List in help buffer all possible completions of the filename at point."
(interactive)
(let* ((pathname (comint-match-partial-pathname))
(pathdir (file-name-directory pathname))
@@ -803,10 +1170,11 @@ it just adds completion characters to the end of the filename."
(file-name-all-completions pathnondir
(or pathdir default-directory))))
(cond ((null completions)
- (error "No completions"))
+ (message "No completions of %s." pathname)
+ (ding))
(t
(let ((conf (current-window-configuration)))
- (with-output-to-temp-buffer " *Completions*"
+ (with-output-to-temp-buffer "*Help*"
(display-completion-list completions))
(sit-for 0)
(message "Hit space to flush.")
@@ -815,22 +1183,32 @@ it just adds completion characters to the end of the filename."
(set-window-configuration conf)
(setq unread-command-char ch))))))))
+; Ergo bindings
+; (global-set-key "\M-\t" 'comint-replace-by-expanded-filename)
+; (global-set-key "\M-?" 'comint-dynamic-list-completions)
+; (define-key shell-mode-map "\M-\t" 'comint-dynamic-complete)
;;; Converting process modes to use comint mode
;;; ===========================================================================
+;;; Several gnu packages (tex-mode, background, dbx, gdb, kermit, prolog,
+;;; telnet are some) use the shell package as clients. Most of them would
+;;; be better off using the comint package, but they predate it.
+;;;
+;;; Altering these packages to use comint mode should greatly
+;;; improve their functionality, and is fairly easy.
+;;;
;;; Renaming variables
-;;; Most of the work is renaming variables and functions.
-;;; These are the common ones.
-
-;;; Local variables --
-;;; last-input-end comint-last-input-end
-;;; last-input-start <unnecessary>
-;;; shell-prompt-pattern comint-prompt-regexp
-;;; shell-set-directory-error-hook <no equivalent>
-;;; Miscellaneous --
+;;; Most of the work is renaming variables and functions. These are the common
+;;; ones:
+;;; Local variables:
+;;; last-input-end comint-last-input-end
+;;; last-input-start <unnecessary>
+;;; shell-prompt-pattern comint-prompt-regexp
+;;; shell-set-directory-error-hook <no equivalent>
+;;; Miscellaneous:
;;; shell-set-directory <unnecessary>
;;; shell-mode-map comint-mode-map
-;;; Commands --
+;;; Commands:
;;; shell-send-input comint-send-input
;;; shell-send-eof comint-delchar-or-maybe-eof
;;; kill-shell-input comint-kill-input
@@ -857,10 +1235,147 @@ it just adds completion characters to the end of the filename."
;;; (comint-prompt-regexp, comint-input-filter, comint-input-sentinel,
;;; comint-get-old-input) that need to be different from the defaults. Call
;;; foo-mode-hook, and you're done. Don't run the comint-mode hook yourself;
-;;; comint-mode will take care of it.
+;;; comint-mode will take care of it. The following example, from cmushell.el,
+;;; is typical:
+;;;
+;;; (defun shell-mode ()
+;;; (interactive)
+;;; (comint-mode)
+;;; (setq comint-prompt-regexp shell-prompt-pattern)
+;;; (setq major-mode 'shell-mode)
+;;; (setq mode-name "Shell")
+;;; (cond ((not shell-mode-map)
+;;; (setq shell-mode-map (full-copy-sparse-keymap comint-mode-map))
+;;; (define-key shell-mode-map "\M-\t" 'comint-dynamic-complete)
+;;; (define-key shell-mode-map "\M-?"
+;;; 'comint-dynamic-list-completions)))
+;;; (use-local-map shell-mode-map)
+;;; (make-local-variable 'shell-directory-stack)
+;;; (setq shell-directory-stack nil)
+;;; (setq comint-input-sentinel 'shell-directory-tracker)
+;;; (run-hooks 'shell-mode-hook))
+;;;
;;;
;;; Note that make-comint is different from make-shell in that it
;;; doesn't have a default program argument. If you give make-shell
;;; a program name of NIL, it cleverly chooses one of explicit-shell-name,
;;; $ESHELL, $SHELL, or /bin/sh. If you give make-comint a program argument
;;; of NIL, it barfs. Adjust your code accordingly...
+;;;
+
+;;; Do the user's customisation...
+
+(defvar comint-load-hook nil
+ "This hook is run when comint is loaded in.
+This is a good place to put keybindings.")
+
+(run-hooks 'comint-load-hook)
+
+;;; Change log:
+;;; 9/12/89
+;;; - Souped up the filename expansion procedures.
+;;; Doc strings are much clearer and more detailed.
+;;; Fixed a bug where doing a filename completion when the point
+;;; was in the middle of the filename instead of at the end would lose.
+;;;
+;;; 2/17/90
+;;; - Souped up the command history stuff so that text inserted
+;;; by comint-previous-input-matching is removed by following
+;;; command history recalls. comint-next/previous-input-matching
+;;; is now much more smoothly integrated w/the command history stuff.
+;;; - Added comint-eol-on-send flag and comint-input-sender hook.
+;;; Comint-input-sender based on code contributed by Jeff Peck
+;;; (peck@sun.com).
+;;;
+;;; 3/13/90 ccm@cmu.cs.edu
+;;; - Added comint-previous-similar-input for looking up similar inputs.
+;;; - Added comint-send-and-get-output to allow snarfing input from
+;;; buffer.
+;;; - Added the ability to pick up a source file by positioning over
+;;; a string in comint-get-source.
+;;; - Added add-hook to make it a little easier for the user to use
+;;; multiple hooks.
+;;;
+;;; 5/22/90 shivers
+;;; - Moved Chris' multiplexed ipc stuff to comint-ipc.el.
+;;; - Altered Chris' comint-get-source string feature. The string
+;;; is only offered as a default if it names an existing file.
+;;; - Changed comint-exec to directly crank up the process, instead
+;;; of calling the env program. This made background.el happy.
+;;; - Added new buffer-local var comint-ptyp. The problem is that
+;;; the signalling functions don't work as advertised. If you are
+;;; communicating via pipes, the CURRENT-GROUP arg is supposed to
+;;; be ignored, but, unfortunately it seems to be the case that you
+;;; must pass a NIL for this arg in the pipe case. COMINT-PTYP
+;;; is a flag that tells whether the process is communicating
+;;; via pipes or a pty. The comint signalling functions use it
+;;; to determine the necessary CURRENT-GROUP arg value. The bug
+;;; has been reported to the Gnu folks.
+;;; - comint-dynamic-complete flushes the help window if you hit space
+;;; after you execute it.
+;;; - Added functions comint-send-string, comint-send-region and var
+;;; comint-input-chunk-size. comint-send-string tries to prevent processes
+;;; from hanging when you send them long strings by breaking them into
+;;; chunks and allowing process output between chunks. I got the idea from
+;;; Eero Simoncelli's Common Lisp package. Note that using
+;;; comint-send-string means that the process buffer's contents can change
+;;; during a call! If you depend on process output only happening between
+;;; toplevel commands, this could be a problem. In such a case, use
+;;; process-send-string instead. If this is a problem for people, I'd like
+;;; to hear about it.
+;;; - Added comint-proc-query as a simple mechanism for commands that
+;;; want to query an inferior process and display its response. For a
+;;; typical use, see lisp-show-arglist in cmulisp.el.
+;;; - Added constant comint-version, which is now "2.01".
+;;;
+;;; 6/14/90 shivers
+;;; - Had comint-update-env defined twice. Removed extra copy. Also
+;;; renamed mem to be comint-mem, for modularity. The duplication
+;;; was reported by Michael Meissner.
+;;; 6/16/90 shivers
+;;; - Emacs has two different mechanisms for maintaining the process
+;;; environment, determined at compile time by the MAINTAIN-ENVIRONMENT
+;;; #define. One uses the process-environment global variable, and
+;;; one uses a getenv/setenv interface. comint-exec assumed the
+;;; process-environment interface; it has been generalised (with
+;;; comint-exec-1) to handle both cases. Pretty bogus. We could,
+;;; of course, skip all this and just use the etc/env program to
+;;; handle the environment tweaking, but that obscures process
+;;; queries that other modules (like background.el) depend on. etc/env
+;;; is also fairly bogus. This bug, and some of the fix code was
+;;; reported by Dan Pierson.
+;;;
+;;; 9/5/90 shivers
+;;; - Changed make-variable-buffer-local's to make-local-variable's.
+;;; This leaves non-comint-mode buffers alone. Stephane Payrard
+;;; reported the sloppy useage.
+;;; - You can now go from comint-previous-similar-input to
+;;; comint-previous-input with no problem.
+;;;
+;;; 12/21/90 shivers
+;;; - Added a condition-case to comint-get-source. Bogus strings
+;;; beginning with ~ were making the file-exists-p barf.
+;;; - Added "=" to the set of chars recognised by file completion
+;;; as constituting a filename.
+;;;
+;;; 1/90 shivers
+;;; These changes comprise release 2.02:
+;;; - Removed the kill-all-local-variables in comint-mode. This
+;;; made it impossible for client modes to set things before calling
+;;; comint-mode. (In particular, it messed up ilisp.el) In general,
+;;; the client mode should be responsible for a k-a-l-v's.
+;;; - Fixed comint-match-partial-pathname so that it works in
+;;; more cases: if the filename begins at the start-of-buffer;
+;;; if point is on the first char of the filename. Just a question
+;;; of getting the tricky bits right.
+;;; - Added a hook, comint-exec-hook that is run each time a process
+;;; is cranked up. Useful for things like process-kill-without-query.
+;;;
+;;; - Improved the doc string in comint-send-input a little bit.
+;;; - Tweaked make-comint to check process status with comint-check-proc
+;;; instead of equivalent inline code.
+;;; These two were pointed out by tale.
+;;; - Prompt-search history commands have been commented out. I never
+;;; liked them; I don't think anyone used them.
+
+(provide 'comint)
diff --git a/lisp/compare-w.el b/lisp/compare-w.el
index 0ae9f37673b..b3dbf0e47c3 100644
--- a/lisp/compare-w.el
+++ b/lisp/compare-w.el
@@ -17,8 +17,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'compare-w)
-
(defvar compare-windows-whitespace " \t\n"
"*String of characters considered whitespace for \\[compare-windows].
Changes in whitespace are optionally ignored.
@@ -127,3 +125,6 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored."
(set-window-point w2 p2)
(if (= (point) opoint1)
(ding))))
+
+(provide 'compare-w)
+
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 51e7d4954cb..e488e385b06 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -38,8 +38,6 @@
;; (interactive)
;; (&info "emacs" "dabbrevs") ; Select the specific info node.
;; )
-(provide 'dabbrevs)
-
(defvar dabbrevs-limit nil
"*Limits region searched by `dabbrevs-expand' to this many chars away.")
(make-variable-buffer-local 'dabbrevs-limit)
@@ -256,3 +254,6 @@ with the next possible expansion not yet tried."
(= (point) beg))
(setq result (downcase result))))))
result)))
+
+(provide 'dabbrevs)
+
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index c0fe4dfe8af..524bc80cd3f 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -31,7 +31,7 @@
(setq i (1+ i)))))
(defun describe-display-table (DT)
- "Describe the display-table DT in a help buffer."
+ "Describe the display table DT in a help buffer."
(with-output-to-temp-buffer "*Help*"
(princ "\nTruncation glyf: ")
(prin1 (aref dt 256))
@@ -56,7 +56,7 @@
(print-help-return-message)))
(defun describe-current-display-table ()
- "Describe the display-table in use in the selected window and buffer."
+ "Describe the display table in use in the selected window and buffer."
(interactive)
(describe-display-table
(or (window-display-table (selected-window))
@@ -67,7 +67,7 @@
(make-vector 261 nil))
(defun standard-display-8bit (l h)
- "Display characters in the range [L, H] literally."
+ "Display characters in the range L to H literally."
(while (<= l h)
(if (and (>= l ?\ ) (< l 127))
(if standard-display-table (aset standard-display-table l nil))
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index 9755bf07b7c..69f2fd4e8af 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -17,8 +17,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
(require 'electric)
-(provide 'ehelp)
-
(defvar electric-help-map ()
"Keymap defining commands available in `electric-help-mode'.")
@@ -305,3 +303,6 @@ will select it.)"
(fset 'ehelp-command map)))
;; Do (define-key global-map "\C-h" 'ehelp-command) if you want to win
+
+(provide 'ehelp)
+
diff --git a/lisp/electric.el b/lisp/electric.el
index be992c60f0d..eab8cd135ed 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -19,7 +19,7 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'electric) ; zaaaaaaap
+; zaaaaaaap
;; perhaps this should be in subr.el...
(defun shrink-window-if-larger-than-buffer (window)
@@ -179,3 +179,5 @@
(enlarge-window (- target-height (window-height win)))))
(goto-char (point-min))
win)))
+
+(provide 'electric) \ No newline at end of file
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index 82cd99a114a..0b5283ca819 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -57,8 +57,6 @@
;;; this or changing the syntax to ... ,(<form>). RMS: opinion?
-(provide 'backquote)
-
;;; a raft of general-purpose macros follows. See the nearest
;;; Commonlisp manual.
(defmacro bq-push (v l)
@@ -353,3 +351,6 @@ for making the list so far."
(defun bq-splicenil (form)
(setq state 'append
tailmaker (list form)))
+
+(provide 'backquote)
+
diff --git a/lisp/emacs-lisp/float.el b/lisp/emacs-lisp/float.el
index 68b88f41ecc..3c2921c506f 100644
--- a/lisp/emacs-lisp/float.el
+++ b/lisp/emacs-lisp/float.el
@@ -46,8 +46,6 @@
;; June 20, 1986
;;
-(provide 'float)
-
;; fundamental implementation constants
(defconst exp-base 2
"Base of exponent in this floating point representation.")
@@ -446,3 +444,6 @@ are recognized."
(funcall func exponent (aref powers-of-10 tens)))))
_f0)) ; if invalid, return 0
+
+(provide 'float)
+
diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el
index c718e94be30..0064bc66e07 100644
--- a/lisp/emacs-lisp/helper.el
+++ b/lisp/emacs-lisp/helper.el
@@ -21,7 +21,7 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'helper) ; hey, here's a helping hand.
+; hey, here's a helping hand.
;; Bind this to a string for <blank> in "... Other keys <blank>".
;; Helper-help uses this to construct help string when scrolling.
@@ -147,3 +147,4 @@
(ding)
(setq continue nil))))))
+(provide 'helper) \ No newline at end of file
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 0f9193a71c7..78310112c10 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -17,8 +17,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'lisp-mode)
-
(defvar lisp-mode-syntax-table nil "")
(defvar emacs-lisp-mode-syntax-table nil "")
(defvar lisp-mode-abbrev-table nil "")
@@ -613,3 +611,6 @@ means don't indent that line."
(progn
(forward-line 1) (point))
nil nil state))))))
+
+(provide 'lisp-mode)
+
diff --git a/lisp/emulation/mlsupport.el b/lisp/emulation/mlsupport.el
index 14e7a3c9557..521b64ce281 100644
--- a/lisp/emulation/mlsupport.el
+++ b/lisp/emulation/mlsupport.el
@@ -18,8 +18,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'mlsupport)
-
(defmacro ml-defun (&rest defs)
(list 'ml-defun-1 (list 'quote defs)))
@@ -403,3 +401,6 @@
(if (< from 0) (setq from (+ from length)))
(if (< to 0) (setq to (+ to length)))
(substring string from (+ from to))))
+
+(provide 'mlsupport)
+
diff --git a/lisp/env.el b/lisp/env.el
index 6adc9ec7c0c..3e494645610 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -17,8 +17,6 @@
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'setenv)
-
(defun setenv (variable value)
"Set the value of the environment variable named VARIABLE to VALUE.
VARIABLE and VALUE should both be strings.
@@ -35,3 +33,6 @@ This function works by modifying process-environment."
((null (setq scan (cdr scan)))
(setq process-environment
(cons (concat variable "=" value) process-environment))))))))
+
+(provide 'setenv)
+
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 472797b15dc..2afb4b435d4 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -46,8 +46,6 @@
;; in your ~/.emacs.
(require 'dired)
-(provide 'find-dired)
-
;;;###autoload
(defvar find-ls-option (if (eq system-type 'berkeley-unix) "-ls"
"-exec ls -ldi {} \\;")
@@ -200,3 +198,5 @@ Wildcards and redirection are handle as usual in the shell."
(start-process name buffer shell-file-name "-c"
(concat "exec " (mapconcat 'identity args " "))))))
+(provide 'find-dired)
+
diff --git a/lisp/float-sup.el b/lisp/float-sup.el
index d7b756238d3..f784ef2bf3c 100644
--- a/lisp/float-sup.el
+++ b/lisp/float-sup.el
@@ -27,8 +27,6 @@
(error "Floating point was disabled at compile time"))
;; provide an easy hook to tell if we are running with floats or not.
-(provide 'lisp-float-type)
-
;; define pi and e via math-lib calls. (much less prone to killer typos.)
(defconst pi (* 4 (atan 1)) "The value of Pi (3.1415926...)")
(defconst e (exp 1) "The value of e (2.7182818...)")
@@ -50,3 +48,6 @@
(defmacro radians-to-degrees (x)
"Convert ARG from radians to degrees."
(list '* (/ 180.0 pi) x))
+
+(provide 'lisp-float-type)
+
diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el
index 1e010e8133d..bcd2c152b4f 100644
--- a/lisp/flow-ctrl.el
+++ b/lisp/flow-ctrl.el
@@ -80,7 +80,7 @@ and C-q characters to OS."
(and (memstr= term losing-terminal-types) (evade-flow-control)))
)
-(provide 'flow-ctrl)
-
;;; flow-ctrl.el ends here
+(provide 'flow-ctrl)
+
diff --git a/lisp/frame.el b/lisp/frame.el
index 8a24cc81e51..930baab6ce1 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1,5 +1,5 @@
;;;; Multi-screen management that is independent of window systems.
-;;;; Copyright (C) 1990 Free Software Foundation, Inc.
+;;;; Copyright (C) 1990, 1992 Free Software Foundation, Inc.
;;; This file is part of GNU Emacs.
;;;
@@ -17,8 +17,6 @@
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'screen)
-
(defvar screen-creation-function nil
"Window-system dependent function to call to create a new screen.
The window system startup file should set this to its screen creation
@@ -270,3 +268,5 @@ under the X Window System."
(define-key ctl-x-3-map "2" 'new-screen)
(define-key ctl-x-3-map "0" 'delete-screen)
+
+(provide 'screen)
diff --git a/lisp/info.el b/lisp/info.el
index 020ec32395d..8ab04955db9 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -17,8 +17,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'info)
-
(defvar Info-history nil
"List of info nodes user has visited.
Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
@@ -994,3 +992,6 @@ Interactively, if the binding is execute-extended-command, a command is read."
(Info-goto-emacs-command-node command)))))
;;;###autoload
(define-key help-map "\C-k" 'Info-goto-emacs-key-command-node)
+
+(provide 'info)
+
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 4f97f1d3508..b25edf5cb5e 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -18,8 +18,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'mail-utils)
-
;;; We require lisp-mode to make sure that lisp-mode-syntax-table has
;;; been initialized.
(require 'lisp-mode)
@@ -199,3 +197,6 @@ If third arg ALL is non-nil, concatenate all such fields with commas between."
"\\|"
(substring labels (match-end 0))))))
labels)
+
+(provide 'mail-utils)
+
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index 5efa9eadd4b..d48d8e80767 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -427,6 +427,6 @@ mail-mode-syntax-table is used when the cursor is not in an address header.")
t))))
(setq mail-aliases nil)
(build-mail-aliases file))
-
+
(provide 'mail-abbrevs)
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index b7e43f62cda..ac63ce63687 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -18,8 +18,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'rfc822)
-
;; uses address-start free, throws to address
(defun rfc822-bad-address (reason)
(save-restriction
@@ -304,3 +302,5 @@
(nreverse list)))
(and buf (kill-buffer buf))))))
+(provide 'rfc822)
+
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 8c966ce9604..ace3498a13b 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -24,8 +24,6 @@
;; expunging by dispatch table, sticky options for file commands.
(require 'mail-utils)
-(provide 'rmail)
-
; These variables now declared paths.el
;(defvar rmail-spool-directory "/usr/spool/mail/"
; "This is the name of the directory used by the system mailer for\n\
@@ -1605,3 +1603,6 @@ buffer visiting that file."
"Break up a digest message into its constituent messages.
Leaves original message, deleted, before the undigestified messages."
t)
+
+(provide 'rmail)
+
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el
index e1f01ad2f8f..3bc00ddbf1b 100644
--- a/lisp/mail/rmailsort.el
+++ b/lisp/mail/rmailsort.el
@@ -19,7 +19,6 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
-(provide 'rmailsort)
(require 'rmail)
(require 'sort)
@@ -201,3 +200,5 @@ Arguments are MSG and FIELD."
(if (<= (length year-string) 2)
(concat "19" year-string)
year-string))
+
+(provide 'rmailsort)
diff --git a/lisp/mail/rnews.el b/lisp/mail/rnews.el
index 64b98ca407b..d96738af30f 100644
--- a/lisp/mail/rnews.el
+++ b/lisp/mail/rnews.el
@@ -42,8 +42,7 @@
;; tower@prep Oct 29 1986
;; added caesar-region, rename news-caesar-buffer-body, hacked accordingly
;; tower@prep Nov 21 1986
-;; added (provide 'rnews) tower@prep 22 Apr 87
-(provide 'rnews)
+;; added tower@prep 22 Apr 87
(require 'mail-utils)
(autoload 'rmail-output "rmailout"
@@ -977,3 +976,5 @@ Mail and USENET news headers are not rotated."
(goto-char (point-max))
(caesar-region rotnum)
(setq buffer-read-only buffer-status))))
+
+(provide 'rnews) (provide 'rnews)
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index c22d7d85c07..24824dfc0f9 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -18,8 +18,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'sendmail)
-
;;;###autoload
(defconst mail-self-blind nil "\
Non-nil means insert BCC to self in messages to be sent.
@@ -660,3 +658,6 @@ The seventh argument ACTIONS is a list of actions to take
;;; Do not add anything but external entries on this page.
+
+(provide 'sendmail)
+
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 2fa8cecf9e6..41940cb6221 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -17,8 +17,6 @@
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'mouse)
-
;;; Utility functions.
@@ -454,3 +452,6 @@ This does not delete the region; it acts like \\[kill-ring-save]."
(global-set-key [mouse-1] 'mouse-set-point)
(global-set-key [S-mouse-1] 'mouse-set-mark)
(global-set-key [mouse-3] 'mouse-delete-other-windows)
+
+(provide 'mouse)
+
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index c40c108895f..a3783e63c5e 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -23,9 +23,6 @@
;;; with precious advices from J.-F. Rit.
;;; This has been tested with GNU Emacs 18.50.
-(provide 'gomoku)
-
-
;; RULES:
;;
;; Gomoku is a game played between two players on a rectangular board. Each
@@ -1158,4 +1155,6 @@ If the game is finished, this command requests for another game."
(gomoku-move-down)
(gomoku-move-left))
+(provide 'gomoku)
+
diff --git a/lisp/play/life.el b/lisp/play/life.el
index 059bf350fd4..0aceb065609 100644
--- a/lisp/play/life.el
+++ b/lisp/play/life.el
@@ -18,8 +18,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'life)
-
(defconst life-patterns
[("@@@" " @@" "@@@")
("@@@ @@@" "@@ @@ " "@@@ @@@")
@@ -272,3 +270,6 @@ generations (this defaults to 1)."
(put 'life-extinct 'error-conditions '(life-extinct quit))
(put 'life-extinct 'error-message "All life has perished")
+
+(provide 'life)
+
diff --git a/lisp/play/yow.el b/lisp/play/yow.el
index a4d33d3609f..0f1c51b23fe 100644
--- a/lisp/play/yow.el
+++ b/lisp/play/yow.el
@@ -16,8 +16,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'yow)
-
; Randomize the seed in the random number generator.
(random t)
@@ -86,3 +84,5 @@
(doctor-ret-or-read 1)
(doctor-ret-or-read 1)))
+(provide 'yow)
+
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 92e0173a2a5..3b74be87cc6 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -18,8 +18,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'etags)
-
;;;###autoload
(defvar tags-file-name nil "\
*File name of tag table.
@@ -354,3 +352,6 @@ unless it has one in the tag table."
(forward-line 1)))))
;; etags.el ends here
+
+(provide 'etags)
+
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 33a2da4b182..6ed3645ec9e 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -89,8 +89,6 @@
;;; Bugs to bug-fortran-mode@erl.mit.edu
-(provide 'fortran)
-
;;;###autoload
(defvar fortran-tab-mode-default nil
"*Default tabbing/carriage control style for empty files in fortran mode.
@@ -995,3 +993,5 @@ character format style."
'(fortran-tab-mode-string fortran-tab-mode-string)
minor-mode-alist)))
+(provide 'fortran)
+
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 7f78c28d970..f3e3ce606d1 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -48,8 +48,6 @@
;;; text to the process? Switch selectable?
(require 'comint)
-(provide 'cmulisp)
-
;; YOUR .EMACS FILE
;;=============================================================================
;; Some suggestions for your .emacs file.
@@ -599,3 +597,6 @@ This is a good place to put keybindings.")
;;; 3/12/90 Olin
;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp.
;;; Tale suggested this.
+
+(provide 'cmulisp)
+
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 111f74c5532..2f333527942 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -25,7 +25,6 @@
;;; $Header: scheme.el,v 1.7 88/07/15 20:20:00 GMT cph Exp $
-(provide 'scheme)
(defvar scheme-mode-syntax-table nil "")
(if (not scheme-mode-syntax-table)
@@ -498,3 +497,5 @@ of the start of the containing expression."
(if (/= (current-column) this-indent)
(progn (delete-region bol (point))
(indent-to this-indent)))))))))
+
+(provide 'scheme)
diff --git a/lisp/sort.el b/lisp/sort.el
index f5ad0765dc2..002a899f7e8 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -17,8 +17,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'sort)
-
;; Original version of most of this contributed by Howie Kaye
(defun sort-subr (reverse nextrecfun endrecfun &optional startkeyfun endkeyfun)
@@ -444,3 +442,6 @@ From a program takes two point or marker arguments, BEG and END."
(insert (car ll) "\n")
(setq ll (cdr ll)))
(insert (car ll)))))
+
+(provide 'sort)
+
diff --git a/lisp/sun-curs.el b/lisp/sun-curs.el
index f290e1b3a76..ec5ffc8442c 100644
--- a/lisp/sun-curs.el
+++ b/lisp/sun-curs.el
@@ -23,8 +23,6 @@
;;;
;;; 9-dec-86 Jeff Peck, Sun Microsystems Inc. <peck@sun.com>
-(provide 'sm-cursors)
-
(defvar sc::cursors nil "List of known cursors")
(defmacro defcursor (name x y string)
@@ -205,3 +203,5 @@ Otherwise, ICON should be a vector or the name of a vector of [x y 32-chars]"
(setq char (1+ (lsh char 1))))
(if (not (eolp))(forward-char)))
+(provide 'sm-cursors)
+
diff --git a/lisp/sun-fns.el b/lisp/sun-fns.el
index b2ca59203f6..b628565d38e 100644
--- a/lisp/sun-fns.el
+++ b/lisp/sun-fns.el
@@ -24,7 +24,6 @@
;;; GoodIdeas Feb. 1987, Steve Greenbaum
;;; & UpClicks Reasoning Systems, Inc.
;;;
-(provide 'sun-fns)
(require 'sun-mouse)
;;;
;;; Functions for manipulating via the mouse and mouse-map definitions
@@ -628,3 +627,4 @@ To unmark a buffer marked for deletion, select it with LEFT."
(global-set-mouse '(minibuffer shift control meta right) 'mouse-help-region)
(global-set-mouse '(minibuffer double control meta right) 'mouse-help-region)
+(provide 'sun-fns)
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index c690385064a..ce70c275668 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -66,9 +66,6 @@
;;; know how to print an arbitrary date, and I don't really want to have to
;;; implement decode-universal-time.
;;;
-;;; o There's code to update the datestamp of edited subfiles, but we set it
-;;; to zero because I don't know how to get the current time as an integer.
-;;;
;;; o The code is less efficient that it could be - in a lot of places, I
;;; pull a 512-character string out of the buffer and parse it, when I could
;;; be parsing it in place, not garbaging a string. Should redo that.
@@ -108,11 +105,7 @@ tar file will update its datestamp. If false, the datestamp is unchanged.
You may or may not want this - it is good in that you can tell when a file
in a tar archive has been changed, but it is bad for the same reason that
editing a file in the tar archive at all is bad - the changed version of
-the file never exists on disk.
-
-## This doesn't work yet because there's no way to get the current time as
-## an integer - if this var is true, then editing a file sets its date to
-## December 31, 1969 (which happens to be what 0 encodes).")
+the file never exists on disk.")
@@ -978,7 +971,7 @@ to make your changes permanent."
nil
(goto-char (+ header-start tar-time-offset))
(delete-region (point) (+ (point) 12))
- (insert (format "%11o" 0)) ; ## oops - how to get it??
+ (insert (format "%11o" (current-time)))
(insert ? ))
;;
;; compute a new checksum and insert it.
diff --git a/lisp/telnet.el b/lisp/telnet.el
index c3513f61056..2f96d16db9f 100644
--- a/lisp/telnet.el
+++ b/lisp/telnet.el
@@ -27,8 +27,6 @@
;; manner
(require 'comint)
-(provide 'telnet)
-
(defvar telnet-new-line "\r")
(defvar telnet-mode-map nil)
(defvar telnet-prompt-pattern "^[^#$%>]*[#$%>] *")
@@ -179,3 +177,6 @@ Bugs:
(setq quit-flag nil))
(setq answ (concat answ (char-to-string tem))))
answ))
+
+(provide 'telnet)
+
diff --git a/lisp/term/bg-mouse.el b/lisp/term/bg-mouse.el
index 9b83f5f6c2a..8e3a546709a 100644
--- a/lisp/term/bg-mouse.el
+++ b/lisp/term/bg-mouse.el
@@ -22,8 +22,6 @@
;;; Original version by John Robinson (jr@bbn-unix.arpa, bbncca!jr), Oct 1985
;;; Modularized and enhanced by gildea@bbn.com Nov 1987
-(provide 'bg-mouse)
-
;;; User customization option:
(defvar bg-mouse-fast-select-window nil
@@ -302,3 +300,5 @@ X and Y are 0-based character positions on the screen."
(bind-bg-mouse-click (+ bg-in-minibuf bg-button-m) 'suspend-emacs)
(bind-bg-mouse-click (+ bg-in-minibuf bg-button-r) 'eval-expression)
+(provide 'bg-mouse)
+
diff --git a/lisp/term/sun-mouse.el b/lisp/term/sun-mouse.el
index bed2b416c1f..3df2da43b61 100644
--- a/lisp/term/sun-mouse.el
+++ b/lisp/term/sun-mouse.el
@@ -20,8 +20,6 @@
;;; Jeff Peck, Sun Microsystems, Jan 1987.
;;; Original idea by Stan Jefferson
-(provide 'sun-mouse)
-
;;;
;;; Modelled after the GNUEMACS keymap interface.
;;;
@@ -666,3 +664,6 @@ just close the window, and wait for reopening."
(make-variable-buffer-local 'current-local-mousemap)
(setq-default current-local-mousemap nil)
(defvar current-global-mousemap (make-mousemap))
+
+(provide 'sun-mouse)
+
diff --git a/lisp/terminal.el b/lisp/terminal.el
index de4b22d3b88..bae0d4c5639 100644
--- a/lisp/terminal.el
+++ b/lisp/terminal.el
@@ -26,7 +26,6 @@
;;>> One probably wants to do setenv MORE -c when running with
;;>> more-processing enabled.
-(provide 'terminal)
(require 'ehelp)
(defvar terminal-escape-char ?\C-^
@@ -1228,3 +1227,5 @@ of the terminal-emulator"
(1+ end)))
start (1+ end)))
(concat "\"" harder "\"")))))
+
+(provide 'terminal)
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index af6f2ded3f0..14ef2045a7b 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -24,8 +24,6 @@
;; bibliography file. Keys are automagically inserted as you type,
;; and appropriate keys are presented for various kinds of entries.
-(provide 'bib-mode)
-
(defvar bib-file "~/my-bibliography.bib"
"Default name of file used by `addbib'.")
@@ -231,3 +229,6 @@ in the title).")
(insert s)
(capitalize-title-region (point-min) (point-max))
(buffer-string)))
+
+(provide 'bib-mode)
+
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 4be2935fc26..d008fe99b3c 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -69,7 +69,7 @@
;;; Bengt Martensson, March 6
;;; Adapted to Bibtex 0.99 by updating the optional fields according
;;; to the document BibTeXing, Oren Patashnik, dated January 31, 1988.
-;;; Updated documentation strings accordingly. Added (provide 'bibtex).
+;;; Updated documentation strings accordingly. Added .
;;; If bibtex-include-OPT-crossref is non-nil, every entry will have
;;; an OPTcrossref field, analogously for bibtex-include-OPTkey and
;;; bibtex-include-OPTannote. Added bibtex-preamble, bound to ^C^EP,
@@ -139,8 +139,6 @@
;;; Trouble is, in Emacs 18.44 you can't have a mode-specific mouse binding,
;;; so it will remain active in all windows. Yuck!
-(provide 'bibtex)
-
(defvar bibtex-mode-syntax-table nil "")
(defvar bibtex-mode-abbrev-table nil "")
(define-abbrev-table 'bibtex-mode-abbrev-table ())
@@ -1101,3 +1099,6 @@ an undefined location.
)) ; matches (if...
;;; ------------- end bibtex-mode.el -------------------------------
+
+(provide 'bibtex)(provide 'bibtex)
+
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 2c1ab18bef2..a72dee496ae 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -19,8 +19,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'picture)
-
(defun move-to-column-force (column)
"Move to column COLUMN in current line.
Differs from `move-to-column' in that it creates or modifies whitespace
@@ -558,3 +556,6 @@ With no argument strips whitespace from end of every line in Picture buffer
(goto-char (point-min))
(while (re-search-forward "[ \t][ \t]*$" nil t)
(delete-region (match-beginning 0) (point)))))
+
+(provide 'picture)
+
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index 149c2f7e5c6..cba3a2ba0f5 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -44,7 +44,6 @@
; modified 3/1/89, fixed capitialize-title for first words all caps
; modified 3/15/89, allow use of " to delimit fields
; modified 4/18/89, properly "quote" special characters on output
-(provide 'refer-to-bibtex)
;**********************************************************
; User Parameters
@@ -708,3 +707,5 @@ To see this message again, perform
(r2b-help))
(message "r2b loaded")
+
+(provide 'refer-to-bibtex)
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 3f0a062a11d..eb5ff51e932 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -33,8 +33,6 @@
;; The code for finding matching $ needs to be fixed.
(require 'oshell)
-(provide 'tex-mode)
-
(defvar tex-directory "./"
"*Directory in which to run TeX subjob. Temporary files are created here.")
@@ -803,3 +801,5 @@ Runs the shell command defined by tex-show-queue-command."
(concat tex-bibtex-command " \"" tex-out-file "\"\n")))
(tex-recenter-output-buffer 0))
+(provide 'tex-mode)
+
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 9a7192ac673..edb72a8ed54 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -23,8 +23,6 @@
(require 'texnfo-upd)
(require 'tex-mode)
-(provide 'texinfo)
-
(defvar texinfo-mode-syntax-table nil)
(if texinfo-mode-syntax-table
@@ -413,3 +411,5 @@ Runs the shell command defined by tex-dvi-print-command."
" " tex-zap-file ".dvi" "\n"))
(tex-recenter-output-buffer nil))
+(provide 'texinfo)
+
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index c236d791846..6954952ca61 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -21,8 +21,6 @@
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'texnfo-upd)
-
;;;; Summary
@@ -1724,3 +1722,6 @@ chapter."
(message "Multiple files updated."))
;;;;;;;;;;;;;;;; end texnfo-upd.el ;;;;;;;;;;;;;;;;
+
+(provide 'texnfo-upd)
+
diff --git a/lisp/view.el b/lisp/view.el
index f8e13959813..3307ba8ce03 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -19,8 +19,6 @@
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-(provide 'view)
-
(defvar view-mode-map nil)
(if view-mode-map
nil
@@ -438,3 +436,6 @@ invocations return to earlier marks."
;;;###autoload
(define-key ctl-x-4-map "v" 'view-file-other-window)
+
+(provide 'view)
+