;;; url-dav.el --- WebDAV support
-;; Copyright (C) 2001, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2012 Free Software Foundation, Inc.
;; Author: Bill Perry <wmperry@gnu.org>
;; Maintainer: Bill Perry <wmperry@gnu.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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, or (at your option)
-;; any later version.
+;; 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
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;; DAV is in RFC 2518.
"List of supported DAV versions.")
(defun url-intersection (l1 l2)
- "Return a list of the elements occuring in both of the lists L1 and L2."
+ "Return a list of the elements occurring in both of the lists L1 and L2."
(if (null l2)
l2
(let (result)
(list (concat "^" full-date)
(concat "T" partial-time)
(concat "Z" time-numoffset)))
- "List of regular expressions matching iso8601 dates.
+ "List of regular expressions matching ISO 8601 dates.
1st regular expression matches the date.
2nd regular expression matches the time.
3rd regular expression matches the (optional) timezone specification.")
;; We need to populate 'time' with
;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ)
- ;; Nobody else handles iso8601 correctly, lets do it ourselves.
+ ;; Nobody else handles iso8601 correctly, let's do it ourselves.
(when (string-match date-re date-string re-start)
(setq year (string-to-number (match-string 1 date-string))
month (string-to-number (match-string 2 date-string))
Automatically creates an XML request body if TAG is non-nil.
BODY is the XML document fragment to be enclosed by <TAG></TAG>.
-DEPTH is how deep the request should propogate. Default is 0, meaning
+DEPTH is how deep the request should propagate. Default is 0, meaning
it should apply only to URL. A negative number means to use
`Infinity' for the depth. Not all WebDAV servers support this depth
though.
;; Take care of the default value for depth...
(setq depth (or depth 0))
- ;; Now lets translate it into something webdav can understand.
+ ;; Now let's translate it into something webdav can understand.
(if (< depth 0)
(setq depth "Infinity")
(setq depth (int-to-string depth)))
depth nil namespaces))
(defmacro url-dav-http-success-p (status)
- "Return whether PROPERTIES was the result of a successful DAV request."
+ "Return whether STATUS was the result of a successful DAV request."
`(= (/ (or ,status 500) 100) 2))
\f
(defmacro url-dav-delete-something (url lock-token &rest error-checking)
"Delete URL completely, with no sanity checking whatsoever. DO NOT USE.
This is defined as a macro that will not be visible from compiled files.
-Use with care, and even then think three times.
-"
+Use with care, and even then think three times."
`(progn
,@error-checking
(url-dav-request ,url "DELETE" nil nil -1
(setq status (plist-get (cdr result) 'DAV:status))
(if (not (url-dav-http-success-p status))
(signal 'file-error (list "Removing old name"
- "Errror removing"
+ "Error removing"
(car result) status))))
props))
nil)
(defun url-dav-directory-files (url &optional full match nosort files-only)
- "Return a list of names of files in DIRECTORY.
+ "Return a list of names of files in URL.
There are three optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the specified directory.
t))
(defun url-dav-file-name-all-completions (file url)
- "Return a list of all completions of file name FILE in directory DIRECTORY.
-These are all file names in directory DIRECTORY which begin with FILE."
+ "Return a list of all completions of file name FILE in URL.
+These are all file names in URL which begin with FILE."
(url-dav-directory-files url nil (concat "^" file ".*")))
(defun url-dav-file-name-completion (file url)
- "Complete file name FILE in directory DIRECTORY.
-Returns the longest string
-common to all file names in DIRECTORY that start with FILE.
+ "Complete file name FILE in URL.
+Returns the longest string common to all file names in URL
+that start with FILE.
If there is only one and FILE matches it exactly, returns t.
-Returns nil if DIR contains no name starting with FILE."
+Returns nil if URL contains no name starting with FILE."
(let ((matches (url-dav-file-name-all-completions file url))
(result nil))
(cond
;; Only one file and FILE matches it exactly...
t)
(t
- ;; Need to figure out the longest string that they have in commmon
+ ;; Need to figure out the longest string that they have in common
(setq matches (sort matches (lambda (a b) (> (length a) (length b)))))
(let ((n (length file))
(searching t)
(provide 'url-dav)
-;; arch-tag: 2b14b7b3-888a-49b8-a490-17276a40e78e
;;; url-dav.el ends here