(pc-select-selection-keys-only, pc-selection-mode): Fix spellings in docstrings.
[bpt/emacs.git] / lisp / files.el
index e08381c..d3764c4 100644 (file)
@@ -514,6 +514,10 @@ Runs the usual ange-ftp hook, but only for completion operations."
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
+FILENAME should be an absolute file name since the conversion rules
+sometimes vary depending on the position in the file name.  E.g. c:/foo
+is a valid DOS file name, but c:/bar/c:/foo is not.
+
 This function's standard definition is trivial; it just returns
 the argument.  However, on Windows and DOS, replace invalid
 characters.  On DOS, make sure to obey the 8.3 limitations.  On
@@ -541,7 +545,7 @@ DIR should be an absolute directory name.  It defaults to
 the value of `default-directory'."
   (unless dir
     (setq dir default-directory))
-  (read-file-name prompt dir (or default-dirname 
+  (read-file-name prompt dir (or default-dirname
                                 (if initial (expand-file-name initial dir)
                                   dir))
                  mustmatch initial
@@ -654,7 +658,7 @@ one or more of those symbols."
 
 (defun locate-file-completion (string path-and-suffixes action)
   "Do completion for file names passed to `locate-file'.
-PATH-AND-SUFFIXES is a pair of lists (DIRECTORIES . SUFFIXES)."
+PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
   (if (file-name-absolute-p string)
       (read-file-name-internal string nil action)
     (let ((names nil)
@@ -1744,7 +1748,7 @@ in that case, this function acts as if `enable-local-variables' were t."
   (mapc
    (lambda (elt)
      (cons (purecopy (car elt)) (cdr elt)))
-   '(;; do this first, so that .html.pl is Polish html, not Perl
+   `(;; do this first, so that .html.pl is Polish html, not Perl
      ("\\.s?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode)
      ("\\.te?xt\\'" . text-mode)
      ("\\.[tT]e[xX]\\'" . tex-mode)
@@ -1762,9 +1766,14 @@ in that case, this function acts as if `enable-local-variables' were t."
      ("\\.ad[abs]\\'" . ada-mode)
      ("\\.ad[bs].dg\\'" . ada-mode)
      ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
-     ("\\.mk\\'" . makefile-mode)
-     ("\\([Mm]\\|GNUm\\)akep*file\\'" . makefile-mode)
-     ("\\.am\\'" . makefile-mode)      ;For Automake.
+     ("GNUmakefile\\'" . makefile-gmake-mode)
+     ,@(if (memq system-type '(berkeley-unix next-mach darwin))
+          '(("\\.mk\\'" . makefile-bsdmake-mode)
+            ("[Mm]akefile\\'" . makefile-bsdmake-mode))
+        '(("\\.mk\\'" . makefile-gmake-mode)   ; Might be any make, give Gnu the host advantage
+          ("[Mm]akefile\\'" . makefile-mode)))
+     ("Makeppfile\\'" . makefile-makepp-mode)
+     ("\\.am\\'" . makefile-automake-mode)
      ;; Less common extensions come here
      ;; so more common ones above are found faster.
      ("\\.texinfo\\'" . texinfo-mode)
@@ -1936,13 +1945,13 @@ and `magic-mode-alist', which determines modes based on file contents.")
      ("more" . text-mode)
      ("less" . text-mode)
      ("pg" . text-mode)
-     ("make" . makefile-mode)          ; Debian uses this
+     ("make" . makefile-gmake-mode)            ; Debian uses this
      ("guile" . scheme-mode)
      ("clisp" . lisp-mode)))
   "Alist mapping interpreter names to major modes.
 This is used for files whose first lines match `auto-mode-interpreter-regexp'.
 Each element looks like (INTERPRETER . MODE).
-The car of each element is compared with
+The car of each element, a regular expression, is compared with
 the name of the interpreter specified in the first line.
 If it matches, mode MODE is selected.
 
@@ -1959,13 +1968,12 @@ from the end of the file name anything that matches one of these regexps.")
 (defvar auto-mode-interpreter-regexp
   "#![ \t]?\\([^ \t\n]*\
 /bin/env[ \t]\\)?\\([^ \t\n]+\\)"
-  "Regular expression matching interpreters, for file mode determination.
+  "Regexp matching interpreters, for file mode determination.
 This regular expression is matched against the first line of a file
-to determine the file's mode in `set-auto-mode' when Emacs can't deduce
-a mode from the file's name.  If it matches, the file is assumed to
-be interpreted by the interpreter matched by the second group of the
-regular expression.  The mode is then determined as the mode associated
-with that interpreter in `interpreter-mode-alist'.")
+to determine the file's mode in `set-auto-mode'.  If it matches, the file
+is assumed to be interpreted by the interpreter matched by the second group
+of the regular expression.  The mode is then determined as the mode
+associated with that interpreter in `interpreter-mode-alist'.")
 
 (defvar magic-mode-alist
   `(;; The < comes before the groups (but the first) to reduce backtracking.
@@ -2151,9 +2159,9 @@ Otherwise, return nil; point may be changed."
        (goto-char beg)
        end))))
 
-(defun hack-local-variables-confirm ()
-  (or (eq enable-local-variables t)
-      (and enable-local-variables
+(defun hack-local-variables-confirm (string flag-to-check)
+  (or (eq flag-to-check t)
+      (and flag-to-check
           (save-window-excursion
             (condition-case nil
                 (switch-to-buffer (current-buffer))
@@ -2168,8 +2176,10 @@ Otherwise, return nil; point may be changed."
             (save-excursion
               (beginning-of-line)
               (set-window-start (selected-window) (point)))
-            (y-or-n-p (format "Set local variables as specified in -*- line of %s? "
-                              (file-name-nondirectory buffer-file-name)))))))
+            (y-or-n-p (format string
+                              (if buffer-file-name
+                                  (file-name-nondirectory buffer-file-name)
+                                (concat "buffer " (buffer-name)))))))))
 
 (defun hack-local-variables-prop-line (&optional mode-only)
   "Set local variables specified in the -*- line.
@@ -2225,7 +2235,9 @@ is specified, returning t if it is specified."
       (if mode-only mode-specified
        (if (and result
                 (or mode-only
-                    (hack-local-variables-confirm)))
+                    (hack-local-variables-confirm
+                     "Set local variables as specified in -*- line of %s? "
+                     enable-local-variables)))
            (let ((enable-local-eval enable-local-eval))
              (while result
                (hack-one-local-variable (car (car result)) (cdr (car result)))
@@ -2255,7 +2267,9 @@ is specified, returning t if it is specified."
       (when (let ((case-fold-search t))
              (and (search-forward "Local Variables:" nil t)
                   (or mode-only
-                      (hack-local-variables-confirm))))
+                      (hack-local-variables-confirm
+                       "Set local variables as specified at end of %s? "
+                       enable-local-variables))))
        (skip-chars-forward " \t")
        (let ((enable-local-eval enable-local-eval)
              ;; suffix is what comes after "local variables:" in its line.
@@ -2476,7 +2490,9 @@ is considered risky."
                      (hack-one-local-variable-eval-safep val))
                 ;; Permit eval if not root and user says ok.
                 (and (not (zerop (user-uid)))
-                     (hack-local-variables-confirm)))
+                     (hack-local-variables-confirm
+                      "Process `eval' or hook local variables in %s? "
+                      enable-local-eval)))
             (if (eq var 'eval)
                 (save-excursion (eval val))
               (make-local-variable var)
@@ -2838,7 +2854,7 @@ the value is \"\"."
 
 (defcustom make-backup-file-name-function nil
   "A function to use instead of the default `make-backup-file-name'.
-A value of nil gives the default `make-backup-file-name' behaviour.
+A value of nil gives the default `make-backup-file-name' behavior.
 
 This could be buffer-local to do something special for specific
 files.  If you define it, you may need to change `backup-file-name-p'
@@ -2982,7 +2998,7 @@ 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 backup-extract-version-start)
           (= (match-beginning 0) backup-extract-version-start))
-      (string-to-int (substring fn backup-extract-version-start -1))
+      (string-to-number (substring fn backup-extract-version-start -1))
       0))
 
 ;; I believe there is no need to alter this behavior for VMS;
@@ -4546,7 +4562,7 @@ normally equivalent short `-D' option is just passed on to
              (if (string-match "ls (.*utils) \\([0-9.]*\\)$" version-out)
                  (let* ((version (match-string 1 version-out))
                         (split (split-string version "[.]"))
-                        (numbers (mapcar 'string-to-int split))
+                        (numbers (mapcar 'string-to-number split))
                         (min '(5 2 1))
                         comparison)
                    (while (and (not comparison) (or numbers min))