/[emacs]/emacs/lisp/gnus/gnus-util.el
ViewVC logotype

Diff of /emacs/lisp/gnus/gnus-util.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18.6.3 by miles, Tue Sep 21 09:34:07 2004 UTC revision 1.18.6.4 by miles, Fri Oct 22 10:13:32 2004 UTC
# Line 38  Line 38 
38  (eval-when-compile  (eval-when-compile
39    (require 'cl)    (require 'cl)
40    ;; Fixme: this should be a gnus variable, not nnmail-.    ;; Fixme: this should be a gnus variable, not nnmail-.
41    (defvar nnmail-pathname-coding-system))    (defvar nnmail-pathname-coding-system)
42    
43      ;; Inappropriate references to other parts of Gnus.
44      (defvar gnus-emphasize-whitespace-regexp)
45      )
46  (require 'time-date)  (require 'time-date)
47  (require 'netrc)  (require 'netrc)
48    
# Line 1186  is run." Line 1190  is run."
1190    "Delete by side effect any elements of LIST whose car is `equal' to KEY.    "Delete by side effect any elements of LIST whose car is `equal' to KEY.
1191  The modified LIST is returned.  If the first member  The modified LIST is returned.  If the first member
1192  of LIST has a car that is `equal' to KEY, there is no way to remove it  of LIST has a car that is `equal' to KEY, there is no way to remove it
1193  by side effect; therefore, write `(setq foo (remassoc key foo))' to be  by side effect; therefore, write `(setq foo (gnus-remassoc key foo))' to be
1194  sure of changing the value of `foo'."  sure of changing the value of `foo'."
1195    (when alist    (when alist
1196      (if (equal key (caar alist))      (if (equal key (caar alist))
# Line 1512  predicate on the elements." Line 1516  predicate on the elements."
1516           "")))           "")))
1517       (t emacs-version))))       (t emacs-version))))
1518    
1519    (defun gnus-rename-file (old-path new-path &optional trim)
1520      "Rename OLD-PATH as NEW-PATH.  If TRIM, recursively delete
1521    empty directories from OLD-PATH."
1522      (when (file-exists-p old-path)
1523        (let* ((old-dir (file-name-directory old-path))
1524               (old-name (file-name-nondirectory old-path))
1525               (new-dir (file-name-directory new-path))
1526               (new-name (file-name-nondirectory new-path))
1527               temp)
1528          (gnus-make-directory new-dir)
1529          (rename-file old-path new-path t)
1530          (when trim
1531            (while (progn (setq temp (directory-files old-dir))
1532                          (while (member (car temp) '("." ".."))
1533                            (setq temp (cdr temp)))
1534                          (= (length temp) 0))
1535              (delete-directory old-dir)
1536              (setq old-dir (file-name-as-directory
1537                             (file-truename
1538                              (concat old-dir "..")))))))))
1539    
1540    
1541  (provide 'gnus-util)  (provide 'gnus-util)
1542    
1543  ;;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49  ;;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49

Legend:
Removed from v.1.18.6.3  
changed lines
  Added in v.1.18.6.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26