aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-07-24 05:00:23 +0000
committerRichard M. Stallman1992-07-24 05:00:23 +0000
commite6dfdce5163f8de5b0acb804d94e7b81f609cf90 (patch)
tree3e1ec38a0412ec8884dc0b17e0e91f9751af57eb
parent3e95679ecc30375da1c94e84c6610a42944b680e (diff)
downloademacs-e6dfdce5163f8de5b0acb804d94e7b81f609cf90.tar.gz
emacs-e6dfdce5163f8de5b0acb804d94e7b81f609cf90.zip
*** empty log message ***
-rw-r--r--lisp/comint.el74
-rw-r--r--lisp/progmodes/c-mode.el2
-rw-r--r--lisp/progmodes/cplus-md.el10
-rw-r--r--lisp/subr.el20
4 files changed, 55 insertions, 51 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index bae665befc0..938b559fc30 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -116,9 +116,9 @@
116;;; comint-prompt-regexp - string comint-bol uses to match prompt. 116;;; comint-prompt-regexp - string comint-bol uses to match prompt.
117;;; comint-last-input-start - marker Handy if inferior always echos 117;;; comint-last-input-start - marker Handy if inferior always echos
118;;; comint-last-input-end - marker For comint-kill-output command 118;;; comint-last-input-end - marker For comint-kill-output command
119;;; input-ring-size - integer For the input history 119;;; comint-input-ring-size - integer For the input history
120;;; input-ring - ring mechanism 120;;; comint-input-ring - ring mechanism
121;;; input-ring-index - marker ... 121;;; comint-input-ring-index - marker ...
122;;; comint-last-input-match - string ... 122;;; comint-last-input-match - string ...
123;;; comint-get-old-input - function Hooks for specific 123;;; comint-get-old-input - function Hooks for specific
124;;; comint-input-sentinel - function process-in-a-buffer 124;;; comint-input-sentinel - function process-in-a-buffer
@@ -140,7 +140,7 @@ Good choices:
140 140
141This is a good thing to set in mode hooks.") 141This is a good thing to set in mode hooks.")
142 142
143(defvar input-ring-size 30 143(defvar comint-input-ring-size 30
144 "Size of input history ring.") 144 "Size of input history ring.")
145 145
146;;; Here are the per-interpreter hooks. 146;;; Here are the per-interpreter hooks.
@@ -185,6 +185,9 @@ executed once when the buffer is created.")
185 185
186(defvar comint-mode-map nil) 186(defvar comint-mode-map nil)
187 187
188(defvar comint-last-input-start)
189(defvar comint-last-input-end)
190
188(defun comint-mode () 191(defun comint-mode ()
189 "Major mode for interacting with an inferior interpreter. 192 "Major mode for interacting with an inferior interpreter.
190Interpreter name is same as buffer name, sans the asterisks. 193Interpreter name is same as buffer name, sans the asterisks.
@@ -199,7 +202,7 @@ comint-input-sentinel, comint-input-filter, comint-input-sender and
199comint-get-old-input to appropriate functions, and the variable 202comint-get-old-input to appropriate functions, and the variable
200comint-prompt-regexp to the appropriate regular expression. 203comint-prompt-regexp to the appropriate regular expression.
201 204
202An input history is maintained of size input-ring-size, and 205An input history is maintained of size comint-input-ring-size, and
203can be accessed with the commands comint-next-input [\\[comint-next-input]] and 206can be accessed with the commands comint-next-input [\\[comint-next-input]] and
204comint-previous-input [\\[comint-previous-input]]. Commands not keybound by 207comint-previous-input [\\[comint-previous-input]]. Commands not keybound by
205default are send-invisible, comint-dynamic-complete, and 208default are send-invisible, comint-dynamic-complete, and
@@ -212,9 +215,9 @@ to continue it.
212 215
213Entry to this mode runs the hooks on comint-mode-hook" 216Entry to this mode runs the hooks on comint-mode-hook"
214 (interactive) 217 (interactive)
215 (let ((old-ring (and (assq 'input-ring (buffer-local-variables)) 218 (let ((old-ring (and (assq 'comint-input-ring (buffer-local-variables))
216 (boundp 'input-ring) 219 (boundp 'comint-input-ring)
217 input-ring)) 220 comint-input-ring))
218 (old-ptyp comint-ptyp)) ; preserve across local var kill. gross. 221 (old-ptyp comint-ptyp)) ; preserve across local var kill. gross.
219; (kill-all-local-variables) ; Removed 1/15/90 Olin 222; (kill-all-local-variables) ; Removed 1/15/90 Olin
220 (setq major-mode 'comint-mode) 223 (setq major-mode 'comint-mode)
@@ -228,10 +231,10 @@ Entry to this mode runs the hooks on comint-mode-hook"
228 (make-local-variable 'comint-last-input-match) 231 (make-local-variable 'comint-last-input-match)
229 (setq comint-last-input-match "") 232 (setq comint-last-input-match "")
230 (make-local-variable 'comint-prompt-regexp) ; Don't set; default 233 (make-local-variable 'comint-prompt-regexp) ; Don't set; default
231 (make-local-variable 'input-ring-size) ; ...to global val. 234 (make-local-variable 'comint-input-ring-size) ; ...to global val.
232 (make-local-variable 'input-ring) 235 (make-local-variable 'comint-input-ring)
233 (make-local-variable 'input-ring-index) 236 (make-local-variable 'comint-input-ring-index)
234 (setq input-ring-index 0) 237 (setq comint-input-ring-index 0)
235 (make-local-variable 'comint-get-old-input) 238 (make-local-variable 'comint-get-old-input)
236 (make-local-variable 'comint-input-sentinel) 239 (make-local-variable 'comint-input-sentinel)
237 (make-local-variable 'comint-input-filter) 240 (make-local-variable 'comint-input-filter)
@@ -241,11 +244,11 @@ Entry to this mode runs the hooks on comint-mode-hook"
241 (setq comint-ptyp old-ptyp) 244 (setq comint-ptyp old-ptyp)
242 (make-local-variable 'comint-exec-hook) 245 (make-local-variable 'comint-exec-hook)
243 (run-hooks 'comint-mode-hook) 246 (run-hooks 'comint-mode-hook)
244 ;Do this after the hook so the user can mung INPUT-RING-SIZE w/his hook. 247 ;Do this after the hook so the user can mung COMINT-INPUT-RING-SIZE w/his hook.
245 ;The test is so we don't lose history if we run comint-mode twice in 248 ;The test is so we don't lose history if we run comint-mode twice in
246 ;a buffer. 249 ;a buffer.
247 (setq input-ring (if (ring-p old-ring) old-ring 250 (setq comint-input-ring (if (ring-p old-ring) old-ring
248 (make-ring input-ring-size))))) 251 (make-ring comint-input-ring-size)))))
249 252
250;;; The old-ptyp stuff above is because we have to preserve the value of 253;;; The old-ptyp stuff above is because we have to preserve the value of
251;;; comint-ptyp across calls to comint-mode, in spite of the 254;;; comint-ptyp across calls to comint-mode, in spite of the
@@ -444,7 +447,7 @@ item to make room."
444 "Remove the oldest item retained on the ring." 447 "Remove the oldest item retained on the ring."
445 (if (ring-empty-p ring) (error "Ring empty") 448 (if (ring-empty-p ring) (error "Ring empty")
446 (let ((tl (car (cdr ring))) (vec (cdr (cdr ring)))) 449 (let ((tl (car (cdr ring))) (vec (cdr (cdr ring))))
447 (set-car (cdr ring) (ring-minus1 tl (length vec))) 450 (setcar (cdr ring) (ring-minus1 tl (length vec)))
448 (aref vec tl)))) 451 (aref vec tl))))
449 452
450;;; This isn't actually used in this package. I just threw it in in case 453;;; This isn't actually used in this package. I just threw it in in case
@@ -469,8 +472,8 @@ item to make room."
469 (aset vec hd (aref vec tl)) 472 (aset vec hd (aref vec tl))
470 (setq tl (ring-minus1 tl len)) 473 (setq tl (ring-minus1 tl len))
471 (setq n (- n 1)))) 474 (setq n (- n 1))))
472 (set-car ring hd) 475 (setcar ring hd)
473 (set-car (cdr ring) tl))))) 476 (setcar (cdr ring) tl)))))
474 477
475(defun comint-mod (n m) 478(defun comint-mod (n m)
476 "Returns N mod M. M is positive. Answer is guaranteed to be non-negative, 479 "Returns N mod M. M is positive. Answer is guaranteed to be non-negative,
@@ -498,7 +501,7 @@ and less than m."
498(defun comint-previous-input (arg) 501(defun comint-previous-input (arg)
499 "Cycle backwards through input history." 502 "Cycle backwards through input history."
500 (interactive "*p") 503 (interactive "*p")
501 (let ((len (ring-length input-ring))) 504 (let ((len (ring-length comint-input-ring)))
502 (cond ((<= len 0) 505 (cond ((<= len 0)
503 (message "Empty input ring") 506 (message "Empty input ring")
504 (ding)) 507 (ding))
@@ -513,13 +516,13 @@ and less than m."
513 (process-mark (get-buffer-process (current-buffer))) 516 (process-mark (get-buffer-process (current-buffer)))
514 (point))) 517 (point)))
515 (t 518 (t
516 (setq input-ring-index 519 (setq comint-input-ring-index
517 (if (> arg 0) -1 520 (if (> arg 0) -1
518 (if (< arg 0) 1 0))) 521 (if (< arg 0) 1 0)))
519 (push-mark (point)))) 522 (push-mark (point))))
520 (setq input-ring-index (comint-mod (+ input-ring-index arg) len)) 523 (setq comint-input-ring-index (comint-mod (+ comint-input-ring-index arg) len))
521 (message "%d" (1+ input-ring-index)) 524 (message "%d" (1+ comint-input-ring-index))
522 (insert (ring-ref input-ring input-ring-index)) 525 (insert (ring-ref comint-input-ring comint-input-ring-index))
523 (setq this-command 'comint-previous-input))))) 526 (setq this-command 'comint-previous-input)))))
524 527
525(defun comint-next-input (arg) 528(defun comint-next-input (arg)
@@ -541,14 +544,14 @@ Buffer local variable.")
541; (interactive "sCommand substring: ") 544; (interactive "sCommand substring: ")
542 (setq comint-last-input-match str) ; update default 545 (setq comint-last-input-match str) ; update default
543 (if (not (eq last-command 'comint-previous-input)) 546 (if (not (eq last-command 'comint-previous-input))
544 (setq input-ring-index -1)) 547 (setq comint-input-ring-index -1))
545 (let ((str (regexp-quote str)) 548 (let ((str (regexp-quote str))
546 (len (ring-length input-ring)) 549 (len (ring-length comint-input-ring))
547 (n (+ input-ring-index 1))) 550 (n (+ comint-input-ring-index 1)))
548 (while (and (< n len) (not (string-match str (ring-ref input-ring n)))) 551 (while (and (< n len) (not (string-match str (ring-ref comint-input-ring n))))
549 (setq n (+ n 1))) 552 (setq n (+ n 1)))
550 (cond ((< n len) 553 (cond ((< n len)
551 (comint-previous-input (- n input-ring-index))) 554 (comint-previous-input (- n comint-input-ring-index)))
552 (t (if (eq last-command 'comint-previous-input) 555 (t (if (eq last-command 'comint-previous-input)
553 (setq this-command 'comint-previous-input)) 556 (setq this-command 'comint-previous-input))
554 (message "Not found.") 557 (message "Not found.")
@@ -624,28 +627,28 @@ in the history, if -1 it will go forward."
624 (if (not (comint-after-pmark-p)) 627 (if (not (comint-after-pmark-p))
625 (error "Not after process mark")) 628 (error "Not after process mark"))
626 (if (not (eq last-command 'comint-previous-similar-input)) 629 (if (not (eq last-command 'comint-previous-similar-input))
627 (setq input-ring-index -1 630 (setq comint-input-ring-index -1
628 comint-last-similar-string 631 comint-last-similar-string
629 (buffer-substring 632 (buffer-substring
630 (process-mark (get-buffer-process (current-buffer))) 633 (process-mark (get-buffer-process (current-buffer)))
631 (point)))) 634 (point))))
632 (let* ((size (length comint-last-similar-string)) 635 (let* ((size (length comint-last-similar-string))
633 (len (ring-length input-ring)) 636 (len (ring-length comint-input-ring))
634 (n (+ input-ring-index arg)) 637 (n (+ comint-input-ring-index arg))
635 entry) 638 entry)
636 (while (and (< n len) 639 (while (and (< n len)
637 (or (< (length (setq entry (ring-ref input-ring n))) size) 640 (or (< (length (setq entry (ring-ref comint-input-ring n))) size)
638 (not (equal comint-last-similar-string 641 (not (equal comint-last-similar-string
639 (substring entry 0 size))))) 642 (substring entry 0 size)))))
640 (setq n (+ n arg))) 643 (setq n (+ n arg)))
641 (cond ((< n len) 644 (cond ((< n len)
642 (setq input-ring-index n) 645 (setq comint-input-ring-index n)
643 (if (eq last-command 'comint-previous-similar-input) 646 (if (eq last-command 'comint-previous-similar-input)
644 (delete-region (mark) (point)) ; repeat 647 (delete-region (mark) (point)) ; repeat
645 (push-mark (point))) ; 1st time 648 (push-mark (point))) ; 1st time
646 (insert (substring entry size))) 649 (insert (substring entry size)))
647 (t (message "Not found.") (ding) (sit-for 1))) 650 (t (message "Not found.") (ding) (sit-for 1)))
648 (message "%d" (1+ input-ring-index)))) 651 (message "%d" (1+ comint-input-ring-index))))
649 652
650 653
651(defun comint-send-input () 654(defun comint-send-input ()
@@ -692,7 +695,8 @@ Similarly for Soar, Scheme, etc.."
692 (insert copy) 695 (insert copy)
693 copy)))) 696 copy))))
694 (insert ?\n) 697 (insert ?\n)
695 (if (funcall comint-input-filter input) (ring-insert input-ring input)) 698 (if (funcall comint-input-filter input)
699 (ring-insert comint-input-ring input))
696 (funcall comint-input-sentinel input) 700 (funcall comint-input-sentinel input)
697 (funcall comint-input-sender proc input) 701 (funcall comint-input-sender proc input)
698 (set-marker comint-last-input-start pmark) 702 (set-marker comint-last-input-start pmark)
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el
index 0bc02b473e2..fc784d71518 100644
--- a/lisp/progmodes/c-mode.el
+++ b/lisp/progmodes/c-mode.el
@@ -1034,7 +1034,7 @@ ENDPOS is encountered."
1034The arguments are a string representing the desired style 1034The arguments are a string representing the desired style
1035and a flag which, if non-nil, means to set the style globally. 1035and a flag which, if non-nil, means to set the style globally.
1036\(Interactively, the flag comes from the prefix argument.) 1036\(Interactively, the flag comes from the prefix argument.)
1037Available styles are GNU, K&R, BSD and Whitesmith. 1037Available styles are GNU, K&R, BSD and Whitesmith."
1038 (interactive (list (completing-read "Use which C indentation style? " 1038 (interactive (list (completing-read "Use which C indentation style? "
1039 c-style-alist nil t) 1039 c-style-alist nil t)
1040 current-prefix-arg)) 1040 current-prefix-arg))
diff --git a/lisp/progmodes/cplus-md.el b/lisp/progmodes/cplus-md.el
index fa8979a11bd..ace790cb80d 100644
--- a/lisp/progmodes/cplus-md.el
+++ b/lisp/progmodes/cplus-md.el
@@ -99,7 +99,7 @@
99 (define-key c++-mode-map "\177" 'backward-delete-char-untabify) 99 (define-key c++-mode-map "\177" 'backward-delete-char-untabify)
100 (define-key c++-mode-map "\t" 'c++-indent-command) 100 (define-key c++-mode-map "\t" 'c++-indent-command)
101;; (define-key c++-mode-map "\C-c\C-i" 'c++-insert-header) 101;; (define-key c++-mode-map "\C-c\C-i" 'c++-insert-header)
102 (define-key c++-mode-map "\C-c\C-\\" 'c-backslash-region) 102 (define-key c++-mode-map "\C-c\C-\\" 'c-backslash-region))
103;; (define-key c++-mode-map "\e\C-a" 'c++-beginning-of-defun) 103;; (define-key c++-mode-map "\e\C-a" 'c++-beginning-of-defun)
104;; (define-key c++-mode-map "\e\C-e" 'c++-end-of-defun) 104;; (define-key c++-mode-map "\e\C-e" 'c++-end-of-defun)
105;; (define-key c++-mode-map "\e\C-x" 'c++-indent-defun)) 105;; (define-key c++-mode-map "\e\C-x" 'c++-indent-defun))
@@ -582,7 +582,7 @@ Returns nil if line starts inside a string, t if in a comment."
582 (contain-stack (list (point))) 582 (contain-stack (list (point)))
583 (case-fold-search nil) 583 (case-fold-search nil)
584 restart outer-loop-done inner-loop-done state ostate 584 restart outer-loop-done inner-loop-done state ostate
585 this-indent last-sexp 585 this-indent last-sexp last-depth
586 at-else at-brace 586 at-else at-brace
587 (opoint (point)) 587 (opoint (point))
588 (next-depth 0)) 588 (next-depth 0))
@@ -596,8 +596,8 @@ Returns nil if line starts inside a string, t if in a comment."
596 ;; plus enough other lines to get to one that 596 ;; plus enough other lines to get to one that
597 ;; does not end inside a comment or string. 597 ;; does not end inside a comment or string.
598 ;; Meanwhile, do appropriate indentation on comment lines. 598 ;; Meanwhile, do appropriate indentation on comment lines.
599 (setq innerloop-done nil) 599 (setq inner-loop-done nil)
600 (while (and (not innerloop-done) 600 (while (and (not inner-loop-done)
601 (not (and (eobp) (setq outer-loop-done t)))) 601 (not (and (eobp) (setq outer-loop-done t))))
602 (setq ostate state) 602 (setq ostate state)
603 (setq state (parse-partial-sexp (point) (progn (end-of-line) (point)) 603 (setq state (parse-partial-sexp (point) (progn (end-of-line) (point))
@@ -610,7 +610,7 @@ Returns nil if line starts inside a string, t if in a comment."
610 (c++-indent-line)) 610 (c++-indent-line))
611 (if (or (nth 3 state)) 611 (if (or (nth 3 state))
612 (forward-line 1) 612 (forward-line 1)
613 (setq innerloop-done t))) 613 (setq inner-loop-done t)))
614 (if (<= next-depth 0) 614 (if (<= next-depth 0)
615 (setq outer-loop-done t)) 615 (setq outer-loop-done t))
616 (if outer-loop-done 616 (if outer-loop-done
diff --git a/lisp/subr.el b/lisp/subr.el
index aee62d11f94..c485e98c608 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -312,16 +312,16 @@ This makes or adds to an entry on `after-load-alist'.
312FILE should be the name of a library, with no directory name." 312FILE should be the name of a library, with no directory name."
313 (eval-after-load file (read))) 313 (eval-after-load file (read)))
314 314
315(defmacro defun-inline (name args &rest body) 315;;(defmacro defun-inline (name args &rest body)
316 "Create an \"inline defun\" (actually a macro). 316;; "Create an \"inline defun\" (actually a macro).
317Use just like `defun'." 317;;Use just like `defun'."
318 (nconc (list 'defmacro name '(&rest args)) 318;; (nconc (list 'defmacro name '(&rest args))
319 (if (stringp (car body)) 319;; (if (stringp (car body))
320 (prog1 (list (car body)) 320;; (prog1 (list (car body))
321 (setq body (or (cdr body) body)))) 321;; (setq body (or (cdr body) body))))
322 (list (list 'cons (list 'quote 322;; (list (list 'cons (list 'quote
323 (cons 'lambda (cons args body))) 323;; (cons 'lambda (cons args body)))
324 'args)))) 324;; 'args))))
325 325
326(defun user-original-login-name () 326(defun user-original-login-name ()
327 "Return user's login name from original login. 327 "Return user's login name from original login.