Commit 17c34b72 authored by David Kågedal's avatar David Kågedal
Browse files

Grundläggande XEmacs-kompatibilitet och upprensning av oanvända

variabler + ett par småfixar.
parent 8f2b0099
Sun Oct 6 02:55:49 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-mark-as-read): Markera texten som lst ven
i mten man inte r med i. Det kan vara s att de inte har hmtats
n.
* utilities.el (lyskom-set-face-scheme): Flyttade hit frn
vars.el.in.
(lyskom-setup-faces): Dito.
(lyskom-set-face-background): Dito.
(lyskom-set-face-foreground): Dito.
(lyskom-emacs-version): Ny funktion.
(lyskom-face-resource): Ny funktion.
(lyskom-setup-faces): Anvnd lyskom-face-resource.
* vars.el.in (kom-default-face-scheme): Lt den vara nil s lnge.
* utilities.el (lyskom-setup-faces): Stt kom-default-face-scheme
om den inte r satt.
* macros.el (unless): Nytt makro.
* utilities.el (lyskom-delete-frame-hook): Anvnd ett bttre test.
* commands2.el (kom-change-conf-type): Skrev om lite renare.
* Rensade upp bland oanvnda variabler.
* vars.el.in (lyskom-setup-faces): Anvnd console-type
(kom-default-face-scheme): Dito.
(lyskom-set-face-scheme): Dito.
* macros.el (map-keymap): Tog bort en ondig lokal variabel.
* utilities.el (console-type): Ny funktion.
(device-class): Ny funktion.
(frame-property): Ny funktion.
(lyskom-background-mode): Ny funktion.
* vars.el.in (kom-default-face-scheme): Anvnd dem.
Sat Oct 5 19:23:13 1996 David Kgedal <davidk@lysator.liu.se>
* prefetch.el (lyskom-prefetch-membership-handler): Gr inte om
......
......@@ -228,7 +228,7 @@ as TYPE. If no such misc-info, return NIL"
(def-kom-command kom-send-letter (&optional pers-no)
"Send a personal letter to a person or a conference."
(interactive)
(condition-case error
(condition-case nil
(progn
(lyskom-tell-internat 'kom-tell-write-letter)
;; If there was a motd, which is now removed we have to
......@@ -729,7 +729,7 @@ The call is continued to the lyskom-edit-text.
TYPE is info whether this is going to be a comment of footnote.
CCREP is a list of all recipients that are going to be cc-recipients."
(condition-case x
(condition-case nil
;; Catch any quits
(progn
;; Filter multiple recipients through y-or-n-p.
......@@ -1077,8 +1077,7 @@ Args: CONF-STAT MEMBERSHIP"
(lyskom-set-mode-line conf-stat))
(cond
((let ((r 0)
(len (read-list-length lyskom-to-do-list))
(list (read-list->all-entries lyskom-to-do-list))
(len (read-list-length lyskom-to-do-list))
(found nil))
(while (and (not found)
(< r len))
......@@ -1457,24 +1456,24 @@ If MARK-NO == 0, review all marked texts."
;; Mera kult
(mapcar (function
(lambda (el)
(let ((x (car el))
(y (cdr el)))
(if (and (or (null (elt x 0))
(= (+ (time->year time) 1900) (elt x 0)))
(or (null (elt x 1))
(= (1+ (time->mon time)) (elt x 1)))
(or (null (elt x 2))
(= (time->mday time) (elt x 2)))
(or (null (elt x 3))
(= (time->hour time) (elt x 3)))
(or (null (elt x 4))
(= (time->min time) (elt x 4)))
(or (null (elt x 5))
(= (time->sec time) (elt x 5))))
(condition-case err
(let ((when (car el))
(event (cdr el)))
(if (and (or (null (elt when 0))
(= (+ (time->year time) 1900) (elt when 0)))
(or (null (elt when 1))
(= (1+ (time->mon time)) (elt when 1)))
(or (null (elt when 2))
(= (time->mday time) (elt when 2)))
(or (null (elt when 3))
(= (time->hour time) (elt when 3)))
(or (null (elt when 4))
(= (time->min time) (elt when 4)))
(or (null (elt when 5))
(= (time->sec time) (elt when 5))))
(condition-case nil
(progn
(lyskom-insert " ")
(lyskom-format-insert (cdr el)
(lyskom-format-insert event
(+ (time->year time) 1900)
(1+ (time->mon time))
(time->mday time)
......@@ -1504,7 +1503,7 @@ prefix is negativ, invisible sessions are also shown.
If the prefix is 0, all visible sessions are shown."
(interactive "P")
(condition-case err
(condition-case nil
(if lyskom-dynamic-session-info-flag
(lyskom-who-is-on-9 arg)
(lyskom-who-is-on-8))
......@@ -1983,7 +1982,7 @@ WHO-INFOS that are potential sessions."
(defun lyskom-format-secs (time)
"Format the number of seconds in TIME as a human-readable string."
(let ((secs (% time 60))
(let (;; (secs (% time 60))
(mins (% (/ time 60) 60))
(hrs (% (/ time 3600) 24))
(days (/ time 86400))
......
......@@ -764,8 +764,7 @@ on one line."
(lyskom-list-summary
(text-list->texts
(read-info->text-list
(let ((list (read-list->all-entries lyskom-reading-list))
(len (read-list-length lyskom-reading-list))
(let ((len (read-list-length lyskom-reading-list))
(r 0))
(while (< r len)
(let ((type (read-info->type
......@@ -848,7 +847,6 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
;; We split the rest between author and subject
(namelen (/ (- (lyskom-window-width) 22) 3))
(subjlen (/ (* (- (lyskom-window-width) 22) 2) 3))
(author-name (lyskom-format "%#1:P" (text-stat->author text-stat)))
(format-string (concat "%=-8#1n%#2s%4#3d %=-"
(int-to-string namelen)
"#4P %[%#5@%=-"
......@@ -963,11 +961,13 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(format "%c" (car arg)))
(or (lyskom-command-name (cdr arg))
(and (keymapp (cdr arg))
(lyskom-get-string 'multiple-choice))
(lyskom-get-string
'multiple-choice))
(cdr arg)))))
keylis
"\n")))
next-char)
;; next-char
)
(if (eq major-mode 'lyskom-mode)
(progn
(lyskom-insert text)
......@@ -1026,10 +1026,10 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(lyskom-message "%s" (lyskom-get-string 'buggreport-compilestart))
(set-buffer old-buf)
(cond
((condition-case error
((condition-case nil
(eq old-buf (process-buffer lyskom-proc))
(error nil)))
((condition-case error
((condition-case nil
(save-excursion
(set-buffer (process-buffer lyskom-proc))
(set-buffer lyskom-unparsed-buffer)
......@@ -1053,7 +1053,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(princ (lyskom-get-string 'buggreport-system-id))
(print system-type)
(princ (lyskom-get-string 'buggreport-ctl-arrow-doc))
(print (condition-case error
(print (condition-case nil
(documentation-property 'ctl-arrow 'variable-documentation)
(error)))
......@@ -1588,54 +1588,53 @@ membership info."
(let* ((conf-stat (lyskom-read-conf-stat
(lyskom-get-string 'what-conf-to-change)
'(conf pers) nil "" t))
(foo
(let* ((type (conf-stat->conf-type conf-stat))
(box (conf-type->letterbox type))
(ori (conf-type->original type))
(pro (conf-type->rd_prot type))
(sec (conf-type->secret type)))
(lyskom-format-insert 'change-type-prompt
conf-stat
conf-stat
(cond
((or box ori pro sec)
(concat
"("
(if box (lyskom-get-string 'Mailbox) "")
(if (and box (or sec ori pro)) ", " "")
(if sec (lyskom-get-string
'Protected) "")
(if (and sec (or ori pro)) ", " "")
(if ori (lyskom-get-string
'no-comments) "")
(if (and ori pro) ", " "")
(if pro (lyskom-get-string 'closed) "")
")"))
(t "")))))
(open (lyskom-j-or-n-p (lyskom-get-string 'anyone-member)))
(secret (if (not open)
(lyskom-j-or-n-p (lyskom-get-string 'secret-conf))))
(orig (lyskom-j-or-n-p (lyskom-get-string 'comments-allowed)))
(anarchy (lyskom-j-or-n-p (lyskom-get-string 'anonymous-allowed))))
(cache-del-conf-stat (conf-stat->conf-no conf-stat))
(if (not (blocking-do
'set-conf-type
(conf-stat->conf-no conf-stat)
(lyskom-create-conf-type (not open)
(not orig)
secret
(conf-type->letterbox
(conf-stat->conf-type conf-stat))
anarchy
(conf-type->rsv1
(conf-stat->conf-type conf-stat))
(conf-type->rsv2
(conf-stat->conf-type conf-stat))
(conf-type->rsv3
(conf-stat->conf-type conf-stat)))))
(progn (lyskom-insert-string 'nope)
(lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
lyskom-errno)))))
(type (conf-stat->conf-type conf-stat))
(box (conf-type->letterbox type))
(ori (conf-type->original type))
(pro (conf-type->rd_prot type))
(sec (conf-type->secret type)))
(lyskom-format-insert 'change-type-prompt
conf-stat
conf-stat
(cond
((or box ori pro sec)
(concat
"("
(if box (lyskom-get-string 'Mailbox) "")
(if (and box (or sec ori pro)) ", " "")
(if sec (lyskom-get-string
'Protected) "")
(if (and sec (or ori pro)) ", " "")
(if ori (lyskom-get-string
'no-comments) "")
(if (and ori pro) ", " "")
(if pro (lyskom-get-string 'closed) "")
")"))
(t "")))
(let* ((open (lyskom-j-or-n-p (lyskom-get-string 'anyone-member)))
(secret (if (not open)
(lyskom-j-or-n-p (lyskom-get-string 'secret-conf))))
(orig (lyskom-j-or-n-p (lyskom-get-string 'comments-allowed)))
(anarchy (lyskom-j-or-n-p (lyskom-get-string 'anonymous-allowed))))
(cache-del-conf-stat (conf-stat->conf-no conf-stat))
(if (not (blocking-do
'set-conf-type
(conf-stat->conf-no conf-stat)
(lyskom-create-conf-type (not open)
(not orig)
secret
(conf-type->letterbox
(conf-stat->conf-type conf-stat))
anarchy
(conf-type->rsv1
(conf-stat->conf-type conf-stat))
(conf-type->rsv2
(conf-stat->conf-type conf-stat))
(conf-type->rsv3
(conf-stat->conf-type conf-stat)))))
(progn (lyskom-insert-string 'nope)
(lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
lyskom-errno))))))
......@@ -541,7 +541,6 @@ the LysKOM rules of string matching."
(tmp-accumulator nil)
(current-accumulator 'main-accumulator)
(done nil)
(next-char-start nil)
(paren-depth 0)
(have-here nil)
(last-event-worth-noting nil)
......
......@@ -89,8 +89,7 @@ Does lyskom-end-of-command."
(defun lyskom-dispatch-edit-text (proc misc-list subject body
&optional handler &rest data)
"Same as lyskom-edit-text except that it doesn't set lyskom-is-writing."
(let ((buf (process-buffer proc))
(buffer (generate-new-buffer
(let ((buffer (generate-new-buffer
(concat (buffer-name (process-buffer proc)) "-edit")))
(config (current-window-configuration)))
(setq lyskom-list-of-edit-buffers (cons buffer
......@@ -438,7 +437,7 @@ Entry to this mode runs lyskom-edit-mode-hook."
(if (cdr-safe (cdr-safe err))
(goto-char (car-safe (cdr-safe (cdr-safe err)))))
(lyskom-message "%s" (lyskom-get-string (car (cdr err))))
(condition-case arg
(condition-case nil
(let ((text ""))
(save-excursion
(set-buffer lyskom-buffer)
......@@ -571,7 +570,7 @@ text is a member of some recipient of this text."
(defun lyskom-send-transform-text (message)
(if lyskom-format-experimental
(condition-case err
(condition-case nil
(let ((buf (generate-new-buffer "lyskom-enriched")))
(unwind-protect
(save-excursion
......@@ -600,7 +599,7 @@ text is a member of some recipient of this text."
(save-excursion
(if (and (boundp 'lyskom-is-dedicated-edit-window)
lyskom-is-dedicated-edit-window)
(condition-case error
(condition-case nil
(delete-frame)
(error))))
(set-window-configuration lyskom-edit-return-to-configuration)
......@@ -655,7 +654,7 @@ text is a member of some recipient of this text."
(let ((p (point)))
(save-excursion
(let* ((buffer (current-buffer))
(headers (condition-case err
(headers (condition-case nil
(cdr (lyskom-edit-parse-headers))
(lyskom-edit-error nil))) ; Ignore these errors
(no nil))
......@@ -699,8 +698,7 @@ text is a member of some recipient of this text."
(defun lyskom-edit-add-recipient/copy (prompt string)
"Adds a new recipient or a cc-recipient to the text which is being edited."
(let ((marker (point-min-marker))
(edit-buffer (current-buffer))
(let ((edit-buffer (current-buffer))
(insert-at (point-min-marker))
(conf-stat (lyskom-read-conf-stat prompt '(all) nil "" t)))
(lyskom-save-excursion
......
......@@ -153,7 +153,7 @@
(defun lyskom-filter-verify-regexp (re)
"Return t if RE is a valid regexp."
(condition-case error
(condition-case nil
(progn
(string-match re "teststring")
t)
......@@ -481,7 +481,7 @@ If NEWLINE is non-nil, insert a newline after the header."
(lyskom-reverse-pairs (if kom-emacs-knows-iso-8859-1
lyskom-filter-actions
lyskom-swascii-filter-actions)))
action permanent filter tmp start end entry)
action permanent filter start end entry)
(if filter-edit-currently-edited-filter-entry-list
(progn
(goto-char (filter-entry->end (elt filter-edit-currently-edited-filter-entry-list
......
......@@ -170,7 +170,7 @@ invalid-value until a filter action has been selected.")
(if (or (null text)
(null author))
(setq lyskom-filter-hack nil)
(let (subject recipient-list text-stat)
(let (subject text-stat)
;;
;; Extract the subject
......@@ -211,7 +211,7 @@ invalid-value until a filter action has been selected.")
filter-list)
(let (tmp)
(while filter-list
(condition-case err
(condition-case nil
(if (functionp (filter->function (car filter-list)))
(setq tmp (funcall (filter->function (car filter-list))
(car filter-list)
......@@ -256,7 +256,7 @@ invalid-value until a filter action has been selected.")
(, (cons 'and (lyskom-create-filter-function-body pattern))))))
(defun lyskom-create-filter-function-body (pattern)
(let (inverse tmp)
(let (inverse)
(cond
;;
;; End of pattern
......@@ -623,8 +623,7 @@ the current text"
(def-kom-command kom-list-filters ()
"Display all filters"
(interactive)
(let ((filters lyskom-filter-list)
(filter nil))
(let ((filters lyskom-filter-list))
(goto-char (point-max))
(if (null filters)
(lyskom-insert (lyskom-get-string 'no-filters))
......
......@@ -309,7 +309,7 @@ If successful then set the buffer not-modified. Else print a warning."
working
(r 1))
(let* ((lyskom-options-text pointers)
word no
word
(r 1))
(while (> (length lyskom-options-text) 2)
(setq word (lyskom-read-options-eval-get-holerith))
......@@ -395,7 +395,7 @@ If successful then set the buffer not-modified. Else print a warning."
It returns nil, and writes a message when an error occurs."
(set (intern var)
(car
(condition-case err
(condition-case nil
(read-from-string string)
(invalid-read-syntax
(lyskom-format-insert (lyskom-get-string 'error-in-options)
......
......@@ -186,8 +186,7 @@ on such functions see the documentation for lyskom-add-button-action."
lyskom-text-buttons. Returns the modified string."
(let ((blist lyskom-text-buttons)
(start 0)
(el nil)
(props nil))
(el nil))
(while blist
(setq el (car blist))
(setq start 0)
......@@ -593,22 +592,24 @@ This is a LysKOM button action."
(user (if (match-beginning 1)
(substring url (match-beginning 1) (1- (match-end 1)))
nil))
(password nil))
;; (password nil)
)
(if (and user
(string-match "^\\([^:]*\\):\\(.*\\)" user))
(progn (setq password (substring user
(match-beginning 2)
(match-end 2)))
(setq user (substring user
(match-beginning 1)
(match-end 1)))))
(progn
;; (setq password (substring user
;; (match-beginning 2)
;; (match-end 2)))
(setq user (substring user
(match-beginning 1)
(match-end 1)))))
(telnet (concat host " " port))
;; (message "u:%s p:%s h:%s #:%s"
;; (or user "<u>")
;; (or password "<p>")
;; (or host "<h>")
;; (or port "<#>"))
;; (message "u:%s p:%s h:%s #:%s"
;; (or user "<u>")
;; (or password "<p>")
;; (or host "<h>")
;; (or port "<#>"))
))
......
No preview for this file type
......@@ -130,7 +130,7 @@ Value returned is always nil."
(list 'defun cmd args doc interactive-decl
(list 'lyskom-start-of-command (list 'quote cmd))
(list 'unwind-protect
(list 'condition-case 'error
(list 'condition-case nil
(cons 'progn
forms)
(list 'quit
......@@ -174,6 +174,20 @@ Value returned is always nil."
"Decrement the variable VAR and return the value."
(list 'setq var (list '1- var)))
(defmacro when (expr &rest body)
"Execute BODY if EXPR evaluates to non-nil"
(list 'if expr (cons 'progn body)))
(put 'when lisp-indent-function 1)
(put 'when 'edebug-form-spec t)
(defmacro unless (expr &rest body)
"Execute BODY if EXPR evaluates to non-nil"
(append (list 'if expr nil) body))
(put 'unless lisp-indent-function 1)
(put 'unless 'edebug-form-spec t)
;;; ======================================================================
;;; Multiple blocking read from server
......@@ -327,8 +341,7 @@ STRING should be given if the last search was by `string-match' on STRING."
;;;
(lyskom-provide-function map-keymap (fn keymap &optional sort-first)
(let ((lis nil)
(r 0))
(let ((r 0))
(cond ((vectorp keymap)
(while (< r (length keymap))
(if (aref keymap r)
......@@ -347,6 +360,20 @@ STRING should be given if the last search was by `string-match' on STRING."
(if tail
(setcdr tail new-parent))))
;;; ================================================================
;;; Faces
(defmacro lyskom-make-face (name &rest body)
(` (if (memq (, name) (face-list))
nil
(,@ body))))
(put 'lyskom-make-face 'lisp-indent-function 1)
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
;;; eval: (put 'lyskom-provide-macro 'lisp-indent-hook 2)
......
......@@ -117,7 +117,7 @@ Signal lyskom-parse-incomplete if the number is not followed by whitespace.
Signal lyskom-protocol-error if the next token is not a number."
(goto-char lyskom-parse-pos)
(let* ((max (point-max))
(result (condition-case read-error
(result (condition-case nil
;; Eval it to prevent malfunction when
;; edebug-all-defs or edebug-all-forms is non-nil.
(read (current-buffer))
......
......@@ -797,7 +797,7 @@ If reading forward then starts reading backward and the other way round."
(list (read-info->text-list info))
(texts (cdr list))
(forward (read-info->forward info)))
(setcdr list (nreverse (cdr list)))
(setcdr list (nreverse texts))
(set-read-info->forward info (not forward))
(lyskom-format-insert 'you-review
(lyskom-get-string (if (not forward)
......
......@@ -590,7 +590,7 @@ to see, set of call."
(lyskom-count-down-edits)
(run-hooks 'lyskom-mode-hook)
(lyskom-tell-phrases-validate)
(buffer-disable-undo)
(buffer-disable-undo (current-buffer))
(setq buffer-read-only t))
(defun lyskom-clear-vars ()
......
......@@ -1348,6 +1348,10 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "\C-?" 'scroll-down)
)
;;;==============================================================
;;; Keymap for filter editing
;;;
......
No preview for this file type
......@@ -409,15 +409,7 @@ This variable is not saved in the LysKOM server.")
This variable is stored in the LysKOM server.")
(defvar kom-default-face-scheme
(condition-case err
(cond ((null window-system) 'default)
((not (x-display-color-p)) 'monochrome)
((eq (cdr (assoc 'background-mode (frame-parameters))) 'dark)
'inverse)
(t 'default))
(error 'default))
(defvar kom-default-face-scheme nil
"*Face scheme to use per default for new logins.
This variable is not saved in the LysKOM server.")
......@@ -1336,26 +1328,6 @@ the value of kom-tell-phrases for fun.")
(defvar mode-line-conf-name nil
"Conf name that is present on the mode-line.")
;;; ================================================================
;;; Faces
(defmacro lyskom-make-face (name &rest body)
(` (if (memq (, name) (face-list))
nil
(,@ body))))
(put 'lyskom-make-face 'lisp-indent-function 1)
(defmacro when (expr &rest body)
"Execute BODY if EXPR evaluates to non-nil"
(list 'if expr (cons 'progn body)))
(put 'when lisp-indent-function 1)
(put 'when 'edebug-form-spec t)
;;
;; Set up default faces in case no face scheme is selected
;;
...