Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* washing and `article-translate-strings' in what hook?
@ 2015-05-29 22:54 Emanuel Berg
  2015-05-31  0:05 ` Ben Bacarisse
       [not found] ` <mailman.4013.1433030725.904.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Emanuel Berg @ 2015-05-29 22:54 UTC (permalink / raw)
  To: info-gnus-english

I have a function that is

    (defun gnus-article-wash-more ()
      "Perform additional article washing."
      (interactive)
      (article-translate-strings
       '(
         ("Sendt fra min iPad" "")
         ("Skickat från Yahoo Mail för iPhone" "")
         ;; ...
         ))
      (gnus-article-strip-multiple-blank-lines) )

which works when called interactively from an
article buffer.

However I can't find a hook to put it in to have it
executed automatically each time!

I tried all the gnus-article--hooks, but none had any
effect (in this context at least).

This is confusing because I already have a hook that
is

    ;; reset: (setq gnus-article-prepare-hook nil)
    (defun gnus-article-prepare-hook-f ()
      (gnus-article-hide-signature nil 1)
      (gnus-article-fill-cited-article) )
    (add-hook 'gnus-article-prepare-hook 'gnus-article-prepare-hook-f)

and those two things happen- just not wash-more if
I put it there as well.

Ideas?

Also, I wonder if there is an option to always perform
maximum washing?

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

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

* Re: washing and `article-translate-strings' in what hook?
  2015-05-29 22:54 washing and `article-translate-strings' in what hook? Emanuel Berg
@ 2015-05-31  0:05 ` Ben Bacarisse
       [not found] ` <mailman.4013.1433030725.904.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Ben Bacarisse @ 2015-05-31  0:05 UTC (permalink / raw)
  To: info-gnus-english

Emanuel Berg <embe8573@student.uu.se> writes:

> I have a function that is
>
>     (defun gnus-article-wash-more ()
>       "Perform additional article washing."
>       (interactive)
>       (article-translate-strings
>        '(
>          ("Sendt fra min iPad" "")
>          ("Skickat från Yahoo Mail för iPhone" "")
>          ;; ...
>          ))
>       (gnus-article-strip-multiple-blank-lines) )
>
> which works when called interactively from an
> article buffer.
>
> However I can't find a hook to put it in to have it
> executed automatically each time!

I think you need to wrap the body in

  (gnus-with-article-buffer ...)

This will have the added effect of making the interactive function work
from the summary buffer window (provided there is a current article in
some buffer, of course).

<snip>
-- 
Ben.


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

* Re: washing and `article-translate-strings' in what hook?
       [not found] ` <mailman.4013.1433030725.904.info-gnus-english@gnu.org>
@ 2015-06-01  0:14   ` Emanuel Berg
  2015-06-01 10:08     ` Ben Bacarisse
  0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2015-06-01  0:14 UTC (permalink / raw)
  To: info-gnus-english

Ben Bacarisse <ben.lists@bsb.me.uk> writes:

> I think you need to wrap the body in
>
>   (gnus-with-article-buffer ...)
>
> This will have the added effect of making the
> interactive function work from the summary buffer
> window (provided there is a current article in some
> buffer, of course).

That's exactly right!

But how is anyone to realize this?

Because there is no article argument to
`article-translate-strings', the current article is
all it can be applied to (?). So then shouldn't it say
there is none, if there isn't?

Or did this happen to some *other* article which
I have been unaware of?

And why did it work calling it interactively but not
doing the same from Lisp?
Is `gnus-article-prepare-hook' the wrong place so at
that time there isn't a buffer set to work
on, interactively?

/The hairdresser

PS. But anyway, not it works so unless you feel like
answering all these question no one will say you
should. DS.

-- 
underground experts united
http://user.it.uu.se/~embe8573

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

* Re: washing and `article-translate-strings' in what hook?
  2015-06-01  0:14   ` Emanuel Berg
@ 2015-06-01 10:08     ` Ben Bacarisse
  2016-09-29 20:35       ` A smart auto-wash? (was: washing and `article-translate-strings' in what hook?) Dave Abrahams
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Bacarisse @ 2015-06-01 10:08 UTC (permalink / raw)
  To: info-gnus-english

Emanuel Berg <embe8573@student.uu.se> writes:

> Ben Bacarisse <ben.lists@bsb.me.uk> writes:
>
>> I think you need to wrap the body in
>>
>>   (gnus-with-article-buffer ...)
>>
>> This will have the added effect of making the
>> interactive function work from the summary buffer
>> window (provided there is a current article in some
>> buffer, of course).
>
> That's exactly right!
>
> But how is anyone to realize this?

Ah, good question.  I don't know.  I learned what I know by reading
other people's code (some of it the Gnus sources).

> Because there is no article argument to
> `article-translate-strings', the current article is
> all it can be applied to (?). So then shouldn't it say
> there is none, if there isn't?
>
> Or did this happen to some *other* article which
> I have been unaware of?

That's possible.  The code operates on the current buffer, so it was
probably editing something!

> And why did it work calling it interactively but not
> doing the same from Lisp?
> Is `gnus-article-prepare-hook' the wrong place so at
> that time there isn't a buffer set to work
> on, interactively?

I don't think the key distinction is interactive/non interactive.  The
key issue is whether there is a "current buffer" which you can see
change.  Selecting an article probably makes the article buffer current
so calling the function interactively works on the article you can see.

<snip>
-- 
Ben.


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

* A smart auto-wash? (was: washing and `article-translate-strings' in what hook?)
  2015-06-01 10:08     ` Ben Bacarisse
@ 2016-09-29 20:35       ` Dave Abrahams
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Abrahams @ 2016-09-29 20:35 UTC (permalink / raw)
  To: info-gnus-english


More generally, I find I am constantly fiddling around with articles in
Gnus to get them to be truly readable.  *Many* need `W-Q'. The ones that only
read well as HTML need `K-b K-v'. I found one today that was garbled
without `K-m', which I had to find by experimentation.  Has anybody
written a smart washer that figures it out for you 99% of the time?

on Mon Jun 01 2015, Ben Bacarisse <ben.lists-AT-bsb.me.uk> wrote:

> Emanuel Berg <embe8573@student.uu.se> writes:
>
>> Ben Bacarisse <ben.lists@bsb.me.uk> writes:
>>
>>> I think you need to wrap the body in
>>>
>>>   (gnus-with-article-buffer ...)
>>>
>>> This will have the added effect of making the
>>> interactive function work from the summary buffer
>>> window (provided there is a current article in some
>>> buffer, of course).
>>
>> That's exactly right!
>>
>> But how is anyone to realize this?
>
> Ah, good question.  I don't know.  I learned what I know by reading
> other people's code (some of it the Gnus sources).
>
>> Because there is no article argument to
>> `article-translate-strings', the current article is
>> all it can be applied to (?). So then shouldn't it say
>> there is none, if there isn't?
>>
>> Or did this happen to some *other* article which
>> I have been unaware of?
>
> That's possible.  The code operates on the current buffer, so it was
> probably editing something!
>
>> And why did it work calling it interactively but not
>> doing the same from Lisp?
>> Is `gnus-article-prepare-hook' the wrong place so at
>> that time there isn't a buffer set to work
>> on, interactively?
>
> I don't think the key distinction is interactive/non interactive.  The
> key issue is whether there is a "current buffer" which you can see
> change.  Selecting an article probably makes the article buffer current
> so calling the function interactively works on the article you can see.
>
> <snip>

-- 
-Dave



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

end of thread, other threads:[~2016-09-29 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 22:54 washing and `article-translate-strings' in what hook? Emanuel Berg
2015-05-31  0:05 ` Ben Bacarisse
     [not found] ` <mailman.4013.1433030725.904.info-gnus-english@gnu.org>
2015-06-01  0:14   ` Emanuel Berg
2015-06-01 10:08     ` Ben Bacarisse
2016-09-29 20:35       ` A smart auto-wash? (was: washing and `article-translate-strings' in what hook?) Dave Abrahams

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 NNTP newsgroup(s).