diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 44 |
2 files changed, 33 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9e564ea6414..d3f667e6374 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2015-02-01 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * xdisp.c (Fwindow_text_pixel_size): Add optional argument BUFFER. | ||
| 4 | |||
| 1 | 2015-01-31 Eli Zaretskii <eliz@gnu.org> | 5 | 2015-01-31 Eli Zaretskii <eliz@gnu.org> |
| 2 | 6 | ||
| 3 | * coding.c (raw_text_coding_system_p): New function. | 7 | * coding.c (raw_text_coding_system_p): New function. |
diff --git a/src/xdisp.c b/src/xdisp.c index 68c0fa54572..8f6695ae2b0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9650,7 +9650,7 @@ in_display_vector_p (struct it *it) | |||
| 9650 | && it->dpvec + it->current.dpvec_index != it->dpend); | 9650 | && it->dpvec + it->current.dpvec_index != it->dpend); |
| 9651 | } | 9651 | } |
| 9652 | 9652 | ||
| 9653 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, | 9653 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 7, 0, |
| 9654 | doc: /* Return the size of the text of WINDOW's buffer in pixels. | 9654 | doc: /* Return the size of the text of WINDOW's buffer in pixels. |
| 9655 | WINDOW must be a live window and defaults to the selected one. The | 9655 | WINDOW must be a live window and defaults to the selected one. The |
| 9656 | return value is a cons of the maximum pixel-width of any text line and | 9656 | return value is a cons of the maximum pixel-width of any text line and |
| @@ -9683,28 +9683,42 @@ Optional argument MODE-AND-HEADER-LINE nil or omitted means do not | |||
| 9683 | include the height of the mode- or header-line of WINDOW in the return | 9683 | include the height of the mode- or header-line of WINDOW in the return |
| 9684 | value. If it is either the symbol `mode-line' or `header-line', include | 9684 | value. If it is either the symbol `mode-line' or `header-line', include |
| 9685 | only the height of that line, if present, in the return value. If t, | 9685 | only the height of that line, if present, in the return value. If t, |
| 9686 | include the height of both, if present, in the return value. */) | 9686 | include the height of both, if present, in the return value. |
| 9687 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, Lisp_Object y_limit, | 9687 | |
| 9688 | Lisp_Object mode_and_header_line) | 9688 | Optional argument BUFFER nil means to return the size of the text of |
| 9689 | WINDOW's buffer. BUFFER t means to return the size of the text of the | ||
| 9690 | current buffer as if it were displayed in WINDOW. Else BUFFER has to | ||
| 9691 | specify a live buffer and this function returns the size of the text of | ||
| 9692 | BUFFER as if it were displayed in WINDOW. */) | ||
| 9693 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, | ||
| 9694 | Lisp_Object y_limit, Lisp_Object mode_and_header_line, Lisp_Object buffer) | ||
| 9689 | { | 9695 | { |
| 9690 | struct window *w = decode_live_window (window); | 9696 | struct window *w = decode_live_window (window); |
| 9691 | Lisp_Object buf; | ||
| 9692 | struct buffer *b; | 9697 | struct buffer *b; |
| 9693 | struct it it; | 9698 | struct it it; |
| 9694 | struct buffer *old_buffer = NULL; | 9699 | struct buffer *old_b = NULL; |
| 9695 | ptrdiff_t start, end, pos; | 9700 | ptrdiff_t start, end, pos; |
| 9696 | struct text_pos startp; | 9701 | struct text_pos startp; |
| 9697 | void *itdata = NULL; | 9702 | void *itdata = NULL; |
| 9698 | int c, max_y = -1, x = 0, y = 0; | 9703 | int c, max_y = -1, x = 0, y = 0; |
| 9699 | 9704 | ||
| 9700 | buf = w->contents; | 9705 | if (EQ (buffer, Qt)) |
| 9701 | CHECK_BUFFER (buf); | 9706 | b = current_buffer; |
| 9702 | b = XBUFFER (buf); | 9707 | else |
| 9703 | |||
| 9704 | if (b != current_buffer) | ||
| 9705 | { | 9708 | { |
| 9706 | old_buffer = current_buffer; | 9709 | if (NILP (buffer)) |
| 9707 | set_buffer_internal (b); | 9710 | buffer = w->contents; |
| 9711 | |||
| 9712 | CHECK_BUFFER (buffer); | ||
| 9713 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) | ||
| 9714 | error ("Not a live buffer"); | ||
| 9715 | |||
| 9716 | b = XBUFFER (buffer); | ||
| 9717 | if (b != current_buffer) | ||
| 9718 | { | ||
| 9719 | old_b = current_buffer; | ||
| 9720 | set_buffer_internal (b); | ||
| 9721 | } | ||
| 9708 | } | 9722 | } |
| 9709 | 9723 | ||
| 9710 | if (NILP (from)) | 9724 | if (NILP (from)) |
| @@ -9780,8 +9794,8 @@ include the height of both, if present, in the return value. */) | |||
| 9780 | 9794 | ||
| 9781 | bidi_unshelve_cache (itdata, 0); | 9795 | bidi_unshelve_cache (itdata, 0); |
| 9782 | 9796 | ||
| 9783 | if (old_buffer) | 9797 | if (old_b) |
| 9784 | set_buffer_internal (old_buffer); | 9798 | set_buffer_internal (old_b); |
| 9785 | 9799 | ||
| 9786 | return Fcons (make_number (x), make_number (y)); | 9800 | return Fcons (make_number (x), make_number (y)); |
| 9787 | } | 9801 | } |