[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109720: For selected window have (se
From: |
martin rudalics |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109720: For selected window have (set-)window-point always operate on buffer's point. |
Date: |
Tue, 21 Aug 2012 11:27:07 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109720
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-21 11:27:07 +0200
message:
For selected window have (set-)window-point always operate on buffer's point.
* window.c (Fwindow_point): For the selected window always return
the position of its buffer's point.
(Fset_window_point): For the selected window always go in its
buffer to the specified position.
* window.el (window-point-1, set-window-point-1): Remove.
(window-in-direction, record-window-buffer)
(set-window-buffer-start-and-point, split-window-below)
(window--state-get-1, display-buffer-record-window): Replace
calls to window-point-1 and set-window-point-1 by calls to
window-point and set-window-point respectively.
modified:
lisp/ChangeLog
lisp/window.el
src/ChangeLog
src/window.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-08-21 07:59:25 +0000
+++ b/lisp/ChangeLog 2012-08-21 09:27:07 +0000
@@ -1,3 +1,12 @@
+2012-08-21 Martin Rudalics <address@hidden>
+
+ * window.el (window-point-1, set-window-point-1): Remove.
+ (window-in-direction, record-window-buffer)
+ (set-window-buffer-start-and-point, split-window-below)
+ (window--state-get-1, display-buffer-record-window): Replace
+ calls to window-point-1 and set-window-point-1 by calls to
+ window-point and set-window-point respectively.
+
2012-08-21 Glenn Morris <address@hidden>
* calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday):
=== modified file 'lisp/window.el'
--- a/lisp/window.el 2012-08-17 06:01:17 +0000
+++ b/lisp/window.el 2012-08-21 09:27:07 +0000
@@ -1062,32 +1062,6 @@
(dolist (walk-windows-window (window-list-1 nil minibuf all-frames))
(funcall fun walk-windows-window))))
-(defun window-point-1 (&optional window)
- "Return value of WINDOW's point.
-WINDOW can be any live window and defaults to the selected one.
-
-This function is like `window-point' with one exception: If
-WINDOW is selected, it returns the value of `point' of WINDOW's
-buffer regardless of whether that buffer is current or not."
- (setq window (window-normalize-window window t))
- (if (eq window (selected-window))
- (with-current-buffer (window-buffer window)
- (point))
- (window-point window)))
-
-(defun set-window-point-1 (window pos)
- "Set value of WINDOW's point to POS.
-WINDOW can be any live window and defaults to the selected one.
-
-This function is like `set-window-point' with one exception: If
-WINDOW is selected, it moves `point' of WINDOW's buffer to POS
-regardless of whether that buffer is current or not."
- (setq window (window-normalize-window window t))
- (if (eq window (selected-window))
- (with-current-buffer (window-buffer window)
- (goto-char pos))
- (set-window-point window pos)))
-
(defun window-at-side-p (&optional window side)
"Return t if WINDOW is at SIDE of its containing frame.
WINDOW must be a valid window and defaults to the selected one.
@@ -1146,7 +1120,7 @@
(last (+ first (if hor
(window-total-width window)
(window-total-height window))))
- (posn-cons (nth 6 (posn-at-point (window-point-1 window) window)))
+ (posn-cons (nth 6 (posn-at-point (window-point window) window)))
;; The column / row value of `posn-at-point' can be nil for the
;; mini-window, guard against that.
(posn (if hor
@@ -2613,7 +2587,7 @@
;; Add an entry for buffer to WINDOW's previous buffers.
(with-current-buffer buffer
(let ((start (window-start window))
- (point (window-point-1 window)))
+ (point (window-point window)))
(setq entry
(cons buffer
(if entry
@@ -2657,7 +2631,7 @@
;; Don't force window-start here (even if POINT is nil).
(set-window-start window start t))
(when point
- (set-window-point-1 window point))))
+ (set-window-point window point))))
(defcustom switch-to-visible-buffer t
"If non-nil, allow switching to an already visible buffer.
@@ -3393,7 +3367,7 @@
amount of redisplay; this is convenient on slow terminals."
(interactive "P")
(let ((old-window (selected-window))
- (old-point (window-point-1))
+ (old-point (window-point))
(size (and size (prefix-numeric-value size)))
moved-by-window-height moved new-window bottom)
(when (and size (< size 0) (< (- size) window-min-height))
@@ -3418,7 +3392,7 @@
(setq bottom (point)))
(and moved-by-window-height
(<= bottom (point))
- (set-window-point-1 old-window (1- bottom)))
+ (set-window-point old-window (1- bottom)))
(and moved-by-window-height
(<= (window-start new-window) old-point)
(set-window-point new-window old-point)
@@ -3727,7 +3701,7 @@
`((parameters . ,list))))
,@(when buffer
;; All buffer related things go in here.
- (let ((point (window-point-1 window))
+ (let ((point (window-point window))
(start (window-start window)))
`((buffer
,(buffer-name buffer)
@@ -4020,7 +3994,7 @@
(list 'other
;; A quadruple of WINDOW's buffer, start, point and height.
(list (window-buffer window) (window-start window)
- (window-point-1 window) (window-total-size window))
+ (window-point window) (window-total-size window))
(selected-window) buffer))))
((eq type 'window)
;; WINDOW has been created on an existing frame.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-08-21 04:46:05 +0000
+++ b/src/ChangeLog 2012-08-21 09:27:07 +0000
@@ -1,3 +1,10 @@
+2012-08-21 Martin Rudalics <address@hidden>
+
+ * window.c (Fwindow_point): For the selected window always return
+ the position of its buffer's point.
+ (Fset_window_point): For the selected window always go in its
+ buffer to the specified position.
+
2012-08-21 Dmitry Antipov <address@hidden>
Setter macros for fontsets.
=== modified file 'src/window.c'
--- a/src/window.c 2012-08-20 09:28:39 +0000
+++ b/src/window.c 2012-08-21 09:27:07 +0000
@@ -1407,22 +1407,21 @@
doc: /* Return current value of point in WINDOW.
WINDOW must be a live window and defaults to the selected one.
-For a nonselected window, this is the value point would have
-if that window were selected.
+For a nonselected window, this is the value point would have if that
+window were selected.
-Note that, when WINDOW is the selected window and its buffer
-is also currently selected, the value returned is the same as (point).
-It would be more strictly correct to return the `top-level' value
-of point, outside of any save-excursion forms.
-But that is hard to define. */)
+Note that, when WINDOW is selected, the value returned is the same as
+that returned by `point' for WINDOW's buffer. It would be more strictly
+correct to return the `top-level' value of `point', outside of any
+`save-excursion' forms. But that is hard to define. */)
(Lisp_Object window)
{
register struct window *w = decode_live_window (window);
- if (w == XWINDOW (selected_window)
- && current_buffer == XBUFFER (w->buffer))
- return Fpoint ();
- return Fmarker_position (w->pointm);
+ if (w == XWINDOW (selected_window))
+ return make_number (BUF_PT (XBUFFER (w->buffer)));
+ else
+ return Fmarker_position (w->pointm);
}
DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1532,16 +1531,27 @@
register struct window *w = decode_live_window (window);
CHECK_NUMBER_COERCE_MARKER (pos);
- if (w == XWINDOW (selected_window)
- && XBUFFER (w->buffer) == current_buffer)
- Fgoto_char (pos);
+
+ if (w == XWINDOW (selected_window))
+ {
+ if (XBUFFER (w->buffer) == current_buffer)
+ Fgoto_char (pos);
+ else
+ {
+ struct buffer *old_buffer = current_buffer;
+
+ set_buffer_internal (XBUFFER (w->buffer));
+ Fgoto_char (pos);
+ set_buffer_internal (old_buffer);
+ }
+ }
else
- set_marker_restricted (w->pointm, pos, w->buffer);
-
- /* We have to make sure that redisplay updates the window to show
- the new value of point. */
- if (!EQ (window, selected_window))
- ++windows_or_buffers_changed;
+ {
+ set_marker_restricted (w->pointm, pos, w->buffer);
+ /* We have to make sure that redisplay updates the window to show
+ the new value of point. */
+ ++windows_or_buffers_changed;
+ }
return pos;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109720: For selected window have (set-)window-point always operate on buffer's point.,
martin rudalics <=