Gnus development mailing list
 help / color / mirror / Atom feed
From: Hobbit <werehobbit@yandex.ru>
To: ding@gnus.org
Subject: Re: Attach file improvement
Date: Wed, 23 Feb 2011 23:14:52 +0200	[thread overview]
Message-ID: <87ei6y4fn7.fsf@myhost.localdomain> (raw)
In-Reply-To: <871v2z2hyj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 23 Feb 2011 01:55:32 -0800")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This patch is more than 10 lines long, so we'll need FSF copyright
> assignment papers.  Do you have assignment papers on file with the
> FSF?

Well, if you compare my patch with the original file mml.el you'd see
that it mostly consists of mere copy of old Gnus code:

For example, fragments from mml.el:

;; mml.el line #1197
(defun mml-minibuffer-read-disposition (type &optional default filename)
  (unless default
    (setq default (mml-content-disposition type filename)))
  (let ((disposition (completing-read                      ;; <-- look
		      (format "Disposition (default %s): " default)
		      '(("attachment") ("inline") (""))
		      nil t nil nil default)))
    (if (not (equal disposition ""))
	disposition
      default)))

;;mml.el line #1280
(defun mml-attach-file (file &optional type description disposition)

;;mml.el line #1296
     (list file type description disposition)))

;; mml.el line #491
(if (and (not raw)
      (member (car (split-string type "/")) '("text" "message")))

And this is the patch:

+(defun mml-minibuffer-read-charset (&optional default);; copy&rename
+  (let ((charset (completing-read     ;;<----- variable renamed
+      (format "Charset: " default)    ;; <-- prompt changed
+                  mm-mime-mule-charset-alist
+                  nil t nil nil default))) ;; just copied
+    (if (not (equal charset ""))           ;; just copied
+        charset                            ;; just copied
+      default)))                           ;; just copied


+(defun mml-attach-file (file &optional type description ;; copied
+                             disposition charset);; <- param added

+body) or \"attachment\" (separate from the body). CHARSET is file
+charset."                          

+      (charset (when (member (car (split-string type "/"))
+                             '("text" "message")) ;; partial copy
+                 (mml-minibuffer-read-charset)));; from line #491


+  (list file type description disposition charset)));; var added
+            'charset charset                        ;; var added

So my autorship is much smaller than it could seem. "Real" weight of
the patch is near 10 lines (if not less).

>> | C-c C-a
>> | Attach file: ~/file.txt
>> | Content type (default text/plain): <RET>
>> | Charset: cp855
>

> The other thing I don't quite understand is that Emacs is usually
> able to tell what the charset is automatically, so why does the user
> need to be prompted here?

Unfortunately, in the cyrillic world things are much more difficult,
because there are several popular charsets which use same codes for
different cyrillic letters.

For example, a file with contents (in hex codes)

0xCE, 0xC5, 0xD4

could be read using charset koi8-r as

CYRILLIC SMALL LETTER EN
CYRILLIC SMALL LETTER IE
CYRILLIC SMALL LETTER TE

whereas in charset windows-1251 it's

CYRILLIC CAPITAL LETTER O
CYRILLIC CAPITAL LETTER IE
CYRILLIC CAPITAL LETTER EF

So how could we know what charset to use without asking a user?



  reply	other threads:[~2011-02-23 21:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 12:08 Hobbit
2011-02-22 12:49 ` Hobbit
2011-02-22 21:03   ` Hobbit
2011-02-23  9:55     ` Lars Ingebrigtsen
2011-02-23 21:14       ` Hobbit [this message]
2011-02-25  3:26         ` Lars Ingebrigtsen
2011-02-28 14:59           ` Hobbit
2011-03-05 12:27             ` Lars Magne Ingebrigtsen
2011-02-28 18:59           ` Hobbit
2011-03-05 12:25             ` Lars Magne Ingebrigtsen

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=87ei6y4fn7.fsf@myhost.localdomain \
    --to=werehobbit@yandex.ru \
    --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).