# HG changeset patch # User Richard M. Stallman # Date 845215248 0 # Node ID e735290b9ebba5e7b5ee5eb9432f9446b176f606 # Parent 0c61b1f40de22b6b0e31f71191e44187fc2d5af1 (hack-local-variables-prop-line): Ignore case when checking for `mode'. diff -r 0c61b1f40de2 -r e735290b9ebb lisp/files.el --- a/lisp/files.el Sun Oct 13 13:59:51 1996 +0000 +++ b/lisp/files.el Sun Oct 13 14:00:48 1996 +0000 @@ -235,13 +235,13 @@ (make-variable-buffer-local 'write-contents-hooks) (defconst enable-local-variables t - "*Control use of local-variables lists in files you visit. + "*Control use of local variables in files you visit. The value can be t, nil or something else. -A value of t means local-variables lists are obeyed; +A value of t means file local variables specifications are obeyed; nil means they are ignored; anything else means query. -The command \\[normal-mode] always obeys local-variables lists -and ignores this variable.") +The command \\[normal-mode] always obeys file local variable +specifications and ignores this variable.") (defconst enable-local-eval 'maybe "*Control processing of the \"variable\" `eval' in a file's local variables. @@ -1241,7 +1241,11 @@ (val (save-restriction (narrow-to-region (point) end) (read (current-buffer))))) - (or (eq key 'mode) + ;; It is traditional to ignore + ;; case when checking for `mode' in set-auto-mode, + ;; so we must do that here as well. + ;; That is inconsistent, but we're stuck with it. + (or (equal (downcase (symbol-name key)) "mode") (setq result (cons (cons key val) result))) (skip-chars-forward " \t;"))) (setq result (nreverse result)))) @@ -1687,6 +1691,22 @@ (substring file 0 (match-beginning 0))) filename)))) +(defun file-name-extension (filename &optional period) + "Return FILENAME's final \"extension\". +The extension, in a file name, is the part that follows the last `.'. +Return nil for extensionless file names such as `foo'. +Return the empty string for file names such as `foo.'. + +If PERIOD is non-nil, then the returned value includes the period +that delimits the extension, and if FILENAME has no extension, +the value is \"\"." + (save-match-data + (let ((file (file-name-sans-versions (file-name-nondirectory filename)))) + (if (string-match "\\.[^.]*\\'" file) + (substring file (+ (match-beginning 0) (if period 0 1))) + (if period + ""))))) + (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. This is a separate function so you can redefine it for customization."