From: Stefan Monnier Date: Mon, 10 Nov 2014 02:58:52 +0000 (-0500) Subject: * lisp/help.el (view-lossage): Include the actual commands run. X-Git-Tag: emacs-25.0.90~2635^2~509 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eca1ea96559e04e18a62a61208d501c557dd4cab;p=emacs.git * lisp/help.el (view-lossage): Include the actual commands run. * src/keyboard.c (command_loop_1): Record this-command in recent-keys. (Frecent_keys): Rewrite. and add optional `include-cmds' arg. --- diff --git a/etc/NEWS b/etc/NEWS index ee6b63b69ed..f838fa1c5dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -49,6 +49,8 @@ Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to. * Changes in Emacs 25.1 +** C-h l now also lists the commands that were run. + ** M-x suggests shorthands and ignores obsolete commands for completion. ** x-select-enable-clipboard is renamed select-enable-clipboard. x-select-enable-primary and renamed select-enable-primary. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 572de2ed950..94473f03b7f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-10 Stefan Monnier + + * help.el (view-lossage): Include the actual commands run. + 2014-11-10 Dmitry Gutov * vc/vc-dir.el (vc-dir-hide-state): Also hide `ignored' items when @@ -5,8 +9,8 @@ 2014-11-09 Eric Ludlam - * emacs-lisp/eieio-custom.el (eieio-customize-object): Set - eieio-cog (current group) to g, which is an improved form of input + * emacs-lisp/eieio-custom.el (eieio-customize-object): + Set eieio-cog (current group) to g, which is an improved form of input group. 2014-11-09 Juri Linkov @@ -14,8 +18,8 @@ * isearch.el (isearch-message-prefix): Show "Multi-file" and "Multi-buffer" instead of "Multi". (Bug#13592) - * misearch.el (multi-isearch-file-list): Autoload - multi-isearch-buffer-list and multi-isearch-file-list. + * misearch.el (multi-isearch-file-list): + Autoload multi-isearch-buffer-list and multi-isearch-file-list. (multi-isearch-end): Reset multi-isearch-buffer-list and multi-isearch-file-list to nil. @@ -70,8 +74,8 @@ 2014-11-08 Alan Mackenzie Fix wrong bound to c-font-lock-declarators. Fixes bug #18948. - * progmodes/cc-fonts.el (c-font-lock-declarations): Pass - "(point-max)" as bound to c-font-lock-declarators, not "limit", as + * progmodes/cc-fonts.el (c-font-lock-declarations): + Pass "(point-max)" as bound to c-font-lock-declarators, not "limit", as the buffer is sometimes narrowed to less than "limit" (e.g., in the presence of macros). diff --git a/lisp/help.el b/lisp/help.el index 2da43d3ed48..eaee6d14736 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -448,25 +448,32 @@ is specified by the variable `message-log-max'." (info "(efaq)Packages that do not come with Emacs")) (defun view-lossage () - "Display last 300 input keystrokes. + "Display last few input keystrokes and the commands run. To record all your input, use `open-dribble-file'." (interactive) (help-setup-xref (list #'view-lossage) (called-interactively-p 'interactive)) (with-help-window (help-buffer) + (princ " ") (princ (mapconcat (lambda (key) - (if (or (integerp key) (symbolp key) (listp key)) - (single-key-description key) - (prin1-to-string key nil))) - (recent-keys) + (cond + ((and (consp key) (null (car key))) + (format "[%s]\n" (if (symbolp (cdr key)) (cdr key) + "anonymous-command"))) + ((or (integerp key) (symbolp key) (listp key)) + (single-key-description key)) + (t + (prin1-to-string key nil)))) + (recent-keys 'include-cmds) " ")) (with-current-buffer standard-output (goto-char (point-min)) - (while (progn (move-to-column 50) (not (eobp))) - (when (search-forward " " nil t) - (delete-char -1)) - (insert "\n")) + (while (not (eobp)) + (move-to-column 50) + (unless (eolp) + (fill-region (line-beginning-position) (line-end-position))) + (forward-line 1)) ;; jidanni wants to see the last keystrokes immediately. (set-marker help-window-point-marker (point))))) diff --git a/src/ChangeLog b/src/ChangeLog index 36f4dbdac66..b51f3c15a66 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-11-10 Stefan Monnier + + * keyboard.c (command_loop_1): Record this-command in recent-keys. + (Frecent_keys): Rewrite. and add optional `include-cmds' arg. + 2014-11-09 Jan Djärv * nsterm.m (ns_set_vertical_scroll_bar) diff --git a/src/keyboard.c b/src/keyboard.c index 24f47bfedc9..060784cf0af 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1534,6 +1534,13 @@ command_loop_1 (void) /* Execute the command. */ + { + total_keys += total_keys < NUM_RECENT_KEYS; + ASET (recent_keys, recent_keys_index, + Fcons (Qnil, cmd)); + if (++recent_keys_index >= NUM_RECENT_KEYS) + recent_keys_index = 0; + } Vthis_command = cmd; Vreal_this_command = cmd; safe_run_hooks (Qpre_command_hook); @@ -10048,23 +10055,34 @@ If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) ? Qt : Qnil); } -DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, - doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) - (void) +DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 1, 0, + doc: /* Return vector of last few events, not counting those from keyboard macros. +If INCLUDE-CMDS is non-nil, include the commands that were run, +represented as events of the form (nil . COMMAND). */) + (Lisp_Object include_cmds) { - Lisp_Object *keys = XVECTOR (recent_keys)->contents; - Lisp_Object val; + bool cmds = !NILP (include_cmds); - if (total_keys < NUM_RECENT_KEYS) - return Fvector (total_keys, keys); + if (!total_keys + || (cmds && total_keys < NUM_RECENT_KEYS)) + return Fvector (total_keys, + XVECTOR (recent_keys)->contents); else { - val = Fvector (NUM_RECENT_KEYS, keys); - vcopy (val, 0, keys + recent_keys_index, - NUM_RECENT_KEYS - recent_keys_index); - vcopy (val, NUM_RECENT_KEYS - recent_keys_index, - keys, recent_keys_index); - return val; + Lisp_Object es = Qnil; + int i = (total_keys < NUM_RECENT_KEYS + ? 0 : recent_keys_index); + eassert (recent_keys_index < NUM_RECENT_KEYS); + do + { + Lisp_Object e = AREF (recent_keys, i); + if (cmds || !CONSP (e) || !NILP (XCAR (e))) + es = Fcons (e, es); + if (++i >= NUM_RECENT_KEYS) + i = 0; + } while (i != recent_keys_index); + es = Fnreverse (es); + return Fvconcat (1, &es); } } diff --git a/test/ChangeLog b/test/ChangeLog index 86f8e240af4..48e01ca973a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2014-11-08 Stefan Monnier + + * automated/bytecomp-tests.el (bytecomp-tests--warnings): New tests. + * automated/cl-lib-tests.el: Rename from cl-lib.el. + 2014-10-28 Ulf Jasper * automated/libxml-tests.el: New file.