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

Införde server-alias

parent 2b538300
#
# -*- Makefile -*-
# $Id$
# Copyright (C) 1991 Lysator Academic Computer Association.
#
......@@ -75,7 +75,6 @@ vars.elc: vars.el macros.elc
macros.elc: macros.el
$(EMACS-BATCH) -f batch-byte-compile $*.el
# influenced by autoconf? Yes.
vars.el: vars.el.in Makefile
......@@ -126,7 +125,7 @@ installatlysator: lyskom-$(CLIENTVERSION).elc lyskom.el
lyskom-$(CLIENTVERSION).elc: lyskom.el
$(EMACS-BATCH) -f batch-byte-compile lyskom.el
mv lyskom.elc lyskom-$(CLIENTVERSION).elc
cp lyskom.elc lyskom-$(CLIENTVERSION).elc
lyskom.elc-compatibility: lyskom.el
$(EMACS-BATCH) -l ./compatibility.el -f batch-byte-compile lyskom.el
......
......@@ -68,7 +68,7 @@
;;; read-info
(defun lyskom-create-read-info (type
(defsubst lyskom-create-read-info (type
conf-stat
priority
text-list
......@@ -82,64 +82,64 @@
'READ-INFO
(vector type conf-stat priority text-list comm-to forward nil)))
(defun read-info->type (read-info)
(defsubst read-info->type (read-info)
"Get type from read-info."
(elt (cdr read-info) 0))
(defun read-info->conf-stat (read-info)
(defsubst read-info->conf-stat (read-info)
"Get conf-stat from read-info."
(elt (cdr read-info) 1))
(defun read-info->priority (read-info)
(defsubst read-info->priority (read-info)
"Get priority from read-info."
(elt (cdr read-info) 2))
(defun read-info->text-list (read-info)
(defsubst read-info->text-list (read-info)
"Get text-list from read-info."
(elt (cdr read-info) 3))
(defun read-info->comm-to (read-info)
(defsubst read-info->comm-to (read-info)
"Get comm-to from read-info."
(elt (cdr read-info) 4))
(defun read-info->forward (read-info)
(defsubst read-info->forward (read-info)
"Get forward from read-info."
(elt (cdr read-info) 5))
(defun read-info->unfetched-texts (read-info)
(defsubst read-info->unfetched-texts (read-info)
"Get forward from read-info."
(elt (cdr read-info) 6))
(defun set-read-info->type (read-info newval)
(defsubst set-read-info->type (read-info newval)
"Set type in read-info to NEWVAL."
(aset (cdr read-info) 0 newval))
(defun set-read-info->conf-stat (read-info newval)
(defsubst set-read-info->conf-stat (read-info newval)
"Set conf-stat in read-info to NEWVAL."
(aset (cdr read-info) 1 newval))
(defun set-read-info->priority (read-info newval)
(defsubst set-read-info->priority (read-info newval)
"Set priority in read-info to NEWVAL."
(aset (cdr read-info) 2 newval))
(defun set-read-info->text-list (read-info newval)
(defsubst set-read-info->text-list (read-info newval)
"Set text-list in read-info to NEWVAL."
(aset (cdr read-info) 3 newval))
(defun set-read-info->comm-to (read-info newval)
(defsubst set-read-info->comm-to (read-info newval)
"Set comm-to in read-info to NEWVAL."
(aset (cdr read-info) 4 newval))
(defun set-read-info->forward (read-info newval)
(defsubst set-read-info->forward (read-info newval)
"Set forward in read-info to NEWVAL."
(aset (cdr read-info) 5 newval))
(defun set-read-info->unfetched-texts (read-info newval)
(defsubst set-read-info->unfetched-texts (read-info newval)
"Set forward in read-info to NEWVAL."
(aset (cdr read-info) 6 newval))
(defun lyskom-read-info-p (object)
(defsubst lyskom-read-info-p (object)
"Return t if OBJECT is a read-info."
(eq (car-safe object) 'READ-INFO))
......@@ -151,58 +151,58 @@
;;; Constructor:
(defun lyskom-create-read-list ()
(defsubst lyskom-create-read-list ()
"Create an empty read-list."
(cons 'READ-LIST nil))
;;; Predicates:
(defun read-list-isempty (read-list)
(defsubst read-list-isempty (read-list)
"Return t if READ-LIST is empty, otherwise return nil."
(null (cdr read-list)))
;;; Selectors:
(defun read-list->first (read-list)
(defsubst read-list->first (read-list)
"Return the first entry in READ-LIST, or nil if empty."
(car-safe (cdr read-list)))
(defun read-list->nth (read-list n)
(defsubst read-list->nth (read-list n)
"Args: READ-LIST N
Return element N in READ-LIST or nil if outside the range.
The range of valid values for N is [0, num-entries - 1]."
(elt (cdr read-list) n))
(defun read-list->all-entries (read-list)
(defsubst read-list->all-entries (read-list)
"Return a list of all entries in READ-LIST."
(cdr read-list))
;;; Other functions:
(defun read-list-length (read-list)
(defsubst read-list-length (read-list)
"Return the number of entries in READ-LIST."
(1- (length read-list)))
;;; Modifiers:
(defun set-read-list-empty (read-list)
(defsubst set-read-list-empty (read-list)
"Empty READ-LIST destructively."
(setcdr read-list nil))
(defun set-read-list-del-first (read-list)
(defsubst set-read-list-del-first (read-list)
"Delete the first entry of READ-LIST if there is one."
(if (cdr read-list)
(setcdr read-list (cdr (cdr read-list)))))
(defun read-list-enter-first (read-info read-list)
(defsubst read-list-enter-first (read-info read-list)
"Enter READ-INFO first into READ-LIST."
(setcdr read-list (cons read-info (cdr read-list))))
......
......@@ -74,7 +74,7 @@ If EMPTY is non-nil then the empty string is allowed (returns 0).
INITIAL is the initial contents of the input field."
(let (read)
(while (and (string= (setq read
(lyskom-read-conf-name prompt type t initial))
(lyskom-read-conf-name prompt type t initial))
"")
(not empty)))
(if (string= read "")
......
No preview for this file type
......@@ -47,9 +47,10 @@
Optional arguments: HOST, USERNAME and PASSWORD.
See lyskom-mode for details."
(interactive (list (lyskom-read-string (lyskom-format 'server-q
(or (getenv "KOMSERVER")
lyskom-default-server)))
(interactive (list (lyskom-read-server-name
(lyskom-format 'server-q
(or (getenv "KOMSERVER")
lyskom-default-server)))
nil
nil))
......@@ -311,6 +312,27 @@ WANT-PERSONS is t for persons, nil for confs."
pers-no lyskom-pers-no))
(defun lyskom-read-server-name (prompt)
"Read the name of a LysKOM server.
Copmpletion is done on the servers i lyskom-server-aliases. If an
alias name is entered, the corresponding address is returned."
;; Create a completion table like
;; (("kom.lysator.liu.se" . "kom.lysator.liu.se")
;; ("LysKOM" . "kom.lysator.liu.se"))
(let ((known-servers
(append (mapcar (function (lambda (pair)
(cons (car pair) (car pair))))
lyskom-server-aliases)
(mapcar (function (lambda (pair)
(cons (cdr pair) (car pair))))
lyskom-server-aliases)))
(completion-ignore-case t)
server)
(setq server (completing-read prompt known-servers nil nil))
(or (cdr (assoc server known-servers))
server)))
;;; ================================================================
;;; The LysKOM mode.
......
......@@ -256,6 +256,13 @@ he gets a y-or-n-p question for all recipients.")
(defvar kom-max-buffer-size nil
"*If non-nil, ensure that buffers won't grow any larger than this")
(defvar lyskom-server-aliases
'(("kom.lysator.liu.se" . "LysKOM")
("kom.ludd.luth.se" . "LuddKOM")
("rydkom.rydnet.lysator.liu.se" . "RydKOM")
("kom.csd.uu.se" . "CSD-KOM"))
"An alist mapping server names to shorter identification strings")
(defconst lyskom-elisp-variables '(
kom-do-when-done
kom-do-when-starting
......
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