GNU bug report logs - #65511
[PATCH] copy-next-command-output suggestion

Previous Next

Package: emacs;

Reported by: Jeremy Bryant <jb <at> jeremybryant.net>

Date: Thu, 24 Aug 2023 21:53:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jeremy Bryant <jb <at> jeremybryant.net>
Cc: 65511 <at> debbugs.gnu.org
Subject: bug#65511: copy-last-command-output Help needed regarding Bug #65511
Date: Mon, 13 Nov 2023 17:59:10 -0500
> 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





This bug report was last modified 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.