]> code.delx.au - gnu-emacs/blobdiff - lisp/files.el
(webjump-to-javaapi): Function deleted.
[gnu-emacs] / lisp / files.el
index c788fc07be62db7880d7c43300fd0a99a37bf069..55ae970c5ddaee2455ede8b2773c7619f03debfe 100644 (file)
@@ -146,12 +146,12 @@ both at the file level and at the levels of the containing directories."
   :type 'boolean
   :group 'find-file)
 
-(defcustom find-file-revert-without-query
+(defcustom revert-without-query
   nil
   "*Specify which files should be reverted without query.
 The value is a list of regular expressions.
 If the file name matches one of these regular expressions,
-then `find-file' reverts the file without querying
+then `revert-buffer' reverts the file without querying
 if the file has changed on disk and you have not edited the buffer."
   :type 'boolean
   :group 'find-file)
@@ -366,10 +366,10 @@ with a definition that really does change some file names."
 Not actually set up until the first time you you use it.")
 
 (defvar path-separator ":"
-  "Character used to separate concatenated paths.")
+  "Character used to separate directories in search paths.")
 
 (defun parse-colon-path (cd-path)
-  "Explode a colon-separated list of paths into a string list."
+  "Explode a colon-separated search path into a list of directory names."
   (and cd-path
        (let (cd-prefix cd-list (cd-start 0) cd-colon)
         (setq cd-path (concat cd-path path-separator))
@@ -879,7 +879,7 @@ Optional second arg RAWFILE non-nil means the file is read literally"
                    ;; Certain files should be reverted automatically
                    ;; if they have changed on disk and not in the buffer.
                    ((and (not (buffer-modified-p buf))
-                         (let ((tail find-file-revert-without-query)
+                         (let ((tail revert-without-query)
                                (found nil))
                            (while tail
                              (if (string-match (car tail) filename)
@@ -1058,11 +1058,10 @@ run `normal-mode' explicitly."
     ("\\.for\\'" . fortran-mode)
     ("\\.p\\'" . pascal-mode)
     ("\\.pas\\'" . pascal-mode)
-    ("\\.mss\\'" . scribe-mode)
     ("\\.ad[abs]\\'" . ada-mode)
-    ("\\.icn\\'" . icon-mode)
     ("\\.pl\\'" . perl-mode)
     ("\\.pm\\'" . perl-mode)
+    ("\\.s?html?\\'" . html-mode)
     ("\\.cc\\'" . c++-mode)
     ("\\.hh\\'" . c++-mode)
     ("\\.hpp\\'" . c++-mode)
@@ -1075,7 +1074,6 @@ run `normal-mode' explicitly."
     ("\\.h\\+\\+\\'" . c++-mode)
     ("\\.m\\'" . objc-mode)
     ("\\.java\\'" . java-mode)
-    ("\\.sim\\'" . simula-mode)
     ("\\.mk\\'" . makefile-mode)
     ("\\(M\\|m\\|GNUm\\)akefile\\(.in\\)?\\'" . makefile-mode)
 ;;; Less common extensions come here
@@ -1113,6 +1111,9 @@ run `normal-mode' explicitly."
     ("\\.exp\\'" . tcl-mode)
     ("\\.itcl\\'" . tcl-mode)
     ("\\.itk\\'" . tcl-mode)
+    ("\\.icn\\'" . icon-mode)
+    ("\\.sim\\'" . simula-mode)
+    ("\\.mss\\'" . scribe-mode)
     ("\\.f90\\'" . f90-mode)
     ("\\.lsp\\'" . lisp-mode)
     ("\\.awk\\'" . awk-mode)
@@ -1133,7 +1134,6 @@ run `normal-mode' explicitly."
     ("\\.sgml?\\'" . sgml-mode)
     ("\\.dtd\\'" . sgml-mode)
     ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
-    ("\\.s?html?\\'" . html-mode)
     ;; .emacs following a directory delimiter
     ;; in either Unix or VMS syntax.
     ("[]>:/]\\..*emacs\\'" . emacs-lisp-mode)
@@ -1904,17 +1904,19 @@ This is a separate function so you can redefine it for customization.
 You may need to redefine `file-name-sans-versions' as well."
     (string-match "~\\'" file))
 
+(defvar backup-extract-version-start)
+
 ;; This is used in various files.
 ;; The usage of bv-length is not very clean,
 ;; but I can't see a good alternative,
 ;; so as of now I am leaving it alone.
 (defun backup-extract-version (fn)
   "Given the name of a numeric backup file, return the backup number.
-Uses the free variable `bv-length', whose value should be
+Uses the free variable `backup-extract-version-start', whose value should be
 the index in the name where the version number begins."
-  (if (and (string-match "[0-9]+~$" fn bv-length)
-          (= (match-beginning 0) bv-length))
-      (string-to-int (substring fn bv-length -1))
+  (if (and (string-match "[0-9]+~$" fn backup-extract-version-start)
+          (= (match-beginning 0) backup-extract-version-start))
+      (string-to-int (substring fn backup-extract-version-start -1))
       0))
 
 ;; I believe there is no need to alter this behavior for VMS;
@@ -1931,7 +1933,7 @@ If the value is nil, don't make a backup."
       (if (eq version-control 'never)
          (list (make-backup-file-name fn))
        (let* ((base-versions (concat (file-name-nondirectory fn) ".~"))
-              (bv-length (length base-versions))
+              (backup-extract-version-start (length base-versions))
               possibilities
               (versions nil)
               (high-water-mark 0)
@@ -1977,21 +1979,21 @@ If this is impossible (which can happen on MSDOS and Windows
 when the file name and directory use different drive names)
 then it returns FILENAME."
   (save-match-data
-    (setq fname (expand-file-name filename)
-         directory (file-name-as-directory
-                    (expand-file-name (or directory default-directory))))
-    ;; On Microsoft OSes, if FILENAME and DIRECTORY have different
-    ;; drive names, they can't be relative, so return the absolute name.
-    (if (and (or (eq system-type 'ms-dos)
-                (eq system-type 'windows-nt))
-            (not (string-equal (substring fname  0 2)
-                               (substring directory 0 2))))
-       filename
-      (let ((ancestor ""))
-       (while (not (string-match (concat "^" (regexp-quote directory)) fname))
-         (setq directory (file-name-directory (substring directory 0 -1))
-               ancestor (concat "../" ancestor)))
-       (concat ancestor (substring fname (match-end 0)))))))
+    (let ((fname (expand-file-name filename)))
+      (setq directory (file-name-as-directory
+                      (expand-file-name (or directory default-directory))))
+      ;; On Microsoft OSes, if FILENAME and DIRECTORY have different
+      ;; drive names, they can't be relative, so return the absolute name.
+      (if (and (or (eq system-type 'ms-dos)
+                  (eq system-type 'windows-nt))
+              (not (string-equal (substring fname  0 2)
+                                 (substring directory 0 2))))
+         filename
+       (let ((ancestor ""))
+         (while (not (string-match (concat "^" (regexp-quote directory)) fname))
+           (setq directory (file-name-directory (substring directory 0 -1))
+                 ancestor (concat "../" ancestor)))
+         (concat ancestor (substring fname (match-end 0))))))))
 \f
 (defun save-buffer (&optional args)
   "Save current buffer in visited file if modified.  Versions described below.
@@ -2444,6 +2446,14 @@ non-nil, it is called instead of rereading visited file contents."
       (cond ((null file-name)
             (error "Buffer does not seem to be associated with any file"))
            ((or noconfirm
+                (and (not (buffer-modified-p))
+                     (let ((tail revert-without-query)
+                           (found nil))
+                       (while tail
+                         (if (string-match (car tail) file-name)
+                             (setq found t))
+                         (setq tail (cdr tail)))
+                       found))
                 (yes-or-no-p (format "Revert buffer from file %s? "
                                      file-name)))
             (run-hooks 'before-revert-hook)