From ed8060d98f3c8281663d4d4d83e0c0ff2b4b9df4 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Fri, 20 May 2005 22:39:33 +0000 Subject: [PATCH] (calc-invalidate-units-table): Use inhibit-read-only. (math-build-units-table-buffer): Use view-mode. --- lisp/ChangeLog | 6 ++ lisp/calc/calc-units.el | 120 ++++++++++++++++++++-------------------- 2 files changed, 66 insertions(+), 60 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b28647fbae..b14240139ad 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2005-05-20 Jay Belanger + + * calc/calc-units.el (calc-invalidate-units-table): + Use inhibit-read-only. + (math-build-units-table-buffer): Use view-mode. + 2005-05-20 David Kastrup * emacs-lisp/easymenu.el (easy-menu-add): Correct docstring since diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 6c694bc5ba8..0983b807fde 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -555,7 +555,7 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).") (save-excursion (goto-char (point-min)) (if (looking-at "Calculator Units Table") - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (insert "(Obsolete) ")))))))) (defun calc-get-unit-definition (uname) @@ -1310,65 +1310,65 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).") (save-excursion (message "Formatting units table...") (set-buffer buf) - (setq buffer-read-only nil) - (erase-buffer) - (insert "Calculator Units Table:\n\n") - (insert "Unit Type Definition Description\n\n") - (while uptr - (setq u (car uptr) - name (nth 2 u)) - (when (eq (car u) 'm) - (setq std t)) - (setq shadowed (and std (assq (car u) math-additional-units))) - (when (and name - (> (length name) 1) - (eq (aref name 0) ?\*)) - (unless (eq uptr math-units-table) - (insert "\n")) - (setq name (substring name 1))) - (insert " ") - (and shadowed (insert "(")) - (insert (symbol-name (car u))) - (and shadowed (insert ")")) - (if (nth 3 u) - (progn - (indent-to 10) - (insert (symbol-name (nth 3 u)))) - (or std - (progn - (indent-to 10) - (insert "U")))) - (indent-to 14) - (and shadowed (insert "(")) - (if (nth 1 u) - (insert (math-format-value (nth 1 u) 80)) - (insert (symbol-name (car u)))) - (and shadowed (insert ")")) - (indent-to 41) - (insert " ") - (when name - (insert name)) - (if shadowed - (insert " (redefined above)") - (unless (nth 1 u) - (insert " (base unit)"))) - (insert "\n") - (setq uptr (cdr uptr))) - (insert "\n\nUnit Prefix Table:\n\n") - (setq uptr math-unit-prefixes) - (while uptr - (setq u (car uptr)) - (insert " " (char-to-string (car u))) - (if (equal (nth 1 u) (nth 1 (nth 1 uptr))) - (insert " " (char-to-string (car (car (setq uptr (cdr uptr))))) - " ") - (insert " ")) - (insert "10^" (int-to-string (nth 2 (nth 1 u)))) - (indent-to 15) - (insert " " (nth 2 u) "\n") - (while (eq (car (car (setq uptr (cdr uptr)))) 0))) - (insert "\n") - (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert "Calculator Units Table:\n\n") + (insert "Unit Type Definition Description\n\n") + (while uptr + (setq u (car uptr) + name (nth 2 u)) + (when (eq (car u) 'm) + (setq std t)) + (setq shadowed (and std (assq (car u) math-additional-units))) + (when (and name + (> (length name) 1) + (eq (aref name 0) ?\*)) + (unless (eq uptr math-units-table) + (insert "\n")) + (setq name (substring name 1))) + (insert " ") + (and shadowed (insert "(")) + (insert (symbol-name (car u))) + (and shadowed (insert ")")) + (if (nth 3 u) + (progn + (indent-to 10) + (insert (symbol-name (nth 3 u)))) + (or std + (progn + (indent-to 10) + (insert "U")))) + (indent-to 14) + (and shadowed (insert "(")) + (if (nth 1 u) + (insert (math-format-value (nth 1 u) 80)) + (insert (symbol-name (car u)))) + (and shadowed (insert ")")) + (indent-to 41) + (insert " ") + (when name + (insert name)) + (if shadowed + (insert " (redefined above)") + (unless (nth 1 u) + (insert " (base unit)"))) + (insert "\n") + (setq uptr (cdr uptr))) + (insert "\n\nUnit Prefix Table:\n\n") + (setq uptr math-unit-prefixes) + (while uptr + (setq u (car uptr)) + (insert " " (char-to-string (car u))) + (if (equal (nth 1 u) (nth 1 (nth 1 uptr))) + (insert " " (char-to-string (car (car (setq uptr (cdr uptr))))) + " ") + (insert " ")) + (insert "10^" (int-to-string (nth 2 (nth 1 u)))) + (indent-to 15) + (insert " " (nth 2 u) "\n") + (while (eq (car (car (setq uptr (cdr uptr)))) 0))) + (insert "\n")) + (view-mode) (message "Formatting units table...done")) (setq math-units-table-buffer-valid t) (let ((oldbuf (current-buffer)))