]> code.delx.au - gnu-emacs/blobdiff - lisp/term.el
Merge branch 'master' into cairo
[gnu-emacs] / lisp / term.el
index a629af90d3e8f1279bd50b4eef4c043fe34c190f..4c829864200c9115b6a69dfb327183a6f471ebbb 100644 (file)
@@ -1145,7 +1145,7 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (make-local-variable 'term-scroll-show-maximum-output)
   (make-local-variable 'term-ptyp)
   (make-local-variable 'term-exec-hook)
-  (make-local-variable 'term-vertical-motion)
+  (set (make-local-variable 'term-vertical-motion) 'vertical-motion)
   (set (make-local-variable 'term-pending-delete-marker) (make-marker))
   (make-local-variable 'term-current-face)
   (term-ansi-reset)
@@ -1155,6 +1155,13 @@ Entry to this mode runs the hooks on `term-mode-hook'."
 
   (set (make-local-variable 'font-lock-defaults) '(nil t))
 
+  (add-function :filter-return
+                (local 'window-adjust-process-window-size-function)
+                (lambda (size)
+                  (when size
+                    (term-reset-size (cdr size) (car size)))
+                  size))
+
   (easy-menu-add term-terminal-menu)
   (easy-menu-add term-signals-menu)
   (or term-input-ring
@@ -1197,12 +1204,6 @@ Entry to this mode runs the hooks on `term-mode-hook'."
        (goto-char save-point)))
     found))
 
-(defun term-check-size (process)
-  (when (or (/= term-height (window-text-height))
-           (/= term-width (term-window-width)))
-    (term-reset-size (window-text-height) (term-window-width))
-    (set-process-window-size process term-height term-width)))
-
 (defun term-send-raw-string (chars)
   (deactivate-mark)
   (let ((proc (get-buffer-process (current-buffer))))
@@ -1504,11 +1505,6 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.")
           (format "TERMINFO=%s" data-directory)
           (format term-termcap-format "TERMCAP="
                   term-term-name term-height term-width)
-          ;; We are going to get rid of the binding for EMACS,
-          ;; probably in Emacs 23, because it breaks
-          ;; `./configure' of some packages that expect it to
-          ;; say where to find EMACS.
-          (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
           (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)
           (format "LINES=%d" term-height)
           (format "COLUMNS=%d" term-width))
@@ -2772,15 +2768,11 @@ See `term-prompt-regexp'."
        (when (/= (point) (process-mark proc))
          (setq save-point (point-marker)))
 
-       ;; Note if the window size has changed.  We used to reset
-       ;; point too, but that gives incorrect results (Bug#4635).
-       (if (eq (window-buffer) (current-buffer))
-           (progn
-             (setq term-vertical-motion (symbol-function 'vertical-motion))
-             (term-check-size proc))
-         (setq term-vertical-motion
-               (symbol-function 'term-buffer-vertical-motion)))
-       (setq save-marker (copy-marker (process-mark proc)))
+        (setf term-vertical-motion
+              (if (eq (window-buffer) (current-buffer))
+                  'vertical-motion
+                'term-buffer-vertical-motion))
+        (setq save-marker (copy-marker (process-mark proc)))
        (goto-char (process-mark proc))
 
        (save-restriction
@@ -3082,9 +3074,7 @@ See `term-prompt-regexp'."
                   (eq (window-buffer selected) (current-buffer)))
          (term-display-line (car term-pending-frame)
                             (cdr term-pending-frame))
-         (setq term-pending-frame nil)
-         ;; We have created a new window, so check the window size.
-         (term-check-size proc))
+          (setq term-pending-frame nil))
 
        ;; Scroll each window displaying the buffer but (by default)
        ;; only if the point matches the process-mark we started with.