aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJim Blandy1992-06-24 05:09:26 +0000
committerJim Blandy1992-06-24 05:09:26 +0000
commitdaa3760289bd389e8c174c8d24b375cd875cd911 (patch)
tree0abe3e6108e0e5a7c98f4c4aa68a495b0ecef09a /lisp
parenta4275ad1c8f60239b0bad43cef97ca86d35a51a3 (diff)
downloademacs-daa3760289bd389e8c174c8d24b375cd875cd911.tar.gz
emacs-daa3760289bd389e8c174c8d24b375cd875cd911.zip
*** empty log message ***
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/autoload.el44
-rw-r--r--lisp/emacs-lisp/edebug.el32
-rw-r--r--lisp/emacs-lisp/lisp-mode.el20
-rw-r--r--lisp/frame.el6
-rw-r--r--lisp/play/blackbox.el5
-rw-r--r--lisp/progmodes/compile.el27
-rw-r--r--lisp/progmodes/etags.el24
-rw-r--r--lisp/progmodes/inf-lisp.el180
-rw-r--r--lisp/simple.el9
-rw-r--r--lisp/term/x-win.el16
-rw-r--r--lisp/textmodes/text-mode.el16
11 files changed, 271 insertions, 108 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index b399a29bfa0..767621adbd2 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -59,14 +59,29 @@ the section of autoloads for a file.")
59(defconst generate-autoload-section-trailer "\n;;;***\n" 59(defconst generate-autoload-section-trailer "\n;;;***\n"
60 "String which indicates the end of the section of autoloads for a file.") 60 "String which indicates the end of the section of autoloads for a file.")
61 61
62;; Forms which have doc-strings which should be printed specially. 62;;; Forms which have doc-strings which should be printed specially.
63;; A doc-string-elt property of ELT says that (nth ELT FORM) is 63;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
64;; the doc-string in FORM. 64;;; the doc-string in FORM.
65;; Note: defconst and defvar should NOT be marked in this way. 65;;;
66;; We don't want to produce defconsts and defvars that make-docfile can 66;;; There used to be the following note here:
67;; grok, because then it would grok them twice, once in foo.el (where they 67;;; ;;; Note: defconst and defvar should NOT be marked in this way.
68;; are given with ;;;###autoload) and once in loaddefs.el. 68;;; ;;; We don't want to produce defconsts and defvars that
69;;; ;;; make-docfile can grok, because then it would grok them twice,
70;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
71;;; ;;; once in loaddefs.el.
72;;;
73;;; Counter-note: Yes, they should be marked in this way.
74;;; make-docfile only processes those files that are loaded into the
75;;; dumped Emacs, and those files should never have anything
76;;; autoloaded here. The above-feared problem only occurs with files
77;;; which have autoloaded entries *and* are processed by make-docfile;
78;;; there should be no such files.
79
69(put 'autoload 'doc-string-elt 3) 80(put 'autoload 'doc-string-elt 3)
81(put 'defun 'doc-string-elt 3)
82(put 'defvar 'doc-string-elt 3)
83(put 'defconst 'doc-string-elt 3)
84(put 'defmacro 'doc-string-elt 3)
70 85
71(defun generate-file-autoloads (file) 86(defun generate-file-autoloads (file)
72 "Insert at point a loaddefs autoload section for FILE. 87 "Insert at point a loaddefs autoload section for FILE.
@@ -86,6 +101,21 @@ are used."
86 (floating-output-format "%20e") 101 (floating-output-format "%20e")
87 (done-any nil) 102 (done-any nil)
88 output-end) 103 output-end)
104
105 ;; If the autoload section we create here uses an absolute
106 ;; pathname for FILE in its header, and then Emacs is installed
107 ;; under a different path on another system,
108 ;; `update-autoloads-here' won't be able to find the files to be
109 ;; autoloaded. So, if FILE is in the same directory or a
110 ;; subdirectory of the current buffer's file, we'll make it
111 ;; relative to the current buffer's directory.
112 (setq file (expand-file-name file))
113 (if (and (< (length default-directory) (length file))
114 (string= default-directory
115 (substring file 0 (length default-directory))))
116 (progn
117 (setq file (substring file (length default-directory)))))
118
89 (message "Generating autoloads for %s..." file) 119 (message "Generating autoloads for %s..." file)
90 (save-excursion 120 (save-excursion
91 (set-buffer inbuf) 121 (set-buffer inbuf)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index d586367933b..2302f1704f8 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -175,7 +175,6 @@
175;; Put edebug.el in some directory in your load-path and byte-compile it. 175;; Put edebug.el in some directory in your load-path and byte-compile it.
176 176
177;; Put the following forms in your .emacs file. 177;; Put the following forms in your .emacs file.
178;; (setq edebug-global-prefix "...whatever you want") ; default is C-xX
179;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun) 178;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun)
180;; (autoload 'edebug-defun "edebug") 179;; (autoload 'edebug-defun "edebug")
181;; (autoload 'edebug-debug "edebug") 180;; (autoload 'edebug-debug "edebug")
@@ -459,17 +458,32 @@ if an error occurs, point is left at the error."
459 )) 458 ))
460 459
461 460
462;; The standard eval-current-buffer doesn't use eval-region. 461(defun edebug-eval-current-buffer (&optional edebug-e-c-b-output)
463(if (not (fboundp 'edebug-emacs-eval-current-buffer))
464 (fset 'edebug-emacs-eval-current-buffer
465 (symbol-function 'eval-current-buffer)))
466;; (fset 'eval-current-buffer (symbol-function 'edebug-emacs-eval-current-buffer))
467
468(defun eval-current-buffer (&optional edebug-e-c-b-output)
469 "Call eval-region on the whole buffer." 462 "Call eval-region on the whole buffer."
470 (interactive) 463 (interactive)
471 (eval-region (point-min) (point-max) edebug-e-c-b-output)) 464 (eval-region (point-min) (point-max) edebug-e-c-b-output))
472 465
466(defun edebug-eval-buffer (&optional buffer edebug-e-c-b-output)
467 "Call eval-region on the whole buffer."
468 (interactive "bEval buffer: ")
469 (save-excursion
470 (set-buffer buffer)
471 (eval-region (point-min) (point-max) edebug-e-c-b-output)))
472
473;; The standard eval-current-buffer doesn't use eval-region.
474(if (and (fboundp 'eval-current-buffer)
475 (not (fboundp 'edebug-emacs-eval-current-buffer)))
476 (progn
477 (fset 'edebug-emacs-eval-current-buffer
478 (symbol-function 'eval-current-buffer))
479 (fset 'eval-current-buffer 'edebug-eval-current-buffer)))
480(if (and (fboundp 'eval-buffer)
481 (not (fboundp 'edebug-emacs-eval-buffer)))
482 (progn
483 (fset 'edebug-emacs-eval-buffer
484 (symbol-function 'eval-buffer))
485 (fset 'eval-buffer 'edebug-eval-buffer)))
486
473 487
474 488
475;;;====================================================================== 489;;;======================================================================
@@ -498,6 +512,7 @@ if an error occurs, point is left at the error."
498;;; for more details. 512;;; for more details.
499 513
500 514
515;;;###autoload
501(defun edebug-defun () 516(defun edebug-defun ()
502 "Evaluate defun or defmacro, like eval-defun, but with edebug calls. 517 "Evaluate defun or defmacro, like eval-defun, but with edebug calls.
503Print its name in the minibuffer and leave point after any error it finds, 518Print its name in the minibuffer and leave point after any error it finds,
@@ -2416,6 +2431,7 @@ Global commands prefixed by global-edbug-prefix:
2416;; Note that debug and its utilities must be byte-compiled to work, since 2431;; Note that debug and its utilities must be byte-compiled to work, since
2417;; they depend on the backtrace looking a certain way. 2432;; they depend on the backtrace looking a certain way.
2418 2433
2434;;;###autoload
2419(defun edebug-debug (&rest debugger-args) 2435(defun edebug-debug (&rest debugger-args)
2420 "Replacement for debug. 2436 "Replacement for debug.
2421If an error or quit occurred and we are running an edebugged function, 2437If an error or quit occurred and we are running an edebugged function,
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index f6fb07b0d2f..d3c1c519460 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -490,9 +490,11 @@ of the start of the containing expression."
490If optional arg ENDPOS is given, indent each line, stopping when 490If optional arg ENDPOS is given, indent each line, stopping when
491ENDPOS is encountered." 491ENDPOS is encountered."
492 (interactive) 492 (interactive)
493 (let ((indent-stack (list nil)) (next-depth 0) last-depth bol 493 (let ((indent-stack (list nil))
494 outer-loop-done inner-loop-done state this-indent 494 (next-depth 0)
495 (last-point (point))) 495 (starting-point (point))
496 (last-point (point))
497 last-depth bol outer-loop-done inner-loop-done state this-indent)
496 ;; Get error now if we don't have a complete sexp after point. 498 ;; Get error now if we don't have a complete sexp after point.
497 (save-excursion (forward-sexp 1)) 499 (save-excursion (forward-sexp 1))
498 (save-excursion 500 (save-excursion
@@ -529,10 +531,12 @@ ENDPOS is encountered."
529 (setcar (nthcdr 5 state) nil)) 531 (setcar (nthcdr 5 state) nil))
530 (setq inner-loop-done t))) 532 (setq inner-loop-done t)))
531 (and endpos 533 (and endpos
532 (while (<= next-depth 0) 534 (<= next-depth 0)
533 (setq indent-stack (append indent-stack (list nil))) 535 (progn
534 (setq next-depth (1+ next-depth)) 536 (setq indent-stack (append indent-stack
535 (setq last-depth (1+ last-depth)))) 537 (make-list (- next-depth) nil))
538 last-depth (- last-depth next-depth)
539 next-depth 0)))
536 (or outer-loop-done 540 (or outer-loop-done
537 (setq outer-loop-done (<= next-depth 0))) 541 (setq outer-loop-done (<= next-depth 0)))
538 (if outer-loop-done 542 (if outer-loop-done
@@ -557,7 +561,7 @@ ENDPOS is encountered."
557 (setq this-indent (car indent-stack)) 561 (setq this-indent (car indent-stack))
558 (let ((val (calculate-lisp-indent 562 (let ((val (calculate-lisp-indent
559 (if (car indent-stack) (- (car indent-stack)) 563 (if (car indent-stack) (- (car indent-stack))
560 last-point)))) 564 starting-point))))
561 (if (integerp val) 565 (if (integerp val)
562 (setcar indent-stack 566 (setcar indent-stack
563 (setq this-indent val)) 567 (setq this-indent val))
diff --git a/lisp/frame.el b/lisp/frame.el
index e756f9d0c2b..e8a52af962f 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -264,8 +264,10 @@ under the X Window System."
264 (list (cons 'horizontal-scroll-bar toggle)))) 264 (list (cons 'horizontal-scroll-bar toggle))))
265 265
266;;;; Key bindings 266;;;; Key bindings
267(define-prefix-command 'ctl-x-5-map) 267(defvar ctl-x-5-map (make-sparse-keymap)
268(define-key ctl-x-map "5" 'ctl-x-5-map) 268 "Keymap for screen commands.")
269(fset 'ctl-x-5-prefix ctl-x-5-map)
270(define-key ctl-x-map "5" 'ctl-x-5-prefix)
269 271
270(define-key ctl-x-5-map "2" 'new-screen) 272(define-key ctl-x-5-map "2" 'new-screen)
271(define-key ctl-x-5-map "0" 'delete-screen) 273(define-key ctl-x-5-map "0" 'delete-screen)
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index 59a21a25708..002a33ec37f 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -1,12 +1,12 @@
1;;; blackbox.el --- blackbox game in Emacs Lisp 1;;; blackbox.el --- blackbox game in Emacs Lisp
2 2
3;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -114,6 +114,7 @@ The usual mnemonic keys move the cursor around the box.
114 (setq major-mode 'blackbox-mode) 114 (setq major-mode 'blackbox-mode)
115 (setq mode-name "Blackbox")) 115 (setq mode-name "Blackbox"))
116 116
117;;;###autoload
117(defun blackbox (num) 118(defun blackbox (num)
118 "Play blackbox. Optional prefix argument is the number of balls; 119 "Play blackbox. Optional prefix argument is the number of balls;
119the default is 4. 120the default is 4.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index a71ac512dd4..ac1be6b9773 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1,4 +1,4 @@
1;;; compile.el --- run compiler as inferior of Emacs, and parse its error messages. 1;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
2 2
3;;;!!! dup removal is broken. 3;;;!!! dup removal is broken.
4 4
@@ -84,21 +84,24 @@ are found.")
84 ("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2) 84 ("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)
85 ;; 4.3BSD lint pass 2 85 ;; 4.3BSD lint pass 2
86 ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8) 86 ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
87 ("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]+[ \t]*\\([0-9]+\\)[:) \t]*$" 1 2) 87 ("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]*(+[ \t]*\\([0-9]+\\))[:) \t]*$" 1 2)
88 ;; 4.3BSD lint pass 3 88 ;; 4.3BSD lint pass 3
89 ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used 89 ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
90 ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2) 90 ;; This used to be
91 ;; ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
92 ;; which is regexp Impressionism - it matches almost anything!
93 ("([ \t]*\\([^:( \t\n]+\\)[ \t]*[:(][ \t]*\\([0-9]+\\))" 1 2)
91 ;; Line 45 of "foo.c": bloofel undefined (who does this?) 94 ;; Line 45 of "foo.c": bloofel undefined (who does this?)
92 ("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"]+\\)\":" 2 1) 95 ("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"\n]+\\)\":" 2 1)
93 ;; Apollo cc, 4.3BSD fc 96 ;; Apollo cc, 4.3BSD fc
94 ;; "foo.f", line 3: Error: syntax error near end of statement 97 ;; "foo.f", line 3: Error: syntax error near end of statement
95 ("^\"\\([^\"]+\\)\", line \\([0-9]+\\):" 1 2) 98 ("^\"\\([^\"\n]+\\)\", line \\([0-9]+\\):" 1 2)
96 ;; HP-UX 7.0 fc 99 ;; HP-UX 7.0 fc
97 ;; foo.f :16 some horrible error message 100 ;; foo.f :16 some horrible error message
98 ("\\([^ \t:]+\\)[ \t]*:\\([0-9]+\\)" 1 2) 101 ("^\\([^ \t\n:]+\\)[ \t]*:\\([0-9]+\\)" 1 2)
99 ;; IBM AIX PS/2 C version 1.1 102 ;; IBM AIX PS/2 C version 1.1
100 ;; ****** Error number 140 in line 8 of file errors.c ****** 103 ;; ****** Error number 140 in line 8 of file errors.c ******
101 ("in line \\([0-9]+\\) of file \\([^ ]+[^. ]\\)\\.? " 2 1) 104 ("in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
102 ;; IBM AIX lint is too painful to do right this way. File name 105 ;; IBM AIX lint is too painful to do right this way. File name
103 ;; prefixes entire sections rather than being on each line. 106 ;; prefixes entire sections rather than being on each line.
104 ) 107 )
@@ -132,18 +135,18 @@ Typically \"grep -n\" or \"egrep -n\".
132\(The \"-n\" option tells grep to output line numbers.)") 135\(The \"-n\" option tells grep to output line numbers.)")
133 136
134(defconst compilation-enter-directory-regexp 137(defconst compilation-enter-directory-regexp
135 ": Entering directory `\\\(.*\\\)'$" 138 ": Entering directory `\\(.*\\)'$"
136 "Regular expression for a line in the compilation log that 139 "Regular expression for a line in the compilation log that
137changes the current directory. This must contain one \\\(, \\\) pair 140changes the current directory. This must contain one \\(, \\) pair
138around the directory name. 141around the directory name.
139 142
140The default value matches lines printed by the `-w' option of GNU Make.") 143The default value matches lines printed by the `-w' option of GNU Make.")
141 144
142(defconst compilation-leave-directory-regexp 145(defconst compilation-leave-directory-regexp
143 ": Leaving directory `\\\(.*\\\)'$" 146 ": Leaving directory `\\(.*\\)'$"
144 "Regular expression for a line in the compilation log that 147 "Regular expression for a line in the compilation log that
145changes the current directory to a previous value. This may 148changes the current directory to a previous value. This may
146contain one \\\(, \\\) pair around the name of the directory 149contain one \\(, \\) pair around the name of the directory
147being moved from. If it does not, the last directory entered 150being moved from. If it does not, the last directory entered
148\(by a line matching `compilation-enter-directory-regexp'\) is assumed. 151\(by a line matching `compilation-enter-directory-regexp'\) is assumed.
149 152
@@ -343,6 +346,8 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
343 (setq omax (point-max) 346 (setq omax (point-max)
344 opoint (point)) 347 opoint (point))
345 (goto-char omax) 348 (goto-char omax)
349 ;; Record where we put the message, so we can ignore it
350 ;; later on.
346 (insert ?\n mode-name " " msg) 351 (insert ?\n mode-name " " msg)
347 (forward-char -1) 352 (forward-char -1)
348 (insert " at " (substring (current-time-string) 0 19)) 353 (insert " at " (substring (current-time-string) 0 19))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index c7daec726ee..3f2f911daed 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1,12 +1,12 @@
1;;; etags.el --- tags facility for Emacs. 1;;; etags.el --- tags facility for Emacs.
2 2
3;; Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1986, 1988, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -244,6 +244,26 @@ See documentation of variable tags-file-name."
244;;;###autoload 244;;;###autoload
245(define-key ctl-x-4-map "." 'find-tag-other-window) 245(define-key ctl-x-4-map "." 'find-tag-other-window)
246 246
247;;;###autoload
248(defun find-tag-other-frame (tagname &optional next)
249 "Find tag (in current tag table) whose name contains TAGNAME.
250 Selects the buffer that the tag is contained in in another frame
251and puts point at its definition.
252 If TAGNAME is a null string, the expression in the buffer
253around or before point is used as the tag name.
254 If second arg NEXT is non-nil (interactively, with prefix arg),
255searches for the next tag in the tag table
256that matches the tagname used in the previous find-tag.
257
258See documentation of variable tags-file-name."
259 (interactive (if current-prefix-arg
260 '(nil t)
261 (find-tag-tag "Find tag other window: ")))
262 (let ((pop-up-screens t))
263 (find-tag tagname next t)))
264;;;###autoload
265(define-key ctl-x-5-map "." 'find-tag-other-frame)
266
247(defvar next-file-list nil 267(defvar next-file-list nil
248 "List of files for next-file to process.") 268 "List of files for next-file to process.")
249 269
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 98299190f49..11fc14af064 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -100,11 +100,8 @@
100;;; c-m-x lisp-eval-defun This binding is a gnu convention. 100;;; c-m-x lisp-eval-defun This binding is a gnu convention.
101;;; c-c c-e lisp-eval-defun Send the current defun to Lisp process. 101;;; c-c c-e lisp-eval-defun Send the current defun to Lisp process.
102;;; c-x c-e lisp-eval-last-sexp Send the previous sexp to Lisp process. 102;;; c-x c-e lisp-eval-last-sexp Send the previous sexp to Lisp process.
103;;; c-c m-e lisp-eval-defun-and-go After sending the defun, switch-to-lisp.
104;;; c-c c-r lisp-eval-region Send the current region to Lisp process. 103;;; c-c c-r lisp-eval-region Send the current region to Lisp process.
105;;; c-c m-r lisp-eval-region-and-go After sending the region, switch-to-lisp.
106;;; c-c c-c lisp-compile-defun Compile the current defun in Lisp process. 104;;; c-c c-c lisp-compile-defun Compile the current defun in Lisp process.
107;;; c-c m-c lisp-compile-defun-and-go After compiling defun, switch-to-lisp.
108;;; c-c c-z switch-to-lisp Switch to the Lisp process buffer. 105;;; c-c c-z switch-to-lisp Switch to the Lisp process buffer.
109;;; c-c c-l lisp-load-file (See above. In a Lisp file buffer, default 106;;; c-c c-l lisp-load-file (See above. In a Lisp file buffer, default
110;;; c-c c-k lisp-compile-file is to load/compile the current file.) 107;;; c-c c-k lisp-compile-file is to load/compile the current file.)
@@ -115,7 +112,6 @@
115 112
116;;; cmulisp Fires up the Lisp process. 113;;; cmulisp Fires up the Lisp process.
117;;; lisp-compile-region Compile all forms in the current region. 114;;; lisp-compile-region Compile all forms in the current region.
118;;; lisp-compile-region-and-go After compiling region, switch-to-lisp.
119;;; 115;;;
120;;; CMU Lisp Mode Variables: 116;;; CMU Lisp Mode Variables:
121;;; cmulisp-filter-regexp Match this => don't get saved on input hist 117;;; cmulisp-filter-regexp Match this => don't get saved on input hist
@@ -154,11 +150,8 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
154(define-key lisp-mode-map "\M-\C-x" 'lisp-eval-defun) ; Gnu convention 150(define-key lisp-mode-map "\M-\C-x" 'lisp-eval-defun) ; Gnu convention
155(define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention 151(define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention
156(define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun) 152(define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun)
157(define-key lisp-mode-map "\C-c\M-e" 'lisp-eval-defun-and-go)
158(define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region) 153(define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region)
159(define-key lisp-mode-map "\C-c\M-r" 'lisp-eval-region-and-go)
160(define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun) 154(define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun)
161(define-key lisp-mode-map "\C-c\M-c" 'lisp-compile-defun-and-go)
162(define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp) 155(define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp)
163(define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file) 156(define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file)
164(define-key lisp-mode-map "\C-c\C-k" 'lisp-compile-file) ; "kompile" file 157(define-key lisp-mode-map "\C-c\C-k" 'lisp-compile-file) ; "kompile" file
@@ -168,6 +161,37 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
168(define-key lisp-mode-map "\C-c\C-v" 'lisp-show-variable-documentation) 161(define-key lisp-mode-map "\C-c\C-v" 'lisp-show-variable-documentation)
169 162
170 163
164;;; This function exists for backwards compatibility.
165;;; Previous versions of this package bound commands to C-c <letter>
166;;; bindings, which is not allowed by the gnumacs standard.
167
168(defun cmulisp-install-letter-bindings ()
169 "This function binds many cmulisp commands to C-c <letter> bindings,
170where they are more accessible. C-c <letter> bindings are reserved for the
171user, so these bindings are non-standard. If you want them, you should
172have this function called by the cmulisp-load-hook:
173 (setq cmulisp-load-hook '(cmulisp-install-letter-bindings))
174You can modify this function to install just the bindings you want."
175
176 (define-key lisp-mode-map "\C-ce" 'lisp-eval-defun-and-go)
177 (define-key lisp-mode-map "\C-cr" 'lisp-eval-region-and-go)
178 (define-key lisp-mode-map "\C-cc" 'lisp-compile-defun-and-go)
179 (define-key lisp-mode-map "\C-cz" 'switch-to-lisp)
180 (define-key lisp-mode-map "\C-cl" 'lisp-load-file)
181 (define-key lisp-mode-map "\C-ck" 'lisp-compile-file)
182 (define-key lisp-mode-map "\C-ca" 'lisp-show-arglist)
183 (define-key lisp-mode-map "\C-cd" 'lisp-describe-sym)
184 (define-key lisp-mode-map "\C-cf" 'lisp-show-function-documentation)
185 (define-key lisp-mode-map "\C-cv" 'lisp-show-variable-documentation)
186
187 (define-key cmulisp-mode-map "\C-cl" 'lisp-load-file)
188 (define-key cmulisp-mode-map "\C-ck" 'lisp-compile-file)
189 (define-key cmulisp-mode-map "\C-ca" 'lisp-show-arglist)
190 (define-key cmulisp-mode-map "\C-cd" 'lisp-describe-sym)
191 (define-key cmulisp-mode-map "\C-cf" 'lisp-show-function-documentation)
192 (define-key cmulisp-mode-map "\C-cv" 'lisp-show-variable-documentation))
193
194
171(defvar inferior-lisp-program "lisp" 195(defvar inferior-lisp-program "lisp"
172 "*Program name for invoking an inferior Lisp with `cmulisp'.") 196 "*Program name for invoking an inferior Lisp with `cmulisp'.")
173 197
@@ -220,9 +244,9 @@ Lisp source.
220 lisp-eval-region sends the current region to the Lisp process. 244 lisp-eval-region sends the current region to the Lisp process.
221 lisp-compile-region compiles the current region. 245 lisp-compile-region compiles the current region.
222 246
223 lisp-eval-defun-and-go, lisp-compile-defun-and-go, 247 Prefixing the lisp-eval/compile-defun/region commands with
224 lisp-eval-region-and-go, and lisp-compile-region-and-go 248 a \\[universal-argument] causes a switch to the Lisp process buffer after sending
225 switch to the Lisp process buffer after sending their text. 249 the text.
226 250
227Commands: 251Commands:
228Return after the end of the process' output sends the text from the 252Return after the end of the process' output sends the text from the
@@ -262,54 +286,87 @@ to continue it."
262 "Don't save anything matching cmulisp-filter-regexp" 286 "Don't save anything matching cmulisp-filter-regexp"
263 (not (string-match cmulisp-filter-regexp str))) 287 (not (string-match cmulisp-filter-regexp str)))
264 288
265(defun cmulisp () 289(defun cmulisp (cmd)
266 "Run an inferior Lisp process, input and output via buffer *cmulisp*. 290 "Run an inferior Lisp process, input and output via buffer *cmulisp*.
267If there is a process already running in *cmulisp*, just switch to that buffer. 291If there is a process already running in *cmulisp*, just switch to that buffer.
268Takes the program name from the variable inferior-lisp-program. 292With argument, allows you to edit the command line (default is value
293of inferior-lisp-program). Runs the hooks from cmulisp-mode-hook (after the
294comint-mode-hook is run).
269\(Type \\[describe-mode] in the process buffer for a list of commands.)" 295\(Type \\[describe-mode] in the process buffer for a list of commands.)"
270 (interactive) 296 (interactive (list (if current-prefix-arg
271 (cond ((not (comint-check-proc "*cmulisp*")) 297 (read-string "Run lisp: " inferior-lisp-program)
272 (set-buffer (make-comint "cmulisp" inferior-lisp-program)) 298 inferior-lisp-program)))
299 (if (not (comint-check-proc "*cmulisp*"))
300 (let ((cmdlist (cmulisp-args-to-list cmd)))
301 (set-buffer (apply (function make-comint) "cmulisp" (car cmdlist) nil
302 (cdr cmdlist)))
273 (cmulisp-mode))) 303 (cmulisp-mode)))
274 (setq cmulisp-buffer "*cmulisp*") 304 (setq cmulisp-buffer "*cmulisp*")
275 (switch-to-buffer "*cmulisp*")) 305 (switch-to-buffer "*cmulisp*"))
276 306
277(defun lisp-eval-region (start end) 307;;; Break a string up into a list of arguments.
278 "Send the current region to the inferior Lisp process." 308;;; This will break if you have an argument with whitespace, as in
279 (interactive "r") 309;;; string = "-ab +c -x 'you lose'".
310(defun cmulisp-args-to-list (string)
311 (let ((where (string-match "[ \t]" string)))
312 (cond ((null where) (list string))
313 ((not (= where 0))
314 (cons (substring string 0 where)
315 (tea-args-to-list (substring string (+ 1 where)
316 (length string)))))
317 (t (let ((pos (string-match "[^ \t]" string)))
318 (if (null pos)
319 nil
320 (cmulsip-args-to-list (substring string pos
321 (length string)))))))))
322
323(defun lisp-eval-region (start end &optional and-go)
324 "Send the current region to the inferior Lisp process.
325Prefix argument means switch-to-lisp afterwards."
326 (interactive "r\nP")
280 (comint-send-region (cmulisp-proc) start end) 327 (comint-send-region (cmulisp-proc) start end)
281 (comint-send-string (cmulisp-proc) "\n")) 328 (comint-send-string (cmulisp-proc) "\n")
329 (if and-go (switch-to-lisp t)))
282 330
283(defun lisp-eval-defun () 331(defun lisp-eval-defun (&optional and-go)
284 "Send the current defun to the inferior Lisp process." 332 "Send the current defun to the inferior Lisp process.
285 (interactive) 333Prefix argument means switch-to-lisp afterwards."
334 (interactive "P")
286 (save-excursion 335 (save-excursion
287 (end-of-defun) 336 (end-of-defun)
288 (let ((end (point))) 337 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
289 (beginning-of-defun) 338 (let ((end (point)))
290 (lisp-eval-region (point) end)))) 339 (beginning-of-defun)
340 (lisp-eval-region (point) end)))
341 (if and-go (switch-to-lisp t)))
291 342
292(defun lisp-eval-last-sexp () 343(defun lisp-eval-last-sexp (&optional and-go)
293 "Send the previous sexp to the inferior Lisp process." 344 "Send the previous sexp to the inferior Lisp process.
294 (interactive) 345Prefix argument means switch-to-lisp afterwards."
295 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point))) 346 (interactive "P")
347 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point) and-go))
296 348
297;;; CommonLisp COMPILE sux. 349;;; Common Lisp COMPILE sux.
298(defun lisp-compile-region (start end) 350(defun lisp-compile-region (start end &optional and-go)
299 "Compile the current region in the inferior Lisp process." 351 "Compile the current region in the inferior Lisp process.
300 (interactive "r") 352Prefix argument means switch-to-lisp afterwards."
353 (interactive "r\nP")
301 (comint-send-string (cmulisp-proc) 354 (comint-send-string (cmulisp-proc)
302 (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n" 355 (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n"
303 (buffer-substring start end)))) 356 (buffer-substring start end)))
357 (if and-go (switch-to-lisp t)))
304 358
305(defun lisp-compile-defun () 359(defun lisp-compile-defun (&optional and-go)
306 "Compile the current defun in the inferior Lisp process." 360 "Compile the current defun in the inferior Lisp process.
307 (interactive) 361Prefix argument means switch-to-lisp afterwards."
362 (interactive "P")
308 (save-excursion 363 (save-excursion
309 (end-of-defun) 364 (end-of-defun)
365 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
310 (let ((e (point))) 366 (let ((e (point)))
311 (beginning-of-defun) 367 (beginning-of-defun)
312 (lisp-compile-region (point) e)))) 368 (lisp-compile-region (point) e)))
369 (if and-go (switch-to-lisp t)))
313 370
314(defun switch-to-lisp (eob-p) 371(defun switch-to-lisp (eob-p)
315 "Switch to the inferior Lisp process buffer. 372 "Switch to the inferior Lisp process buffer.
@@ -322,33 +379,35 @@ With argument, positions cursor at end of buffer."
322 (push-mark) 379 (push-mark)
323 (goto-char (point-max))))) 380 (goto-char (point-max)))))
324 381
382
383;;; Now that lisp-compile/eval-defun/region takes an optional prefix arg,
384;;; these commands are redundant. But they are kept around for the user
385;;; to bind if he wishes, for backwards functionality, and because it's
386;;; easier to type C-c e than C-u C-c C-e.
387
325(defun lisp-eval-region-and-go (start end) 388(defun lisp-eval-region-and-go (start end)
326 "Send the current region to the inferior Lisp, 389 "Send the current region to the inferior Lisp,
327and switch to the process buffer." 390and switch to the process buffer."
328 (interactive "r") 391 (interactive "r")
329 (lisp-eval-region start end) 392 (lisp-eval-region start end t))
330 (switch-to-lisp t))
331 393
332(defun lisp-eval-defun-and-go () 394(defun lisp-eval-defun-and-go ()
333 "Send the current defun to the inferior Lisp, 395 "Send the current defun to the inferior Lisp,
334and switch to the process buffer." 396and switch to the process buffer."
335 (interactive) 397 (interactive)
336 (lisp-eval-defun) 398 (lisp-eval-defun t))
337 (switch-to-lisp t))
338 399
339(defun lisp-compile-region-and-go (start end) 400(defun lisp-compile-region-and-go (start end)
340 "Compile the current region in the inferior Lisp, 401 "Compile the current region in the inferior Lisp,
341and switch to the process buffer." 402and switch to the process buffer."
342 (interactive "r") 403 (interactive "r")
343 (lisp-compile-region start end) 404 (lisp-compile-region start end t))
344 (switch-to-lisp t))
345 405
346(defun lisp-compile-defun-and-go () 406(defun lisp-compile-defun-and-go ()
347 "Compile the current defun in the inferior Lisp, 407 "Compile the current defun in the inferior Lisp,
348and switch to the process buffer." 408and switch to the process buffer."
349 (interactive) 409 (interactive)
350 (lisp-compile-defun) 410 (lisp-compile-defun t))
351 (switch-to-lisp t))
352 411
353;;; A version of the form in H. Shevis' soar-mode.el package. Less robust. 412;;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
354;(defun lisp-compile-sexp (start end) 413;(defun lisp-compile-sexp (start end)
@@ -406,7 +465,8 @@ Used by these commands to determine defaults.")
406 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name) 465 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name)
407 (file-name-nondirectory file-name))) 466 (file-name-nondirectory file-name)))
408 (comint-send-string (cmulisp-proc) 467 (comint-send-string (cmulisp-proc)
409 (format inferior-lisp-load-command file-name))) 468 (format inferior-lisp-load-command file-name))
469 (switch-to-lisp t))
410 470
411 471
412(defun lisp-compile-file (file-name) 472(defun lisp-compile-file (file-name)
@@ -419,7 +479,8 @@ Used by these commands to determine defaults.")
419 (file-name-nondirectory file-name))) 479 (file-name-nondirectory file-name)))
420 (comint-send-string (cmulisp-proc) (concat "(compile-file \"" 480 (comint-send-string (cmulisp-proc) (concat "(compile-file \""
421 file-name 481 file-name
422 "\"\)\n"))) 482 "\"\)\n"))
483 (switch-to-lisp t))
423 484
424 485
425 486
@@ -541,7 +602,7 @@ have three inferior lisps running:
541 foo cmulisp 602 foo cmulisp
542 bar cmulisp<2> 603 bar cmulisp<2>
543 *cmulisp* cmulisp<3> 604 *cmulisp* cmulisp<3>
544If you do a \\[lisp-eval-defun-and-go] command on some Lisp source code, 605If you do a \\[lisp-eval-defun] command on some Lisp source code,
545what process do you send it to? 606what process do you send it to?
546 607
547- If you're in a process buffer (foo, bar, or *cmulisp*), 608- If you're in a process buffer (foo, bar, or *cmulisp*),
@@ -598,6 +659,25 @@ This is a good place to put keybindings.")
598;;; 3/12/90 Olin 659;;; 3/12/90 Olin
599;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp. 660;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp.
600;;; Tale suggested this. 661;;; Tale suggested this.
662;;; - Reversed this decision 7/15/91. You need the visual feedback.
663;;;
664;;; 7/25/91 Olin
665;;; Changed all keybindings of the form C-c <letter>. These are
666;;; supposed to be reserved for the user to bind. This affected
667;;; mainly the compile/eval-defun/region[-and-go] commands.
668;;; This was painful, but necessary to adhere to the gnumacs standard.
669;;; For some backwards compatibility, see the
670;;; cmulisp-install-letter-bindings
671;;; function.
672;;;
673;;; 8/2/91 Olin
674;;; - The lisp-compile/eval-defun/region commands now take a prefix arg,
675;;; which means switch-to-lisp after sending the text to the Lisp process.
676;;; This obsoletes all the -and-go commands. The -and-go commands are
677;;; kept around for historical reasons, and because the user can bind
678;;; them to key sequences shorter than C-u C-c C-<letter>.
679;;; - If M-x cmulisp is invoked with a prefix arg, it allows you to
680;;; edit the command line.
601 681
602(provide 'cmulisp) 682(provide 'cmulisp)
603 683
diff --git a/lisp/simple.el b/lisp/simple.el
index 8c555190de1..3989a3685a2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -724,7 +724,14 @@ text that other programs have provided for pasting.
724The function should be called with no arguments. If the function 724The function should be called with no arguments. If the function
725returns nil, then no other program has provided such text, and the top 725returns nil, then no other program has provided such text, and the top
726of the Emacs kill ring should be used. If the function returns a 726of the Emacs kill ring should be used. If the function returns a
727string, that string should be put in the kill ring as the latest kill.") 727string, that string should be put in the kill ring as the latest kill.
728
729Note that the function should return a string only if a program other
730than Emacs has provided a string for pasting; if Emacs provided the
731most recent string, the function should return nil. If it is
732difficult to tell whether Emacs or some other program provided the
733current string, it is probably good enough to return nil if the string
734is equal (according to `string=') to the last text Emacs provided.")
728 735
729 736
730 737
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 3f6cefe0a6f..22237e5e21a 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -447,6 +447,11 @@ This returns ARGS with the arguments that have been processed removed."
447 '(lambda () 447 '(lambda ()
448 (error "Suspending an emacs running under X makes no sense"))) 448 (error "Suspending an emacs running under X makes no sense")))
449 449
450;;; We keep track of the last text selected here, so we can check the
451;;; current selection against it, and avoid passing back our own text
452;;; from x-cut-buffer-or-selection-value.
453(defvar x-last-selected-text nil)
454
450;;; Make TEXT, a string, the primary and clipboard X selections. 455;;; Make TEXT, a string, the primary and clipboard X selections.
451;;; If you are running xclipboard, this means you can effectively 456;;; If you are running xclipboard, this means you can effectively
452;;; have a window on a copy of the kill-ring. 457;;; have a window on a copy of the kill-ring.
@@ -455,14 +460,19 @@ This returns ARGS with the arguments that have been processed removed."
455(defun x-select-text (text) 460(defun x-select-text (text)
456 (x-own-selection text 'cut-buffer0) 461 (x-own-selection text 'cut-buffer0)
457 (x-own-selection text 'clipboard) 462 (x-own-selection text 'clipboard)
458 (x-own-selection text)) 463 (x-own-selection text)
464 (setq x-last-selected-text text))
459 465
460;;; Return the value of the current X selection. For compatibility 466;;; Return the value of the current X selection. For compatibility
461;;; with older X applications, this checks cut buffer 0 before 467;;; with older X applications, this checks cut buffer 0 before
462;;; retrieving the value of the primary selection. 468;;; retrieving the value of the primary selection.
463(defun x-cut-buffer-or-selection-value () 469(defun x-cut-buffer-or-selection-value ()
464 (or (x-selection-value 'cut-buffer0) 470 (let ((text (or (x-selection-value 'cut-buffer0)
465 (x-selection-value))) 471 (x-selection-value))))
472 (if (string= text x-last-selected-text)
473 nil
474 (setq x-last-selected-text nil)
475 text)))
466 476
467;;; Arrange for the kill and yank functions to set and check the clipboard. 477;;; Arrange for the kill and yank functions to set and check the clipboard.
468(setq interprogram-cut-function 'x-select-text) 478(setq interprogram-cut-function 'x-select-text)
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 56a4ab59c59..a87d2b09251 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -1,12 +1,12 @@
1;;; text-mode.el --- text mode, and its idiosyncratic commands. 1;;; text-mode.el --- text mode, and its idiosyncratic commands.
2 2
3;; Copyright (C) 1985 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -94,18 +94,6 @@ if that value is non-nil."
94 (setq major-mode 'indented-text-mode) 94 (setq major-mode 'indented-text-mode)
95 (run-hooks 'text-mode-hook)) 95 (run-hooks 'text-mode-hook))
96 96
97(defun change-log-mode ()
98 "Major mode for editing ChangeLog files. See M-x add-change-log-entry.
99Almost the same as Indented Text mode, but prevents numeric backups
100and sets `left-margin' to 8 and `fill-column' to 74."
101 (interactive)
102 (indented-text-mode)
103 (setq left-margin 8)
104 (setq fill-column 74)
105 (make-local-variable 'version-control)
106 (setq version-control 'never)
107 (run-hooks 'change-log-mode-hook))
108
109(defun center-paragraph () 97(defun center-paragraph ()
110 "Center each nonblank line in the paragraph at or after point. 98 "Center each nonblank line in the paragraph at or after point.
111See center-line for more info." 99See center-line for more info."