Commit 1357a1c0 authored by David Byers's avatar David Byers
Browse files

Debugging code, some bugfixes and work on bug 868.

Detailed changes:
> 2003-04-21  David Byers  <byers@lysator.liu.se>
>
> 	More work on debugging stuff:
> 	* macros.el (lyskom-assert-error): Handle non-LysKOM-buffer
> 	situations smarter.
>
> 	Work on bug 868:
> 	* aux-items.el (mx-refuse-import): Added this aux-item.
> 	(lyskom-print-mx-refuse-import): New function.
>
> 	Microfix bugfix:
> 	* lyskom-buttons.el (lyskom-highlight-function-get-conf-stat):
> 	Return nil when getting conf-stat in background. Fix text for
> 	conf-z-info.
>
> 	Bugfix:
> 	* commands1.el (kom-list-created-conferences): Fixed bug where we
> 	called conf-stat->name on an uconf-stat.
>
1a21,37
>
> 	Microfix:
> 	* lyskom-buttons.el (lyskom-highlight-function-get-conf-stat): Get
> 	conf-stat in background if it was not cached so it will be next
> 	time around. Also support conf-z-info.
>
> 	Better debugging support (would have caught bug 1013):
> 	* komtypes.el (def-komtype): Added assertions on data type to
> 	accessors and mutators.
>
> 	* macros.el (lyskom-assert): New macro.
>
> 	* header.el (lyskom-debug-compile): Added definition of
> 	lyskom-debug-compile.
>
> 	* komtypes.el (def-komtype): Added assertions to accessor and
> 	mutators to check type.
parent 31747aa1
2003-04-21 David Byers <byers@lysator.liu.se>
More work on debugging stuff:
* macros.el (lyskom-assert-error): Handle non-LysKOM-buffer
situations smarter.
Work on bug 868:
* aux-items.el (mx-refuse-import): Added this aux-item.
(lyskom-print-mx-refuse-import): New function.
Microfix bugfix:
* lyskom-buttons.el (lyskom-highlight-function-get-conf-stat):
Return nil when getting conf-stat in background. Fix text for
conf-z-info.
Bugfix:
* commands1.el (kom-list-created-conferences): Fixed bug where we
called conf-stat->name on an uconf-stat.
2003-04-20 David Byers <byers@lysator.liu.se>
Microfix:
* lyskom-buttons.el (lyskom-highlight-function-get-conf-stat): Get
conf-stat in background if it was not cached so it will be next
time around. Also support conf-z-info.
Better debugging support (would have caught bug 1013):
* komtypes.el (def-komtype): Added assertions on data type to
accessors and mutators.
* macros.el (lyskom-assert): New macro.
* header.el (lyskom-debug-compile): Added definition of
lyskom-debug-compile.
* komtypes.el (def-komtype): Added assertions to accessor and
mutators to check type.
Fix bug 1013:
* lyskom-buttons.el (lyskom-default-button): Fixed cut-and-paste
bug that caused uconf-stat and pers-stat-based buttons not to be
......
......@@ -325,6 +325,11 @@ return non-nil if the item is to be included in the list."
(edit-insert . lyskom-edit-insert-world-readable)
(text-print-when . header))
(def-aux-item mx-refuse-import 35
(text-name aux-mx-refuse-import)
(info . lyskom-aux-item-info)
(status-print . lyskom-print-mx-refuse-import))
(def-aux-item elisp-client-read-faq 10000
(text-name aux-elisp-client-read-faq-name)
(info . lyskom-aux-item-info)
......@@ -607,7 +612,7 @@ return non-nil if the item is to be included in the list."
(substring (text->decoded-text-mass text text-stat) 0 (match-beginning 0)))
(t ""))
"\"")
(lyskom-format 'no-such-text-no text-no)))
(lyskom-format 'no-such-text-m text-no)))
(defun lyskom-deferred-print-faq (text-stat defer-info)
(if text-stat
......@@ -684,6 +689,13 @@ return non-nil if the item is to be included in the list."
(aux-item->data item)
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-print-mx-refuse-import (item &optional obj)
(let* ((sym (intern (format "mx-refuse-import-%s" (aux-item->data item))))
(s (or (lyskom-try-get-string sym 'lyskom-message)
(format "'%s'" (aux-item->data item)))))
(lyskom-format-insert 'conf-mx-refuse-import s
(lyskom-aux-item-terminating-button item obj))))
(defun lyskom-print-recommended-conf (item &optional obj)
(let ((conf-no (string-to-int (if (string-match " " (aux-item->data item))
(substring (aux-item->data item) 0 (match-beginning 0))
......
......@@ -1921,7 +1921,7 @@ See `kom-allow-incompleteness'."
'(all)
nil
(if (cache-get-uconf-stat lyskom-pers-no)
(cons (conf-stat->name (cache-get-uconf-stat lyskom-pers-no)) 0)1
(cons (uconf-stat->name (cache-get-uconf-stat lyskom-pers-no)) 0)1
nil)
t)))
(lyskom-format-insert 'listing-confs-created-by (conf-stat->conf-no pers))
......
......@@ -649,6 +649,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(status-conf-generic . "%-40#1s %#2s\n")
(status-aux-item . "Unknown auxiliary information: %11#1s%#3s (created by %#2M)\n")
(conf-mx-list-name . "Imported mailing list: %#1s %#2s\n")
(conf-mx-refuse-import . "Refuse import of: %#1s %#2s\n")
(recommended-conf-aux . "Recommended conference: %#1M <%#1m> %#2s\n")
(status-read-faq-aux-item . "Read FAQ: %15#2n for %#1?z%[%#1M <%#1m>%]%[the server%] %#3s\n")
(status-rejected-recommendation-aux-item . "Rejected recommendation for: %#1M %#2s\n")
......@@ -1838,6 +1839,7 @@ giving the command \"Save options\".\n\n")
(aux-mx-list-name-name . "Mailing list name")
(aux-send-comments-to-name . "Send comments to")
(aux-world-readable-name . "World-readable")
(aux-mx-refuse-import . "Refuse text import")
(aux-elisp-client-read-faq-name . "Read FAQ")
(aux-elisp-client-rejected-invitation-name . "Rejected invitation")
......@@ -1905,6 +1907,9 @@ environment to one that uses \"%#2s\" to encode text.
(cant-mark-text-unread . "Couldn't mark %#1n as unread (%#2s)\n")
(confusion-what-to-mark-unread . "I can't figure out what text you want to mark as unread.\n")
(no-comment-to-to-unread . "There is no commented text to mark as unread.\n")
(mx-refuse-import-spam . "Spam")
(mx-refuse-import-all . "All imported texts")
))
......
......@@ -119,3 +119,7 @@ load path, but I am unable to find this package. LysKOM cannot
run with your version of read-kbd-macro.
")
(error "Unable to run or compile due to obsolete definition of read-kbd-macro.")))))))
(eval-and-compile
(defvar lyskom-debug-compile (getenv "LYSKOM_DEBUG_COMPILE")))
......@@ -114,12 +114,16 @@ Automatically created with def-komtype" type)
(let ((field (or (car-safe arg) arg)))
(setq accessors
(cons `(defsubst ,(intern (format "%S->%S" type field)) (obj)
(lyskom-assert (or (null obj) (,(intern (format "lyskom-%S-p" type)) obj))
"Assertion failed in %s: got %S" ,(format "%S->%S" type field) obj)
,(format "Return field `%s' from OBJ." field)
(,access-method (cdr obj) ,field-index))
accessors))
(unless (plist-get (cdr-safe arg) ':read-only)
(setq mutators
(cons `(defsubst ,(intern (format "set-%S->%S" type field)) (obj val)
(lyskom-assert (or (null obj) (,(intern (format "lyskom-%S-p" type)) obj))
"Assertion failed in %s: got %S" ,(format "%S->%S" type field) obj)
,(format "Set field `%s' of OBJ to VAL." field)
(aset (cdr obj) ,field-index val))
mutators))))
......
......@@ -1356,17 +1356,18 @@ depending on the value of `kom-lynx-terminal'."
(defun lyskom-highlight-function-get-conf-stat (arg)
"Try to translate ARG to a conf-stat without making server calls.
ARG may be a conf-stat, pers-stat, uconf-stat, integer or string."
(cond ((lyskom-pers-stat-p arg)
(cache-get-conf-stat (pers-stat->pers-no arg)))
((lyskom-uconf-stat-p arg)
(cache-get-conf-stat (uconf-stat->conf-no arg)))
((numberp arg)
(cache-get-conf-stat arg))
((stringp arg)
(cache-get-conf-stat (string-to-int arg)))
((lyskom-conf-stat-p arg) arg)
(t nil)))
ARG may be a conf-stat, pers-stat, uconf-stat, conf-z-info, integer or string."
(if (lyskom-conf-stat-p arg)
arg
(let* ((conf-no (cond ((lyskom-pers-stat-p arg) (pers-stat->pers-no arg))
((lyskom-uconf-stat-p arg) (uconf-stat->conf-no arg))
((numberp arg) arg)
((lyskom-conf-z-info-p arg) (conf-z-info->conf-no arg))
((stringp arg) (string-to-int arg)))))
(when conf-no
(cond ((cache-get-conf-stat conf-no))
(conf-no (initiate-get-conf-stat 'background nil conf-no)
nil))))))
(defun lyskom-highlight-i-am-supervisor (arg)
......
......@@ -295,6 +295,26 @@ the current buffer, and its value is copied from the LysKOM buffer."
(put 'ignore-errors 'edebug-form-spec
'(sexp form body))
(defun lyskom-assert-error (&rest args)
(save-excursion
(save-match-data
(if (not (and (boundp 'lyskom-buffer)
(bufferp lyskom-buffer)))
(let ((debug-on-error t))
(apply 'error args))
(set-buffer lyskom-buffer)
(lyskom-save-backtrace)
(apply 'message args)
(lyskom-insert-before-prompt (concat (apply 'format args) "\n"))
(lyskom-insert-before-prompt (format "%s\n" (car (car lyskom-backtrace-list))))
(lyskom-insert-before-prompt (format "%s\n" (elt (car lyskom-backtrace-list) 1)))))))
(eval-and-compile
(if lyskom-debug-compile
(defsubst lyskom-assert (check &rest args)
(or check (if args (apply 'lyskom-assert-error args)
(lyskom-assert-error "Assertion failed"))))
(defsubst lyskom-assert (check &rest args) nil)))
;;; ============================================================
;;; Local variables
......
......@@ -648,6 +648,7 @@ i svensk datorhistoria. L
(status-conf-generic . "%-40#1s %#2s\n")
(status-aux-item . "Oknd tillggsinformation: %15#1s%#3s (skapad av %#2M)\n")
(conf-mx-list-name . "Importerad mailinglista: %#1s %#2s\n")
(conf-mx-refuse-import . "Vgra import av: %#1s %#2s\n")
(recommended-conf-aux . "Rekommenderat mte: %#1M <%#1m> %#2s\n")
(status-read-faq-aux-item . "Lst FAQ: %15#2n fr %#1?z%[%#1M <%#1m>%]%[servern%] %#3s\n")
(status-rejected-recommendation-aux-item . "Avvisad mtesrekommendation: %#1M %#2s\n")
......@@ -1873,6 +1874,7 @@ ge kommandot \"Spara inst
(aux-mx-list-name-name . "E-maillistnamn")
(aux-send-comments-to-name . "Snd kommentarer till")
(aux-world-readable-name . "Lsbart utan inloggning")
(aux-mx-refuse-import . "Vgra inlggsimport")
(aux-elisp-client-read-faq-name . "Lst FAQ")
(aux-elisp-client-rejected-invitation-name . "Avvisad inbjudan")
......@@ -1939,6 +1941,9 @@ teckenkodning.
(cant-mark-text-unread . "Kunde inte markera inlgg %#1n som olst (%#2s)\n")
(confusion-what-to-mark-unread . "Jag frstr inte vilken text du vill markera olst.\n")
(no-comment-to-to-unread . "Det finns inget kommenterat inlgg att markera som olst.\n")
(mx-refuse-import-spam . "Spam")
(mx-refuse-import-all . "Alla importade texter")
))
(lyskom-language-var local lyskom-month-names sv
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment