From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Jeremy Bryant <jb@jeremybryant.net>
Cc: 65511@debbugs.gnu.org
Subject: bug#65511: copy-last-command-output Help needed regarding Bug #65511
Date: Mon, 13 Nov 2023 17:59:10 -0500 [thread overview]
Message-ID: <jwvjzql8dts.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87r0l2v7os.fsf@jeremybryant.net> (Jeremy Bryant's message of "Mon, 06 Nov 2023 22:23:39 +0000")
> 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
parent reply other threads:[~2023-11-13 22:59 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <87r0l2v7os.fsf@jeremybryant.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvjzql8dts.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=65511@debbugs.gnu.org \
--cc=jb@jeremybryant.net \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).