org-mobile.el: new custom variable org-mobile-files-exclude-regexp.

* org-mobile.el (org-mobile-files-exclude-regexp): New custom
variable.
(org-mobile-files-alist): Use it.
This commit is contained in:
Bastien Guerry 2011-03-05 11:49:30 +01:00
parent 2d37c8caf5
commit 2ebf586e05
1 changed files with 14 additions and 1 deletions

View File

@ -63,6 +63,11 @@ org-agenda-text-search-extra-files
(repeat :inline t :tag "Additional files" (repeat :inline t :tag "Additional files"
(file)))) (file))))
(defcustom org-mobile-files-exclude-regexp ""
"A regexp to exclude files from `org-mobile-files'."
:group 'org-mobile
:type 'regexp)
(defcustom org-mobile-directory "" (defcustom org-mobile-directory ""
"The WebDAV directory where the interaction with the mobile takes place." "The WebDAV directory where the interaction with the mobile takes place."
:group 'org-mobile :group 'org-mobile
@ -241,7 +246,8 @@ using `rsync' or `scp'.")
(setq org-mobile-checksum-files nil)) (setq org-mobile-checksum-files nil))
(defun org-mobile-files-alist () (defun org-mobile-files-alist ()
"Expand the list in `org-mobile-files' to a list of existing files." "Expand the list in `org-mobile-files' to a list of existing files.
Also exclude files matching `org-mobile-files-exclude-regexp'."
(let* ((include-archives (let* ((include-archives
(and (member 'org-agenda-text-search-extra-files org-mobile-files) (and (member 'org-agenda-text-search-extra-files org-mobile-files)
(member 'agenda-archives org-agenda-text-search-extra-files) (member 'agenda-archives org-agenda-text-search-extra-files)
@ -263,6 +269,13 @@ using `rsync' or `scp'.")
(list f)) (list f))
(t nil))) (t nil)))
org-mobile-files))) org-mobile-files)))
(files (delete
nil
(mapcar (lambda (f)
(unless (and (not (string= org-mobile-files-exclude-regexp ""))
(string-match org-mobile-files-exclude-regexp f))
(identity f)))
files)))
(orgdir-uname (file-name-as-directory (file-truename org-directory))) (orgdir-uname (file-name-as-directory (file-truename org-directory)))
(orgdir-re (concat "\\`" (regexp-quote orgdir-uname))) (orgdir-re (concat "\\`" (regexp-quote orgdir-uname)))
uname seen rtn file link-name) uname seen rtn file link-name)