aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2014-04-19 01:36:51 +0200
committerJuanma Barranquero2014-04-19 01:36:51 +0200
commitbba633792b813249a47dde828cbf84cdb946ba60 (patch)
treee320e5217ad3dc878e49fb86be7297a5cef60e5f
parentf0496348d1b9b1f2fff9e4265f51cbdc77eb40dc (diff)
parent2a2e6726d1f7031d89fd6740e5b167476267f778 (diff)
downloademacs-bba633792b813249a47dde828cbf84cdb946ba60.tar.gz
emacs-bba633792b813249a47dde828cbf84cdb946ba60.zip
Merge from emacs-24; up to 2014-04-16T15:28:06Z!eggert@cs.ucla.edu
-rw-r--r--admin/ChangeLog6
-rw-r--r--admin/notes/bzr36
-rw-r--r--lisp/ChangeLog17
-rw-r--r--lisp/net/tramp-adb.el4
-rw-r--r--lisp/net/tramp-compat.el1
-rw-r--r--lisp/net/tramp.el70
-rw-r--r--src/ChangeLog20
-rw-r--r--src/emacs.c7
-rw-r--r--src/insdel.c22
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xterm.c9
-rw-r--r--test/ChangeLog15
-rw-r--r--test/automated/tramp-tests.el298
13 files changed, 401 insertions, 118 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index c28ff6853c2..7af23b779ef 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,9 @@
12014-04-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 * notes/bzr: Update instructions for merging from gnulib.
4 Remove obsolete note about tramp.el and tramp-sh.el.
5 Change "emacs-23" to "emacs-24".
6
12014-04-11 Glenn Morris <rgm@gnu.org> 72014-04-11 Glenn Morris <rgm@gnu.org>
2 8
3 * grammars/Makefile.in (EMACSDATA, EMACSDOC, EMACSPATH): Unexport. 9 * grammars/Makefile.in (EMACSDATA, EMACSDOC, EMACSPATH): Unexport.
diff --git a/admin/notes/bzr b/admin/notes/bzr
index a3a125cd675..a1ef8f64133 100644
--- a/admin/notes/bzr
+++ b/admin/notes/bzr
@@ -3,9 +3,9 @@ NOTES ON COMMITTING TO EMACS'S BAZAAR REPO -*- outline -*-
3* Install changes only on one branch, let them get merged elsewhere if needed. 3* Install changes only on one branch, let them get merged elsewhere if needed.
4In particular, install bug-fixes only on the release branch (if there 4In particular, install bug-fixes only on the release branch (if there
5is one) and let them get synced to the trunk; do not install them by 5is one) and let them get synced to the trunk; do not install them by
6hand on the trunk as well. E.g. if there is an active "emacs-23" branch 6hand on the trunk as well. E.g. if there is an active "emacs-24" branch
7and you have a bug-fix appropriate for the next Emacs-23.x release, 7and you have a bug-fix appropriate for the next emacs-24.x release,
8install it only on the emacs-23 branch, not on the trunk as well. 8install it only on the emacs-24 branch, not on the trunk as well.
9 9
10Installing things manually into more than one branch makes merges more 10Installing things manually into more than one branch makes merges more
11difficult. 11difficult.
@@ -18,7 +18,7 @@ In that case, it's helpful if you can apply the change to both trunk
18and branch yourself (when committing the branch change, indicate 18and branch yourself (when committing the branch change, indicate
19in the commit log that it should not be merged to the trunk; see below). 19in the commit log that it should not be merged to the trunk; see below).
20 20
21* Backporting a bug-fix from the trunk to a branch (e.g. "emacs-23"). 21* Backporting a bug-fix from the trunk to a branch (e.g. "emacs-24").
22Indicate in the commit log that there is no need to merge the commit 22Indicate in the commit log that there is no need to merge the commit
23to the trunk. Anything that matches `bzrmerge-skip-regexp' will do; 23to the trunk. Anything that matches `bzrmerge-skip-regexp' will do;
24eg start the commit message with "Backport:". This is helpful for the 24eg start the commit message with "Backport:". This is helpful for the
@@ -49,7 +49,7 @@ http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00086.html
49* Installing changes from gnulib 49* Installing changes from gnulib
50Some of the files in Emacs are copied from gnulib. To synchronize 50Some of the files in Emacs are copied from gnulib. To synchronize
51these files from the version of gnulib that you have checked out into 51these files from the version of gnulib that you have checked out into
52a sibling directory of your branch, type "make sync-from-gnulib"; this 52a sibling directory of your branch, type "admin/merge-gnulib"; this
53will check out the latest version of gnulib if there is no sibling 53will check out the latest version of gnulib if there is no sibling
54directory already. It is a good idea to run "bzr status" afterwards, 54directory already. It is a good idea to run "bzr status" afterwards,
55so that if a gnulib module added a file, you can record the new file 55so that if a gnulib module added a file, you can record the new file
@@ -57,17 +57,12 @@ using "bzr add". After synchronizing from gnulib, do a "make" in the
57usual way. 57usual way.
58 58
59To change the set of gnulib modules, change the GNULIB_MODULES 59To change the set of gnulib modules, change the GNULIB_MODULES
60variable in the top-level Makefile.in, and then run: 60variable in admin/merge-gnulib before running it.
61 61
62 ./config.status 62If you remove a gnulib module, or if a gnulib module
63 make sync-from-gnulib
64 bzr status
65
66The last command will mention files that may need to be added using
67"bzr add". If you remove a gnulib module, or if a gnulib module
68removes a file, then remove the corresponding files by hand. 63removes a file, then remove the corresponding files by hand.
69 64
70* How to merge changes from emacs-23 to trunk 65* How to merge changes from emacs-24 to trunk
71 66
72The following description uses bound branches, presumably it works in 67The following description uses bound branches, presumably it works in
73a similar way with unbound ones. 68a similar way with unbound ones.
@@ -90,7 +85,7 @@ copy in ~/.bazaar if you upgrade bzr.
90Maybe the default Emacs behavior without this plugin is better, 85Maybe the default Emacs behavior without this plugin is better,
91though, it's not clear yet. 86though, it's not clear yet.
92 87
931) Get clean, up-to-date copies of the emacs-23 and trunk branches. 881) Get clean, up-to-date copies of the emacs-24 and trunk branches.
94Check for any uncommitted changes with bzr status. 89Check for any uncommitted changes with bzr status.
95 90
962) M-x cd /path/to/trunk 912) M-x cd /path/to/trunk
@@ -102,7 +97,7 @@ changelog_merge_files = ChangeLog
102 97
1033) load admin/bzrmerge.el 983) load admin/bzrmerge.el
104 99
1054) M-x bzrmerge RET /path/to/emacs-23 RET 1004) M-x bzrmerge RET /path/to/emacs-24 RET
106 101
107It will prompt about revisions that should be skipped, based on the 102It will prompt about revisions that should be skipped, based on the
108regexp in bzrmerge-missing. If there are more revisions that you know 103regexp in bzrmerge-missing. If there are more revisions that you know
@@ -119,7 +114,7 @@ Do not commit (or exit Emacs) until you have run bzrmerge to completion.
119 114
120Before committing, check bzr status and bzr diff output. 115Before committing, check bzr status and bzr diff output.
121If you have run bzrmerge enough times, the "pending merge tip" in bzr 116If you have run bzrmerge enough times, the "pending merge tip" in bzr
122status should be the last revision from the emacs-23 branch, and 117status should be the last revision from the emacs-24 branch, and
123bzr status -v should show all the revisions you expect to merge. 118bzr status -v should show all the revisions you expect to merge.
124 119
125(Note that it will also show "skipped" revisions. This is expected, 120(Note that it will also show "skipped" revisions. This is expected,
@@ -141,18 +136,13 @@ authors, don't break the logical ordering in doing this.
141 136
142Notes: 137Notes:
143 138
1441) A lot that was in tramp.el in emacs-23 has moved to tramp-sh.el in 1391) If a file is modified in emacs-24, and deleted in the trunk, you
145the trunk. If you end up with a conflict in tramp.el, the changes may
146need to go to tramp-sh.el instead. Remember to update the file name in
147the ChangeLog.
148
1492) If a file is modified in emacs-23, and deleted in the trunk, you
150get a "contents conflict". Assuming the changes don't need to be in 140get a "contents conflict". Assuming the changes don't need to be in
151the trunk at all, use `bzr resolve path/to/file --take-this' to keep the 141the trunk at all, use `bzr resolve path/to/file --take-this' to keep the
152trunk version. Prior to bzr 2.2.3, this may fail. You can just 142trunk version. Prior to bzr 2.2.3, this may fail. You can just
153delete the .OTHER etc files by hand and use bzr resolve path/to/file. 143delete the .OTHER etc files by hand and use bzr resolve path/to/file.
154 144
1553) Conflicts in autoload md5sums in comments. Strictly speaking, the 1452) Conflicts in autoload md5sums in comments. Strictly speaking, the
156right thing to do is merge everything else, resolve the conflict by 146right thing to do is merge everything else, resolve the conflict by
157choosing either the trunk or branch version, then run `make -C lisp 147choosing either the trunk or branch version, then run `make -C lisp
158autoloads' to update the md5sums to the correct trunk value before 148autoloads' to update the md5sums to the correct trunk value before
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ab9240c8f82..9078046f149 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,20 @@
12014-04-18 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-run-real-handler, tramp-file-name-handler):
4 Do not autoload.
5 (tramp-file-name-handler, tramp-completion-file-name-handler):
6 Revert patch from 2014-04-10, it isn't necessary anymore.
7 (tramp-autoload-file-name-handler)
8 (tramp-register-autoload-file-name-handlers): New defuns.
9 (top): Autoload call of `tramp-register-autoload-file-name-handlers'.
10 (tramp-register-file-name-handlers): Remove also
11 `tramp-autoload-file-name-handler' from `file-name-handler-list'.
12 Do not autoload its invocation, but eval it after loading of 'tramp.
13
14 * net/tramp-adb.el (tramp-unload-hook): Unload `tramp-adb'.
15
16 * net/tramp-compat.el (tramp-unload-hook): Unload `tramp-loaddefs'.
17
12014-04-17 Daniel Colascione <dancol@dancol.org> 182014-04-17 Daniel Colascione <dancol@dancol.org>
2 19
3 Add support for bracketed paste mode; add infrastructure for 20 Add support for bracketed paste mode; add infrastructure for
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 27f20dea754..53888473217 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1183,5 +1183,9 @@ connection if a previous connection has died for some reason."
1183 (read (current-buffer))) 1183 (read (current-buffer)))
1184 ":" 'omit-nulls)))))))) 1184 ":" 'omit-nulls))))))))
1185 1185
1186(add-hook 'tramp-unload-hook
1187 (lambda ()
1188 (unload-feature 'tramp-adb 'force)))
1189
1186(provide 'tramp-adb) 1190(provide 'tramp-adb)
1187;;; tramp-adb.el ends here 1191;;; tramp-adb.el ends here
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index bdbfbcf4c2e..cd336ec61b3 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -587,6 +587,7 @@ and replace a sub-expression, e.g.
587 587
588(add-hook 'tramp-unload-hook 588(add-hook 'tramp-unload-hook
589 (lambda () 589 (lambda ()
590 (unload-feature 'tramp-loaddefs 'force)
590 (unload-feature 'tramp-compat 'force))) 591 (unload-feature 'tramp-compat 'force)))
591 592
592(provide 'tramp-compat) 593(provide 'tramp-compat)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 51cc13fed7c..6cc8275b327 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1943,8 +1943,7 @@ coding system might not be determined. This function repairs it."
1943 (add-to-list 1943 (add-to-list
1944 'result (cons (regexp-quote tmpname) (cdr elt)) 'append))))) 1944 'result (cons (regexp-quote tmpname) (cdr elt)) 'append)))))
1945 1945
1946;;;###autoload 1946(defun tramp-run-real-handler (operation args)
1947(progn (defun tramp-run-real-handler (operation args)
1948 "Invoke normal file name handler for OPERATION. 1947 "Invoke normal file name handler for OPERATION.
1949First arg specifies the OPERATION, second arg is a list of arguments to 1948First arg specifies the OPERATION, second arg is a list of arguments to
1950pass to the OPERATION." 1949pass to the OPERATION."
@@ -1958,7 +1957,7 @@ pass to the OPERATION."
1958 ,(and (eq inhibit-file-name-operation operation) 1957 ,(and (eq inhibit-file-name-operation operation)
1959 inhibit-file-name-handlers))) 1958 inhibit-file-name-handlers)))
1960 (inhibit-file-name-operation operation)) 1959 (inhibit-file-name-operation operation))
1961 (apply operation args)))) 1960 (apply operation args)))
1962 1961
1963;;;###autoload 1962;;;###autoload
1964(progn (defun tramp-completion-run-real-handler (operation args) 1963(progn (defun tramp-completion-run-real-handler (operation args)
@@ -2100,22 +2099,12 @@ ARGS are the arguments OPERATION has been called with."
2100 (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) 2099 (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers)))
2101 2100
2102;; Main function. 2101;; Main function.
2103;;;###autoload
2104(defun tramp-file-name-handler (operation &rest args) 2102(defun tramp-file-name-handler (operation &rest args)
2105 "Invoke Tramp file name handler. 2103 "Invoke Tramp file name handler.
2106Falls back to normal file name handler if no Tramp file name handler exists." 2104Falls back to normal file name handler if no Tramp file name handler exists."
2107 (if tramp-mode 2105 (if tramp-mode
2108 (save-match-data 2106 (save-match-data
2109 (let* ((default-directory 2107 (let* ((filename
2110 ;; Some packages set the default directory to a
2111 ;; remote path, before tramp.el has been loaded.
2112 ;; This results in recursive loading. Therefore, we
2113 ;; set `default-directory' to a local path. `args'
2114 ;; could also be remote when loading tramp.el, but
2115 ;; that would be such perverse we don't care about.
2116 (if load-in-progress
2117 temporary-file-directory default-directory))
2118 (filename
2119 (tramp-replace-environment-variables 2108 (tramp-replace-environment-variables
2120 (apply 'tramp-file-name-for-operation operation args))) 2109 (apply 'tramp-file-name-for-operation operation args)))
2121 (completion (tramp-completion-mode-p)) 2110 (completion (tramp-completion-mode-p))
@@ -2227,11 +2216,8 @@ preventing reentrant calls of Tramp.")
2227 "Invoke Tramp file name completion handler. 2216 "Invoke Tramp file name completion handler.
2228Falls back to normal file name handler if no Tramp file name handler exists." 2217Falls back to normal file name handler if no Tramp file name handler exists."
2229 ;; We bind `directory-sep-char' here for XEmacs on Windows, which 2218 ;; We bind `directory-sep-char' here for XEmacs on Windows, which
2230 ;; would otherwise use backslash. For `default-directory', see 2219 ;; would otherwise use backslash.
2231 ;; comment in `tramp-file-name-handler'.
2232 (let ((directory-sep-char ?/) 2220 (let ((directory-sep-char ?/)
2233 (default-directory
2234 (if load-in-progress temporary-file-directory default-directory))
2235 (fn (assoc operation tramp-completion-file-name-handler-alist))) 2221 (fn (assoc operation tramp-completion-file-name-handler-alist)))
2236 (if (and 2222 (if (and
2237 ;; When `tramp-mode' is not enabled, we don't do anything. 2223 ;; When `tramp-mode' is not enabled, we don't do anything.
@@ -2255,15 +2241,43 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2255 (tramp-completion-run-real-handler operation args))))) 2241 (tramp-completion-run-real-handler operation args)))))
2256 2242
2257;;;###autoload 2243;;;###autoload
2258(progn (defun tramp-register-file-name-handlers () 2244(progn (defun tramp-autoload-file-name-handler (operation &rest args)
2245 "Load Tramp file name handler, and perform OPERATION."
2246 ;; Avoid recursive loading of tramp.el.
2247 (let ((default-directory temporary-file-directory))
2248 (load "tramp" nil t))
2249 (apply operation args)))
2250
2251;; `tramp-autoload-file-name-handler' must be registered before
2252;; evaluation of site-start and init files, because there might exist
2253;; remote files already, f.e. files kept via recentf-mode. We cannot
2254;; autoload `tramp-file-name-handler', because it would result in
2255;; recursive loading of tramp.el when `default-directory' is set to
2256;; remote.
2257;;;###autoload
2258(progn (defun tramp-register-autoload-file-name-handlers ()
2259 "Add Tramp file name handlers to `file-name-handler-alist' during autoload."
2260 (add-to-list 'file-name-handler-alist
2261 (cons tramp-file-name-regexp
2262 'tramp-autoload-file-name-handler))
2263 (put 'tramp-autoload-file-name-handler 'safe-magic t)
2264 (add-to-list 'file-name-handler-alist
2265 (cons tramp-completion-file-name-regexp
2266 'tramp-completion-file-name-handler))
2267 (put 'tramp-completion-file-name-handler 'safe-magic t)))
2268
2269;;;###autoload
2270(tramp-register-autoload-file-name-handlers)
2271
2272(defun tramp-register-file-name-handlers ()
2259 "Add Tramp file name handlers to `file-name-handler-alist'." 2273 "Add Tramp file name handlers to `file-name-handler-alist'."
2260 ;; Remove autoloaded handlers from file name handler alist. Useful, 2274 ;; Remove autoloaded handlers from file name handler alist. Useful,
2261 ;; if `tramp-syntax' has been changed. 2275 ;; if `tramp-syntax' has been changed.
2262 (let ((a1 (rassq 'tramp-file-name-handler file-name-handler-alist))) 2276 (dolist (fnh '(tramp-file-name-handler
2263 (setq file-name-handler-alist (delq a1 file-name-handler-alist))) 2277 tramp-completion-file-name-handler
2264 (let ((a1 (rassq 2278 tramp-autoload-file-name-handler))
2265 'tramp-completion-file-name-handler file-name-handler-alist))) 2279 (let ((a1 (rassq fnh file-name-handler-alist)))
2266 (setq file-name-handler-alist (delq a1 file-name-handler-alist))) 2280 (setq file-name-handler-alist (delq a1 file-name-handler-alist))))
2267 ;; Add the handlers. 2281 ;; Add the handlers.
2268 (add-to-list 'file-name-handler-alist 2282 (add-to-list 'file-name-handler-alist
2269 (cons tramp-file-name-regexp 'tramp-file-name-handler)) 2283 (cons tramp-file-name-regexp 'tramp-file-name-handler))
@@ -2278,13 +2292,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2278 (let ((entry (rassoc fnh file-name-handler-alist))) 2292 (let ((entry (rassoc fnh file-name-handler-alist)))
2279 (when entry 2293 (when entry
2280 (setq file-name-handler-alist 2294 (setq file-name-handler-alist
2281 (cons entry (delete entry file-name-handler-alist)))))))) 2295 (cons entry (delete entry file-name-handler-alist)))))))
2282 2296
2283;; `tramp-file-name-handler' must be registered before evaluation of 2297(eval-after-load 'tramp (tramp-register-file-name-handlers))
2284;; site-start and init files, because there might exist remote files
2285;; already, f.e. files kept via recentf-mode.
2286;;;###autoload
2287(tramp-register-file-name-handlers)
2288 2298
2289(defun tramp-exists-file-name-handler (operation &rest args) 2299(defun tramp-exists-file-name-handler (operation &rest args)
2290 "Check, whether OPERATION runs a file name handler." 2300 "Check, whether OPERATION runs a file name handler."
diff --git a/src/ChangeLog b/src/ChangeLog
index 96c46d09624..34ae84c788f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12014-04-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 * emacs.c (close_output_streams): Don't clear and restore errno.
4
52014-04-18 Jan Djärv <jan.h.d@swipnet.se>
6
7 * xterm.c (x_make_frame_visible): Prevent endless loop when frame
8 never becomes visible, i.e. using XMonad (Bug#17237).
9
102014-04-18 Eli Zaretskii <eliz@gnu.org>
11
12 * xdisp.c (insert_left_trunc_glyphs): Ensure the left truncation
13 glyph is written to TEXT_AREA of the temporary glyph_row. (Bug#17288)
14 (Fline_pixel_height): Don't assume that the current buffer and the
15 selected window's buffer are one and the same. (Bug#17281)
16
17 * insdel.c (invalidate_buffer_caches): Invalidate the bidi
18 paragraph-start cache before the newline cache. (Bug#17269)
19
12014-04-17 Paul Eggert <eggert@cs.ucla.edu> 202014-04-17 Paul Eggert <eggert@cs.ucla.edu>
2 21
3 * term.c (tty_send_additional_strings): No need to fflush here, 22 * term.c (tty_send_additional_strings): No need to fflush here,
@@ -23,6 +42,7 @@
23 42
242014-04-16 Eli Zaretskii <eliz@gnu.org> 432014-04-16 Eli Zaretskii <eliz@gnu.org>
25 44
45 Fix the MSDOS build.
26 * unexcoff.c [MSDOS]: Include libc/atexit.h. 46 * unexcoff.c [MSDOS]: Include libc/atexit.h.
27 (copy_text_and_data): Zero out the atexit chain pointer before 47 (copy_text_and_data): Zero out the atexit chain pointer before
28 dumping Emacs. 48 dumping Emacs.
diff --git a/src/emacs.c b/src/emacs.c
index 9cfc09469c2..deebb2280c7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -690,11 +690,6 @@ void (*__malloc_initialize_hook) (void) EXTERNALLY_VISIBLE = malloc_initialize_h
690static void 690static void
691close_output_streams (void) 691close_output_streams (void)
692{ 692{
693 int err = errno;
694
695 /* close_stream checks errno, so make sure it doesn't inherit some
696 random value. */
697 errno = 0;
698 if (close_stream (stdout) != 0) 693 if (close_stream (stdout) != 0)
699 { 694 {
700 emacs_perror ("Write error to standard output"); 695 emacs_perror ("Write error to standard output");
@@ -703,8 +698,6 @@ close_output_streams (void)
703 698
704 if (close_stream (stderr) != 0) 699 if (close_stream (stderr) != 0)
705 _exit (EXIT_FAILURE); 700 _exit (EXIT_FAILURE);
706
707 errno = err;
708} 701}
709 702
710/* ARGSUSED */ 703/* ARGSUSED */
diff --git a/src/insdel.c b/src/insdel.c
index 82896758a15..2894af75348 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1849,14 +1849,9 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
1849 need to consider the caches of their base buffer. */ 1849 need to consider the caches of their base buffer. */
1850 if (buf->base_buffer) 1850 if (buf->base_buffer)
1851 buf = buf->base_buffer; 1851 buf = buf->base_buffer;
1852 if (buf->newline_cache) 1852 /* The bidi_paragraph_cache must be invalidated first, because doing
1853 invalidate_region_cache (buf, 1853 so might need to use the newline_cache (via find_newline_no_quit,
1854 buf->newline_cache, 1854 see below). */
1855 start - BUF_BEG (buf), BUF_Z (buf) - end);
1856 if (buf->width_run_cache)
1857 invalidate_region_cache (buf,
1858 buf->width_run_cache,
1859 start - BUF_BEG (buf), BUF_Z (buf) - end);
1860 if (buf->bidi_paragraph_cache) 1855 if (buf->bidi_paragraph_cache)
1861 { 1856 {
1862 if (start != end 1857 if (start != end
@@ -1880,13 +1875,20 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
1880 &start_byte); 1875 &start_byte);
1881 set_buffer_internal (old); 1876 set_buffer_internal (old);
1882 } 1877 }
1883 if (line_beg > BUF_BEG (buf)) 1878 start = line_beg - (line_beg > BUF_BEG (buf));
1884 start = line_beg - 1;
1885 } 1879 }
1886 invalidate_region_cache (buf, 1880 invalidate_region_cache (buf,
1887 buf->bidi_paragraph_cache, 1881 buf->bidi_paragraph_cache,
1888 start - BUF_BEG (buf), BUF_Z (buf) - end); 1882 start - BUF_BEG (buf), BUF_Z (buf) - end);
1889 } 1883 }
1884 if (buf->newline_cache)
1885 invalidate_region_cache (buf,
1886 buf->newline_cache,
1887 start - BUF_BEG (buf), BUF_Z (buf) - end);
1888 if (buf->width_run_cache)
1889 invalidate_region_cache (buf,
1890 buf->width_run_cache,
1891 start - BUF_BEG (buf), BUF_Z (buf) - end);
1890} 1892}
1891 1893
1892/* These macros work with an argument named `preserve_ptr' 1894/* These macros work with an argument named `preserve_ptr'
diff --git a/src/xdisp.c b/src/xdisp.c
index 067d9f6ac0e..bb91d6f5e1f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1262,12 +1262,23 @@ Value is the height in pixels of the line at point. */)
1262 struct it it; 1262 struct it it;
1263 struct text_pos pt; 1263 struct text_pos pt;
1264 struct window *w = XWINDOW (selected_window); 1264 struct window *w = XWINDOW (selected_window);
1265 struct buffer *old_buffer = NULL;
1266 Lisp_Object result;
1265 1267
1268 if (XBUFFER (w->contents) != current_buffer)
1269 {
1270 old_buffer = current_buffer;
1271 set_buffer_internal_1 (XBUFFER (w->contents));
1272 }
1266 SET_TEXT_POS (pt, PT, PT_BYTE); 1273 SET_TEXT_POS (pt, PT, PT_BYTE);
1267 start_display (&it, w, pt); 1274 start_display (&it, w, pt);
1268 it.vpos = it.current_y = 0; 1275 it.vpos = it.current_y = 0;
1269 last_height = 0; 1276 last_height = 0;
1270 return make_number (line_bottom_y (&it)); 1277 result = make_number (line_bottom_y (&it));
1278 if (old_buffer)
1279 set_buffer_internal_1 (old_buffer);
1280
1281 return result;
1271} 1282}
1272 1283
1273/* Return the default pixel height of text lines in window W. The 1284/* Return the default pixel height of text lines in window W. The
@@ -18677,6 +18688,7 @@ insert_left_trunc_glyphs (struct it *it)
18677 truncate_it.current_x = 0; 18688 truncate_it.current_x = 0;
18678 truncate_it.face_id = DEFAULT_FACE_ID; 18689 truncate_it.face_id = DEFAULT_FACE_ID;
18679 truncate_it.glyph_row = &scratch_glyph_row; 18690 truncate_it.glyph_row = &scratch_glyph_row;
18691 truncate_it.area = TEXT_AREA;
18680 truncate_it.glyph_row->used[TEXT_AREA] = 0; 18692 truncate_it.glyph_row->used[TEXT_AREA] = 0;
18681 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; 18693 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1;
18682 truncate_it.object = make_number (0); 18694 truncate_it.object = make_number (0);
diff --git a/src/xterm.c b/src/xterm.c
index dd71a8a1986..85daee66717 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8900,6 +8900,7 @@ void
8900x_make_frame_visible (struct frame *f) 8900x_make_frame_visible (struct frame *f)
8901{ 8901{
8902 int original_top, original_left; 8902 int original_top, original_left;
8903 int tries = 0;
8903 8904
8904 block_input (); 8905 block_input ();
8905 8906
@@ -9007,7 +9008,13 @@ x_make_frame_visible (struct frame *f)
9007 /* Force processing of queued events. */ 9008 /* Force processing of queued events. */
9008 x_sync (f); 9009 x_sync (f);
9009 9010
9010 /* This hack is still in use at least for Cygwin. See 9011 /* If on another desktop, the deiconify/map may be ignored and the
9012 frame never becomes visible. XMonad does this.
9013 Prevent an endless loop. */
9014 if (FRAME_ICONIFIED_P (f) && ++tries > 100)
9015 break;
9016
9017 /* This hack is still in use at least for Cygwin. See
9011 http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. 9018 http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
9012 9019
9013 Machines that do polling rather than SIGIO have been 9020 Machines that do polling rather than SIGIO have been
diff --git a/test/ChangeLog b/test/ChangeLog
index 504cf85c5ec..4986280f5f1 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,18 @@
12014-04-18 Michael Albinus <michael.albinus@gmx.de>
2
3 * automated/tramp-tests.el (tramp-copy-size-limit): Set to nil.
4 (tramp--test-make-temp-name): Optional argument LOCAL.
5 (tramp--instrument-test-case): Show messages. Catch also `quit'.
6 (tramp-test10-write-region): No special test for out-of-band copy
7 needed anymore.
8 (tramp-test11-copy-file, tramp-test12-rename-file)
9 (tramp-test21-file-links): Extend tests.
10 (tramp-test20-file-modes): More robust check for user "root".
11 (tramp--test-check-files): New defun.
12 (tramp-test30-special-characters, tramp-test33-recursive-load)
13 (tramp-test34-unload): New tests.
14 (tramp-test31-utf8, tramp-test32-asynchronous-requests): Rename.
15
12014-04-11 Glenn Morris <rgm@gnu.org> 162014-04-11 Glenn Morris <rgm@gnu.org>
2 17
3 * automated/Makefile.in (EMACSDATA, EMACSDOC, EMACSPATH): Unexport. 18 * automated/Makefile.in (EMACSDATA, EMACSDOC, EMACSPATH): Unexport.
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index 7bf0ab4e9c8..dff9103c4a7 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -56,6 +56,7 @@
56 56
57(setq password-cache-expiry nil 57(setq password-cache-expiry nil
58 tramp-verbose 0 58 tramp-verbose 0
59 tramp-copy-size-limit nil
59 tramp-message-show-message nil) 60 tramp-message-show-message nil)
60 61
61;; Disable interactive passwords in batch mode. 62;; Disable interactive passwords in batch mode.
@@ -92,10 +93,11 @@ being the result.")
92 ;; Return result. 93 ;; Return result.
93 (cdr tramp--test-enabled-checked)) 94 (cdr tramp--test-enabled-checked))
94 95
95(defun tramp--test-make-temp-name () 96(defun tramp--test-make-temp-name (&optional local)
96 "Create a temporary file name for test." 97 "Create a temporary file name for test."
97 (expand-file-name 98 (expand-file-name
98 (make-temp-name "tramp-test") tramp-test-temporary-file-directory)) 99 (make-temp-name "tramp-test")
100 (if local temporary-file-directory tramp-test-temporary-file-directory)))
99 101
100(defmacro tramp--instrument-test-case (verbose &rest body) 102(defmacro tramp--instrument-test-case (verbose &rest body)
101 "Run BODY with `tramp-verbose' equal VERBOSE. 103 "Run BODY with `tramp-verbose' equal VERBOSE.
@@ -103,12 +105,17 @@ Print the the content of the Tramp debug buffer, if BODY does not
103eval properly in `should', `should-not' or `should-error'." 105eval properly in `should', `should-not' or `should-error'."
104 (declare (indent 1) (debug (natnump body))) 106 (declare (indent 1) (debug (natnump body)))
105 `(let ((tramp-verbose ,verbose) 107 `(let ((tramp-verbose ,verbose)
108 (tramp-message-show-message t)
106 (tramp-debug-on-error t)) 109 (tramp-debug-on-error t))
107 (condition-case err 110 (condition-case err
108 (progn ,@body) 111 ;; In general, we cannot use a timeout here: this would
112 ;; prevent traces when the test runs into an error.
113; (with-timeout (10 (ert-fail "`tramp--instrument-test-case' timed out"))
114 (progn
115 ,@body)
109 (ert-test-skipped 116 (ert-test-skipped
110 (signal (car err) (cdr err))) 117 (signal (car err) (cdr err)))
111 (error 118 ((error quit)
112 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil 119 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
113 (with-current-buffer (tramp-get-connection-buffer v) 120 (with-current-buffer (tramp-get-connection-buffer v)
114 (message "%s" (buffer-string))) 121 (message "%s" (buffer-string)))
@@ -662,15 +669,7 @@ and `file-name-nondirectory'."
662 (write-region 3 5 tmp-name)) 669 (write-region 3 5 tmp-name))
663 (with-temp-buffer 670 (with-temp-buffer
664 (insert-file-contents tmp-name) 671 (insert-file-contents tmp-name)
665 (should (string-equal (buffer-string) "34"))) 672 (should (string-equal (buffer-string) "34"))))
666 ;; Trigger out-of-band copy.
667 (let ((string ""))
668 (while (<= (length string) tramp-copy-size-limit)
669 (setq string (concat string (md5 string))))
670 (write-region string nil tmp-name)
671 (with-temp-buffer
672 (insert-file-contents tmp-name)
673 (should (string-equal (buffer-string) string)))))
674 (ignore-errors (delete-file tmp-name))))) 673 (ignore-errors (delete-file tmp-name)))))
675 674
676(ert-deftest tramp-test11-copy-file () 675(ert-deftest tramp-test11-copy-file ()
@@ -678,7 +677,12 @@ and `file-name-nondirectory'."
678 (skip-unless (tramp--test-enabled)) 677 (skip-unless (tramp--test-enabled))
679 678
680 (let ((tmp-name1 (tramp--test-make-temp-name)) 679 (let ((tmp-name1 (tramp--test-make-temp-name))
681 (tmp-name2 (tramp--test-make-temp-name))) 680 (tmp-name2 (tramp--test-make-temp-name))
681 (tmp-name3 (tramp--test-make-temp-name))
682 (tmp-name4 (tramp--test-make-temp-name 'local))
683 (tmp-name5 (tramp--test-make-temp-name 'local)))
684
685 ;; Copy on remote side.
682 (unwind-protect 686 (unwind-protect
683 (progn 687 (progn
684 (write-region "foo" nil tmp-name1) 688 (write-region "foo" nil tmp-name1)
@@ -686,17 +690,69 @@ and `file-name-nondirectory'."
686 (should (file-exists-p tmp-name2)) 690 (should (file-exists-p tmp-name2))
687 (with-temp-buffer 691 (with-temp-buffer
688 (insert-file-contents tmp-name2) 692 (insert-file-contents tmp-name2)
689 (should (string-equal (buffer-string) "foo")))) 693 (should (string-equal (buffer-string) "foo")))
690 (ignore-errors 694 (should-error (copy-file tmp-name1 tmp-name2))
691 (delete-file tmp-name1) 695 (copy-file tmp-name1 tmp-name2 'ok)
692 (delete-file tmp-name2))))) 696 (make-directory tmp-name3)
697 (copy-file tmp-name1 tmp-name3)
698 (should
699 (file-exists-p
700 (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3))))
701 (ignore-errors (delete-file tmp-name1))
702 (ignore-errors (delete-file tmp-name2))
703 (ignore-errors (delete-directory tmp-name3 'recursive)))
704
705 ;; Copy from remote side to local side.
706 (unwind-protect
707 (progn
708 (write-region "foo" nil tmp-name1)
709 (copy-file tmp-name1 tmp-name4)
710 (should (file-exists-p tmp-name4))
711 (with-temp-buffer
712 (insert-file-contents tmp-name4)
713 (should (string-equal (buffer-string) "foo")))
714 (should-error (copy-file tmp-name1 tmp-name4))
715 (copy-file tmp-name1 tmp-name4 'ok)
716 (make-directory tmp-name5)
717 (copy-file tmp-name1 tmp-name5)
718 (should
719 (file-exists-p
720 (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5))))
721 (ignore-errors (delete-file tmp-name1))
722 (ignore-errors (delete-file tmp-name4))
723 (ignore-errors (delete-directory tmp-name5 'recursive)))
724
725 ;; Copy from local side to remote side.
726 (unwind-protect
727 (progn
728 (write-region "foo" nil tmp-name4 nil 'nomessage)
729 (copy-file tmp-name4 tmp-name1)
730 (should (file-exists-p tmp-name1))
731 (with-temp-buffer
732 (insert-file-contents tmp-name1)
733 (should (string-equal (buffer-string) "foo")))
734 (should-error (copy-file tmp-name4 tmp-name1))
735 (copy-file tmp-name4 tmp-name1 'ok)
736 (make-directory tmp-name3)
737 (copy-file tmp-name4 tmp-name3)
738 (should
739 (file-exists-p
740 (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3))))
741 (ignore-errors (delete-file tmp-name1))
742 (ignore-errors (delete-file tmp-name4))
743 (ignore-errors (delete-directory tmp-name3 'recursive)))))
693 744
694(ert-deftest tramp-test12-rename-file () 745(ert-deftest tramp-test12-rename-file ()
695 "Check `rename-file'." 746 "Check `rename-file'."
696 (skip-unless (tramp--test-enabled)) 747 (skip-unless (tramp--test-enabled))
697 748
698 (let ((tmp-name1 (tramp--test-make-temp-name)) 749 (let ((tmp-name1 (tramp--test-make-temp-name))
699 (tmp-name2 (tramp--test-make-temp-name))) 750 (tmp-name2 (tramp--test-make-temp-name))
751 (tmp-name3 (tramp--test-make-temp-name))
752 (tmp-name4 (tramp--test-make-temp-name 'local))
753 (tmp-name5 (tramp--test-make-temp-name 'local)))
754
755 ;; Rename on remote side.
700 (unwind-protect 756 (unwind-protect
701 (progn 757 (progn
702 (write-region "foo" nil tmp-name1) 758 (write-region "foo" nil tmp-name1)
@@ -705,8 +761,71 @@ and `file-name-nondirectory'."
705 (should (file-exists-p tmp-name2)) 761 (should (file-exists-p tmp-name2))
706 (with-temp-buffer 762 (with-temp-buffer
707 (insert-file-contents tmp-name2) 763 (insert-file-contents tmp-name2)
708 (should (string-equal (buffer-string) "foo")))) 764 (should (string-equal (buffer-string) "foo")))
709 (ignore-errors (delete-file tmp-name2))))) 765 (write-region "foo" nil tmp-name1)
766 (should-error (rename-file tmp-name1 tmp-name2))
767 (rename-file tmp-name1 tmp-name2 'ok)
768 (should-not (file-exists-p tmp-name1))
769 (write-region "foo" nil tmp-name1)
770 (make-directory tmp-name3)
771 (rename-file tmp-name1 tmp-name3)
772 (should-not (file-exists-p tmp-name1))
773 (should
774 (file-exists-p
775 (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3))))
776 (ignore-errors (delete-file tmp-name1))
777 (ignore-errors (delete-file tmp-name2))
778 (ignore-errors (delete-directory tmp-name3 'recursive)))
779
780 ;; Rename from remote side to local side.
781 (unwind-protect
782 (progn
783 (write-region "foo" nil tmp-name1)
784 (rename-file tmp-name1 tmp-name4)
785 (should-not (file-exists-p tmp-name1))
786 (should (file-exists-p tmp-name4))
787 (with-temp-buffer
788 (insert-file-contents tmp-name4)
789 (should (string-equal (buffer-string) "foo")))
790 (write-region "foo" nil tmp-name1)
791 (should-error (rename-file tmp-name1 tmp-name4))
792 (rename-file tmp-name1 tmp-name4 'ok)
793 (should-not (file-exists-p tmp-name1))
794 (write-region "foo" nil tmp-name1)
795 (make-directory tmp-name5)
796 (rename-file tmp-name1 tmp-name5)
797 (should-not (file-exists-p tmp-name1))
798 (should
799 (file-exists-p
800 (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5))))
801 (ignore-errors (delete-file tmp-name1))
802 (ignore-errors (delete-file tmp-name4))
803 (ignore-errors (delete-directory tmp-name5 'recursive)))
804
805 ;; Rename from local side to remote side.
806 (unwind-protect
807 (progn
808 (write-region "foo" nil tmp-name4 nil 'nomessage)
809 (rename-file tmp-name4 tmp-name1)
810 (should-not (file-exists-p tmp-name4))
811 (should (file-exists-p tmp-name1))
812 (with-temp-buffer
813 (insert-file-contents tmp-name1)
814 (should (string-equal (buffer-string) "foo")))
815 (write-region "foo" nil tmp-name4 nil 'nomessage)
816 (should-error (rename-file tmp-name4 tmp-name1))
817 (rename-file tmp-name4 tmp-name1 'ok)
818 (should-not (file-exists-p tmp-name4))
819 (write-region "foo" nil tmp-name4 nil 'nomessage)
820 (make-directory tmp-name3)
821 (rename-file tmp-name4 tmp-name3)
822 (should-not (file-exists-p tmp-name4))
823 (should
824 (file-exists-p
825 (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3))))
826 (ignore-errors (delete-file tmp-name1))
827 (ignore-errors (delete-file tmp-name4))
828 (ignore-errors (delete-directory tmp-name3 'recursive)))))
710 829
711(ert-deftest tramp-test13-make-directory () 830(ert-deftest tramp-test13-make-directory ()
712 "Check `make-directory'. 831 "Check `make-directory'.
@@ -930,7 +1049,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
930 (should (= (file-modes tmp-name) #o444)) 1049 (should (= (file-modes tmp-name) #o444))
931 (should-not (file-executable-p tmp-name)) 1050 (should-not (file-executable-p tmp-name))
932 ;; A file is always writable for user "root". 1051 ;; A file is always writable for user "root".
933 (when (not (string-equal (file-remote-p tmp-name 'user) "root")) 1052 (unless (zerop (nth 2 (file-attributes tmp-name)))
934 (should-not (file-writable-p tmp-name)))) 1053 (should-not (file-writable-p tmp-name))))
935 (ignore-errors (delete-file tmp-name))))) 1054 (ignore-errors (delete-file tmp-name)))))
936 1055
@@ -941,7 +1060,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
941 1060
942 (let ((tmp-name1 (tramp--test-make-temp-name)) 1061 (let ((tmp-name1 (tramp--test-make-temp-name))
943 (tmp-name2 (tramp--test-make-temp-name)) 1062 (tmp-name2 (tramp--test-make-temp-name))
944 (tmp-name3 (make-temp-name "tramp-"))) 1063 (tmp-name3 (tramp--test-make-temp-name 'local)))
945 (unwind-protect 1064 (unwind-protect
946 (progn 1065 (progn
947 (write-region "foo" nil tmp-name1) 1066 (write-region "foo" nil tmp-name1)
@@ -988,16 +1107,18 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
988 (should (file-symlink-p tmp-name2)) 1107 (should (file-symlink-p tmp-name2))
989 (should-not (string-equal tmp-name2 (file-truename tmp-name2))) 1108 (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
990 (should 1109 (should
991 (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) 1110 (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
1111 (should (file-equal-p tmp-name1 tmp-name2)))
992 (ignore-errors 1112 (ignore-errors
993 (delete-file tmp-name1) 1113 (delete-file tmp-name1)
994 (delete-file tmp-name2))) 1114 (delete-file tmp-name2)))
995 1115
996 ;; `file-truename' shall preserve trailing link of directories. 1116 ;; `file-truename' shall preserve trailing link of directories.
997 (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory)) 1117 (unless (file-symlink-p tramp-test-temporary-file-directory)
998 (dir2 (file-name-as-directory dir1))) 1118 (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory))
999 (should (string-equal (file-truename dir1) (expand-file-name dir1))) 1119 (dir2 (file-name-as-directory dir1)))
1000 (should (string-equal (file-truename dir2) (expand-file-name dir2)))))) 1120 (should (string-equal (file-truename dir1) (expand-file-name dir1)))
1121 (should (string-equal (file-truename dir2) (expand-file-name dir2)))))))
1001 1122
1002(ert-deftest tramp-test22-file-times () 1123(ert-deftest tramp-test22-file-times ()
1003 "Check `set-file-times' and `file-newer-than-file-p'." 1124 "Check `set-file-times' and `file-newer-than-file-p'."
@@ -1295,35 +1416,61 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1295 1416
1296 (ignore-errors (delete-directory tmp-name1 'recursive))))) 1417 (ignore-errors (delete-directory tmp-name1 'recursive)))))
1297 1418
1298(ert-deftest tramp-test30-utf8 () 1419(defun tramp--test-check-files (&rest files)
1299 "Check UTF8 encoding in file names and file contents." 1420 "Runs a simple but comprehensive test over every file in FILES."
1300 (skip-unless (tramp--test-enabled)) 1421 (let ((tmp-name (tramp--test-make-temp-name)))
1301
1302 (let ((tmp-name (tramp--test-make-temp-name))
1303 (coding-system-for-read 'utf-8)
1304 (coding-system-for-write 'utf-8)
1305 (arabic "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
1306 (chinese "银河系漫游指南系列")
1307 (russian "Автостопом по гала́ктике"))
1308 (unwind-protect 1422 (unwind-protect
1309 (progn 1423 (progn
1310 (make-directory tmp-name) 1424 (make-directory tmp-name)
1311 (dolist (lang `(,arabic ,chinese ,russian)) 1425 (dolist (elt files)
1312 (let ((file (expand-file-name lang tmp-name))) 1426 (let ((file (expand-file-name elt tmp-name)))
1313 (write-region lang nil file) 1427 (write-region elt nil file)
1314 (should (file-exists-p file)) 1428 (should (file-exists-p file))
1315 ;; Check file contents. 1429 ;; Check file contents.
1316 (with-temp-buffer 1430 (with-temp-buffer
1317 (insert-file-contents file) 1431 (insert-file-contents file)
1318 (should (string-equal (buffer-string) lang))))) 1432 (should (string-equal (buffer-string) elt)))))
1319 ;; Check file names. 1433 ;; Check file names.
1320 (should (equal (directory-files 1434 (should (equal (directory-files
1321 tmp-name nil directory-files-no-dot-files-regexp) 1435 tmp-name nil directory-files-no-dot-files-regexp)
1322 (sort `(,arabic ,chinese ,russian) 'string-lessp)))) 1436 (sort files 'string-lessp))))
1323 (ignore-errors (delete-directory tmp-name 'recursive))))) 1437 (ignore-errors (delete-directory tmp-name 'recursive)))))
1324 1438
1439;; This test is inspired by Bug#17238.
1440(ert-deftest tramp-test30-special-characters ()
1441 "Check special characters in file names."
1442 (skip-unless (tramp--test-enabled))
1443
1444 ;; Newlines and slashes in file names are not supported. So we don't test.
1445 (tramp--test-check-files
1446 " foo bar\tbaz "
1447 "$foo$bar$$baz$"
1448 "-foo-bar-baz-"
1449 "%foo%bar%baz%"
1450 "&foo&bar&baz&"
1451 "?foo?bar?baz?"
1452 "*foo*bar*baz*"
1453 "'foo\"bar'baz\""
1454 "\\foo\\bar\\baz\\"
1455 "#foo#bar#baz#"
1456 "!foo|bar!baz|"
1457 ":foo;bar:baz;"
1458 "<foo>bar<baz>"
1459 "(foo)bar(baz)"))
1460
1461(ert-deftest tramp-test31-utf8 ()
1462 "Check UTF8 encoding in file names and file contents."
1463 (skip-unless (tramp--test-enabled))
1464
1465 (let ((coding-system-for-read 'utf-8)
1466 (coding-system-for-write 'utf-8))
1467 (tramp--test-check-files
1468 "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت"
1469 "银河系漫游指南系列"
1470 "Автостопом по гала́ктике")))
1471
1325;; This test is inspired by Bug#16928. 1472;; This test is inspired by Bug#16928.
1326(ert-deftest tramp-test31-asynchronous-requests () 1473(ert-deftest tramp-test32-asynchronous-requests ()
1327 "Check parallel asynchronous requests. 1474 "Check parallel asynchronous requests.
1328Such requests could arrive from timers, process filters and 1475Such requests could arrive from timers, process filters and
1329process sentinels. They shall not disturb each other." 1476process sentinels. They shall not disturb each other."
@@ -1412,6 +1559,62 @@ process sentinels. They shall not disturb each other."
1412 (dolist (buf buffers) 1559 (dolist (buf buffers)
1413 (ignore-errors (kill-buffer buf))))))) 1560 (ignore-errors (kill-buffer buf)))))))
1414 1561
1562(ert-deftest tramp-test33-recursive-load ()
1563 "Check that Tramp does not fail due to recursive load."
1564 (skip-unless (tramp--test-enabled))
1565
1566 (dolist (code
1567 (list
1568 (format
1569 "(expand-file-name %S))"
1570 tramp-test-temporary-file-directory)
1571 (format
1572 "(let ((default-directory %S)) (expand-file-name %S))"
1573 tramp-test-temporary-file-directory
1574 temporary-file-directory)))
1575 (should-not
1576 (string-match
1577 "Recursive load"
1578 (shell-command-to-string
1579 (format
1580 "%s -batch -Q -L %s --eval %s"
1581 (expand-file-name invocation-name invocation-directory)
1582 (mapconcat 'shell-quote-argument load-path " -L ")
1583 (shell-quote-argument code)))))))
1584
1585(ert-deftest tramp-test34-unload ()
1586 "Check that Tramp and its subpackages unload completely.
1587Since it unloads Tramp, it shall be the last test to run."
1588 ;; Mark as failed until all symbols are unbound.
1589 :expected-result (if (featurep 'tramp) :failed :passed)
1590 (when (featurep 'tramp)
1591 (unload-feature 'tramp 'force)
1592 ;; No Tramp feature must be left.
1593 (should-not (featurep 'tramp))
1594 (should-not (all-completions "tramp" (delq 'tramp-tests features)))
1595 ;; `file-name-handler-alist' must be clean.
1596 (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist)))
1597 ;; There shouldn't be left a bound symbol. We do not regard our
1598 ;; test symbols, and the Tramp unload hooks.
1599 (mapatoms
1600 (lambda (x)
1601 (and (or (boundp x) (functionp x))
1602 (string-match "^tramp" (symbol-name x))
1603 (not (string-match "^tramp--?test" (symbol-name x)))
1604 (not (string-match "unload-hook$" (symbol-name x)))
1605 (ert-fail (format "`%s' still bound" x)))))
1606; (progn (message "`%s' still bound" x)))))
1607 ;; There shouldn't be left a hook function containing a Tramp
1608 ;; function. We do not regard the Tramp unload hooks.
1609 (mapatoms
1610 (lambda (x)
1611 (and (boundp x)
1612 (string-match "-hooks?$" (symbol-name x))
1613 (not (string-match "unload-hook$" (symbol-name x)))
1614 (consp (symbol-value x))
1615 (ignore-errors (all-completions "tramp" (symbol-value x)))
1616 (ert-fail (format "Hook `%s' still contains Tramp function" x)))))))
1617
1415;; TODO: 1618;; TODO:
1416 1619
1417;; * dired-compress-file 1620;; * dired-compress-file
@@ -1426,8 +1629,11 @@ process sentinels. They shall not disturb each other."
1426 1629
1427;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). 1630;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
1428;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). 1631;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message).
1429;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'. 1632;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when
1430;; * Fix Bug#16928. Set expected error of `tramp-test31-asynchronous-requests'. 1633;; target is a dumb busybox). Seems to be in `directory-files'.
1634;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'.
1635;; * Fix `tramp-test34-unload' (Not all symbols are unbound). Set
1636;; expected error.
1431 1637
1432(defun tramp-test-all (&optional interactive) 1638(defun tramp-test-all (&optional interactive)
1433 "Run all tests for \\[tramp]." 1639 "Run all tests for \\[tramp]."