summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog23
-rw-r--r--lisp/url/url-dav.el2
-rw-r--r--lisp/url/url-gw.el1
-rw-r--r--lisp/url/url-handlers.el42
-rw-r--r--lisp/url/url-http.el3
-rw-r--r--lisp/url/url-news.el3
-rw-r--r--lisp/url/url-tramp.el79
-rw-r--r--lisp/url/url-util.el15
-rw-r--r--lisp/url/url-vars.el7
-rw-r--r--lisp/url/url.el4
10 files changed, 141 insertions, 38 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 408f659681f..b445ff6d1f1 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,12 +1,31 @@
-2014-05-09 Michael Albinus <michael.albinus@gmx.de>
+2014-05-14 Glenn Morris <rgm@gnu.org>
+
+ * url-util.el (url-make-private-file): Use with-file-modes.
+
+2014-05-12 Michael Albinus <michael.albinus@gmx.de>
* url-handlers.el (url-file-handler-load-in-progress): New defvar.
(url-file-handler): Use it, in order to avoid recursive load.
-2014-05-01 Glenn Morris <rgm@gnu.org>
+2014-05-04 Glenn Morris <rgm@gnu.org>
* url-parse.el (url-generic-parse-url): Doc fix (replace `iff').
+2014-04-01 Michael Albinus <michael.albinus@gmx.de>
+
+ * url-tramp.el: New file.
+
+ * url-handlers.el (url-handler-regexp): Add ssh, scp, rsync and telnet.
+ Add :version.
+ (url-file-handler): Call `url-tramp-file-handler' if appropriate.
+
+2014-03-28 Glenn Morris <rgm@gnu.org>
+
+ * url-vars.el (url-bug-address): Make into an obsolete alias.
+ * url-http.el (url-http-handle-authentication):
+ * url-news.el (url-news-fetch-message-id):
+ Use M-x report-emacs-bug in help messages.
+
2014-03-26 Juanma Barranquero <lekktu@gmail.com>
* url-handlers.el (url-http-parse-response): Add autoload.
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index fcb6e70f4d7..6adb2d978af 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2001, 2004-2014 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
-;; Maintainer: Bill Perry <wmperry@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: url, vc
;; This file is part of GNU Emacs.
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el
index 2a9c6ead029..b1cc8a29e3b 100644
--- a/lisp/url/url-gw.el
+++ b/lisp/url/url-gw.el
@@ -3,6 +3,7 @@
;; Copyright (C) 1997-1998, 2004-2014 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: comm, data, processes
;; This file is part of GNU Emacs.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index b0f01123bbb..c86acb680d0 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -112,7 +112,7 @@ the mode if ARG is omitted or nil."
(push (cons url-handler-regexp 'url-file-handler)
file-name-handler-alist)))
-(defcustom url-handler-regexp "\\`\\(https?\\|ftp\\|file\\|nfs\\)://"
+(defcustom url-handler-regexp "\\`\\(https?\\|ftp\\|file\\|nfs\\|ssh\\|scp\\|rsync\\|telnet\\)://"
"Regular expression for URLs handled by `url-handler-mode'.
When URL Handler mode is enabled, this regular expression is
added to `file-name-handler-alist'.
@@ -123,6 +123,7 @@ regular expression avoids conflicts with local files that look
like URLs \(Gnus is particularly bad at this\)."
:group 'url
:type 'regexp
+ :version "24.5"
:set (lambda (symbol value)
(let ((enable url-handler-mode))
(url-handler-mode 0)
@@ -148,21 +149,30 @@ the arguments that would have been passed to OPERATION."
;; Avoid recursive load.
(if (and load-in-progress url-file-handler-load-in-progress)
(url-run-real-handler operation args)
- (let ((url-file-handler-load-in-progress load-in-progress)
- (fn (get operation 'url-file-handlers))
- (val nil)
- (hooked nil))
- (if (and (not fn) (intern-soft (format "url-%s" operation))
- (fboundp (intern-soft (format "url-%s" operation))))
- (error "Missing URL handler mapping for %s" operation))
- (if fn
- (setq hooked t
- val (save-match-data (apply fn args)))
- (setq hooked nil
- val (url-run-real-handler operation args)))
- (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real")
- operation args val)
- val)))
+ (let ((url-file-handler-load-in-progress load-in-progress))
+ ;; Check, whether there are arguments we want pass to Tramp.
+ (if (catch :do
+ (dolist (url (cons default-directory args))
+ (and (member
+ (url-type (url-generic-parse-url (and (stringp url) url)))
+ url-tramp-protocols)
+ (throw :do t))))
+ (apply 'url-tramp-file-handler operation args)
+ ;; Otherwise, let's do the job.
+ (let ((fn (get operation 'url-file-handlers))
+ (val nil)
+ (hooked nil))
+ (if (and (not fn) (intern-soft (format "url-%s" operation))
+ (fboundp (intern-soft (format "url-%s" operation))))
+ (error "Missing URL handler mapping for %s" operation))
+ (if fn
+ (setq hooked t
+ val (save-match-data (apply fn args)))
+ (setq hooked nil
+ val (url-run-real-handler operation args)))
+ (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real")
+ operation args val)
+ val)))))
(defun url-file-handler-identity (&rest args)
;; Identity function
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index ac2e1403d03..23e7d4b6074 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -3,6 +3,7 @@
;; Copyright (C) 1999, 2001, 2004-2014 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: comm, data, processes
;; This file is part of GNU Emacs.
@@ -414,7 +415,7 @@ Return the number of characters removed."
(goto-char (point-max))
(insert "<hr>Sorry, but I do not know how to handle " type
" authentication. If you'd like to write it,"
- " send it to " url-bug-address ".<hr>")
+ " please use M-x report-emacs-bug RET.<hr>")
;; We used to set a `status' var (declared "special") but I can't
;; find the corresponding let-binding, so it's probably an error.
;; FIXME: Maybe it was supposed to set `success', i.e. to return t?
diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el
index 105fb677374..0ce6d2e6cd1 100644
--- a/lisp/url/url-news.el
+++ b/lisp/url/url-news.el
@@ -70,8 +70,7 @@
" </xmp>\n"
" </p>\n"
" <p>\n"
- " If you If you feel this is an error, <a href=\""
- "mailto:" url-bug-address "\">send mail</a>\n"
+ " If you feel this is an error, M-x report-emacs-bug RET.\n"
" </p>\n"
" </div>\n"
" </body>\n"
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el
new file mode 100644
index 00000000000..83cedd1d62c
--- /dev/null
+++ b/lisp/url/url-tramp.el
@@ -0,0 +1,79 @@
+;;; url-tramp.el --- file-name-handler magic invoking Tramp for some protocols
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <michael.albinus@gmx.de>
+;; Keywords: comm, data, processes, hypermedia
+
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'url-parse)
+(require 'tramp)
+(require 'password-cache)
+
+;;;###autoload
+(defcustom url-tramp-protocols '("ftp" "ssh" "scp" "rsync" "telnet")
+ "List of URL protocols the work is handled by Tramp.
+They must also be covered by `url-handler-regexp'."
+ :group 'url
+ :version "24.5"
+ :type '(list string))
+
+(defun url-tramp-convert-url-to-tramp (url)
+ "Convert URL to a Tramp file name."
+ (let ((obj (url-generic-parse-url (and (stringp url) url))))
+ (if (member (url-type obj) url-tramp-protocols)
+ (progn
+ (if (url-password obj)
+ (password-cache-add
+ (tramp-make-tramp-file-name
+ (url-type obj) (url-user obj) (url-host obj) "")
+ (url-password obj))
+ (tramp-make-tramp-file-name
+ (url-type obj) (url-user obj) (url-host obj) (url-filename obj))))
+ url)))
+
+(defun url-tramp-convert-tramp-to-url (file)
+ "Convert FILE, a Tramp file name, to a URL."
+ (let ((obj (ignore-errors (tramp-dissect-file-name file))))
+ (if (member (tramp-file-name-method obj) url-tramp-protocols)
+ (url-recreate-url
+ (url-parse-make-urlobj
+ (tramp-file-name-method obj)
+ (tramp-file-name-user obj)
+ nil ; password.
+ (tramp-file-name-host obj)
+ nil ; port.
+ (tramp-file-name-localname obj)
+ nil nil t)) ; target attributes fullness.
+ file)))
+
+;;;###autoload
+(defun url-tramp-file-handler (operation &rest args)
+ "Function called from the `file-name-handler-alist' routines.
+OPERATION is what needs to be done. ARGS are the arguments that
+would have been passed to OPERATION."
+ (let ((default-directory (url-tramp-convert-url-to-tramp default-directory))
+ (args (mapcar 'url-tramp-convert-url-to-tramp args)))
+ (url-tramp-convert-tramp-to-url (apply operation args))))
+
+(provide 'url-tramp)
+
+;;; url-tramp.el ends here
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index a7d7e3e0fed..b796e769c60 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -1,9 +1,9 @@
;;; url-util.el --- Miscellaneous helper routines for URL library
-;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: comm, data, processes
;; This file is part of GNU Emacs.
@@ -628,14 +628,9 @@ Creates FILE and its parent directories if they do not exist."
(make-directory dir t)))
;; Based on doc-view-make-safe-dir.
(condition-case nil
- (let ((umask (default-file-modes)))
- (unwind-protect
- (progn
- (set-default-file-modes #o0600)
- (with-temp-buffer
- (write-region (point-min) (point-max)
- file nil 'silent nil 'excl)))
- (set-default-file-modes umask)))
+ (with-file-modes #o0600
+ (with-temp-buffer
+ (write-region (point-min) (point-max) file nil 'silent nil 'excl)))
(file-already-exists
(if (file-symlink-p file)
(error "Danger: `%s' is a symbolic link" file))
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index 4cdb59deb27..62b7b855533 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -1,7 +1,6 @@
;;; url-vars.el --- Variables for Uniform Resource Locator tool
-;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation, Inc.
;; Keywords: comm, data, processes, hypermedia
@@ -82,8 +81,8 @@ If non-nil and not t, the user will be asked for each refresh request."
:type 'boolean
:group 'url-cache)
-(defconst url-bug-address "bug-gnu-emacs@gnu.org"
- "Where to send bug reports.")
+(define-obsolete-variable-alias 'url-bug-address
+ 'report-emacs-bug-address "24.5")
(defcustom url-personal-mail-address nil
"Your full email address.
diff --git a/lisp/url/url.el b/lisp/url/url.el
index cbbcfd4f18b..620593a9a81 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -1,9 +1,9 @@
;;; url.el --- Uniform Resource Locator retrieval tool -*- lexical-binding: t -*-
-;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1996-1999, 2001, 2004-2014 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: comm, data, processes, hypermedia
;; This file is part of GNU Emacs.