diff options
| author | Vinicius Jose Latorre | 2004-03-31 01:33:26 +0000 |
|---|---|---|
| committer | Vinicius Jose Latorre | 2004-03-31 01:33:26 +0000 |
| commit | 1ede99a8ec33e48df285def0f9751e067b01dc6b (patch) | |
| tree | 7e5c73731c2c55b0580f5a8c80d01532ec8f05e1 | |
| parent | ce4dd05c9fc3a5953004a1b3528e04c41df56214 (diff) | |
| download | emacs-1ede99a8ec33e48df285def0f9751e067b01dc6b.tar.gz emacs-1ede99a8ec33e48df285def0f9751e067b01dc6b.zip | |
Write a buffer if and only if the buffer was modified.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/ebnf2ps.el | 95 |
2 files changed, 53 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6a48cd0e907..ab9461d7267 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-03-30 Vinicius Jose Latorre <viniciusjl@ig.com.br> | ||
| 2 | |||
| 3 | * progmodes/ebnf2ps.el (ebnf-eps-finish-and-write): Write a buffer if | ||
| 4 | and only if the buffer was modified. | ||
| 5 | |||
| 1 | 2004-03-30 Kenichi Handa <handa@m17n.org> | 6 | 2004-03-30 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * international/characters.el: Delete pairs for U+2308..U+230B. | 8 | * international/characters.el: Delete pairs for U+2308..U+230B. |
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index fa4e46677b7..56125cbea5a 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 8 | ;; Time-stamp: <2004/03/28 19:56:21 vinicius> | 8 | ;; Time-stamp: <2004/03/30 21:49:21 vinicius> |
| 9 | ;; Keywords: wp, ebnf, PostScript | 9 | ;; Keywords: wp, ebnf, PostScript |
| 10 | ;; Version: 4.1 | 10 | ;; Version: 4.1 |
| 11 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ | 11 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
| @@ -4762,52 +4762,53 @@ killed after process termination." | |||
| 4762 | 4762 | ||
| 4763 | 4763 | ||
| 4764 | (defun ebnf-eps-finish-and-write (buffer filename) | 4764 | (defun ebnf-eps-finish-and-write (buffer filename) |
| 4765 | (save-excursion | 4765 | (when (buffer-modified-p buffer) |
| 4766 | (set-buffer buffer) | 4766 | (save-excursion |
| 4767 | (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) | 4767 | (set-buffer buffer) |
| 4768 | ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) | 4768 | (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) |
| 4769 | ebnf-eps-max-height | 4769 | ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) |
| 4770 | (+ ebnf-eps-upper-y | 4770 | ebnf-eps-max-height |
| 4771 | ebnf-production-vertical-space | 4771 | (+ ebnf-eps-upper-y |
| 4772 | ebnf-eps-max-height))) | 4772 | ebnf-production-vertical-space |
| 4773 | ;; prologue | 4773 | ebnf-eps-max-height))) |
| 4774 | (goto-char (point-min)) | 4774 | ;; prologue |
| 4775 | (insert | 4775 | (goto-char (point-min)) |
| 4776 | "%!PS-Adobe-3.0 EPSF-3.0" | 4776 | (insert |
| 4777 | "\n%%BoundingBox: 0 0 " | 4777 | "%!PS-Adobe-3.0 EPSF-3.0" |
| 4778 | (format "%d %d" (1+ ebnf-eps-upper-x) (1+ ebnf-eps-upper-y)) | 4778 | "\n%%BoundingBox: 0 0 " |
| 4779 | "\n%%Title: " filename | 4779 | (format "%d %d" (1+ ebnf-eps-upper-x) (1+ ebnf-eps-upper-y)) |
| 4780 | "\n%%CreationDate: " (format-time-string "%T %b %d %Y") | 4780 | "\n%%Title: " filename |
| 4781 | "\n%%Creator: " (user-full-name) " (using ebnf2ps v" ebnf-version ")" | 4781 | "\n%%CreationDate: " (format-time-string "%T %b %d %Y") |
| 4782 | "\n%%DocumentNeededResources: font " | 4782 | "\n%%Creator: " (user-full-name) " (using ebnf2ps v" ebnf-version ")" |
| 4783 | (or ebnf-fonts-required | 4783 | "\n%%DocumentNeededResources: font " |
| 4784 | (setq ebnf-fonts-required | 4784 | (or ebnf-fonts-required |
| 4785 | (mapconcat 'identity | 4785 | (setq ebnf-fonts-required |
| 4786 | (ps-remove-duplicates | 4786 | (mapconcat 'identity |
| 4787 | (mapcar 'ebnf-font-name-select | 4787 | (ps-remove-duplicates |
| 4788 | (list ebnf-production-font | 4788 | (mapcar 'ebnf-font-name-select |
| 4789 | ebnf-terminal-font | 4789 | (list ebnf-production-font |
| 4790 | ebnf-non-terminal-font | 4790 | ebnf-terminal-font |
| 4791 | ebnf-special-font | 4791 | ebnf-non-terminal-font |
| 4792 | ebnf-except-font | 4792 | ebnf-special-font |
| 4793 | ebnf-repeat-font))) | 4793 | ebnf-except-font |
| 4794 | "\n%%+ font "))) | 4794 | ebnf-repeat-font))) |
| 4795 | "\n%%Pages: 0\n%%EndComments\n\n%%BeginProlog\n" | 4795 | "\n%%+ font "))) |
| 4796 | ebnf-eps-prologue) | 4796 | "\n%%Pages: 0\n%%EndComments\n\n%%BeginProlog\n" |
| 4797 | (ebnf-insert-ebnf-prologue) | 4797 | ebnf-eps-prologue) |
| 4798 | (insert ebnf-eps-begin | 4798 | (ebnf-insert-ebnf-prologue) |
| 4799 | "\n0 " (ebnf-format-float | 4799 | (insert ebnf-eps-begin |
| 4800 | (- ebnf-eps-upper-y (* ebnf-font-height-P 0.7))) | 4800 | "\n0 " (ebnf-format-float |
| 4801 | " #ebnf2ps#begin\n") | 4801 | (- ebnf-eps-upper-y (* ebnf-font-height-P 0.7))) |
| 4802 | ;; epilogue | 4802 | " #ebnf2ps#begin\n") |
| 4803 | (goto-char (point-max)) | 4803 | ;; epilogue |
| 4804 | (insert ebnf-eps-end) | 4804 | (goto-char (point-max)) |
| 4805 | ;; write file | 4805 | (insert ebnf-eps-end) |
| 4806 | (message "Saving...") | 4806 | ;; write file |
| 4807 | (setq filename (expand-file-name filename)) | 4807 | (message "Saving...") |
| 4808 | (let ((coding-system-for-write 'raw-text-unix)) | 4808 | (setq filename (expand-file-name filename)) |
| 4809 | (write-region (point-min) (point-max) filename)) | 4809 | (let ((coding-system-for-write 'raw-text-unix)) |
| 4810 | (message "Wrote %s" filename))) | 4810 | (write-region (point-min) (point-max) filename)) |
| 4811 | (message "Wrote %s" filename)))) | ||
| 4811 | 4812 | ||
| 4812 | 4813 | ||
| 4813 | (defun ebnf-insert-ebnf-prologue () | 4814 | (defun ebnf-insert-ebnf-prologue () |