aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-01-02 15:31:19 -0500
committerChong Yidong2011-01-02 15:31:19 -0500
commit7c420169baa7c50428589cca7f8eda71b462eb15 (patch)
treeb556f9e181818bbaf8b5b425844b4ae26e88f537
parentbb7f5cbcda931661c8dc3311603ac764fa87a639 (diff)
parentd12f22f52cb7bb18b46f5ea8de5d8e8e04733e3f (diff)
downloademacs-7c420169baa7c50428589cca7f8eda71b462eb15.tar.gz
emacs-7c420169baa7c50428589cca7f8eda71b462eb15.zip
Merge changes from emacs-23 branch
-rw-r--r--admin/ChangeLog5
-rw-r--r--doc/emacs/ChangeLog26
-rw-r--r--doc/emacs/frames.texi14
-rw-r--r--doc/emacs/maintaining.texi4
-rw-r--r--doc/emacs/rmail.texi114
-rw-r--r--doc/emacs/trouble.texi14
-rw-r--r--doc/lispref/ChangeLog9
-rw-r--r--doc/lispref/modes.texi37
-rw-r--r--doc/man/ChangeLog4
-rw-r--r--doc/man/emacsclient.130
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS.2321
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/ebrowse.c9
-rw-r--r--lib-src/etags.c9
-rwxr-xr-xlib-src/rcs2log7
-rw-r--r--lisp/ChangeLog118
-rw-r--r--lisp/emulation/edt-mapper.el42
-rw-r--r--lisp/eshell/em-hist.el4
-rw-r--r--lisp/files.el5
-rw-r--r--lisp/help-fns.el14
-rw-r--r--lisp/isearch.el7
-rw-r--r--lisp/mail/binhex.el7
-rw-r--r--lisp/mail/mail-utils.el40
-rw-r--r--lisp/mail/rmail.el137
-rw-r--r--lisp/mail/rmailmm.el998
-rw-r--r--lisp/mail/smtpmail.el9
-rw-r--r--lisp/term/w32-win.el30
-rw-r--r--lisp/textmodes/rst.el4
-rw-r--r--lisp/time.el4
-rw-r--r--lisp/version.el3
-rw-r--r--nextstep/ChangeLog7
-rw-r--r--nextstep/Cocoa/Emacs.base/Contents/Info.plist4
-rw-r--r--nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings2
-rw-r--r--nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist2
-rw-r--r--nt/ChangeLog8
-rw-r--r--nt/INSTALL17
-rw-r--r--nt/README.W3224
-rwxr-xr-xnt/configure.bat13
-rw-r--r--src/.gdbinit7
-rw-r--r--src/ChangeLog51
-rw-r--r--src/fileio.c2
-rw-r--r--src/image.c27
-rw-r--r--src/keyboard.c4
-rw-r--r--src/window.c6
-rw-r--r--src/xdisp.c39
-rw-r--r--src/xterm.c14
47 files changed, 1459 insertions, 503 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 601f577523b..1314438a10a 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,8 @@
12011-01-02 Eli Zaretskii <eliz@gnu.org>
2
3 * nt/README.W32: Update the information about PNG support libraries.
4 (Bug#7716)
5
12010-12-27 Stefan Monnier <monnier@iro.umontreal.ca> 62010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * bzrmerge.el: New file to help merge branches while skipping 8 * bzrmerge.el: New file to help merge branches while skipping
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index ba2156bd745..3b751584f6b 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,29 @@
12011-01-02 Chong Yidong <cyd@stupidchicken.com>
2
3 * rmail.texi (Rmail Display): Edit for grammar and conciseness.
4
52011-01-02 Kenichi Handa <handa@m17n.org>
6
7 * rmail.texi (Rmail Display): Describe new features of Rmail in Info.
8
92011-01-02 Eli Zaretskii <eliz@gnu.org>
10
11 * frames.texi (Cut and Paste): Modify the section's name and text:
12 don't mix "cut/paste" with "kill/yank".
13 (Cut/Paste Other App): Describe the per-session emulation of PRIMARY.
14 (Bug#7702)
15
16 * trouble.texi (Checklist): Mention debug-on-quit. (Bug#7667)
17
182011-01-02 Glenn Morris <rgm@gnu.org>
19
20 * maintaining.texi: Move inclusion of emerge after EDE, so that it
21 matches its position in the menu. (Bug#7674)
22
232011-01-02 Glenn Morris <rgm@gnu.org>
24
25 * trouble.texi (Checklist): Mention not replying via news either.
26
12010-12-30 Tassilo Horn <tassilo@member.fsf.org> 272010-12-30 Tassilo Horn <tassilo@member.fsf.org>
2 28
3 * misc.texi (Document View): Update DocView section with newly 29 * misc.texi (Document View): Update DocView section with newly
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index df4f0beff9e..0ecf6f68d8c 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -58,10 +58,10 @@ so that you can use many of the features described in this chapter.
58@end menu 58@end menu
59 59
60@node Cut and Paste 60@node Cut and Paste
61@section Killing and Yanking on Graphical Displays 61@section Cutting and Pasting on Graphical Displays
62 62
63 This section describes commands for selecting a region, killing, and 63 This section describes commands for selecting a region, cutting, and
64yanking using the mouse. 64pasting using the mouse.
65 65
66@menu 66@menu
67* Mouse Commands:: Moving, cutting, and pasting, with the mouse. 67* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
@@ -248,6 +248,14 @@ has no ``memory'': each time you save something in the primary
248selection, either in Emacs or in another X application, the previous 248selection, either in Emacs or in another X application, the previous
249contents of the primary selection are lost. 249contents of the primary selection are lost.
250 250
251@cindex MS-Windows, and primary selection
252 MS-Windows provides no primary selection, but Emacs emulates it
253within a single Emacs session, by storing the selected text
254internally. Therefore, all the features and commands related to the
255primary selection work on Windows as they do on X, for cutting and
256pasting within the same session, but not across Emacs sessions or with
257other applications.
258
251 Whenever you kill some text using a command such as @kbd{C-w} 259 Whenever you kill some text using a command such as @kbd{C-w}
252(@code{kill-region}), or copy it into the kill ring using a command 260(@code{kill-region}), or copy it into the kill ring using a command
253such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in 261such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 8442586ab27..6ae4cf2dd36 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -2354,7 +2354,3 @@ the target should be built.
2354@ifnottex 2354@ifnottex
2355@include emerge-xtra.texi 2355@include emerge-xtra.texi
2356@end ifnottex 2356@end ifnottex
2357
2358@ignore
2359 arch-tag: b9d83dfb-82ea-4ff6-bab5-05a3617091fb
2360@end ignore
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index ddf68e62bbf..1477a6959c2 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1101,57 +1101,90 @@ buffer before sorting it.
1101@node Rmail Display 1101@node Rmail Display
1102@section Display of Messages 1102@section Display of Messages
1103 1103
1104 Rmail reformats the header of each message before displaying it for 1104 This section describes how Rmail displays mail headers,
1105the first time. Reformatting hides uninteresting header fields to 1105@acronym{MIME} sections and attachments, and URLs.
1106reduce clutter. You can use the @kbd{t} command to show the entire
1107header or to repeat the header reformatting operation.
1108 1106
1109@table @kbd 1107@table @kbd
1110@item t 1108@item t
1111Toggle display of complete header (@code{rmail-toggle-header}). 1109Toggle display of complete header (@code{rmail-toggle-header}).
1112@end table 1110@end table
1113 1111
1114@vindex rmail-ignored-headers
1115@vindex rmail-nonignored-headers
1116 Reformatting the header involves deleting most header fields, on the
1117grounds that they are not interesting. The variable
1118@code{rmail-ignored-headers} holds a regular expression that specifies
1119which header fields to hide in this way---if it matches the beginning
1120of a header field, that whole field is hidden. However, the variable
1121@code{rmail-nonignored-headers} provides a further override: a header
1122matching that regular expression is shown even if it matches
1123@code{rmail-ignored-headers} too.
1124
1125@vindex rmail-displayed-headers
1126 As an alternative to the previous two variables, you can set
1127@code{rmail-displayed-headers} instead. If non-@code{nil}, this should
1128be a regular expression specifying which headers to display.
1129
1130@kindex t @r{(Rmail)} 1112@kindex t @r{(Rmail)}
1131@findex rmail-toggle-header 1113@findex rmail-toggle-header
1132 To see the complete, original header, use the @kbd{t} command 1114 Before displaying each message for the first time, Rmail reformats
1133(@code{rmail-toggle-header}). This discards the reformatted headers of 1115its header, hiding uninteresting header fields to reduce clutter. The
1134the current message and displays it with the original header. Repeating 1116@kbd{t} (@code{rmail-toggle-header}) command toggles this, switching
1135@kbd{t} reformats the message again, which shows only the interesting 1117between showing the reformatted header fields and showing the
1136headers according to the current values of the above variables. 1118complete, original header. With a positive prefix argument, the
1137Selecting the message again also reformats it if necessary. 1119command shows the reformatted header; with a zero or negative prefix
1120argument, it shows the full header. Selecting the message again also
1121reformats it if necessary.
1138 1122
1139 When the @kbd{t} command has a prefix argument, a positive argument 1123@vindex rmail-ignored-headers
1140means to show the reformatted header, and a zero or negative argument 1124@vindex rmail-displayed-headers
1141means to show the full header. 1125@vindex rmail-nonignored-headers
1126 The variable @code{rmail-ignored-headers} holds a regular expression
1127specifying the header fields to hide; any matching header line will be
1128hidden. The variable @code{rmail-nonignored-headers} overrides this:
1129any header field matching that regular expression is shown even if it
1130matches @code{rmail-ignored-headers} too. The variable
1131@code{rmail-displayed-headers} is an alternative to these two
1132variables; if non-@code{nil}, this should be a regular expression
1133specifying which headers to display (the default is @code{nil}).
1142 1134
1143@vindex rmail-highlighted-headers 1135@vindex rmail-highlighted-headers
1144 Rmail highlights certain header fields that are especially 1136 Rmail highlights certain header fields that are especially
1145interesting---by default, the @samp{From} and @samp{Subject} fields. 1137interesting---by default, the @samp{From} and @samp{Subject} fields.
1146The variable @code{rmail-highlighted-headers} holds a regular expression 1138This highlighting uses the @code{rmail-highlight} face. The variable
1147that specifies the header fields to highlight; if it matches the 1139@code{rmail-highlighted-headers} holds a regular expression specifying
1148beginning of a header field, that whole field is highlighted. To turn 1140the header fields to highlight; if it matches the beginning of a
1149off this feature, set @code{rmail-highlighted-headers} to @code{nil}. 1141header field, that whole field is highlighted. To disable this
1150Customize the face @code{rmail-highlight} to adjust the style of the 1142feature, set @code{rmail-highlighted-headers} to @code{nil}.
1151highlighting. 1143
1144@cindex MIME messages (Rmail)
1145@vindex rmail-enable-mime
1146 By default, Rmail automatically decodes @acronym{MIME} (Multipurpose
1147Internet Mail Extensions) messages. If the message contains multiple
1148parts (@acronym{MIME} entities), each part is represented by a tagline
1149in the Rmail buffer. The tagline summarizes the part's depth, index,
1150and type, and may also contain a button for handling it, e.g. saving
1151it to a file or displaying it as an image in the Rmail buffer.
1152
1153@table @kbd
1154@findex rmail-mime-toggle-hidden
1155@item @key{RET}
1156Hide or show the @acronym{MIME} part at point
1157(@code{rmail-mime-toggle-hidden}).
1152 1158
1153 You can highlight and activate URLs in incoming messages using 1159@findex rmail-mime-next-item
1154Goto Address mode: 1160@item @key{TAB}
1161Move point to the next @acronym{MIME} part
1162(@code{rmail-mime-next-item}).
1163
1164@findex rmail-mime-previous-item
1165@item @key{BackTab}
1166Move point to the previous @acronym{MIME} part
1167(@code{rmail-mime-previous-item}).
1168
1169@findex rmail-mime
1170@item v
1171@kindex v @r{(Rmail)}
1172Toggle between @acronym{MIME} display and raw message
1173(@code{rmail-mime}).
1174@end table
1175
1176 The @kbd{v} (@code{rmail-mime}) command toggles between the default
1177@acronym{MIME} display described above, and a ``raw'' display showing
1178the undecoded @acronym{MIME} data. With a prefix argument, this
1179command toggles the display of only an entity at point.
1180
1181 To prevent Rmail from handling MIME decoded messages, change the
1182variable @code{rmail-enable-mime} to @code{nil}. When this is the
1183case, the @kbd{v} (@code{rmail-mime}) command instead creates a
1184temporary buffer to display the current @acronym{MIME} message.
1185
1186 You can highlight and activate URLs in the Rmail buffer using Goto
1187Address mode:
1155 1188
1156@c FIXME goto-addr.el commentary says to use goto-address instead. 1189@c FIXME goto-addr.el commentary says to use goto-address instead.
1157@smallexample 1190@smallexample
@@ -1163,13 +1196,6 @@ Then you can browse these URLs by clicking on them with @kbd{Mouse-2}
1163(or @kbd{Mouse-1} quickly) or by moving to one and typing @kbd{C-c 1196(or @kbd{Mouse-1} quickly) or by moving to one and typing @kbd{C-c
1164@key{RET}}. @xref{Goto Address mode, Activating URLs, Activating URLs}. 1197@key{RET}}. @xref{Goto Address mode, Activating URLs, Activating URLs}.
1165 1198
1166@cindex MIME messages (Rmail)
1167@findex rmail-mime
1168@kindex v @r{(Rmail)}
1169 The @kbd{v} (@code{rmail-mime}) command creates a temporary buffer
1170displaying the current MIME message. By default, it displays plain text
1171and multipart messages, and offers buttons to save attachments.
1172
1173@node Rmail Coding 1199@node Rmail Coding
1174@section Rmail and Coding Systems 1200@section Rmail and Coding Systems
1175 1201
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index e2b27083243..b8cfd322bd4 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -630,9 +630,10 @@ you can use.
630 630
631All mail sent to the @samp{bug-gnu-emacs} mailing list is also 631All mail sent to the @samp{bug-gnu-emacs} mailing list is also
632gatewayed to the @samp{gnu.emacs.bug} newsgroup. The reverse is also 632gatewayed to the @samp{gnu.emacs.bug} newsgroup. The reverse is also
633true, but we ask you not to post bug reports via the newsgroup. It 633true, but we ask you not to post bug reports (or replies) via the
634can make it much harder to contact you if we need to ask for more 634newsgroup. It can make it much harder to contact you if we need to ask
635information, and it does not integrate well with the bug tracker. 635for more information, and it does not integrate well with the bug
636tracker.
636 637
637If your data is more than 500,000 bytes, please don't include it 638If your data is more than 500,000 bytes, please don't include it
638directly in the bug report; instead, offer to send it on request, or 639directly in the bug report; instead, offer to send it on request, or
@@ -805,6 +806,13 @@ This use of the debugger is possible only if you know how to make the
805bug happen again. If you can't make it happen again, at least copy 806bug happen again. If you can't make it happen again, at least copy
806the whole error message. 807the whole error message.
807 808
809@vindex debug-on-quit
810If Emacs appears to be stuck in an infinite loop or in a very long
811operation, typing @kbd{C-g} with the variable @code{debug-on-quit}
812non-@code{nil} will start the Lisp debugger and show a backtrace.
813This backtrace is useful for debugging such long loops, so if you can
814produce it, copy it into the bug report.
815
808@item 816@item
809Check whether any programs you have loaded into the Lisp world, 817Check whether any programs you have loaded into the Lisp world,
810including your @file{.emacs} file, set any variables that may affect the 818including your @file{.emacs} file, set any variables that may affect the
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 157c8580b9c..7307d7fab4f 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,12 @@
12011-01-02 Eli Zaretskii <eliz@gnu.org>
2
3 * modes.texi (Emulating Mode Line): Fix last change.
4
52011-01-02 Eli Zaretskii <eliz@gnu.org>
6
7 * modes.texi (Emulating Mode Line): Update documentation of
8 format-mode-line according to changes that fixed bug #7587.
9
12010-12-18 Stefan Monnier <monnier@iro.umontreal.ca> 102010-12-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * modes.texi (Derived Modes): Mention prog-mode. 12 * modes.texi (Derived Modes): Mention prog-mode.
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 0f66ebeb6b1..f7e164d9879 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2112,29 +2112,38 @@ the text that would appear in a mode line or header line
2112based on a certain mode-line specification. 2112based on a certain mode-line specification.
2113 2113
2114@defun format-mode-line format &optional face window buffer 2114@defun format-mode-line format &optional face window buffer
2115This function formats a line of text according to @var{format} as if 2115This function formats a line of text according to @var{format} as if it
2116it were generating the mode line for @var{window}, but instead of 2116were generating the mode line for @var{window}, but it also returns the
2117displaying the text in the mode line or the header line, it returns 2117text as a string. The argument @var{window} defaults to the selected
2118the text as a string. The argument @var{window} defaults to the 2118window. If @var{buffer} is non-@code{nil}, all the information used is
2119selected window. If @var{buffer} is non-@code{nil}, all the 2119taken from @var{buffer}; by default, it comes from @var{window}'s
2120information used is taken from @var{buffer}; by default, it comes from 2120buffer.
2121@var{window}'s buffer.
2122 2121
2123The value string normally has text properties that correspond to the 2122The value string normally has text properties that correspond to the
2124faces, keymaps, etc., that the mode line would have. And any character 2123faces, keymaps, etc., that the mode line would have. Any character for
2125for which no @code{face} property is specified gets a default 2124which no @code{face} property is specified by @var{format} gets a
2126value which is usually @var{face}. (If @var{face} is @code{t}, 2125default value determined by @var{face}. If @var{face} is @code{t}, that
2127that stands for either @code{mode-line} if @var{window} is selected, 2126stands for either @code{mode-line} if @var{window} is selected,
2128otherwise @code{mode-line-inactive}. If @var{face} is @code{nil} or 2127otherwise @code{mode-line-inactive}. If @var{face} is @code{nil} or
2129omitted, that stands for no face property.) 2128omitted, that stands for the default face. If @var{face} is an integer,
2129the value returned by this function will have no text properties.
2130 2130
2131However, if @var{face} is an integer, the value has no text properties. 2131You can also specify other valid faces as the value of @var{face}.
2132If specified, that face provides the @code{face} property for characters
2133whose face is not specified by @var{format}.
2134
2135Note that using @code{mode-line}, @code{mode-line-inactive}, or
2136@code{header-line} as @var{face} will actually redisplay the mode line
2137or the header line, respectively, using the current definitions of the
2138corresponding face, in addition to returning the formatted string.
2139(Other faces do not cause redisplay.)
2132 2140
2133For example, @code{(format-mode-line header-line-format)} returns the 2141For example, @code{(format-mode-line header-line-format)} returns the
2134text that would appear in the selected window's header line (@code{""} 2142text that would appear in the selected window's header line (@code{""}
2135if it has no header line). @code{(format-mode-line header-line-format 2143if it has no header line). @code{(format-mode-line header-line-format
2136'header-line)} returns the same text, with each character 2144'header-line)} returns the same text, with each character
2137carrying the face that it will have in the header line itself. 2145carrying the face that it will have in the header line itself, and also
2146redraws the header line.
2138@end defun 2147@end defun
2139 2148
2140@node Imenu 2149@node Imenu
diff --git a/doc/man/ChangeLog b/doc/man/ChangeLog
index f2810be7f97..55e38e33a0a 100644
--- a/doc/man/ChangeLog
+++ b/doc/man/ChangeLog
@@ -1,3 +1,7 @@
12011-01-02 Jari Aalto <jari.aalto@cante.net> (tiny change)
2
3 * emacsclient.1: Arrange options alphabetically (Bug#7620).
4
12010-10-12 Glenn Morris <rgm@gnu.org> 52010-10-12 Glenn Morris <rgm@gnu.org>
2 6
3 * emacs.1: Small fixes. 7 * emacs.1: Small fixes.
diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1
index 16bfb73e16b..6af699e036b 100644
--- a/doc/man/emacsclient.1
+++ b/doc/man/emacsclient.1
@@ -49,36 +49,36 @@ If you set the variable `server-window' to a window or a frame, `C-x
49The programs follow the usual GNU command line syntax, with long 49The programs follow the usual GNU command line syntax, with long
50options starting with two dashes (`-'). 50options starting with two dashes (`-').
51.TP 51.TP
52.B \-nw, \-t, \-\-tty 52.B \-a, \-\-alternate-editor=EDITOR
53open a new Emacs frame on the current terminal 53if the Emacs server is not running, run the specified editor instead.
54This can also be specified via the `ALTERNATE_EDITOR' environment variable.
55If the value of EDITOR is the empty string, then Emacs is started in
56daemon mode and emacsclient will try to connect to it.
54.TP 57.TP
55.B -c, \-\-create-frame 58.B -c, \-\-create-frame
56create a new frame instead of trying to use the current Emacs frame 59create a new frame instead of trying to use the current Emacs frame
57.TP 60.TP
61.B \-d, \-\-display=DISPLAY
62tell the server to display the files on the given display.
63.TP
58.B \-e, \-\-eval 64.B \-e, \-\-eval
59do not visit files but instead evaluate the arguments as Emacs 65do not visit files but instead evaluate the arguments as Emacs
60Lisp expressions. 66Lisp expressions.
61.TP 67.TP
68.B \-f, \-\-server-file=FILENAME
69use TCP configuration file FILENAME for communication.
70This can also be specified via the `EMACS_SERVER_FILE' environment variable.
71.TP
62.B \-n, \-\-no-wait 72.B \-n, \-\-no-wait
63returns 73returns
64immediately without waiting for you to "finish" the buffer in Emacs. 74immediately without waiting for you to "finish" the buffer in Emacs.
65.TP 75.TP
76.B \-nw, \-t, \-\-tty
77open a new Emacs frame on the current terminal
78.TP
66.B \-s, \-\-socket-name=FILENAME 79.B \-s, \-\-socket-name=FILENAME
67use socket named FILENAME for communication. 80use socket named FILENAME for communication.
68.TP 81.TP
69.B \-f, \-\-server-file=FILENAME
70use TCP configuration file FILENAME for communication.
71This can also be specified via the `EMACS_SERVER_FILE' environment variable.
72.TP
73.B \-a, \-\-alternate-editor=EDITOR
74if the Emacs server is not running, run the specified editor instead.
75This can also be specified via the `ALTERNATE_EDITOR' environment variable.
76If the value of EDITOR is the empty string, then Emacs is started in
77daemon mode and emacsclient will try to connect to it.
78.TP
79.B \-d, \-\-display=DISPLAY
80tell the server to display the files on the given display.
81.TP
82.B \-V, \-\-version 82.B \-V, \-\-version
83print version information and exit 83print version information and exit
84.TP 84.TP
diff --git a/etc/ChangeLog b/etc/ChangeLog
index ebd613ddfe8..3e21a4fd2cb 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
12011-01-02 Kenichi Handa <handa@m17n.org>
2
3 * NEWS.23: Describe the changes for rmail's MIME handling.
4
12010-12-18 Chong Yidong <cyd@stupidchicken.com> 52010-12-18 Chong Yidong <cyd@stupidchicken.com>
2 6
3 * images/separator.xpm: Tweak colors. 7 * images/separator.xpm: Tweak colors.
diff --git a/etc/NEWS.23 b/etc/NEWS.23
index 0608286e6d5..3b10a6d2815 100644
--- a/etc/NEWS.23
+++ b/etc/NEWS.23
@@ -67,6 +67,27 @@ Bazaar recognizes the headers "Author", "Date" and "Fixes".
67Git, Mercurial, and Monotone recognize "Author" and "Date". 67Git, Mercurial, and Monotone recognize "Author" and "Date".
68Any unknown header is left as is in the message, so it is not lost. 68Any unknown header is left as is in the message, so it is not lost.
69 69
70** Rmail
71
72*** The default value of `rmail-enable-mime' is now t. Rmail decodes
73MIME contents automatically. You can customize the variable
74`rmail-enable-mime' back to `nil' to disable this automatic MIME
75decoding.
76
77*** The command `rmail-mime' change the displaying of a MIME message
78between decoded presentation form and raw data if `rmail-enable-mime'
79is non-nil. And, with prefix argument, it change only the displaying
80of the MIME entity at point.
81
82*** The new command `rmail-mime-next-item' (bound to TAB) moves point
83to the next item of MIME message.
84
85*** The new command `rmail-mime-previous-item' (bound to backtab) moves
86point to the previous item of MIME message.
87
88*** The new command `rmail-mime-toggle-hidden' (RET) hide or show the
89body of the MIME entity at point.
90
70** Obsolete packages 91** Obsolete packages
71 92
72+++ 93+++
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 160a19099a3..c9031421cea 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
12011-01-02 Glenn Morris <rgm@gnu.org>
2
3 * ebrowse.c (version) <emacs_copyright>:
4 * etags.c (print_version) <emacs_copyright>:
5 * rcs2log (Copyright): Set short copyright year to 2011.
6
12010-11-27 Joe Matarazzo <joe.matarazzo@gmail.com> (tiny change) 72010-11-27 Joe Matarazzo <joe.matarazzo@gmail.com> (tiny change)
2 8
3 * ebrowse.c (yylex): If end of input buffer encountered while 9 * ebrowse.c (yylex): If end of input buffer encountered while
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 81067a90819..72709503070 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1,8 +1,8 @@
1/* ebrowse.c --- parsing files for the ebrowse C++ browser 1/* ebrowse.c --- parsing files for the ebrowse C++ browser
2 2
3Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
4 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc. 5 Free Software Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
8 8
@@ -3577,7 +3577,7 @@ void
3577version (void) 3577version (void)
3578{ 3578{
3579 /* Makes it easier to update automatically. */ 3579 /* Makes it easier to update automatically. */
3580 char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 3580 char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc.";
3581 3581
3582 printf ("ebrowse %s\n", VERSION); 3582 printf ("ebrowse %s\n", VERSION);
3583 puts (emacs_copyright); 3583 puts (emacs_copyright);
@@ -3877,7 +3877,4 @@ main (int argc, char **argv)
3877 return EXIT_SUCCESS; 3877 return EXIT_SUCCESS;
3878} 3878}
3879 3879
3880/* arch-tag: fc03b4bc-91a9-4c3d-b3b9-12a77fa86dd8
3881 (do not change this comment) */
3882
3883/* ebrowse.c ends here */ 3880/* ebrowse.c ends here */
diff --git a/lib-src/etags.c b/lib-src/etags.c
index abc8b06dd8e..f06e714c041 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -29,8 +29,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 30
31Copyright (C) 1984, 1987, 1988, 1989, 1993, 1994, 1995, 1998, 1999, 31Copyright (C) 1984, 1987, 1988, 1989, 1993, 1994, 1995, 1998, 1999,
32 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 32 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
33 Free Software Foundation, Inc. 33 2011 Free Software Foundation, Inc.
34 34
35This file is not considered part of GNU Emacs. 35This file is not considered part of GNU Emacs.
36 36
@@ -891,7 +891,7 @@ static void
891print_version (void) 891print_version (void)
892{ 892{
893 /* Makes it easier to update automatically. */ 893 /* Makes it easier to update automatically. */
894 char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 894 char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc.";
895 895
896 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); 896 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
897 puts (emacs_copyright); 897 puts (emacs_copyright);
@@ -6725,7 +6725,4 @@ xrealloc (char *ptr, unsigned int size)
6725 * End: 6725 * End:
6726 */ 6726 */
6727 6727
6728/* arch-tag: 8a9b748d-390c-4922-99db-2eeefa921051
6729 (do not change this comment) */
6730
6731/* etags.c ends here */ 6728/* etags.c ends here */
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 2a2eab83fcb..5808068f646 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -3,8 +3,8 @@
3# RCS to ChangeLog generator 3# RCS to ChangeLog generator
4 4
5# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, 5# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
6# 2004, 2005, 2006, 2007, 2008, 2009, 2010 6# 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
7# Free Software Foundation, Inc. 7# Free Software Foundation, Inc.
8 8
9# Author: Paul Eggert <eggert@twinsun.com> 9# Author: Paul Eggert <eggert@twinsun.com>
10 10
@@ -22,7 +22,7 @@
22# along with this program. If not, see <http://www.gnu.org/licenses/>. 22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
24 24
25Copyright='Copyright (C) 2010 Free Software Foundation, Inc. 25Copyright='Copyright (C) 2011 Free Software Foundation, Inc.
26This program comes with NO WARRANTY, to the extent permitted by law. 26This program comes with NO WARRANTY, to the extent permitted by law.
27You may redistribute copies of this program 27You may redistribute copies of this program
28under the terms of the GNU General Public License. 28under the terms of the GNU General Public License.
@@ -777,4 +777,3 @@ exec rm -fr $logdir
777# tab-width:4 777# tab-width:4
778# End: 778# End:
779 779
780# arch-tag: cea067bd-a552-4254-ba17-078208933073
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8e693845a4f..d1bcb77882f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,119 @@
12011-01-02 Eli Zaretskii <eliz@gnu.org>
2
3 * term/w32-win.el (dynamic-library-alist): Set up correctly for
4 libpng versions both before and after 1.4.0. (Bug#7716)
5
62011-01-02 Eli Zaretskii <eliz@gnu.org>
7
8 * time.el (display-time-mode): Mention display-time-interval in
9 the doc string. (Bug#7713)
10
112011-01-02 Kenichi Handa <handa@m17n.org>
12
13 * mail/rmailmm.el (rmail-mime-parse): Perform parsing in
14 condition-case and return an error message string if something
15 goes wrong.
16 (rmail-show-mime): Adjust for the above change. Insert the
17 header by rmail-mime-insert-header.
18
192011-01-02 Kenichi Handa <handa@m17n.org>
20
21 * mail/rmailmm.el: New key bindings for rmail-mime-next-item,
22 rmail-mime-previous-item, and rmail-mime-toggle-hidden.
23 (rmail-mime-mbox-buffer)
24 (rmail-mime-view-buffer, rmail-mime-coding-system): New variables.
25 (rmail-mime-entity): Argument changed. All codes handling an
26 entity object are changed.
27 (rmail-mime-entity-header, rmail-mime-entity-body): Adjust for
28 the above change.
29 (rmail-mime-entity-children, rmail-mime-entity-handler)
30 (rmail-mime-entity-tagline): New functions.
31 (rmail-mime-message-p): New function.
32 (rmail-mime-save): Bind rmail-mime-mbox-buffer.
33 (rmail-mime-entity-segment, rmail-mime-next-item)
34 (rmail-mime-previous-item, rmail-mime-shown-mode)
35 (rmail-mime-hidden-mode, rmail-mime-raw-mode)
36 (rmail-mime-toggle-raw, rmail-mime-toggle-hidden)
37 (rmail-mime-insert-tagline, rmail-mime-insert-header):
38 New functions.
39 (rmail-mime-text-handler): Call rmail-mime-insert-text.
40 (rmail-mime-insert-decoded-text): New function.
41 (rmail-mime-insert-text): Call rmail-mime-insert-decoded-text.
42 (rmail-mime-insert-image): Argument changed. Caller changed.
43 (rmail-mime-image): Call rmail-mime-toggle-hidden.
44 (rmail-mime-set-bulk-data): New funciton.
45 (rmail-mime-insert-bulk): Argument changed.
46 (rmail-mime-multipart-handler): Return t.
47 (rmail-mime-process-multipart): Argument changed.
48 Handle "multipart/alternative" here.
49 (rmail-mime-process): Argument changed.
50 (rmail-mime-parse): Bind rmail-mime-mbox-buffer.
51 (rmail-mime-insert): Argument changed. Handle raw display mode.
52 (rmail-mime): Argument changed. Handle toggling of raw display
53 mode.
54 (rmail-show-mime): Bind rmail-mime-mbox-buffer and
55 rmail-mime-view-buffer.
56 (rmail-insert-mime-forwarded-message): Likewise.
57 (rmail-search-mime-message): Likewise. Don't bind rmail-buffer.
58
59 * mail/rmail.el (rmail-show-message-1): If rmail-enable-mime is
60 non-nil, handle the header in rmail-show-mime-function.
61
622011-01-02 Leo <sdl.web@gmail.com>
63
64 * help-fns.el (describe-variable): Fix previous change.
65
662011-01-02 Juri Linkov <juri@jurta.org>
67
68 * isearch.el (isearch-lazy-highlight-error): New variable.
69 (isearch-lazy-highlight-new-loop): Compare `isearch-error' and
70 `isearch-lazy-highlight-error'. Set `isearch-lazy-highlight-error'
71 to the current value of `isearch-error' (Bug#7468).
72
732011-01-02 Chong Yidong <cyd@stupidchicken.com>
74
75 * help-fns.el (describe-variable): Don't emit trailing whitespace
76 (Bug#7511).
77
782011-01-02 Chong Yidong <cyd@stupidchicken.com>
79
80 * textmodes/rst.el (rst-compile-pdf-preview)
81 (rst-compile-slides-preview): Use make-temp-file (Bug#7646).
82
832011-01-02 Kevin Gallagher <Kevin.Gallagher@boeing.com>
84
85 * emulation/edt-mapper.el: Override mapping of function keys so
86 that the later call to read-key-sequence works.
87
882011-01-02 Eli Zaretskii <eliz@gnu.org>
89
90 * mail/smtpmail.el (smtpmail-send-it): Write queued mail body with
91 Unix EOLs. (Bug#7589)
92
932011-01-02 Leo <sdl.web@gmail.com>
94
95 * eshell/em-hist.el (eshell-previous-matching-input): Signal error
96 if point is not behind eshell-last-output-end (Bug#7585).
97
982011-01-02 Stefan Monnier <monnier@iro.umontreal.ca>
99
100 * files.el (file-local-variables-alist):
101 Make permanent-local (bug#7767).
102
1032011-01-02 Glenn Morris <rgm@gnu.org>
104
105 * version.el (emacs-copyright): Set short copyright year to 2011.
106
1072011-01-02 Mark Lillibridge <mark.lillibridge@hp.com> (tiny change)
108
109 * mail/mail-utils.el (mail-strip-quoted-names): Avoid clobbering
110 an existing temp buffer. (Bug#7746)
111
1122011-01-02 Glenn Morris <rgm@gnu.org>
113
114 * mail/mail-utils.el (mail-mbox-from): Handle From: headers with
115 multiple addresses. (Bug#7760)
116
12010-12-31 Michael Albinus <michael.albinus@gmx.de> 1172010-12-31 Michael Albinus <michael.albinus@gmx.de>
2 118
3 * net/tramp-sh.el (tramp-methods): Add recursive options to "scpc" 119 * net/tramp-sh.el (tramp-methods): Add recursive options to "scpc"
@@ -20285,7 +20401,7 @@ See ChangeLog.14 for earlier changes.
20285;; coding: utf-8 20401;; coding: utf-8
20286;; End: 20402;; End:
20287 20403
20288 Copyright (C) 2009, 2010 Free Software Foundation, Inc. 20404 Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
20289 20405
20290 This file is part of GNU Emacs. 20406 This file is part of GNU Emacs.
20291 20407
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 6bf50db5442..09b28cca7fe 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -142,6 +142,48 @@
142 (setq edt-term (getenv "TERM"))) 142 (setq edt-term (getenv "TERM")))
143 143
144;;; 144;;;
145;;; Implements a workaround for a feature that was added to simple.el.
146;;;
147;;; Many function keys have no Emacs functions assigned to them by
148;;; default. A subset of these are typically assigned functions in the
149;;; EDT emulation. This includes all the keypad keys and a some others
150;;; like Delete.
151;;;
152;;; Logic in simple.el maps some of these unassigned function keys to
153;;; ordinary typing keys. Where this is the case, a call to
154;;; read-key-sequence, below, does not return the name of the function
155;;; key pressd by the user but, instead, it returns the name of the
156;;; key to which it has been mapped. It needs to know the name of the
157;;; key pressed by the user. As a workaround, we assign a function to
158;;; each of the unassigned function keys of interest, here. These
159;;; assignments override the mapping to other keys and are only
160;;; temporary since, when edt-mapper is finished executing, it causes
161;;; Emacs to exit.
162;;;
163
164(mapc
165 (lambda (function-key)
166 (if (not (lookup-key (current-global-map) function-key))
167 (define-key (current-global-map) function-key 'forward-char)))
168 '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4]
169 [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]
170 [kp-space]
171 [kp-tab]
172 [kp-enter]
173 [kp-multiply]
174 [kp-add]
175 [kp-separator]
176 [kp-subtract]
177 [kp-decimal]
178 [kp-divide]
179 [kp-equal]
180 [backspace]
181 [delete]
182 [tab]
183 [linefeed]
184 [clear]))
185
186;;;
145;;; Make sure the window is big enough to display the instructions, 187;;; Make sure the window is big enough to display the instructions,
146;;; except where window cannot be re-sized. 188;;; except where window cannot be re-sized.
147;;; 189;;;
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 1f644261337..82c9b0ccfc3 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -837,6 +837,8 @@ With prefix argument N, search for Nth previous match.
837If N is negative, find the next or Nth next match." 837If N is negative, find the next or Nth next match."
838 (interactive (eshell-regexp-arg "Previous input matching (regexp): ")) 838 (interactive (eshell-regexp-arg "Previous input matching (regexp): "))
839 (setq arg (eshell-search-arg arg)) 839 (setq arg (eshell-search-arg arg))
840 (if (> eshell-last-output-end (point))
841 (error "Point not located after prompt"))
840 (let ((pos (eshell-previous-matching-input-string-position regexp arg))) 842 (let ((pos (eshell-previous-matching-input-string-position regexp arg)))
841 ;; Has a match been found? 843 ;; Has a match been found?
842 (if (null pos) 844 (if (null pos)
@@ -844,7 +846,7 @@ If N is negative, find the next or Nth next match."
844 (setq eshell-history-index pos) 846 (setq eshell-history-index pos)
845 (unless (minibuffer-window-active-p (selected-window)) 847 (unless (minibuffer-window-active-p (selected-window))
846 (message "History item: %d" (- (ring-length eshell-history-ring) pos))) 848 (message "History item: %d" (- (ring-length eshell-history-ring) pos)))
847 ;; Can't use kill-region as it sets this-command 849 ;; Can't use kill-region as it sets this-command
848 (delete-region eshell-last-output-end (point)) 850 (delete-region eshell-last-output-end (point))
849 (insert-and-inherit (eshell-get-history pos))))) 851 (insert-and-inherit (eshell-get-history pos)))))
850 852
diff --git a/lisp/files.el b/lisp/files.el
index 76526de1c0a..1383c90dcb6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1,8 +1,8 @@
1;;; files.el --- file input and output commands for Emacs 1;;; files.el --- file input and output commands for Emacs
2 2
3;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 3;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996,
4;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 4;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6 6
7;; Maintainer: FSF 7;; Maintainer: FSF
8;; Package: emacs 8;; Package: emacs
@@ -2876,6 +2876,7 @@ is a file-local variable (a symbol) and VALUE is the value
2876specified. The actual value in the buffer may differ from VALUE, 2876specified. The actual value in the buffer may differ from VALUE,
2877if it is changed by the major or minor modes, or by the user.") 2877if it is changed by the major or minor modes, or by the user.")
2878(make-variable-buffer-local 'file-local-variables-alist) 2878(make-variable-buffer-local 'file-local-variables-alist)
2879(put 'file-local-variables-alist 'permanent-local t)
2879 2880
2880(defvar dir-local-variables-alist nil 2881(defvar dir-local-variables-alist nil
2881 "Alist of directory-local variable settings in the current buffer. 2882 "Alist of directory-local variable settings in the current buffer.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index b100a4e471d..9b8e7f1458c 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -639,19 +639,16 @@ it is displayed along with the global value."
639 (if valvoid 639 (if valvoid
640 (princ " is void as a variable.") 640 (princ " is void as a variable.")
641 (princ "'s ")))) 641 (princ "'s "))))
642 (if valvoid 642 (unless valvoid
643 nil
644 (with-current-buffer standard-output 643 (with-current-buffer standard-output
645 (setq val-start-pos (point)) 644 (setq val-start-pos (point))
646 (princ "value is ") 645 (princ "value is ")
647 (terpri)
648 (let ((from (point))) 646 (let ((from (point)))
647 (terpri)
649 (pp val) 648 (pp val)
650 ;; Hyperlinks in variable's value are quite frequently 649 (if (< (point) (+ 68 (line-beginning-position 0)))
651 ;; inappropriate e.g C-h v <RET> features <RET> 650 (delete-region from (1+ from))
652 ;; (help-xref-on-pp from (point)) 651 (delete-region (1- from) from))
653 (if (< (point) (+ from 20))
654 (delete-region (1- from) from))
655 (let* ((sv (get variable 'standard-value)) 652 (let* ((sv (get variable 'standard-value))
656 (origval (and (consp sv) 653 (origval (and (consp sv)
657 (condition-case nil 654 (condition-case nil
@@ -666,7 +663,6 @@ it is displayed along with the global value."
666 (if (< (point) (+ from 20)) 663 (if (< (point) (+ from 20))
667 (delete-region (1- from) from))))))) 664 (delete-region (1- from) from)))))))
668 (terpri) 665 (terpri)
669
670 (when locus 666 (when locus
671 (if (bufferp locus) 667 (if (bufferp locus)
672 (princ (format "%socal in buffer %s; " 668 (princ (format "%socal in buffer %s; "
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ebe2e8fa009..70508735f83 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2581,6 +2581,7 @@ since they have special meaning in a regexp."
2581(defvar isearch-lazy-highlight-regexp nil) 2581(defvar isearch-lazy-highlight-regexp nil)
2582(defvar isearch-lazy-highlight-space-regexp nil) 2582(defvar isearch-lazy-highlight-space-regexp nil)
2583(defvar isearch-lazy-highlight-forward nil) 2583(defvar isearch-lazy-highlight-forward nil)
2584(defvar isearch-lazy-highlight-error nil)
2584 2585
2585(defun lazy-highlight-cleanup (&optional force) 2586(defun lazy-highlight-cleanup (&optional force)
2586 "Stop lazy highlighting and remove extra highlighting from current buffer. 2587 "Stop lazy highlighting and remove extra highlighting from current buffer.
@@ -2622,9 +2623,13 @@ by other Emacs features."
2622 (not (= (window-end) ; Window may have been split/joined. 2623 (not (= (window-end) ; Window may have been split/joined.
2623 isearch-lazy-highlight-window-end)) 2624 isearch-lazy-highlight-window-end))
2624 (not (eq isearch-forward 2625 (not (eq isearch-forward
2625 isearch-lazy-highlight-forward)))) 2626 isearch-lazy-highlight-forward))
2627 ;; In case we are recovering from an error.
2628 (not (equal isearch-error
2629 isearch-lazy-highlight-error))))
2626 ;; something important did indeed change 2630 ;; something important did indeed change
2627 (lazy-highlight-cleanup t) ;kill old loop & remove overlays 2631 (lazy-highlight-cleanup t) ;kill old loop & remove overlays
2632 (setq isearch-lazy-highlight-error isearch-error)
2628 (when (not isearch-error) 2633 (when (not isearch-error)
2629 (setq isearch-lazy-highlight-start-limit beg 2634 (setq isearch-lazy-highlight-start-limit beg
2630 isearch-lazy-highlight-end-limit end) 2635 isearch-lazy-highlight-end-limit end)
diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el
index 42d2f35baed..d866fed371e 100644
--- a/lisp/mail/binhex.el
+++ b/lisp/mail/binhex.el
@@ -1,4 +1,4 @@
1;;; binhex.el --- elisp native binhex decode 1;;; binhex.el --- decode BinHex-encoded text
2 2
3;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
@@ -23,6 +23,11 @@
23 23
24;;; Commentary: 24;;; Commentary:
25 25
26;; BinHex is a binary-to-text encoding scheme similar to uuencode.
27;; The command `binhex-decode-region' decodes BinHex-encoded text, via
28;; the external program "hexbin" if that is available, or an Emacs
29;; Lisp implementation if not.
30
26;;; Code: 31;;; Code:
27 32
28(eval-when-compile (require 'cl)) 33(eval-when-compile (require 'cl))
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index a8d845146f6..81a2bd49441 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -1,7 +1,7 @@
1;;; mail-utils.el --- utility functions used both by rmail and rnews 1;;; mail-utils.el --- utility functions used both by rmail and rnews
2 2
3;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 3;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4;; 2009, 2010 Free Software Foundation, Inc. 4;; 2009, 2010, 2011 Free Software Foundation, Inc.
5 5
6;; Maintainer: FSF 6;; Maintainer: FSF
7;; Keywords: mail, news 7;; Keywords: mail, news
@@ -185,8 +185,7 @@ Return a modified address list."
185 ;; Detect nested comments. 185 ;; Detect nested comments.
186 (if (string-match "[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*(" address) 186 (if (string-match "[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*(" address)
187 ;; Strip nested comments. 187 ;; Strip nested comments.
188 (with-current-buffer (get-buffer-create " *temp*") 188 (with-temp-buffer
189 (erase-buffer)
190 (insert address) 189 (insert address)
191 (set-syntax-table lisp-mode-syntax-table) 190 (set-syntax-table lisp-mode-syntax-table)
192 (goto-char 1) 191 (goto-char 1)
@@ -199,8 +198,7 @@ Return a modified address list."
199 (forward-sexp 1) 198 (forward-sexp 1)
200 (error (goto-char (point-max)))) 199 (error (goto-char (point-max))))
201 (point)))) 200 (point))))
202 (setq address (buffer-string)) 201 (setq address (buffer-string)))
203 (erase-buffer))
204 ;; Strip non-nested comments an easier way. 202 ;; Strip non-nested comments an easier way.
205 (while (setq pos (string-match 203 (while (setq pos (string-match
206 ;; This doesn't hack rfc822 nested comments 204 ;; This doesn't hack rfc822 nested comments
@@ -235,12 +233,12 @@ Return a modified address list."
235 nil 'literal address 2))) 233 nil 'literal address 2)))
236 address)))) 234 address))))
237 235
238;;; The following piece of ugliness is legacy code. The name was an 236;; The following piece of ugliness is legacy code. The name was an
239;;; unfortunate choice --- a flagrant violation of the Emacs Lisp 237;; unfortunate choice --- a flagrant violation of the Emacs Lisp
240;;; coding conventions. `mail-dont-reply-to' would have been 238;; coding conventions. `mail-dont-reply-to' would have been
241;;; infinitely better. Also, `rmail-dont-reply-to-names' might have 239;; infinitely better. Also, `rmail-dont-reply-to-names' might have
242;;; been better named `mail-dont-reply-to-names' and sourced from this 240;; been better named `mail-dont-reply-to-names' and sourced from this
243;;; file instead of in rmail.el. Yuck. -pmr 241;; file instead of in rmail.el. Yuck. -pmr
244(defun rmail-dont-reply-to (destinations) 242(defun rmail-dont-reply-to (destinations)
245 "Prune addresses from DESTINATIONS, a list of recipient addresses. 243 "Prune addresses from DESTINATIONS, a list of recipient addresses.
246All addresses matching `rmail-dont-reply-to-names' are removed from 244All addresses matching `rmail-dont-reply-to-names' are removed from
@@ -394,13 +392,19 @@ matches may be returned from the message body."
394(defun mail-mbox-from () 392(defun mail-mbox-from ()
395 "Return an mbox \"From \" line for the current message. 393 "Return an mbox \"From \" line for the current message.
396The buffer should be narrowed to just the header." 394The buffer should be narrowed to just the header."
397 (let ((from (or (mail-fetch-field "from") 395 (let* ((from (mail-strip-quoted-names (or (mail-fetch-field "from")
398 (mail-fetch-field "really-from") 396 (mail-fetch-field "really-from")
399 (mail-fetch-field "sender") 397 (mail-fetch-field "sender")
400 (mail-fetch-field "return-path") 398 (mail-fetch-field "return-path")
401 "unknown")) 399 "unknown")))
402 (date (mail-fetch-field "date"))) 400 (date (mail-fetch-field "date"))
403 (format "From %s %s\n" (mail-strip-quoted-names from) 401 ;; A From: header can contain multiple addresses, a "From "
402 ;; line must contain only one. (Bug#7760)
403 ;; See eg RFC 5322, 3.6.2. Originator Fields.
404 (end (string-match "[ \t]*[,\n]" from)))
405 (format "From %s %s\n" (if end
406 (substring from 0 end)
407 from)
404 (or (and date 408 (or (and date
405 (ignore-errors 409 (ignore-errors
406 (current-time-string (date-to-time date)))) 410 (current-time-string (date-to-time date))))
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 7b896e579bc..250481c20b5 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -2691,75 +2691,72 @@ The current mail message becomes the message displayed."
2691 (message "Showing message %d" msg)) 2691 (message "Showing message %d" msg))
2692 (narrow-to-region beg end) 2692 (narrow-to-region beg end)
2693 (goto-char beg) 2693 (goto-char beg)
2694 (if (and rmail-enable-mime
2695 (re-search-forward "mime-version: 1.0" nil t))
2696 (let ((rmail-buffer mbox-buf)
2697 (rmail-view-buffer view-buf))
2698 (funcall rmail-show-mime-function))
2699 (setq body-start (search-forward "\n\n" nil t))
2700 (narrow-to-region beg (point))
2701 (goto-char beg)
2702 (save-excursion
2703 (if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t)
2704 (setq coding-system (intern (match-string 1)))
2705 (setq coding-system (rmail-get-coding-system))))
2706 (setq character-coding (mail-fetch-field "content-transfer-encoding")
2707 is-text-message (rmail-is-text-p))
2708 (if character-coding
2709 (setq character-coding (downcase character-coding)))
2710 (narrow-to-region beg end)
2711 ;; Decode the message body into an empty view buffer using a
2712 ;; unibyte temporary buffer where the character decoding takes
2713 ;; place.
2714 (with-current-buffer rmail-view-buffer
2715 (erase-buffer))
2716 (if (null character-coding)
2717 ;; Do it directly since that is fast.
2718 (rmail-decode-region body-start end coding-system view-buf)
2719 ;; Can this be done directly, skipping the temp buffer?
2720 (with-temp-buffer
2721 (set-buffer-multibyte nil)
2722 (insert-buffer-substring mbox-buf body-start end)
2723 (cond
2724 ((string= character-coding "quoted-printable")
2725 ;; See bug#5441.
2726 (or (mail-unquote-printable-region (point-min) (point-max)
2727 nil t 'unibyte)
2728 (message "Malformed MIME quoted-printable message")))
2729 ((and (string= character-coding "base64") is-text-message)
2730 (condition-case err
2731 (base64-decode-region (point-min) (point-max))
2732 (error (message "%s" (cdr err)))))
2733 ((eq character-coding 'uuencode)
2734 (error "uuencoded messages are not supported yet"))
2735 (t))
2736 (rmail-decode-region (point-min) (point-max)
2737 coding-system view-buf))))
2738 (with-current-buffer rmail-view-buffer 2694 (with-current-buffer rmail-view-buffer
2739 ;; We give the view buffer a buffer-local value of 2695 ;; We give the view buffer a buffer-local value of
2740 ;; rmail-header-style based on the binding in effect when 2696 ;; rmail-header-style based on the binding in effect when
2741 ;; this function is called; `rmail-toggle-headers' can 2697 ;; this function is called; `rmail-toggle-headers' can
2742 ;; inspect this value to determine how to toggle. 2698 ;; inspect this value to determine how to toggle.
2743 (set (make-local-variable 'rmail-header-style) header-style) 2699 (set (make-local-variable 'rmail-header-style) header-style))
2744 ;; Unquote quoted From lines 2700 (if (and rmail-enable-mime
2745 (goto-char (point-min)) 2701 (re-search-forward "mime-version: 1.0" nil t))
2746 (while (re-search-forward "^>+From " nil t) 2702 (let ((rmail-buffer mbox-buf)
2747 (beginning-of-line) 2703 (rmail-view-buffer view-buf))
2748 (delete-char 1) 2704 (funcall rmail-show-mime-function))
2749 (forward-line)) 2705 (setq body-start (search-forward "\n\n" nil t))
2750 (goto-char (point-min))) 2706 (narrow-to-region beg (point))
2751 ;; Copy the headers to the front of the message view buffer. 2707 (goto-char beg)
2752 (rmail-copy-headers beg end) 2708 (save-excursion
2753 ;; Add the separator (blank line) between headers and body; 2709 (if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t)
2710 (setq coding-system (intern (match-string 1)))
2711 (setq coding-system (rmail-get-coding-system))))
2712 (setq character-coding (mail-fetch-field "content-transfer-encoding")
2713 is-text-message (rmail-is-text-p))
2714 (if character-coding
2715 (setq character-coding (downcase character-coding)))
2716 (narrow-to-region beg end)
2717 ;; Decode the message body into an empty view buffer using a
2718 ;; unibyte temporary buffer where the character decoding takes
2719 ;; place.
2720 (with-current-buffer rmail-view-buffer
2721 (erase-buffer))
2722 (if (null character-coding)
2723 ;; Do it directly since that is fast.
2724 (rmail-decode-region body-start end coding-system view-buf)
2725 ;; Can this be done directly, skipping the temp buffer?
2726 (with-temp-buffer
2727 (set-buffer-multibyte nil)
2728 (insert-buffer-substring mbox-buf body-start end)
2729 (cond
2730 ((string= character-coding "quoted-printable")
2731 ;; See bug#5441.
2732 (or (mail-unquote-printable-region (point-min) (point-max)
2733 nil t 'unibyte)
2734 (message "Malformed MIME quoted-printable message")))
2735 ((and (string= character-coding "base64") is-text-message)
2736 (condition-case err
2737 (base64-decode-region (point-min) (point-max))
2738 (error (message "%s" (cdr err)))))
2739 ((eq character-coding 'uuencode)
2740 (error "uuencoded messages are not supported yet"))
2741 (t))
2742 (rmail-decode-region (point-min) (point-max)
2743 coding-system view-buf)))
2744 (with-current-buffer rmail-view-buffer
2745 ;; Prepare the separator (blank line) before the body.
2746 (goto-char (point-min))
2747 (insert "\n")
2748 ;; Unquote quoted From lines
2749 (while (re-search-forward "^>+From " nil t)
2750 (beginning-of-line)
2751 (delete-char 1)
2752 (forward-line))
2753 (goto-char (point-min)))
2754 ;; Copy the headers to the front of the message view buffer.
2755 (rmail-copy-headers beg end))
2754 ;; highlight the message, activate any URL like text and add 2756 ;; highlight the message, activate any URL like text and add
2755 ;; special highlighting for and quoted material. 2757 ;; special highlighting for and quoted material.
2756 (with-current-buffer rmail-view-buffer 2758 (with-current-buffer rmail-view-buffer
2757 (insert "\n")
2758 (goto-char (point-min)) 2759 (goto-char (point-min))
2759 ;; Decode the headers according to RFC2047.
2760 (save-excursion
2761 (search-forward "\n\n" nil 'move)
2762 (rfc2047-decode-region (point-min) (point)))
2763 (rmail-highlight-headers) 2760 (rmail-highlight-headers)
2764 ;(rmail-activate-urls) 2761 ;(rmail-activate-urls)
2765 ;(rmail-process-quoted-material) 2762 ;(rmail-process-quoted-material)
@@ -4289,18 +4286,28 @@ With prefix argument N moves forward N messages with these labels.
4289 4286
4290;;;*** 4287;;;***
4291 4288
4292;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "b1ce015fd919b54cc7b1d0b2155489f9") 4289;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "3735f9bfe6ff3e612091857cc6b401b6")
4293;;; Generated autoloads from rmailmm.el 4290;;; Generated autoloads from rmailmm.el
4294 4291
4295(autoload 'rmail-mime "rmailmm" "\ 4292(autoload 'rmail-mime "rmailmm" "\
4296Process the current Rmail message as a MIME message. 4293Toggle displaying of a MIME message.
4297This creates a temporary \"*RMAIL*\" buffer holding a decoded 4294
4298copy of the message. Inline content-types are handled according to 4295The actualy behavior depends on the value of `rmail-enable-mime'.
4296
4297If `rmail-enable-mime' is t (default), this command change the
4298displaying of a MIME message between decoded presentation form
4299and raw data.
4300
4301With ARG, toggle the displaying of the current MIME entity only.
4302
4303If `rmail-enable-mime' is nil, this creates a temporary
4304\"*RMAIL*\" buffer holding a decoded copy of the message. Inline
4305content-types are handled according to
4299`rmail-mime-media-type-handlers-alist'. By default, this 4306`rmail-mime-media-type-handlers-alist'. By default, this
4300displays text and multipart messages, and offers to download 4307displays text and multipart messages, and offers to download
4301attachments as specfied by `rmail-mime-attachment-dirs-alist'. 4308attachments as specfied by `rmail-mime-attachment-dirs-alist'.
4302 4309
4303\(fn)" t nil) 4310\(fn &optional ARG)" t nil)
4304 4311
4305;;;*** 4312;;;***
4306 4313
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 708ec64706e..70c4ca36c63 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -53,7 +53,7 @@
53;; 53;;
54;; rmail-mime 54;; rmail-mime
55;; +- rmail-mime-show <----------------------------------+ 55;; +- rmail-mime-show <----------------------------------+
56;; +- rmail-mime-process | 56;; +- rmail-mime-process |
57;; +- rmail-mime-handle | 57;; +- rmail-mime-handle |
58;; +- rmail-mime-text-handler | 58;; +- rmail-mime-text-handler |
59;; +- rmail-mime-bulk-handler | 59;; +- rmail-mime-bulk-handler |
@@ -97,7 +97,9 @@ The first item is a regular expression matching a content-type.
97The remaining elements are handler functions to run, in order of 97The remaining elements are handler functions to run, in order of
98decreasing preference. These are called until one returns non-nil. 98decreasing preference. These are called until one returns non-nil.
99Note that this only applies to items with an inline Content-Disposition, 99Note that this only applies to items with an inline Content-Disposition,
100all others are handled by `rmail-mime-bulk-handler'." 100all others are handled by `rmail-mime-bulk-handler'.
101Note also that this alist is ignored when the variable
102`rmail-enable-mime' is non-nil."
101 :type '(alist :key-type regexp :value-type (repeat function)) 103 :type '(alist :key-type regexp :value-type (repeat function))
102 :version "23.1" 104 :version "23.1"
103 :group 'rmail-mime) 105 :group 'rmail-mime)
@@ -131,18 +133,36 @@ automatically display the image in the buffer."
131 133
132;;; End of user options. 134;;; End of user options.
133 135
136;;; Global variables that always have let-binding when referred.
137
138(defvar rmail-mime-mbox-buffer nil
139 "Buffer containing the mbox data.
140The value is usually nil, and bound to a proper value while
141processing MIME.")
142
143(defvar rmail-mime-view-buffer nil
144 "Buffer showing a message.
145The value is usually nil, and bound to a proper value while
146processing MIME.")
147
148(defvar rmail-mime-coding-system nil
149 "The first coding-system used for decoding a MIME entity.
150The value is usually nil, and bound to non-nil while inserting
151MIME entities.")
152
134;;; MIME-entity object 153;;; MIME-entity object
135 154
136(defun rmail-mime-entity (type disposition transfer-encoding 155(defun rmail-mime-entity (type disposition transfer-encoding
137 header body children) 156 display header tagline body children handler)
138 "Retrun a newly created MIME-entity object. 157 "Retrun a newly created MIME-entity object from arguments.
139 158
140A MIME-entity is a vector of 6 elements: 159A MIME-entity is a vector of 9 elements:
141 160
142 [ TYPE DISPOSITION TRANSFER-ENCODING HEADER BODY CHILDREN ] 161 [TYPE DISPOSITION TRANSFER-ENCODING DISPLAY HEADER TAGLINE BODY
143 162 CHILDREN HANDLER]
144TYPE and DISPOSITION correspond to MIME headers Content-Type: and 163
145Cotent-Disposition: respectively, and has this format: 164TYPE and DISPOSITION correspond to MIME headers Content-Type and
165Cotent-Disposition respectively, and has this format:
146 166
147 \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...) 167 \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...)
148 168
@@ -161,31 +181,61 @@ The corresponding TYPE argument must be:
161TRANSFER-ENCODING corresponds to MIME header 181TRANSFER-ENCODING corresponds to MIME header
162Content-Transfer-Encoding, and is a lowercased string. 182Content-Transfer-Encoding, and is a lowercased string.
163 183
164HEADER and BODY are a cons (BEG . END), where BEG and END specify 184DISPLAY is a vector [CURRENT NEW], where CURRENT indicates how
165the region of the corresponding part in RMAIL's data (mbox) 185the header, tagline, and body of the entity are displayed now,
166buffer. BODY may be nil. In that case, the current buffer is 186and NEW indicates how their displaying should be updated.
167narrowed to the body part. 187Both elements are vector [HEADER-DISPLAY TAGLINE-DISPLAY BODY-DISPLAY],
168 188where each element is a symbol for the corresponding item that
169CHILDREN is a list of MIME-entities for a \"multipart\" entity, and 189has these values:
170nil for the other types." 190 nil: not displayed
171 (vector type disposition transfer-encoding header body children)) 191 t: displayed by the decoded presentation form
192 raw: displayed by the raw MIME data (for the header and body only)
193
194HEADER and BODY are vectors [BEG END DISPLAY-FLAG], where BEG and
195END specify the region of the header or body lines in RMAIL's
196data (mbox) buffer, and DISPLAY-FLAG non-nil means that the
197header or body is, by default, displayed by the decoded
198presentation form.
199
200TAGLINE is a vector [TAG BULK-DATA DISPLAY-FLAG], where TAG is a
201string indicating the depth and index number of the entity,
202BULK-DATA is a cons (SIZE . TYPE) indicating the size and type of
203an attached data, DISPLAY-FLAG non-nil means that the tagline is,
204by default, displayed.
205
206CHILDREN is a list of child MIME-entities. A \"multipart/*\"
207entity have one or more children. A \"message/rfc822\" entity
208has just one child. Any other entity has no child.
209
210HANDLER is a function to insert the entity according to DISPLAY.
211It is called with one argument ENTITY."
212 (vector type disposition transfer-encoding
213 display header tagline body children handler))
172 214
173;; Accessors for a MIME-entity object. 215;; Accessors for a MIME-entity object.
174(defsubst rmail-mime-entity-type (entity) (aref entity 0)) 216(defsubst rmail-mime-entity-type (entity) (aref entity 0))
175(defsubst rmail-mime-entity-disposition (entity) (aref entity 1)) 217(defsubst rmail-mime-entity-disposition (entity) (aref entity 1))
176(defsubst rmail-mime-entity-transfer-encoding (entity) (aref entity 2)) 218(defsubst rmail-mime-entity-transfer-encoding (entity) (aref entity 2))
177(defsubst rmail-mime-entity-header (entity) (aref entity 3)) 219(defsubst rmail-mime-entity-display (entity) (aref entity 3))
178(defsubst rmail-mime-entity-body (entity) (aref entity 4)) 220(defsubst rmail-mime-entity-header (entity) (aref entity 4))
179(defsubst rmail-mime-entity-children (entity) (aref entity 5)) 221(defsubst rmail-mime-entity-tagline (entity) (aref entity 5))
222(defsubst rmail-mime-entity-body (entity) (aref entity 6))
223(defsubst rmail-mime-entity-children (entity) (aref entity 7))
224(defsubst rmail-mime-entity-handler (entity) (aref entity 8))
225
226(defsubst rmail-mime-message-p ()
227 "Non-nil if and only if the current message is a MIME."
228 (or (get-text-property (point) 'rmail-mime-entity)
229 (get-text-property (point-min) 'rmail-mime-entity)))
180 230
181;;; Buttons 231;;; Buttons
182 232
183(defun rmail-mime-save (button) 233(defun rmail-mime-save (button)
184 "Save the attachment using info in the BUTTON." 234 "Save the attachment using info in the BUTTON."
185 (let* ((filename (button-get button 'filename)) 235 (let* ((rmail-mime-mbox-buffer rmail-view-buffer)
236 (filename (button-get button 'filename))
186 (directory (button-get button 'directory)) 237 (directory (button-get button 'directory))
187 (data (button-get button 'data)) 238 (data (button-get button 'data))
188 (mbox-buf rmail-view-buffer)
189 (ofilename filename)) 239 (ofilename filename))
190 (setq filename (expand-file-name 240 (setq filename (expand-file-name
191 (read-file-name (format "Save as (default: %s): " filename) 241 (read-file-name (format "Save as (default: %s): " filename)
@@ -210,7 +260,8 @@ nil for the other types."
210 ;; DATA is a MIME-entity object. 260 ;; DATA is a MIME-entity object.
211 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data)) 261 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data))
212 (body (rmail-mime-entity-body data))) 262 (body (rmail-mime-entity-body data)))
213 (insert-buffer-substring mbox-buf (car body) (cdr body)) 263 (insert-buffer-substring rmail-mime-mbox-buffer
264 (aref body 0) (aref body 1))
214 (cond ((string= transfer-encoding "base64") 265 (cond ((string= transfer-encoding "base64")
215 (ignore-errors (base64-decode-region (point-min) (point-max)))) 266 (ignore-errors (base64-decode-region (point-min) (point-max))))
216 ((string= transfer-encoding "quoted-printable") 267 ((string= transfer-encoding "quoted-printable")
@@ -219,34 +270,293 @@ nil for the other types."
219 270
220(define-button-type 'rmail-mime-save 'action 'rmail-mime-save) 271(define-button-type 'rmail-mime-save 'action 'rmail-mime-save)
221 272
273(defun rmail-mime-entity-segment (pos &optional entity)
274 "Return a vector describing the displayed region of a MIME-entity at POS.
275Optional 2nd argument ENTITY is the MIME-entity at POS.
276The value is a vector [ INDEX HEADER TAGLINE BODY END], where
277 HEADER: the position of the beginning of a header
278 TAGLINE: the position of the beginning of a tagline
279 BODY: the position of the beginning of a body
280 END: the position of the end of the entity.
281 INDEX: index into the returned vector indicating where POS is."
282 (save-excursion
283 (or entity
284 (setq entity (get-text-property pos 'rmail-mime-entity)))
285 (if (not entity)
286 (vector 1 (point) (point) (point) (point))
287 (let ((current (aref (rmail-mime-entity-display entity) 0))
288 (beg (if (and (> pos (point-min))
289 (eq (get-text-property (1- pos) 'rmail-mime-entity)
290 entity))
291 (previous-single-property-change pos 'rmail-mime-entity
292 nil (point-min))
293 pos))
294 (index 1)
295 tagline-beg body-beg end)
296 (goto-char beg)
297 (if (aref current 0)
298 (search-forward "\n\n" nil t))
299 (setq tagline-beg (point))
300 (if (>= pos tagline-beg)
301 (setq index 2))
302 (if (aref current 1)
303 (forward-line 1))
304 (setq body-beg (point))
305 (if (>= pos body-beg)
306 (setq index 3))
307 (if (aref current 2)
308 (let ((tag (aref (rmail-mime-entity-tagline entity) 0))
309 tag2)
310 (setq end (next-single-property-change beg 'rmail-mime-entity
311 nil (point-max)))
312 (while (and (< end (point-max))
313 (setq entity (get-text-property end 'rmail-mime-entity)
314 tag2 (aref (rmail-mime-entity-tagline entity) 0))
315 (and (> (length tag2) 0)
316 (eq (string-match tag tag2) 0)))
317 (setq end (next-single-property-change end 'rmail-mime-entity
318 nil (point-max)))))
319 (setq end body-beg))
320 (vector index beg tagline-beg body-beg end)))))
321
322(defun rmail-mime-next-item ()
323 "Move point to the next displayed item of the current MIME entity.
324A MIME entity has three items; header, tagline, and body.
325If we are in the last item of the entity, move point to the first
326item of the next entity. If we reach the end of buffer, move
327point to the first item of the first entity (i.e. the beginning
328of buffer)."
329 (interactive)
330 (if (rmail-mime-message-p)
331 (let* ((segment (rmail-mime-entity-segment (point)))
332 (next-pos (aref segment (1+ (aref segment 0))))
333 (button (next-button (point))))
334 (goto-char (if (and button (< (button-start button) next-pos))
335 (button-start button)
336 next-pos))
337 (if (eobp)
338 (goto-char (point-min))))))
339
340(defun rmail-mime-previous-item ()
341 "Move point to the previous displayed item of the current MIME message.
342A MIME entity has three items; header, tagline, and body.
343If we are at the beginning of the first item of the entity, move
344point to the last item of the previous entity. If we reach the
345beginning of buffer, move point to the last item of the last
346entity."
347 (interactive)
348 (when (rmail-mime-message-p)
349 (if (bobp)
350 (goto-char (point-max)))
351 (let* ((segment (rmail-mime-entity-segment (1- (point))))
352 (prev-pos (aref segment (aref segment 0)))
353 (button (previous-button (point))))
354 (goto-char (if (and button (> (button-start button) prev-pos))
355 (button-start button)
356 prev-pos)))))
357
358(defun rmail-mime-shown-mode (entity)
359 "Make MIME-entity ENTITY displayed by the default way."
360 (let ((new (aref (rmail-mime-entity-display entity) 1)))
361 (aset new 0 (aref (rmail-mime-entity-header entity) 2))
362 (aset new 1 (aref (rmail-mime-entity-tagline entity) 2))
363 (aset new 2 (aref (rmail-mime-entity-body entity) 2))))
364
365(defun rmail-mime-hidden-mode (entity top)
366 "Make MIME-entity ENTITY displayed in the hidden mode.
367If TOP is non-nil, display ENTITY only by the tagline.
368Otherwise, don't display ENTITY."
369 (if top
370 (let ((new (aref (rmail-mime-entity-display entity) 1)))
371 (aset new 0 nil)
372 (aset new 1 top)
373 (aset new 2 nil)
374 (aset (rmail-mime-entity-body entity) 2 nil))
375 (let ((current (aref (rmail-mime-entity-display entity) 0)))
376 (aset current 0 nil)
377 (aset current 1 nil)
378 (aset current 2 nil)))
379 (dolist (child (rmail-mime-entity-children entity))
380 (rmail-mime-hidden-mode child nil)))
381
382(defun rmail-mime-raw-mode (entity)
383 "Make MIME-entity ENTITY displayed in the raw mode."
384 (let ((new (aref (rmail-mime-entity-display entity) 1)))
385 (aset new 0 'raw)
386 (aset new 1 nil)
387 (aset new 2 'raw)
388 (dolist (child (rmail-mime-entity-children entity))
389 (rmail-mime-hidden-mode child nil))))
390
391(defun rmail-mime-toggle-raw (entity)
392 "Toggle on and off the raw display mode of MIME-entity ENTITY."
393 (let* ((pos (if (eobp) (1- (point-max)) (point)))
394 (entity (get-text-property pos 'rmail-mime-entity))
395 (current (aref (rmail-mime-entity-display entity) 0))
396 (segment (rmail-mime-entity-segment pos entity)))
397 (if (not (eq (aref current 0) 'raw))
398 ;; Enter the raw mode.
399 (rmail-mime-raw-mode entity)
400 ;; Enter the shown mode.
401 (rmail-mime-shown-mode entity))
402 (let ((inhibit-read-only t)
403 (modified (buffer-modified-p)))
404 (save-excursion
405 (goto-char (aref segment 1))
406 (rmail-mime-insert entity)
407 (restore-buffer-modified-p modified)))))
408
409(defun rmail-mime-toggle-hidden ()
410 "Toggle on and off the hidden display mode of MIME-entity ENTITY."
411 (interactive)
412 (when (rmail-mime-message-p)
413 (let* ((rmail-mime-mbox-buffer rmail-view-buffer)
414 (rmail-mime-view-buffer (current-buffer))
415 (pos (if (eobp) (1- (point-max)) (point)))
416 (entity (get-text-property pos 'rmail-mime-entity))
417 (current (aref (rmail-mime-entity-display entity) 0))
418 (segment (rmail-mime-entity-segment pos entity)))
419 (if (aref current 2)
420 ;; Enter the hidden mode.
421 (progn
422 ;; If point is in the body part, move it to the tagline
423 ;; (or the header if headline is not displayed).
424 (if (= (aref segment 0) 3)
425 (goto-char (aref segment 2)))
426 (rmail-mime-hidden-mode entity t)
427 ;; If the current entity is the topmost one, display the
428 ;; header.
429 (if (and rmail-mime-mbox-buffer (= (aref segment 1) (point-min)))
430 (let ((new (aref (rmail-mime-entity-display entity) 1)))
431 (aset new 0 t))))
432 ;; Enter the shown mode.
433 (aset (rmail-mime-entity-body entity) 2 t)
434 (rmail-mime-shown-mode entity))
435 (let ((inhibit-read-only t)
436 (modified (buffer-modified-p))
437 (rmail-mime-mbox-buffer rmail-view-buffer)
438 (rmail-mime-view-buffer rmail-buffer))
439 (save-excursion
440 (goto-char (aref segment 1))
441 (rmail-mime-insert entity)
442 (restore-buffer-modified-p modified))))))
443
444(define-key rmail-mode-map "\t" 'rmail-mime-next-item)
445(define-key rmail-mode-map [backtab] 'rmail-mime-previous-item)
446(define-key rmail-mode-map "\r" 'rmail-mime-toggle-hidden)
447
222;;; Handlers 448;;; Handlers
223 449
450(defun rmail-mime-insert-tagline (entity &rest item-list)
451 "Insert a tag line for MIME-entity ENTITY.
452ITEM-LIST is a list of strings or button-elements (list) to be added
453to the tag line."
454 (insert "[")
455 (let ((tag (aref (rmail-mime-entity-tagline entity) 0)))
456 (if (> (length tag) 0) (insert (substring tag 1) ":")))
457 (insert (car (rmail-mime-entity-type entity)))
458 (dolist (item item-list)
459 (when item
460 (if (stringp item)
461 (insert item)
462 (apply 'insert-button item))))
463 (insert "]\n"))
464
465(defun rmail-mime-insert-header (header)
466 "Decode and insert a MIME-entity header HEADER in the current buffer.
467HEADER is a vector [BEG END DEFAULT-STATUS].
468See `rmail-mime-entity' for the detail."
469 (let ((pos (point))
470 (last-coding-system-used nil))
471 (save-restriction
472 (narrow-to-region pos pos)
473 (with-current-buffer rmail-mime-mbox-buffer
474 (let ((rmail-buffer rmail-mime-mbox-buffer)
475 (rmail-view-buffer rmail-mime-view-buffer))
476 (save-excursion
477 (goto-char (aref header 0))
478 (rmail-copy-headers (point) (aref header 1)))))
479 (rfc2047-decode-region pos (point))
480 (if (and last-coding-system-used (not rmail-mime-coding-system))
481 (setq rmail-mime-coding-system last-coding-system-used))
482 (goto-char (point-min))
483 (rmail-highlight-headers)
484 (goto-char (point-max))
485 (insert "\n"))))
486
224(defun rmail-mime-text-handler (content-type 487(defun rmail-mime-text-handler (content-type
225 content-disposition 488 content-disposition
226 content-transfer-encoding) 489 content-transfer-encoding)
227 "Handle the current buffer as a plain text MIME part." 490 "Handle the current buffer as a plain text MIME part."
228 (let* ((charset (cdr (assq 'charset (cdr content-type)))) 491 (rmail-mime-insert-text
229 (coding-system (when charset 492 (rmail-mime-entity content-type content-disposition
230 (intern (downcase charset))))) 493 content-transfer-encoding
231 (when (coding-system-p coding-system) 494 (vector (vector nil nil nil) (vector nil nil t))
232 (decode-coding-region (point-min) (point-max) coding-system)))) 495 (vector nil nil nil) (vector "" (cons nil nil) t)
233 496 (vector nil nil nil) nil 'rmail-mime-insert-text))
234(defun rmail-mime-insert-text (entity) 497 t)
235 "Insert MIME-entity ENTITY as a plain text MIME part in the current buffer." 498
499(defun rmail-mime-insert-decoded-text (entity)
500 "Decode and insert the text body of MIME-entity ENTITY."
236 (let* ((content-type (rmail-mime-entity-type entity)) 501 (let* ((content-type (rmail-mime-entity-type entity))
237 (charset (cdr (assq 'charset (cdr content-type)))) 502 (charset (cdr (assq 'charset (cdr content-type))))
238 (coding-system (if charset (intern (downcase charset)))) 503 (coding-system (if charset
239 (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) 504 (coding-system-from-name charset)))
240 (body (rmail-mime-entity-body entity))) 505 (body (rmail-mime-entity-body entity))
241 (save-restriction 506 (pos (point)))
242 (narrow-to-region (point) (point)) 507 (or (and coding-system (coding-system-p coding-system))
243 (insert-buffer-substring rmail-buffer (car body) (cdr body)) 508 (setq coding-system 'undecided))
244 (cond ((string= transfer-encoding "base64") 509 (if (stringp (aref body 0))
245 (ignore-errors (base64-decode-region (point-min) (point-max)))) 510 (insert (aref body 0))
246 ((string= transfer-encoding "quoted-printable") 511 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding entity)))
247 (quoted-printable-decode-region (point-min) (point-max)))) 512 (insert-buffer-substring rmail-mime-mbox-buffer
248 (if (coding-system-p coding-system) 513 (aref body 0) (aref body 1))
249 (decode-coding-region (point-min) (point-max) coding-system))))) 514 (cond ((string= transfer-encoding "base64")
515 (ignore-errors (base64-decode-region pos (point))))
516 ((string= transfer-encoding "quoted-printable")
517 (quoted-printable-decode-region pos (point))))))
518 (decode-coding-region pos (point) coding-system)
519 (or rmail-mime-coding-system
520 (setq rmail-mime-coding-system coding-system))
521 (or (bolp) (insert "\n"))))
522
523(defun rmail-mime-insert-text (entity)
524 "Presentation handler for a plain text MIME entity."
525 (let ((current (aref (rmail-mime-entity-display entity) 0))
526 (new (aref (rmail-mime-entity-display entity) 1))
527 (header (rmail-mime-entity-header entity))
528 (tagline (rmail-mime-entity-tagline entity))
529 (body (rmail-mime-entity-body entity))
530 (beg (point))
531 (segment (rmail-mime-entity-segment (point) entity)))
532
533 (or (integerp (aref body 0))
534 (let ((data (buffer-string)))
535 (aset body 0 data)
536 (delete-region (point-min) (point-max))))
537
538 ;; header
539 (if (eq (aref current 0) (aref new 0))
540 (goto-char (aref segment 2))
541 (if (aref current 0)
542 (delete-char (- (aref segment 2) (aref segment 1))))
543 (if (aref new 0)
544 (rmail-mime-insert-header header)))
545 ;; tagline
546 (if (eq (aref current 1) (aref new 1))
547 (forward-char (- (aref segment 3) (aref segment 2)))
548 (if (aref current 1)
549 (delete-char (- (aref segment 3) (aref segment 2))))
550 (if (aref new 1)
551 (rmail-mime-insert-tagline entity)))
552 ;; body
553 (if (eq (aref current 2) (aref new 2))
554 (forward-char (- (aref segment 4) (aref segment 3)))
555 (if (aref current 2)
556 (delete-char (- (aref segment 4) (aref segment 3))))
557 (if (aref new 2)
558 (rmail-mime-insert-decoded-text entity)))
559 (put-text-property beg (point) 'rmail-mime-entity entity)))
250 560
251;; FIXME move to the test/ directory? 561;; FIXME move to the test/ directory?
252(defun test-rmail-mime-handler () 562(defun test-rmail-mime-handler ()
@@ -265,35 +575,35 @@ MIME-Version: 1.0
265 (set-buffer-multibyte t))) 575 (set-buffer-multibyte t)))
266 576
267 577
268(defun rmail-mime-insert-image (type data) 578(defun rmail-mime-insert-image (entity)
269 "Insert an image of type TYPE, where DATA is the image data. 579 "Decode and insert the image body of MIME-entity ENTITY."
270If DATA is not a string, it is a MIME-entity object." 580 (let* ((content-type (car (rmail-mime-entity-type entity)))
271 (end-of-line) 581 (bulk-data (aref (rmail-mime-entity-tagline entity) 1))
272 (let ((modified (buffer-modified-p))) 582 (body (rmail-mime-entity-body entity))
273 (insert ?\n) 583 data)
274 (unless (stringp data) 584 (if (stringp (aref body 0))
275 ;; DATA is a MIME-entity. 585 (setq data (aref body 0))
276 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data)) 586 (let ((rmail-mime-mbox-buffer rmail-view-buffer)
277 (body (rmail-mime-entity-body data)) 587 (transfer-encoding (rmail-mime-entity-transfer-encoding entity)))
278 (mbox-buffer rmail-view-buffer))
279 (with-temp-buffer 588 (with-temp-buffer
280 (set-buffer-multibyte nil) 589 (set-buffer-multibyte nil)
281 (setq buffer-undo-list t) 590 (setq buffer-undo-list t)
282 (insert-buffer-substring mbox-buffer (car body) (cdr body)) 591 (insert-buffer-substring rmail-mime-mbox-buffer
592 (aref body 0) (aref body 1))
283 (cond ((string= transfer-encoding "base64") 593 (cond ((string= transfer-encoding "base64")
284 (ignore-errors (base64-decode-region (point-min) (point-max)))) 594 (ignore-errors (base64-decode-region (point-min) (point-max))))
285 ((string= transfer-encoding "quoted-printable") 595 ((string= transfer-encoding "quoted-printable")
286 (quoted-printable-decode-region (point-min) (point-max)))) 596 (quoted-printable-decode-region (point-min) (point-max))))
287 (setq data 597 (setq data
288 (buffer-substring-no-properties (point-min) (point-max)))))) 598 (buffer-substring-no-properties (point-min) (point-max))))))
289 (insert-image (create-image data type t)) 599 (insert-image (create-image data (cdr bulk-data) t))
290 (set-buffer-modified-p modified))) 600 (insert "\n")))
291 601
292(defun rmail-mime-image (button) 602(defun rmail-mime-image (button)
293 "Display the image associated with BUTTON." 603 "Display the image associated with BUTTON."
294 (let ((inhibit-read-only t)) 604 (save-excursion
295 (rmail-mime-insert-image (button-get button 'image-type) 605 (goto-char (button-end button))
296 (button-get button 'image-data)))) 606 (rmail-mime-toggle-hidden)))
297 607
298(define-button-type 'rmail-mime-image 'action 'rmail-mime-image) 608(define-button-type 'rmail-mime-image 'action 'rmail-mime-image)
299 609
@@ -306,15 +616,60 @@ For images that Emacs is capable of displaying, the behavior
306depends upon the value of `rmail-mime-show-images'." 616depends upon the value of `rmail-mime-show-images'."
307 (rmail-mime-insert-bulk 617 (rmail-mime-insert-bulk
308 (rmail-mime-entity content-type content-disposition content-transfer-encoding 618 (rmail-mime-entity content-type content-disposition content-transfer-encoding
309 nil nil nil))) 619 (vector (vector nil nil nil) (vector nil t nil))
620 (vector nil nil nil) (vector "" (cons nil nil) t)
621 (vector nil nil nil) nil 'rmail-mime-insert-bulk)))
622
623(defun rmail-mime-set-bulk-data (entity)
624 "Setup the information about the attachment object for MIME-entity ENTITY.
625The value is non-nil if and only if the attachment object should be shown
626directly."
627 (let ((content-type (car (rmail-mime-entity-type entity)))
628 (size (cdr (assq 'size (cdr (rmail-mime-entity-disposition entity)))))
629 (bulk-data (aref (rmail-mime-entity-tagline entity) 1))
630 (body (rmail-mime-entity-body entity))
631 size type to-show)
632 (cond (size
633 (setq size (string-to-number size)))
634 ((stringp (aref body 0))
635 (setq size (length (aref body 0))))
636 (t
637 ;; Rough estimation of the size.
638 (let ((encoding (rmail-mime-entity-transfer-encoding entity)))
639 (setq size (- (aref body 1) (aref body 0)))
640 (cond ((string= encoding "base64")
641 (setq size (/ (* size 3) 4)))
642 ((string= encoding "quoted-printable")
643 (setq size (/ (* size 7) 3)))))))
644
645 (cond
646 ((string-match "text/" content-type)
647 (setq type 'text))
648 ((string-match "image/\\(.*\\)" content-type)
649 (setq type (image-type-from-file-name
650 (concat "." (match-string 1 content-type))))
651 (if (and (memq type image-types)
652 (image-type-available-p type))
653 (if (and rmail-mime-show-images
654 (not (eq rmail-mime-show-images 'button))
655 (or (not (numberp rmail-mime-show-images))
656 (< size rmail-mime-show-images)))
657 (setq to-show t))
658 (setq type nil))))
659 (setcar bulk-data size)
660 (setcdr bulk-data type)
661 to-show))
310 662
311(defun rmail-mime-insert-bulk (entity) 663(defun rmail-mime-insert-bulk (entity)
312 "Inesrt a MIME-entity ENTITY as an attachment. 664 "Presentation handler for an attachment MIME entity."
313The optional second arg DATA, if non-nil, is a string containing
314the attachment data that is already decoded."
315 ;; Find the default directory for this media type. 665 ;; Find the default directory for this media type.
316 (let* ((content-type (rmail-mime-entity-type entity)) 666 (let* ((content-type (rmail-mime-entity-type entity))
317 (content-disposition (rmail-mime-entity-disposition entity)) 667 (content-disposition (rmail-mime-entity-disposition entity))
668 (current (aref (rmail-mime-entity-display entity) 0))
669 (new (aref (rmail-mime-entity-display entity) 1))
670 (header (rmail-mime-entity-header entity))
671 (tagline (rmail-mime-entity-tagline entity))
672 (bulk-data (aref tagline 1))
318 (body (rmail-mime-entity-body entity)) 673 (body (rmail-mime-entity-body entity))
319 (directory (catch 'directory 674 (directory (catch 'directory
320 (dolist (entry rmail-mime-attachment-dirs-alist) 675 (dolist (entry rmail-mime-attachment-dirs-alist)
@@ -325,47 +680,70 @@ the attachment data that is already decoded."
325 (filename (or (cdr (assq 'name (cdr content-type))) 680 (filename (or (cdr (assq 'name (cdr content-type)))
326 (cdr (assq 'filename (cdr content-disposition))) 681 (cdr (assq 'filename (cdr content-disposition)))
327 "noname")) 682 "noname"))
328 (label (format "\nAttached %s file: " (car content-type)))
329 (units '(B kB MB GB)) 683 (units '(B kB MB GB))
330 data udata size osize type) 684 (segment (rmail-mime-entity-segment (point) entity))
331 (if body 685 beg data size)
686
687 (if (integerp (aref body 0))
332 (setq data entity 688 (setq data entity
333 udata entity 689 size (car bulk-data))
334 size (- (cdr body) (car body))) 690 (if (stringp (aref body 0))
335 (setq data (buffer-string) 691 (setq data (aref body 0))
336 udata (string-as-unibyte data) 692 (setq data (string-as-unibyte (buffer-string)))
337 size (length udata)) 693 (aset body 0 data)
338 (delete-region (point-min) (point-max))) 694 (rmail-mime-set-bulk-data entity)
339 (setq osize size) 695 (delete-region (point-min) (point-max)))
696 (setq size (length data)))
340 (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message 697 (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message
341 (cdr units)) 698 (cdr units))
342 (setq size (/ size 1024.0) 699 (setq size (/ size 1024.0)
343 units (cdr units))) 700 units (cdr units)))
344 (insert label) 701
345 (insert-button filename 702 (setq beg (point))
346 :type 'rmail-mime-save 703
347 'help-echo "mouse-2, RET: Save attachment" 704 ;; header
348 'filename filename 705 (if (eq (aref current 0) (aref new 0))
349 'directory (file-name-as-directory directory) 706 (goto-char (aref segment 2))
350 'data data) 707 (if (aref current 0)
351 (insert (format " (%.0f%s)" size (car units))) 708 (delete-char (- (aref segment 2) (aref segment 1))))
352 (when (and rmail-mime-show-images 709 (if (aref new 0)
353 (string-match "image/\\(.*\\)" (setq type (car content-type))) 710 (rmail-mime-insert-header header)))
354 (setq type (concat "." (match-string 1 type)) 711
355 type (image-type-from-file-name type)) 712 ;; tagline
356 (memq type image-types) 713 (if (eq (aref current 1) (aref new 1))
357 (image-type-available-p type)) 714 (forward-char (- (aref segment 3) (aref segment 2)))
358 (insert " ") 715 (if (aref current 1)
359 (cond ((or (eq rmail-mime-show-images 'button) 716 (delete-char (- (aref segment 3) (aref segment 2))))
360 (and (numberp rmail-mime-show-images) 717 (if (aref new 1)
361 (>= osize rmail-mime-show-images))) 718 (rmail-mime-insert-tagline
362 (insert-button "Display" 719 entity
363 :type 'rmail-mime-image 720 " file:"
364 'help-echo "mouse-2, RET: Show image" 721 (list filename
365 'image-type type 722 :type 'rmail-mime-save
366 'image-data udata)) 723 'help-echo "mouse-2, RET: Save attachment"
367 (t 724 'filename filename
368 (rmail-mime-insert-image type udata)))))) 725 'directory (file-name-as-directory directory)
726 'data data)
727 (format " (%.0f%s)" size (car units))
728 (if (cdr bulk-data)
729 " ")
730 (if (cdr bulk-data)
731 (list "Toggle show/hide"
732 :type 'rmail-mime-image
733 'help-echo "mouse-2, RET: Toggle show/hide"
734 'image-type (cdr bulk-data)
735 'image-data data)))))
736 ;; body
737 (if (eq (aref current 2) (aref new 2))
738 (forward-char (- (aref segment 4) (aref segment 3)))
739 (if (aref current 2)
740 (delete-char (- (aref segment 4) (aref segment 3))))
741 (if (aref new 2)
742 (cond ((eq (cdr bulk-data) 'text)
743 (rmail-mime-insert-decoded-text entity))
744 ((cdr bulk-data)
745 (rmail-mime-insert-image entity)))))
746 (put-text-property beg (point) 'rmail-mime-entity entity)))
369 747
370(defun test-rmail-mime-bulk-handler () 748(defun test-rmail-mime-bulk-handler ()
371 "Test of a mail used as an example in RFC 2183." 749 "Test of a mail used as an example in RFC 2183."
@@ -397,19 +775,21 @@ CONTENT-DISPOSITION, and CONTENT-TRANSFER-ENCODING are the values
397of the respective parsed headers. See `rmail-mime-handle' for their 775of the respective parsed headers. See `rmail-mime-handle' for their
398format." 776format."
399 (rmail-mime-process-multipart 777 (rmail-mime-process-multipart
400 content-type content-disposition content-transfer-encoding nil)) 778 content-type content-disposition content-transfer-encoding nil)
779 t)
401 780
402(defun rmail-mime-process-multipart (content-type 781(defun rmail-mime-process-multipart (content-type
403 content-disposition 782 content-disposition
404 content-transfer-encoding 783 content-transfer-encoding
405 parse-only) 784 parse-tag)
406 "Process the current buffer as a multipart MIME body. 785 "Process the current buffer as a multipart MIME body.
407 786
408If PARSE-ONLY is nil, modify the current buffer directly for showing 787If PARSE-TAG is nil, modify the current buffer directly for
409the MIME body and return nil. 788showing the MIME body and return nil.
410 789
411Otherwise, just parse the current buffer and return a list of 790Otherwise, PARSE-TAG is a string indicating the depth and index
412MIME-entity objects. 791number of the entity. In this case, parse the current buffer and
792return a list of MIME-entity objects.
413 793
414The other arguments are the same as `rmail-mime-multipart-handler'." 794The other arguments are the same as `rmail-mime-multipart-handler'."
415 ;; Some MUAs start boundaries with "--", while it should start 795 ;; Some MUAs start boundaries with "--", while it should start
@@ -420,6 +800,8 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
420 ;; of the preceding part. 800 ;; of the preceding part.
421 ;; We currently don't handle that. 801 ;; We currently don't handle that.
422 (let ((boundary (cdr (assq 'boundary content-type))) 802 (let ((boundary (cdr (assq 'boundary content-type)))
803 (subtype (cadr (split-string (car content-type) "/")))
804 (index 0)
423 beg end next entities) 805 beg end next entities)
424 (unless boundary 806 (unless boundary
425 (rmail-mm-get-boundary-error-message 807 (rmail-mm-get-boundary-error-message
@@ -430,12 +812,20 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
430 (goto-char (point-min)) 812 (goto-char (point-min))
431 (when (and (search-forward boundary nil t) 813 (when (and (search-forward boundary nil t)
432 (looking-at "[ \t]*\n")) 814 (looking-at "[ \t]*\n"))
433 (if parse-only 815 (if parse-tag
434 (narrow-to-region (match-end 0) (point-max)) 816 (narrow-to-region (match-end 0) (point-max))
435 (delete-region (point-min) (match-end 0)))) 817 (delete-region (point-min) (match-end 0))))
818
819 ;; Change content-type to the proper default one for the children.
820 (cond ((string-match "mixed" subtype)
821 (setq content-type '("text/plain")))
822 ((string-match "digest" subtype)
823 (setq content-type '("message/rfc822"))))
824
436 ;; Loop over all body parts, where beg points at the beginning of 825 ;; Loop over all body parts, where beg points at the beginning of
437 ;; the part and end points at the end of the part. next points at 826 ;; the part and end points at the end of the part. next points at
438 ;; the beginning of the next part. 827 ;; the beginning of the next part. The current point is just
828 ;; after the boundary tag.
439 (setq beg (point-min)) 829 (setq beg (point-min))
440 (while (search-forward boundary nil t) 830 (while (search-forward boundary nil t)
441 (setq end (match-beginning 0)) 831 (setq end (match-beginning 0))
@@ -450,17 +840,46 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
450 (rmail-mm-get-boundary-error-message 840 (rmail-mm-get-boundary-error-message
451 "Malformed boundary" content-type content-disposition 841 "Malformed boundary" content-type content-disposition
452 content-transfer-encoding))) 842 content-transfer-encoding)))
843
844 (setq index (1+ index))
453 ;; Handle the part. 845 ;; Handle the part.
454 (if parse-only 846 (if parse-tag
455 (save-restriction 847 (save-restriction
456 (narrow-to-region beg end) 848 (narrow-to-region beg end)
457 (setq entities (cons (rmail-mime-process nil t) entities))) 849 (let ((child (rmail-mime-process
850 nil (format "%s/%d" parse-tag index)
851 content-type content-disposition)))
852 ;; Display a tagline.
853 (aset (aref (rmail-mime-entity-display child) 1) 1
854 (aset (rmail-mime-entity-tagline child) 2 t))
855 (push child entities)))
856
458 (delete-region end next) 857 (delete-region end next)
459 (save-restriction 858 (save-restriction
460 (narrow-to-region beg end) 859 (narrow-to-region beg end)
461 (rmail-mime-show))) 860 (rmail-mime-show)))
462 (goto-char (setq beg next))) 861 (goto-char (setq beg next)))
463 (nreverse entities))) 862
863 (when parse-tag
864 (setq entities (nreverse entities))
865 (if (string-match "alternative" subtype)
866 ;; Find the best entity to show, and hide all the others.
867 (let (best second)
868 (dolist (child entities)
869 (if (string= (or (car (rmail-mime-entity-disposition child))
870 (car content-disposition))
871 "inline")
872 (if (string-match "text/plain"
873 (car (rmail-mime-entity-type child)))
874 (setq best child)
875 (if (string-match "text/.*"
876 (car (rmail-mime-entity-type child)))
877 (setq second child)))))
878 (or best (not second) (setq best second))
879 (dolist (child entities)
880 (or (eq best child)
881 (rmail-mime-hidden-mode child t)))))
882 entities)))
464 883
465(defun test-rmail-mime-multipart-handler () 884(defun test-rmail-mime-multipart-handler ()
466 "Test of a mail used as an example in RFC 2046." 885 "Test of a mail used as an example in RFC 2046."
@@ -493,6 +912,40 @@ This is the epilogue. It is also to be ignored."))
493 (insert mail) 912 (insert mail)
494 (rmail-mime-show t))) 913 (rmail-mime-show t)))
495 914
915(defun rmail-mime-insert-multipart (entity)
916 "Presentation handler for a multipart MIME entity."
917 (let ((current (aref (rmail-mime-entity-display entity) 0))
918 (new (aref (rmail-mime-entity-display entity) 1))
919 (header (rmail-mime-entity-header entity))
920 (tagline (rmail-mime-entity-tagline entity))
921 (body (rmail-mime-entity-body entity))
922 (beg (point))
923 (segment (rmail-mime-entity-segment (point) entity)))
924 ;; header
925 (if (eq (aref current 0) (aref new 0))
926 (goto-char (aref segment 2))
927 (if (aref current 0)
928 (delete-char (- (aref segment 2) (aref segment 1))))
929 (if (aref new 0)
930 (rmail-mime-insert-header header)))
931 ;; tagline
932 (if (eq (aref current 1) (aref new 1))
933 (forward-char (- (aref segment 3) (aref segment 2)))
934 (if (aref current 1)
935 (delete-char (- (aref segment 3) (aref segment 2))))
936 (if (aref new 1)
937 (rmail-mime-insert-tagline entity)))
938
939 (put-text-property beg (point) 'rmail-mime-entity entity)
940 ;; body
941 (if (eq (aref current 2) (aref new 2))
942 (forward-char (- (aref segment 4) (aref segment 3)))
943 (if (aref current 2)
944 (delete-char (- (aref segment 4) (aref segment 3))))
945 (if (aref new 2)
946 (dolist (child (rmail-mime-entity-children entity))
947 (rmail-mime-insert child))))))
948
496;;; Main code 949;;; Main code
497 950
498(defun rmail-mime-handle (content-type 951(defun rmail-mime-handle (content-type
@@ -565,7 +1018,9 @@ The current buffer must contain a single message. It will be
565modified." 1018modified."
566 (rmail-mime-process show-headers nil)) 1019 (rmail-mime-process show-headers nil))
567 1020
568(defun rmail-mime-process (show-headers parse-only) 1021(defun rmail-mime-process (show-headers parse-tag &optional
1022 default-content-type
1023 default-content-disposition)
569 (let ((end (point-min)) 1024 (let ((end (point-min))
570 content-type 1025 content-type
571 content-transfer-encoding 1026 content-transfer-encoding
@@ -596,45 +1051,76 @@ modified."
596 (setq content-type 1051 (setq content-type
597 (if content-type 1052 (if content-type
598 (mail-header-parse-content-type content-type) 1053 (mail-header-parse-content-type content-type)
599 ;; FIXME: Default "message/rfc822" in a "multipart/digest" 1054 (or default-content-type '("text/plain"))))
600 ;; according to RFC 2046.
601 '("text/plain")))
602 (setq content-disposition 1055 (setq content-disposition
603 (if content-disposition 1056 (if content-disposition
604 (mail-header-parse-content-disposition content-disposition) 1057 (mail-header-parse-content-disposition content-disposition)
605 ;; If none specified, we are free to choose what we deem 1058 ;; If none specified, we are free to choose what we deem
606 ;; suitable according to RFC 2183. We like inline. 1059 ;; suitable according to RFC 2183. We like inline.
607 '("inline"))) 1060 (or default-content-disposition '("inline"))))
608 ;; Unrecognized disposition types are to be treated like 1061 ;; Unrecognized disposition types are to be treated like
609 ;; attachment according to RFC 2183. 1062 ;; attachment according to RFC 2183.
610 (unless (member (car content-disposition) '("inline" "attachment")) 1063 (unless (member (car content-disposition) '("inline" "attachment"))
611 (setq content-disposition '("attachment"))) 1064 (setq content-disposition '("attachment")))
612 1065
613 (if parse-only 1066 (if parse-tag
614 (cond ((string-match "multipart/.*" (car content-type)) 1067 (let* ((is-inline (string= (car content-disposition) "inline"))
615 (setq end (1- end)) 1068 (header (vector (point-min) end nil))
616 (save-restriction 1069 (tagline (vector parse-tag (cons nil nil) t))
617 (let ((header (if show-headers (cons (point-min) end)))) 1070 (body (vector end (point-max) is-inline))
1071 (new (vector (aref header 2) (aref tagline 2) (aref body 2)))
1072 children handler entity)
1073 (cond ((string-match "multipart/.*" (car content-type))
1074 (save-restriction
1075 (narrow-to-region (1- end) (point-max))
1076 (setq children (rmail-mime-process-multipart
1077 content-type
1078 content-disposition
1079 content-transfer-encoding
1080 parse-tag)
1081 handler 'rmail-mime-insert-multipart)))
1082 ((string-match "message/rfc822" (car content-type))
1083 (save-restriction
618 (narrow-to-region end (point-max)) 1084 (narrow-to-region end (point-max))
619 (rmail-mime-entity content-type 1085 (let* ((msg (rmail-mime-process t parse-tag
620 content-disposition 1086 '("text/plain") '("inline")))
621 content-transfer-encoding 1087 (msg-new (aref (rmail-mime-entity-display msg) 1)))
622 header nil 1088 ;; Show header of the child.
623 (rmail-mime-process-multipart 1089 (aset msg-new 0 t)
624 content-type content-disposition 1090 (aset (rmail-mime-entity-header msg) 2 t)
625 content-transfer-encoding t))))) 1091 ;; Hide tagline of the child.
626 ((string-match "message/rfc822" (car content-type)) 1092 (aset msg-new 1 nil)
627 (or show-headers 1093 (aset (rmail-mime-entity-tagline msg) 2 nil)
628 (narrow-to-region end (point-max))) 1094 (setq children (list msg)
629 (rmail-mime-process t t)) 1095 handler 'rmail-mime-insert-multipart))))
630 (t 1096 ((and is-inline (string-match "text/" (car content-type)))
631 (rmail-mime-entity content-type 1097 ;; Don't need a tagline.
632 content-disposition 1098 (aset new 1 (aset tagline 2 nil))
633 content-transfer-encoding 1099 (setq handler 'rmail-mime-insert-text))
634 nil 1100 (t
635 (cons end (point-max)) 1101 ;; Force hidden mode.
636 nil))) 1102 (aset new 1 (aset tagline 2 t))
1103 (aset new 2 (aset body 2 nil))
1104 (setq handler 'rmail-mime-insert-bulk)))
1105 (setq entity (rmail-mime-entity content-type
1106 content-disposition
1107 content-transfer-encoding
1108 (vector (vector nil nil nil) new)
1109 header tagline body children handler))
1110 (if (and (eq handler 'rmail-mime-insert-bulk)
1111 (rmail-mime-set-bulk-data entity))
1112 ;; Show the body.
1113 (aset new 2 (aset body 2 t)))
1114 entity)
1115
637 ;; Hide headers and handle the part. 1116 ;; Hide headers and handle the part.
1117 (put-text-property (point-min) (point-max) 'rmail-mime-entity
1118 (rmail-mime-entity
1119 content-type content-disposition
1120 content-transfer-encoding
1121 (vector (vector 'raw nil 'raw) (vector 'raw nil 'raw))
1122 (vector nil nil 'raw) (vector "" (cons nil nil) nil)
1123 (vector nil nil 'raw) nil nil))
638 (save-restriction 1124 (save-restriction
639 (cond ((string= (car content-type) "message/rfc822") 1125 (cond ((string= (car content-type) "message/rfc822")
640 (narrow-to-region end (point-max))) 1126 (narrow-to-region end (point-max)))
@@ -643,102 +1129,117 @@ modified."
643 (rmail-mime-handle content-type content-disposition 1129 (rmail-mime-handle content-type content-disposition
644 content-transfer-encoding))))) 1130 content-transfer-encoding)))))
645 1131
646(defun rmail-mime-insert-multipart (entity)
647 "Insert MIME-entity ENTITY of multipart type in the current buffer."
648 (let ((subtype (cadr (split-string (car (rmail-mime-entity-type entity))
649 "/")))
650 (disposition (rmail-mime-entity-disposition entity))
651 (header (rmail-mime-entity-header entity))
652 (children (rmail-mime-entity-children entity)))
653 (if header
654 (let ((pos (point)))
655 (or (bolp)
656 (insert "\n"))
657 (insert-buffer-substring rmail-buffer (car header) (cdr header))
658 (rfc2047-decode-region pos (point))
659 (insert "\n")))
660 (cond
661 ((string= subtype "mixed")
662 (dolist (child children)
663 (rmail-mime-insert child '("text/plain") disposition)))
664 ((string= subtype "digest")
665 (dolist (child children)
666 (rmail-mime-insert child '("message/rfc822") disposition)))
667 ((string= subtype "alternative")
668 (let (best-plain-text best-text)
669 (dolist (child children)
670 (if (string= (or (car (rmail-mime-entity-disposition child))
671 (car disposition))
672 "inline")
673 (if (string-match "text/plain"
674 (car (rmail-mime-entity-type child)))
675 (setq best-plain-text child)
676 (if (string-match "text/.*"
677 (car (rmail-mime-entity-type child)))
678 (setq best-text child)))))
679 (if (or best-plain-text best-text)
680 (rmail-mime-insert (or best-plain-text best-text))
681 ;; No child could be handled. Insert all.
682 (dolist (child children)
683 (rmail-mime-insert child nil disposition)))))
684 (t
685 ;; Unsupported subtype. Insert all of them.
686 (dolist (child children)
687 (rmail-mime-insert child))))))
688
689(defun rmail-mime-parse () 1132(defun rmail-mime-parse ()
690 "Parse the current Rmail message as a MIME message. 1133 "Parse the current Rmail message as a MIME message.
691The value is a MIME-entiy object (see `rmail-mime-enty-new')." 1134The value is a MIME-entiy object (see `rmail-mime-entity').
692 (save-excursion 1135If an error occurs, return an error message string."
693 (goto-char (point-min)) 1136 (let ((rmail-mime-mbox-buffer (if (rmail-buffers-swapped-p)
694 (condition-case nil 1137 rmail-view-buffer
695 (rmail-mime-process nil t) 1138 (current-buffer))))
696 (error nil)))) 1139 (condition-case err
697 1140 (with-current-buffer rmail-mime-mbox-buffer
698(defun rmail-mime-insert (entity &optional content-type disposition) 1141 (save-excursion
1142 (goto-char (point-min))
1143 (let* ((entity (rmail-mime-process t ""
1144 '("text/plain") '("inline")))
1145 (new (aref (rmail-mime-entity-display entity) 1)))
1146 ;; Show header.
1147 (aset new 0 (aset (rmail-mime-entity-header entity) 2 t))
1148 ;; Show tagline if and only if body is not shown.
1149 (if (aref new 2)
1150 (aset new 1 (aset (rmail-mime-entity-tagline entity) 2 nil))
1151 (aset new 1 (aset (rmail-mime-entity-tagline entity) 2 t)))
1152 entity)))
1153 (error (format "%s" err)))))
1154
1155(defun rmail-mime-insert (entity)
699 "Insert a MIME-entity ENTITY in the current buffer. 1156 "Insert a MIME-entity ENTITY in the current buffer.
700 1157
701This function will be called recursively if multiple parts are 1158This function will be called recursively if multiple parts are
702available." 1159available."
703 (if (rmail-mime-entity-children entity) 1160 (let ((current (aref (rmail-mime-entity-display entity) 0))
704 (rmail-mime-insert-multipart entity) 1161 (new (aref (rmail-mime-entity-display entity) 1)))
705 (setq content-type 1162 (if (not (eq (aref new 0) 'raw))
706 (or (rmail-mime-entity-type entity) content-type)) 1163 ;; Not a raw-mode. Each handler should handle it.
707 (setq disposition 1164 (funcall (rmail-mime-entity-handler entity) entity)
708 (or (rmail-mime-entity-disposition entity) disposition)) 1165 (let ((header (rmail-mime-entity-header entity))
709 (if (and (string= (car disposition) "inline") 1166 (tagline (rmail-mime-entity-tagline entity))
710 (string-match "text/.*" (car content-type))) 1167 (body (rmail-mime-entity-body entity))
711 (rmail-mime-insert-text entity) 1168 (beg (point))
712 (rmail-mime-insert-bulk entity)))) 1169 (segment (rmail-mime-entity-segment (point) entity)))
1170 ;; header
1171 (if (eq (aref current 0) (aref new 0))
1172 (goto-char (aref segment 2))
1173 (if (aref current 0)
1174 (delete-char (- (aref segment 2) (aref segment 1))))
1175 (insert-buffer-substring rmail-mime-mbox-buffer
1176 (aref header 0) (aref header 1)))
1177 ;; tagline
1178 (if (aref current 1)
1179 (delete-char (- (aref segment 3) (aref segment 2))))
1180 ;; body
1181 (if (eq (aref current 2) (aref new 2))
1182 (forward-char (- (aref segment 4) (aref segment 3)))
1183 (if (aref current 2)
1184 (delete-char (- (aref segment 4) (aref segment 3))))
1185 (insert-buffer-substring rmail-mime-mbox-buffer
1186 (aref body 0) (aref body 1)))
1187 (put-text-property beg (point) 'rmail-mime-entity entity)))
1188 (dotimes (i 3)
1189 (aset current i (aref new i)))))
713 1190
714(define-derived-mode rmail-mime-mode fundamental-mode "RMIME" 1191(define-derived-mode rmail-mime-mode fundamental-mode "RMIME"
715 "Major mode used in `rmail-mime' buffers." 1192 "Major mode used in `rmail-mime' buffers."
716 (setq font-lock-defaults '(rmail-font-lock-keywords t t nil nil))) 1193 (setq font-lock-defaults '(rmail-font-lock-keywords t t nil nil)))
717 1194
718;;;###autoload 1195;;;###autoload
719(defun rmail-mime () 1196(defun rmail-mime (&optional arg)
720 "Process the current Rmail message as a MIME message. 1197 "Toggle displaying of a MIME message.
721This creates a temporary \"*RMAIL*\" buffer holding a decoded 1198
722copy of the message. Inline content-types are handled according to 1199The actualy behavior depends on the value of `rmail-enable-mime'.
1200
1201If `rmail-enable-mime' is t (default), this command change the
1202displaying of a MIME message between decoded presentation form
1203and raw data.
1204
1205With ARG, toggle the displaying of the current MIME entity only.
1206
1207If `rmail-enable-mime' is nil, this creates a temporary
1208\"*RMAIL*\" buffer holding a decoded copy of the message. Inline
1209content-types are handled according to
723`rmail-mime-media-type-handlers-alist'. By default, this 1210`rmail-mime-media-type-handlers-alist'. By default, this
724displays text and multipart messages, and offers to download 1211displays text and multipart messages, and offers to download
725attachments as specfied by `rmail-mime-attachment-dirs-alist'." 1212attachments as specfied by `rmail-mime-attachment-dirs-alist'."
726 (interactive) 1213 (interactive "P")
727 (let ((data (rmail-apply-in-message rmail-current-message 'buffer-string)) 1214 (if rmail-enable-mime
728 (buf (get-buffer-create "*RMAIL*"))) 1215 (if (rmail-mime-message-p)
729 (set-buffer buf) 1216 (let ((rmail-mime-mbox-buffer rmail-view-buffer)
730 (setq buffer-undo-list t) 1217 (rmail-mime-view-buffer rmail-buffer)
731 (let ((inhibit-read-only t)) 1218 (entity (get-text-property (point) 'rmail-mime-entity)))
732 ;; Decoding the message in fundamental mode for speed, only 1219 (if arg
733 ;; switching to rmail-mime-mode at the end for display. Eg 1220 (if entity
734 ;; quoted-printable-decode-region gets very slow otherwise (Bug#4993). 1221 (rmail-mime-toggle-raw entity))
735 (fundamental-mode) 1222 (goto-char (point-min))
736 (erase-buffer) 1223 (rmail-mime-toggle-raw
737 (insert data) 1224 (get-text-property (point) 'rmail-mime-entity))))
738 (rmail-mime-show t) 1225 (message "Not a MIME message"))
739 (rmail-mime-mode) 1226 (let* ((data (rmail-apply-in-message rmail-current-message 'buffer-string))
740 (set-buffer-modified-p nil)) 1227 (buf (get-buffer-create "*RMAIL*"))
741 (view-buffer buf))) 1228 (rmail-mime-mbox-buffer rmail-view-buffer)
1229 (rmail-mime-view-buffer buf))
1230 (set-buffer buf)
1231 (setq buffer-undo-list t)
1232 (let ((inhibit-read-only t))
1233 ;; Decoding the message in fundamental mode for speed, only
1234 ;; switching to rmail-mime-mode at the end for display. Eg
1235 ;; quoted-printable-decode-region gets very slow otherwise (Bug#4993).
1236 (fundamental-mode)
1237 (erase-buffer)
1238 (insert data)
1239 (rmail-mime-show t)
1240 (rmail-mime-mode)
1241 (set-buffer-modified-p nil))
1242 (view-buffer buf))))
742 1243
743(defun rmail-mm-get-boundary-error-message (message type disposition encoding) 1244(defun rmail-mm-get-boundary-error-message (message type disposition encoding)
744 "Return MESSAGE with more information on the main mime components." 1245 "Return MESSAGE with more information on the main mime components."
@@ -747,34 +1248,41 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
747 1248
748(defun rmail-show-mime () 1249(defun rmail-show-mime ()
749 "Function to set in `rmail-show-mime-function' (which see)." 1250 "Function to set in `rmail-show-mime-function' (which see)."
750 (let ((mbox-buf rmail-buffer) 1251 (let ((entity (rmail-mime-parse))
751 (entity (rmail-mime-parse))) 1252 (rmail-mime-mbox-buffer rmail-buffer)
752 (if entity 1253 (rmail-mime-view-buffer rmail-view-buffer)
753 (with-current-buffer rmail-view-buffer 1254 (rmail-mime-coding-system nil))
754 (let ((inhibit-read-only t) 1255 (if (vectorp entity)
755 (rmail-buffer mbox-buf)) 1256 (with-current-buffer rmail-mime-view-buffer
756 (erase-buffer) 1257 (erase-buffer)
757 (rmail-mime-insert entity))) 1258 (rmail-mime-insert entity)
758 ;; Decoding failed. Insert the original message body as is. 1259 (if rmail-mime-coding-system
759 (let ((region (with-current-buffer mbox-buf 1260 (set-buffer-file-coding-system rmail-mime-coding-system t t)))
1261 ;; Decoding failed. ENTITY is an error message. Insert the
1262 ;; original message body as is, and show warning.
1263 (let ((region (with-current-buffer rmail-mime-mbox-buffer
760 (goto-char (point-min)) 1264 (goto-char (point-min))
761 (re-search-forward "^$" nil t) 1265 (re-search-forward "^$" nil t)
762 (forward-line 1) 1266 (forward-line 1)
763 (cons (point) (point-max))))) 1267 (vector (point-min) (point) (point-max)))))
764 (with-current-buffer rmail-view-buffer 1268 (with-current-buffer rmail-mime-view-buffer
765 (let ((inhibit-read-only t)) 1269 (let ((inhibit-read-only t))
766 (erase-buffer) 1270 (erase-buffer)
767 (insert-buffer-substring mbox-buf (car region) (cdr region)))) 1271 (rmail-mime-insert-header region)
768 (message "MIME decoding failed"))))) 1272 (insert-buffer-substring rmail-mime-mbox-buffer
1273 (aref region 1) (aref region 2))))
1274 (set-buffer-file-coding-system 'no-conversion t t)
1275 (message "MIME decoding failed: %s" entity)))))
769 1276
770(setq rmail-show-mime-function 'rmail-show-mime) 1277(setq rmail-show-mime-function 'rmail-show-mime)
771 1278
772(defun rmail-insert-mime-forwarded-message (forward-buffer) 1279(defun rmail-insert-mime-forwarded-message (forward-buffer)
773 "Function to set in `rmail-insert-mime-forwarded-message-function' (which see)." 1280 "Function to set in `rmail-insert-mime-forwarded-message-function' (which see)."
774 (let ((mbox-buf (with-current-buffer forward-buffer rmail-view-buffer))) 1281 (let ((rmail-mime-mbox-buffer
1282 (with-current-buffer forward-buffer rmail-view-buffer)))
775 (save-restriction 1283 (save-restriction
776 (narrow-to-region (point) (point)) 1284 (narrow-to-region (point) (point))
777 (message-forward-make-body-mime mbox-buf)))) 1285 (message-forward-make-body-mime rmail-mime-mbox-buffer))))
778 1286
779(setq rmail-insert-mime-forwarded-message-function 1287(setq rmail-insert-mime-forwarded-message-function
780 'rmail-insert-mime-forwarded-message) 1288 'rmail-insert-mime-forwarded-message)
@@ -795,15 +1303,16 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
795 "Function to set in `rmail-search-mime-message-function' (which see)." 1303 "Function to set in `rmail-search-mime-message-function' (which see)."
796 (save-restriction 1304 (save-restriction
797 (narrow-to-region (rmail-msgbeg msg) (rmail-msgend msg)) 1305 (narrow-to-region (rmail-msgbeg msg) (rmail-msgend msg))
798 (let ((mbox-buf (current-buffer)) 1306 (let* ((rmail-mime-mbox-buffer (current-buffer))
799 (header-end (save-excursion 1307 (rmail-mime-view-buffer rmail-view-buffer)
800 (re-search-forward "^$" nil 'move) (point))) 1308 (header-end (save-excursion
801 (body-end (point-max)) 1309 (re-search-forward "^$" nil 'move) (point)))
802 (entity (rmail-mime-parse))) 1310 (body-end (point-max))
803 (or 1311 (entity (rmail-mime-parse)))
1312 (or
804 ;; At first, just search the headers. 1313 ;; At first, just search the headers.
805 (with-temp-buffer 1314 (with-temp-buffer
806 (insert-buffer-substring mbox-buf nil header-end) 1315 (insert-buffer-substring rmail-mime-mbox-buffer nil header-end)
807 (rfc2047-decode-region (point-min) (point)) 1316 (rfc2047-decode-region (point-min) (point))
808 (goto-char (point-min)) 1317 (goto-char (point-min))
809 (re-search-forward regexp nil t)) 1318 (re-search-forward regexp nil t))
@@ -811,13 +1320,12 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
811 (if (and entity 1320 (if (and entity
812 (let* ((content-type (rmail-mime-entity-type entity)) 1321 (let* ((content-type (rmail-mime-entity-type entity))
813 (charset (cdr (assq 'charset (cdr content-type))))) 1322 (charset (cdr (assq 'charset (cdr content-type)))))
814 (or (not (string-match "text/.*" (car content-type))) 1323 (or (not (string-match "text/.*" (car content-type)))
815 (and charset 1324 (and charset
816 (not (string= (downcase charset) "us-ascii")))))) 1325 (not (string= (downcase charset) "us-ascii"))))))
817 ;; Search the decoded MIME message. 1326 ;; Search the decoded MIME message.
818 (with-temp-buffer 1327 (with-temp-buffer
819 (let ((rmail-buffer mbox-buf)) 1328 (rmail-mime-insert entity)
820 (rmail-mime-insert entity))
821 (goto-char (point-min)) 1329 (goto-char (point-min))
822 (re-search-forward regexp nil t)) 1330 (re-search-forward regexp nil t))
823 ;; Search the body without decoding. 1331 ;; Search the body without decoding.
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 62bfbb740c4..7aed6a549ef 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -392,7 +392,14 @@ The list is in preference order.")
392 (make-directory smtpmail-queue-dir t)) 392 (make-directory smtpmail-queue-dir t))
393 (with-current-buffer buffer-data 393 (with-current-buffer buffer-data
394 (erase-buffer) 394 (erase-buffer)
395 (set-buffer-file-coding-system smtpmail-code-conv-from nil t) 395 (set-buffer-file-coding-system
396 ;; We will be reading the file with no-conversion in
397 ;; smtpmail-send-queued-mail below, so write it out
398 ;; with Unix EOLs.
399 (coding-system-change-eol-conversion
400 (or smtpmail-code-conv-from 'undecided)
401 'unix)
402 nil t)
396 (insert-buffer-substring tembuf) 403 (insert-buffer-substring tembuf)
397 (write-file file-data) 404 (write-file file-data)
398 (set-buffer buffer-elisp) 405 (set-buffer buffer-elisp)
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index a1ab5a8225c..df4057aba24 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -190,17 +190,25 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
190 190
191;;; Set default known names for external libraries 191;;; Set default known names for external libraries
192(setq dynamic-library-alist 192(setq dynamic-library-alist
193 '((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll") 193 (list
194 (png "libpng12d.dll" "libpng12.dll" "libpng.dll" 194 '(xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
195 ;; these are libpng 1.2.8 from GTK+ 195 ;; Versions of libpng 1.4.x and later are incompatible with
196 "libpng13d.dll" "libpng13.dll") 196 ;; earlier versions. Set up the list of libraries according to
197 (jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") 197 ;; the version we were compiled against. (If we were compiled
198 (tiff "libtiff3.dll" "libtiff.dll") 198 ;; without PNG support, libpng-version's value is -1.)
199 (gif "giflib4.dll" "libungif4.dll" "libungif.dll") 199 (if (>= libpng-version 10400)
200 (svg "librsvg-2-2.dll") 200 ;; libpng14-14.dll is libpng 1.4.3 from GTK+
201 (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") 201 '(png "libpng14-14.dll" "libpng14.dll")
202 (glib "libglib-2.0-0.dll") 202 '(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
203 (gobject "libgobject-2.0-0.dll"))) 203 ;; these are libpng 1.2.8 from GTK+
204 "libpng13d.dll" "libpng13.dll"))
205 '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
206 '(tiff "libtiff3.dll" "libtiff.dll")
207 '(gif "giflib4.dll" "libungif4.dll" "libungif.dll")
208 '(svg "librsvg-2-2.dll")
209 '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
210 '(glib "libglib-2.0-0.dll")
211 '(gobject "libgobject-2.0-0.dll")))
204 212
205;;; multi-tty support 213;;; multi-tty support
206(defvar w32-initialized nil 214(defvar w32-initialized nil
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 5bf1a7c7894..067fa3a06d7 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -3340,7 +3340,7 @@ or of the entire buffer, if the region is not selected."
3340(defun rst-compile-pdf-preview () 3340(defun rst-compile-pdf-preview ()
3341 "Convert the document to a PDF file and launch a preview program." 3341 "Convert the document to a PDF file and launch a preview program."
3342 (interactive) 3342 (interactive)
3343 (let* ((tmp-filename "/tmp/out.pdf") 3343 (let* ((tmp-filename (make-temp-file "rst-out" nil ".pdf"))
3344 (command (format "rst2pdf.py %s %s && %s %s" 3344 (command (format "rst2pdf.py %s %s && %s %s"
3345 buffer-file-name tmp-filename 3345 buffer-file-name tmp-filename
3346 rst-pdf-program tmp-filename))) 3346 rst-pdf-program tmp-filename)))
@@ -3355,7 +3355,7 @@ or of the entire buffer, if the region is not selected."
3355(defun rst-compile-slides-preview () 3355(defun rst-compile-slides-preview ()
3356 "Convert the document to an S5 slide presentation and launch a preview program." 3356 "Convert the document to an S5 slide presentation and launch a preview program."
3357 (interactive) 3357 (interactive)
3358 (let* ((tmp-filename "/tmp/slides.html") 3358 (let* ((tmp-filename (make-temp-file "rst-slides" nil ".html"))
3359 (command (format "rst2s5.py %s %s && %s %s" 3359 (command (format "rst2s5.py %s %s && %s %s"
3360 buffer-file-name tmp-filename 3360 buffer-file-name tmp-filename
3361 rst-slides-program tmp-filename))) 3361 rst-slides-program tmp-filename)))
diff --git a/lisp/time.el b/lisp/time.el
index 006fd758a7c..3fc17ec6eee 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -463,7 +463,9 @@ update which can wait for the next redisplay."
463 "Toggle display of time, load level, and mail flag in mode lines. 463 "Toggle display of time, load level, and mail flag in mode lines.
464With a numeric arg, enable this display if arg is positive. 464With a numeric arg, enable this display if arg is positive.
465 465
466When this display is enabled, it updates automatically every minute. 466When this display is enabled, it updates automatically every minute
467\(you can control the number of seconds between updates by
468customizing `display-time-interval').
467If `display-time-day-and-date' is non-nil, the current day and date 469If `display-time-day-and-date' is non-nil, the current day and date
468are displayed as well. 470are displayed as well.
469This runs the normal hook `display-time-hook' after each update." 471This runs the normal hook `display-time-hook' after each update."
diff --git a/lisp/version.el b/lisp/version.el
index b4e2c61b570..f1146e8a510 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -1,7 +1,7 @@
1;;; version.el --- record version number of Emacs -*- no-byte-compile: t -*- 1;;; version.el --- record version number of Emacs -*- no-byte-compile: t -*-
2 2
3;; Copyright (C) 1985, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 3;; Copyright (C) 1985, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
4;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 4;; 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
5;; Free Software Foundation, Inc. 5;; Free Software Foundation, Inc.
6 6
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -88,5 +88,4 @@ to the system configuration; look at `system-configuration' instead."
88;;version-control: never 88;;version-control: never
89;;End: 89;;End:
90 90
91;; arch-tag: e60dc445-6218-4a4c-a7df-f15a818642a0
92;;; version.el ends here 91;;; version.el ends here
diff --git a/nextstep/ChangeLog b/nextstep/ChangeLog
index ac060bbcee4..26d22b4c90e 100644
--- a/nextstep/ChangeLog
+++ b/nextstep/ChangeLog
@@ -1,3 +1,10 @@
12011-01-02 Glenn Morris <rgm@gnu.org>
2
3 * Cocoa/Emacs.base/Contents/Info.plist:
4 * Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:
5 * GNUstep/Emacs.base/Resources/Info-gnustep.plist:
6 Set short copyright year to 2011.
7
12010-10-13 Glenn Morris <rgm@gnu.org> 82010-10-13 Glenn Morris <rgm@gnu.org>
2 9
3 * README: Remove information duplicated in AUTHORS. 10 * README: Remove information duplicated in AUTHORS.
diff --git a/nextstep/Cocoa/Emacs.base/Contents/Info.plist b/nextstep/Cocoa/Emacs.base/Contents/Info.plist
index f064a1248ea..7d95a4b0936 100644
--- a/nextstep/Cocoa/Emacs.base/Contents/Info.plist
+++ b/nextstep/Cocoa/Emacs.base/Contents/Info.plist
@@ -1,5 +1,5 @@
1<!-- 1<!--
2Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -553,7 +553,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
553 <key>CFBundleExecutable</key> 553 <key>CFBundleExecutable</key>
554 <string>Emacs</string> 554 <string>Emacs</string>
555 <key>CFBundleGetInfoString</key> 555 <key>CFBundleGetInfoString</key>
556 <string>Emacs 24.0.50 Copyright (C) 2010 Free Software Foundation, Inc.</string> 556 <string>Emacs 24.0.50 Copyright (C) 2011 Free Software Foundation, Inc.</string>
557 <key>CFBundleIconFile</key> 557 <key>CFBundleIconFile</key>
558 <string>Emacs.icns</string> 558 <string>Emacs.icns</string>
559 <key>CFBundleIdentifier</key> 559 <key>CFBundleIdentifier</key>
diff --git a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings b/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
index 197e42cb6fb..95bc8ad83e6 100644
--- a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
+++ b/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
@@ -3,4 +3,4 @@
3CFBundleName = "Emacs"; 3CFBundleName = "Emacs";
4CFBundleShortVersionString = "Version 24.0.50"; 4CFBundleShortVersionString = "Version 24.0.50";
5CFBundleGetInfoString = "Emacs version 24.0.50, NS Windowing"; 5CFBundleGetInfoString = "Emacs version 24.0.50, NS Windowing";
6NSHumanReadableCopyright = "Copyright (C) 2010 Free Software Foundation, Inc."; 6NSHumanReadableCopyright = "Copyright (C) 2011 Free Software Foundation, Inc.";
diff --git a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist b/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
index ade3f0117e6..e92d45ae686 100644
--- a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
+++ b/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
@@ -11,7 +11,7 @@
11 "Carl Edman (NeXTStep)", 11 "Carl Edman (NeXTStep)",
12 "..see http://emacs-app.sf.net/authorship.html" 12 "..see http://emacs-app.sf.net/authorship.html"
13 ); 13 );
14 Copyright = "Copyright (C) 2010 Free Software Foundation, Inc."; 14 Copyright = "Copyright (C) 2011 Free Software Foundation, Inc.";
15 CopyrightDescription = "Released under the GNU General Public License Version 3 or later"; 15 CopyrightDescription = "Released under the GNU General Public License Version 3 or later";
16 FullVersionID = "Emacs 24.0.50, NS Windowing"; 16 FullVersionID = "Emacs 24.0.50, NS Windowing";
17 NSExecutable = Emacs; 17 NSExecutable = Emacs;
diff --git a/nt/ChangeLog b/nt/ChangeLog
index eca36a06be0..dffae55ba93 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,11 @@
12011-01-02 Eli Zaretskii <eliz@gnu.org>
2
3 * configure.bat (end): Unset environment variables used by this
4 batch file.
5
6 * INSTALL: Update the information about PNG support libraries.
7 (Bug#7716)
8
12010-11-23 Eli Zaretskii <eliz@gnu.org> 92010-11-23 Eli Zaretskii <eliz@gnu.org>
2 10
3 * config.nt (EXTERNALLY_VISIBLE): Define. 11 * config.nt (EXTERNALLY_VISIBLE): Define.
diff --git a/nt/INSTALL b/nt/INSTALL
index a000b21ade4..da7ad5647ed 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -290,6 +290,23 @@
290 If GTK 2.0 is installed, addpm will arrange for its image libraries 290 If GTK 2.0 is installed, addpm will arrange for its image libraries
291 to be on the DLL search path for Emacs. 291 to be on the DLL search path for Emacs.
292 292
293 For PNG images, we recommend to use versions 1.4.x and later of
294 libpng, because previous versions had security issues. You can find
295 precompiled libraries and headers on the GTK download page for
296 Windows (http://www.gtk.org/download-windows.html).
297
298 Versions 1.4.0 and later of libpng are binary incompatible with
299 earlier versions, so Emacs will only look for libpng libraries which
300 are compatible with the version it was compiled against. That
301 version is given by the value of the Lisp variable `libpng-version';
302 e.g., 10403 means version 1.4.3. The variable `image-library-alist'
303 is automatically set to name only those DLL names that are known to
304 be compatible with the version given by `libpng-version'. If PNG
305 support does not work for you even though you have the support DLL
306 installed, check the name of the installed DLL against
307 `image-library-alist' and the value of `libpng-version', and
308 download compatible DLLs if needed.
309
293* Experimental SVG support 310* Experimental SVG support
294 311
295 SVG support is currently experimental, and not built by default. 312 SVG support is currently experimental, and not built by default.
diff --git a/nt/README.W32 b/nt/README.W32
index df869d6569d..808b77e29d0 100644
--- a/nt/README.W32
+++ b/nt/README.W32
@@ -116,14 +116,19 @@ See the end of the file for license conditions.
116 libXpm library from X11R7.3. 116 libXpm library from X11R7.3.
117 117
118 Emacs can also support some other image formats with appropriate 118 Emacs can also support some other image formats with appropriate
119 libraries. These libraries are all available as part of GTK, or from 119 libraries. These libraries are all available as part of GTK
120 gnuwin32.sourceforge.net. Emacs will find them if the directory they 120 download for Windows (http://www.gtk.org/download-windows.html), or
121 are installed in is on the PATH. 121 from the GnuWin32 project. Emacs will find them if the directory
122 122 they are installed in is on the PATH.
123 PNG: requires the PNG reference library 1.2 or later, which will 123
124 be named libpng13d.dll, libpng13.dll, libpng12d.dll, libpng12.dll 124 PNG: requires the PNG reference library 1.4 or later, which will
125 or libpng.dll. LibPNG requires zlib, which should come from the same 125 be named libpng14.dll or libpng14-14.dll. LibPNG requires zlib,
126 source as you got libpng. 126 which should come from the same source as you got libpng.
127 Starting with Emacs 23.3, the precompiled Emacs binaries are
128 built with libpng 1.4.x and later, and are incompatible with
129 earlier versions of libpng DLLs. So if you have libpng 1.2.x,
130 the PNG support will not work, and you will have to download
131 newer versions.
127 132
128 JPEG: requires the Independant JPEG Group's libjpeg 6b or later, 133 JPEG: requires the Independant JPEG Group's libjpeg 6b or later,
129 which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll. 134 which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll.
@@ -134,6 +139,9 @@ See the end of the file for license conditions.
134 GIF: requires libungif or giflib 4.1 or later, which will be 139 GIF: requires libungif or giflib 4.1 or later, which will be
135 called giflib4.dll, libungif4.dll or libungif.dll. 140 called giflib4.dll, libungif4.dll or libungif.dll.
136 141
142 If you have image support DLLs under different names, customize the
143 value of `image-library-alist'.
144
137 In addition, Emacs can be compiled to support SVG. This precompiled 145 In addition, Emacs can be compiled to support SVG. This precompiled
138 distribution has not been compiled that way, since the SVG library 146 distribution has not been compiled that way, since the SVG library
139 or one or more of its extensive dependencies appear to be 147 or one or more of its extensive dependencies appear to be
diff --git a/nt/configure.bat b/nt/configure.bat
index 4da25927673..410087687bd 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -788,6 +788,19 @@ set mf=
788set distfiles= 788set distfiles=
789set HAVE_DISTFILES= 789set HAVE_DISTFILES=
790set distFilesOk= 790set distFilesOk=
791set pngsupport=
792set jpegsupport=
793set gifsupport=
794set tiffsupport=
795set xpmsupport=
796set svgsupport=
797set libsOK=
798set HAVE_GIF=
799set HAVE_JPEG=
800set HAVE_PNG=
801set HAVE_TIFF=
802set HAVE_XPM=
803set dbginfo=
791 804
792goto skipArchTag 805goto skipArchTag
793 arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c 806 arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c
diff --git a/src/.gdbinit b/src/.gdbinit
index 73fecea5972..ac466de0eee 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,5 +1,5 @@
1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
2# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 2# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3# Free Software Foundation, Inc. 3# Free Software Foundation, Inc.
4# 4#
5# This file is part of GNU Emacs. 5# This file is part of GNU Emacs.
@@ -51,7 +51,7 @@ handle SIGALRM ignore
51# Using a constant runs into GDB bugs sometimes. 51# Using a constant runs into GDB bugs sometimes.
52define xgetptr 52define xgetptr
53 set $bugfix = $arg0 53 set $bugfix = $arg0
54 set $ptr = (gdb_use_union ? $bugfix.u.val : $bugfix & $valmask) | gdb_data_seg_bits 54 set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : $bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits
55end 55end
56 56
57define xgetint 57define xgetint
@@ -1227,7 +1227,8 @@ define xbacktrace
1227 xprintsym (*$bt->function) 1227 xprintsym (*$bt->function)
1228 printf " (0x%x)\n", $bt->args 1228 printf " (0x%x)\n", $bt->args
1229 else 1229 else
1230 printf "0x%x ", *$bt->function 1230 xgetptr *$bt->function
1231 printf "0x%x ", $ptr
1231 if $type == Lisp_Vectorlike 1232 if $type == Lisp_Vectorlike
1232 xgetptr (*$bt->function) 1233 xgetptr (*$bt->function)
1233 set $size = ((struct Lisp_Vector *) $ptr)->size 1234 set $size = ((struct Lisp_Vector *) $ptr)->size
diff --git a/src/ChangeLog b/src/ChangeLog
index d03b16a7092..879ecc94d72 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,54 @@
12011-01-02 Eli Zaretskii <eliz@gnu.org>
2
3 * keyboard.c (Vselect_active_regions): Doc fix. (Bug#7702)
4
52011-01-02 Eli Zaretskii <eliz@gnu.org>
6
7 * image.c <Qlibpng_version>: New variable.
8 (syms_of_image): Intern and staticpro it. Set its value to the
9 version of PNG library we were compiled with.
10 (my_png_error, png_load): Avoid GCC warnings about direct access
11 to png_ptr->jmpbuf. (Bug#7716)
12 (png_jmpbuf): New macro.
13 (my_png_error, png_load): Use it instead of #ifdef'ing according
14 to PNG_LIBPNG_VER_MAJOR and PNG_LIBPNG_VER_MINOR.
15
162011-01-02 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * .gdbinit (xgetptr): Fix the union+lsb case.
19 (xbacktrace): Fix the union case.
20
212011-01-02 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * window.c (Fmove_to_window_line): Avoid abort when called in a buffer
24 different from selected-window's.
25
262011-01-02 Eli Zaretskii <eliz@gnu.org>
27
28 * keyboard.c (parse_menu_item): Prepend " " to the key sequence
29 equivalent of a menu item when the key sequence is given by the
30 `:keys' attribute. (Bug#7662)
31
32 * xdisp.c (Fformat_mode_line): Doc fix: no need to state that only
33 the basic faces are supported.
34
352011-01-02 Jan Djärv <jan.h.d@swipnet.se>
36
37 * xterm.c (x_check_fullscreen): Fix pixel/character mixup.
38
392011-01-02 Eli Zaretskii <eliz@gnu.org>
40
41 * xdisp.c (Fformat_mode_line): Fix last change.
42
432011-01-02 Chong Yidong <cyd@stupidchicken.com>
44
45 * xdisp.c (Fformat_mode_line): Restrict the FACE argument to basic
46 faces (Bug#7587).
47
482011-01-02 Eli Zaretskii <eliz@gnu.org>
49
50 * fileio.c (Fexpand_file_name): One more doc fix.
51
12011-01-01 Chong Yidong <cyd@stupidchicken.com> 522011-01-01 Chong Yidong <cyd@stupidchicken.com>
2 53
3 * gtkutil.c (xg_get_tool_bar_widgets): Use NULL for a missing 54 * gtkutil.c (xg_get_tool_bar_widgets): Use NULL for a missing
diff --git a/src/fileio.c b/src/fileio.c
index c2b93a6bd8b..881dc92acab 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -782,6 +782,8 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
782Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative 782Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
783\(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing, 783\(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing,
784the current buffer's value of `default-directory' is used. 784the current buffer's value of `default-directory' is used.
785NAME should be a string that is a valid file name for the underlying
786filesystem.
785File name components that are `.' are removed, and 787File name components that are `.' are removed, and
786so are file name components followed by `..', along with the `..' itself; 788so are file name components followed by `..', along with the `..' itself;
787note that these simplifications are done without checking the resulting 789note that these simplifications are done without checking the resulting
diff --git a/src/image.c b/src/image.c
index 07f573ca893..41c9cb8f534 100644
--- a/src/image.c
+++ b/src/image.c
@@ -94,6 +94,11 @@ typedef struct w32_bitmap_record Bitmap_Record;
94 without modifying lots of files). */ 94 without modifying lots of files). */
95extern void x_query_colors (struct frame *f, XColor *colors, int ncolors); 95extern void x_query_colors (struct frame *f, XColor *colors, int ncolors);
96extern void x_query_color (struct frame *f, XColor *color); 96extern void x_query_color (struct frame *f, XColor *color);
97
98/* Version of libpng that we were compiled with, or -1 if no PNG
99 support was compiled in. This is tested by w32-win.el to correctly
100 set up the alist used to search for PNG libraries. */
101Lisp_Object Qlibpng_version;
97#endif /* HAVE_NTGUI */ 102#endif /* HAVE_NTGUI */
98 103
99#ifdef HAVE_NS 104#ifdef HAVE_NS
@@ -5523,6 +5528,12 @@ init_png_functions (Lisp_Object libraries)
5523 5528
5524#endif /* HAVE_NTGUI */ 5529#endif /* HAVE_NTGUI */
5525 5530
5531/* libpng before 1.4.0 didn't have png_jmpbuf; v1.4.0 and later
5532 deprecate direct access to png_ptr fields. */
5533#ifndef png_jmpbuf
5534# define png_jmpbuf(PTR) ((PTR)->jmpbuf)
5535#endif
5536
5526/* Error and warning handlers installed when the PNG library 5537/* Error and warning handlers installed when the PNG library
5527 is initialized. */ 5538 is initialized. */
5528 5539
@@ -5530,8 +5541,10 @@ static void
5530my_png_error (png_struct *png_ptr, const char *msg) 5541my_png_error (png_struct *png_ptr, const char *msg)
5531{ 5542{
5532 xassert (png_ptr != NULL); 5543 xassert (png_ptr != NULL);
5544 /* Avoid compiler warning about deprecated direct access to
5545 png_ptr's fields in libpng versions 1.4.x. */
5533 image_error ("PNG error: %s", build_string (msg), Qnil); 5546 image_error ("PNG error: %s", build_string (msg), Qnil);
5534 longjmp (png_ptr->jmpbuf, 1); 5547 longjmp (png_jmpbuf (png_ptr), 1);
5535} 5548}
5536 5549
5537 5550
@@ -5693,7 +5706,7 @@ png_load (struct frame *f, struct image *img)
5693 5706
5694 /* Set error jump-back. We come back here when the PNG library 5707 /* Set error jump-back. We come back here when the PNG library
5695 detects an error. */ 5708 detects an error. */
5696 if (setjmp (png_ptr->jmpbuf)) 5709 if (setjmp (png_jmpbuf (png_ptr)))
5697 { 5710 {
5698 error: 5711 error:
5699 if (png_ptr) 5712 if (png_ptr)
@@ -8776,6 +8789,16 @@ non-numeric, there is no explicit limit on the size of images. */);
8776 staticpro (&QCpt_height); 8789 staticpro (&QCpt_height);
8777#endif /* HAVE_GHOSTSCRIPT */ 8790#endif /* HAVE_GHOSTSCRIPT */
8778 8791
8792#ifdef HAVE_NTGUI
8793 Qlibpng_version = intern_c_string ("libpng-version");
8794 staticpro (&Qlibpng_version);
8795#if HAVE_PNG
8796 SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (PNG_LIBPNG_VER));
8797#else
8798 SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (-1));
8799#endif
8800#endif
8801
8779#if defined (HAVE_XPM) || defined (HAVE_NS) 8802#if defined (HAVE_XPM) || defined (HAVE_NS)
8780 Qxpm = intern_c_string ("xpm"); 8803 Qxpm = intern_c_string ("xpm");
8781 staticpro (&Qxpm); 8804 staticpro (&Qxpm);
diff --git a/src/keyboard.c b/src/keyboard.c
index 27c311d72e2..7759549fa23 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7968,7 +7968,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7968 /* The previous code preferred :key-sequence to :keys, so we 7968 /* The previous code preferred :key-sequence to :keys, so we
7969 preserve this behavior. */ 7969 preserve this behavior. */
7970 if (STRINGP (keyeq) && !CONSP (keyhint)) 7970 if (STRINGP (keyeq) && !CONSP (keyhint))
7971 keyeq = Fsubstitute_command_keys (keyeq); 7971 keyeq = concat2 (build_string (" "), Fsubstitute_command_keys (keyeq));
7972 else 7972 else
7973 { 7973 {
7974 Lisp_Object prefix = keyeq; 7974 Lisp_Object prefix = keyeq;
@@ -12386,7 +12386,7 @@ and tool-bar buttons. */);
12386 12386
12387 DEFVAR_LISP ("select-active-regions", 12387 DEFVAR_LISP ("select-active-regions",
12388 &Vselect_active_regions, 12388 &Vselect_active_regions,
12389 doc: /* If non-nil, an active region automatically becomes the window selection. 12389 doc: /* If non-nil, an active region automatically sets the primary selection.
12390If the value is `only', only temporarily active regions (usually made 12390If the value is `only', only temporarily active regions (usually made
12391by mouse-dragging or shift-selection) set the window selection. 12391by mouse-dragging or shift-selection) set the window selection.
12392 12392
diff --git a/src/window.c b/src/window.c
index 920a528a03e..b0171436088 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5762,6 +5762,12 @@ zero means top of window, negative means relative to bottom of window. */)
5762 int this_scroll_margin; 5762 int this_scroll_margin;
5763#endif 5763#endif
5764 5764
5765 if (!(BUFFERP (w->buffer)
5766 && XBUFFER (w->buffer) == current_buffer))
5767 /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer
5768 when passed below to set_marker_both. */
5769 error ("move-to-window-line called from unrelated buffer");
5770
5765 window = selected_window; 5771 window = selected_window;
5766 start = marker_position (w->start); 5772 start = marker_position (w->start);
5767 if (start < BEGV || start > ZV) 5773 if (start < BEGV || start > ZV)
diff --git a/src/xdisp.c b/src/xdisp.c
index 7a299055185..4e15e8a5f6d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19068,23 +19068,27 @@ DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
19068First arg FORMAT specifies the mode line format (see `mode-line-format' 19068First arg FORMAT specifies the mode line format (see `mode-line-format'
19069for details) to use. 19069for details) to use.
19070 19070
19071Optional second arg FACE specifies the face property to put 19071By default, the format is evaluated for the currently selected window.
19072on all characters for which no face is specified. 19072
19073The value t means whatever face the window's mode line currently uses 19073Optional second arg FACE specifies the face property to put on all
19074\(either `mode-line' or `mode-line-inactive', depending). 19074characters for which no face is specified. The value nil means the
19075A value of nil means the default is no face property. 19075default face. The value t means whatever face the window's mode line
19076If FACE is an integer, the value string has no text properties. 19076currently uses (either `mode-line' or `mode-line-inactive',
19077depending on whether the window is the selected window or not).
19078An integer value means the value string has no text
19079properties.
19077 19080
19078Optional third and fourth args WINDOW and BUFFER specify the window 19081Optional third and fourth args WINDOW and BUFFER specify the window
19079and buffer to use as the context for the formatting (defaults 19082and buffer to use as the context for the formatting (defaults
19080are the selected window and the window's buffer). */) 19083are the selected window and the WINDOW's buffer). */)
19081 (Lisp_Object format, Lisp_Object face, Lisp_Object window, Lisp_Object buffer) 19084 (Lisp_Object format, Lisp_Object face,
19085 Lisp_Object window, Lisp_Object buffer)
19082{ 19086{
19083 struct it it; 19087 struct it it;
19084 int len; 19088 int len;
19085 struct window *w; 19089 struct window *w;
19086 struct buffer *old_buffer = NULL; 19090 struct buffer *old_buffer = NULL;
19087 int face_id = -1; 19091 int face_id;
19088 int no_props = INTEGERP (face); 19092 int no_props = INTEGERP (face);
19089 int count = SPECPDL_INDEX (); 19093 int count = SPECPDL_INDEX ();
19090 Lisp_Object str; 19094 Lisp_Object str;
@@ -19107,15 +19111,14 @@ are the selected window and the window's buffer). */)
19107 if (no_props) 19111 if (no_props)
19108 face = Qnil; 19112 face = Qnil;
19109 19113
19110 if (!NILP (face)) 19114 face_id = (NILP (face) || EQ (face, Qdefault)) ? DEFAULT_FACE_ID
19111 { 19115 : EQ (face, Qt) ? (EQ (window, selected_window)
19112 if (EQ (face, Qt)) 19116 ? MODE_LINE_FACE_ID : MODE_LINE_INACTIVE_FACE_ID)
19113 face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive); 19117 : EQ (face, Qmode_line) ? MODE_LINE_FACE_ID
19114 face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0); 19118 : EQ (face, Qmode_line_inactive) ? MODE_LINE_INACTIVE_FACE_ID
19115 } 19119 : EQ (face, Qheader_line) ? HEADER_LINE_FACE_ID
19116 19120 : EQ (face, Qtool_bar) ? TOOL_BAR_FACE_ID
19117 if (face_id < 0) 19121 : DEFAULT_FACE_ID;
19118 face_id = DEFAULT_FACE_ID;
19119 19122
19120 if (XBUFFER (buffer) != current_buffer) 19123 if (XBUFFER (buffer) != current_buffer)
19121 old_buffer = current_buffer; 19124 old_buffer = current_buffer;
diff --git a/src/xterm.c b/src/xterm.c
index e91782395df..f0ef8746b01 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8612,9 +8612,13 @@ x_check_fullscreen (struct frame *f)
8612 if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window) 8612 if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
8613 return; /* Only fullscreen without WM or with EWM hints (above). */ 8613 return; /* Only fullscreen without WM or with EWM hints (above). */
8614 8614
8615 /* Setting fullscreen to nil doesn't do anything. We could save the
8616 last non-fullscreen size and restore it, but it seems like a
8617 lot of work for this unusual case (no window manager running). */
8618
8615 if (f->want_fullscreen != FULLSCREEN_NONE) 8619 if (f->want_fullscreen != FULLSCREEN_NONE)
8616 { 8620 {
8617 int width = FRAME_COLS (f), height = FRAME_LINES (f); 8621 int width = FRAME_PIXEL_WIDTH (f), height = FRAME_PIXEL_HEIGHT (f);
8618 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 8622 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8619 8623
8620 switch (f->want_fullscreen) 8624 switch (f->want_fullscreen)
@@ -8632,12 +8636,8 @@ x_check_fullscreen (struct frame *f)
8632 height = x_display_pixel_height (dpyinfo); 8636 height = x_display_pixel_height (dpyinfo);
8633 } 8637 }
8634 8638
8635 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) 8639 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
8636 { 8640 width, height);
8637 change_frame_size (f, height, width, 0, 1, 0);
8638 SET_FRAME_GARBAGED (f);
8639 cancel_mouse_face (f);
8640 }
8641 } 8641 }
8642} 8642}
8643 8643