1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-31 11:13:50 +00:00

(calc-invalidate-units-table): Use inhibit-read-only.

(math-build-units-table-buffer): Use view-mode.
This commit is contained in:
Jay Belanger 2005-05-20 22:39:33 +00:00
parent 240d926eb2
commit ed8060d98f
2 changed files with 66 additions and 60 deletions

View File

@ -1,3 +1,9 @@
2005-05-20 Jay Belanger <belanger@truman.edu>
* 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 <dak@gnu.org>
* emacs-lisp/easymenu.el (easy-menu-add): Correct docstring since

View File

@ -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)))