aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-03-12 17:56:57 +0000
committerStefan Monnier2008-03-12 17:56:57 +0000
commitf130385591a6433867dbf13ae7781ec1211e80fc (patch)
tree785c99f3c7e66f0ad969167f832045a10ca62c86
parent33de15f4c1fa8155ddde7004d368f96e8dd747f2 (diff)
downloademacs-f130385591a6433867dbf13ae7781ec1211e80fc.tar.gz
emacs-f130385591a6433867dbf13ae7781ec1211e80fc.zip
Fix up indentation and comment style. Remove `function'.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/comint.el352
2 files changed, 170 insertions, 184 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 315d69af254..c2420f22b9f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12008-03-12 Stefan Monnier <monnier@iro.umontreal.ca> 12008-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * comint.el: Fix up indentation and comment style. Remove `function'.
4
3 * international/mule-cmds.el (reset-language-environment) 5 * international/mule-cmds.el (reset-language-environment)
4 (set-language-environment-nonascii-translation): Don't set-unibyte-charset. 6 (set-language-environment-nonascii-translation): Don't set-unibyte-charset.
5 7
diff --git a/lisp/comint.el b/lisp/comint.el
index bc0419bf6e2..6c9befa5460 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -422,7 +422,7 @@ respect field boundaries in a natural way)."
422;; Autoload is necessary for Custom to recognize old alias. 422;; Autoload is necessary for Custom to recognize old alias.
423;;;###autoload 423;;;###autoload
424(define-obsolete-variable-alias 'comint-use-prompt-regexp-instead-of-fields 424(define-obsolete-variable-alias 'comint-use-prompt-regexp-instead-of-fields
425 'comint-use-prompt-regexp "22.1") 425 'comint-use-prompt-regexp "22.1")
426 426
427(defcustom comint-mode-hook nil 427(defcustom comint-mode-hook nil
428 "Hook run upon entry to `comint-mode'. 428 "Hook run upon entry to `comint-mode'.
@@ -656,8 +656,8 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
656 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00827.html 656 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00827.html
657 ;; 657 ;;
658 ;; This makes it really work to keep point at the bottom. 658 ;; This makes it really work to keep point at the bottom.
659;;; (make-local-variable 'scroll-conservatively) 659 ;; (make-local-variable 'scroll-conservatively)
660;;; (setq scroll-conservatively 10000) 660 ;; (setq scroll-conservatively 10000)
661 (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom t t) 661 (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom t t)
662 (make-local-variable 'comint-ptyp) 662 (make-local-variable 'comint-ptyp)
663 (make-local-variable 'comint-process-echoes) 663 (make-local-variable 'comint-process-echoes)
@@ -759,8 +759,8 @@ buffer. The hook `comint-exec-hook' is run after each exec."
759 (setq startfile (buffer-substring (point) (point-max))) 759 (setq startfile (buffer-substring (point) (point-max)))
760 (delete-region (point) (point-max)) 760 (delete-region (point) (point-max))
761 (comint-send-string proc startfile))) 761 (comint-send-string proc startfile)))
762 (run-hooks 'comint-exec-hook) 762 (run-hooks 'comint-exec-hook)
763 buffer))) 763 buffer)))
764 764
765;; This auxiliary function cranks up the process for comint-exec in 765;; This auxiliary function cranks up the process for comint-exec in
766;; the appropriate environment. 766;; the appropriate environment.
@@ -962,8 +962,9 @@ See also `comint-read-input-ring'."
962(defun comint-dynamic-list-input-ring-select () 962(defun comint-dynamic-list-input-ring-select ()
963 "Choose the input history entry that point is in or next to." 963 "Choose the input history entry that point is in or next to."
964 (interactive) 964 (interactive)
965 (let (beg end completion (buffer completion-reference-buffer) 965 (let ((buffer completion-reference-buffer)
966 (base-size completion-base-size)) 966 (base-size completion-base-size)
967 beg end completion)
967 (if (and (not (eobp)) (get-text-property (point) 'mouse-face)) 968 (if (and (not (eobp)) (get-text-property (point) 'mouse-face))
968 (setq end (point) beg (1+ (point)))) 969 (setq end (point) beg (1+ (point))))
969 (if (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face)) 970 (if (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face))
@@ -1514,119 +1515,119 @@ Similarly for Soar, Scheme, etc."
1514 ;; Note that the input string does not include its terminal newline. 1515 ;; Note that the input string does not include its terminal newline.
1515 (let ((proc (get-buffer-process (current-buffer)))) 1516 (let ((proc (get-buffer-process (current-buffer))))
1516 (if (not proc) (error "Current buffer has no process") 1517 (if (not proc) (error "Current buffer has no process")
1517 (widen) 1518 (widen)
1518 (let* ((pmark (process-mark proc)) 1519 (let* ((pmark (process-mark proc))
1519 (intxt (if (>= (point) (marker-position pmark)) 1520 (intxt (if (>= (point) (marker-position pmark))
1520 (progn (if comint-eol-on-send (end-of-line)) 1521 (progn (if comint-eol-on-send (end-of-line))
1521 (buffer-substring pmark (point))) 1522 (buffer-substring pmark (point)))
1522 (let ((copy (funcall comint-get-old-input))) 1523 (let ((copy (funcall comint-get-old-input)))
1523 (goto-char pmark) 1524 (goto-char pmark)
1524 (insert copy) 1525 (insert copy)
1525 copy))) 1526 copy)))
1526 (input (if (not (eq comint-input-autoexpand 'input)) 1527 (input (if (not (eq comint-input-autoexpand 'input))
1527 ;; Just whatever's already there 1528 ;; Just whatever's already there
1528 intxt 1529 intxt
1529 ;; Expand and leave it visible in buffer 1530 ;; Expand and leave it visible in buffer
1530 (comint-replace-by-expanded-history t pmark) 1531 (comint-replace-by-expanded-history t pmark)
1531 (buffer-substring pmark (point)))) 1532 (buffer-substring pmark (point))))
1532 (history (if (not (eq comint-input-autoexpand 'history)) 1533 (history (if (not (eq comint-input-autoexpand 'history))
1533 input 1534 input
1534 ;; This is messy 'cos ultimately the original 1535 ;; This is messy 'cos ultimately the original
1535 ;; functions used do insertion, rather than return 1536 ;; functions used do insertion, rather than return
1536 ;; strings. We have to expand, then insert back. 1537 ;; strings. We have to expand, then insert back.
1537 (comint-replace-by-expanded-history t pmark) 1538 (comint-replace-by-expanded-history t pmark)
1538 (let ((copy (buffer-substring pmark (point))) 1539 (let ((copy (buffer-substring pmark (point)))
1539 (start (point))) 1540 (start (point)))
1540 (insert input) 1541 (insert input)
1541 (delete-region pmark start) 1542 (delete-region pmark start)
1542 copy)))) 1543 copy))))
1543 1544
1544 (unless no-newline 1545 (unless no-newline
1545 (insert ?\n)) 1546 (insert ?\n))
1546 1547
1547 (comint-add-to-input-history history) 1548 (comint-add-to-input-history history)
1548 1549
1549 (run-hook-with-args 'comint-input-filter-functions 1550 (run-hook-with-args 'comint-input-filter-functions
1550 (if no-newline input 1551 (if no-newline input
1551 (concat input "\n"))) 1552 (concat input "\n")))
1552 1553
1553 (let ((beg (marker-position pmark)) 1554 (let ((beg (marker-position pmark))
1554 (end (if no-newline (point) (1- (point)))) 1555 (end (if no-newline (point) (1- (point))))
1555 (inhibit-modification-hooks t)) 1556 (inhibit-modification-hooks t))
1556 (when (> end beg) 1557 (when (> end beg)
1557 (add-text-properties beg end 1558 (add-text-properties beg end
1558 '(front-sticky t 1559 '(front-sticky t
1559 font-lock-face comint-highlight-input)) 1560 font-lock-face comint-highlight-input))
1560 (unless comint-use-prompt-regexp 1561 (unless comint-use-prompt-regexp
1561 ;; Give old user input a field property of `input', to 1562 ;; Give old user input a field property of `input', to
1562 ;; distinguish it from both process output and unsent 1563 ;; distinguish it from both process output and unsent
1563 ;; input. The terminating newline is put into a special 1564 ;; input. The terminating newline is put into a special
1564 ;; `boundary' field to make cursor movement between input 1565 ;; `boundary' field to make cursor movement between input
1565 ;; and output fields smoother. 1566 ;; and output fields smoother.
1566 (add-text-properties 1567 (add-text-properties
1567 beg end 1568 beg end
1568 '(mouse-face highlight 1569 '(mouse-face highlight
1569 help-echo "mouse-2: insert after prompt as new input" 1570 help-echo "mouse-2: insert after prompt as new input"
1570 field input)))) 1571 field input))))
1571 (unless (or no-newline comint-use-prompt-regexp) 1572 (unless (or no-newline comint-use-prompt-regexp)
1572 ;; Cover the terminating newline 1573 ;; Cover the terminating newline
1573 (add-text-properties end (1+ end) 1574 (add-text-properties end (1+ end)
1574 '(rear-nonsticky t 1575 '(rear-nonsticky t
1575 field boundary 1576 field boundary
1576 inhibit-line-move-field-capture t)))) 1577 inhibit-line-move-field-capture t))))
1577 1578
1578 (comint-snapshot-last-prompt) 1579 (comint-snapshot-last-prompt)
1579 1580
1580 (setq comint-save-input-ring-index comint-input-ring-index) 1581 (setq comint-save-input-ring-index comint-input-ring-index)
1581 (setq comint-input-ring-index nil) 1582 (setq comint-input-ring-index nil)
1582 ;; Update the markers before we send the input 1583 ;; Update the markers before we send the input
1583 ;; in case we get output amidst sending the input. 1584 ;; in case we get output amidst sending the input.
1584 (set-marker comint-last-input-start pmark) 1585 (set-marker comint-last-input-start pmark)
1585 (set-marker comint-last-input-end (point)) 1586 (set-marker comint-last-input-end (point))
1586 (set-marker (process-mark proc) (point)) 1587 (set-marker (process-mark proc) (point))
1587 ;; clear the "accumulation" marker 1588 ;; clear the "accumulation" marker
1588 (set-marker comint-accum-marker nil) 1589 (set-marker comint-accum-marker nil)
1589 (let ((comint-input-sender-no-newline no-newline)) 1590 (let ((comint-input-sender-no-newline no-newline))
1590 (funcall comint-input-sender proc input)) 1591 (funcall comint-input-sender proc input))
1591 1592
1592 ;; Optionally delete echoed input (after checking it). 1593 ;; Optionally delete echoed input (after checking it).
1593 (when (and comint-process-echoes (not artificial)) 1594 (when (and comint-process-echoes (not artificial))
1594 (let ((echo-len (- comint-last-input-end 1595 (let ((echo-len (- comint-last-input-end
1595 comint-last-input-start))) 1596 comint-last-input-start)))
1596 ;; Wait for all input to be echoed: 1597 ;; Wait for all input to be echoed:
1597 (while (and (accept-process-output proc) 1598 (while (and (accept-process-output proc)
1598 (> (+ comint-last-input-end echo-len) 1599 (> (+ comint-last-input-end echo-len)
1599 (point-max)) 1600 (point-max))
1600 (zerop 1601 (zerop
1601 (compare-buffer-substrings 1602 (compare-buffer-substrings
1602 nil comint-last-input-start 1603 nil comint-last-input-start
1603 (- (point-max) echo-len) 1604 (- (point-max) echo-len)
1604 ;; Above difference is equivalent to 1605 ;; Above difference is equivalent to
1605 ;; (+ comint-last-input-start 1606 ;; (+ comint-last-input-start
1606 ;; (- (point-max) comint-last-input-end)) 1607 ;; (- (point-max) comint-last-input-end))
1607 nil comint-last-input-end (point-max))))) 1608 nil comint-last-input-end (point-max)))))
1608 (if (and 1609 (if (and
1609 (<= (+ comint-last-input-end echo-len) 1610 (<= (+ comint-last-input-end echo-len)
1610 (point-max)) 1611 (point-max))
1611 (zerop 1612 (zerop
1612 (compare-buffer-substrings 1613 (compare-buffer-substrings
1613 nil comint-last-input-start comint-last-input-end 1614 nil comint-last-input-start comint-last-input-end
1614 nil comint-last-input-end 1615 nil comint-last-input-end
1615 (+ comint-last-input-end echo-len)))) 1616 (+ comint-last-input-end echo-len))))
1616 ;; Certain parts of the text to be deleted may have 1617 ;; Certain parts of the text to be deleted may have
1617 ;; been mistaken for prompts. We have to prevent 1618 ;; been mistaken for prompts. We have to prevent
1618 ;; problems when `comint-prompt-read-only' is non-nil. 1619 ;; problems when `comint-prompt-read-only' is non-nil.
1619 (let ((inhibit-read-only t)) 1620 (let ((inhibit-read-only t))
1620 (delete-region comint-last-input-end 1621 (delete-region comint-last-input-end
1621 (+ comint-last-input-end echo-len)) 1622 (+ comint-last-input-end echo-len))
1622 (when comint-prompt-read-only 1623 (when comint-prompt-read-only
1623 (save-excursion 1624 (save-excursion
1624 (goto-char comint-last-input-end) 1625 (goto-char comint-last-input-end)
1625 (comint-update-fence))))))) 1626 (comint-update-fence)))))))
1626 1627
1627 ;; This used to call comint-output-filter-functions, 1628 ;; This used to call comint-output-filter-functions,
1628 ;; but that scrolled the buffer in undesirable ways. 1629 ;; but that scrolled the buffer in undesirable ways.
1629 (run-hook-with-args 'comint-output-filter-functions ""))))) 1630 (run-hook-with-args 'comint-output-filter-functions "")))))
1630 1631
1631(defvar comint-preoutput-filter-functions nil 1632(defvar comint-preoutput-filter-functions nil
1632 "List of functions to call before inserting Comint output into the buffer. 1633 "List of functions to call before inserting Comint output into the buffer.
@@ -1869,13 +1870,13 @@ This function should be a pre-command hook."
1869 (if (eq scroll 'this) 1870 (if (eq scroll 'this)
1870 (goto-char (point-max)) 1871 (goto-char (point-max))
1871 (walk-windows 1872 (walk-windows
1872 (function (lambda (window) 1873 (lambda (window)
1873 (if (and (eq (window-buffer window) current) 1874 (if (and (eq (window-buffer window) current)
1874 (or (eq scroll t) (eq scroll 'all))) 1875 (or (eq scroll t) (eq scroll 'all)))
1875 (progn 1876 (progn
1876 (select-window window) 1877 (select-window window)
1877 (goto-char (point-max)) 1878 (goto-char (point-max))
1878 (select-window selected))))) 1879 (select-window selected))))
1879 nil t)))))) 1880 nil t))))))
1880 1881
1881(defun comint-postoutput-scroll-to-bottom (string) 1882(defun comint-postoutput-scroll-to-bottom (string)
@@ -1892,27 +1893,26 @@ This function should be in the list `comint-output-filter-functions'."
1892 (unwind-protect 1893 (unwind-protect
1893 (if process 1894 (if process
1894 (walk-windows 1895 (walk-windows
1895 (function (lambda (window) 1896 (lambda (window)
1896 (if (eq (window-buffer window) current) 1897 (when (eq (window-buffer window) current)
1897 (progn 1898 (select-window window)
1898 (select-window window) 1899 (if (and (< (point) (process-mark process))
1899 (if (and (< (point) (process-mark process)) 1900 (or (eq scroll t) (eq scroll 'all)
1900 (or (eq scroll t) (eq scroll 'all) 1901 ;; Maybe user wants point to jump to end.
1901 ;; Maybe user wants point to jump to end. 1902 (and (eq scroll 'this) (eq selected window))
1902 (and (eq scroll 'this) (eq selected window)) 1903 (and (eq scroll 'others) (not (eq selected window)))
1903 (and (eq scroll 'others) (not (eq selected window))) 1904 ;; If point was at the end, keep it at end.
1904 ;; If point was at the end, keep it at end. 1905 (and (marker-position comint-last-output-start)
1905 (and (marker-position comint-last-output-start) 1906 (>= (point) comint-last-output-start))))
1906 (>= (point) comint-last-output-start)))) 1907 (goto-char (process-mark process)))
1907 (goto-char (process-mark process))) 1908 ;; Optionally scroll so that the text
1908 ;; Optionally scroll so that the text 1909 ;; ends at the bottom of the window.
1909 ;; ends at the bottom of the window. 1910 (if (and comint-scroll-show-maximum-output
1910 (if (and comint-scroll-show-maximum-output 1911 (= (point) (point-max)))
1911 (= (point) (point-max))) 1912 (save-excursion
1912 (save-excursion 1913 (goto-char (point-max))
1913 (goto-char (point-max)) 1914 (recenter (- -1 scroll-margin))))
1914 (recenter (- -1 scroll-margin)))) 1915 (select-window selected)))
1915 (select-window selected)))))
1916 nil t)) 1916 nil t))
1917 (set-buffer current)))) 1917 (set-buffer current))))
1918 1918
@@ -2118,7 +2118,7 @@ Does not delete the prompt."
2118 ;; Output message and put back prompt 2118 ;; Output message and put back prompt
2119 (comint-output-filter proc replacement))) 2119 (comint-output-filter proc replacement)))
2120(define-obsolete-function-alias 'comint-kill-output 2120(define-obsolete-function-alias 'comint-kill-output
2121 'comint-delete-output "21.1") 2121 'comint-delete-output "21.1")
2122 2122
2123(defun comint-write-output (filename &optional append mustbenew) 2123(defun comint-write-output (filename &optional append mustbenew)
2124 "Write output from interpreter since last input to FILENAME. 2124 "Write output from interpreter since last input to FILENAME.
@@ -2182,8 +2182,8 @@ between the process mark and point."
2182 (interactive) 2182 (interactive)
2183 (comint-skip-input) 2183 (comint-skip-input)
2184 (interrupt-process nil comint-ptyp) 2184 (interrupt-process nil comint-ptyp)
2185;; (process-send-string nil "\n") 2185 ;; (process-send-string nil "\n")
2186) 2186 )
2187 2187
2188(defun comint-kill-subjob () 2188(defun comint-kill-subjob ()
2189 "Send kill signal to the current subjob. 2189 "Send kill signal to the current subjob.
@@ -2593,12 +2593,12 @@ A typical use:
2593 (error nil)) 2593 (error nil))
2594 (not (file-directory-p stringfile)))) 2594 (not (file-directory-p stringfile))))
2595 (defdir (if sfile-p (file-name-directory stringfile) 2595 (defdir (if sfile-p (file-name-directory stringfile)
2596 (car def))) 2596 (car def)))
2597 (deffile (if sfile-p (file-name-nondirectory stringfile) 2597 (deffile (if sfile-p (file-name-nondirectory stringfile)
2598 (cdr def))) 2598 (cdr def)))
2599 (ans (read-file-name (if deffile (format "%s(default %s) " 2599 (ans (read-file-name (if deffile (format "%s(default %s) "
2600 prompt deffile) 2600 prompt deffile)
2601 prompt) 2601 prompt)
2602 defdir 2602 defdir
2603 (concat defdir deffile) 2603 (concat defdir deffile)
2604 mustmatch-p))) 2604 mustmatch-p)))
@@ -2793,7 +2793,7 @@ Magic characters are those in `comint-file-name-quote-list'."
2793 filename 2793 filename
2794 (let ((regexp 2794 (let ((regexp
2795 (format "[%s]" 2795 (format "[%s]"
2796 (mapconcat 'char-to-string comint-file-name-quote-list "")))) 2796 (mapconcat 'char-to-string comint-file-name-quote-list ""))))
2797 (save-match-data 2797 (save-match-data
2798 (let ((i 0)) 2798 (let ((i 0))
2799 (while (string-match regexp filename i) 2799 (while (string-match regexp filename i)
@@ -3310,7 +3310,7 @@ INPUT-STRING is the input from the Comint process.
3310This function does not need to be invoked by the end user." 3310This function does not need to be invoked by the end user."
3311 (let ((output-buffer-list 3311 (let ((output-buffer-list
3312 (if (listp comint-redirect-output-buffer) 3312 (if (listp comint-redirect-output-buffer)
3313 comint-redirect-output-buffer 3313 comint-redirect-output-buffer
3314 (list comint-redirect-output-buffer))) 3314 (list comint-redirect-output-buffer)))
3315 (filtered-input-string input-string)) 3315 (filtered-input-string input-string))
3316 3316
@@ -3401,37 +3401,22 @@ If NO-DISPLAY is non-nil, do not show the output buffer."
3401 (or (re-search-backward comint-prompt-regexp nil t) 3401 (or (re-search-backward comint-prompt-regexp nil t)
3402 (error "No prompt found or `comint-prompt-regexp' not set properly")))) 3402 (error "No prompt found or `comint-prompt-regexp' not set properly"))))
3403 3403
3404 ;;;;;;;;;;;;;;;;;;;;;
3405 ;; Set up for redirection 3404 ;; Set up for redirection
3406 ;;;;;;;;;;;;;;;;;;;;;
3407 (comint-redirect-setup 3405 (comint-redirect-setup
3408 ;; Output Buffer
3409 output-buffer 3406 output-buffer
3410 ;; Comint Buffer 3407 (current-buffer) ; Comint Buffer
3411 (current-buffer) 3408 comint-prompt-regexp ; Finished Regexp
3412 ;; Finished Regexp 3409 echo) ; Echo input
3413 comint-prompt-regexp 3410
3414 ;; Echo input
3415 echo)
3416
3417 ;;;;;;;;;;;;;;;;;;;;;
3418 ;; Set the filter 3411 ;; Set the filter
3419 ;;;;;;;;;;;;;;;;;;;;; 3412 (setq comint-redirect-original-filter-function ; Save the old filter
3420 ;; Save the old filter
3421 (setq comint-redirect-original-filter-function
3422 (process-filter proc)) 3413 (process-filter proc))
3423 (set-process-filter proc 'comint-redirect-filter) 3414 (set-process-filter proc 'comint-redirect-filter)
3424 3415
3425 ;;;;;;;;;;;;;;;;;;;;;
3426 ;; Send the command 3416 ;; Send the command
3427 ;;;;;;;;;;;;;;;;;;;;; 3417 (process-send-string (current-buffer) (concat command "\n"))
3428 (process-send-string
3429 (current-buffer)
3430 (concat command "\n"))
3431 3418
3432 ;;;;;;;;;;;;;;;;;;;;;
3433 ;; Show the output 3419 ;; Show the output
3434 ;;;;;;;;;;;;;;;;;;;;;
3435 (or no-display 3420 (or no-display
3436 (display-buffer 3421 (display-buffer
3437 (get-buffer-create 3422 (get-buffer-create
@@ -3478,13 +3463,12 @@ REGEXP-GROUP is the regular expression group in REGEXP to use."
3478 results))) 3463 results)))
3479 results))) 3464 results)))
3480 3465
3481(mapc (lambda (x) 3466(dolist (x '("^Not at command line$"
3482 (add-to-list 'debug-ignored-errors x)) 3467 "^Empty input ring$"
3483 '("^Not at command line$" 3468 "^No history$"
3484 "^Empty input ring$" 3469 "^Not found$" ; Too common?
3485 "^No history$" 3470 "^Current buffer has no process$"))
3486 "^Not found$" ; Too common? 3471 (add-to-list 'debug-ignored-errors x))
3487 "^Current buffer has no process$"))
3488 3472
3489 3473
3490;; Converting process modes to use comint mode 3474;; Converting process modes to use comint mode