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

String checking supports expected errors.

Declared expected errors for string checker.
Show e-mail address of server admin on login failure
Correct multibytedness of buffer names.
Fix question about adding recipient as a cc-recipient instead.
Fix defaults for sub and move text.
Fix regression caused by printing summary statistics for clients.
parent 6ac81cc5
2000-08-29 David Byers <davby@ida.liu.se>
* check-strings.el: Support strings and user variables declared as
missing to eliminate spurious warnings. Support expected ending
mismatches.
* language.el (lyskom-language-missing-string-internal): New
function.
(lyskom-language-missing-string): New macro.
* startup.el (kom-start-anew): Print e-mail address for server
admin if user does not enter the correct password.
2000-08-29 David Byers <davby@sen2.ida.liu.se>
Correct multibytedness of buffer names:
* buffers.el (lyskom-recode-buffer-name): New function.
(lyskom-generate-new-buffer): Use it instead of
lyskom-maybe-recode-string.
(lyskom-get-buffer-create): Same here.
2000-08-29 David Byers <davby@ida.liu.se>
* edit-text.el (lyskom-edit-add-recipient/copy): Obey
kom-confirm-add-recipients.
Fix question whether to add cc-recipient:
* commands1.el (lyskom-add-helper): Inline check for cc-recipient.
Removed call to lyskom-last-added-rcpt.
(lyskom-verify-add-recipient): Removed.
* vars.el.in (kom-confirm-add-recipients): New variable.
(lyskom-add-recipient-hook): Removed.
Fix defaults for sub and move recipients:
* commands1.el (kom-sub-recipient): Use lyskom-last-sub-recipient
if it is one of the recipients. If a default recipient does not
exist, try the next.
(lyskom-default-recpt-for-sub): New function.
(kom-sub-recipient): Use lyskom-default-recpt-for-sub.
* vars.el.in (lyskom-last-added-rcpt): Made local.
(lyskom-last-added-ccrcpt): Ditto.
(lyskom-last-added-bccrcpt): Ditto.
(lyskom-last-sub-rcpt): New variable.
Bugfix for status session:
* commands1.el (lyskom-deferred-client-1): Work even when
defer-info data is just the session number.
(lyskom-deferred-client-2): Handle case when there is no
collector.
2000-08-28 David Byers <davby@ida.liu.se>
Make nearly all hooks local:
......
......@@ -36,7 +36,7 @@
# makefile too!
#
CLIENTVERSION = 0.46-BETA-O
CLIENTVERSION = 0.46-BETA-P
DOCFILES=NEWS-0.46
DEBIANCLIENTVERSION = $(shell echo $(CLIENTVERSION) | tr - .)
......@@ -122,7 +122,7 @@ all: $(TARGET)
vars.el: vars.el.in Makefile
rm -f vars.el
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/' < vars.el.in > vars.el
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/g' < vars.el.in > vars.el
chmod 444 vars.el
%.elc: %.el _header.el
......@@ -171,11 +171,13 @@ release-files: $(HEADER) $(SOURCES) $(DISTSRC) $(MISC) $(TARGET-EL)
mkdir lyskom-$(CLIENTVERSION)
cp $(HEADER) $(SOURCES) $(MISC) lyskom-$(CLIENTVERSION)
for i in $(DISTFILES) ; do \
cp distribution-$$i lyskom-$(CLIENTVERSION)/$$i ; \
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/g' < distribution-$$i \
> lyskom-$(CLIENTVERSION)/$$i; \
done
for i in $(DOCFILES) ; do \
cp ../doc/$$i lyskom-$(CLIENTVERSION)/$$i ; \
done
(cd lyskom-$(CLIENTVERSION); make lyskom-$(CLIENTVERSION).el)
chmod -R u+rw,g+r,o+r lyskom-$(CLIENTVERSION)
tar cvf lyskom-$(CLIENTVERSION).tar lyskom-$(CLIENTVERSION)
gzip -9 lyskom-$(CLIENTVERSION).tar
......
......@@ -343,8 +343,23 @@ categories")
(add-hook 'kill-buffer-query-functions 'lyskom-quit-query)
(add-hook 'kill-emacs-query-functions 'lyskom-quit-query)
(defun lyskom-recode-buffer-name (name)
(cond ((and (multibyte-string-p name) (not enable-multibyte-characters))
(encode-coding-string name
(or (and lyskom-language
(lyskom-language-coding
lyskom-language))
'raw-text)))
((and (not (multibyte-string-p name)) enable-multibyte-characters)
(decode-coding-string name
(or (and lyskom-language
(lyskom-language-coding
lyskom-language))
'raw-text)))
(t name)))
(defun lyskom-generate-new-buffer (name)
(setq name (lyskom-maybe-recode-string name))
(setq name (lyskom-recode-buffer-name name))
(let ((buf (generate-new-buffer name)))
(save-excursion
(set-buffer buf))
......@@ -356,7 +371,7 @@ If UNIQUE is non-nil, re-use the first existing buffer of category
CATEGORY, renaming it and killing its local variables.
The created buffer is made a child of the current buffer."
(setq name (lyskom-maybe-recode-string name))
(setq name (lyskom-recode-buffer-name name))
(let ((buffers (lyskom-buffers-of-category category))
(buffer nil))
(if (and unique buffers)
......
......@@ -21,6 +21,14 @@
(defvar lcs-message-buffer "*LysKOM string check*")
(defun lcs-expected-missing-langs (category name)
(cdr (assq 'lyskom-missing-languages (get name category))))
(defun lcs-ignore-ending-mismatch (category name l1 l2)
(and name category l1 l2
(member (cons l1 l2)
(cdr (assq 'lyskom-ending-mismatch (get name category))))))
(defun lyskom-check-strings ()
"Check the strings in LysKOM for sanity."
(interactive)
......@@ -79,6 +87,7 @@ STRINGS is a list of (language . string)."
;; (lcs-message t "Checking %s:%s" category name)
(let ((format-list 'uninitialized)
(first-str nil)
(first-lang nil)
(langs (mapcar 'car lyskom-languages)))
(while strings
(let* ((lang (car (car strings)))
......@@ -92,14 +101,20 @@ STRINGS is a list of (language . string)."
(and
(not (memq category lcs-dont-check-ending-categories))
(or (lcs-check-string-ending first-str str)
(lcs-ignore-ending-mismatch category name first-lang lang)
(lcs-message nil "(%s:%s) Ending mismatch\n %S\n %S"
category name first-str str))))
(setq format-list flist
first-str str))
first-str str
first-lang lang))
(setq strings (cdr strings)
langs (delq lang langs))))
(mapcar (lambda (el)
(setq langs (delq el langs)))
(lcs-expected-missing-langs category name))
(if langs
(lcs-message nil "(%s:%s) Missing languages %s"
category name langs))))
......@@ -197,9 +212,29 @@ Check that all server-stored variables are customizeable."
(cust-vars-all (append lyskom-elisp-variables
lyskom-global-boolean-variables
lyskom-global-non-boolean-variables)))
;; Check that variables have widget definitions and are in the
;; customize buffer, or are declared missing and really *are*
;; missing.
(mapcar
(lambda (var)
(cond ((not (memq var cust-vars-widgets))
(cond ((memq var lyskom-custom-variables-missing)
(if (memq var cust-vars-widgets)
(lcs-message nil "(%s:%s) Widget definition for variable declared as missing."
'lyskom-custom-variables var))
(if (memq var cust-vars-in-buffer)
(lcs-message nil "(%s:%s) Variable declared as missing in custom buffer."
'lyskom-custom-variables var))
(if (lyskom-get-string-internal (intern (format "%s-tag" var))
'lyskom-custom-strings)
(lcs-message nil "(%s:%s) Tag string for variable declared as missing."
'lyskom-custom-strings var))
(if (lyskom-get-string-internal (intern (format "%s-doc" var))
'lyskom-custom-strings)
(lcs-message nil "(%s:%s) Doc string for variable declared as missing."
'lyskom-custom-strings var)))
((not (memq var cust-vars-widgets))
(lcs-message nil "(%s:%s) No widget definition for variable."
'lyskom-custom-variables var))
((not (memq var cust-vars-in-buffer))
......
......@@ -2800,16 +2800,19 @@ Uses Protocol A version 9 calls"
(defun lyskom-deferred-client-1 (name defer-info)
(initiate-get-client-version 'deferred
'lyskom-deferred-client-2
(elt (defer-info->data defer-info) 0)
defer-info
name
(elt (defer-info->data defer-info) 1)
))
(let* ((data (defer-info->data defer-info))
(session (if (consp data) (elt data 0) data))
(collector (if (consp data) (elt data 1) nil)))
(initiate-get-client-version 'deferred
'lyskom-deferred-client-2
session
defer-info
name
collector
)))
(defun lyskom-deferred-client-2 (version defer-info name collect)
(lyskom-list-clients-collect name version collect)
(when collect (lyskom-list-clients-collect name version collect))
(lyskom-replace-deferred defer-info (if (zerop (length name))
"-"
(concat name " " version))))
......@@ -3153,21 +3156,6 @@ footnotes) to it as read in the server."
'adding-name-as-copy
'bcc-recpt))
(defvar lyskom-add-recipient-type)
(defvar lyskom-add-recipient-target)
(defvar lyskom-add-recipient-text)
(defun lyskom-verify-add-recipient ()
"Make sure the user really does mean to add a recipient
conference instead of just adding a carbon copy as he most likely
ought to. Useful as a lyskom-add-recipient-hook only."
(when (eq lyskom-add-recipient-type 'recpt)
(unless (lyskom-j-or-n-p (lyskom-format 'really-add-as-recpt-q
lyskom-add-recipient-target)
t)
(setq lyskom-add-recipient-type 'cc-recpt))))
(defun lyskom-add-helper (text-no last-variable who-prompt doing-prompt type)
(let* ((conf (blocking-do 'get-conf-stat (lyskom-default-value last-variable)))
(target (lyskom-read-conf-stat
......@@ -3179,35 +3167,49 @@ ought to. Useful as a lyskom-add-recipient-hook only."
(when (and target text-no)
(let ((lyskom-add-recipient-text text-no)
(lyskom-add-recipient-type type)
(lyskom-add-recipient-target target))
(run-hooks 'lyskom-add-recipient-hook)
(when (and (eq type 'recpt)
kom-confirm-add-recipients
(not (lyskom-j-or-n-p (lyskom-format 'really-add-as-recpt-q
target))))
(setq type 'cc-recpt
doing-prompt 'adding-name-as-copy))
(lyskom-set-default last-variable (conf-stat->conf-no target))
(lyskom-format-insert doing-prompt target text-no)
(lyskom-move-recipient text-no nil target type))))
(defun lyskom-default-recpt-for-sub (recipients)
"Select the default recipient for removal from RECIPIENTS.
The value of RECIPIENTS should be the result of a call to
\(lyskom-text-recipients text-no t\)."
(let ((last-sub (lyskom-default-value 'lyskom-last-sub-rcpt)))
(cond ((and (assq last-sub recipients)
(blocking-do 'get-conf-stat last-sub)))
((and (assq lyskom-current-conf recipients)
(blocking-do 'get-conf-stat lyskom-current-conf)))
((and (rassq 'RECPT recipients)
(blocking-do 'get-conf-stat (car (rassq 'RECPT recipients)))))
((and (car recipients)
(blocking-do 'get-conf-stat (car (car recipients))))))))
(when (and target text-no)
(lyskom-set-default last-variable (conf-stat->conf-no target))
(lyskom-format-insert doing-prompt target text-no)
(lyskom-move-recipient text-no nil target type))))))
(def-kom-command kom-sub-recipient (text-no)
"Remove a recipient from text TEXT-NO."
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-delete-recipient)))
(let ((text-stat (blocking-do 'get-text-stat text-no)))
(if text-stat
(let ((recipients (lyskom-text-recipients text-stat)))
(let ((recipients (lyskom-text-recipients text-stat t)))
(if recipients
(let* ((conf (cond ((memq lyskom-current-conf recipients)
(blocking-do 'get-conf-stat lyskom-current-conf))
((car recipients) (blocking-do 'get-conf-stat (car recipients)))))
(let* ((conf (lyskom-default-recpt-for-sub recipients))
(source (lyskom-read-conf-stat
(lyskom-get-string 'who-to-sub-q)
(list (cons 'restrict recipients))
(list (cons 'restrict (mapcar 'car recipients)))
nil
(cons (if conf (conf-stat->name conf) "") 0)
t)))
(when source
(lyskom-format-insert 'remove-name-as-recipient source text-no)
(lyskom-set-default 'lyskom-last-sub-rcpt (conf-stat->conf-no source))
(lyskom-move-recipient text-no source nil nil)
))
(lyskom-format-insert 'text-has-no-recipients-r text-no)))
......@@ -3219,35 +3221,34 @@ ought to. Useful as a lyskom-add-recipient-hook only."
(let ((text-stat (blocking-do 'get-text-stat text-no)))
(if text-stat
(let* ((recipients (lyskom-text-recipients text-stat t))
(default-recpt (or (car (assq lyskom-current-conf recipients))
(car (rassq 'RECPT recipients))
(car (car recipients)))))
(if (null default-recpt)
(default-from (lyskom-default-recpt-for-sub recipients))
(default-to (blocking-do 'get-conf-stat
(or (lyskom-default-value 'lyskom-last-added-rcpt)
lyskom-current-conf))))
(if (null default-from)
(lyskom-format-insert 'text-has-no-recipients-r text-no)
(blocking-do-multiple ((default-from (get-conf-stat default-recpt))
(default-to (get-conf-stat
(or lyskom-last-added-rcpt
lyskom-current-conf))))
(let ((source (lyskom-read-conf-stat 'who-to-move-from-q
(list
(cons 'restrict
(mapcar 'car
recipients)))
nil
(cons (if default-from
(conf-stat->name default-from)
"") 0)
t))
(target (lyskom-read-conf-stat 'who-to-move-to-q
'(all)
nil
(cons (if default-to
(conf-stat->name default-from)
"") 0)
t)))
(when (and source target)
(lyskom-format-insert 'moving-name source target text-stat)
(lyskom-move-recipient text-no source target 'recpt))))))
(let ((source (lyskom-read-conf-stat 'who-to-move-from-q
(list
(cons 'restrict
(mapcar 'car
recipients)))
nil
(cons (if default-from
(conf-stat->name default-from)
"") 0)
t))
(target (lyskom-read-conf-stat 'who-to-move-to-q
'(all)
nil
(cons (if default-to
(conf-stat->name default-from)
"") 0)
t)))
(when (and source target)
(lyskom-format-insert 'moving-name source target text-stat)
(lyskom-set-default 'lyskom-last-added-rcpt (conf-stat->conf-no target))
(lyskom-set-default 'lyskom-last-sub-rcpt (conf-stat->conf-no source))
(lyskom-move-recipient text-no source target 'recpt)))))
(lyskom-format-insert 'no-such-text-no text-no))))
......
......@@ -95,20 +95,21 @@ HEADER = header.el \
language.el
all: envcheck lyskom.elc
all: envcheck lyskom-@@CLIENTVERSION@@.elc
envcheck:
$(EMACS-BATCH) -l ./envcheck.el -f lyskom-check-environment
lyskom.elc: lyskom.el
$(EMACS-BATCH) -l ./lpath.el -f batch-byte-compile lyskom.el
lyskom-@@CLIENTVERSION@@.elc: lyskom-@@CLIENTVERSION@@.el
$(EMACS-BATCH) -l ./lpath.el -f batch-byte-compile lyskom-@@CLIENTVERSION@@.el
lyskom.el: $(HEADER) $(SOURCES)
cat $(HEADER) $(SOURCES) > lyskom.el
lyskom-@@CLIENTVERSION@@.el: $(HEADER) $(SOURCES)
cat $(HEADER) $(SOURCES) > lyskom-@@CLIENTVERSION@@.el
install: lyskom.elc
cp lyskom.el lyskom.elc $(LISPDIR)
install: lyskom-@@CLIENTVERSION@@.elc
cp lyskom-@@CLIENTVERSION@@.el lyskom-@@CLIENTVERSION@@.elc $(LISPDIR)
ln -s $(LISPDIR)/lyskom-@@CLIENTVERSION@@.elc $(LISPDIR)/lyskom.elc
clean:
$(RM) lyskom.el
$(RM) lyskom-@@CLIENTVERSION@@.el
$(RM) *~ *.elc core *.bak
......@@ -30,16 +30,16 @@
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.
c/o ISY, Linköpings universitet, S-581 83 Linköping, SWEDEN, or
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
02139, USA.
Please mail bug reports to bug-lyskom@lysator.liu.se.
Please mail change requests to kom@lysator.liu.se
1. What do I need
1. REQUIREMENTS
You need an Emacs. The client appears to work with the following
versions of Emacs:
......@@ -52,132 +52,176 @@
use Gnus, you may have to update that as well.
[2] It should be possible to run the client in Gnu Emacs 20.2 and
later, but you may experience some problems. Column alignment
is known to fail in version 20.2.
later, but you may experience some additional problems. Column
alignment is known to fail in version 20.2.
You need to have a recent version of the custom package installed.
The custom.el file that is bundled with Gnu Emacs 19.34 and older
versions of Gnus will not work.
The version that is bundled with recent versions of XEmacs, with
Gnu Emacs 20, with recent versions of Gnus and w3 is the one you
need.
There are also some requirements on supplemental elisp packages:
Custom is not longer distributed as a separate package, but it may
be available at <URL:http://www.dina.kvl.dk/~abraham/custom/>. An
old version is available in the elisp-client ftp directory at
<URL:ftp://ftp.lysator.liu.se/pub/lyskom/elisp-client/>.
* custom
If you have a version of Gnus installed that uses the old custom
package, it's time to upgrade. The latest version of Gnus is
available from <URL:http://www.gnus.org/>.
You need to have a recent version of the custom package
installed. The custom.el file that is bundled with Gnu Emacs
19.34 and older versions of Gnus will not work.
MAKE SURE YOU DO NOT HAVE a file called macedit.el early in your
load path. This file redefines a function that the client relies
heavly on. The redefinition is buggy. You can recognize this
problem if your Emacs says something like this: "Key sequence < m
o u s e - 2 > uses invalid prefix characters".
The version that is bundled with recent versions of XEmacs, with
Gnu Emacs 20, with recent versions of Gnus and w3 is the one you
need.
Custom is not longer distributed as a separate package, but it
may be available at <URL:http://www.dina.kvl.dk/~abraham/
custom/>. An old version is available in the elisp-client ftp
directory at <URL:ftp://ftp.lysator.liu.se/pub/lyskom/elisp-
client/>.
If you have a version of Gnus installed that uses the old custom
package, it's time to upgrade. The latest version of Gnus is
available from <URL:http://www.gnus.org/>.
2. What should I have
* You must NOT HAVE macedit.el
LysKOM can use w3 for displaying HTML and calc for performing
calculations. Neither package is required, but since they are
useful in their own right you might as well install them anyway.
Make sure you do not have a file called macedit.el early in your
load path. This file redefines a function that the client relies
heavly on. The redefinition is buggy. You can recognize this
problem if your Emacs says something like this: "Key sequence <
m o u s e - 2 > uses invalid prefix characters" when you load or
compile the elisp client.
At the time of writing this, the latest version of W3 is 4.0. It
is available from <URL:http://www.cs.indiana.edu/elisp/w3/w3.html>
* w3 4.0 or later (optional)
LysKOM can use w3 for displaying HTML. At the time of writing
this, the latest version of W3 is 4.0. It is available from
<URL:http://www.cs.indiana.edu/elisp/w3/w3.html> and included in
many distributions of Emacs. If w3 is not installed, LysKOM will
be unable to display HTML.
The latest version of calc, when writing this, is available at
<URL:ftp://ftp.gnu.org/pub/gnu/calc/calc-2.02f.tar.gz>
* calc (optional)
LysKOM uses calc to implement the "Compute" command. If you want
to use it you need calc. The latest version of calc, as of
writing this, is available at <URL:ftp://ftp.gnu.org/pub/gnu/
calc/calc-2.02f.tar.gz>
3. Installation
There are two ways to install the client. You can assemble,
compile and install it from a tar file, or from a single emacs
lisp file.
You will have received the client in a compressed tar archive or
in a zip file. The archive contains all the files needed to build
the client and a pre-built client.
The client is also available as an RPM (for RedHat, Mandrake,
Gentus and other RedHat-based Linux distributions) and a Debian
package. These assume that you are using Gnu Emacs 20.5 or later.
You can either install manually (see section 3.1) or using the
Makefile (section 3.3). However you install, there are a few
additional steps that you may want to follow to facilitate using
the client (section 3.3).
3.1 Manual installation
This procedure should work on any system, including Windows.
1. Compile the client with the command `emacs -batch -f
batch-byte-compile-file lyskom-@@CLIENTVERSION@@.el'
If you are using a Unix system (or something sufficiently
similar), try installing from the tar file. If you are using
Microsoft Windows, install using the single file.
You may see some warnings when you compile. Most of these can
be ignored. When compilation is done you should have a new file
named lyskom-@@CLIENTVERSION@@.elc located in the same directory as
lyskom-@@CLIENTVERSION@@.el.
2. Copy lyskom-@@CLIENTVERSION@@.elc to where you want to install
the client and either rename the file lyskom.elc or create a
symbolic link from lyskom.elc to lyskom-@@CLIENTVERSION@@.elc.
3.1 Installation from the tar file
If possible you should place it in your site-lisp directory.
Check the value of load-path (C-h v l o a d - p a t h RET) to
see possible locations.
Edit the Makefile in the distribution to reflect your environment.
You can change the following variables:
EMACS should be set to the command used to start Emacs. Usually
this will be either emacs or xemacs.
3.2 Using the Makefile
LISPDIR is the directory in which the compiled and uncompiled
client will go. This will normally be set to your site-lisp
directory.
If you are on a Unix-like system (or anything that supports
Makefiles) you can use make to install the client. You have to use
the Makefile method if you want to change the list of available
languages.
INFODIR is where the info files will go, once we've written
them. You should set this variable on the off chance that we
distributed some documentation with the code.
LANGUAGES is a list of languages to compile in. As of version
0.45 there are only two translations of LysKOM. The Makefile
states which values are legal. Just list all the languages you
want, separated by whitespace. The first language you specify
will be the default language.
1. Edit the Makefile in the distribution to reflect your
environment. You can change the following variables:
Type `make envcheck' to make sure your Emacs environment is set up
correctly. The environment check is somewhat pessimistic. It is
entirely possible that LysKOM will run just fine even if it
complains.
EMACS should be set to the command used to start Emacs.
Usually this will be either `emacs' or `xemacs'.
If you need to add anything to the default load path for
compiling, edit the file lpath.el.
LISPDIR is the directory in which the compiled and
uncompiled client will go. This will normally be set to your
site-lisp directory.
Type `make'. If your environment is set up correctly, LysKOM
should be compiled. When compilation is finished, type `make
install' to copy all the relevant files to the relevant places. If
you do `make install' without just doing `make', you'll bypass the
environment check, which is probably not a good idea.
INFODIR is where the info files will go, once we've written
them. You should set this variable on the off chance that we
distributed some documentation with the code.
Start Emacs, load lyskom.elc and type M-x lyskom RET, and you
should be in business.
LANGUAGES is a list of languages to compile in. As of version
0.46 there are only two translations of LysKOM. The Makefile
states which values are legal. Just list all the languages
you want, separated by whitespace. The first language you
specify will be the default language.
If you have your own LysKOM server you may want to modify the
variable kom-server-aliases. The best place to change it is in your
site init file. For example, if you are running a server on
kom.domain.org, you might want to say something like this in your
init file:
2. Run `make envcheck' to make sure your Emacs environment is set
up correctly. The environment check does not read your .emacs,
so it will not find libraries that are not in the default load
path. This means that it is possible that LysKOM will run just
fine for you even if it complains.
(defvar kom-server-aliases