[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65511: copy-last-command-output Help needed regarding Bug #65511
From: |
Stefan Monnier |
Subject: |
bug#65511: copy-last-command-output Help needed regarding Bug #65511 |
Date: |
Mon, 13 Nov 2023 17:59:10 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> I have tried to work on bug #65511 but got confused with markers (even
> after reading the manual.)
>
> This was an attempt to write copy-last-command-output as a symmetrical
> version of copy-next-command-output
>
> The below is my test code but it doesn't work yet.
Any hint about what "doesn't work"?
> (defun copy-last-command-output ()
> "Copy last command output."
> (interactive)
> (with-current-buffer "*Messages*"
> ;; TODO: isolate those messages not arising from completion UI
What do you mean by this TODO?
> (copy-region-as-kill (marker-position output-marker-beg)
> (marker-position output-marker-end))
> (message "Output is:"))
> )
The `message` call looks odd.
Did you mean to add further info after the `:`?
> (defun output-marker-pre ()
> "Hook for pre."
> (with-current-buffer "*Messages*"
> (let ((buffer-read-only nil))
Better bind `inhibit-read-only` instead of `buffer-read-only`.
Also beware that *Messages* may have been killed (it's OK if the
command doesn't work in this case, but the pre/post hooks should avoid
signaling a never-ending stream of errors).
> (defun output-marker-post ()
> "Hook for post."
> (with-current-buffer "*Messages*"
> (let ((buffer-read-only nil))
> (setq output-marker-end (point-marker))
> (message "End:%s" (marker-position output-marker-end))
> ;; (insert "post- marker\n")
Any reason why you can't just use `point-max` instead of
`output-marker-end`?
Stefan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#65511: copy-last-command-output Help needed regarding Bug #65511,
Stefan Monnier <=