Mercurial > emacs
comparison lisp/format.el @ 54469:0610337ed9b5
(format-insert-file): Always return a list of two elements,
like insert-file-contents does.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Mon, 22 Mar 2004 04:41:48 +0000 |
parents | a1177e068d43 |
children | dc6cd68555d1 |
comparison
equal
deleted
inserted
replaced
54468:d21aba49e1ce | 54469:0610337ed9b5 |
---|---|
414 If FORMAT is nil then do not do any format conversion. | 414 If FORMAT is nil then do not do any format conversion. |
415 The optional third and fourth arguments BEG and END specify | 415 The optional third and fourth arguments BEG and END specify |
416 the part of the file to read. | 416 the part of the file to read. |
417 | 417 |
418 The return value is like the value of `insert-file-contents': | 418 The return value is like the value of `insert-file-contents': |
419 a list (ABSOLUTE-FILE-NAME . SIZE)." | 419 a list (ABSOLUTE-FILE-NAME SIZE)." |
420 (interactive | 420 (interactive |
421 ;; Same interactive spec as write-file, plus format question. | 421 ;; Same interactive spec as write-file, plus format question. |
422 (let* ((file (read-file-name "Find file: ")) | 422 (let* ((file (read-file-name "Find file: ")) |
423 (fmt (format-read (format "Read file `%s' in format: " | 423 (fmt (format-read (format "Read file `%s' in format: " |
424 (file-name-nondirectory file))))) | 424 (file-name-nondirectory file))))) |
427 (let ((format-alist nil)) | 427 (let ((format-alist nil)) |
428 (setq value (insert-file-contents filename nil beg end)) | 428 (setq value (insert-file-contents filename nil beg end)) |
429 (setq size (nth 1 value))) | 429 (setq size (nth 1 value))) |
430 (if format | 430 (if format |
431 (setq size (format-decode format size) | 431 (setq size (format-decode format size) |
432 value (cons (car value) size))) | 432 value (list (car value) size))) |
433 value)) | 433 value)) |
434 | 434 |
435 (defun format-read (&optional prompt) | 435 (defun format-read (&optional prompt) |
436 "Read and return the name of a format. | 436 "Read and return the name of a format. |
437 Return value is a list, like `buffer-file-format'; it may be nil. | 437 Return value is a list, like `buffer-file-format'; it may be nil. |