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 5635e1b5e8f..d45b4e332c6 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-02-01 Joakim Verona <joakim@verona.se> | 5 | 2015-02-01 Joakim Verona <joakim@verona.se> |
| 2 | Support for the new Xwidget feature. | 6 | Support for the new Xwidget feature. |
| 3 | * window.c, Makefile.in, buffer.c, dispextern.h, dispnew.c, emacs.c: | 7 | * window.c, Makefile.in, buffer.c, dispextern.h, dispnew.c, emacs.c: |
diff --git a/src/xdisp.c b/src/xdisp.c index 01d598fe2c2..2da6c7676df 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9703,7 +9703,7 @@ in_display_vector_p (struct it *it) | |||
| 9703 | && it->dpvec + it->current.dpvec_index != it->dpend); | 9703 | && it->dpvec + it->current.dpvec_index != it->dpend); |
| 9704 | } | 9704 | } |
| 9705 | 9705 | ||
| 9706 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, | 9706 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 7, 0, |
| 9707 | doc: /* Return the size of the text of WINDOW's buffer in pixels. | 9707 | doc: /* Return the size of the text of WINDOW's buffer in pixels. |
| 9708 | WINDOW must be a live window and defaults to the selected one. The | 9708 | WINDOW must be a live window and defaults to the selected one. The |
| 9709 | return value is a cons of the maximum pixel-width of any text line and | 9709 | return value is a cons of the maximum pixel-width of any text line and |
| @@ -9736,28 +9736,42 @@ Optional argument MODE-AND-HEADER-LINE nil or omitted means do not | |||
| 9736 | include the height of the mode- or header-line of WINDOW in the return | 9736 | include the height of the mode- or header-line of WINDOW in the return |
| 9737 | value. If it is either the symbol `mode-line' or `header-line', include | 9737 | value. If it is either the symbol `mode-line' or `header-line', include |
| 9738 | only the height of that line, if present, in the return value. If t, | 9738 | only the height of that line, if present, in the return value. If t, |
| 9739 | include the height of both, if present, in the return value. */) | 9739 | include the height of both, if present, in the return value. |
| 9740 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, Lisp_Object y_limit, | 9740 | |
| 9741 | Lisp_Object mode_and_header_line) | 9741 | Optional argument BUFFER nil means to return the size of the text of |
| 9742 | WINDOW's buffer. BUFFER t means to return the size of the text of the | ||
| 9743 | current buffer as if it were displayed in WINDOW. Else BUFFER has to | ||
| 9744 | specify a live buffer and this function returns the size of the text of | ||
| 9745 | BUFFER as if it were displayed in WINDOW. */) | ||
| 9746 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, | ||
| 9747 | Lisp_Object y_limit, Lisp_Object mode_and_header_line, Lisp_Object buffer) | ||
| 9742 | { | 9748 | { |
| 9743 | struct window *w = decode_live_window (window); | 9749 | struct window *w = decode_live_window (window); |
| 9744 | Lisp_Object buf; | ||
| 9745 | struct buffer *b; | 9750 | struct buffer *b; |
| 9746 | struct it it; | 9751 | struct it it; |
| 9747 | struct buffer *old_buffer = NULL; | 9752 | struct buffer *old_b = NULL; |
| 9748 | ptrdiff_t start, end, pos; | 9753 | ptrdiff_t start, end, pos; |
| 9749 | struct text_pos startp; | 9754 | struct text_pos startp; |
| 9750 | void *itdata = NULL; | 9755 | void *itdata = NULL; |
| 9751 | int c, max_y = -1, x = 0, y = 0; | 9756 | int c, max_y = -1, x = 0, y = 0; |
| 9752 | 9757 | ||
| 9753 | buf = w->contents; | 9758 | if (EQ (buffer, Qt)) |
| 9754 | CHECK_BUFFER (buf); | 9759 | b = current_buffer; |
| 9755 | b = XBUFFER (buf); | 9760 | else |
| 9756 | |||
| 9757 | if (b != current_buffer) | ||
| 9758 | { | 9761 | { |
| 9759 | old_buffer = current_buffer; | 9762 | if (NILP (buffer)) |
| 9760 | set_buffer_internal (b); | 9763 | buffer = w->contents; |
| 9764 | |||
| 9765 | CHECK_BUFFER (buffer); | ||
| 9766 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) | ||
| 9767 | error ("Not a live buffer"); | ||
| 9768 | |||
| 9769 | b = XBUFFER (buffer); | ||
| 9770 | if (b != current_buffer) | ||
| 9771 | { | ||
| 9772 | old_b = current_buffer; | ||
| 9773 | set_buffer_internal (b); | ||
| 9774 | } | ||
| 9761 | } | 9775 | } |
| 9762 | 9776 | ||
| 9763 | if (NILP (from)) | 9777 | if (NILP (from)) |
| @@ -9833,8 +9847,8 @@ include the height of both, if present, in the return value. */) | |||
| 9833 | 9847 | ||
| 9834 | bidi_unshelve_cache (itdata, 0); | 9848 | bidi_unshelve_cache (itdata, 0); |
| 9835 | 9849 | ||
| 9836 | if (old_buffer) | 9850 | if (old_b) |
| 9837 | set_buffer_internal (old_buffer); | 9851 | set_buffer_internal (old_b); |
| 9838 | 9852 | ||
| 9839 | return Fcons (make_number (x), make_number (y)); | 9853 | return Fcons (make_number (x), make_number (y)); |
| 9840 | } | 9854 | } |