• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:find +defs:file

8 ;; This file is part of GNU Emacs.
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; This file defines a unified mechanism for saving & loading files stored
32 ;; When a file is visited, its format is determined by matching the
33 ;; beginning of the file against regular expressions stored in
36 ;; listed in the variable `buffer-file-format', and become the default
38 ;; change this variable, or use `format-write-file'.
41 ;; file, but the variable `buffer-auto-save-file-format' can be set to a
53 ;; an example of how to implement a file format. There are various
54 ;; functions defined in this file that may be useful for writing the
58 ;; The alist defines a correspondence between strings in the file
65 (put 'buffer-file-format 'permanent-local t)
66 (put 'buffer-auto-save-file-format 'permanent-local t)
109 "List of information about understood file formats.
112 NAME is a symbol, which is stored in `buffer-file-format'.
118 REGEXP is a regular expression to match against the beginning of the file;
125 end. It must make sure that the beginning of the file no longer
133 example, to find the values of local variables. TO-FN should either
143 MODE-FN, if specified, is called when visiting a file with that format.
147 PRESERVE, if non-nil, means that `format-write-file' should not remove
148 this format from `buffer-file-formats'.")
204 It must be a single symbol, not a list like `buffer-file-format'.
218 ;; build_annotations) for each element of buffer-file-format.
229 (coding-system buffer-file-coding-system))
233 (setq buffer-file-coding-system coding-system))
243 ;; This function is called by insert-file-contents whenever a file is read.
252 If optional third arg VISIT-FLAG is true, set `buffer-file-format'
302 (setq buffer-file-format format)))
316 Set `buffer-file-format' to the format used, and call any
337 FORMAT defaults to `buffer-file-format'. It is a symbol naming one of the
341 buffer-file-format))))
346 FORMAT defaults to `buffer-file-format'. It is a symbol naming
351 buffer-file-format))))
352 (if (null format) (setq format buffer-file-format))
371 (defun format-write-file (filename format &optional confirm)
372 "Write current buffer into file FILENAME using some FORMAT.
373 Make buffer visit that file and set the format as the default for future
374 saves. If the buffer is already visiting a file, you can specify a directory
375 name as FILENAME, to write a file of the same old name in that directory.
378 overwriting an existing file. Interactively, confirmation is required
381 ;; Same interactive spec as write-file, plus format question.
382 (let* ((file (if buffer-file-name
383 (read-file-name "Write file: "
385 (read-file-name "Write file: "
389 (fmt (format-read (format "Write file `%s' in format: "
390 (file-name-nondirectory file)))))
391 (list file fmt (not current-prefix-arg))))
392 (let ((old-formats buffer-file-format)
398 (setq buffer-file-format format)
400 (unless (memq fmt buffer-file-format)
401 (setq buffer-file-format (append buffer-file-format (list fmt))))))
402 (write-file filename confirm))
404 (defun format-find-file (filename format)
405 "Find the file FILENAME using data format FORMAT.
408 ;; Same interactive spec as write-file, plus format question.
409 (let* ((file (read-file-name "Find file: "))
410 (fmt (format-read (format "Read file `%s' in format: "
411 (file-name-nondirectory file)))))
412 (list file fmt)))
414 (find-file filename))
418 (defun format-insert-file (filename format &optional beg end)
419 "Insert the contents of file FILENAME using data format FORMAT.
422 the part (in bytes) of the file to read.
424 The return value is like the value of `insert-file-contents':
427 ;; Same interactive spec as write-file, plus format question.
428 (let* ((file (read-file-name "Find file: "))
429 (fmt (format-read (format "Read file `%s' in format: "
430 (file-name-nondirectory file)))))
431 (list file fmt)))
434 (setq value (insert-file-contents filename nil beg end))
443 Return value is a list, like `buffer-file-format'; it may be nil.
609 to write these unknown annotations back into the file."
629 ;; If the file's nesting is messed up, the close might not match
633 (message "Extra closing annotation (%s) in file" name))
647 (message "Improper nesting in file."))
718 ;; Didn't find any match for the annotation:
732 ;; Once entire file has been scanned, add the properties.
849 \(as formatted by FORMAT-FN) are inserted into the file.