forked from mirrors/org-mode
New compatibility function `org-delete-directory'
* org-compat.el (org-delete-directory): New compatibility function for Emacs 22, where `delete-directory' does not support recursive deletion. * org-odt.el (org-odt-cleanup-xml-buffers): Use the new compatibility function. Thanks to Achim and Jambunathan for suggesting this.
This commit is contained in:
parent
317a96a471
commit
58999598ed
|
@ -256,7 +256,6 @@ Works on both Emacs and XEmacs."
|
||||||
(when (boundp 'zmacs-regions)
|
(when (boundp 'zmacs-regions)
|
||||||
(setq zmacs-regions t)))))
|
(setq zmacs-regions t)))))
|
||||||
|
|
||||||
|
|
||||||
;; Invisibility compatibility
|
;; Invisibility compatibility
|
||||||
|
|
||||||
(defun org-remove-from-invisibility-spec (arg)
|
(defun org-remove-from-invisibility-spec (arg)
|
||||||
|
@ -455,6 +454,27 @@ With two arguments, return floor and remainder of their quotient."
|
||||||
'condition-case-no-debug)
|
'condition-case-no-debug)
|
||||||
'condition-case))
|
'condition-case))
|
||||||
|
|
||||||
|
;; RECURSIVE has been introduced with Emacs 23.2.
|
||||||
|
;; This is copying and adapted from `tramp-compat-delete-directory'
|
||||||
|
(defun org-delete-directory (directory &optional recursive)
|
||||||
|
"Compatibility function for `delete-directory'."
|
||||||
|
(if (null recursive)
|
||||||
|
(delete-directory directory)
|
||||||
|
(condition-case nil
|
||||||
|
(funcall 'delete-directory directory recursive)
|
||||||
|
;; This Emacs version does not support the RECURSIVE flag. We
|
||||||
|
;; use the implementation from Emacs 23.2.
|
||||||
|
(wrong-number-of-arguments
|
||||||
|
(setq directory (directory-file-name (expand-file-name directory)))
|
||||||
|
(if (not (file-symlink-p directory))
|
||||||
|
(mapc (lambda (file)
|
||||||
|
(if (eq t (car (file-attributes file)))
|
||||||
|
(org-delete-directory file recursive)
|
||||||
|
(delete-file file)))
|
||||||
|
(directory-files
|
||||||
|
directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
|
||||||
|
(delete-directory directory)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro org-check-version ()
|
(defmacro org-check-version ()
|
||||||
"Try very hard to provide sensible version strings."
|
"Try very hard to provide sensible version strings."
|
||||||
|
|
|
@ -446,7 +446,7 @@ values. See Info node `(emacs) File Variables'."
|
||||||
(kill-buffer)))
|
(kill-buffer)))
|
||||||
xml-files))
|
xml-files))
|
||||||
;; delete temporary directory.
|
;; delete temporary directory.
|
||||||
(delete-directory org-odt-zip-dir t)))))
|
(org-delete-directory org-odt-zip-dir t)))))
|
||||||
(org-condition-case-unless-debug err
|
(org-condition-case-unless-debug err
|
||||||
(prog1 (progn ,@body)
|
(prog1 (progn ,@body)
|
||||||
(funcall --cleanup-xml-buffers))
|
(funcall --cleanup-xml-buffers))
|
||||||
|
|
Loading…
Reference in New Issue