]> code.delx.au - gnu-emacs/blobdiff - lisp/find-file.el
Revert changes, which were committed with 2013-01-29T16:03:40Z!michael.albinus@gmx...
[gnu-emacs] / lisp / find-file.el
index a3b4272fe7259430df62fff99565e5f5f7cbe1df..4d1953b3c1f2b6a7f2822785992fcf116ef879ef 100644 (file)
@@ -4,8 +4,7 @@
 ;; Maintainer: FSF
 ;; Keywords: c, matching, tools
 
 ;; Maintainer: FSF
 ;; Keywords: c, matching, tools
 
-;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2013 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
 
 ;; This file is part of GNU Emacs.
 
   :group 'find-file)
 
 (defcustom ff-pre-find-hook nil
   :group 'find-file)
 
 (defcustom ff-pre-find-hook nil
-  "*List of functions to be called before the search for the file starts."
+  "List of functions to be called before the search for the file starts."
   :type 'hook
   :group 'ff)
 
 (defcustom ff-pre-load-hook nil
   :type 'hook
   :group 'ff)
 
 (defcustom ff-pre-load-hook nil
-  "*List of functions to be called before the other file is loaded."
+  "List of functions to be called before the other file is loaded."
   :type 'hook
   :group 'ff)
 
 (defcustom ff-post-load-hook nil
   :type 'hook
   :group 'ff)
 
 (defcustom ff-post-load-hook nil
-  "*List of functions to be called after the other file is loaded."
+  "List of functions to be called after the other file is loaded."
   :type 'hook
   :group 'ff)
 
 (defcustom ff-not-found-hook nil
   :type 'hook
   :group 'ff)
 
 (defcustom ff-not-found-hook nil
-  "*List of functions to be called if the other file could not be found."
+  "List of functions to be called if the other file could not be found."
   :type 'hook
   :group 'ff)
 
 (defcustom ff-file-created-hook nil
   :type 'hook
   :group 'ff)
 
 (defcustom ff-file-created-hook nil
-  "*List of functions to be called if the other file needs to be created."
+  "List of functions to be called if the other file needs to be created."
   :type 'hook
   :group 'ff)
 
 (defcustom ff-case-fold-search nil
   :type 'hook
   :group 'ff)
 
 (defcustom ff-case-fold-search nil
-  "*Non-nil means ignore cases in matches (see `case-fold-search').
+  "Non-nil means ignore cases in matches (see `case-fold-search').
 If you have extensions in different cases, you will want this to be nil."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-always-in-other-window nil
 If you have extensions in different cases, you will want this to be nil."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-always-in-other-window nil
-  "*If non-nil, find the corresponding file in another window by default.
+  "If non-nil, find the corresponding file in another window by default.
 To override this, give an argument to `ff-find-other-file'."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-ignore-include nil
 To override this, give an argument to `ff-find-other-file'."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-ignore-include nil
-  "*If non-nil, ignore `#include' lines."
+  "If non-nil, ignore `#include' lines."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-always-try-to-create t
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-always-try-to-create t
-  "*If non-nil, always attempt to create the other file if it was not found."
+  "If non-nil, always attempt to create the other file if it was not found."
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-quiet-mode nil
   :type 'boolean
   :group 'ff)
 
 (defcustom ff-quiet-mode nil
-  "*If non-nil, trace which directories are being searched."
+  "If non-nil, trace which directories are being searched."
   :type 'boolean
   :group 'ff)
 
 ;;;###autoload
   :type 'boolean
   :group 'ff)
 
 ;;;###autoload
-(defvar ff-special-constructs
-  '(
-    ;; C/C++ include, for NeXTSTEP too
-    ("^\#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]" .
+(defcustom ff-special-constructs
+  ;; C/C++ include, for NeXTstep too
+  `((,(purecopy "^\#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") .
      (lambda ()
      (lambda ()
-       (buffer-substring (match-beginning 2) (match-end 2))))
-    )
+       (buffer-substring (match-beginning 2) (match-end 2)))))
   ;; We include `ff-treat-as-special' documentation here so that autoload
   ;; can make it available to be read prior to loading this file.
   ;; We include `ff-treat-as-special' documentation here so that autoload
   ;; can make it available to be read prior to loading this file.
-  "*List of special constructs for `ff-treat-as-special' to recognize.
+  "List of special constructs recognized by `ff-treat-as-special'.
 Each element, tried in order, has the form (REGEXP . EXTRACT).
 If REGEXP matches the current line (from the beginning of the line),
 `ff-treat-as-special' calls function EXTRACT with no args.
 If EXTRACT returns nil, keep trying.  Otherwise, return the
 Each element, tried in order, has the form (REGEXP . EXTRACT).
 If REGEXP matches the current line (from the beginning of the line),
 `ff-treat-as-special' calls function EXTRACT with no args.
 If EXTRACT returns nil, keep trying.  Otherwise, return the
-filename that EXTRACT returned.")
+filename that EXTRACT returned."
+  :type '(repeat (cons regexp function))
+  :group 'ff)
 
 (defvaralias 'ff-related-file-alist 'ff-other-file-alist)
 (defcustom ff-other-file-alist 'cc-other-file-alist
 
 (defvaralias 'ff-related-file-alist 'ff-other-file-alist)
 (defcustom ff-other-file-alist 'cc-other-file-alist
-  "*Alist of extensions to find given the current file's extension.
+  "Alist of extensions to find given the current file's extension.
 
 This list should contain the most used extensions before the others,
 since the search algorithm searches sequentially through each
 
 This list should contain the most used extensions before the others,
 since the search algorithm searches sequentially through each
@@ -212,7 +211,7 @@ This alist should be set by the major mode."
   :group 'ff)
 
 (defcustom ff-search-directories 'cc-search-directories
   :group 'ff)
 
 (defcustom ff-search-directories 'cc-search-directories
-  "*List of directories to search for a specific file.
+  "List of directories to search for a specific file.
 
 Set by default to `cc-search-directories', expanded at run-time.
 
 
 Set by default to `cc-search-directories', expanded at run-time.
 
@@ -226,7 +225,7 @@ A typical format is
     '(\".\" \"/usr/include\" \"$PROJECT/*/include\")
 
 Environment variables can be inserted between slashes (`/').
     '(\".\" \"/usr/include\" \"$PROJECT/*/include\")
 
 Environment variables can be inserted between slashes (`/').
-They will be replaced by their definition. If a variable does
+They will be replaced by their definition.  If a variable does
 not exist, it is replaced (silently) with an empty string.
 
 The stars are *not* wildcards: they are searched for together with
 not exist, it is replaced (silently) with an empty string.
 
 The stars are *not* wildcards: they are searched for together with
@@ -237,7 +236,7 @@ the preceding slash.  The star represents all the subdirectories except
 
 (defcustom cc-search-directories
   '("." "/usr/include" "/usr/local/include/*")
 
 (defcustom cc-search-directories
   '("." "/usr/include" "/usr/local/include/*")
-  "*See the description of the `ff-search-directories' variable."
+  "See the description of the `ff-search-directories' variable."
   :type '(repeat directory)
   :group 'ff)
 
   :type '(repeat directory)
   :group 'ff)
 
@@ -262,7 +261,7 @@ the preceding slash.  The star represents all the subdirectories except
 
     ("\\.cxx\\'" (".hxx" ".hh" ".h"))
     ("\\.hxx\\'" (".cxx")))
 
     ("\\.cxx\\'" (".hxx" ".hh" ".h"))
     ("\\.hxx\\'" (".cxx")))
-  "*Alist of extensions to find given the current file's extension.
+  "Alist of extensions to find given the current file's extension.
 
 This list should contain the most used extensions before the others,
 since the search algorithm searches sequentially through each directory
 
 This list should contain the most used extensions before the others,
 since the search algorithm searches sequentially through each directory
@@ -276,7 +275,7 @@ is created with the first matching extension (`.cc' yields `.hh')."
     ("\\.mi$" (".md")) ;; Modula-2 module definition
     ("\\.md$" (".mi")) ;; and implementation.
     )
     ("\\.mi$" (".md")) ;; Modula-2 module definition
     ("\\.md$" (".mi")) ;; and implementation.
     )
-  "*See the description for the `ff-search-directories' variable."
+  "See the description for the `ff-search-directories' variable."
   :type '(repeat (list regexp (choice (repeat string) function)))
   :group 'ff)
 
   :type '(repeat (list regexp (choice (repeat string) function)))
   :group 'ff)
 
@@ -495,7 +494,7 @@ If optional IN-OTHER-WINDOW is non-nil, find the file in another window."
 
             (setq name
                   (expand-file-name
 
             (setq name
                   (expand-file-name
-                   (read-file-name
+                   (read-directory-name
                     (format "Find or create %s in: " default-name)
                     default-directory default-name nil)))
 
                     (format "Find or create %s in: " default-name)
                     default-directory default-name nil)))
 
@@ -611,8 +610,8 @@ the `ff-ignore-include' variable."
 
 (defun ff-get-file (search-dirs filename &optional suffix-list other-window)
   "Find a file in the SEARCH-DIRS with the given FILENAME (or filename stub).
 
 (defun ff-get-file (search-dirs filename &optional suffix-list other-window)
   "Find a file in the SEARCH-DIRS with the given FILENAME (or filename stub).
-If (optional) SUFFIX-LIST is nil, search for fname, otherwise search
-for fname with each of the given suffixes.  Get the file or the buffer
+If (optional) SUFFIX-LIST is nil, search for FILENAME, otherwise search
+for FILENAME with each of the given suffixes.  Get the file or the buffer
 corresponding to the name of the first file found, or nil."
   (let ((filename (ff-get-file-name search-dirs filename suffix-list)))
 
 corresponding to the name of the first file found, or nil."
   (let ((filename (ff-get-file-name search-dirs filename suffix-list)))
 
@@ -636,16 +635,16 @@ corresponding to the name of the first file found, or nil."
 If (optional) SUFFIX-LIST is nil, search for FNAME-STUB, otherwise
 search for FNAME-STUB with each of the given suffixes.  Return the
 name of the first file found."
 If (optional) SUFFIX-LIST is nil, search for FNAME-STUB, otherwise
 search for FNAME-STUB with each of the given suffixes.  Return the
 name of the first file found."
-  (let* (dirs         ;; working copy of dirs to search
-         dir          ;; the current dir considered
-         file         ;; filename being looked for
-         rest         ;; pathname after first /*
-         this-suffix  ;; the suffix we are currently considering
-         suffixes     ;; working copy of suffix-list
-         filename     ;; built filename
-         blist        ;; list of live buffers
-         buf          ;; current buffer in blist
-         found)       ;; whether we have found anything
+  (let (dirs         ;; working copy of dirs to search
+       dir          ;; the current dir considered
+       file         ;; filename being looked for
+       rest         ;; pathname after first /*
+       this-suffix  ;; the suffix we are currently considering
+       suffixes     ;; working copy of suffix-list
+       filename     ;; built filename
+       blist        ;; list of live buffers
+       buf          ;; current buffer in blist
+       found)       ;; whether we have found anything
 
     (setq suffixes suffix-list)
 
 
     (setq suffixes suffix-list)
 
@@ -968,5 +967,4 @@ That name was previously determined by `ff-which-function-are-we-in'."
 
 (provide 'find-file)
 
 
 (provide 'find-file)
 
-;; arch-tag: 5a2fc49e-3b0a-4708-9acf-fb14e471a97a
 ;;; find-file.el ends here
 ;;; find-file.el ends here