# HG changeset patch # User Stefan Monnier # Date 1213114128 0 # Node ID edc51d72cb1783793e30a7cbbc3917f4ff065e3e # Parent dc7fbbea402ea9d48e3b0abe6ea2fc7661dca961 * 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. diff -r dc7fbbea402e -r edc51d72cb17 etc/NEWS --- a/etc/NEWS Tue Jun 10 14:17:32 2008 +0000 +++ b/etc/NEWS Tue Jun 10 16:08:48 2008 +0000 @@ -826,6 +826,9 @@ * Lisp Changes in Emacs 23.1 +** The variable window-point-insertion-type determines the insertion-type +of the marker used for window-point. + ** minibuffer-local-must-match-filename-map is now named minibuffer-local-filename-must-match-map. diff -r dc7fbbea402e -r edc51d72cb17 lisp/ChangeLog --- a/lisp/ChangeLog Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/ChangeLog Tue Jun 10 16:08:48 2008 +0000 @@ -1,5 +1,16 @@ 2008-06-10 Stefan Monnier + * 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. 2008-06-10 Juanma Barranquero diff -r dc7fbbea402e -r edc51d72cb17 lisp/comint.el --- a/lisp/comint.el Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/comint.el Tue Jun 10 16:08:48 2008 +0000 @@ -618,6 +618,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'." (setq mode-line-process '(":%s")) + (set (make-local-variable 'window-point-insertion-type) t) (set (make-local-variable 'comint-last-input-start) (point-min-marker)) (set (make-local-variable 'comint-last-input-end) (point-min-marker)) (set (make-local-variable 'comint-last-output-start) (make-marker)) @@ -1755,48 +1756,9 @@ (set-marker comint-last-output-start (point)) ;; insert-before-markers is a bad thing. XXX - ;; - ;; It is used here to force window-point markers (used to - ;; store the value of point in non-selected windows) to - ;; advance, but it also screws up any other markers that we - ;; don't _want_ to advance, such as the start-marker of some - ;; of the overlays we create. - ;; - ;; We work around the problem with the overlays by - ;; explicitly adjusting them after we do the insertion, but - ;; in the future this problem should be solved correctly, by - ;; using `insert', and making the insertion-type of - ;; window-point markers settable (via a buffer-local - ;; variable). In comint buffers, this variable would be set - ;; to `t', to cause point in non-select windows to advance. - (insert-before-markers string) - ;; Fixup markers and overlays that got screwed up because we - ;; used `insert-before-markers'. - (let ((old-point (- (point) (length string)))) - ;; comint-last-output-start - (set-marker comint-last-output-start old-point) - ;; comint-last-input-end - (when (and comint-last-input-end - (equal (marker-position comint-last-input-end) - (point))) - (set-marker comint-last-input-end old-point)) - ;; No overlays we create are set to advance upon insertion - ;; (at the start/end), so we assume that any overlay which - ;; is at the current point was incorrectly advanced by - ;; insert-before-markers. First fixup overlays that might - ;; start at point: - (dolist (over (overlays-at (point))) - (when (= (overlay-start over) (point)) - (let ((end (overlay-end over))) - (move-overlay over - old-point - (if (= end (point)) old-point end))))) - ;; Then do overlays that might end at point: - (dolist (over (overlays-at (1- (point)))) - (when (= (overlay-end over) (point)) - (move-overlay over - (min (overlay-start over) old-point) - old-point)))) + ;; Luckily we don't have to use it any more, we use + ;; window-point-insertion-type instead. + (insert string) ;; Advance process-mark (set-marker (process-mark process) (point)) diff -r dc7fbbea402e -r edc51d72cb17 lisp/emacs-lisp/trace.el --- a/lisp/emacs-lisp/trace.el Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/emacs-lisp/trace.el Tue Jun 10 16:08:48 2008 +0000 @@ -219,7 +219,8 @@ (trace-buffer (get-buffer-create ,buffer))) (unless inhibit-trace (with-current-buffer trace-buffer - ,(unless background '(display-buffer trace-buffer)) + (set (make-local-variable 'window-point-insertion-type) t) + ,(unless background '(display-buffer trace-buffer)) (goto-char (point-max)) ;; Insert a separator from previous trace output: (if (= trace-level 1) (insert trace-separator)) diff -r dc7fbbea402e -r edc51d72cb17 lisp/net/telnet.el --- a/lisp/net/telnet.el Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/net/telnet.el Tue Jun 10 16:08:48 2008 +0000 @@ -159,8 +159,7 @@ (comint-send-string proc telnet-new-line))) (defun telnet-filter (proc string) - (save-excursion - (set-buffer (process-buffer proc)) + (with-current-buffer (process-buffer proc) (let* ((last-insertion (marker-position (process-mark proc))) (delta (- (point) last-insertion)) (ie (and comint-last-input-end @@ -168,7 +167,7 @@ (w (get-buffer-window (current-buffer))) (ws (and w (window-start w)))) (goto-char last-insertion) - (insert-before-markers string) + (insert string) (set-marker comint-last-output-start last-insertion) (set-marker (process-mark proc) (point)) (if ws (set-window-start w ws t)) @@ -245,6 +244,7 @@ There is a variable ``telnet-interrupt-string'' which is the character sent to try to stop execution of a job on the remote host. Data is sent to the remote host when RET is typed." + (set (make-local-variable 'window-point-insertion-type) t) (set (make-local-variable 'comint-prompt-regexp) telnet-prompt-pattern) (set (make-local-variable 'comint-use-prompt-regexp) t)) diff -r dc7fbbea402e -r edc51d72cb17 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/progmodes/compile.el Tue Jun 10 16:08:48 2008 +0000 @@ -1467,6 +1467,8 @@ (interactive) (kill-all-local-variables) (use-local-map compilation-mode-map) + ;; Let windows scroll along with the output. + (set (make-local-variable 'window-point-insertion-type) t) (set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map) (setq major-mode 'compilation-mode mode-name (or name-of-mode "Compilation")) @@ -1663,13 +1665,16 @@ (defun compilation-filter (proc string) "Process filter for compilation buffers. -Just inserts the text, but uses `insert-before-markers'." - (if (buffer-name (process-buffer proc)) +Just inserts the text, and runs `compilation-filter-hook'." + (if (buffer-live-p (process-buffer proc)) (with-current-buffer (process-buffer proc) (let ((inhibit-read-only t)) (save-excursion (goto-char (process-mark proc)) - (insert-before-markers string) + ;; We used to use `insert-before-markers', so that windows with + ;; point at `process-mark' scroll along with the output, but we + ;; now use window-point-insertion-type instead. + (insert string) (run-hooks 'compilation-filter-hook)))))) ;;; test if a buffer is a compilation buffer, assuming we're in the buffer diff -r dc7fbbea402e -r edc51d72cb17 lisp/startup.el --- a/lisp/startup.el Tue Jun 10 14:17:32 2008 +0000 +++ b/lisp/startup.el Tue Jun 10 16:08:48 2008 +0000 @@ -396,10 +396,12 @@ (if command-line-processed (message "Back to top level.") (setq command-line-processed t) - ;; Give *Messages* the same default-directory as *scratch*, - ;; just to keep things predictable. (let ((dir default-directory)) (with-current-buffer "*Messages*" + ;; Make it easy to do like "tail -f". + (set (make-local-variable 'window-point-insertion-type) t) + ;; Give *Messages* the same default-directory as *scratch*, + ;; just to keep things predictable. (setq default-directory dir))) ;; `user-full-name' is now known; reset its standard-value here. (put 'user-full-name 'standard-value @@ -994,8 +996,7 @@ (setq init-file-had-error nil)) (error (let ((message-log-max nil)) - (save-excursion - (set-buffer (get-buffer-create "*Messages*")) + (with-current-buffer (get-buffer-create "*Messages*") (insert "\n\n" (format "An error has occurred while loading `%s':\n\n" user-init-file) diff -r dc7fbbea402e -r edc51d72cb17 src/ChangeLog --- a/src/ChangeLog Tue Jun 10 14:17:32 2008 +0000 +++ b/src/ChangeLog Tue Jun 10 16:08:48 2008 +0000 @@ -1,21 +1,21 @@ +2008-06-10 Stefan Monnier + + * window.c (Vwindow_point_insertion_type): New var. + (set_window_buffer): Use it. + (syms_of_window): Init and export it to Lisp. + 2008-06-10 Kenichi Handa * font.h (font_intern_prop): Prototype adjusted. * font.c (font_intern_prop): New arg force_symbol. - (font_parse_xlfd): Adjusted for the change of font_intern_prop. - (font_parse_fcname): Likewise. - (font_parse_family_registry): Likewise. - - * ftfont.c (ftfont_pattern_entity): Adjusted for the change of - font_intern_prop. - - * w32font.c (add_font_name_to_list): Adjusted for - the change of font_intern_prop. - (w32_enumfont_pattern_entity): Likewise. - (w32_registry): Likewise. - - * w32uniscribe.c (add_opentype_font_name_to_list): Adjusted for + (font_parse_xlfd, font_parse_fcname, font_parse_family_registry): + Adjust for the change of font_intern_prop. + + * ftfont.c (ftfont_pattern_entity): + * w32font.c (add_font_name_to_list, w32_enumfont_pattern_entity) + (w32_registry): + * w32uniscribe.c (add_opentype_font_name_to_list): Adjust for the change of font_intern_prop. 2008-06-09 Juanma Barranquero @@ -24,15 +24,15 @@ 2008-06-09 Jason Rumney - * w32term.c (x_make_frame_visible): Use alternate restore flags. - - * w32menu.c (Fx_popup_menu): Unwind protect while building menu. - (parse_single_submenu): Remove. - (digest_single_submenu): Remove. - (syms_of_w32menu): Don't initialise variables that have moved - to menu.c. - (set_frame_menubar): Sync with version in xmenu.c. - (w32_menu_show): Sync with xmenu_show in xmenu.c. + * w32term.c (x_make_frame_visible): Use alternate restore flags. + + * w32menu.c (Fx_popup_menu): Unwind protect while building menu. + (parse_single_submenu): Remove. + (digest_single_submenu): Remove. + (syms_of_w32menu): Don't initialise variables that have moved + to menu.c. + (set_frame_menubar): Sync with version in xmenu.c. + (w32_menu_show): Sync with xmenu_show in xmenu.c. * menu.c (single_keymap_panes, push_menu_pane, push_menu_item): Make static again. diff -r dc7fbbea402e -r edc51d72cb17 src/window.c --- a/src/window.c Tue Jun 10 14:17:32 2008 +0000 +++ b/src/window.c Tue Jun 10 16:08:48 2008 +0000 @@ -167,6 +167,10 @@ Lisp_Object Vscroll_preserve_screen_position; +/* Non-nil means that text is inserted before window's markers. */ + +Lisp_Object Vwindow_point_insertion_type; + /* Incremented by 1 whenever a window is deleted. */ int window_deletion_count; @@ -3420,6 +3424,8 @@ Fset_buffer (buffer); } + XMARKER (w->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type); + if (!keep_margins_p) { /* Set left and right marginal area width etc. from buffer. */ @@ -3486,9 +3492,11 @@ else if (! EQ (tem, Qt)) /* w->buffer is t when the window is first being set up. */ { - if (!NILP (w->dedicated) && !EQ (tem, buffer)) - error ("Window is dedicated to `%s'", - SDATA (XBUFFER (tem)->name)); + if (!EQ (tem, buffer)) + if (EQ (w->dedicated, Qt)) + error ("Window is dedicated to `%s'", SDATA (XBUFFER (tem)->name)); + else + w->dedicated = Qnil; unshow_buffer (w); } @@ -7151,6 +7159,10 @@ Any other value means point always keeps its screen position. */); Vscroll_preserve_screen_position = Qnil; + DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, + doc: /* Type of marker to use for `window-point'. */); + Vwindow_point_insertion_type = Qnil; + DEFVAR_LISP ("window-configuration-change-hook", &Vwindow_configuration_change_hook, doc: /* Functions to call when window configuration changes.