aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKenichi Handa2010-05-14 12:52:21 +0900
committerKenichi Handa2010-05-14 12:52:21 +0900
commit508197067c434b0111bcb6ded742d424bb738ece (patch)
tree8771c78dae5018afa802675f0f798251d492ba31 /lisp
parent0e5d78007c37e98a5682a5d4c18966cdf6063c0b (diff)
parentfbc00890119ec27ceaf50a0969ee121bef22905a (diff)
downloademacs-508197067c434b0111bcb6ded742d424bb738ece.tar.gz
emacs-508197067c434b0111bcb6ded742d424bb738ece.zip
merge trunk
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog45
-rw-r--r--lisp/dos-fns.el39
-rw-r--r--lisp/gnus/ChangeLog22
-rw-r--r--lisp/gnus/gnus-art.el6
-rw-r--r--lisp/gnus/gnus-sum.el1
-rw-r--r--lisp/gnus/message.el4
-rw-r--r--lisp/gnus/mml1991.el2
-rw-r--r--lisp/gnus/mml2015.el1
-rw-r--r--lisp/net/tramp-smb.el270
-rw-r--r--lisp/net/tramp.el242
-rw-r--r--lisp/progmodes/cc-cmds.el10
-rw-r--r--lisp/progmodes/sh-script.el10
-rw-r--r--lisp/textmodes/ispell.el17
-rw-r--r--lisp/textmodes/sgml-mode.el5
-rw-r--r--lisp/textmodes/tex-mode.el5
15 files changed, 386 insertions, 293 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0cbf007771..484ae6529c3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,48 @@
12010-05-13 Chong Yidong <cyd@stupidchicken.com>
2
3 Add TeX open-block and close-block keybindings to SGML, and vice
4 versa.
5
6 * textmodes/tex-mode.el (tex-mode-map): Bind C-c C-t to
7 latex-open-block and C-c / to latex-close-block.
8
9 * textmodes/sgml-mode.el (sgml-mode-map): Bind C-c C-o to sgml-tag
10 and C-c C-e to sgml-close-tag.
11
122010-05-13 Michael Albinus <michael.albinus@gmx.de>
13
14 * net/tramp.el (with-progress-reporter): Create reporter object
15 only when the message would be displayed. Handled nested calls.
16 (tramp-handle-load, tramp-handle-file-local-copy)
17 (tramp-handle-insert-file-contents, tramp-handle-write-region)
18 (tramp-maybe-send-script, tramp-find-shell): Use
19 `with-progress-reporter'.
20 (tramp-handle-dired-compress-file, tramp-maybe-open-connection):
21 Fix message text.
22
23 * net/tramp-smb.el (tramp-smb-handle-copy-file)
24 (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
25 (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection):
26 Use `with-progress-reporter'.
27
282010-05-13 Agustín Martín <agustin.martin@hispalinux.es>
29
30 * ispell.el (ispell-init-process): Do not kill ispell process
31 everytime when spellchecking from the minibuffer (bug#6143).
32
332010-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
34
35 * progmodes/sh-script.el (sh-mode): Use define-derived-mode.
36
37 * dos-fns.el: Add "dos-" prefix for namespace control.
38 (convert-standard-filename): Define as alias for
39 dos-convert-standard-filename but only if applicable.
40
412010-05-12 Alan Mackenzie <acm@muc.de>
42
43 * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun):
44 Push the mark at the start of these functions when appropriate.
45
12010-05-12 Stefan Monnier <monnier@iro.umontreal.ca> 462010-05-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 47
3 * minibuffer.el (completion-cycle-threshold): New custom var. 48 * minibuffer.el (completion-cycle-threshold): New custom var.
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index c1c2517bc22..5834afae8bc 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -31,7 +31,7 @@
31(declare-function msdos-long-file-names "msdos.c") 31(declare-function msdos-long-file-names "msdos.c")
32 32
33;; This overrides a trivial definition in files.el. 33;; This overrides a trivial definition in files.el.
34(defun convert-standard-filename (filename) 34(defun dos-convert-standard-filename (filename)
35 "Convert a standard file's name to something suitable for the current OS. 35 "Convert a standard file's name to something suitable for the current OS.
36This means to guarantee valid names and perhaps to canonicalize 36This means to guarantee valid names and perhaps to canonicalize
37certain patterns. 37certain patterns.
@@ -48,7 +48,7 @@ shell requires it (see `w32-shell-dos-semantics')."
48 (let ((flen (length filename))) 48 (let ((flen (length filename)))
49 ;; If FILENAME has a trailing slash, remove it and recurse. 49 ;; If FILENAME has a trailing slash, remove it and recurse.
50 (if (memq (aref filename (1- flen)) '(?/ ?\\)) 50 (if (memq (aref filename (1- flen)) '(?/ ?\\))
51 (concat (convert-standard-filename 51 (concat (dos-convert-standard-filename
52 (substring filename 0 (1- flen))) 52 (substring filename 0 (1- flen)))
53 "/") 53 "/")
54 (let* (;; ange-ftp gets in the way for names like "/foo:bar". 54 (let* (;; ange-ftp gets in the way for names like "/foo:bar".
@@ -122,12 +122,17 @@ shell requires it (see `w32-shell-dos-semantics')."
122 (aset string (1- (length string)) lastchar)))) 122 (aset string (1- (length string)) lastchar))))
123 (concat (if (and (stringp dir) 123 (concat (if (and (stringp dir)
124 (memq (aref dir dlen-m-1) '(?/ ?\\))) 124 (memq (aref dir dlen-m-1) '(?/ ?\\)))
125 (concat (convert-standard-filename 125 (concat (dos-convert-standard-filename
126 (substring dir 0 dlen-m-1)) 126 (substring dir 0 dlen-m-1))
127 "/") 127 "/")
128 (convert-standard-filename dir)) 128 (dos-convert-standard-filename dir))
129 string)))))) 129 string))))))
130 130
131;; Only redirect convert-standard-filename if it has a chance of working,
132;; otherwise loading dos-fns.el might make your non-DOS Emacs misbehave.
133(when (fboundp 'msdos-long-file-names)
134 (defalias 'convert-standard-filename 'dos-convert-standard-filename))
135
131(defun dos-8+3-filename (filename) 136(defun dos-8+3-filename (filename)
132 "Truncate FILENAME to DOS 8+3 limits." 137 "Truncate FILENAME to DOS 8+3 limits."
133 (if (or (not (stringp filename)) 138 (if (or (not (stringp filename))
@@ -188,12 +193,12 @@ shell requires it (see `w32-shell-dos-semantics')."
188 193
189;; This is for the sake of standard file names elsewhere in Emacs that 194;; This is for the sake of standard file names elsewhere in Emacs that
190;; are defined as constant strings or via defconst, and whose 195;; are defined as constant strings or via defconst, and whose
191;; conversion via `convert-standard-filename' does not give good 196;; conversion via `dos-convert-standard-filename' does not give good
192;; enough results. 197;; enough results.
193(defun dosified-file-name (file-name) 198(defun dosified-file-name (file-name)
194 "Return a variant of FILE-NAME that is valid on MS-DOS filesystems. 199 "Return a variant of FILE-NAME that is valid on MS-DOS filesystems.
195 200
196This function is for those rare cases where `convert-standard-filename' 201This function is for those rare cases where `dos-convert-standard-filename'
197does not do a job that is good enough, e.g. if you need to preserve the 202does not do a job that is good enough, e.g. if you need to preserve the
198file-name extension. It recognizes only certain specific file names 203file-name extension. It recognizes only certain specific file names
199that are used in Emacs Lisp sources; any other file name will be 204that are used in Emacs Lisp sources; any other file name will be
@@ -209,13 +214,13 @@ returned unaltered."
209(defvar msdos-shells) 214(defvar msdos-shells)
210 215
211;; Override settings chosen at startup. 216;; Override settings chosen at startup.
212(defun set-default-process-coding-system () 217(defun dos-set-default-process-coding-system ()
213 (setq default-process-coding-system 218 (setq default-process-coding-system
214 (if (default-value 'enable-multibyte-characters) 219 (if (default-value 'enable-multibyte-characters)
215 '(undecided-dos . undecided-dos) 220 '(undecided-dos . undecided-dos)
216 '(raw-text-dos . raw-text-dos)))) 221 '(raw-text-dos . raw-text-dos))))
217 222
218(add-hook 'before-init-hook 'set-default-process-coding-system) 223(add-hook 'before-init-hook 'dos-set-default-process-coding-system)
219 224
220;; File names defined in preloaded packages can be incorrect or 225;; File names defined in preloaded packages can be incorrect or
221;; invalid if long file names were available during dumping, but not 226;; invalid if long file names were available during dumping, but not
@@ -232,17 +237,17 @@ returned unaltered."
232 237
233(add-hook 'before-init-hook 'dos-reevaluate-defcustoms) 238(add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
234 239
235(defvar register-name-alist 240(defvar dos-register-name-alist
236 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5) 241 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
237 (cflag . 6) (flags . 7) 242 (cflag . 6) (flags . 7)
238 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0)) 243 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
239 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1)))) 244 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
240 245
241(defun make-register () 246(defun dos-make-register ()
242 (make-vector 8 0)) 247 (make-vector 8 0))
243 248
244(defun register-value (regs name) 249(defun dos-register-value (regs name)
245 (let ((where (cdr (assoc name register-name-alist)))) 250 (let ((where (cdr (assoc name dos-register-name-alist))))
246 (cond ((consp where) 251 (cond ((consp where)
247 (let ((tem (aref regs (car where)))) 252 (let ((tem (aref regs (car where))))
248 (if (zerop (cdr where)) 253 (if (zerop (cdr where))
@@ -252,10 +257,10 @@ returned unaltered."
252 (aref regs where)) 257 (aref regs where))
253 (t nil)))) 258 (t nil))))
254 259
255(defun set-register-value (regs name value) 260(defun dos-set-register-value (regs name value)
256 (and (numberp value) 261 (and (numberp value)
257 (>= value 0) 262 (>= value 0)
258 (let ((where (cdr (assoc name register-name-alist)))) 263 (let ((where (cdr (assoc name dos-register-name-alist))))
259 (cond ((consp where) 264 (cond ((consp where)
260 (let ((tem (aref regs (car where))) 265 (let ((tem (aref regs (car where)))
261 (value (logand value 255))) 266 (value (logand value 255)))
@@ -268,18 +273,18 @@ returned unaltered."
268 (aset regs where (logand value 65535)))))) 273 (aset regs where (logand value 65535))))))
269 regs) 274 regs)
270 275
271(defsubst intdos (regs) 276(defsubst dos-intdos (regs)
272 (int86 33 regs)) 277 (int86 33 regs))
273 278
274;; Backward compatibility for obsolescent functions which 279;; Backward compatibility for obsolescent functions which
275;; set screen size. 280;; set screen size.
276 281
277(defun mode25 () 282(defun dos-mode25 ()
278 "Changes the number of screen rows to 25." 283 "Changes the number of screen rows to 25."
279 (interactive) 284 (interactive)
280 (set-frame-size (selected-frame) 80 25)) 285 (set-frame-size (selected-frame) 80 25))
281 286
282(defun mode4350 () 287(defun dos-mode4350 ()
283 "Changes the number of rows to 43 or 50. 288 "Changes the number of rows to 43 or 50.
284Emacs always tries to set the screen height to 50 rows first. 289Emacs always tries to set the screen height to 50 rows first.
285If this fails, it will try to set it to 43 rows, on the assumption 290If this fails, it will try to set it to 43 rows, on the assumption
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 194d2036c3f..0b7eaf7ed72 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,25 @@
12010-05-13 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * mml1991.el (mml1991-mailcrypt-encrypt, mml1991-gpg-encrypt)
4 * mml2015.el (mml2015-gpg-encrypt): Disable multibyte in buffers
5 generated within the mm-with-unibyte-current-buffer macro.
6
72010-05-13 Katsumi Yamaoka <yamaoka@jpl.org>
8
9 * gnus-art.el (gnus-bind-safe-url-regexp): Bind mm-w3m-safe-url-regexp
10 to nil when we're in a mml-preview buffer and no group is selected.
11
122010-05-12 Andreas Seltenreich <seltenreich@gmx.de>
13
14 * gnus-sum.el (gnus-summary-read-group-1): Don't jump to next group
15 when catching the `C-g'. Reported by: "Leo"
16
172010-05-12 Katsumi Yamaoka <yamaoka@jpl.org>
18
19 * message.el (message-forward-make-body-plain)
20 (message-forward-make-body-mml): Use mm-multibyte-string-p instead of
21 multibyte-string-p.
22
12010-05-12 Katsumi Yamaoka <yamaoka@jpl.org> 232010-05-12 Katsumi Yamaoka <yamaoka@jpl.org>
2 24
3 * message.el (message-forward-make-body-mml): Assume original message 25 * message.el (message-forward-make-body-mml): Assume original message
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 5f899b3067a..0659ee893de 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4822,7 +4822,11 @@ General format specifiers can also be used. See Info node
4822 (with-current-buffer gnus-article-current-summary 4822 (with-current-buffer gnus-article-current-summary
4823 gnus-newsgroup-name) 4823 gnus-newsgroup-name)
4824 gnus-newsgroup-name))) 4824 gnus-newsgroup-name)))
4825 (if (cond ((stringp gnus-safe-html-newsgroups) 4825 (if (cond ((not group)
4826 ;; Maybe we're in a mml-preview buffer
4827 ;; and no group is selected.
4828 t)
4829 ((stringp gnus-safe-html-newsgroups)
4826 (string-match gnus-safe-html-newsgroups group)) 4830 (string-match gnus-safe-html-newsgroups group))
4827 ((consp gnus-safe-html-newsgroups) 4831 ((consp gnus-safe-html-newsgroups)
4828 (member group gnus-safe-html-newsgroups))) 4832 (member group gnus-safe-html-newsgroups)))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index a0943493844..3a2c944ed2f 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -3931,7 +3931,6 @@ If NO-DISPLAY, don't generate a summary buffer."
3931 (progn 3931 (progn
3932 (set-buffer gnus-group-buffer) 3932 (set-buffer gnus-group-buffer)
3933 (gnus-group-jump-to-group group) 3933 (gnus-group-jump-to-group group)
3934 (gnus-group-next-unread-group 1)
3935 (gnus-configure-windows 'group 'force)) 3934 (gnus-configure-windows 'group 'force))
3936 (gnus-handle-ephemeral-exit quit-config)) 3935 (gnus-handle-ephemeral-exit quit-config))
3937 ;; Finally signal the quit. 3936 ;; Finally signal the quit.
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 897fe695288..947b1bd53e8 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -7165,7 +7165,7 @@ Optional DIGEST will use digest to forward."
7165 (contents (with-current-buffer forward-buffer (buffer-string))) 7165 (contents (with-current-buffer forward-buffer (buffer-string)))
7166 e) 7166 e)
7167 (unless (featurep 'xemacs) 7167 (unless (featurep 'xemacs)
7168 (unless (multibyte-string-p contents) 7168 (unless (mm-multibyte-string-p contents)
7169 (error "Attempt to insert unibyte string from the buffer \"%s\"\ 7169 (error "Attempt to insert unibyte string from the buffer \"%s\"\
7170 to the multibyte buffer \"%s\"" 7170 to the multibyte buffer \"%s\""
7171 (if (bufferp forward-buffer) 7171 (if (bufferp forward-buffer)
@@ -7220,7 +7220,7 @@ Optional DIGEST will use digest to forward."
7220 (if (not message-forward-decoded-p) 7220 (if (not message-forward-decoded-p)
7221 (let ((contents (with-current-buffer forward-buffer (buffer-string)))) 7221 (let ((contents (with-current-buffer forward-buffer (buffer-string))))
7222 (unless (featurep 'xemacs) 7222 (unless (featurep 'xemacs)
7223 (unless (multibyte-string-p contents) 7223 (unless (mm-multibyte-string-p contents)
7224 (error "Attempt to insert unibyte string from the buffer \"%s\"\ 7224 (error "Attempt to insert unibyte string from the buffer \"%s\"\
7225 to the multibyte buffer \"%s\"" 7225 to the multibyte buffer \"%s\""
7226 (if (bufferp forward-buffer) 7226 (if (bufferp forward-buffer)
diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el
index a3ada29fa66..3ba479574fd 100644
--- a/lisp/gnus/mml1991.el
+++ b/lisp/gnus/mml1991.el
@@ -145,6 +145,7 @@ Whether the passphrase is cached at all is controlled by
145 (delete-region (point-min) (point))) 145 (delete-region (point-min) (point)))
146 (mm-with-unibyte-current-buffer 146 (mm-with-unibyte-current-buffer
147 (with-temp-buffer 147 (with-temp-buffer
148 (inline (mm-disable-multibyte))
148 (setq cipher (current-buffer)) 149 (setq cipher (current-buffer))
149 (insert-buffer-substring text) 150 (insert-buffer-substring text)
150 (unless (mc-encrypt-generic 151 (unless (mc-encrypt-generic
@@ -225,6 +226,7 @@ Whether the passphrase is cached at all is controlled by
225 (delete-region (point-min) (point))) 226 (delete-region (point-min) (point)))
226 (mm-with-unibyte-current-buffer 227 (mm-with-unibyte-current-buffer
227 (with-temp-buffer 228 (with-temp-buffer
229 (inline (mm-disable-multibyte))
228 (flet ((gpg-encrypt-func 230 (flet ((gpg-encrypt-func
229 (sign plaintext ciphertext result recipients &optional 231 (sign plaintext ciphertext result recipients &optional
230 passphrase sign-with-key armor textmode) 232 passphrase sign-with-key armor textmode)
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 130a3ca86a5..977f4dabb67 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -680,6 +680,7 @@ Whether the passphrase is cached at all is controlled by
680 cipher) 680 cipher)
681 (mm-with-unibyte-current-buffer 681 (mm-with-unibyte-current-buffer
682 (with-temp-buffer 682 (with-temp-buffer
683 (mm-disable-multibyte)
683 ;; set up a function to call the correct gpg encrypt routine 684 ;; set up a function to call the correct gpg encrypt routine
684 ;; with the right arguments. (FIXME: this should be done 685 ;; with the right arguments. (FIXME: this should be done
685 ;; differently.) 686 ;; differently.)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 434c2bad20d..00b282b83e3 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -334,41 +334,41 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
334PRESERVE-UID-GID is completely ignored." 334PRESERVE-UID-GID is completely ignored."
335 (setq filename (expand-file-name filename) 335 (setq filename (expand-file-name filename)
336 newname (expand-file-name newname)) 336 newname (expand-file-name newname))
337 (with-progress-reporter
338 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
339 0 (format "Copying %s to %s" filename newname)
340
341 (let ((tmpfile (file-local-copy filename)))
342
343 (if tmpfile
344 ;; Remote filename.
345 (condition-case err
346 (rename-file tmpfile newname ok-if-already-exists)
347 ((error quit)
348 (tramp-compat-delete-file tmpfile 'force)
349 (signal (car err) (cdr err))))
350
351 ;; Remote newname.
352 (when (file-directory-p newname)
353 (setq newname
354 (expand-file-name (file-name-nondirectory filename) newname)))
355
356 (with-parsed-tramp-file-name newname nil
357 (when (and (not ok-if-already-exists)
358 (file-exists-p newname))
359 (tramp-error v 'file-already-exists newname))
337 360
338 (let ((tmpfile (file-local-copy filename))) 361 ;; We must also flush the cache of the directory, because
339 362 ;; `file-attributes' reads the values from there.
340 (if tmpfile 363 (tramp-flush-file-property v (file-name-directory localname))
341 ;; Remote filename. 364 (tramp-flush-file-property v localname)
342 (condition-case err 365 (unless (tramp-smb-get-share v)
343 (rename-file tmpfile newname ok-if-already-exists) 366 (tramp-error
344 ((error quit) 367 v 'file-error "Target `%s' must contain a share name" newname))
345 (tramp-compat-delete-file tmpfile 'force) 368 (unless (tramp-smb-send-command
346 (signal (car err) (cdr err)))) 369 v (format "put \"%s\" \"%s\""
347 370 filename (tramp-smb-get-localname v)))
348 ;; Remote newname. 371 (tramp-error v 'file-error "Cannot copy `%s'" filename))))))
349 (when (file-directory-p newname)
350 (setq newname (expand-file-name
351 (file-name-nondirectory filename) newname)))
352
353 (with-parsed-tramp-file-name newname nil
354 (when (and (not ok-if-already-exists)
355 (file-exists-p newname))
356 (tramp-error v 'file-already-exists newname))
357
358 ;; We must also flush the cache of the directory, because
359 ;; `file-attributes' reads the values from there.
360 (tramp-flush-file-property v (file-name-directory localname))
361 (tramp-flush-file-property v localname)
362 (unless (tramp-smb-get-share v)
363 (tramp-error
364 v 'file-error "Target `%s' must contain a share name" newname))
365 (tramp-message v 0 "Copying file %s to file %s..." filename newname)
366 (if (tramp-smb-send-command
367 v (format "put \"%s\" \"%s\""
368 filename (tramp-smb-get-localname v)))
369 (tramp-message
370 v 0 "Copying file %s to file %s...done" filename newname)
371 (tramp-error v 'file-error "Cannot copy `%s'" filename)))))
372 372
373 ;; KEEP-DATE handling. 373 ;; KEEP-DATE handling.
374 (when keep-date (set-file-times newname (nth 5 (file-attributes filename))))) 374 (when keep-date (set-file-times newname (nth 5 (file-attributes filename)))))
@@ -605,15 +605,15 @@ PRESERVE-UID-GID is completely ignored."
605 v 'file-error 605 v 'file-error
606 "Cannot make local copy of non-existing file `%s'" filename)) 606 "Cannot make local copy of non-existing file `%s'" filename))
607 (let ((tmpfile (tramp-compat-make-temp-file filename))) 607 (let ((tmpfile (tramp-compat-make-temp-file filename)))
608 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) 608 (with-progress-reporter
609 (if (tramp-smb-send-command 609 v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
610 v (format "get \"%s\" \"%s\"" (tramp-smb-get-localname v) tmpfile)) 610 (unless (tramp-smb-send-command
611 (tramp-message 611 v (format "get \"%s\" \"%s\""
612 v 4 "Fetching %s to tmp file %s...done" filename tmpfile) 612 (tramp-smb-get-localname v) tmpfile))
613 ;; Oops, an error. We shall cleanup. 613 ;; Oops, an error. We shall cleanup.
614 (tramp-compat-delete-file tmpfile 'force) 614 (tramp-compat-delete-file tmpfile 'force)
615 (tramp-error 615 (tramp-error
616 v 'file-error "Cannot make local copy of file `%s'" filename)) 616 v 'file-error "Cannot make local copy of file `%s'" filename)))
617 tmpfile))) 617 tmpfile)))
618 618
619;; This function should return "foo/" for directories and "bar" for 619;; This function should return "foo/" for directories and "bar" for
@@ -850,38 +850,39 @@ target of the symlink differ."
850 "Like `rename-file' for Tramp files." 850 "Like `rename-file' for Tramp files."
851 (setq filename (expand-file-name filename) 851 (setq filename (expand-file-name filename)
852 newname (expand-file-name newname)) 852 newname (expand-file-name newname))
853 (with-progress-reporter
854 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
855 0 (format "Renaming %s to %s" filename newname)
856
857 (let ((tmpfile (file-local-copy filename)))
858
859 (if tmpfile
860 ;; Remote filename.
861 (condition-case err
862 (rename-file tmpfile newname ok-if-already-exists)
863 ((error quit)
864 (tramp-compat-delete-file tmpfile 'force)
865 (signal (car err) (cdr err))))
866
867 ;; Remote newname.
868 (when (file-directory-p newname)
869 (setq newname (expand-file-name
870 (file-name-nondirectory filename) newname)))
871
872 (with-parsed-tramp-file-name newname nil
873 (when (and (not ok-if-already-exists)
874 (file-exists-p newname))
875 (tramp-error v 'file-already-exists newname))
876 ;; We must also flush the cache of the directory, because
877 ;; `file-attributes' reads the values from there.
878 (tramp-flush-file-property v (file-name-directory localname))
879 (tramp-flush-file-property v localname)
880 (unless (tramp-smb-send-command
881 v (format "put %s \"%s\""
882 filename (tramp-smb-get-localname v)))
883 (tramp-error v 'file-error "Cannot rename `%s'" filename)))))
853 884
854 (let ((tmpfile (file-local-copy filename))) 885 (tramp-compat-delete-file filename 'force)))
855
856 (if tmpfile
857 ;; Remote filename.
858 (condition-case err
859 (rename-file tmpfile newname ok-if-already-exists)
860 ((error quit)
861 (tramp-compat-delete-file tmpfile 'force)
862 (signal (car err) (cdr err))))
863
864 ;; Remote newname.
865 (when (file-directory-p newname)
866 (setq newname (expand-file-name
867 (file-name-nondirectory filename) newname)))
868
869 (with-parsed-tramp-file-name newname nil
870 (when (and (not ok-if-already-exists)
871 (file-exists-p newname))
872 (tramp-error v 'file-already-exists newname))
873 ;; We must also flush the cache of the directory, because
874 ;; `file-attributes' reads the values from there.
875 (tramp-flush-file-property v (file-name-directory localname))
876 (tramp-flush-file-property v localname)
877 (tramp-message v 0 "Copying file %s to file %s..." filename newname)
878 (if (tramp-smb-send-command
879 v (format "put %s \"%s\"" filename (tramp-smb-get-localname v)))
880 (tramp-message
881 v 0 "Copying file %s to file %s...done" filename newname)
882 (tramp-error v 'file-error "Cannot rename `%s'" filename)))))
883
884 (tramp-compat-delete-file filename 'force))
885 886
886(defun tramp-smb-handle-set-file-modes (filename mode) 887(defun tramp-smb-handle-set-file-modes (filename mode)
887 "Like `set-file-modes' for Tramp files." 888 "Like `set-file-modes' for Tramp files."
@@ -938,14 +939,14 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
938 (list start end tmpfile append 'no-message lockname confirm) 939 (list start end tmpfile append 'no-message lockname confirm)
939 (list start end tmpfile append 'no-message lockname))) 940 (list start end tmpfile append 'no-message lockname)))
940 941
941 (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename) 942 (with-progress-reporter
942 (unwind-protect 943 v 3 (format "Moving tmp file %s to %s" tmpfile filename)
943 (if (tramp-smb-send-command 944 (unwind-protect
944 v (format "put %s \"%s\"" tmpfile (tramp-smb-get-localname v))) 945 (unless (tramp-smb-send-command
945 (tramp-message 946 v (format "put %s \"%s\""
946 v 5 "Writing tmp file %s to file %s...done" tmpfile filename) 947 tmpfile (tramp-smb-get-localname v)))
947 (tramp-error v 'file-error "Cannot write `%s'" filename)) 948 (tramp-error v 'file-error "Cannot write `%s'" filename))
948 (tramp-compat-delete-file tmpfile 'force)) 949 (tramp-compat-delete-file tmpfile 'force)))
949 950
950 (unless (equal curbuf (current-buffer)) 951 (unless (equal curbuf (current-buffer))
951 (tramp-error 952 (tramp-error
@@ -1302,60 +1303,57 @@ connection if a previous connection has died for some reason."
1302 (setq args (append args (list "-s" tramp-smb-conf)))) 1303 (setq args (append args (list "-s" tramp-smb-conf))))
1303 1304
1304 ;; OK, let's go. 1305 ;; OK, let's go.
1305 (tramp-message 1306 (with-progress-reporter
1306 vec 3 "Opening connection for //%s%s/%s..." 1307 vec 3
1307 (if (not (zerop (length user))) (concat user "@") "") 1308 (format "Opening connection for //%s%s/%s"
1308 host (or share "")) 1309 (if (not (zerop (length user))) (concat user "@") "")
1309 1310 host (or share ""))
1310 (let* ((coding-system-for-read nil) 1311
1311 (process-connection-type tramp-process-connection-type) 1312 (let* ((coding-system-for-read nil)
1312 (p (let ((default-directory 1313 (process-connection-type tramp-process-connection-type)
1313 (tramp-compat-temporary-file-directory))) 1314 (p (let ((default-directory
1314 (apply #'start-process 1315 (tramp-compat-temporary-file-directory)))
1315 (tramp-buffer-name vec) (tramp-get-buffer vec) 1316 (apply #'start-process
1316 tramp-smb-program args)))) 1317 (tramp-buffer-name vec) (tramp-get-buffer vec)
1317 1318 tramp-smb-program args))))
1318 (tramp-message 1319
1319 vec 6 "%s" (mapconcat 'identity (process-command p) " ")) 1320 (tramp-message
1320 (tramp-set-process-query-on-exit-flag p nil) 1321 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
1321 1322 (tramp-set-process-query-on-exit-flag p nil)
1322 ;; Set variables for computing the prompt for reading password. 1323
1323 (setq tramp-current-method tramp-smb-method 1324 ;; Set variables for computing the prompt for reading password.
1324 tramp-current-user user 1325 (setq tramp-current-method tramp-smb-method
1325 tramp-current-host host) 1326 tramp-current-user user
1326 1327 tramp-current-host host)
1327 ;; Play login scenario. 1328
1328 (tramp-process-actions 1329 ;; Play login scenario.
1329 p vec 1330 (tramp-process-actions
1330 (if share 1331 p vec
1331 tramp-smb-actions-with-share 1332 (if share
1332 tramp-smb-actions-without-share)) 1333 tramp-smb-actions-with-share
1333 1334 tramp-smb-actions-without-share))
1334 ;; Check server version. 1335
1335 (with-current-buffer (tramp-get-connection-buffer vec) 1336 ;; Check server version.
1336 (goto-char (point-min)) 1337 (with-current-buffer (tramp-get-connection-buffer vec)
1337 (search-forward-regexp 1338 (goto-char (point-min))
1338 "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t) 1339 (search-forward-regexp
1339 (let ((smbserver-version (match-string 0))) 1340 "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t)
1340 (unless 1341 (let ((smbserver-version (match-string 0)))
1341 (string-equal 1342 (unless
1342 smbserver-version 1343 (string-equal
1343 (tramp-get-connection-property 1344 smbserver-version
1344 vec "smbserver-version" smbserver-version)) 1345 (tramp-get-connection-property
1345 (tramp-flush-directory-property vec "") 1346 vec "smbserver-version" smbserver-version))
1346 (tramp-flush-connection-property vec)) 1347 (tramp-flush-directory-property vec "")
1347 (tramp-set-connection-property 1348 (tramp-flush-connection-property vec))
1348 vec "smbserver-version" smbserver-version))) 1349 (tramp-set-connection-property
1349 1350 vec "smbserver-version" smbserver-version)))
1350 ;; Set chunksize. Otherwise, `tramp-send-string' might 1351
1351 ;; try it itself. 1352 ;; Set chunksize. Otherwise, `tramp-send-string' might
1352 (tramp-set-connection-property p "smb-share" share) 1353 ;; try it itself.
1353 (tramp-set-connection-property p "chunksize" tramp-chunksize) 1354 (tramp-set-connection-property p "smb-share" share)
1354 1355 (tramp-set-connection-property
1355 (tramp-message 1356 p "chunksize" tramp-chunksize))))))))
1356 vec 3 "Opening connection for //%s%s/%s...done"
1357 (if (not (zerop (length user))) (concat user "@") "")
1358 host (or share ""))))))))
1359 1357
1360;; We don't use timeouts. If needed, the caller shall wrap around. 1358;; We don't use timeouts. If needed, the caller shall wrap around.
1361(defun tramp-smb-wait-for-output (vec) 1359(defun tramp-smb-wait-for-output (vec)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2da11bda834..c5addae8e5d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2271,14 +2271,18 @@ FILE must be a local file name on a connection identified via VEC."
2271 (tramp-message ,vec ,level "%s..." ,message) 2271 (tramp-message ,vec ,level "%s..." ,message)
2272 ;; We start a pulsing progress reporter after 3 seconds. Feature 2272 ;; We start a pulsing progress reporter after 3 seconds. Feature
2273 ;; introduced in Emacs 24.1. 2273 ;; introduced in Emacs 24.1.
2274 (when (<= ,level tramp-verbose) 2274 (when (and tramp-message-show-message
2275 ;; Display only when there is a minimum level.
2276 (<= ,level (min tramp-verbose 3)))
2275 (condition-case nil 2277 (condition-case nil
2276 (setq pr (tramp-compat-funcall 'make-progress-reporter ,message) 2278 (setq pr (tramp-compat-funcall 'make-progress-reporter ,message)
2277 tm (if pr (run-at-time 3 0.1 'progress-reporter-update pr))) 2279 tm (if pr (run-at-time 3 0.1 'progress-reporter-update pr)))
2278 (error nil))) 2280 (error nil)))
2279 (unwind-protect 2281 (unwind-protect
2280 ;; Execute the body. 2282 ;; Execute the body.
2281 (progn ,@body) 2283 (let ((tramp-message-show-message
2284 (and tramp-message-show-message (not tm))))
2285 ,@body)
2282 ;; Stop progress reporter. 2286 ;; Stop progress reporter.
2283 (if tm (tramp-compat-funcall 'cancel-timer tm)) 2287 (if tm (tramp-compat-funcall 'cancel-timer tm))
2284 (tramp-message ,vec ,level "%s...done" ,message)))) 2288 (tramp-message ,vec ,level "%s...done" ,message))))
@@ -2558,13 +2562,13 @@ target of the symlink differ."
2558 (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file))) 2562 (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file)))
2559 (if (not (file-exists-p file)) 2563 (if (not (file-exists-p file))
2560 nil 2564 nil
2561 (unless nomessage (tramp-message v 0 "Loading %s..." file)) 2565 (let ((tramp-message-show-message (not nomessage)))
2562 (let ((local-copy (file-local-copy file))) 2566 (with-progress-reporter v 0 (format "Loading %s" file)
2563 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. 2567 (let ((local-copy (file-local-copy file)))
2564 (unwind-protect 2568 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
2565 (load local-copy noerror t t) 2569 (unwind-protect
2566 (tramp-compat-delete-file local-copy 'force))) 2570 (load local-copy noerror t t)
2567 (unless nomessage (tramp-message v 0 "Loading %s...done" file)) 2571 (tramp-compat-delete-file local-copy 'force)))))
2568 t))) 2572 t)))
2569 2573
2570;; Localname manipulation functions that grok Tramp localnames... 2574;; Localname manipulation functions that grok Tramp localnames...
@@ -4153,7 +4157,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
4153 nil) 4157 nil)
4154 ((and suffix (nth 2 suffix)) 4158 ((and suffix (nth 2 suffix))
4155 ;; We found an uncompression rule. 4159 ;; We found an uncompression rule.
4156 (with-progress-reporter v 0 (format "Uncompressing %s..." file) 4160 (with-progress-reporter v 0 (format "Uncompressing %s" file)
4157 (when (zerop 4161 (when (zerop
4158 (tramp-send-command-and-check 4162 (tramp-send-command-and-check
4159 v (concat (nth 2 suffix) " " 4163 v (concat (nth 2 suffix) " "
@@ -4165,7 +4169,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
4165 (t 4169 (t
4166 ;; We don't recognize the file as compressed, so compress it. 4170 ;; We don't recognize the file as compressed, so compress it.
4167 ;; Try gzip. 4171 ;; Try gzip.
4168 (with-progress-reporter v 0 (format "Compressing %s..." file) 4172 (with-progress-reporter v 0 (format "Compressing %s" file)
4169 (when (zerop 4173 (when (zerop
4170 (tramp-send-command-and-check 4174 (tramp-send-command-and-check
4171 v (concat "gzip -f " 4175 v (concat "gzip -f "
@@ -4747,11 +4751,11 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
4747 ;; Use inline encoding for file transfer. 4751 ;; Use inline encoding for file transfer.
4748 (rem-enc 4752 (rem-enc
4749 (save-excursion 4753 (save-excursion
4750 (tramp-message v 5 "Encoding remote file %s..." filename) 4754 (with-progress-reporter
4751 (tramp-barf-unless-okay 4755 v 5 (format "Encoding remote file %s" filename)
4752 v (format rem-enc (tramp-shell-quote-argument localname)) 4756 (tramp-barf-unless-okay
4753 "Encoding remote file failed") 4757 v (format rem-enc (tramp-shell-quote-argument localname))
4754 (tramp-message v 5 "Encoding remote file %s...done" filename) 4758 "Encoding remote file failed"))
4755 4759
4756 (if (functionp loc-dec) 4760 (if (functionp loc-dec)
4757 ;; If local decoding is a function, we call it. We 4761 ;; If local decoding is a function, we call it. We
@@ -4761,15 +4765,15 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
4761 (with-temp-buffer 4765 (with-temp-buffer
4762 (set-buffer-multibyte nil) 4766 (set-buffer-multibyte nil)
4763 (insert-buffer-substring (tramp-get-buffer v)) 4767 (insert-buffer-substring (tramp-get-buffer v))
4764 (tramp-message 4768 (with-progress-reporter
4765 v 5 "Decoding remote file %s with function %s..." 4769 v 3 (format "Decoding remote file %s with function %s"
4766 filename loc-dec) 4770 filename loc-dec)
4767 (funcall loc-dec (point-min) (point-max)) 4771 (funcall loc-dec (point-min) (point-max))
4768 ;; Unset `file-name-handler-alist'. Otherwise, 4772 ;; Unset `file-name-handler-alist'. Otherwise,
4769 ;; epa-file gets confused. 4773 ;; epa-file gets confused.
4770 (let (file-name-handler-alist 4774 (let (file-name-handler-alist
4771 (coding-system-for-write 'binary)) 4775 (coding-system-for-write 'binary))
4772 (write-region (point-min) (point-max) tmpfile))) 4776 (write-region (point-min) (point-max) tmpfile))))
4773 4777
4774 ;; If tramp-decoding-function is not defined for this 4778 ;; If tramp-decoding-function is not defined for this
4775 ;; method, we invoke tramp-decoding-command instead. 4779 ;; method, we invoke tramp-decoding-command instead.
@@ -4779,14 +4783,14 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
4779 (let (file-name-handler-alist 4783 (let (file-name-handler-alist
4780 (coding-system-for-write 'binary)) 4784 (coding-system-for-write 'binary))
4781 (write-region (point-min) (point-max) tmpfile2)) 4785 (write-region (point-min) (point-max) tmpfile2))
4782 (tramp-message 4786 (with-progress-reporter
4783 v 5 "Decoding remote file %s with command %s..." 4787 v 3 (format "Decoding remote file %s with command %s"
4784 filename loc-dec) 4788 filename loc-dec)
4785 (unwind-protect 4789 (unwind-protect
4786 (tramp-call-local-coding-command loc-dec tmpfile2 tmpfile) 4790 (tramp-call-local-coding-command
4787 (tramp-compat-delete-file tmpfile2 'force)))) 4791 loc-dec tmpfile2 tmpfile)
4792 (tramp-compat-delete-file tmpfile2 'force)))))
4788 4793
4789 (tramp-message v 5 "Decoding remote file %s...done" filename)
4790 ;; Set proper permissions. 4794 ;; Set proper permissions.
4791 (set-file-modes tmpfile (tramp-default-file-modes filename)) 4795 (set-file-modes tmpfile (tramp-default-file-modes filename))
4792 ;; Set local user ownership. 4796 ;; Set local user ownership.
@@ -4842,7 +4846,7 @@ coding system might not be determined. This function repairs it."
4842 "Like `insert-file-contents' for Tramp files." 4846 "Like `insert-file-contents' for Tramp files."
4843 (barf-if-buffer-read-only) 4847 (barf-if-buffer-read-only)
4844 (setq filename (expand-file-name filename)) 4848 (setq filename (expand-file-name filename))
4845 (let (coding-system-used result local-copy remote-copy) 4849 (let (result local-copy remote-copy)
4846 (with-parsed-tramp-file-name filename nil 4850 (with-parsed-tramp-file-name filename nil
4847 (unwind-protect 4851 (unwind-protect
4848 (if (not (file-exists-p filename)) 4852 (if (not (file-exists-p filename))
@@ -4913,27 +4917,16 @@ coding system might not be determined. This function repairs it."
4913 (setq tramp-temp-buffer-file-name local-copy) 4917 (setq tramp-temp-buffer-file-name local-copy)
4914 (put 'tramp-temp-buffer-file-name 'permanent-local t)) 4918 (put 'tramp-temp-buffer-file-name 'permanent-local t))
4915 4919
4916 (tramp-message 4920 (with-progress-reporter
4917 v 4 "Inserting local temp file `%s'..." local-copy) 4921 v 3 (format "Inserting local temp file `%s'" local-copy)
4918 4922 ;; We must ensure that `file-coding-system-alist'
4919 ;; We must ensure that `file-coding-system-alist' 4923 ;; matches `local-copy'.
4920 ;; matches `local-copy'. 4924 (let ((file-coding-system-alist
4921 (let ((file-coding-system-alist 4925 (tramp-find-file-name-coding-system-alist
4922 (tramp-find-file-name-coding-system-alist 4926 filename local-copy)))
4923 filename local-copy))) 4927 (setq result
4924 (setq result 4928 (insert-file-contents
4925 (insert-file-contents 4929 local-copy nil nil nil replace))))))
4926 local-copy nil nil nil replace))
4927 ;; Now `last-coding-system-used' has right value.
4928 ;; Remember it.
4929 (when (boundp 'last-coding-system-used)
4930 (setq coding-system-used
4931 (symbol-value 'last-coding-system-used))))
4932
4933 (tramp-message
4934 v 4 "Inserting local temp file `%s'...done" local-copy)
4935 (when (boundp 'last-coding-system-used)
4936 (set 'last-coding-system-used coding-system-used))))
4937 4930
4938 ;; Save exit. 4931 ;; Save exit.
4939 (progn 4932 (progn
@@ -5193,15 +5186,14 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
5193 ;; Use inline file transfer. 5186 ;; Use inline file transfer.
5194 (rem-dec 5187 (rem-dec
5195 ;; Encode tmpfile. 5188 ;; Encode tmpfile.
5196 (tramp-message v 5 "Encoding region...")
5197 (unwind-protect 5189 (unwind-protect
5198 (with-temp-buffer 5190 (with-temp-buffer
5199 (set-buffer-multibyte nil) 5191 (set-buffer-multibyte nil)
5200 ;; Use encoding function or command. 5192 ;; Use encoding function or command.
5201 (if (functionp loc-enc) 5193 (if (functionp loc-enc)
5202 (progn 5194 (with-progress-reporter
5203 (tramp-message 5195 v 3 (format "Encoding region using function `%s'"
5204 v 5 "Encoding region using function `%s'..." loc-enc) 5196 loc-enc)
5205 (let ((coding-system-for-read 'binary)) 5197 (let ((coding-system-for-read 'binary))
5206 (insert-file-contents-literally tmpfile)) 5198 (insert-file-contents-literally tmpfile))
5207 ;; The following `let' is a workaround for the 5199 ;; The following `let' is a workaround for the
@@ -5217,59 +5209,61 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
5217 (tramp-compat-temporary-file-directory))) 5209 (tramp-compat-temporary-file-directory)))
5218 (funcall loc-enc (point-min) (point-max)))) 5210 (funcall loc-enc (point-min) (point-max))))
5219 5211
5220 (tramp-message 5212 (with-progress-reporter
5221 v 5 "Encoding region using command `%s'..." loc-enc) 5213 v 3 (format "Encoding region using command `%s'"
5222 (unless (zerop (tramp-call-local-coding-command 5214 loc-enc)
5223 loc-enc tmpfile t)) 5215 (unless (zerop (tramp-call-local-coding-command
5224 (tramp-error 5216 loc-enc tmpfile t))
5225 v 'file-error 5217 (tramp-error
5226 "Cannot write to `%s', local encoding command `%s' failed" 5218 v 'file-error
5227 filename loc-enc))) 5219 (concat "Cannot write to `%s', "
5220 "local encoding command `%s' failed")
5221 filename loc-enc))))
5228 5222
5229 ;; Send buffer into remote decoding command which 5223 ;; Send buffer into remote decoding command which
5230 ;; writes to remote file. Because this happens on 5224 ;; writes to remote file. Because this happens on
5231 ;; the remote host, we cannot use the function. 5225 ;; the remote host, we cannot use the function.
5232 (goto-char (point-max)) 5226 (with-progress-reporter
5233 (unless (bolp) (newline)) 5227 v 3
5234 (tramp-message 5228 (format "Decoding region into remote file %s" filename)
5235 v 5 "Decoding region into remote file %s..." filename) 5229 (goto-char (point-max))
5236 (tramp-send-command 5230 (unless (bolp) (newline))
5237 v 5231 (tramp-send-command
5238 (format 5232 v
5239 (concat rem-dec " <<'EOF'\n%sEOF") 5233 (format
5240 (tramp-shell-quote-argument localname) 5234 (concat rem-dec " <<'EOF'\n%sEOF")
5241 (buffer-string))) 5235 (tramp-shell-quote-argument localname)
5242 (tramp-barf-unless-okay 5236 (buffer-string)))
5243 v nil 5237 (tramp-barf-unless-okay
5244 "Couldn't write region to `%s', decode using `%s' failed" 5238 v nil
5245 filename rem-dec) 5239 "Couldn't write region to `%s', decode using `%s' failed"
5246 ;; When `file-precious-flag' is set, the region is 5240 filename rem-dec)
5247 ;; written to a temporary file. Check that the 5241 ;; When `file-precious-flag' is set, the region is
5248 ;; checksum is equal to that from the local tmpfile. 5242 ;; written to a temporary file. Check that the
5249 (when file-precious-flag 5243 ;; checksum is equal to that from the local tmpfile.
5250 (erase-buffer) 5244 (when file-precious-flag
5251 (and 5245 (erase-buffer)
5252 ;; cksum runs locally, if possible. 5246 (and
5253 (zerop (tramp-local-call-process "cksum" tmpfile t)) 5247 ;; cksum runs locally, if possible.
5254 ;; cksum runs remotely. 5248 (zerop (tramp-local-call-process "cksum" tmpfile t))
5255 (zerop 5249 ;; cksum runs remotely.
5256 (tramp-send-command-and-check 5250 (zerop
5257 v 5251 (tramp-send-command-and-check
5258 (format 5252 v
5259 "cksum <%s" (tramp-shell-quote-argument localname)))) 5253 (format
5260 ;; ... they are different. 5254 "cksum <%s"
5261 (not 5255 (tramp-shell-quote-argument localname))))
5262 (string-equal 5256 ;; ... they are different.
5263 (buffer-string) 5257 (not
5264 (with-current-buffer (tramp-get-buffer v) 5258 (string-equal
5265 (buffer-string)))) 5259 (buffer-string)
5266 (tramp-error 5260 (with-current-buffer (tramp-get-buffer v)
5267 v 'file-error 5261 (buffer-string))))
5268 (concat "Couldn't write region to `%s'," 5262 (tramp-error
5269 " decode using `%s' failed") 5263 v 'file-error
5270 filename rem-dec))) 5264 (concat "Couldn't write region to `%s',"
5271 (tramp-message 5265 " decode using `%s' failed")
5272 v 5 "Decoding region into remote file %s...done" filename)) 5266 filename rem-dec)))))
5273 5267
5274 ;; Save exit. 5268 ;; Save exit.
5275 (tramp-compat-delete-file tmpfile 'force))) 5269 (tramp-compat-delete-file tmpfile 'force)))
@@ -6286,14 +6280,13 @@ Only send the definition if it has not already been done."
6286 (let* ((p (tramp-get-connection-process vec)) 6280 (let* ((p (tramp-get-connection-process vec))
6287 (scripts (tramp-get-connection-property p "scripts" nil))) 6281 (scripts (tramp-get-connection-property p "scripts" nil)))
6288 (unless (member name scripts) 6282 (unless (member name scripts)
6289 (tramp-message vec 5 "Sending script `%s'..." name) 6283 (with-progress-reporter vec 5 (format "Sending script `%s'" name)
6290 ;; The script could contain a call of Perl. This is masked with `%s'. 6284 ;; The script could contain a call of Perl. This is masked with `%s'.
6291 (tramp-send-command-and-check 6285 (tramp-send-command-and-check
6292 vec 6286 vec
6293 (format "%s () {\n%s\n}" name 6287 (format "%s () {\n%s\n}" name
6294 (format script (tramp-get-remote-perl vec)))) 6288 (format script (tramp-get-remote-perl vec))))
6295 (tramp-set-connection-property p "scripts" (cons name scripts)) 6289 (tramp-set-connection-property p "scripts" (cons name scripts))))))
6296 (tramp-message vec 5 "Sending script `%s'...done." name))))
6297 6290
6298(defun tramp-set-auto-save () 6291(defun tramp-set-auto-save ()
6299 (when (and ;; ange-ftp has its own auto-save mechanism 6292 (when (and ;; ange-ftp has its own auto-save mechanism
@@ -6572,7 +6565,7 @@ file exists and nonzero exit status otherwise."
6572 (setq extra-args (cdr item)))) 6565 (setq extra-args (cdr item))))
6573 (when extra-args (setq shell (concat shell " " extra-args)))) 6566 (when extra-args (setq shell (concat shell " " extra-args))))
6574 (tramp-message 6567 (tramp-message
6575 vec 5 "Starting remote shell `%s' for tilde expansion..." shell) 6568 vec 5 "Starting remote shell `%s' for tilde expansion" shell)
6576 (let ((tramp-end-of-output tramp-initial-end-of-output)) 6569 (let ((tramp-end-of-output tramp-initial-end-of-output))
6577 (tramp-send-command 6570 (tramp-send-command
6578 vec 6571 vec
@@ -6580,13 +6573,12 @@ file exists and nonzero exit status otherwise."
6580 (shell-quote-argument tramp-end-of-output) shell) 6573 (shell-quote-argument tramp-end-of-output) shell)
6581 t)) 6574 t))
6582 ;; Setting prompts. 6575 ;; Setting prompts.
6583 (tramp-message vec 5 "Setting remote shell prompt...") 6576 (with-progress-reporter vec 5 (format "Setting remote shell prompt")
6584 (tramp-send-command 6577 (tramp-send-command
6585 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t) 6578 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
6586 (tramp-send-command vec "PS2=''" t) 6579 (tramp-send-command vec "PS2=''" t)
6587 (tramp-send-command vec "PS3=''" t) 6580 (tramp-send-command vec "PS3=''" t)
6588 (tramp-send-command vec "PROMPT_COMMAND=''" t) 6581 (tramp-send-command vec "PROMPT_COMMAND=''" t)))
6589 (tramp-message vec 5 "Setting remote shell prompt...done"))
6590 6582
6591 (t (tramp-message 6583 (t (tramp-message
6592 vec 5 "Remote `%s' groks tilde expansion, good" 6584 vec 5 "Remote `%s' groks tilde expansion, good"
@@ -7423,11 +7415,11 @@ connection if a previous connection has died for some reason."
7423 (tramp-get-buffer vec) 7415 (tramp-get-buffer vec)
7424 (if (zerop (length (tramp-file-name-user vec))) 7416 (if (zerop (length (tramp-file-name-user vec)))
7425 (tramp-message 7417 (tramp-message
7426 vec 3 "Opening connection for %s using %s..." 7418 vec 3 "Opening connection for %s using %s"
7427 (tramp-file-name-host vec) 7419 (tramp-file-name-host vec)
7428 (tramp-file-name-method vec)) 7420 (tramp-file-name-method vec))
7429 (tramp-message 7421 (tramp-message
7430 vec 3 "Opening connection for %s@%s using %s..." 7422 vec 3 "Opening connection for %s@%s using %s"
7431 (tramp-file-name-user vec) 7423 (tramp-file-name-user vec)
7432 (tramp-file-name-host vec) 7424 (tramp-file-name-host vec)
7433 (tramp-file-name-method vec))) 7425 (tramp-file-name-method vec)))
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 56fc8032541..10267a6b2dc 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1501,6 +1501,11 @@ defun."
1501 (interactive "p") 1501 (interactive "p")
1502 (or arg (setq arg 1)) 1502 (or arg (setq arg 1))
1503 1503
1504 (or (not (eq this-command 'c-beginning-of-defun))
1505 (eq last-command 'c-beginning-of-defun)
1506 (and transient-mark-mode mark-active)
1507 (push-mark))
1508
1504 (c-save-buffer-state 1509 (c-save-buffer-state
1505 (beginning-of-defun-function end-of-defun-function 1510 (beginning-of-defun-function end-of-defun-function
1506 (start (point)) 1511 (start (point))
@@ -1604,6 +1609,11 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
1604 (interactive "p") 1609 (interactive "p")
1605 (or arg (setq arg 1)) 1610 (or arg (setq arg 1))
1606 1611
1612 (or (not (eq this-command 'c-end-of-defun))
1613 (eq last-command 'c-end-of-defun)
1614 (and transient-mark-mode mark-active)
1615 (push-mark))
1616
1607 (c-save-buffer-state 1617 (c-save-buffer-state
1608 (beginning-of-defun-function end-of-defun-function 1618 (beginning-of-defun-function end-of-defun-function
1609 (start (point)) 1619 (start (point))
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 610fa14489a..eca6d5fbe7b 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1480,7 +1480,7 @@ frequently editing existing scripts with different styles.")
1480;; mode-command and utility functions 1480;; mode-command and utility functions
1481 1481
1482;;;###autoload 1482;;;###autoload
1483(defun sh-mode () 1483(define-derived-mode sh-mode prog-mode "Shell-script"
1484 "Major mode for editing shell scripts. 1484 "Major mode for editing shell scripts.
1485This mode works for many shells, since they all have roughly the same syntax, 1485This mode works for many shells, since they all have roughly the same syntax,
1486as far as commands, arguments, variables, pipes, comments etc. are concerned. 1486as far as commands, arguments, variables, pipes, comments etc. are concerned.
@@ -1533,11 +1533,6 @@ indicate what shell it is use `sh-alias-alist' to translate.
1533 1533
1534If your shell gives error messages with line numbers, you can use \\[executable-interpret] 1534If your shell gives error messages with line numbers, you can use \\[executable-interpret]
1535with your script for an edit-interpret-debug cycle." 1535with your script for an edit-interpret-debug cycle."
1536 (interactive)
1537 (kill-all-local-variables)
1538 (setq major-mode 'sh-mode
1539 mode-name "Shell-script")
1540 (use-local-map sh-mode-map)
1541 (make-local-variable 'skeleton-end-hook) 1536 (make-local-variable 'skeleton-end-hook)
1542 (make-local-variable 'paragraph-start) 1537 (make-local-variable 'paragraph-start)
1543 (make-local-variable 'paragraph-separate) 1538 (make-local-variable 'paragraph-separate)
@@ -1613,8 +1608,7 @@ with your script for an edit-interpret-debug cycle."
1613 "sh") 1608 "sh")
1614 (t 1609 (t
1615 sh-shell-file)) 1610 sh-shell-file))
1616 nil nil) 1611 nil nil))
1617 (run-mode-hooks 'sh-mode-hook))
1618 1612
1619;;;###autoload 1613;;;###autoload
1620(defalias 'shell-script-mode 'sh-mode) 1614(defalias 'shell-script-mode 'sh-mode)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c88b32f64cc..94eb721e4cf 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2630,11 +2630,22 @@ Keeps argument list for future ispell invocations for no async support."
2630 (or ispell-local-dictionary ispell-dictionary "default")) 2630 (or ispell-local-dictionary ispell-dictionary "default"))
2631 (sit-for 0) 2631 (sit-for 0)
2632 (setq ispell-library-directory (ispell-check-version) 2632 (setq ispell-library-directory (ispell-check-version)
2633 ispell-process-directory default-directory
2634 ispell-process (ispell-start-process) 2633 ispell-process (ispell-start-process)
2635 ispell-filter nil 2634 ispell-filter nil
2636 ispell-filter-continue nil 2635 ispell-filter-continue nil)
2637 ispell-process-buffer-name (buffer-name)) 2636 ;; When spellchecking minibuffer contents, make sure ispell process
2637 ;; is not restarted every time the minibuffer is killed.
2638 (if (window-minibuffer-p)
2639 (if (fboundp 'minibuffer-selected-window)
2640 ;; Assign ispell process to parent buffer
2641 (setq ispell-process-directory default-directory
2642 ispell-process-buffer-name (window-buffer (minibuffer-selected-window)))
2643 ;; Force `ispell-process-directory' to $HOME and use a dummy name
2644 (setq ispell-process-directory (expand-file-name "~/")
2645 ispell-process-buffer-name " * Minibuffer-has-spellcheck-enabled"))
2646 ;; Not in a minibuffer
2647 (setq ispell-process-directory default-directory
2648 ispell-process-buffer-name (buffer-name)))
2638 (if ispell-async-processp 2649 (if ispell-async-processp
2639 (set-process-filter ispell-process 'ispell-filter)) 2650 (set-process-filter ispell-process 'ispell-filter))
2640 ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs 2651 ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index b9d52acdeba..6cd4121bd10 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -101,6 +101,11 @@ This takes effect when first loading the `sgml-mode' library.")
101 (define-key map "\C-c\^?" 'sgml-delete-tag) 101 (define-key map "\C-c\^?" 'sgml-delete-tag)
102 (define-key map "\C-c?" 'sgml-tag-help) 102 (define-key map "\C-c?" 'sgml-tag-help)
103 (define-key map "\C-c/" 'sgml-close-tag) 103 (define-key map "\C-c/" 'sgml-close-tag)
104
105 ;; Redundant keybindings, for consistency with TeX mode.
106 (define-key map "\C-c\C-o" 'sgml-tag)
107 (define-key map "\C-c\C-e" 'sgml-close-tag)
108
104 (define-key map "\C-c8" 'sgml-name-8bit-mode) 109 (define-key map "\C-c8" 'sgml-name-8bit-mode)
105 (define-key map "\C-c\C-v" 'sgml-validate) 110 (define-key map "\C-c\C-v" 'sgml-validate)
106 (when sgml-quick-keys 111 (when sgml-quick-keys
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 5fc92a92d37..da0c5396f2c 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -808,6 +808,11 @@ END is the position of the first delimiter after \verb."
808 (define-key map "\C-c\C-c" 'tex-compile) 808 (define-key map "\C-c\C-c" 'tex-compile)
809 (define-key map "\C-c\C-i" 'tex-bibtex-file) 809 (define-key map "\C-c\C-i" 'tex-bibtex-file)
810 (define-key map "\C-c\C-o" 'latex-insert-block) 810 (define-key map "\C-c\C-o" 'latex-insert-block)
811
812 ;; Redundant keybindings, for consistency with SGML mode.
813 (define-key map "\C-c\C-t" 'latex-insert-block)
814 (define-key map "\C-c/" 'latex-close-block)
815
811 (define-key map "\C-c\C-e" 'latex-close-block) 816 (define-key map "\C-c\C-e" 'latex-close-block)
812 (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block) 817 (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block)
813 (define-key map "\C-c\C-m" 'tex-feed-input) 818 (define-key map "\C-c\C-m" 'tex-feed-input)