[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30560: Better format for view-lossage

From: Juri Linkov
Subject: bug#30560: Better format for view-lossage
Date: Tue, 20 Feb 2018 23:17:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

It would much more useful in the output buffer of ‘C-h l’ (view-lossage)
to use the same format as is used by ‘edit-last-kbd-macro’.

Then it will possible to just copy the lines from the buffer generated
by ‘view-lossage’, yank them to the buffer “*Edit Macro*” created by
‘edit-last-kbd-macro’, and save the macro by ‘C-c C-c’.

This is useful for such cases when the user forgets to start macro recording,
or wants to convert recent keystrokes to the macro without re-typing them,
or pick only some of recent keystrokes and compose a new macro
in different order.

This patch is for master:

diff --git a/lisp/help.el b/lisp/help.el
index 4899bc4..9575f5b 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -465,8 +465,8 @@ view-lossage
     (princ (mapconcat (lambda (key)
                         ((and (consp key) (null (car key)))
-                         (format "[%s]\n" (if (symbolp (cdr key)) (cdr key)
-                                          "anonymous-command")))
+                         (format ";; %s\n" (if (symbolp (cdr key)) (cdr key)
+                                             "anonymous-command")))
                         ((or (integerp key) (symbolp key) (listp key))
                          (single-key-description key))
@@ -475,11 +475,11 @@ view-lossage
                      " "))
     (with-current-buffer standard-output
       (goto-char (point-min))
-      (while (not (eobp))
-       (move-to-column 50)
-       (unless (eolp)
-         (fill-region (line-beginning-position) (line-end-position)))
-       (forward-line 1))
+      (let ((comment-start ";; ")
+            (comment-column 24))
+        (while (not (eobp))
+          (comment-indent)
+         (forward-line 1)))
       ;; jidanni wants to see the last keystrokes immediately.
       (set-marker help-window-point-marker (point)))))
PS: I'm not sure whether this feature should be documented somewhere.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]