Commit db2ae656 authored by David Byers's avatar David Byers
Browse files

Bug fixes.

Unibyte and MULE support reworked some more.
Got rid of compiler warnings.
Fix compatibility with XEmacs 20.4

Paranoid check of Emacs version in build and load. See header.el
parent 94534a8b
2000-08-23 David Byers <davby@ida.liu.se>
* commands2.el (lyskom-stop-keep-alive): Use disable-timeout for
XEmacs 20.4 compatibility.
(lyskom-keep-alive): Use add-timeout for XEmacs 20.4
compatibility.
Get rid of compiler warnings:
* utilities.el (functionp): Use lyskom-compiled-function-p, not
byte-code-function-p to eliminate a warning.
(lyskom-compiled-function-p): Define depending on Emacs version to
avoid using function marked as obsolete in XEmacs but not in Emacs
and vice versa (compiled-function-p vs byte-code-function-p).
* lyskom-buttons.el (kom-mouse-null): Added call to identity to
get rid of compiler warning in Gnu Emacs 20.2.
* lyskom-rest.el (lyskom-is-loaded): defvar
frame-icon-title-format to avoid compiler warnings.
* compatibility.el (strikethrough): Define face strikethrough
here. The type of definition is set at compile time.
* utilities.el (lyskom-setup-faces): Move creation of face
strikethrough to compatibility.el.
2000-08-22 David Byers <davby@ida.liu.se>
Get rid of compiler warnings:
* compatibility.el (lyskom-encode-coding-char): Test emacs version
at compile time to get rid of some warnings. Downside is that we
need to run in the same version (more or less) that we compiled
in.
Get completing-read to work in unibyte MULE emacsen:
* startup.el (lyskom-read-server-name): Use
lyskom-completing-read.
* remote-control.el (kom-remote-autoreply): Use
lyskom-completing-read.
* lyskom-buttons.el (lyskom-keyboard-menu): Use
lyskom-completing-read. Recove completion table as necessary.
* filter.el (lyskom-filter-read-action): Use
lyskom-completing-read.
* filter-edit.el (lyskom-filter-edit-insert-entry): Use
lyskom-completing-read.
(lyskom-filter-edit-insert-pattern): Use lyskom-completing-read.
* edit-text.el (kom-edit-add-cross-reference): Use
lyskom-completing-read.
* completing-read.el (lyskom-read-session-resolve-ambiguity): Use
lyskom-completing-read.
* command.el (lyskom-read-extended-command): Use
lyskom-completing-read.
* commands2.el (kom-change-language): Use lyskom-completing-read.
(kom-del-faq): Use lyskom-completing-read.
* utilities.el (lyskom-default-collate-table): Rewrote the string
so it can be safely encoded in iso-8859-1 so that Gnu Emacs will
not attempt to save it in emacs-mule encoding, which would fuck it
up completely.
* startup.el (lyskom-read-server-name): Recode completion table as
necessary.
* remote-control.el (kom-remote-autoreply): Recode completion
table as necessary.
* commands2.el (kom-del-faq): Recode completion table as
necessary.
* completing-read.el (lyskom-read-session-resolve-ambiguity):
Recode completion table as necessary.
* filter-edit.el (lyskom-filter-edit-insert-entry): Recode
completion tables as necessary.
(lyskom-filter-read-action): Recode completion table as necessary.
* commands2.el (kom-change-language): Recode completion table as
necessary.
* command.el (lyskom-read-extended-command): Recode completion
table as necessary.
* utilities.el (lyskom-maybe-frob-completion-table): New function
to recode completion tables for completing-read according to the
state of enable-multibyte-characters.
2000-08-22 David Byers <davby@ida.liu.se>
* completing-read.el (lyskom-completing-match-string): Quote
string to be used as regexp.
* commands1.el (kom-list-created-conferences): Re-signal caught
quit signal.
2000-08-21 David Byers <davby@ida.liu.se>
* buffers.el (lyskom-traverse-buffer-hierarchy): Test liveness of
current buffer, not root buffer (doh!).
2000-08-21 David Byers <davby@sen2.ida.liu.se>
* Release av 0.46-BETA-N
......
......@@ -98,7 +98,8 @@ SOURCES = $(LANGUAGE-EL) \
talkback.el \
lyskom-rest.el
HEADER = defvar.el \
HEADER = header.el \
defvar.el \
feature.el \
vars.el \
macros.el \
......@@ -124,11 +125,11 @@ vars.el: vars.el.in Makefile
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/' < vars.el.in > vars.el
chmod 444 vars.el
%.elc: %.el header.el
$(EMACS-BATCH) -l ./lpath.el -l ./header.el -f batch-byte-compile $<
%.elc: %.el _header.el
$(EMACS-BATCH) -l ./lpath.el -l ./_header.el -f batch-byte-compile $<
header.el: $(HEADER)
cat $(HEADER) > header.el
_header.el: $(HEADER)
cat $(HEADER) > _header.el
fast: $(HEADER-ELC) $(SOURCES-ELC)
cat $(HEADER-ELC) $(SOURCES-ELC) > $(TARGET)
......
......@@ -136,7 +136,7 @@ a child of some buffer, reparent it."
(setq current (car queue))
(setq queue (cdr queue))
(unless (or (memq current done)
(not (buffer-live-p buffer)))
(not (buffer-live-p current)))
(setq done (cons current done))
(setq queue (append queue (lyskom-get-buffer-children current)))
(funcall function current)))))
......
......@@ -209,7 +209,7 @@
(alternatives (mapcar
(lambda (pair)
(cons
(lyskom-maybe-recode-string (cdr pair))
(cdr pair)
(car pair)))
(lyskom-get-strings lyskom-commands
'lyskom-command)))
......@@ -228,16 +228,17 @@
(lyskom-get-string 'extended-command))))
(lyskom-with-lyskom-minibuffer
(setq name (completing-read prompt
alternatives
;; lyskom-is-administrator is buffer-local and
;; must be evalled before the call to
;; completing-read
;; Yes, this is not beautiful
(list 'lambda '(alternative)
(list 'lyskom-ok-command 'alternative
lyskom-is-administrator))
t nil 'lyskom-command-history)))
(setq name (lyskom-completing-read prompt
(lyskom-maybe-frob-completion-table
alternatives)
;; lyskom-is-administrator is buffer-local and
;; must be evalled before the call to
;; completing-read
;; Yes, this is not beautiful
(list 'lambda '(alternative)
(list 'lyskom-ok-command 'alternative
lyskom-is-administrator))
t nil 'lyskom-command-history)))
(cdr (lyskom-string-assoc name alternatives))))
(defun lyskom-start-of-command (function &optional may-interrupt)
......
......@@ -1483,7 +1483,8 @@ Those that you are not a member in will be marked with an asterisk."
(goto-char (point-max))
(and kom-continuous-scrolling (lyskom-scroll)))))))
(quit (aset counter 0 t)
(lyskom-cancel-call 'main calls))))
(lyskom-cancel-call 'main calls)
(signal 'quit nil))))
(lyskom-insert (lyskom-get-string (if arg 'no-pers-confs-exist 'no-confs-exist))))
(lyskom-format-insert (lyskom-current-error))))))
......
......@@ -1927,13 +1927,13 @@ Return-value: 'no-session if there is no suitable session to switch to
(interactive)
(let* ((completion-ignore-case t)
(table (lyskom-available-language-list))
(language (completing-read
(lyskom-get-string 'which-language)
table
nil
t
nil
'lyskom-language-history)))
(language (lyskom-completing-read
(lyskom-get-string 'which-language)
(lyskom-maybe-frob-completion-table table)
nil
t
nil
'lyskom-language-history)))
(when (lyskom-string-assoc language table)
(lyskom-set-language (cdr (lyskom-string-assoc language table))))))
......@@ -1957,7 +1957,8 @@ Return-value: 'no-session if there is no suitable session to switch to
(lambda (codelist)
(when (assq code codelist)
(setq result
(cons (cons (cdr (assq code codelist)) code)
(cons (cons (cdr (assq code codelist))
code)
result)))))
tmp)))
codes)
......@@ -2000,7 +2001,9 @@ Return-value: 'no-session if there is no suitable session to switch to
(completion-ignore-case t)
(type (cdr (lyskom-string-assoc
(completing-read (lyskom-get-string 'label-what-kind)
completions nil t)
(lyskom-maybe-frob-completion-table
completions)
nil t)
completions)))
(objno nil)
(label nil)
......@@ -2154,8 +2157,10 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-format-insert 'conf-no-does-not-exist-r conf-no))
((null faq-list)
(lyskom-format-insert 'conf-has-no-faq conf-stat))
(t (setq text-no (completing-read (lyskom-get-string
'text-to-del-as-faq) faq-list nil t))
(t (setq text-no (lyskom-completing-read (lyskom-get-string 'text-to-del-as-faq)
(lyskom-maybe-frob-completion-table
faq-list)
nil t))
(when text-no
(lyskom-format-insert 'deleting-faq
(string-to-int text-no)
......@@ -2384,7 +2389,10 @@ The variable kom-keep-alive-interval controls the frequency of the request."
(defun lyskom-keep-alive ()
(setq lyskom-keep-alive-timers
(cons
(run-with-timer kom-keep-alive-interval kom-keep-alive-interval 'lyskom-keep-alive-callback (current-buffer))
(add-timeout kom-keep-alive-interval
'lyskom-keep-alive-callback
(current-buffer)
kom-keep-alive-interval)
lyskom-keep-alive-timers)))
(def-kom-command kom-stop-keep-alive ()
......@@ -2398,7 +2406,7 @@ The variable kom-keep-alive-interval controls the frequency of the request."
(defun lyskom-stop-keep-alive ()
(mapcar 'cancel-timer lyskom-keep-alive-timers)
(mapcar 'disable-timeout lyskom-keep-alive-timers)
(setq lyskom-keep-alive-timers nil))
......
......@@ -164,9 +164,6 @@ KEYS should be a string in the format used for saving keyboard macros
;;;
(lyskom-provide-macro byte-code-function-p (obj)
(` (compiled-function-p (, obj))))
(lyskom-provide-function characterp (obj)
(integerp obj))
......@@ -341,16 +338,20 @@ string to search in."
;; defmacro lyskom-encode-coding-char in XEmacs so the compiled code
;; is quicker. In Gnu Emacs define it as a function.
;;
;; The definition is made at compile-time to avoid getting warnings
;; about encode-coding-char.
(eval-and-compile
(lyskom-xemacs-or-gnu
(defmacro lyskom-encode-coding-char (c system) c)
(if (fboundp 'encode-coding-char)
(defun lyskom-encode-coding-char (c system)
(let ((s (encode-coding-char c system)))
(if (and s (= (length s) 1))
(elt s 0))))
(defun lyskom-encode-coding-char (c system) c))))
(cond ((eval-when-compile (string-match "XEmacs" (emacs-version)))
(defmacro lyskom-encode-coding-char (c system) c))
((eval-when-compile (fboundp 'encode-coding-char))
(defun lyskom-encode-coding-char (c system)
(let ((s (encode-coding-char c system)))
(if (and s (= (length s) 1))
(elt s 0)))))
(t (defmacro lyskom-encode-coding-char (c system) c))))
(eval-and-compile
(lyskom-xemacs-or-gnu
......@@ -365,6 +366,24 @@ string to search in."
(t (string-width str))))))
(eval-and-compile
(cond ((eval-when-compile (string-match "XEmacs" (emacs-version)))
(defun lyskom-completing-read (prompt
table
&optional predicate require-match
init hist def inherit-input-method)
(completing-read prompt table predicate require-match init hist)))
((eval-when-compile (> emacs-major-version 19))
(fset 'lyskom-completing-read (symbol-function 'completing-read)))
(t
(defun lyskom-completing-read (prompt
table
&optional predicate require-match
init hist def inherit-input-method)
(completing-read prompt table predicate require-match init hist)))))
(lyskom-provide-function last (x &optional n)
"Returns the last link in the list LIST.
With optional argument N, returns the Nth-to-last link (default 1)."
......@@ -406,6 +425,12 @@ property and a property with the value nil."
(lyskom-xemacs-or-gnu (make-face name nil temporary)
(make-face name)))
(if (not (find-face 'strikethrough))
(progn (make-face 'strikethrough)
(if (eval-when-compile (fboundp 'set-face-strikethrough-p))
(set-face-strikethru-p 'strikethrough t)
(set-face-underline-p 'strikethrough t))))
;;; ======================================================================
;;; Event stuff
......
......@@ -533,7 +533,7 @@ function work as a name-to-conf-stat translator."
(defun lyskom-completing-match-string (string name)
"Return non-nil if STRING matches NAME using LysKOM completion rules."
(string-match (concat "^"
(replace-in-string (lyskom-unicase (lyskom-completing-strip-name string))
(replace-in-string (regexp-quote (lyskom-unicase (lyskom-completing-strip-name string)))
"\\s-+" "\\\\S-*\\\\s-+")
"\\s-*")
(lyskom-completing-strip-name (lyskom-unicase name))))
......@@ -1014,9 +1014,10 @@ the LysKOM rules of string matching."
(lyskom-scroll)
(while (string= ""
(lyskom-with-lyskom-minibuffer
(setq result (completing-read
(setq result (lyskom-completing-read
(lyskom-get-string 'resolve-session)
who-info
(lyskom-maybe-frob-completion-table
who-info)
nil
t
(car (car who-info))
......
;;;;; -*-coding: raw-text;-*-
;;;;; -*-coding: iso-8859-1;-*-
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991, 1996 Lysator Academic Computer Association.
......
......@@ -86,7 +86,8 @@ SOURCES = $(LANGUAGE-EL) \
talkback.el \
lyskom-rest.el
HEADER = defvar.el \
HEADER = header.el \
defvar.el \
feature.el \
vars.el \
macros.el \
......
......@@ -1285,8 +1285,10 @@ RECPT-TYPE is the type of recipient to add."
(cons (lyskom-get-string 'text) 'text)))
(completion-ignore-case t)
(type (cdr (lyskom-string-assoc
(completing-read (lyskom-get-string 'xref-type)
completions nil t)
(lyskom-completing-read (lyskom-get-string 'xref-type)
(lyskom-maybe-frob-completion-table
completions)
nil t)
completions)))
(obj nil)
(prompt nil)
......
......@@ -478,10 +478,11 @@ If NEWLINE is non-nil, insert a newline after the header."
(insert "\n"))
(goto-char filter-edit-list-end))
(setq action (completing-read (lyskom-get-string 'filter-edit-filter-how)
rev-actions
nil
t))
(setq action (lyskom-completing-read (lyskom-get-string 'filter-edit-filter-how)
(lyskom-maybe-frob-completion-table
rev-actions)
nil
t))
(setq permanent
(lyskom-j-or-n-p (lyskom-get-string 'filter-permanent) t))
(setq filter (make-filter nil
......@@ -518,13 +519,15 @@ If NEWLINE is non-nil, insert a newline after the header."
(inhibit-read-only t)
(completion-ignore-case t)
(rev-what (lyskom-reverse-pairs lyskom-filter-what)))
(setq what (completing-read
(setq what (lyskom-completing-read
(lyskom-get-string 'filter-edit-filter-what)
rev-what
(lyskom-maybe-frob-completion-table rev-what)
nil t))
(setq pred
(completing-read (lyskom-format 'filter-edit-insert-pred what)
lyskom-filter-predicate-list
(lyskom-completing-read (lyskom-format 'filter-edit-insert-pred what)
(lyskom-maybe-frob-completion-table
lyskom-filter-predicate-list
t)
nil t))
(setq argstring (read-from-minibuffer
(lyskom-format 'filter-edit-insert-arg what pred)))
......@@ -553,7 +556,8 @@ If NEWLINE is non-nil, insert a newline after the header."
(setq pat
(cons what arg))
(if (cdr (assoc pred lyskom-filter-predicate-list))
(if (cdr (assoc pred (lyskom-maybe-frob-completion-table
lyskom-filter-predicate-list t)))
(setq pat (cons 'not pat)))
;;
......
......@@ -428,13 +428,14 @@ invalid-value until a filter action has been selected.")
(let ((completion-ignore-case t))
(car
(rassoc
(completing-read (lyskom-get-string 'filter-action)
(lyskom-reverse-pairs
lyskom-filter-actions)
nil
nil
(cdr (car lyskom-filter-actions))
t)
(lyskom-completing-read (lyskom-get-string 'filter-action)
(lyskom-maybe-frob-completion-table
(lyskom-reverse-pairs
lyskom-filter-actions))
nil
nil
(cdr (car lyskom-filter-actions))
t)
lyskom-filter-actions))))
......
;;;;; -*-coding: iso-8859-1;-*-
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991, 1996 Lysator Academic Computer Association.
;;;;;
;;;;; This file is part of the LysKOM server.
;;;;;
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by
;;;;; the Free Software Foundation; either version 2, or (at your option)
;;;;; any later version.
;;;;;
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;;;;; for more details.
;;;;;
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING. If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se.
;;;;;
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: header.el
;;;;
;;;; Code that needs to go before everything else
;;;;
;;; Check the version of Emacs when compiling
;;;
;;; If the version of Emacs is too old, signal an error.
;;; We require Gnu Emacs 19.34 or 20.3 or XEmacs 21.1.
(eval-and-compile
(if (or (not (boundp 'emacs-major-version))
(not (boundp 'emacs-minor-version))
(and (string-match "XEmacs" (emacs-version))
(or (< emacs-major-version 20)
(and (= emacs-major-version 20)
(< emacs-minor-version 4))
(and (= emacs-major-version 21)
(< emacs-minor-version 1))))
(and (not (string-match "XEmacs" (emacs-version)))
(or (< emacs-major-version 19)
(and (= emacs-major-version 19)
(< emacs-minor-version 34))
(and (= emacs-major-version 20)
(< emacs-minor-version 2)))))
(error "Emacs 19.34, XEmacs 21.1 or later, or Emacs 20.2 or later is required")))
(cond ((or (not (boundp 'emacs-major-version))
(not (boundp 'emacs-minor-version))
(< emacs-major-version (eval-when-compile emacs-major-version)))
(error "LysKOM was compiled for a newer version of Emacs"))
((and (eq (eval-when-compile emacs-major-version) 19)
(> emacs-major-version 19))
(error "A LysKOM client compiled for Emacs 19 will not run in newer versions of Emacs.")))
......@@ -154,7 +154,7 @@ If there is no active area, then do something else."
"Do nothing."
(interactive "@e")
;; This is here to pervent unwanted events when clicking mouse-3
)
(identity 1))
(defun lyskom-make-button-menu (title entries buf arg text)
"Create a menu keymap from a list of button actions."
......@@ -246,12 +246,13 @@ If there is no active area, then do something else."
(- (window-width (minibuffer-window))
maxlen 3))) ": "))
(let ((choice (completing-read prompt
entries
nil
t
(cons (car (car entries))
0) nil)))
(let ((choice (lyskom-completing-read prompt
(lyskom-maybe-frob-completion-table
entries t)
nil
t
(cons (car (car entries))
0) nil)))
(when choice
(funcall (cdr (lyskom-string-assoc choice entries))
buf arg text)))))
......
......@@ -3540,6 +3540,7 @@ One parameter - the prompt string."
(define-key lyskom-modeline-keymap (kbd (lyskom-keys 'button3)) 'kom-modeline-select-unread-kom))
(defvar frame-icon-title-format)
(if lyskom-is-loaded
nil
......
......@@ -71,10 +71,13 @@ turn auto-reply on, off turn it off and nil toggle its state."
nil nil t))))
(setq state (or state
(cdr-safe (assoc
(completing-read
(lyskom-completing-read
(lyskom-get-string 'remote-control-autoreply)
lyskom-onoff-table nil t nil nil)
lyskom-onoff-table))))
(lyskom-maybe-frob-completion-table
lyskom-onoff-table t)
nil t nil nil)
(lyskom-maybe-frob-completion-table
lyskom-onoff-table t)))))
(let ((info (blocking-do 'get-session-info session-no)))
(lyskom-send-message (session-info->pers-no info)
(format "Remote-command: %d %d\nautoreply\n%s"
......
......@@ -693,7 +693,10 @@ alias name is entered, the corresponding address is returned."
kom-server-aliases)))
(completion-ignore-case t)
server)
(setq server (completing-read prompt known-servers nil nil))
(setq server (lyskom-completing-read prompt
(lyskom-maybe-frob-completion-table
known-servers)
nil nil))
(or (cdr (lyskom-string-assoc server known-servers))
server)))
......
......@@ -726,7 +726,7 @@ M
;; From review.el:
(no-review-done . "Du mste terse innan du kan terse mer.\n")
(not-reviewing . "Du mste hller inte p att terse ngot nu.\n")
(not-reviewing . "Du hller inte p att terse ngot nu.\n")
(review-how-many . "terse hur mnga?")
(review-how-many-more . "terse ytterligare hur mnga?")
(latest-n . "senaste %#1d")
......
;;;;; -*-coding: raw-text;-*-
;;;;; -*-coding: iso-8859-1;-*-
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991, 1996 Lysator Academic Computer Association.
......
......@@ -141,6 +141,11 @@ If BEFORE is not in the list, then insert EL at the end of the list."
;;; These should be shared in LysKOM
;;;
(eval-and-compile
(if (eval-when-compile (string-match "XEmacs" emacs-version))