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

En massa ändringar...

parent 12ece8a3
Sun Oct 20 03:46:22 1996 David Kgedal <davidk@lysator.liu.se>
* swedish-strings.el: Flyttade alla defvar till vars.el.in (med
nil-vrden) och ersatte med lyskom-language-var.
* startup.el (lyskom-mode): Anropa inte
lyskom-tell-phrases-validate.
* review.el (kom-review-noconversion): Flyttade hit.
* macros.el (lyskom-expected-unresolved-functions): Anvnd inte
eval-when-compile.
Flyttade ut def-kom-command till command.el.
* utilities.el (device-class): Hantera icke-X.
* command.el: Ny fil.
* lyskom-rest.el (lyskom-tell-string): Anvnd lyskomg-et-string.
Flyttade ngra funktioner till command.el.
* english-strings.el (lyskom-menu): ndrade "Person" till "User".
* La till en massa provide och require p olika stllen. Inte
klart.
* Makefile: Modifierade sttet som enskilda filer byggs. La till
command.el.
* flags.el (lyskom-read-options): Anropa inte
lyskom-tell-phrases-validate.
* lyskom-rest.el (lyskom-missing-fields): Tog bort.
(lyskom-tell-phrases-validate): Tog bort.
* command.el: Ny fil.
* language.el (lyskom-language-strings): Bytte namn frn
lyskom-define-language.
(lyskom-language-var): Nytt makro.
(lyskom-language-var-internal): Ny funktion.
(lyskom-language-vars): Ny variabel.
Tue Oct 15 03:30:31 1996 David Kgedal <davidk@lysator.liu.se>
* commands1.el (lyskom-do-go-to-conf): Tog bort specialhacket fr
icke-prefetchade mten.
Fri Oct 11 02:52:14 1996 David Kgedal <davidk@lysator.liu.se>
* review.el (kom-review-noconversion): Flyttade hit frn
swedish-strings.el och english-strings.el.
* lyskom-rest.el (lyskom-command-name): Anvnd defsubst.
* commands1.el (kom-write-comment): Anvnd lyskom-command-name.
* vars.el.in (kom-allow-incompleteness): Ny variabel.
* commands2.el (kom-list-news): Anvnd den.
......
......@@ -39,14 +39,17 @@ RM = /usr/gnu/bin/rm -vf
# for compiling using emacs 19!
EMACS=emacs
EMACS-BATCH = $(EMACS) -batch
EMACS-BATCH = $(EMACS) -batch -l ./lpath.el
# NOTE: lyskom-rest.el must be the last file in PARTS-EL and SRC-ELC.
PARTS-EL = komtypes.el clienttypes.el deferred-insert.el utilities.el \
prefetch.el \
startup.el \
reading.el \
internal.el parse.el services.el cache.el\
internal.el \
services.el \
command.el \
parse.el cache.el\
commands1.el commands2.el review.el edit-text.el \
filter.el filter-edit.el lyskom-buttons.el \
view-text.el async.el completing-read.el \
......@@ -64,7 +67,10 @@ SRC-ELC = komtypes.elc clienttypes.elc deferred-insert.elc utilities.elc \
prefetch.elc \
startup.elc \
reading.elc \
internal.elc parse.elc services.elc cache.elc\
internal.elc \
services.elc \
command.elc \
parse.elc cache.elc\
commands1.elc commands2.elc review.elc edit-text.elc \
filter.elc filter-edit.elc lyskom-buttons.elc \
view-text.elc async.elc completing-read.elc \
......@@ -79,7 +85,7 @@ all: lyskom.elc
.SUFFIXES : .el .elc
.el.elc:
$(EMACS-BATCH) -l `pwd`/macros -l `pwd`/vars -f batch-byte-compile $*.el
$(EMACS-BATCH) -f batch-byte-compile $*.el
# influenced by autoconf? Yes.
vars.el: vars.el.in Makefile
......@@ -120,7 +126,7 @@ english-lyskom.elc: english-lyskom.el
# The method of compiling elc files separately is now depreceated
# I dont want any warnings of the newer file...
vars.elc: vars.el macros.elc
$(EMACS-BATCH) -l `pwd`/macros -f batch-byte-compile $*.el
$(EMACS-BATCH) -f batch-byte-compile $*.el
macros.elc: macros.el
$(EMACS-BATCH) -f batch-byte-compile $*.el
......
......@@ -32,6 +32,15 @@
;;;; It must be loaded after messages.el
;;;;
(eval-when-compile
(require 'lyskom-vars "vars")
(require 'lyskom-macros "macros")
(require 'lyskom-command "command")
(require 'lyskom-language "language")
(require 'lyskom-messages "messages")
(require 'lyskom-services "services"))
(setq lyskom-clientversion-long
(concat lyskom-clientversion-long
"$Id$\n"))
......@@ -215,3 +224,6 @@ kom-ansaphone-default-reply and kom-ansaphone-replies."
t)
(provide 'lyskom-ansaphone)
;;; ansaphone.el ends here
......@@ -644,3 +644,8 @@ The element last pushed is first in the list."
(defun collector-push (value collector)
"Push VALUE onto the front of COLLECTOR's value"
(setcdr collector (cons value (cdr collector))))
(provide 'lyskom-clienttypes)
;;; clienttypes.el ends here
;;;;;
;;;;; $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: command.el
;;;;
;;;; This file contains stuff regarding commands.
;;;;
(eval-when-compile
(require 'lyskom-vars "vars")
(require 'lyskom-services "services")
(require 'lyskom-language "language")
(require 'lyskom-clienttypes "clienttypes"))
;;; ======================================================================
;;; LysKOM user commands
;;; The new, blocking commands have a very similar structure
;;;
;;; (defun kom-cmd (args)
;;; "Documentation"
;;; (interactive "...")
;;; (lyskom-start-of-command 'kom-cmd)
;;; (unwind-protect
;;; (progn ...)
;;; (lyskom-end-of-command)))
;;;
;;; This can now be written as
;;;
;;; (def-kom-command kom-cmd (args)
;;; "Documentation"
;;; (interactive "...")
;;; ...)
(defmacro def-kom-command (cmd args doc interactive-decl &rest forms)
(list 'defun cmd args doc interactive-decl
(list 'lyskom-start-of-command (list 'quote cmd))
(list 'unwind-protect
(list 'condition-case nil
(cons 'progn
forms)
(list 'quit
(list 'ding)
(list 'lyskom-insert-before-prompt
(list 'lyskom-get-string
(list 'quote 'interrupted)))))
(list 'lyskom-end-of-command))))
;;(def-edebug-spec def-kom-command
;; (&define name lambda-list
;; [&optional stringp] ; Match the doc string, if present.
;; ("interactive" interactive)
;; def-body))
(put 'def-kom-command 'edebug-form-spec
'(&define name lambda-list
[&optional stringp] ; Match the doc string, if present.
("interactive" interactive)
def-body))
;;;; ================================================================
;;;; User-level commands and functions.
(defsubst lyskom-command-name (command)
"Get the command name for the command COMMAND"
(lyskom-get-string command 'lyskom-command))
(defun lyskom-ok-command (alternative administrator)
"Returns non-nil if it is ok to do such a command right now."
(if administrator
(not (memq (cdr alternative) lyskom-admin-removed-commands))
(not (memq (cdr alternative) lyskom-noadmin-removed-commands))))
(defun kom-extended-command ()
"Read a LysKOM function name and call the function."
(interactive)
(let ((fnc (lyskom-read-extended-command)))
(cond
(fnc (call-interactively fnc))
(t (kom-next-command)))) )
(defun lyskom-read-extended-command ()
"Reads and returns a command"
(let* ((completion-ignore-case t)
(alternatives (mapcar (function (lambda (pair)
(cons (cdr pair) (car pair))))
(lyskom-get-strings lyskom-commands
'lyskom-command)))
(name (completing-read (lyskom-get-string 'extended-command)
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))
(` (lambda (alternative)
(lyskom-ok-command
alternative
(, lyskom-is-administrator))))
t nil)))
(cdr (assoc name alternatives))))
(defun lyskom-start-of-command (function &optional may-interrupt)
"This function is run at the beginning of every LysKOM command.
It moves the cursor one line down, and +++ later it will tell the server
that the previous text has been read.
Argument FUNCTION is a string the string will be written in the buffer
on start of the command. If it is a symbol it searches for the corresponding
command name in lyskom-commands and writes this in the message buffer.
If optional argument MAY-INTERRUPT is present and non-nil,
don't signal an error if this call is interrupting another command.
Special: if lyskom-is-waiting then we are allowed to break if we set
lyskom-is-waiting nil.
This function checks if lyskom-doing-default-command and
lyskom-first-time-around are bound. The text entered in the buffer is
chosen according to this"
(if (not lyskom-proc)
(lyskom-error "%s" (lyskom-get-string 'dead-session)))
(if (and lyskom-is-waiting
(listp lyskom-is-waiting))
(progn
(setq lyskom-is-waiting nil)
(lyskom-end-of-command)))
(setq lyskom-is-waiting nil)
(if (and lyskom-executing-command (not may-interrupt))
(lyskom-error "%s" (lyskom-get-string 'wait-for-prompt)))
(if (not (and (boundp 'lyskom-doing-default-command)
lyskom-doing-default-command))
(cond
(lyskom-first-time-around)
((stringp function) (lyskom-insert function))
((and function (symbolp function))
(let ((name (lyskom-command-name function)))
(if name (lyskom-insert name)))))
(save-excursion
(if lyskom-current-prompt
(let ((inhibit-read-only t))
(goto-char (point-max))
(delete-char (- (length lyskom-prompt-text))))))
(lyskom-insert lyskom-prompt-executing-default-command-text))
(setq mode-line-process (lyskom-get-string 'mode-line-working))
(if (pos-visible-in-window-p (point-max))
(save-excursion
(goto-char (point-max))
(lyskom-set-last-viewed)))
(setq lyskom-executing-command t)
(setq lyskom-current-command function)
(setq lyskom-current-prompt nil)
(lyskom-insert "\n")
(if (and (eq (window-buffer (selected-window))
(current-buffer))
;; (= (point) (point-max))
)
(progn
(if (pos-visible-in-window-p (1- (point-max)))
(goto-char (point-max)))
(sit-for 0)))
; (lyskom-scroll)
(run-hooks 'lyskom-before-command-hook)
(if kom-page-before-command ;Nice with dumb terminals.
(if (or (not (listp kom-page-before-command))
(memq function kom-page-before-command))
(recenter 1))))
(defun lyskom-end-of-command ()
"Print prompt, maybe scroll, prefetch info."
(message "")
(while (and lyskom-to-be-printed-before-prompt
(lyskom-queue->first lyskom-to-be-printed-before-prompt))
(if (not (bolp)) (lyskom-insert "\n"))
(lyskom-insert (car (lyskom-queue->first
lyskom-to-be-printed-before-prompt)))
(lyskom-queue-delete-first lyskom-to-be-printed-before-prompt))
(setq lyskom-executing-command nil)
(setq lyskom-current-command nil)
(setq lyskom-current-prompt nil) ; Already set in s-o-c really
(lyskom-scroll)
(setq mode-line-process (lyskom-get-string 'mode-line-waiting))
(if (pos-visible-in-window-p (point-max) (selected-window))
(lyskom-set-last-viewed))
(lyskom-prefetch-and-print-prompt)
(run-hooks 'lyskom-after-command-hook)
(if lyskom-idle-time-flag
(initiate-user-active 'background nil))
(if kom-inhibit-typeahead
(discard-input)))
(provide 'lyskom-command)
;;; command.el ends here
......@@ -407,8 +407,6 @@ Returns t if it was possible, otherwise nil."
"Adds MEMBERSHIP to the sorted list of memberships.
Args: MEMBERSHIP CONF-STAT THENDO DATA
Also adds to lyskom-to-do-list."
;;; +++ What should this do if the priority is lower than
;;; kom-session-priority?
(if membership
(progn
(lyskom-insert-membership membership lyskom-membership)
......@@ -596,8 +594,7 @@ If optional arg TEXT-NO is present write a comment to that text instead."
(t
(signal 'lyskom-internal-error '(kom-write-comment))))))
(lyskom-start-of-command (concat
(lyskom-get-string 'kom-write-comment
'lyskom-command)
(lyskom-command-name 'kom-write-comment)
(if text-no
(format " (%d)" text-no)
"")))
......@@ -1072,13 +1069,6 @@ Args: CONF-STAT MEMBERSHIP"
(setq found t)
(++ r)))
;; If the membership list is prefetched there is no need to
;; insert empty read-infos, but if there is a chance that
;; there might be unknown texts that will be entered into the
;; read-info later we'll insert an empty read-info. This
;; enables the user to go to a conference before it is
;; prefetched.
(cond (found
(let ((read-info (read-list->nth lyskom-to-do-list r)))
(read-list-enter-first read-info lyskom-reading-list)
......@@ -1087,18 +1077,6 @@ Args: CONF-STAT MEMBERSHIP"
(read-list-enter-first read-info lyskom-to-do-list)
(set-read-info->priority read-info priority)
(lyskom-enter-conf conf-stat read-info)))
((not (lyskom-membership-is-read))
(let ((read-info (lyskom-create-read-info
'CONF conf-stat
(membership->priority membership)
(lyskom-create-text-list nil))))
(read-list-enter-first read-info lyskom-reading-list)
(read-list-delete-read-info (conf-stat->conf-no conf-stat)
lyskom-to-do-list)
(read-list-enter-first read-info lyskom-to-do-list)
(lyskom-go-to-empty-conf conf-stat)))
(t
(lyskom-go-to-empty-conf conf-stat))))))
......
......@@ -1122,7 +1122,7 @@ On since %#8s%#9s")
(dont-read . "Jump")
(write . "Write")
(conference . "Conference")
(person . "Person")
(person . "User")
(move . "Go")
(info . "About")
(send . "Send message")
......@@ -1603,30 +1603,6 @@ This variable is stored in the LysKOM server.")
;; Review a non-converted text
;; Author: Linus Tolke
(defun kom-review-noconversion (&optional text-no)
"Displays the last read text without any conversion."
(interactive (list
(cond
((null current-prefix-arg)
lyskom-current-text)
((integerp current-prefix-arg)
current-prefix-arg)
((and (listp current-prefix-arg)
(integerp (car current-prefix-arg))
(null (cdr current-prefix-arg)))
(car current-prefix-arg))
(t
(signal 'lyskom-internal-error '(kom-review-noconversion))))))
(lyskom-start-of-command 'kom-review-noconversion)
(let ((kom-emacs-knows-iso-8859-1 t))
(lyskom-view-text text-no))
(lyskom-end-of-command))
;; A bag of goodies for sojge.
(defun kom-put-file (filename)
......@@ -1641,3 +1617,8 @@ This variable is stored in the LysKOM server.")
(defun kom-list-files ()
(interactive)
(list-directory "/ftp@ftp.lysator.liu.se:/open"))
(provide 'lyskom-strings)
;;; english-strings ends here
......@@ -292,7 +292,7 @@ If successful then set the buffer not-modified. Else print a warning."
(setq lyskom-other-clients-user-areas)
(if (zerop (pers-stat->user-area pers-stat))
(progn
(lyskom-tell-phrases-validate)
;; (lyskom-tell-phrases-validate)
(setq lyskom-options-done t))
(lyskom-read-options-eval
(blocking-do 'get-text
......
;;;;;
;;;;; $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: language.el
;;;; Author: Niels Mller
;;;;
;;;;
(require 'lyskom-vars "vars")
;;(defconst lyskom-category-properties
;; '((command . lyskom-command)
......@@ -11,7 +44,29 @@
(defvar lyskom-language-categories nil
"Categories used")
(defun lyskom-define-language (category language alist)
(defvar lyskom-language-vars nil
"A list of all language-dependent variables.")
(defun lyskom-language-var-internal (var language val)
"Defines a language-local variable value."
(or (memq var lyskom-language-vars)
(setq lyskom-language-vars
(cons var lyskom-language-vars)))
(let* ((alist (get var 'lyskom-language-var))
(entry (assq language alist)))
(if entry
(setcdr entry val)
(put var 'lyskom-language-var (cons (cons language val) alist)))))
(defmacro lyskom-language-var (var language val)
(list 'lyskom-language-var-internal
(list 'quote var)
(list 'quote language)
(list 'quote val)))
(put 'lyskom-language-var 'lisp-indent-function 2)
(defun lyskom-language-strings (category language alist)
"Associates names to symbols.
CATEGORY and LANGUAGE determines what kind of association to
......@@ -35,7 +90,7 @@ create. ALIST is a mapping from symbols to strings."
(cons (cons language string) llist))))))
alist))
(put 'lyskom-define-language 'lisp-indent-function 2)
(put 'lyskom-language-strings 'lisp-indent-function 2)
(defsubst lyskom-get-string-internal (symbol category)
(cdr (assq lyskom-language (get symbol category))))
......@@ -85,3 +140,6 @@ if 'lyskom-menu is not found."
lyskom-language-symbols)))
(provide 'lyskom-language)
;;; language.el ends here
......@@ -74,6 +74,9 @@
;;;; work is needed.
;;;;
(require 'lyskom-menus "menus")
(setq lyskom-clientversion-long
(concat lyskom-clientversion-long
"$Id$\n"))
......@@ -133,10 +136,10 @@
;;; ----------------------------------------------------------------
;;; Author: Aronsson
(defun lyskom-tell-string (key)
(defsubst lyskom-tell-string (key)
"Retrieve the phrase indexed by the key from the kom-tell-phrases
assoc list."
(car (cdr (assoc key kom-tell-phrases))))
(lyskom-get-string key 'kom-tell-phrases))
(defun lyskom-tell-internat (key)
......@@ -148,51 +151,6 @@ assoc list."
;;;; ================================================================
;;;; User-level commands and functions.
(defun lyskom-command-name (command)
"Get the command name for the command COMMAND"
(lyskom-get-string command 'lyskom-command))
(defun lyskom-ok-command (alternative administrator)
"Returns non-nil if it is ok to do such a command right now."
(if administrator
(not (memq (cdr alternative) lyskom-admin-removed-commands))
(not (memq (cdr alternative) lyskom-noadmin-removed-commands))))
(defun kom-extended-command ()
"Read a LysKOM function name and call the function."
(interactive)
(let ((fnc (lyskom-read-extended-command)))
(cond
(fnc (call-interactively fnc))
(t (kom-next-command)))) )
(defun lyskom-read-extended-command ()
"Reads and returns a command"
(let* ((completion-ignore-case t)
(alternatives (mapcar (function (lambda (pair)
(cons (cdr pair) (car pair))))
(lyskom-get-strings lyskom-commands 'lyskom-command)))
(name (completing-read (lyskom-get-string 'extended-command)
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))
(` (lambda (alternative)
(lyskom-ok-command
alternative
(, lyskom-is-administrator))))
t nil)))
(cdr (assoc name alternatives))))