aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong2010-11-27 15:04:57 -0500
committerChong Yidong2010-11-27 15:04:57 -0500
commit07976ae3b816dea4fd541bbba862603d3132eb2c (patch)
tree4a437b7cb3abb01fb144530a130c991882a1b7f2 /lisp
parent9610796712a3bc43730c99005906571a2c0bccbd (diff)
parent402c8a49571227f8a4e678d4a6cdd6ba7841aef9 (diff)
downloademacs-07976ae3b816dea4fd541bbba862603d3132eb2c.tar.gz
emacs-07976ae3b816dea4fd541bbba862603d3132eb2c.zip
Merge changes from emacs-23 branch
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog122
-rw-r--r--lisp/ChangeLog.138
-rw-r--r--lisp/dired.el8
-rw-r--r--lisp/emacs-lisp/smie.el120
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/pop3.el19
-rw-r--r--lisp/locate.el14
-rw-r--r--lisp/lpr.el18
-rw-r--r--lisp/mail/rmail.el54
-rw-r--r--lisp/mail/rmailmm.el367
-rw-r--r--lisp/mail/rmailsum.el22
-rw-r--r--lisp/net/tramp.el14
-rw-r--r--lisp/progmodes/python.el52
-rw-r--r--lisp/progmodes/which-func.el8
-rw-r--r--lisp/vc/log-edit.el7
15 files changed, 657 insertions, 181 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f26911298e3..8544b0e53d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,113 @@
12010-11-27 Chong Yidong <cyd@stupidchicken.com>
2
3 * log-edit.el (log-edit-font-lock-keywords): Don't try matching
4 stand-alone lines, since that is handled by log-edit-match-to-eoh
5 (Bug#6465).
6
72010-11-27 Eduard Wiebe <usenet@pusto.de>
8
9 * dired.el (dired-get-filename): Replace backslashes with slashes
10 in file names on MS-Windows, needed by `locate'. (Bug#7308)
11 * locate.el (locate-default-make-command-line): Don't consider
12 drive letter and root directory part of
13 `directory-listing-before-filename-regexp'. (Bug#7308)
14 (locate-post-command-hook, locate-post-command-hook): New defcustoms.
15
162010-11-27 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling
19 of :smie-open/close-alist.
20 (smie-next-sexp): Make it accept a "start token" as argument.
21 (smie-indent-keyword): Be careful not to misidentify tokens that span
22 more than one line, as empty lines. Add argument `token'.
23
242010-11-27 Kenichi Handa <handa@m17n.org>
25
26 * mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported
27 multipart subtypes, insert all as usual.
28
29 * mail/rmail.el: Require rfc2047.
30
312010-11-27 Kenichi Handa <handa@m17n.org>
32
33 * mail/rmailmm.el (rmail-mime-entity, rmail-mime-entity-type)
34 (rmail-mime-entity-disposition)
35 (rmail-mime-entity-transfer-encoding, rmail-mime-entity-header)
36 (rmail-mime-entity-body, rmail-mime-entity-children): New functions.
37 (rmail-mime-save): Handle the case that the button's `data' is a
38 MIME entity.
39 (rmail-mime-insert-text): New function.
40 (rmail-mime-insert-image): Handle the case that DATA is a MIME
41 entity.
42 (rmail-mime-bulk-handler): Just call rmail-mime-insert-bulk.
43 (rmail-mime-insert-bulk): New function mostly copied from the old
44 rmail-mime-bulk-handler.
45 (rmail-mime-multipart-handler): Just call
46 rmail-mime-process-multipart.
47 (rmail-mime-process-multipart): New funciton mostly copied from
48 the old rmail-mime-multipart-handler.
49 (rmail-mime-show): Just call rmail-mime-process.
50 (rmail-mime-process): New funciton mostly copied from the old
51 rmail-mime-show.
52 (rmail-mime-insert-multipart, rmail-mime-parse)
53 (rmail-mime-insert, rmail-show-mime)
54 (rmail-insert-mime-forwarded-message)
55 (rmail-insert-mime-resent-message): New functions.
56 (rmail-insert-mime-forwarded-message-function): Set to
57 rmail-insert-mime-forwarded-message.
58 (rmail-insert-mime-resent-message-function): Set to
59 rmail-insert-mime-resent-message.
60
61 * mail/rmailsum.el: Require rfc2047.
62 (rmail-header-summary): Handle multiline Subject: field.
63 (rmail-summary-line-decoder): Change the default to
64 rfc2047-decode-string.
65
66 * mail/rmail.el (rmail-enable-mime): Change the default to t.
67 (rmail-mime-feature): Change the default to `rmailmm'.
68 (rmail-quit): Delete the specifal code for rmail-enable-mime.
69 (rmail-display-labels): Likewise.
70 (rmail-show-message-1): Check rmail-enable-mime, and use
71 rmail-show-mime-function for a MIME message. Decode the headers
72 according to RFC2047.
73
742010-11-27 Stefan Monnier <monnier@iro.umontreal.ca>
75
76 * progmodes/which-func.el (which-func-imenu-joiner-function):
77 Return a string, as expected.
78 (which-function-mode): Make sure we stop any previous timer before
79 starting a new one.
80
812010-11-27 Michael Albinus <michael.albinus@gmx.de>
82
83 * net/tramp.el (tramp-default-method-alist)
84 (tramp-default-user-alist, tramp-default-proxies-alist):
85 Adapt custom options type. (Bug#7445)
86
872010-11-27 Chong Yidong <cyd@stupidchicken.com>
88
89 * progmodes/python.el: Add Ipython support (Bug#5390).
90 (python-shell-prompt-alist)
91 (python-shell-continuation-prompt-alist): New options.
92 (python--set-prompt-regexp): New function.
93 (inferior-python-mode, run-python, python-shell):
94 Require ansi-color. Use python--set-prompt-regexp to set the comint
95 prompt based on the Python interpreter.
96 (python--prompt-regexp): New var.
97 (python-check-comint-prompt)
98 (python-comint-output-filter-function): Use it.
99 (run-python): Use a pipe (Bug#5694).
100
1012010-11-27 Chong Yidong <cyd@stupidchicken.com>
102
103 * progmodes/python.el (run-python): Doc fix.
104 (python-keep-current-directory-in-path): New var (Bug#7454).
105
1062010-11-27 Chong Yidong <cyd@stupidchicken.com>
107
108 * lpr.el (lpr-buffer, print-buffer, lpr-region, print-region):
109 Prompt user before actually printing.
110
12010-11-27 Eli Zaretskii <eliz@gnu.org> 1112010-11-27 Eli Zaretskii <eliz@gnu.org>
2 112
3 * international/characters.el (glyphless-char-display-control): 113 * international/characters.el (glyphless-char-display-control):
@@ -227,7 +337,8 @@
2272010-11-18 Stefan Monnier <monnier@iro.umontreal.ca> 3372010-11-18 Stefan Monnier <monnier@iro.umontreal.ca>
228 338
229 * simple.el (kill-new, kill-append, kill-region): 339 * simple.el (kill-new, kill-append, kill-region):
230 * comint.el (comint-kill-region): Make the yank-handler argument obsolete. 340 * comint.el (comint-kill-region): Make the yank-handler argument
341 obsolete.
231 342
2322010-11-18 Stefan Monnier <monnier@iro.umontreal.ca> 3432010-11-18 Stefan Monnier <monnier@iro.umontreal.ca>
233 344
@@ -6074,7 +6185,7 @@
6074 * vc/vc-annotate.el (vc-annotate): Add an optional argument for the 6185 * vc/vc-annotate.el (vc-annotate): Add an optional argument for the
6075 VC backend. Use it when non-nil. 6186 VC backend. Use it when non-nil.
6076 (vc-annotate-warp-revision): Pass the VC backend to vc-annotate. 6187 (vc-annotate-warp-revision): Pass the VC backend to vc-annotate.
6077 (Bug#6487) 6188 (Bug#6487).
6078 6189
6079 Fix vc-annotate-show-changeset-diff-revision-at-line for git. 6190 Fix vc-annotate-show-changeset-diff-revision-at-line for git.
6080 * vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal): 6191 * vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal):
@@ -9735,7 +9846,8 @@
9735 9846
97362010-02-06 Dan Nicolaescu <dann@ics.uci.edu> 98472010-02-06 Dan Nicolaescu <dann@ics.uci.edu>
9737 9848
9738 * vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header. 9849 * vc-bzr.el (vc-bzr-dir-extra-headers):
9850 Disable the pending merges header.
9739 9851
97402010-02-05 Juri Linkov <juri@jurta.org> 98522010-02-05 Juri Linkov <juri@jurta.org>
9741 9853
@@ -10624,8 +10736,8 @@
106242009-12-18 Ulf Jasper <ulf.jasper@web.de> 107362009-12-18 Ulf Jasper <ulf.jasper@web.de>
10625 10737
10626 * calendar/icalendar.el (icalendar--convert-tz-offset): 10738 * calendar/icalendar.el (icalendar--convert-tz-offset):
10627 Fix timezone names. 10739 Fixed timezone names.
10628 (icalendar--convert-tz-offset): Fix the "last-day-problem". 10740 (icalendar--convert-tz-offset): Fixed the "last-day-problem".
10629 (icalendar--add-diary-entry): Remove the trailing blank that 10741 (icalendar--add-diary-entry): Remove the trailing blank that
10630 diary-make-entry inserts. 10742 diary-make-entry inserts.
10631 10743
diff --git a/lisp/ChangeLog.13 b/lisp/ChangeLog.13
index fa82dc2fc63..d8ec37390f1 100644
--- a/lisp/ChangeLog.13
+++ b/lisp/ChangeLog.13
@@ -6680,8 +6680,9 @@
6680 buffer if the parent buffer is in vc-dired-mode. 6680 buffer if the parent buffer is in vc-dired-mode.
6681 6681
66822007-11-23 Mark A. Hershberger <mah@everybody.org> 66822007-11-23 Mark A. Hershberger <mah@everybody.org>
6683 James Clark <none@example.com>
6683 6684
6684 * nxml: Initial merge of nxml. Kept nxml/char-name subdir for now. 6685 * nxml/: Initial merge of nxml. Kept nxml/char-name subdir for now.
6685 6686
66862007-11-23 Juri Linkov <juri@jurta.org> 66872007-11-23 Juri Linkov <juri@jurta.org>
6687 6688
@@ -16693,10 +16694,9 @@ See ChangeLog.12 for earlier changes.
16693 16694
16694;; Local Variables: 16695;; Local Variables:
16695;; coding: utf-8 16696;; coding: utf-8
16696;; add-log-time-zone-rule: t
16697;; End: 16697;; End:
16698 16698
16699 Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 16699 Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
16700 16700
16701 This file is part of GNU Emacs. 16701 This file is part of GNU Emacs.
16702 16702
@@ -16712,5 +16712,3 @@ See ChangeLog.12 for earlier changes.
16712 16712
16713 You should have received a copy of the GNU General Public License 16713 You should have received a copy of the GNU General Public License
16714 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 16714 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
16715
16716;; arch-tag: 1e8aa93a-fc6c-4ac3-9b10-1f445e1840af
diff --git a/lisp/dired.el b/lisp/dired.el
index bd3fb531d77..104cf4970ad 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2011,6 +2011,14 @@ Otherwise, an error occurs in these cases."
2011 ;; with quotation marks in their names. 2011 ;; with quotation marks in their names.
2012 (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file) 2012 (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file)
2013 (setq file (replace-match "\\\"" nil t file 1))) 2013 (setq file (replace-match "\\\"" nil t file 1)))
2014
2015 (when (eq system-type 'windows-nt)
2016 (save-match-data
2017 (let ((start 0))
2018 (while (string-match "\\\\" file start)
2019 (aset file (match-beginning 0) ?/)
2020 (setq start (match-end 0))))))
2021
2014 (setq file (read (concat "\"" file "\""))) 2022 (setq file (read (concat "\"" file "\"")))
2015 ;; The above `read' will return a unibyte string if FILE 2023 ;; The above `read' will return a unibyte string if FILE
2016 ;; contains eight-bit-control/graphic characters. 2024 ;; contains eight-bit-control/graphic characters.
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 179e0a9f094..a7021b3cf7b 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -76,8 +76,6 @@
76 76
77;; TODO & BUGS: 77;; TODO & BUGS:
78;; 78;;
79;; - FIXME: I think the behavior on empty lines is wrong. It shouldn't
80;; look at the next token on subsequent lines.
81;; - Using the structural information SMIE gives us, it should be possible to 79;; - Using the structural information SMIE gives us, it should be possible to
82;; implement a `smie-align' command that would automatically figure out what 80;; implement a `smie-align' command that would automatically figure out what
83;; there is to align and how to do it (something like: align the token of 81;; there is to align and how to do it (something like: align the token of
@@ -470,7 +468,7 @@ PREC2 is a table as returned by `smie-precs->prec2' or
470 (to (cdar eqs))) 468 (to (cdar eqs)))
471 (setq eqs (cdr eqs)) 469 (setq eqs (cdr eqs))
472 (if (eq to from) 470 (if (eq to from)
473 nil ;Nothing to do. 471 nil ;Nothing to do.
474 (dolist (other-eq eqs) 472 (dolist (other-eq eqs)
475 (if (eq from (cdr other-eq)) (setcdr other-eq to)) 473 (if (eq from (cdr other-eq)) (setcdr other-eq to))
476 (when (eq from (car other-eq)) 474 (when (eq from (car other-eq))
@@ -523,24 +521,23 @@ PREC2 is a table as returned by `smie-precs->prec2' or
523 (setcar (car eq) (cadr eq)) 521 (setcar (car eq) (cadr eq))
524 ;; (smie-check-grammar table prec2 'step2) 522 ;; (smie-check-grammar table prec2 'step2)
525 ) 523 )
526 ;; Finally, fill in the remaining vars (which only appeared on the 524 ;; Finally, fill in the remaining vars (which did not appear on the
527 ;; right side of the < constraints). 525 ;; left side of any < constraint).
528 (let ((classification-table (gethash :smie-open/close-alist prec2))) 526 (dolist (x table)
529 (dolist (x table) 527 (unless (nth 1 x)
530 ;; When both sides are nil, it means this operator binds very 528 (setf (nth 1 x) i)
531 ;; very tight, but it's still just an operator, so we give it 529 (incf i)) ;See other (incf i) above.
532 ;; the highest precedence. 530 (unless (nth 2 x)
533 ;; OTOH if only one side is nil, it usually means it's like an 531 (setf (nth 2 x) i)
534 ;; open-paren, which is very important for indentation purposes, 532 (incf i)))) ;See other (incf i) above.
535 ;; so we keep it nil if so, to make it easier to recognize. 533 ;; Mark closers and openers.
536 (unless (or (nth 1 x) 534 (dolist (x (gethash :smie-open/close-alist prec2))
537 (eq 'opener (cdr (assoc (car x) classification-table)))) 535 (let* ((token (car x))
538 (setf (nth 1 x) i) 536 (cons (case (cdr x)
539 (incf i)) ;See other (incf i) above. 537 (closer (cddr (assoc token table)))
540 (unless (or (nth 2 x) 538 (opener (cdr (assoc token table))))))
541 (eq 'closer (cdr (assoc (car x) classification-table)))) 539 (assert (numberp (car cons)))
542 (setf (nth 2 x) i) 540 (setf (car cons) (list (car cons)))))
543 (incf i))))) ;See other (incf i) above.
544 (let ((ca (gethash :smie-closer-alist prec2))) 541 (let ((ca (gethash :smie-closer-alist prec2)))
545 (when ca (push (cons :smie-closer-alist ca) table))) 542 (when ca (push (cons :smie-closer-alist ca) table)))
546 ;; (smie-check-grammar table prec2 'step3) 543 ;; (smie-check-grammar table prec2 'step3)
@@ -611,6 +608,8 @@ OP-FORW is the accessor to the forward level of the level data.
611OP-BACK is the accessor to the backward level of the level data. 608OP-BACK is the accessor to the backward level of the level data.
612HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 609HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
613first token we see is an operator, skip over its left-hand-side argument. 610first token we see is an operator, skip over its left-hand-side argument.
611HALFSEXP can also be a token, in which case it means to parse as if
612we had just successfully passed this token.
614Possible return values: 613Possible return values:
615 (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level 614 (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
616 is too high. FORW-LEVEL is the forw-level of TOKEN, 615 is too high. FORW-LEVEL is the forw-level of TOKEN,
@@ -619,7 +618,10 @@ Possible return values:
619 (nil POS TOKEN): we skipped over a paren-like pair. 618 (nil POS TOKEN): we skipped over a paren-like pair.
620 nil: we skipped over an identifier, matched parentheses, ..." 619 nil: we skipped over an identifier, matched parentheses, ..."
621 (catch 'return 620 (catch 'return
622 (let ((levels ())) 621 (let ((levels
622 (if (stringp halfsexp)
623 (prog1 (list (cdr (assoc halfsexp smie-grammar)))
624 (setq halfsexp nil)))))
623 (while 625 (while
624 (let* ((pos (point)) 626 (let* ((pos (point))
625 (token (funcall next-token)) 627 (token (funcall next-token))
@@ -697,6 +699,8 @@ Possible return values:
697 "Skip over one sexp. 699 "Skip over one sexp.
698HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 700HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
699first token we see is an operator, skip over its left-hand-side argument. 701first token we see is an operator, skip over its left-hand-side argument.
702HALFSEXP can also be a token, in which case we should skip the text
703assuming it is the left-hand-side argument of that token.
700Possible return values: 704Possible return values:
701 (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level 705 (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level
702 is too high. LEFT-LEVEL is the left-level of TOKEN, 706 is too high. LEFT-LEVEL is the left-level of TOKEN,
@@ -714,7 +718,9 @@ Possible return values:
714(defun smie-forward-sexp (&optional halfsexp) 718(defun smie-forward-sexp (&optional halfsexp)
715 "Skip over one sexp. 719 "Skip over one sexp.
716HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 720HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
717first token we see is an operator, skip over its left-hand-side argument. 721first token we see is an operator, skip over its right-hand-side argument.
722HALFSEXP can also be a token, in which case we should skip the text
723assuming it is the right-hand-side argument of that token.
718Possible return values: 724Possible return values:
719 (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level 725 (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level
720 is too high. RIGHT-LEVEL is the right-level of TOKEN, 726 is too high. RIGHT-LEVEL is the right-level of TOKEN,
@@ -791,7 +797,7 @@ Possible return values:
791 (push (car other) found)))))) 797 (push (car other) found))))))
792 (cond 798 (cond
793 ((null found) (error "No known closer for opener %s" open)) 799 ((null found) (error "No known closer for opener %s" open))
794 ;; FIXME: what should we do if there are various closers? 800 ;; What should we do if there are various closers?
795 (t (car found)))))))))) 801 (t (car found))))))))))
796 (unless (save-excursion (skip-chars-backward " \t") (bolp)) 802 (unless (save-excursion (skip-chars-backward " \t") (bolp))
797 (newline)) 803 (newline))
@@ -1094,9 +1100,6 @@ Only meaningful when called from within `smie-rules-function'."
1094 ;; line, in which case we want to align it with its enclosing parent. 1100 ;; line, in which case we want to align it with its enclosing parent.
1095 (cond 1101 (cond
1096 ((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p))) 1102 ((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p)))
1097 ;; FIXME: Rather than consult the number of spaces, we could *set* the
1098 ;; number of spaces so as to align the separator with the close-paren
1099 ;; while aligning the content with the rest.
1100 (let ((parent-col (cdr (smie-rule-parent))) 1103 (let ((parent-col (cdr (smie-rule-parent)))
1101 (parent-pos-col ;FIXME: we knew this when computing smie--parent. 1104 (parent-pos-col ;FIXME: we knew this when computing smie--parent.
1102 (save-excursion 1105 (save-excursion
@@ -1225,39 +1228,48 @@ in order to figure out the indentation of some other (further down) point."
1225 (smie-indent-virtual)) ;:not-hanging 1228 (smie-indent-virtual)) ;:not-hanging
1226 (scan-error nil))))) 1229 (scan-error nil)))))
1227 1230
1228(defun smie-indent-keyword () 1231(defun smie-indent-keyword (&optional token)
1229 ;; Align closing token with the corresponding opening one. 1232 "Indent point based on the token that follows it immediately.
1230 ;; (e.g. "of" with "case", or "in" with "let"). 1233If TOKEN is non-nil, assume that that is the token that follows point.
1234Returns either a column number or nil if it considers that indentation
1235should not be computed on the basis of the following token."
1231 (save-excursion 1236 (save-excursion
1232 (let* ((pos (point)) 1237 (let* ((pos (point))
1233 (toklevels (smie-indent-forward-token)) 1238 (toklevels
1234 (token (pop toklevels))) 1239 (if token
1240 (assoc token smie-grammar)
1241 (let* ((res (smie-indent-forward-token)))
1242 ;; Ignore tokens on subsequent lines.
1243 (if (and (< pos (line-beginning-position))
1244 ;; Make sure `token' also *starts* on another line.
1245 (save-excursion
1246 (smie-indent-backward-token)
1247 (< pos (line-beginning-position))))
1248 nil
1249 (goto-char pos)
1250 res)))))
1251 (setq token (pop toklevels))
1235 (cond 1252 (cond
1236 ((< pos (line-beginning-position)) 1253 ((null (cdr toklevels)) nil) ;Not a keyword.
1237 ;; The token we just read is actually not on the line where we started.
1238 nil)
1239 ((not (numberp (car toklevels))) 1254 ((not (numberp (car toklevels)))
1240 (save-excursion 1255 ;; Different cases:
1241 (goto-char pos) 1256 ;; - smie-indent--bolp: "indent according to others".
1242 ;; Different cases: 1257 ;; - common hanging: "indent according to others".
1243 ;; - smie-indent--bolp: "indent according to others". 1258 ;; - SML-let hanging: "indent like parent".
1244 ;; - common hanging: "indent according to others". 1259 ;; - if-after-else: "indent-like parent".
1245 ;; - SML-let hanging: "indent like parent". 1260 ;; - middle-of-line: "trust current position".
1246 ;; - if-after-else: "indent-like parent". 1261 (cond
1247 ;; - middle-of-line: "trust current position". 1262 ((smie-indent--rule :before token))
1248 (cond 1263 ((smie-indent--bolp) ;I.e. non-virtual indent.
1249 ((null (cdr toklevels)) nil) ;Not a keyword. 1264 ;; For an open-paren-like thingy at BOL, always indent only
1250 ((smie-indent--rule :before token)) 1265 ;; based on other rules (typically smie-indent-after-keyword).
1251 ((smie-indent--bolp) ;I.e. non-virtual indent. 1266 nil)
1252 ;; For an open-paren-like thingy at BOL, always indent only 1267 (t
1253 ;; based on other rules (typically smie-indent-after-keyword). 1268 ;; By default use point unless we're hanging.
1254 nil) 1269 (unless (smie-indent--hanging-p) (current-column)))))
1255 (t
1256 ;; By default use point unless we're hanging.
1257 (unless (smie-indent--hanging-p) (current-column))))))
1258 (t 1270 (t
1259 ;; FIXME: This still looks too much like black magic!! 1271 ;; FIXME: This still looks too much like black magic!!
1260 (let* ((parent (smie-backward-sexp 'halfsexp))) 1272 (let* ((parent (smie-backward-sexp token)))
1261 ;; Different behaviors: 1273 ;; Different behaviors:
1262 ;; - align with parent. 1274 ;; - align with parent.
1263 ;; - parent + offset. 1275 ;; - parent + offset.
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 3ae3c5bc740..651cfef7f00 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12010-11-27 Yuri Karaban <tech@askold.net> (tiny change)
2
3 * pop3.el (pop3-open-server): Read server greeting before starting TLS
4 negotiation.
5
12010-11-26 Julien Danjou <julien@danjou.info> 62010-11-26 Julien Danjou <julien@danjou.info>
2 7
3 * color.el: Rename various rgb functions to srgb. 8 * color.el: Rename various rgb functions to srgb.
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index 327c5297492..eef53c2797d 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -327,21 +327,22 @@ Returns the process associated with the connection."
327 ;; gnutls-cli, openssl don't accept service names 327 ;; gnutls-cli, openssl don't accept service names
328 (if (equal port "pop3") 328 (if (equal port "pop3")
329 (setq port 110)) 329 (setq port 110))
330 (let ((process (starttls-open-stream "POP" (current-buffer) 330 ;; Delay STLS until server greeting is read (Bug#7438).
331 mailhost (or port 110)))) 331 (starttls-open-stream "POP" (current-buffer)
332 (pop3-send-command process "STLS") 332 mailhost (or port 110)))
333 (let ((response (pop3-read-response process t)))
334 (if (and response (string-match "+OK" response))
335 (starttls-negotiate process)
336 (pop3-quit process)
337 (error "POP server doesn't support starttls")))
338 process))
339 (t 333 (t
340 (open-network-stream "POP" (current-buffer) mailhost port)))) 334 (open-network-stream "POP" (current-buffer) mailhost port))))
341 (let ((response (pop3-read-response process t))) 335 (let ((response (pop3-read-response process t)))
342 (setq pop3-timestamp 336 (setq pop3-timestamp
343 (substring response (or (string-match "<" response) 0) 337 (substring response (or (string-match "<" response) 0)
344 (+ 1 (or (string-match ">" response) -1))))) 338 (+ 1 (or (string-match ">" response) -1)))))
339 (when (eq pop3-stream-type 'starttls)
340 (pop3-send-command process "STLS")
341 (let ((response (pop3-read-response process t)))
342 (if (and response (string-match "+OK" response))
343 (starttls-negotiate process)
344 (pop3-quit process)
345 (error "POP server doesn't support starttls"))))
345 (pop3-set-process-query-on-exit-flag process nil) 346 (pop3-set-process-query-on-exit-flag process nil)
346 process))) 347 process)))
347 348
diff --git a/lisp/locate.el b/lisp/locate.el
index 4e8925665ca..4c4312b9598 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -145,6 +145,11 @@ the version.)"
145 :type 'string 145 :type 'string
146 :group 'locate) 146 :group 'locate)
147 147
148(defcustom locate-post-command-hook nil
149 "List of hook functions run after `locate' (see `run-hooks')."
150 :type 'hook
151 :group 'locate)
152
148(defvar locate-history-list nil 153(defvar locate-history-list nil
149 "The history list used by the \\[locate] command.") 154 "The history list used by the \\[locate] command.")
150 155
@@ -226,6 +231,11 @@ that is, with a prefix arg, you get the default behavior."
226 :group 'locate 231 :group 'locate
227 :type 'boolean) 232 :type 'boolean)
228 233
234(defcustom locate-mode-hook nil
235 "List of hook functions run by `locate-mode' (see `run-mode-hooks')."
236 :type 'hook
237 :group 'locate)
238
229;; Functions 239;; Functions
230 240
231(defun locate-default-make-command-line (search-string) 241(defun locate-default-make-command-line (search-string)
@@ -471,9 +481,9 @@ do not work in subdirectories.
471 (make-local-variable 'directory-listing-before-filename-regexp) 481 (make-local-variable 'directory-listing-before-filename-regexp)
472 ;; This should support both Unix and Windoze style names 482 ;; This should support both Unix and Windoze style names
473 (setq directory-listing-before-filename-regexp 483 (setq directory-listing-before-filename-regexp
474 (concat "^." 484 (concat "^.\\("
475 (make-string (1- locate-filename-indentation) ?\s) 485 (make-string (1- locate-filename-indentation) ?\s)
476 "\\(/\\|[A-Za-z]:\\)\\|" 486 "\\)\\|"
477 (default-value 'directory-listing-before-filename-regexp))) 487 (default-value 'directory-listing-before-filename-regexp)))
478 (make-local-variable 'dired-actual-switches) 488 (make-local-variable 'dired-actual-switches)
479 (setq dired-actual-switches "") 489 (setq dired-actual-switches "")
diff --git a/lisp/lpr.el b/lisp/lpr.el
index 559dc5513ae..3b91172a7ef 100644
--- a/lisp/lpr.el
+++ b/lisp/lpr.el
@@ -152,7 +152,9 @@ The variable `lpr-page-header-program' specifies the program to use."
152 "Print buffer contents without pagination or page headers. 152 "Print buffer contents without pagination or page headers.
153See the variables `lpr-switches' and `lpr-command' 153See the variables `lpr-switches' and `lpr-command'
154for customization of the printer command." 154for customization of the printer command."
155 (interactive) 155 (interactive
156 (unless (y-or-n-p "Send current buffer to default printer? ")
157 (error "Cancelled")))
156 (print-region-1 (point-min) (point-max) lpr-switches nil)) 158 (print-region-1 (point-min) (point-max) lpr-switches nil))
157 159
158;;;###autoload 160;;;###autoload
@@ -169,7 +171,9 @@ in the print command itself; we expect them to request pagination.
169 171
170See the variables `lpr-switches' and `lpr-command' 172See the variables `lpr-switches' and `lpr-command'
171for further customization of the printer command." 173for further customization of the printer command."
172 (interactive) 174 (interactive
175 (unless (y-or-n-p "Send current buffer to default printer? ")
176 (error "Cancelled")))
173 (print-region-1 (point-min) (point-max) lpr-switches t)) 177 (print-region-1 (point-min) (point-max) lpr-switches t))
174 178
175;;;###autoload 179;;;###autoload
@@ -177,7 +181,10 @@ for further customization of the printer command."
177 "Print region contents without pagination or page headers. 181 "Print region contents without pagination or page headers.
178See the variables `lpr-switches' and `lpr-command' 182See the variables `lpr-switches' and `lpr-command'
179for customization of the printer command." 183for customization of the printer command."
180 (interactive "r") 184 (interactive
185 (if (y-or-n-p "Send selected text to default printer? ")
186 (list (region-beginning) (region-end))
187 (error "Cancelled")))
181 (print-region-1 start end lpr-switches nil)) 188 (print-region-1 start end lpr-switches nil))
182 189
183;;;###autoload 190;;;###autoload
@@ -194,7 +201,10 @@ in the print command itself; we expect them to request pagination.
194 201
195See the variables `lpr-switches' and `lpr-command' 202See the variables `lpr-switches' and `lpr-command'
196for further customization of the printer command." 203for further customization of the printer command."
197 (interactive "r") 204 (interactive
205 (if (y-or-n-p "Send selected text to default printer? ")
206 (list (region-beginning) (region-end))
207 (error "Cancelled")))
198 (print-region-1 start end lpr-switches t)) 208 (print-region-1 start end lpr-switches t))
199 209
200(defun print-region-1 (start end switches page-headers) 210(defun print-region-1 (start end switches page-headers)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 47e52f27aa1..a2629dfe1c7 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -39,6 +39,7 @@
39;; 39;;
40 40
41(require 'mail-utils) 41(require 'mail-utils)
42(require 'rfc2047)
42 43
43(defconst rmail-attribute-header "X-RMAIL-ATTRIBUTES" 44(defconst rmail-attribute-header "X-RMAIL-ATTRIBUTES"
44 "The header that stores the Rmail attribute data.") 45 "The header that stores the Rmail attribute data.")
@@ -638,7 +639,7 @@ Element N specifies the summary line for message N+1.")
638 639
639This is set to nil by default.") 640This is set to nil by default.")
640 641
641(defcustom rmail-enable-mime nil 642(defcustom rmail-enable-mime t
642 "If non-nil, RMAIL uses MIME features. 643 "If non-nil, RMAIL uses MIME features.
643If the value is t, RMAIL automatically shows MIME decoded message. 644If the value is t, RMAIL automatically shows MIME decoded message.
644If the value is neither t nor nil, RMAIL does not show MIME decoded message 645If the value is neither t nor nil, RMAIL does not show MIME decoded message
@@ -649,6 +650,7 @@ unless the feature specified by `rmail-mime-feature' is available."
649 :type '(choice (const :tag "on" t) 650 :type '(choice (const :tag "on" t)
650 (const :tag "off" nil) 651 (const :tag "off" nil)
651 (other :tag "when asked" ask)) 652 (other :tag "when asked" ask))
653 :version "23.3"
652 :group 'rmail) 654 :group 'rmail)
653 655
654(defvar rmail-enable-mime-composing nil 656(defvar rmail-enable-mime-composing nil
@@ -693,13 +695,12 @@ start of the header) with three arguments MSG, REGEXP, and LIMIT,
693where MSG is the message number, REGEXP is the regular 695where MSG is the message number, REGEXP is the regular
694expression, LIMIT is the position specifying the end of header.") 696expression, LIMIT is the position specifying the end of header.")
695 697
696(defvar rmail-mime-feature 'rmail-mime 698(defvar rmail-mime-feature 'rmailmm
697 "Feature to require to load MIME support in Rmail. 699 "Feature to require to load MIME support in Rmail.
698When starting Rmail, if `rmail-enable-mime' is non-nil, 700When starting Rmail, if `rmail-enable-mime' is non-nil,
699this feature is required with `require'. 701this feature is required with `require'.
700 702
701The default value is `rmail-mime'. This feature is provided by 703The default value is `rmailmm'")
702the rmail-mime package available at <http://www.m17n.org/rmail-mime/>.")
703 704
704;; FIXME this is unused. 705;; FIXME this is unused.
705(defvar rmail-decode-mime-charset t 706(defvar rmail-decode-mime-charset t
@@ -1509,17 +1510,9 @@ Hook `rmail-quit-hook' is run after expunging."
1509 (set-buffer-modified-p nil)) 1510 (set-buffer-modified-p nil))
1510 (replace-buffer-in-windows rmail-summary-buffer) 1511 (replace-buffer-in-windows rmail-summary-buffer)
1511 (bury-buffer rmail-summary-buffer)) 1512 (bury-buffer rmail-summary-buffer))
1512 (if rmail-enable-mime 1513 (let ((obuf (current-buffer)))
1513 (let ((obuf rmail-buffer) 1514 (quit-window)
1514 (ovbuf rmail-view-buffer)) 1515 (replace-buffer-in-windows obuf)))
1515 (set-buffer rmail-view-buffer)
1516 (quit-window)
1517 (replace-buffer-in-windows ovbuf)
1518 (replace-buffer-in-windows obuf)
1519 (bury-buffer obuf))
1520 (let ((obuf (current-buffer)))
1521 (quit-window)
1522 (replace-buffer-in-windows obuf))))
1523 1516
1524(defun rmail-bury () 1517(defun rmail-bury ()
1525 "Bury current Rmail buffer and its summary buffer." 1518 "Bury current Rmail buffer and its summary buffer."
@@ -2219,15 +2212,7 @@ If nil, that means the current message."
2219 (let ((blurb (rmail-get-labels))) 2212 (let ((blurb (rmail-get-labels)))
2220 (setq mode-line-process 2213 (setq mode-line-process
2221 (format " %d/%d%s" 2214 (format " %d/%d%s"
2222 rmail-current-message rmail-total-messages blurb)) 2215 rmail-current-message rmail-total-messages blurb))))
2223 ;; If rmail-enable-mime is non-nil, we may have to update
2224 ;; `mode-line-process' of rmail-view-buffer too.
2225 (if (and rmail-enable-mime
2226 (not (eq (current-buffer) rmail-view-buffer))
2227 (buffer-live-p rmail-view-buffer))
2228 (let ((mlp mode-line-process))
2229 (with-current-buffer rmail-view-buffer
2230 (setq mode-line-process mlp))))))
2231 2216
2232(defun rmail-get-attr-value (attr state) 2217(defun rmail-get-attr-value (attr state)
2233 "Return the character value for ATTR. 2218 "Return the character value for ATTR.
@@ -2706,6 +2691,11 @@ The current mail message becomes the message displayed."
2706 (message "Showing message %d" msg)) 2691 (message "Showing message %d" msg))
2707 (narrow-to-region beg end) 2692 (narrow-to-region beg end)
2708 (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))
2709 (setq body-start (search-forward "\n\n" nil t)) 2699 (setq body-start (search-forward "\n\n" nil t))
2710 (narrow-to-region beg (point)) 2700 (narrow-to-region beg (point))
2711 (goto-char beg) 2701 (goto-char beg)
@@ -2722,11 +2712,6 @@ The current mail message becomes the message displayed."
2722 ;; unibyte temporary buffer where the character decoding takes 2712 ;; unibyte temporary buffer where the character decoding takes
2723 ;; place. 2713 ;; place.
2724 (with-current-buffer rmail-view-buffer 2714 (with-current-buffer rmail-view-buffer
2725 ;; We give the view buffer a buffer-local value of
2726 ;; rmail-header-style based on the binding in effect when
2727 ;; this function is called; `rmail-toggle-headers' can
2728 ;; inspect this value to determine how to toggle.
2729 (set (make-local-variable 'rmail-header-style) header-style)
2730 (erase-buffer)) 2715 (erase-buffer))
2731 (if (null character-coding) 2716 (if (null character-coding)
2732 ;; Do it directly since that is fast. 2717 ;; Do it directly since that is fast.
@@ -2749,8 +2734,13 @@ The current mail message becomes the message displayed."
2749 (error "uuencoded messages are not supported yet")) 2734 (error "uuencoded messages are not supported yet"))
2750 (t)) 2735 (t))
2751 (rmail-decode-region (point-min) (point-max) 2736 (rmail-decode-region (point-min) (point-max)
2752 coding-system view-buf))) 2737 coding-system view-buf))))
2753 (with-current-buffer rmail-view-buffer 2738 (with-current-buffer rmail-view-buffer
2739 ;; We give the view buffer a buffer-local value of
2740 ;; rmail-header-style based on the binding in effect when
2741 ;; this function is called; `rmail-toggle-headers' can
2742 ;; inspect this value to determine how to toggle.
2743 (set (make-local-variable 'rmail-header-style) header-style)
2754 ;; Unquote quoted From lines 2744 ;; Unquote quoted From lines
2755 (goto-char (point-min)) 2745 (goto-char (point-min))
2756 (while (re-search-forward "^>+From " nil t) 2746 (while (re-search-forward "^>+From " nil t)
@@ -2766,6 +2756,10 @@ The current mail message becomes the message displayed."
2766 (with-current-buffer rmail-view-buffer 2756 (with-current-buffer rmail-view-buffer
2767 (insert "\n") 2757 (insert "\n")
2768 (goto-char (point-min)) 2758 (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)))
2769 (rmail-highlight-headers) 2763 (rmail-highlight-headers)
2770 ;(rmail-activate-urls) 2764 ;(rmail-activate-urls)
2771 ;(rmail-process-quoted-material) 2765 ;(rmail-process-quoted-material)
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 3882c9e47c8..918d2dfc365 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -27,17 +27,57 @@
27 27
28;; Essentially based on the design of Alexander Pohoyda's MIME 28;; Essentially based on the design of Alexander Pohoyda's MIME
29;; extensions (mime-display.el and mime.el). 29;; extensions (mime-display.el and mime.el).
30;; Call `M-x rmail-mime' when viewing an Rmail message. 30
31;; This file provides two operation modes for viewing a MIME message.
32
33;; (1) When rmail-enable-mime is non-nil (now it is the default), the
34;; function `rmail-show-mime' is automatically called. That function
35;; shows a MIME message directly in RMAIL's view buffer.
36
37;; (2) When rmail-enable-mime is nil, the command 'v' (or M-x
38;; rmail-mime) shows a MIME message in a new buffer "*RMAIL*".
39
40;; Both operations share the intermediate functions rmail-mime-process
41;; and rmail-mime-process-multipart as below.
42
43;; rmail-show-mime
44;; +- rmail-mime-parse
45;; | +- rmail-mime-process <--+------------+
46;; | | +---------+ |
47;; | + rmail-mime-process-multipart --+
48;; |
49;; + rmail-mime-insert <----------------+
50;; +- rmail-mime-insert-text |
51;; +- rmail-mime-insert-bulk |
52;; +- rmail-mime-insert-multipart --+
53;;
54;; rmail-mime
55;; +- rmail-mime-show <----------------------------------+
56;; +- rmail-mime-process |
57;; +- rmail-mime-handle |
58;; +- rmail-mime-text-handler |
59;; +- rmail-mime-bulk-handler |
60;; | + rmail-mime-insert-bulk
61;; +- rmail-mime-multipart-handler |
62;; +- rmail-mime-process-multipart --+
63
64;; In addition, for the case of rmail-enable-mime being non-nil, this
65;; file provides two functions rmail-insert-mime-forwarded-message and
66;; rmail-insert-mime-resent-message for composing forwarded and resent
67;; messages respectively.
31 68
32;; Todo: 69;; Todo:
33 70
34;; Handle multipart/alternative. 71;; Make rmail-mime-media-type-handlers-alist usable in the first
72;; operation mode.
73;; Handle multipart/alternative in the second operation mode.
35;; Offer the option to call external/internal viewers (doc-view, xpdf, etc). 74;; Offer the option to call external/internal viewers (doc-view, xpdf, etc).
36 75
37;;; Code: 76;;; Code:
38 77
39(require 'rmail) 78(require 'rmail)
40(require 'mail-parse) 79(require 'mail-parse)
80(require 'message)
41 81
42;;; User options. 82;;; User options.
43 83
@@ -91,6 +131,52 @@ automatically display the image in the buffer."
91 131
92;;; End of user options. 132;;; End of user options.
93 133
134;;; MIME-entity object
135
136(defun rmail-mime-entity (type disposition transfer-encoding
137 header body children)
138 "Retrun a newly created MIME-entity object.
139
140A MIME-entity is a vector of 6 elements:
141
142 [ TYPE DISPOSITION TRANSFER-ENCODING HEADER BODY CHILDREN ]
143
144TYPE and DISPOSITION correspond to MIME headers Content-Type: and
145Cotent-Disposition: respectively, and has this format:
146
147 \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...)
148
149VALUE is a string and ATTRIBUTE is a symbol.
150
151Consider the following header, for example:
152
153Content-Type: multipart/mixed;
154 boundary=\"----=_NextPart_000_0104_01C617E4.BDEC4C40\"
155
156The corresponding TYPE argument must be:
157
158\(\"multipart/mixed\"
159 \(\"boundary\" . \"----=_NextPart_000_0104_01C617E4.BDEC4C40\"))
160
161TRANSFER-ENCODING corresponds to MIME header
162Content-Transfer-Encoding, and is a lowercased string.
163
164HEADER and BODY are a cons (BEG . END), where BEG and END specify
165the region of the corresponding part in RMAIL's data (mbox)
166buffer. BODY may be nil. In that case, the current buffer is
167narrowed to the body part.
168
169CHILDREN is a list of MIME-entities for a \"multipart\" entity, and
170nil for the other types."
171 (vector type disposition transfer-encoding header body children))
172
173;; Accessors for a MIME-entity object.
174(defsubst rmail-mime-entity-type (entity) (aref entity 0))
175(defsubst rmail-mime-entity-disposition (entity) (aref entity 1))
176(defsubst rmail-mime-entity-transfer-encoding (entity) (aref entity 2))
177(defsubst rmail-mime-entity-header (entity) (aref entity 3))
178(defsubst rmail-mime-entity-body (entity) (aref entity 4))
179(defsubst rmail-mime-entity-children (entity) (aref entity 5))
94 180
95;;; Buttons 181;;; Buttons
96 182
@@ -99,6 +185,7 @@ automatically display the image in the buffer."
99 (let* ((filename (button-get button 'filename)) 185 (let* ((filename (button-get button 'filename))
100 (directory (button-get button 'directory)) 186 (directory (button-get button 'directory))
101 (data (button-get button 'data)) 187 (data (button-get button 'data))
188 (mbox-buf rmail-view-buffer)
102 (ofilename filename)) 189 (ofilename filename))
103 (setq filename (expand-file-name 190 (setq filename (expand-file-name
104 (read-file-name (format "Save as (default: %s): " filename) 191 (read-file-name (format "Save as (default: %s): " filename)
@@ -117,7 +204,17 @@ automatically display the image in the buffer."
117 ;; file, the magic signature compares equal with the unibyte 204 ;; file, the magic signature compares equal with the unibyte
118 ;; signature string recorded in jka-compr-compression-info-list. 205 ;; signature string recorded in jka-compr-compression-info-list.
119 (set-buffer-multibyte nil) 206 (set-buffer-multibyte nil)
120 (insert data) 207 (setq buffer-undo-list t)
208 (if (stringp data)
209 (insert data)
210 ;; DATA is a MIME-entity object.
211 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data))
212 (body (rmail-mime-entity-body data)))
213 (insert-buffer-substring mbox-buf (car body) (cdr body))
214 (cond ((string= transfer-encoding "base64")
215 (ignore-errors (base64-decode-region (point-min) (point-max))))
216 ((string= transfer-encoding "quoted-printable")
217 (quoted-printable-decode-region (point-min) (point-max))))))
121 (write-region nil nil filename nil nil nil t)))) 218 (write-region nil nil filename nil nil nil t))))
122 219
123(define-button-type 'rmail-mime-save 'action 'rmail-mime-save) 220(define-button-type 'rmail-mime-save 'action 'rmail-mime-save)
@@ -134,6 +231,23 @@ automatically display the image in the buffer."
134 (when (coding-system-p coding-system) 231 (when (coding-system-p coding-system)
135 (decode-coding-region (point-min) (point-max) coding-system)))) 232 (decode-coding-region (point-min) (point-max) coding-system))))
136 233
234(defun rmail-mime-insert-text (entity)
235 "Insert MIME-entity ENTITY as a plain text MIME part in the current buffer."
236 (let* ((content-type (rmail-mime-entity-type entity))
237 (charset (cdr (assq 'charset (cdr content-type))))
238 (coding-system (if charset (intern (downcase charset))))
239 (transfer-encoding (rmail-mime-entity-transfer-encoding entity))
240 (body (rmail-mime-entity-body entity)))
241 (save-restriction
242 (narrow-to-region (point) (point))
243 (insert-buffer-substring rmail-buffer (car body) (cdr body))
244 (cond ((string= transfer-encoding "base64")
245 (ignore-errors (base64-decode-region (point-min) (point-max))))
246 ((string= transfer-encoding "quoted-printable")
247 (quoted-printable-decode-region (point-min) (point-max))))
248 (if (coding-system-p coding-system)
249 (decode-coding-region (point-min) (point-max) coding-system)))))
250
137;; FIXME move to the test/ directory? 251;; FIXME move to the test/ directory?
138(defun test-rmail-mime-handler () 252(defun test-rmail-mime-handler ()
139 "Test of a mail using no MIME parts at all." 253 "Test of a mail using no MIME parts at all."
@@ -152,10 +266,28 @@ MIME-Version: 1.0
152 266
153 267
154(defun rmail-mime-insert-image (type data) 268(defun rmail-mime-insert-image (type data)
155 "Insert an image of type TYPE, where DATA is the image data." 269 "Insert an image of type TYPE, where DATA is the image data.
270If DATA is not a string, it is a MIME-entity object."
156 (end-of-line) 271 (end-of-line)
157 (insert ?\n) 272 (let ((modified (buffer-modified-p)))
158 (insert-image (create-image data type t))) 273 (insert ?\n)
274 (unless (stringp data)
275 ;; DATA is a MIME-entity.
276 (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data))
277 (body (rmail-mime-entity-body data))
278 (mbox-buffer rmail-view-buffer))
279 (with-temp-buffer
280 (set-buffer-multibyte nil)
281 (setq buffer-undo-list t)
282 (insert-buffer-substring mbox-buffer (car body) (cdr body))
283 (cond ((string= transfer-encoding "base64")
284 (ignore-errors (base64-decode-region (point-min) (point-max))))
285 ((string= transfer-encoding "quoted-printable")
286 (quoted-printable-decode-region (point-min) (point-max))))
287 (setq data
288 (buffer-substring-no-properties (point-min) (point-max))))))
289 (insert-image (create-image data type t))
290 (set-buffer-modified-p modified)))
159 291
160(defun rmail-mime-image (button) 292(defun rmail-mime-image (button)
161 "Display the image associated with BUTTON." 293 "Display the image associated with BUTTON."
@@ -172,8 +304,19 @@ MIME-Version: 1.0
172 "Handle the current buffer as an attachment to download. 304 "Handle the current buffer as an attachment to download.
173For images that Emacs is capable of displaying, the behavior 305For images that Emacs is capable of displaying, the behavior
174depends upon the value of `rmail-mime-show-images'." 306depends upon the value of `rmail-mime-show-images'."
307 (rmail-mime-insert-bulk
308 (rmail-mime-entity content-type content-disposition content-transfer-encoding
309 nil nil nil)))
310
311(defun rmail-mime-insert-bulk (entity)
312 "Inesrt a MIME-entity ENTITY as an attachment.
313The optional second arg DATA, if non-nil, is a string containing
314the attachment data that is already decoded."
175 ;; Find the default directory for this media type. 315 ;; Find the default directory for this media type.
176 (let* ((directory (catch 'directory 316 (let* ((content-type (rmail-mime-entity-type entity))
317 (content-disposition (rmail-mime-entity-disposition entity))
318 (body (rmail-mime-entity-body entity))
319 (directory (catch 'directory
177 (dolist (entry rmail-mime-attachment-dirs-alist) 320 (dolist (entry rmail-mime-attachment-dirs-alist)
178 (when (string-match (car entry) (car content-type)) 321 (when (string-match (car entry) (car content-type))
179 (dolist (dir (cdr entry)) 322 (dolist (dir (cdr entry))
@@ -183,17 +326,21 @@ depends upon the value of `rmail-mime-show-images'."
183 (cdr (assq 'filename (cdr content-disposition))) 326 (cdr (assq 'filename (cdr content-disposition)))
184 "noname")) 327 "noname"))
185 (label (format "\nAttached %s file: " (car content-type))) 328 (label (format "\nAttached %s file: " (car content-type)))
186 (data (buffer-string))
187 (udata (string-as-unibyte data))
188 (size (length udata))
189 (osize size)
190 (units '(B kB MB GB)) 329 (units '(B kB MB GB))
191 type) 330 data udata size osize type)
192 (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message 331 (if body
332 (setq data entity
333 udata entity
334 size (- (cdr body) (car body)))
335 (setq data (buffer-string)
336 udata (string-as-unibyte data)
337 size (length udata))
338 (delete-region (point-min) (point-max)))
339 (setq osize size)
340 (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message
193 (cdr units)) 341 (cdr units))
194 (setq size (/ size 1024.0) 342 (setq size (/ size 1024.0)
195 units (cdr units))) 343 units (cdr units)))
196 (delete-region (point-min) (point-max))
197 (insert label) 344 (insert label)
198 (insert-button filename 345 (insert-button filename
199 :type 'rmail-mime-save 346 :type 'rmail-mime-save
@@ -249,6 +396,22 @@ The current buffer should be narrowed to the body. CONTENT-TYPE,
249CONTENT-DISPOSITION, and CONTENT-TRANSFER-ENCODING are the values 396CONTENT-DISPOSITION, and CONTENT-TRANSFER-ENCODING are the values
250of the respective parsed headers. See `rmail-mime-handle' for their 397of the respective parsed headers. See `rmail-mime-handle' for their
251format." 398format."
399 (rmail-mime-process-multipart
400 content-type content-disposition content-transfer-encoding nil))
401
402(defun rmail-mime-process-multipart (content-type
403 content-disposition
404 content-transfer-encoding
405 parse-only)
406 "Process the current buffer as a multipart MIME body.
407
408If PARSE-ONLY is nil, modify the current buffer directly for showing
409the MIME body and return nil.
410
411Otherwise, just parse the current buffer and return a list of
412MIME-entity objects.
413
414The other arguments are the same as `rmail-mime-multipart-handler'."
252 ;; Some MUAs start boundaries with "--", while it should start 415 ;; Some MUAs start boundaries with "--", while it should start
253 ;; with "CRLF--", as defined by RFC 2046: 416 ;; with "CRLF--", as defined by RFC 2046:
254 ;; The boundary delimiter MUST occur at the beginning of a line, 417 ;; The boundary delimiter MUST occur at the beginning of a line,
@@ -257,7 +420,7 @@ format."
257 ;; of the preceding part. 420 ;; of the preceding part.
258 ;; We currently don't handle that. 421 ;; We currently don't handle that.
259 (let ((boundary (cdr (assq 'boundary content-type))) 422 (let ((boundary (cdr (assq 'boundary content-type)))
260 beg end next) 423 beg end next entities)
261 (unless boundary 424 (unless boundary
262 (rmail-mm-get-boundary-error-message 425 (rmail-mm-get-boundary-error-message
263 "No boundary defined" content-type content-disposition 426 "No boundary defined" content-type content-disposition
@@ -267,7 +430,9 @@ format."
267 (goto-char (point-min)) 430 (goto-char (point-min))
268 (when (and (search-forward boundary nil t) 431 (when (and (search-forward boundary nil t)
269 (looking-at "[ \t]*\n")) 432 (looking-at "[ \t]*\n"))
270 (delete-region (point-min) (match-end 0))) 433 (if parse-only
434 (narrow-to-region (match-end 0) (point-max))
435 (delete-region (point-min) (match-end 0))))
271 ;; Loop over all body parts, where beg points at the beginning of 436 ;; Loop over all body parts, where beg points at the beginning of
272 ;; the part and end points at the end of the part. next points at 437 ;; the part and end points at the end of the part. next points at
273 ;; the beginning of the next part. 438 ;; the beginning of the next part.
@@ -285,13 +450,17 @@ format."
285 (rmail-mm-get-boundary-error-message 450 (rmail-mm-get-boundary-error-message
286 "Malformed boundary" content-type content-disposition 451 "Malformed boundary" content-type content-disposition
287 content-transfer-encoding))) 452 content-transfer-encoding)))
288 (delete-region end next)
289 ;; Handle the part. 453 ;; Handle the part.
290 (save-restriction 454 (if parse-only
291 (narrow-to-region beg end) 455 (save-restriction
292 (rmail-mime-show)) 456 (narrow-to-region beg end)
293 (goto-char (setq beg next))))) 457 (setq entities (cons (rmail-mime-process nil t) entities)))
294 458 (delete-region end next)
459 (save-restriction
460 (narrow-to-region beg end)
461 (rmail-mime-show)))
462 (goto-char (setq beg next)))
463 (nreverse entities)))
295 464
296(defun test-rmail-mime-multipart-handler () 465(defun test-rmail-mime-multipart-handler ()
297 "Test of a mail used as an example in RFC 2046." 466 "Test of a mail used as an example in RFC 2046."
@@ -394,6 +563,9 @@ called recursively if multiple parts are available.
394 563
395The current buffer must contain a single message. It will be 564The current buffer must contain a single message. It will be
396modified." 565modified."
566 (rmail-mime-process show-headers nil))
567
568(defun rmail-mime-process (show-headers parse-only)
397 (let ((end (point-min)) 569 (let ((end (point-min))
398 content-type 570 content-type
399 content-transfer-encoding 571 content-transfer-encoding
@@ -437,14 +609,105 @@ modified."
437 ;; attachment according to RFC 2183. 609 ;; attachment according to RFC 2183.
438 (unless (member (car content-disposition) '("inline" "attachment")) 610 (unless (member (car content-disposition) '("inline" "attachment"))
439 (setq content-disposition '("attachment"))) 611 (setq content-disposition '("attachment")))
440 ;; Hide headers and handle the part. 612
441 (save-restriction 613 (if parse-only
442 (cond ((string= (car content-type) "message/rfc822") 614 (cond ((string-match "multipart/.*" (car content-type))
443 (narrow-to-region end (point-max))) 615 (setq end (1- end))
444 ((not show-headers) 616 (save-restriction
445 (delete-region (point-min) end))) 617 (let ((header (if show-headers (cons (point-min) end))))
446 (rmail-mime-handle content-type content-disposition 618 (narrow-to-region end (point-max))
447 content-transfer-encoding)))) 619 (rmail-mime-entity content-type
620 content-disposition
621 content-transfer-encoding
622 header nil
623 (rmail-mime-process-multipart
624 content-type content-disposition
625 content-transfer-encoding t)))))
626 ((string-match "message/rfc822" (car content-type))
627 (or show-headers
628 (narrow-to-region end (point-max)))
629 (rmail-mime-process t t))
630 (t
631 (rmail-mime-entity content-type
632 content-disposition
633 content-transfer-encoding
634 nil
635 (cons end (point-max))
636 nil)))
637 ;; Hide headers and handle the part.
638 (save-restriction
639 (cond ((string= (car content-type) "message/rfc822")
640 (narrow-to-region end (point-max)))
641 ((not show-headers)
642 (delete-region (point-min) end)))
643 (rmail-mime-handle content-type content-disposition
644 content-transfer-encoding)))))
645
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 ()
690 "Parse the current Rmail message as a MIME message.
691The value is a MIME-entiy object (see `rmail-mime-enty-new')."
692 (save-excursion
693 (goto-char (point-min))
694 (rmail-mime-process nil t)))
695
696(defun rmail-mime-insert (entity &optional content-type disposition)
697 "Insert a MIME-entity ENTITY in the current buffer.
698
699This function will be called recursively if multiple parts are
700available."
701 (if (rmail-mime-entity-children entity)
702 (rmail-mime-insert-multipart entity)
703 (setq content-type
704 (or (rmail-mime-entity-type entity) content-type))
705 (setq disposition
706 (or (rmail-mime-entity-disposition entity) disposition))
707 (if (and (string= (car disposition) "inline")
708 (string-match "text/.*" (car content-type)))
709 (rmail-mime-insert-text entity)
710 (rmail-mime-insert-bulk entity))))
448 711
449(define-derived-mode rmail-mime-mode fundamental-mode "RMIME" 712(define-derived-mode rmail-mime-mode fundamental-mode "RMIME"
450 "Major mode used in `rmail-mime' buffers." 713 "Major mode used in `rmail-mime' buffers."
@@ -480,6 +743,50 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
480 (error "%s; type: %s; disposition: %s; encoding: %s" 743 (error "%s; type: %s; disposition: %s; encoding: %s"
481 message type disposition encoding)) 744 message type disposition encoding))
482 745
746(defun rmail-show-mime ()
747 (let ((mbox-buf rmail-buffer))
748 (condition-case nil
749 (let ((entity (rmail-mime-parse)))
750 (with-current-buffer rmail-view-buffer
751 (let ((inhibit-read-only t)
752 (rmail-buffer mbox-buf))
753 (erase-buffer)
754 (rmail-mime-insert entity))))
755 (error
756 ;; Decoding failed. Insert the original message body as is.
757 (let ((region (with-current-buffer mbox-buf
758 (goto-char (point-min))
759 (re-search-forward "^$" nil t)
760 (forward-line 1)
761 (cons (point) (point-max)))))
762 (with-current-buffer rmail-view-buffer
763 (let ((inhibit-read-only t))
764 (erase-buffer)
765 (insert-buffer-substring mbox-buf (car region) (cdr region))))
766 (message "MIME decoding failed"))))))
767
768(setq rmail-show-mime-function 'rmail-show-mime)
769
770(defun rmail-insert-mime-forwarded-message (forward-buffer)
771 (let ((mbox-buf (with-current-buffer forward-buffer rmail-view-buffer)))
772 (save-restriction
773 (narrow-to-region (point) (point))
774 (message-forward-make-body-mime mbox-buf))))
775
776(setq rmail-insert-mime-forwarded-message-function
777 'rmail-insert-mime-forwarded-message)
778
779(defun rmail-insert-mime-resent-message (forward-buffer)
780 (insert-buffer-substring
781 (with-current-buffer forward-buffer rmail-view-buffer))
782 (goto-char (point-min))
783 (when (looking-at "From ")
784 (forward-line 1)
785 (delete-region (point-min) (point))))
786
787(setq rmail-insert-mime-resent-message-function
788 'rmail-insert-mime-resent-message)
789
483(provide 'rmailmm) 790(provide 'rmailmm)
484 791
485;; Local Variables: 792;; Local Variables:
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 0b8abbca6a5..f1efb33e6cb 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -32,6 +32,7 @@
32 32
33;; For rmail-select-summary. 33;; For rmail-select-summary.
34(require 'rmail) 34(require 'rmail)
35(require 'rfc2047)
35 36
36(defcustom rmail-summary-scroll-between-messages t 37(defcustom rmail-summary-scroll-between-messages t
37 "Non-nil means Rmail summary scroll commands move between messages. 38 "Non-nil means Rmail summary scroll commands move between messages.
@@ -364,13 +365,15 @@ The current buffer contains the unrestricted message collection."
364 (aset rmail-summary-vector (1- msgnum) line)) 365 (aset rmail-summary-vector (1- msgnum) line))
365 line)) 366 line))
366 367
367(defcustom rmail-summary-line-decoder (function identity) 368(defcustom rmail-summary-line-decoder (function rfc2047-decode-string)
368 "Function to decode a Rmail summary line. 369 "Function to decode a Rmail summary line.
369It receives the summary line for one message as a string 370It receives the summary line for one message as a string
370and should return the decoded string. 371and should return the decoded string.
371 372
372By default, it is `identity', which returns the string unaltered." 373By default, it is `rfc2047-decode-string', which decodes MIME-encoded
374subject."
373 :type 'function 375 :type 'function
376 :version "23.3"
374 :group 'rmail-summary) 377 :group 'rmail-summary)
375 378
376(defun rmail-create-summary-line (msgnum) 379(defun rmail-create-summary-line (msgnum)
@@ -589,10 +592,17 @@ the message being processed."
589 (t (- mch 14)))) 592 (t (- mch 14))))
590 (min len (+ lo 25))))))))) 593 (min len (+ lo 25)))))))))
591 (concat (if (re-search-forward "^Subject:" nil t) 594 (concat (if (re-search-forward "^Subject:" nil t)
592 (progn (skip-chars-forward " \t") 595 (let (pos str)
593 (buffer-substring (point) 596 (skip-chars-forward " \t")
594 (progn (end-of-line) 597 (setq pos (point))
595 (point)))) 598 (forward-line 1)
599 (setq str (buffer-substring pos (1- (point))))
600 (while (looking-at "\\s ")
601 (setq str (concat str " "
602 (buffer-substring (match-end 0)
603 (line-end-position))))
604 (forward-line 1))
605 str)
596 (re-search-forward "[\n][\n]+" nil t) 606 (re-search-forward "[\n][\n]+" nil t)
597 (buffer-substring (point) (progn (end-of-line) (point)))) 607 (buffer-substring (point) (progn (end-of-line) (point))))
598 "\n"))) 608 "\n")))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 10b3c7bd04c..789677ce643 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -331,9 +331,9 @@ empty string for the user name.
331 331
332See `tramp-methods' for a list of possibilities for METHOD." 332See `tramp-methods' for a list of possibilities for METHOD."
333 :group 'tramp 333 :group 'tramp
334 :type '(repeat (list (regexp :tag "Host regexp") 334 :type '(repeat (list (choice :tag "Host regexp" regexp sexp)
335 (regexp :tag "User regexp") 335 (choice :tag "User regexp" regexp sexp)
336 (string :tag "Method")))) 336 (choice :tag "Method name" string (const nil)))))
337 337
338(defcustom tramp-default-user nil 338(defcustom tramp-default-user nil
339 "*Default user to use for transferring files. 339 "*Default user to use for transferring files.
@@ -355,9 +355,9 @@ matches, the variable `tramp-default-user' takes effect.
355If the file name does not specify the method, lookup is done using the 355If the file name does not specify the method, lookup is done using the
356empty string for the method name." 356empty string for the method name."
357 :group 'tramp 357 :group 'tramp
358 :type '(repeat (list (regexp :tag "Method regexp") 358 :type '(repeat (list (choice :tag "Method regexp" regexp sexp)
359 (regexp :tag "Host regexp") 359 (choice :tag " Host regexp" regexp sexp)
360 (string :tag "User")))) 360 (choice :tag " User name" string (const nil)))))
361 361
362(defcustom tramp-default-host (system-name) 362(defcustom tramp-default-host (system-name)
363 "*Default host to use for transferring files. 363 "*Default host to use for transferring files.
@@ -382,7 +382,7 @@ interpreted as a regular expression which always matches."
382 :group 'tramp 382 :group 'tramp
383 :type '(repeat (list (choice :tag "Host regexp" regexp sexp) 383 :type '(repeat (list (choice :tag "Host regexp" regexp sexp)
384 (choice :tag "User regexp" regexp sexp) 384 (choice :tag "User regexp" regexp sexp)
385 (choice :tag "Proxy remote name" string (const nil))))) 385 (choice :tag " Proxy name" string (const nil)))))
386 386
387(defconst tramp-local-host-regexp 387(defconst tramp-local-host-regexp
388 (concat 388 (concat
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 9fe57beec30..0a641d0945f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1462,6 +1462,16 @@ Default ignores all inputs of 0, 1, or 2 non-blank characters."
1462 :type 'regexp 1462 :type 'regexp
1463 :group 'python) 1463 :group 'python)
1464 1464
1465(defcustom python-remove-cwd-from-path t
1466 "Whether to allow loading of Python modules from the current directory.
1467If this is non-nil, Emacs removes '' from sys.path when starting
1468an inferior Python process. This is the default, for security
1469reasons, as it is easy for the Python process to be started
1470without the user's realization (e.g. to perform completion)."
1471 :type 'boolean
1472 :group 'python
1473 :version "23.3")
1474
1465(defun python-input-filter (str) 1475(defun python-input-filter (str)
1466 "`comint-input-filter' function for inferior Python. 1476 "`comint-input-filter' function for inferior Python.
1467Don't save anything for STR matching `inferior-python-filter-regexp'." 1477Don't save anything for STR matching `inferior-python-filter-regexp'."
@@ -1559,20 +1569,24 @@ print version_info >= (2, 2) and version_info < (3, 0)\""))))
1559;;;###autoload 1569;;;###autoload
1560(defun run-python (&optional cmd noshow new) 1570(defun run-python (&optional cmd noshow new)
1561 "Run an inferior Python process, input and output via buffer *Python*. 1571 "Run an inferior Python process, input and output via buffer *Python*.
1562CMD is the Python command to run. NOSHOW non-nil means don't show the 1572CMD is the Python command to run. NOSHOW non-nil means don't
1563buffer automatically. 1573show the buffer automatically.
1564 1574
1565Normally, if there is a process already running in `python-buffer', 1575Interactively, a prefix arg means to prompt for the initial
1566switch to that buffer. Interactively, a prefix arg allows you to edit 1576Python command line (default is `python-command').
1567the initial command line (default is `python-command'); `-i' etc. args 1577
1568will be added to this as appropriate. A new process is started if: 1578A new process is started if one isn't running attached to
1569one isn't running attached to `python-buffer', or interactively the 1579`python-buffer', or if called from Lisp with non-nil arg NEW.
1570default `python-command', or argument NEW is non-nil. See also the 1580Otherwise, if a process is already running in `python-buffer',
1571documentation for `python-buffer'. 1581switch to that buffer.
1572 1582
1573Runs the hook `inferior-python-mode-hook' \(after the 1583This command runs the hook `inferior-python-mode-hook' after
1574`comint-mode-hook' is run). \(Type \\[describe-mode] in the process 1584running `comint-mode-hook'. Type \\[describe-mode] in the
1575buffer for a list of commands.)" 1585process buffer for a list of commands.
1586
1587By default, Emacs inhibits the loading of Python modules from the
1588current working directory, for security reasons. To disable this
1589behavior, change `python-remove-cwd-from-path' to nil."
1576 (interactive (if current-prefix-arg 1590 (interactive (if current-prefix-arg
1577 (list (read-string "Run Python: " python-command) nil t) 1591 (list (read-string "Run Python: " python-command) nil t)
1578 (list python-command))) 1592 (list python-command)))
@@ -1586,13 +1600,9 @@ buffer for a list of commands.)"
1586 (when (or new (not (comint-check-proc python-buffer))) 1600 (when (or new (not (comint-check-proc python-buffer)))
1587 (with-current-buffer 1601 (with-current-buffer
1588 (let* ((cmdlist 1602 (let* ((cmdlist
1589 (append (python-args-to-list cmd) 1603 (append (python-args-to-list cmd) '("-i")
1590 ;; It's easy for the user to cause the process to be 1604 (if python-remove-cwd-from-path
1591 ;; started without realizing it (e.g. to perform 1605 '("-c" "import sys; sys.path.remove('')"))))
1592 ;; completion); for this reason loading files from the
1593 ;; current directory is a security risk. See
1594 ;; http://article.gmane.org/gmane.emacs.devel/103569
1595 '("-i" "-c" "import sys; sys.path.remove('')")))
1596 (path (getenv "PYTHONPATH")) 1606 (path (getenv "PYTHONPATH"))
1597 (process-environment ; to import emacs.py 1607 (process-environment ; to import emacs.py
1598 (cons (concat "PYTHONPATH=" 1608 (cons (concat "PYTHONPATH="
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 469786e04dd..049d708d191 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -154,7 +154,7 @@ mouse-3: go to end")
154 :type 'sexp) 154 :type 'sexp)
155;;;###autoload (put 'which-func-format 'risky-local-variable t) 155;;;###autoload (put 'which-func-format 'risky-local-variable t)
156 156
157(defvar which-func-imenu-joiner-function #'last 157(defvar which-func-imenu-joiner-function (lambda (x) (car (last x)))
158 "Function to join together multiple levels of imenu nomenclature. 158 "Function to join together multiple levels of imenu nomenclature.
159Called with a single argument, a list of strings giving the names 159Called with a single argument, a list of strings giving the names
160of the menus we had to traverse to get to the item. Returns a 160of the menus we had to traverse to get to the item. Returns a
@@ -242,6 +242,9 @@ continuously displayed in the mode line, in certain major modes.
242With prefix ARG, turn Which Function mode on if arg is positive, 242With prefix ARG, turn Which Function mode on if arg is positive,
243and off otherwise." 243and off otherwise."
244 :global t :group 'which-func 244 :global t :group 'which-func
245 (when (timerp which-func-update-timer)
246 (cancel-timer which-func-update-timer))
247 (setq which-func-update-timer nil)
245 (if which-function-mode 248 (if which-function-mode
246 ;;Turn it on 249 ;;Turn it on
247 (progn 250 (progn
@@ -253,9 +256,6 @@ and off otherwise."
253 (or (eq which-func-modes t) 256 (or (eq which-func-modes t)
254 (member major-mode which-func-modes)))))) 257 (member major-mode which-func-modes))))))
255 ;; Turn it off 258 ;; Turn it off
256 (when (timerp which-func-update-timer)
257 (cancel-timer which-func-update-timer))
258 (setq which-func-update-timer nil)
259 (dolist (buf (buffer-list)) 259 (dolist (buf (buffer-list))
260 (with-current-buffer buf (setq which-func-mode nil))))) 260 (with-current-buffer buf (setq which-func-mode nil)))))
261 261
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index c0aa595d968..2bce58f50f2 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -350,17 +350,16 @@ automatically."
350(defvar log-edit-font-lock-keywords 350(defvar log-edit-font-lock-keywords
351 ;; Copied/inspired by message-font-lock-keywords. 351 ;; Copied/inspired by message-font-lock-keywords.
352 `((log-edit-match-to-eoh 352 `((log-edit-match-to-eoh
353 (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp 353 (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp)
354 "\\|\\(.*\\)")
355 (progn (goto-char (match-beginning 0)) (match-end 0)) nil 354 (progn (goto-char (match-beginning 0)) (match-end 0)) nil
356 (1 (if (assoc (match-string 2) log-edit-headers-alist) 355 (1 (if (assoc (match-string 2) log-edit-headers-alist)
357 'log-edit-header 356 'log-edit-header
358 'log-edit-unknown-header) 357 'log-edit-unknown-header)
359 nil lax) 358 nil lax)
359 ;; From `log-edit-header-contents-regexp':
360 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) 360 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist))
361 'log-edit-header) 361 'log-edit-header)
362 nil lax) 362 nil lax)))))
363 (4 font-lock-warning-face)))))
364 363
365;;;###autoload 364;;;###autoload
366(defun log-edit (callback &optional setup params buffer mode &rest ignore) 365(defun log-edit (callback &optional setup params buffer mode &rest ignore)