unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Kaushal Modi <kaushal.modi@gmail.com>,
	Dmitry Gutov <dgutov@yandex.ru>,
	Emacs developers <emacs-devel@gnu.org>,
	Michael Albinus <michael.albinus@gmx.de>
Subject: Re: Recursive load? master build fail
Date: Sun, 8 May 2016 00:17:08 -0700	[thread overview]
Message-ID: <572EE7F4.4060100@cs.ucla.edu> (raw)
In-Reply-To: <572E9CCB.7070401@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 129 bytes --]

After some experimenting I narrowed it down to the attached patch: reverting
this change unbreaks the build on master. Michael?


[-- Attachment #2: 0001-Continue-to-fix-Bug-10085.patch --]
[-- Type: text/x-diff, Size: 6534 bytes --]

From 97776f295d652aff97be91431ad53db5618ad2a2 Mon Sep 17 00:00:00 2001
From: Michael Albinus <michael.albinus@gmx.de>
Date: Sat, 7 May 2016 22:52:30 +0200
Subject: [PATCH] Continue to fix Bug#10085

* lisp/net/tramp.el (tramp-completion-file-name-handler-alist)
<expand-file-name>: Add handler.
(tramp-completion-handle-expand-file-name): New defun.
(tramp-handle-file-name-as-directory): Handle completion mode case.

* test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name):
Fix test.
(tramp-test24-file-name-completion): Extend test.
---
 lisp/net/tramp.el            | 31 +++++++++++++++++---
 test/lisp/net/tramp-tests.el | 67 +++++++++++++++++++++++++++++++-------------
 2 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3da60e9..87ccae1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1010,7 +1010,9 @@ tramp-current-connection
 
 ;;;###autoload
 (defconst tramp-completion-file-name-handler-alist
-  '((file-name-all-completions . tramp-completion-handle-file-name-all-completions)
+  '((expand-file-name . tramp-completion-handle-expand-file-name)
+    (file-name-all-completions
+     . tramp-completion-handle-file-name-all-completions)
     (file-name-completion . tramp-completion-handle-file-name-completion))
   "Alist of completion handler functions.
 Used for file names matching `tramp-file-name-regexp'. Operations
@@ -2261,6 +2263,23 @@ tramp-connectable-p
 		    (p (tramp-get-connection-process v)))
 	       (and p (processp p) (memq (process-status p) '(run open))))))))
 
+;;;###autoload
+(defun tramp-completion-handle-expand-file-name
+    (name &optional dir)
+  "Like `expand-file-name' for Tramp files."
+  (if (tramp-completion-mode-p)
+      (progn
+	;; If DIR is not given, use `default-directory' or "/".
+	(setq dir (or dir default-directory "/"))
+	;; Unless NAME is absolute, concat DIR and NAME.
+	(unless (file-name-absolute-p name)
+	  (setq name (concat (file-name-as-directory dir) name)))
+	;; Return NAME.
+	name)
+
+    (tramp-completion-run-real-handler
+     'expand-file-name (list name dir))))
+
 ;; Method, host name and user name completion.
 ;; `tramp-completion-dissect-file-name' returns a list of
 ;; tramp-file-name structures. For all of them we return possible completions.
@@ -2817,13 +2836,17 @@ tramp-handle-file-name-as-directory
   ;; `file-name-as-directory' would be sufficient except localname is
   ;; the empty string.
   (let ((v (tramp-dissect-file-name file t)))
-    ;; Run the command on the localname portion only.
+    ;; Run the command on the localname portion only unless we are in
+    ;; completion mode.
     (tramp-make-tramp-file-name
      (tramp-file-name-method v)
      (tramp-file-name-user v)
      (tramp-file-name-host v)
-     (tramp-run-real-handler
-      'file-name-as-directory (list (or (tramp-file-name-localname v) "")))
+     (if (and (tramp-completion-mode-p)
+	      (zerop (length (tramp-file-name-localname v))))
+	 ""
+       (tramp-run-real-handler
+	'file-name-as-directory (list (or (tramp-file-name-localname v) ""))))
      (tramp-file-name-hop v))))
 
 (defun tramp-handle-file-name-completion
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index efb19e9..a85eed0 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -649,7 +649,9 @@ tramp--instrument-test-case
 	  (setq file (format "/%s:" file))
 	  (should (string-equal (directory-file-name file) file))
 	  (should
-	   (string-equal (file-name-as-directory file) (concat file "./")))
+	   (string-equal
+	    (file-name-as-directory file)
+	    (if (tramp-completion-mode-p) file (concat file "./"))))
 	  (should (string-equal (file-name-directory file) file))
 	  (should (string-equal (file-name-nondirectory file) "")))))))
 
@@ -1367,25 +1369,52 @@ tramp--instrument-test-case
   "Check `file-name-completion' and `file-name-all-completions'."
   (skip-unless (tramp--test-enabled))
 
-  (let ((tmp-name (tramp--test-make-temp-name)))
-    (unwind-protect
-	(progn
-	  (make-directory tmp-name)
-	  (should (file-directory-p tmp-name))
-	  (write-region "foo" nil (expand-file-name "foo" tmp-name))
-	  (write-region "bar" nil (expand-file-name "bold" tmp-name))
-	  (make-directory (expand-file-name "boz" tmp-name))
-	  (should (equal (file-name-completion "fo" tmp-name) "foo"))
-	  (should (equal (file-name-completion "b" tmp-name) "bo"))
-	  (should
-	   (equal (file-name-completion "b" tmp-name 'file-directory-p) "boz/"))
-	  (should (equal (file-name-all-completions "fo" tmp-name) '("foo")))
-	  (should
-	   (equal (sort (file-name-all-completions "b" tmp-name) 'string-lessp)
-		  '("bold" "boz/"))))
+  (dolist (n-e '(nil t))
+    (let ((non-essential n-e)
+	  (tmp-name (tramp--test-make-temp-name))
+	  (method (file-remote-p tramp-test-temporary-file-directory 'method))
+	  (host (file-remote-p tramp-test-temporary-file-directory 'host)))
+
+      (unwind-protect
+	  (progn
+	    ;; Method and host name in completion mode.
+	    (when (tramp-completion-mode-p)
+	      (unless (zerop (length method))
+		(should
+		 (member
+		  (format "%s:" method)
+		  (file-name-all-completions (substring method 0 1) "/"))))
+	      (unless (zerop (length host))
+		(should
+		 (member
+		  (format "%s:" host)
+		  (file-name-all-completions (substring host 0 1) "/"))))
+	      (unless (or (zerop (length method)) (zerop (length host)))
+		(should
+		 (member
+		  (format "%s:" host)
+		  (file-name-all-completions
+		   (substring host 0 1) (format "/%s:" method))))))
+
+	    ;; Local files.
+	    (make-directory tmp-name)
+	    (should (file-directory-p tmp-name))
+	    (write-region "foo" nil (expand-file-name "foo" tmp-name))
+	    (write-region "bar" nil (expand-file-name "bold" tmp-name))
+	    (make-directory (expand-file-name "boz" tmp-name))
+	    (should (equal (file-name-completion "fo" tmp-name) "foo"))
+	    (should (equal (file-name-completion "b" tmp-name) "bo"))
+	    (should
+	     (equal
+	      (file-name-completion "b" tmp-name 'file-directory-p) "boz/"))
+	    (should (equal (file-name-all-completions "fo" tmp-name) '("foo")))
+	    (should
+	     (equal
+	      (sort (file-name-all-completions "b" tmp-name) 'string-lessp)
+	      '("bold" "boz/"))))
 
-      ;; Cleanup.
-      (ignore-errors (delete-directory tmp-name 'recursive)))))
+	;; Cleanup.
+	(ignore-errors (delete-directory tmp-name 'recursive))))))
 
 (ert-deftest tramp-test25-load ()
   "Check `load'."
-- 
2.7.4


  reply	other threads:[~2016-05-08  7:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 21:58 Recursive load? master build fail Kaushal Modi
2016-05-07 23:27 ` Dmitry Gutov
2016-05-08  0:08   ` Paul Eggert
2016-05-08  1:22     ` Kaushal Modi
2016-05-08  1:31       ` Kaushal Modi
2016-05-08  1:56         ` Paul Eggert
2016-05-08  7:17           ` Paul Eggert [this message]
2016-05-08  7:55             ` Michael Albinus
2016-05-08  9:50               ` Michael Albinus
2016-05-08 14:24                 ` Kaushal Modi
2016-05-08 19:00                   ` Colin Baxter
2016-05-11  5:22                     ` Colin Baxter
2016-05-08 19:13                 ` Paul Eggert
2016-05-08 22:06                   ` Michael Albinus
2016-05-09  6:43                     ` Paul Eggert
2016-05-09  7:23                       ` Michael Albinus
2016-05-11  6:17                         ` Paul Eggert
2016-05-11  7:23                           ` Michael Albinus
2016-05-11  9:45                             ` Stephen Berman
2016-05-11 15:08                               ` Michael Albinus
2016-05-11 19:02                                 ` Stephen Berman
2016-05-11 19:11                                   ` Michael Albinus
2016-05-11 19:31                                     ` Stephen Berman
2016-05-11 19:32                                       ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=572EE7F4.4060100@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).