along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include "config.h"
+#include <config.h>
#include "lisp.h"
#include "buffer.h"
#include "frame.h"
register int posint;
register struct buffer *buf;
struct position posval;
+ int hscroll;
if (NILP (pos))
posint = point;
w = decode_window (window);
top = marker_position (w->start);
+ hscroll = XINT (w->hscroll);
if (posint < top)
return Qnil;
}
else
{
- if (posint > BUF_Z (buf))
+ if (posint > BUF_ZV (buf))
return Qnil;
/* If that info is not correct, calculate afresh */
- posval = *compute_motion (top, 0, 0, posint, height, 0,
+ posval = *compute_motion (top, 0, (hscroll ? 1 - hscroll : 0),
+ posint, height, 0,
window_internal_width (w) - 1,
- XINT (w->hscroll), 0);
+ hscroll, 0);
return posval.vpos < height ? Qt : Qnil;
}
DELETE_OTHER_WINDOWS, /* Arg is window not to delete */
DELETE_BUFFER_WINDOWS, /* Arg is buffer */
GET_LARGEST_WINDOW,
- UNSHOW_BUFFER, /* Arg is buffer */
+ UNSHOW_BUFFER /* Arg is buffer */
};
static Lisp_Object
new_buffer
= Fget_buffer_create (build_string ("*scratch*"));
Fset_window_buffer (w, new_buffer);
- Fset_buffer (XWINDOW (w)->buffer);
+ if (EQ (w, selected_window))
+ Fset_buffer (XWINDOW (w)->buffer);
}
else
Fdelete_window (w);
}
DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on,
- 1, 1, "bDelete windows on (buffer): ",
+ 1, 2, "bDelete windows on (buffer): ",
"Delete all windows showing BUFFER.\n\
Optional second argument FRAME controls which frames are affected.\n\
If nil or omitted, delete all windows showing BUFFER in any frame.\n\
If BUFFER is shown already in some window, just use that one,\n\
unless the window is the selected window and the optional second\n\
argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\
+If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\
Returns the window displaying BUFFER.")
(buffer, not_this_window)
register Lisp_Object buffer, not_this_window;
&& XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
return selected_window;
- window = Fget_buffer_window (buffer, Qnil);
+ /* If pop_up_frames, look for a window on any frame, showing BUFFER. */
+ window = Fget_buffer_window (buffer, pop_up_frames ? Qt : Qnil);
if (!NILP (window)
&& (NILP (not_this_window) || !EQ (window, selected_window)))
return window;