[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

[nnshimbun] group deletion



nnshimbun に `G DEL' でグループを消す機能が無いのは、何か理由が
あるんでしたっけ?

ちょっと作ってみたのですが:

(defun nnshimbun-delete-file (file)
  "Delete FILE or directory."
  (if (eq t (car (file-attributes file)))
      ;; FILE is a directory.
      (let ((files (directory-files
		    file t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
	(while files
	  (nnshimbun-delete-file (car files))
	  (setq files (cdr files)))
	(delete-directory file))
    ;; FILE is a file or a symlink.
    (delete-file file)))

(deffoo nnshimbun-request-delete-group (group &optional force server)
  (when (nnshimbun-possibly-change-group group server)
    (let ((dir (nnmail-group-pathname group (nnshimbun-server-directory))))
      (when (file-exists-p dir)
	(nnshimbun-delete-file dir)
	(setq dir (expand-file-name ".." dir))
	(unless (directory-files
		 dir t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")
	  (delete-directory dir))))
    t))