aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/format.el
diff options
context:
space:
mode:
authorMiles Bader2007-08-13 13:48:35 +0000
committerMiles Bader2007-08-13 13:48:35 +0000
commitb2e6b10fe2d40020a75ab0025af98a4abf339cd2 (patch)
treedb265e5ea93cdc13f8e3b54ed5c7ad2869d50ec9 /lisp/format.el
parent905350bef3ebc514a418658dd155c1d062664b56 (diff)
parent37cc095b6a175fb5a2fb18fa029eaf3aa3b3fa53 (diff)
downloademacs-b2e6b10fe2d40020a75ab0025af98a4abf339cd2.tar.gz
emacs-b2e6b10fe2d40020a75ab0025af98a4abf339cd2.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 846-851) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 88-92) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 242-244) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-246
Diffstat (limited to 'lisp/format.el')
-rw-r--r--lisp/format.el35
1 files changed, 28 insertions, 7 deletions
diff --git a/lisp/format.el b/lisp/format.el
index af708bd9a0c..d18afd7e8be 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -420,13 +420,34 @@ a list (ABSOLUTE-FILE-NAME SIZE)."
420 (fmt (format-read (format "Read file `%s' in format: " 420 (fmt (format-read (format "Read file `%s' in format: "
421 (file-name-nondirectory file))))) 421 (file-name-nondirectory file)))))
422 (list file fmt))) 422 (list file fmt)))
423 (let (value size) 423 (let (value size old-undo)
424 (let ((format-alist nil)) 424 ;; Record only one undo entry for the insertion. Inhibit point-motion and
425 (setq value (insert-file-contents filename nil beg end)) 425 ;; modification hooks as with `insert-file-contents'.
426 (setq size (nth 1 value))) 426 (let ((inhibit-point-motion-hooks t)
427 (if format 427 (inhibit-modification-hooks t))
428 (setq size (format-decode format size) 428 ;; Don't bind `buffer-undo-list' to t here to assert that
429 value (list (car value) size))) 429 ;; `insert-file-contents' may record whether the buffer was unmodified
430 ;; before.
431 (let ((format-alist nil))
432 (setq value (insert-file-contents filename nil beg end))
433 (setq size (nth 1 value)))
434 (when (consp buffer-undo-list)
435 (let ((head (car buffer-undo-list)))
436 (when (and (consp head)
437 (equal (car head) (point))
438 (equal (cdr head) (+ (point) size)))
439 ;; Remove first entry from `buffer-undo-list', we shall insert
440 ;; another one below.
441 (setq old-undo (cdr buffer-undo-list)))))
442 (when format
443 (let ((buffer-undo-list t))
444 (setq size (format-decode format size)
445 value (list (car value) size)))
446 (unless (eq buffer-undo-list t)
447 (setq buffer-undo-list
448 (cons (cons (point) (+ (point) size)) old-undo)))))
449 (unless inhibit-modification-hooks
450 (run-hook-with-args 'after-change-functions (point) (+ (point) size) 0))
430 value)) 451 value))
431 452
432(defun format-read (&optional prompt) 453(defun format-read (&optional prompt)