From cda219c3df688cb54b20bf8d061dac56b8f754be Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Dec 2017 15:21:21 +0200 Subject: [PATCH] Improve interactive debugging commands in xdisp.c * src/xdisp.c (Fdump_glyph_row, Fdump_tool_bar_row): Allow to specify ROW via prefix argument. Fix the doc strings. --- src/xdisp.c | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 3de57dbcd19..0a37013c560 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19479,19 +19479,34 @@ Only text-mode frames have frame glyph matrices. */) } -DEFUN ("dump-glyph-row", Fdump_glyph_row, Sdump_glyph_row, 1, 2, "", +DEFUN ("dump-glyph-row", Fdump_glyph_row, Sdump_glyph_row, 1, 2, "P", doc: /* Dump glyph row ROW to stderr. -GLYPH 0 means don't dump glyphs. -GLYPH 1 means dump glyphs in short form. -GLYPH > 1 or omitted means dump glyphs in long form. */) +Interactively, ROW is the prefix numeric argument and defaults to +the row which displays point. +Optional argument GLYPHS 0 means don't dump glyphs. +GLYPHS 1 means dump glyphs in short form. +GLYPHS > 1 or omitted means dump glyphs in long form. */) (Lisp_Object row, Lisp_Object glyphs) { struct glyph_matrix *matrix; EMACS_INT vpos; - CHECK_NUMBER (row); + if (NILP (row)) + { + int d1, d2, d3, d4, d5, ypos; + bool visible_p = pos_visible_p (XWINDOW (selected_window), PT, + &d1, &d2, &d3, &d4, &d5, &ypos); + if (visible_p) + vpos = ypos; + else + vpos = 0; + } + else + { + CHECK_NUMBER (row); + vpos = XINT (row); + } matrix = XWINDOW (selected_window)->current_matrix; - vpos = XINT (row); if (vpos >= 0 && vpos < matrix->nrows) dump_glyph_row (MATRIX_ROW (matrix, vpos), vpos, @@ -19500,11 +19515,12 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) } -DEFUN ("dump-tool-bar-row", Fdump_tool_bar_row, Sdump_tool_bar_row, 1, 2, "", +DEFUN ("dump-tool-bar-row", Fdump_tool_bar_row, Sdump_tool_bar_row, 1, 2, "P", doc: /* Dump glyph row ROW of the tool-bar of the current frame to stderr. -GLYPH 0 means don't dump glyphs. -GLYPH 1 means dump glyphs in short form. -GLYPH > 1 or omitted means dump glyphs in long form. +Interactively, ROW is the prefix numeric argument and defaults to zero. +GLYPHS 0 means don't dump glyphs. +GLYPHS 1 means dump glyphs in short form. +GLYPHS > 1 or omitted means dump glyphs in long form. If there's no tool-bar, or if the tool-bar is not drawn by Emacs, do nothing. */) @@ -19515,8 +19531,13 @@ do nothing. */) struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; EMACS_INT vpos; - CHECK_NUMBER (row); - vpos = XINT (row); + if (NILP (row)) + vpos = 0; + else + { + CHECK_NUMBER (row); + vpos = XINT (row); + } if (vpos >= 0 && vpos < m->nrows) dump_glyph_row (MATRIX_ROW (m, vpos), vpos, TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2); -- 2.39.2