]> code.delx.au - gnu-emacs/blobdiff - lisp/filesets.el
Regenerate, and restore by hand the shell function message lost in
[gnu-emacs] / lisp / filesets.el
index 5a4dd7bda9ac27be1a5526210764aff2051eafe9..ae605e6806c9d8e0439eae172834ada95de6af8b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; filesets.el --- handle group of files
 
-;; Copyright (C) 2002, 200 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Thomas Link <t.link@gmx.at>
 ;; Maintainer: FSF
@@ -10,7 +10,7 @@
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; This program is distributed in the hope that it will be useful,
@@ -19,8 +19,8 @@
 ;; GNU General Public License for more details.
 
 ;; A copy of the GNU General Public License can be obtained from this
-;; program's author or from the Free Software Foundation, Inc., 675 Mass
-;; Ave, Cambridge, MA 02139, USA.
+;; program's author or from the Free Software Foundation, Inc.,
+;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 (defvar filesets-version "1.8.4")
 (defvar filesets-homepage
@@ -132,7 +132,8 @@ Is buffer local variable.")
 
 (defvar filesets-menu-ensure-use-cached
   (and filesets-running-xemacs
-       (not (emacs-version>= 21 5)))
+       (if (fboundp 'emacs-version>=)
+          (not (emacs-version>= 21 5))))
   "Make sure (X)Emacs uses filesets' cache.
 
 Well, if you use XEmacs (prior to 21.5?) custom.el is loaded after
@@ -353,7 +354,7 @@ See `add-submenu' for documentation."
 (defcustom filesets-menu-cache-file
   (if filesets-running-xemacs
       "~/.xemacs/filesets-cache.el"
-      "~/.emacs.d/filesets-cache.el")
+    (concat user-emacs-directory "filesets-cache.el"))
   "*File to be used for saving the filesets menu between sessions.
 Set this to \"\", to disable caching of menus.
 Don't forget to check out `filesets-menu-ensure-use-cached'."
@@ -649,8 +650,8 @@ the filename."
 Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a
 function or a command name as string.
 
-Properties is an association list determining filesets' behaviour in
-several conditions. Choose one from this list:
+Properties is an association list determining filesets' behavior in
+several conditions.  Choose one from this list:
 
 :ignore-on-open-all ... Don't open files of this type automatically --
 i.e. on open-all-files-events or when running commands
@@ -1602,7 +1603,7 @@ Replace <file-name> or <<file-name>> with filename."
                      ((equal arg "<file-name>")
                       (buffer-file-name))
                      ((equal arg "<<file-name>>")
-                      (filesets-quote (buffer-file-name)))
+                      (shell-quote-argument (buffer-file-name)))
                      (t
                       arg))))
 
@@ -1700,7 +1701,7 @@ Replace <file-name> or <<file-name>> with filename."
                  ok)
              t)))
     (when ok
-      (let ((cmd (format txt (buffer-file-name))))
+      (let ((cmd (format txt (shell-quote-argument (buffer-file-name)))))
        (message "Filesets: %s" cmd)
        (filesets-cmd-show-result cmd
                                  (shell-command-to-string cmd))))))
@@ -1794,8 +1795,17 @@ User will be queried, if no fileset name is provided."
         (name   (or name
                     (completing-read
                      (format "Add '%s' to fileset: " buffer)
-                     filesets-data nil t)))
-        (entry  (assoc name filesets-data)))
+                     filesets-data nil)))
+         (entry  (or (assoc name filesets-data)
+                     (when (y-or-n-p
+                            (format "Fileset %s does not exist. Create it? "
+                                    name))
+                       (progn
+      (add-to-list 'filesets-data (list name '(:files)))
+      (message
+       "Fileset %s created.  Call `M-x filesets-save-config' to save."
+       name)
+      (car filesets-data))))))
     (if entry
        (let* ((files  (filesets-entry-get-files entry))
               (this   (buffer-file-name buffer))