# Folder definition file
# This file is generated automatically by %s.
#
+# If you edit this file by hand, be sure that comment lines
+# will be washed out by wl-fldmgr.
+#
" (product-string-1 'wl-version t)))
(defun wl-fldmgr-exit ()
(when (and wl-fldmgr-modified
(or (not wl-interactive-save-folders)
- (y-or-n-p "Folder view was modified. Save current folders? ")))
+ (y-or-n-p
+ (concat "Folder view was modified"
+ (and wl-fldmgr-cut-entity-list
+ (format " (%s in cut stack)"
+ (length wl-fldmgr-cut-entity-list)))
+ ". Save current folders? "))))
(wl-fldmgr-save-folders)))
;;; Macro and misc Function
;; (defun wl-fldmgr-get-previous-entity (entity key-id)
;; (cdr (wl-fldmgr-get-previous-entity-internal '(nil . nil) entity key-id)))
-;;
+;;
;; (defun wl-fldmgr-get-previous-entity-internal (result entity key-id)
;; (cond
;; ((stringp entity)
(message "%s not found" key)
(setq update nil)
(throw 'done t)))
- (when access
+ (when (and access (not clear))
(if is-group
(wl-append unsubscribes
(list (list (elmo-string key) 'access nil)))
(cond
((stringp (car new2)) ;; folder
(cond
- ((wl-string-member (car new2) flist)
+ ((elmo-string-member (car new2) flist)
(and errmes (message "%s: already exists" (car new2)))
(throw 'success nil))
((and access
- (not (wl-string-member (car new2) unsubscribes)))
+ (not (elmo-string-member (car new2) unsubscribes)))
(and errmes (message "%s: not access group folder" (car new2)))
(throw 'success nil))))
(t ;; group
;;; (wl-fldmgr-get-entity-id (cdr previous-entity))))))
(wl-folder-prev-entity-skip-invalid))
(if (and prev
+ (wl-folder-buffer-group-p)
(looking-at wl-folder-group-regexp)
(string= (wl-match-buffer 2) "-"))
(setq group-target nil)
(wl-delete-entity path nil wl-folder-entity clear)))
(setq wl-fldmgr-modified t)
;;
- (if (looking-at wl-folder-group-regexp)
+ (if (and (wl-folder-buffer-group-p)
+ (looking-at wl-folder-group-regexp))
;; group
(let (beg end indent opened)
(setq indent (wl-match-buffer 1))
(while (< (point) to)
(and (looking-at "^\\([ ]*\\)")
(setq indent (wl-match-buffer 1)))
- (if (looking-at wl-folder-group-regexp)
+ (if (wl-folder-buffer-group-p)
(progn
(setq errmes "can't copy group folder")
(throw 'err t)))
(beginning-of-line)
(let ((ret-val nil))
(if (and (not ename)
- (looking-at wl-folder-group-regexp))
+ (wl-folder-buffer-group-p))
(message "Can't copy group folder")
(let* ((name (or ename (wl-folder-get-entity-from-buffer)))
(entity (elmo-string name)))
(throw 'found (symbol-value atom)))))
wl-fldmgr-add-completion-hashtb)))
(pattern
- (if (string-match "\\.$"
+ (if (string-match "\\.$"
(elmo-folder-prefix-internal
(wl-folder-get-elmo-folder string)))
(substring string 0 (match-beginning 0))
(beginning-of-line)
(let ((ret-val nil)
(inhibit-read-only t)
- (wl-folder-completion-function
+ (wl-folder-complete-folder-candidate
(if wl-fldmgr-add-complete-with-current-folder-list
(function wl-fldmgr-add-completion-subr)))
tmp indent path diffs)
(interactive)
(save-excursion
(beginning-of-line)
- (if (looking-at wl-folder-group-regexp)
+ (if (wl-folder-buffer-group-p)
(error "Can't delete group folder"))
(let* ((inhibit-read-only t)
(tmp (wl-fldmgr-get-path-from-buffer))
(entity (elmo-string (nth 4 tmp)))
- (folder (wl-folder-get-elmo-folder entity))
- (msgs (and (elmo-folder-exists-p folder)
- (elmo-folder-list-messages folder))))
- (when (yes-or-no-p (format "%sDo you really want to delete \"%s\"? "
- (if (> (length msgs) 0)
- (format "%d msg(s) exists. " (length msgs))
- "")
- entity))
- (elmo-folder-delete folder)
- (wl-fldmgr-cut tmp nil t)))))
+ (folder (wl-folder-get-elmo-folder entity)))
+ (when (elmo-folder-delete folder)
+ (wl-folder-clear-entity-info entity)
+ (wl-fldmgr-cut tmp nil t)
+ (wl-fldmgr-save-access-list)))))
(defun wl-fldmgr-rename ()
(interactive)
(if (bobp)
(message "Can't rename desktop group")
(cond
- ((looking-at wl-folder-group-regexp) ;; group
+ ((and (wl-folder-buffer-group-p)
+ (looking-at wl-folder-group-regexp)) ;; group
(let* ((indent (wl-match-buffer 1))
- (old-group (wl-folder-get-realname (wl-match-buffer 3)))
+ (old-group (wl-folder-get-entity-from-buffer))
(group-entity (wl-folder-search-group-entity-by-name
old-group wl-folder-entity))
group)
new-folder
(wl-folder-get-entity-info old-folder))
(wl-folder-clear-entity-info old-folder)
+ (setq wl-folder-info-alist-modified t)
(if (eq (cdr (nth 2 tmp)) 'access)
;; force update access group
(beginning-of-line)
(let ((inhibit-read-only t)
entity flist indent opened)
- (when (looking-at wl-folder-group-regexp)
+ (when (and (wl-folder-buffer-group-p)
+ (looking-at wl-folder-group-regexp)
+ (prog1
+ (y-or-n-p (format "Sort subfolders of %s? "
+ (wl-folder-get-entity-from-buffer)))
+ (message nil)))
(setq indent (wl-match-buffer 1))
(setq opened (wl-match-buffer 2))
(setq entity (wl-folder-search-group-entity-by-name
- (wl-folder-get-realname (wl-match-buffer 3))
+ (wl-folder-get-entity-from-buffer)
wl-folder-entity))
(message "Sorting...")
(setq flist (sort (nth 2 entity) wl-fldmgr-sort-function))
(t
(if (and type (< type 0))
nil
- (setq is-group (looking-at wl-folder-group-regexp))
+ (setq is-group (wl-folder-buffer-group-p))
(setq tmp (wl-fldmgr-get-path-from-buffer))
(setq indent (wl-fldmgr-make-indent (nth 1 tmp)))
(if (eq (cdr (nth 2 tmp)) 'access)
(when (wl-fldmgr-cut tmp)
- (pop wl-fldmgr-cut-entity-list) ;; don't leave cut-list
+ ;; don't leave cut-list
+ (setq wl-fldmgr-cut-entity-list (cdr wl-fldmgr-cut-entity-list))
(setq beg (point))
(insert indent wl-folder-unsubscribe-mark
(if is-group
(save-excursion (forward-line -1)
(wl-highlight-folder-current-line))
(remove-text-properties beg (point) '(wl-folder-entity-id))
- (setq execed t))))))
+ (setq execed t))
+ (message "not an access group folder")))))
(set-buffer-modified-p nil)))
(if (or force execed)
(progn
(let ((inhibit-read-only t)
entity indent opened
unsubscribes beg)
- (when (not (looking-at wl-folder-group-regexp))
+ (when (not
+ (and (wl-folder-buffer-group-p)
+ (looking-at wl-folder-group-regexp)))
(wl-folder-goto-top-of-current-folder)
(looking-at wl-folder-group-regexp))
(setq indent (wl-match-buffer 1))
(setq opened (wl-match-buffer 2))
(setq entity (wl-folder-search-group-entity-by-name
- (wl-folder-get-realname (wl-match-buffer 3))
+ (wl-folder-get-entity-from-buffer)
wl-folder-entity))
(when (eq (nth 1 entity) 'access)
(save-excursion
(interactive)
(save-excursion
(beginning-of-line)
- (let* ((is-group (looking-at wl-folder-group-regexp))
+ (let* ((is-group (wl-folder-buffer-group-p))
(name (wl-folder-get-entity-from-buffer))
(searchname (wl-folder-get-petname name))
(pentry (wl-string-assoc name wl-folder-petname-alist))
(if (string= petname old-petname)
nil
(if (or (rassoc petname wl-folder-petname-alist)
- (wl-string-assoc petname wl-folder-group-alist))
+ (and is-group
+ (wl-string-assoc petname wl-folder-group-alist)))
(message "%s: already exists" petname)
(wl-folder-append-petname name petname)
(setq change t)))))
"")
"\n"))
((consp name)
- (let ((group (wl-folder-get-realname (car name)))
+ (let ((group (car name))
(type (nth 1 name)))
- (if (not (string= group (car name))) ; petname.
- (wl-append pet-entities (list (car name))))
(cond ((eq type 'group)
(insert indent group "{\n")
(setq pet-entities
(defun wl-fldmgr-save-folders ()
(interactive)
(let ((tmp-buf (get-buffer-create " *wl-fldmgr-tmp*"))
- (access-list wl-fldmgr-modified-access-list)
- entity
save-petname-entities)
(message "Saving folders...")
(set-buffer tmp-buf)
(wl-fldmgr-delete-disused-petname)
(setq save-petname-entities
(wl-fldmgr-insert-folders-buffer "" (nth 2 wl-folder-entity)))
- (insert "\n# petname definition (group, folder in access group)\n")
+ (insert "\n# petname definition (access group, folder in access group)\n")
(wl-fldmgr-insert-petname-buffer save-petname-entities)
(insert "\n# end of file.\n")
(if (and wl-fldmgr-make-backup
'no-msg)
(set-file-modes wl-folders-file (+ (* 64 6) (* 8 0) 0))) ; chmod 0600
(kill-buffer tmp-buf)
+ (wl-fldmgr-save-access-list)
+ (setq wl-fldmgr-modified nil)
+ (message "Saving folders...done")))
+
+(defun wl-fldmgr-save-access-list ()
+ (let ((access-list wl-fldmgr-modified-access-list)
+ entity)
(while access-list
(setq entity (wl-folder-search-group-entity-by-name
(car access-list) wl-folder-entity))
(wl-folder-make-save-access-list (nth 2 entity))
(wl-folder-make-save-access-list (nth 3 entity))))
(setq access-list (cdr access-list)))
- (setq wl-fldmgr-modified nil)
- (setq wl-fldmgr-modified-access-list nil)
- (message "Saving folders...done")))
+ (setq wl-fldmgr-modified-access-list nil)))
(require 'product)
(product-provide (provide 'wl-fldmgr) (require 'wl-version))