/[emacs]/emacs/lisp/files.el
ViewVC logotype

Diff of /emacs/lisp/files.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.738 by rms, Fri Dec 31 14:48:12 2004 UTC revision 1.739 by monnier, Sun Jan 2 01:20:33 2005 UTC
# Line 1  Line 1 
1  ;;; files.el --- file input and output commands for Emacs  ;;; files.el --- file input and output commands for Emacs
2    
3  ;; Copyright (C) 1985,86,87,92,93,94,95,96,97,98,99,2000,01,02,03,2004  ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4  ;;;   Free Software Foundation, Inc.  ;;   1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
5    
6  ;; Maintainer: FSF  ;; Maintainer: FSF
7    
# Line 2218  is specified, returning t if it is speci Line 2218  is specified, returning t if it is speci
2218                                                     buffer-file-name)                                                     buffer-file-name)
2219                                                  (concat "buffer "                                                  (concat "buffer "
2220                                                          (buffer-name))))))))))                                                          (buffer-name))))))))))
2221            (let (prefix suffix beg            (skip-chars-forward " \t")
2222                  (enable-local-eval enable-local-eval))            (let ((enable-local-eval enable-local-eval)
2223              ;; The prefix is what comes before "local variables:" in its line.                  ;; suffix is what comes after "local variables:" in its line.
2224              ;; The suffix is what comes after "local variables:" in its line.                  (suffix
2225              (skip-chars-forward " \t")                   (concat
2226              (or (eolp)                    (regexp-quote (buffer-substring (point) (line-end-position)))
2227                  (setq suffix (buffer-substring (point)                    "$"))
2228                                                 (progn (end-of-line) (point)))))                  ;; prefix is what comes before "local variables:" in its line.
2229              (goto-char (match-beginning 0))                  (prefix
2230              (or (bolp)                   (concat "^" (regexp-quote
2231                  (setq prefix                                (buffer-substring (line-beginning-position)
2232                        (buffer-substring (point)                                                  (match-beginning 0)))))
2233                                          (progn (beginning-of-line) (point)))))                  beg)
2234    
             (setq prefix (if prefix (regexp-quote prefix) "^"))  
             (if suffix (setq suffix (concat (regexp-quote suffix) "$")))  
2235              (forward-line 1)              (forward-line 1)
2236              (let ((startpos (point))              (let ((startpos (point))
2237                    endpos                    endpos
2238                    (thisbuf (current-buffer)))                    (thisbuf (current-buffer)))
2239                (save-excursion                (save-excursion
2240                  (if (not (re-search-forward                  (if (not (re-search-forward
2241                            (concat (or prefix "")                            (concat prefix "[ \t]*End:[ \t]*" suffix)
                                   "[ \t]*End:[ \t]*"  
                                   (or suffix ""))  
2242                            nil t))                            nil t))
2243                      (error "Local variables list is not properly terminated"))                      (error "Local variables list is not properly terminated"))
2244                  (beginning-of-line)                  (beginning-of-line)
# Line 2251  is specified, returning t if it is speci Line 2247  is specified, returning t if it is speci
2247                (with-temp-buffer                (with-temp-buffer
2248                  (insert-buffer-substring thisbuf startpos endpos)                  (insert-buffer-substring thisbuf startpos endpos)
2249                  (goto-char (point-min))                  (goto-char (point-min))
2250                  (subst-char-in-region (point) (point-max)                  (subst-char-in-region (point) (point-max) ?\^m ?\n)
                                       ?\^m ?\n)  
2251                  (while (not (eobp))                  (while (not (eobp))
2252                    ;; Discard the prefix, if any.                    ;; Discard the prefix.
2253                    (if prefix                    (if (looking-at prefix)
2254                        (if (looking-at prefix)                        (delete-region (point) (match-end 0))
2255                            (delete-region (point) (match-end 0))                      (error "Local variables entry is missing the prefix"))
                         (error "Local variables entry is missing the prefix")))  
2256                    (end-of-line)                    (end-of-line)
2257                    ;; Discard the suffix, if any.                    ;; Discard the suffix.
2258                    (if suffix                    (if (looking-back suffix)
2259                        (if (looking-back suffix)                        (delete-region (match-beginning 0) (point))
2260                            (delete-region (match-beginning 0) (point))                      (error "Local variables entry is missing the suffix"))
                         (error "Local variables entry is missing the suffix")))  
2261                    (forward-line 1))                    (forward-line 1))
2262                  (goto-char (point-min))                  (goto-char (point-min))
2263    

Legend:
Removed from v.1.738  
changed lines
  Added in v.1.739

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26