* bug#65511: copy-last-command-output Help needed regarding Bug #65511
[not found] <87r0l2v7os.fsf@jeremybryant.net>
@ 2023-11-13 22:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; only message in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-13 22:59 UTC (permalink / raw)
To: Jeremy Bryant; +Cc: 65511
> 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-13 22:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <87r0l2v7os.fsf@jeremybryant.net>
2023-11-13 22:59 ` bug#65511: copy-last-command-output Help needed regarding Bug #65511 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).