From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59443 Path: main.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: can't delete nnml groups Date: Fri, 17 Dec 2004 19:28:39 +0900 Organization: Emacsen advocacy group Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1103405553 3773 80.91.229.6 (18 Dec 2004 21:32:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Dec 2004 21:32:33 +0000 (UTC) Original-X-From: ding-owner+M7983@lists.math.uh.edu Sat Dec 18 22:31:58 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CfmAx-0002xW-00 for ; Sat, 18 Dec 2004 22:31:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1Cflyi-0006iX-00; Sat, 18 Dec 2004 15:19:04 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1CfFLx-00048X-00 for ding@lists.math.uh.edu; Fri, 17 Dec 2004 04:28:53 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1CfFLq-00067D-UY for ding@lists.math.uh.edu; Fri, 17 Dec 2004 04:28:47 -0600 Original-Received: from washington.hostforweb.net ([69.61.11.2]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1CfFLp-0004w5-00 for ; Fri, 17 Dec 2004 11:28:46 +0100 Original-Received: from localhost ([127.0.0.1]) by washington.hostforweb.net with esmtpa (Exim 4.43) id 1CfFLp-0000on-1z for ding@gnus.org; Fri, 17 Dec 2004 05:28:45 -0500 Original-To: ding@gnus.org X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:8RF8qlaPPOvbrOfGbKiyphRxv8U= X-Hashcash: 1:20:041217:ding@gnus.org::ad4fjwy2XbSBzm2N:00004bRu X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - washington.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: main.gmane.org gmane.emacs.gnus.general:59443 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59443 --=-=-= >>>>> In Katsumi Yamaoka wrote: > I noticed I cannot delete nnml groups if there are persistent > articles. > Debugger entered--Lisp error: (file-error "Removing old name: > is a directory" "/home/yamaoka/News/cache/nnml:foo.bar.baz") > delete-file("/home/yamaoka/News/cache/nnml:foo.bar.baz") > gnus-delete-file("/home/yamaoka/News/cache/nnml:foo.bar.baz") > gnus-cache-delete-group("nnml:foo.bar.baz") > gnus-request-delete-group("nnml:foo.bar.baz" (4)) > gnus-group-delete-group("nnml:foo.bar.baz" (4)) > call-interactively(gnus-group-delete-group) [...] > Emacs 21 provides the `dired-delete-file' function which deletes > a file and also a directory recursively. Can't we use the copy > of it as `gnus-delete-file'? Oops, that's dangerous! It may delete articles in lower hierarchical groups. Instead, I made a new function as shown below and committed it. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline (defun gnus-delete-directory (directory) "Delete files in DIRECTORY. Subdirectories remain. If there's no subdirectory, delete DIRECTORY as well." (when (file-directory-p directory) (let ((files (directory-files directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) file dir) (while files (setq file (pop files)) (if (eq t (car (file-attributes file))) ;; `file' is a subdirectory. (setq dir t) ;; `file' is a file or a symlink. (delete-file file))) (unless dir (delete-directory directory))))) --=-=-=--