comparison lisp/comint.el @ 95777:edc51d72cb17

* window.c (Vwindow_point_insertion_type): New var. (set_window_buffer): Use it. (syms_of_window): Init and export it to Lisp. * progmodes/compile.el (compilation-mode): Set window-point-insertion-type. (compilation-filter): Don't use insert-before-markers any more. * emacs-lisp/trace.el (trace-make-advice): Set window-point-insertion-type in the trace buffer. * startup.el (normal-top-level): Set window-point-insertion-type in *Messages*. * net/telnet.el (telnet-mode): Set window-point-insertion-type. (telnet-filter): Don't use insert-before-markers any more. * comint.el (comint-mode): Set window-point-insertion-type. (comint-output-filter): Don't use insert-before-markers any more. * button.el (make-text-button): Allow `start' to be a string.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 10 Jun 2008 16:08:48 +0000
parents ee5932bf781d
children d5d7186027e2
comparison
equal deleted inserted replaced
95776:dc7fbbea402e 95777:edc51d72cb17
616 616
617 \\{comint-mode-map} 617 \\{comint-mode-map}
618 618
619 Entry to this mode runs the hooks on `comint-mode-hook'." 619 Entry to this mode runs the hooks on `comint-mode-hook'."
620 (setq mode-line-process '(":%s")) 620 (setq mode-line-process '(":%s"))
621 (set (make-local-variable 'window-point-insertion-type) t)
621 (set (make-local-variable 'comint-last-input-start) (point-min-marker)) 622 (set (make-local-variable 'comint-last-input-start) (point-min-marker))
622 (set (make-local-variable 'comint-last-input-end) (point-min-marker)) 623 (set (make-local-variable 'comint-last-input-end) (point-min-marker))
623 (set (make-local-variable 'comint-last-output-start) (make-marker)) 624 (set (make-local-variable 'comint-last-output-start) (make-marker))
624 (make-local-variable 'comint-last-prompt-overlay) 625 (make-local-variable 'comint-last-prompt-overlay)
625 (make-local-variable 'comint-prompt-regexp) ; Don't set; default 626 (make-local-variable 'comint-prompt-regexp) ; Don't set; default
1753 1754
1754 (goto-char (process-mark process)) 1755 (goto-char (process-mark process))
1755 (set-marker comint-last-output-start (point)) 1756 (set-marker comint-last-output-start (point))
1756 1757
1757 ;; insert-before-markers is a bad thing. XXX 1758 ;; insert-before-markers is a bad thing. XXX
1758 ;; 1759 ;; Luckily we don't have to use it any more, we use
1759 ;; It is used here to force window-point markers (used to 1760 ;; window-point-insertion-type instead.
1760 ;; store the value of point in non-selected windows) to 1761 (insert string)
1761 ;; advance, but it also screws up any other markers that we
1762 ;; don't _want_ to advance, such as the start-marker of some
1763 ;; of the overlays we create.
1764 ;;
1765 ;; We work around the problem with the overlays by
1766 ;; explicitly adjusting them after we do the insertion, but
1767 ;; in the future this problem should be solved correctly, by
1768 ;; using `insert', and making the insertion-type of
1769 ;; window-point markers settable (via a buffer-local
1770 ;; variable). In comint buffers, this variable would be set
1771 ;; to `t', to cause point in non-select windows to advance.
1772 (insert-before-markers string)
1773 ;; Fixup markers and overlays that got screwed up because we
1774 ;; used `insert-before-markers'.
1775 (let ((old-point (- (point) (length string))))
1776 ;; comint-last-output-start
1777 (set-marker comint-last-output-start old-point)
1778 ;; comint-last-input-end
1779 (when (and comint-last-input-end
1780 (equal (marker-position comint-last-input-end)
1781 (point)))
1782 (set-marker comint-last-input-end old-point))
1783 ;; No overlays we create are set to advance upon insertion
1784 ;; (at the start/end), so we assume that any overlay which
1785 ;; is at the current point was incorrectly advanced by
1786 ;; insert-before-markers. First fixup overlays that might
1787 ;; start at point:
1788 (dolist (over (overlays-at (point)))
1789 (when (= (overlay-start over) (point))
1790 (let ((end (overlay-end over)))
1791 (move-overlay over
1792 old-point
1793 (if (= end (point)) old-point end)))))
1794 ;; Then do overlays that might end at point:
1795 (dolist (over (overlays-at (1- (point))))
1796 (when (= (overlay-end over) (point))
1797 (move-overlay over
1798 (min (overlay-start over) old-point)
1799 old-point))))
1800 1762
1801 ;; Advance process-mark 1763 ;; Advance process-mark
1802 (set-marker (process-mark process) (point)) 1764 (set-marker (process-mark process) (point))
1803 1765
1804 (unless comint-inhibit-carriage-motion 1766 (unless comint-inhibit-carriage-motion