Re: [S-mailx] signature

2022-09-17 Thread Steffen Nurpmeso
Hello Stephen.

(Why has all that become a private thread??  I'll CC mailx, ok?)

Stephen Isard wrote in
 <[email protected]>:
 |On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |> Isn't it much easier to write
 |>
 |>  set message-inject-tail=$'\nMoney\nGet back\nGrab that cash!'
 |>
 |> than to have a dedicated signature _file_?
 |
 |The colleague who mailed me about this has a twelve line signature file 
 |with lots of contact details.

Hm, ok, well that is .. hm.

 |Signature is clear.   message-inject-tail is complicated.

Except for groff caused copy+paste problems because it uses
symbols which do not map to the syntax elements we expect (hyphen
instead of hyphen-minus, whatever instead of single quote, etc);
The replacement should only be a copy+paste thing.
We will have this in the default nail.rc and the manual in v14.10

  #\define add_signature {
  #   \read version
  #   \echo '~< ~/.mysig' # or '~ I really want to have this go.
 |
 |Yes, I can tell :-)

We must shrink again.

 |> It is obsoloted for over half a decade, without anyone complaining 
 |> about it!
 |
 |But it has continued to work.  You might start to get complaints when 

But it is really noisy on the terminal.

 |it stops working and people are forced to read the manual and learn 
 |about splice macros.

I find the above not overly complicated.  No Stephen, if people
want to use S-nail and insert a signature file, the above five
lines will do it.

Sorry!  Greetings to America.

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in
 <20220916204431.ldtoq%[email protected]>:
 ...

I also rewrite splice hook docu with credits to you.

 These hooks run after compose mode is finished, but before
 on-compose-leave[492].  Both are executed in a subprocess, with
 their input and output connected such that they can act like an
 interactive user: S-nail's output they read[252], input for
 S-nail they can echo[184].  Whereas the latter is a SHELL[638]
 command, the former is a define[173]d macro that is evaluated
 in a restricted mode with only a small set of commands avail-
 able (the verbose[611] output of for example list[219] indi-
 cates the `subprocess' capability).

 In the subprocess (a restricted set of) COMMAND ESCAPES[30]
 will always be available.  For guaranteed reproducibilities'
 sake escape[416] and ifs[444] are set to their defaults.  The
 escape ~^[320] has been especially designed for scriptability:
 the first line these hooks will read on standard input is the
 escape's protocol version ("0 0 2"), backward incompatible pro-
 tocol changes have to be expected.

 Care must be taken to avoid deadlocks and other false control
 flow: if subprocess and S-nail both wait for more input, or if
 one does not expect more input, whereas the other waits for
 consumption of its output.  Hooks are not automatically syn-
 chronized: if a hook emits `~x' to cause S-nail to exit compose
 mode, the subprocess will keep running nonetheless until the
 macro is completely worked or xit[309] is called explicitly.
 They will however receive a termination signal if the parent
 enters an error condition.  [v15 behaviour may differ] Protec-
 tion against and interaction with signals is not yet given; it
 is likely that in the future these scripts will be placed in an
 isolated session, which is signalled in its entirety as neces-
 sary.

Ciao!  And thanks (and sorry -- ach, i hate it!)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Hello Stephen.

Stephen Isard wrote in
 <[email protected]>:
 |On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
 |...
 |> Well ok but the manual includes a fully spelled out example for
 |> on-compose-splice:
 |>
 |>   define ocs_signature {
 |> read version
 |> echo '~< ~/.mysig' # '~}
 |>   set on-compose-splice=ocs_signature
 |
 |This works, but I don't actually understand how.  The man page says that 
 |'read' reads a line from standard input and assigns it to the given 
 |variable.  What is standard input going to be in this case?  Is it the 
 |output of echo?[.]

Well the splice hooks run in a dedicated subprocess that can act
"as if it were a user", so you basically have to echo the commands
you want "the user" to run.  The process itself can only run
a restricted set of commands itself (it is a separate process,
say).

 |[.]The given variable is 'version', which is read-only, so 
 |can't get assigned to.  What causes the quoted string to get evaluated?

Oops.  Well i think bitrot hammered into this one.  I'll fix it in
a second, thanks for noticing!  (And as above.)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] signature

2022-09-16 Thread Stephen Isard

On Fri, 16 Sep 2022, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:
...

Well ok but the manual includes a fully spelled out example for
on-compose-splice:

  define ocs_signature {
read version
echo '~< ~/.mysig' # '~

This works, but I don't actually understand how.  The man page says that 
'read' reads a line from standard input and assigns it to the given 
variable.  What is standard input going to be in this case?  Is it the 
output of echo?  The given variable is 'version', which is read-only, so 
can't get assigned to.  What causes the quoted string to get evaluated?


Stephen Isard


Re: [S-mailx] signature

2022-09-16 Thread Steffen Nurpmeso
Hello Stephen.

(..yaya i will look at modifying the fetchmail oauth thing for
s-nail in the upcoming days, next week thus likely..)

Stephen Isard wrote in
 <[email protected]>:
 |Steffen,
 |
 |I don't use a signature myself, but a colleague who does recently 
 |updated his s-nail from the out of date version in the ubuntu repository 
 |and got a warning that signature was obsolete and he should use 
 |on-compose-leave and message-inject-tail.  That is, replace the single 
 |line
 |
 |signature=~/.signature
 |
 |whose meaning is pretty obvious to the ordinary user, with half a dozen 
 |lines of - if you will forgive my saying so - rather arcane low level 
 |code.  You shouldn't have to understand the semantics of "vput csop" 
 |to include a signature your emails.
 |
 |Please don't misunderstand. I think it is great that you have exposed 
 |low level workings of s-nail so that, for instance, someone who wants to 
 |include different signatures for different classes of recipients can 
 |arrange that.  But it shouldn't be at the expense of over-complicating 
 |everyday use.  Please retain the signature variable.

message-inject-tail.  signature loads a file.
Well ok but the manual includes a fully spelled out example for
on-compose-splice:

   define ocs_signature {
 read version
 echo '~< ~/.mysig' # '~MAILX)_TAIL.
With credits to you this "duplicating to the interactive terminal"
i removed.

I mean you can place multiline strings in v15-compat=y, and you
can `source' whatever file you want, for example

  $ cat .MYSIG
  set message-inject-tail=$'\nThe land returns to how it has always been\n\
  Thyme carried on the wind'
  $ MAILRC=$(pwd)/.MYSIG