Gnus development mailing list
 help / color / mirror / Atom feed
From: Emanuel Berg <moasenwood@zoho.eu>
To: ding@gnus.org
Subject: Re: my attach this buffer
Date: Mon, 24 May 2021 09:03:58 +0200	[thread overview]
Message-ID: <875yz81uld.fsf@zoho.eu> (raw)
In-Reply-To: <87mtsk8x0o.fsf@mat.ucm.es>

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

Uwe Brauer wrote:

>>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
>
>> Uwe Brauer wrote:
>>>> You could try `mailcap-file-name-to-mime-type' on the file
>>>> name, and see if that gets it right often enough to
>>>> be useful.
>>> 
>>> Hm I tried (mailcap-file-name-to-mime-type (buffer-file-name
>>> current-buffer)) but that did not work
>>> 
>>> I mean 
>>> 
>>> (defun my-attach-this-buffer ()
>>> "Send the whole buffer, funny to note that such a function does not exist."
>>> (interactive)
>>> (let  ((src-buf (buffer-file-name (current-buffer))))
>>> (let ((my-mime (mailcap-file-name-to-mime-type
>>> (buffer-file-name current-buffer))))
>>> (gnus-summary-post-news)
>>> (mail-text)
>>> (mml-attach-buffer src-buf my-mime nil nil)
>>> (message-goto-to))))
>>> 
>>> But it did not work
>
>> Are you kidding? :O
>
>> Straight gangsta!
>
>> (require 'gnus-msg)
>> (require 'mailcap)
>> (require 'message)
>> (require 'mml)
>> (require 'sendmail)
>
>> (defun mail-attach-buffer ()
>>   (interactive)
>>   (let*((buf  (buffer-file-name (current-buffer)))
>>         (mime (mailcap-file-name-to-mime-type buf)) )
>>     (gnus-summary-post-news)
>>     (mail-text)
>>     (mml-attach-buffer buf mime)
>>     (message-goto-to) ))
>
> Thanks, misplaced brackets and let instead of let*, I copied that code
> from another one badly.
>
> Strangely enough if I fire that function in a matlab file
> I obtain
>
> #part buffer="/home/oub/Annu-Matlab2021/file.m"
> #/part
>
> So mail-cap-file-name-to-mime-type does not work, even though
> "text/x-matlab"
>
> Seems a recognised type. Maybe that is a bug

It works here what I can see, e.g. in/from mail.el you get

< #part type="application/emacs-lisp" buffer="/home/incal/.emacs.d/emacs-init/gnus/mail.el">

[-- Attachment #2: Type: text/plain, Size: 63 bytes --]

>

-- 
underground experts united
https://dataswamp.org/~incal

  reply	other threads:[~2021-05-24  7:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 17:22 Uwe Brauer
2021-05-22 17:51 ` dick.r.chiang
2021-05-22 18:01   ` Uwe Brauer
2021-05-22 19:39     ` Eric Abrahamsen
2021-05-23 21:08       ` Uwe Brauer
2021-05-23 21:24         ` Emanuel Berg
2021-05-23 22:13           ` Emanuel Berg
2021-05-24  6:29           ` Uwe Brauer
2021-05-24  7:03             ` Emanuel Berg [this message]
2021-05-24 10:47               ` Uwe Brauer
2021-05-24 18:29                 ` Eric Abrahamsen
2021-05-24 19:53                   ` Uwe Brauer
2021-05-24 20:01                     ` Eric Abrahamsen
2021-05-25  8:09                       ` Uwe Brauer
2021-05-25 16:37                         ` Eric Abrahamsen
2021-05-26  6:40                           ` Uwe Brauer
2021-05-26 15:57                             ` Eric Abrahamsen
2021-05-23 22:07         ` Adam Sjøgren
2021-08-23 12:06     ` Wayne Harris
2021-08-23 18:23       ` Emanuel Berg

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yz81uld.fsf@zoho.eu \
    --to=moasenwood@zoho.eu \
    --cc=ding@gnus.org \
    /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.
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).