(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.
\f
* 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.
2008-06-10 Stefan Monnier <monnier@iro.umontreal.ca>
+ * 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 <lekktu@gmail.com>
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))
(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))
(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))
(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
(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))
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))
(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"))
(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
(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
(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)
+2008-06-10 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * 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 <handa@m17n.org>
* 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.
+ (font_parse_xlfd, font_parse_fcname, font_parse_family_registry):
+ Adjust for the change of font_intern_prop.
- * w32uniscribe.c (add_opentype_font_name_to_list): Adjusted for
+ * 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 <lekktu@gmail.com>
2008-06-09 Jason Rumney <jasonr@gnu.org>
- * w32term.c (x_make_frame_visible): Use alternate restore flags.
+ * 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.
+ * 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.
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;
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. */
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);
}
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.