Unnamed repository; edit this file 'description' to name the repository.
 help / color / Atom feed
* How to copy "raw", but decoded article body to a new buffer?
@ 2019-11-23 11:35 Tim Landscheidt
  2019-11-23 12:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Landscheidt @ 2019-11-23 11:35 UTC (permalink / raw)
  To: info-gnus-english

Hi,

(for example) cron sends me programs' outputs with the head-
ers:

| MIME-Version: 1.0
| Content-Type: text/plain; charset=UTF-8

I want to copy the output to a new buffer and then do some
stuff there.

O b (gnus-summary-save-article-body-file) will a) save the
article body "washed", i. e. for example word-wrapped &
Co. and b) prepend "X-Gnus-Coding-System: -*- coding: utf-8;
-*-" (?).

C-o (gnus-summary-save-article-mail) will a) save the head-
ers as well and b) not decode the body (which is probably
not a problem for "text/plain; charset=UTF-8", but still).

(O f (gnus-summary-save-article-file) seems to be doing the
same as O b, o (gnus-summary-save-article) the same as C-o.)

Both commands have the disadvantage of saving the article to
a file which I have to then visit, edit, save, delete in-
stead of just creating a new buffer.

How can I copy the "raw", but decoded article body to a new
buffer?

TIA,
Tim


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to copy "raw", but decoded article body to a new buffer?
  2019-11-23 11:35 How to copy "raw", but decoded article body to a new buffer? Tim Landscheidt
@ 2019-11-23 12:08 ` Lars Ingebrigtsen
  2019-11-24 15:59   ` Tim Landscheidt
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-23 12:08 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: info-gnus-english

Tim Landscheidt <tim@tim-landscheidt.de> writes:

> How can I copy the "raw", but decoded article body to a new
> buffer?

`C-u C-u g' and then `C-x C-w' the buffer to a file?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to copy "raw", but decoded article body to a new buffer?
  2019-11-23 12:08 ` Lars Ingebrigtsen
@ 2019-11-24 15:59   ` Tim Landscheidt
  2019-11-24 21:19     ` Štěpán Němec
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Landscheidt @ 2019-11-24 15:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: info-gnus-english

Lars Ingebrigtsen <larsi@gnus.org> wrote:

>> How can I copy the "raw", but decoded article body to a new
>> buffer?

> `C-u C-u g' and then `C-x C-w' the buffer to a file?

(I have used C-u g thousands of times, but was never aware
of C-u C-u g; thanks :-).)

That works fine when I type C-u C-u g, however when I run

| M-: (gnus-summary-show-article 16) RET

I get prompted "View as charset:" which somewhat defeats the
purpose of automation.

Any advice for that?

Tim

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to copy "raw", but decoded article body to a new buffer?
  2019-11-24 15:59   ` Tim Landscheidt
@ 2019-11-24 21:19     ` Štěpán Němec
  2019-11-24 22:29       ` Tim Landscheidt
  0 siblings, 1 reply; 6+ messages in thread
From: Štěpán Němec @ 2019-11-24 21:19 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: Lars Ingebrigtsen, info-gnus-english

On Sun, 24 Nov 2019 15:59:31 +0000
Tim Landscheidt wrote:

> That works fine when I type C-u C-u g, however when I run
>
> | M-: (gnus-summary-show-article 16) RET
>
> I get prompted "View as charset:" which somewhat defeats the
> purpose of automation.
>
> Any advice for that?

(gnus-summary-show-article 16) ≊ C-u 16 g

C-u C-u g ≊ (gnus-summary-show-article '(16))

Cf. (info "(elisp)Prefix Command Arguments")

-- 
Štěpán

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to copy "raw", but decoded article body to a new buffer?
  2019-11-24 21:19     ` Štěpán Němec
@ 2019-11-24 22:29       ` Tim Landscheidt
  2019-12-02  8:08         ` Tim Landscheidt
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Landscheidt @ 2019-11-24 22:29 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: Lars Ingebrigtsen, info-gnus-english

Štěpán Němec <stepnem@gmail.com> wrote:

>> That works fine when I type C-u C-u g, however when I run

>> | M-: (gnus-summary-show-article 16) RET

>> I get prompted "View as charset:" which somewhat defeats the
>> purpose of automation.

>> Any advice for that?

> (gnus-summary-show-article 16) ≊ C-u 16 g

> C-u C-u g ≊ (gnus-summary-show-article '(16))

> Cf. (info "(elisp)Prefix Command Arguments")

Ah!  With that, something like:

| (defun tl-ab2nb nil
|   (interactive)
|   (gnus-summary-show-article '(16))
|   (gnus-summary-select-article-buffer)
|   (article-goto-body)
|   (copy-to-buffer (generate-new-buffer "article body") (point) (point-max)))

works nicely.  (Only nitpick: Gnus adds a trailing newline,
i. e. the function above applied to a mail generated by
"echo echo Test | at now" produces a buffer with
"Test\n\n".)

Thanks,
Tim

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to copy "raw", but decoded article body to a new buffer?
  2019-11-24 22:29       ` Tim Landscheidt
@ 2019-12-02  8:08         ` Tim Landscheidt
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Landscheidt @ 2019-12-02  8:08 UTC (permalink / raw)
  To: info-gnus-english

I wrote:

> […]

> Ah!  With that, something like:

> | (defun tl-ab2nb nil
> |   (interactive)
> |   (gnus-summary-show-article '(16))
> |   (gnus-summary-select-article-buffer)
> |   (article-goto-body)
> |   (copy-to-buffer (generate-new-buffer "article body") (point) (point-max)))

> works nicely.  (Only nitpick: Gnus adds a trailing newline,
> i. e. the function above applied to a mail generated by
> "echo echo Test | at now" produces a buffer with
> "Test\n\n".)

Two more issues related to that:

- "(gnus-summary-show-article '(16))" will trigger
  gnus-select-article-hook, so to call the former in the
  latter, I had to wrap that in "(let
  (gnus-select-article-hook) […])".  Is there a better/re-
  commended way to solve that?

- gnus-summary-show-article will switch to the *Summary*
  buffer, so in "(gnus-with-article-buffer
  (gnus-summary-show-article '(16)) (something-else))"
  something-else will be executed in the *Summary* buffer,
  therefore I had to wrap that in another
  gnus-with-article-buffer form.  However, when executed in
  the *Article* buffer, C-u C-u g will stay there.  Is this
  a bug?

Tim


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23 11:35 How to copy "raw", but decoded article body to a new buffer? Tim Landscheidt
2019-11-23 12:08 ` Lars Ingebrigtsen
2019-11-24 15:59   ` Tim Landscheidt
2019-11-24 21:19     ` Štěpán Němec
2019-11-24 22:29       ` Tim Landscheidt
2019-12-02  8:08         ` Tim Landscheidt

Unnamed repository; edit this file 'description' to name the repository.

Archives are clonable: git clone --mirror http://inbox.vuxu.org/info-gnus-english

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.emacs.gnus.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git