Commit 55e1e3d1 authored by David Byers's avatar David Byers

Completion av kommandon fungerar kanske som den ska. Det är ett fult hack

och logiken är inte genomtänkt. Håll till godo.
Bugfixar i Ändra prioritet.
parent 91e4fcb0
2000-09-09 David Byers <davby@sen2.ida.liu.se>
* buffers.el (lyskom-buffer-kill-trim-hook): New function. Add
call to lyskom-ignore to avoid warnings about unused variables.
(kill-buffer-hook): Add lyskom-buffer-kill-trim-hook instead of
anonymous lambda. Add to the global value since the local value of
the hook is undefined at load time.
Compatibility definition lyskom-read-from-minibuffer:
* option-edit.el (lyskom-widget-string-action): Use
lyskom-read-from-minibuffer.
* filter.el (kom-filter-subject): Use lyskom-read-from-minibuffer.
(kom-filter-text): Use lyskom-read-from-minibuffer.
* filter-edit.el (lyskom-filter-edit-insert-pattern): Use
lyskom-read-from-minibuffer.
* edit-text.el (kom-edit-insert-text): Use
lyskom-read-from-minibuffer.
* commands2.el (kom-calculate): Use lyskom-read-from-minibuffer.
(kom-set-personal-label): Same here.
(kom-set-personal-label): Same here.
* ansaphone.el (kom-change-auto-reply): Use
lyskom-read-from-minibuffer.
Start to fix command completion:
* command.el (lyskom-read-extended-command): Roll our own
completing-read by emulating the standard behavior.
* compatibility.el (lyskom-read-from-minibuffer): New
compatibility definition.
* command.el (lyskom-completing-strip-command): Replace parens
with empty string, not space.
(lyskom-command-match-string-regexp): Allow initial space.
2000-09-05 David Byers <davby@sen2.ida.liu.se>
* commands1.el (kom-change-priority): Bind
kom-membership-default-priority to nil to force
lyskom-try-add-member to ask.
(kom-change-priority): Don't break when user is not a member of
the conference. Useful error message when conference does not
exist.
2000-09-03 David Byers <davby@sen2.ida.liu.se>
* command.el (lyskom-update-command-completion): Save unicased
version of string.
(lyskom-complete-command): Fix updating of exact.
2000-09-05 Joel Rosdahl <joel@lysator.liu.se>
* distribution-README: Information about the Debian package.
......
......@@ -36,7 +36,7 @@
# makefile too!
#
CLIENTVERSION = 0.46
CLIENTVERSION = 0.46.1-BETA-1
DOCFILES=NEWS-0.46
DEBIANCLIENTVERSION = $(shell echo $(CLIENTVERSION) | tr - .)
......@@ -44,6 +44,7 @@ REDHATCLIENTVERSION = $(shell echo $(CLIENTVERSION) | tr - .)
RPMROOT = /usr/src/redhat
FTPDIR=/home/davby/www-pub
REMOTEDIR=sanna.lysator.liu.se:/lysator/ftp/pub/lyskom/elisp-client
#FTPDIR = /usr/ftp/pub/lyskom/elisp-client
LISPDIR = /usr/gnu/share/emacs/site-lisp
LANGUAGES = swedish english
......@@ -169,7 +170,7 @@ TAGS: $(HEADER) $(SOURCES)
install: $(TARGET) $(TARGET-EL)
cp $(TARGET-EL) $(TARGET) $(LISPDIR)
release: release-files release-cleanup release-move
release: release-files release-move release-cleanup
release-files: $(HEADER) $(SOURCES) $(DISTSRC) $(MISC)
mkdir lyskom-$(CLIENTVERSION)
......@@ -196,11 +197,16 @@ release-cleanup:
lyskom-$(CLIENTVERSION).zip \
lyskom-elisp-client-$(DEBIANCLIENTVERSION)
release-move: release-files
release-move:
if [ ! -z "$(REMOTEDIR)" ] ; then \
scp lyskom-$(CLIENTVERSION).tar.gz $(REMOTEDIR); \
scp lyskom-$(CLIENTVERSION).zip $(REMOTEDIR); \
else \
echo "Kopierade inte release-filerna till remote-system." ; \
fi
if [ -d $(FTPDIR) ]; then \
mv lyskom-$(CLIENTVERSION).tar.gz $(FTPDIR) ; \
mv lyskom-$(CLIENTVERSION).zip $(FTPDIR) ; \
mv $(TARGET-EL) $(FTPDIR)/lyskom-$(CLIENTVERSION).el ; \
else \
echo "Flyttade inte release-filerna till $(FTPDIR)." ; \
fi
......
......@@ -58,7 +58,7 @@
"Change the default automatic reply message."
(interactive)
(let ((message (or message
(read-from-minibuffer
(lyskom-read-from-minibuffer
(lyskom-get-string 'ansaphone-new-message)
(if (stringp kom-ansaphone-default-reply)
(cons kom-ansaphone-default-reply 0)))))
......
......@@ -180,15 +180,15 @@ the children object"
(setq buflist (cdr buflist))))))
(add-hook 'kill-buffer-hook
'lyskom-buffer-hierarchy-kill-hook)
(add-hook 'kill-buffer-hook
'(lambda ()
(when (eq major-mode 'lyskom-mode)
(let ((lyskom-trim-buffer-delete-to
(point-max)))
(run-hooks 'lyskom-trim-buffer-hook))))
nil t)
(defun lyskom-buffer-kill-trim-hook ()
"When killing a buffer, run trimming hooks."
(when (eq major-mode 'lyskom-mode)
(let ((lyskom-trim-buffer-delete-to (point-max)))
(lyskom-ignore lyskom-trim-buffer-delete-to)
(run-hooks 'lyskom-trim-buffer-hook))))
(add-hook 'kill-buffer-hook 'lyskom-buffer-hierarchy-kill-hook)
(add-hook 'kill-buffer-hook 'lyskom-buffer-kill-trim-hook)
(add-hook 'kill-buffer-query-functions
'lyskom-buffer-hierarchy-query-kill-function)
......
......@@ -201,6 +201,13 @@
(fnc (call-interactively fnc))
(t (kom-next-command)))) )
(defvar lyskom-command-completion-map nil)
(if lyskom-command-completion-map
nil
(setq lyskom-command-completion-map (make-sparse-keymap))
(define-key lyskom-command-completion-map (kbd "SPC")
'lyskom-command-complete-word))
(defun lyskom-read-extended-command (&optional prefix-arg)
"Reads and returns a command"
(let* ((completion-ignore-case t)
......@@ -220,12 +227,19 @@
(lyskom-get-string 'extended-command))))
(lyskom-with-lyskom-minibuffer
(setq name (lyskom-completing-read prompt
'lyskom-complete-command
(lambda (alt)
(lyskom-ok-command alt
lyskom-is-administrator))
t nil 'lyskom-command-history))
(set-keymap-parent lyskom-command-completion-map
minibuffer-local-must-match-map)
(let ((minibuffer-completion-table 'lyskom-complete-command)
(minibuffer-completion-predicate (lambda (alt)
(lyskom-ok-command alt
lyskom-is-administrator)))
(minibuffer-completion-confirm nil))
(setq name (lyskom-read-from-minibuffer prompt
nil
lyskom-command-completion-map
'lyskom-command-history
nil
t)))
(lyskom-lookup-command-by-name name (lambda (alt)
(lyskom-ok-command
alt lyskom-is-administrator))))))
......@@ -240,8 +254,9 @@ transformed for matching."
(mapcar (lambda (el)
(vector (cdr el)
(car el)
(lyskom-completing-strip-name
(lyskom-unicase (cdr el)))))
(lyskom-completing-strip-command
(lyskom-unicase (cdr el)))
(lyskom-unicase (cdr el))))
(lyskom-get-strings lyskom-commands 'lyskom-command))))
(defun lyskom-lookup-command-by-name (string &optional predicate)
......@@ -250,7 +265,7 @@ transformed for matching."
(defsubst lyskom-command-match-string-regexp (string)
(concat
"^"
"^\\s-*"
(replace-in-string (regexp-quote
(lyskom-unicase
(lyskom-completing-strip-command string)))
......@@ -262,32 +277,62 @@ transformed for matching."
If optional DONT-STRIP-SPACES is non-nil, don't strip spaces at front
and back of the string."
(while (string-match "([^()]*)" string) ; Strip nested parens
(setq string (replace-match " " t t string)))
(setq string (replace-match "" t t string)))
(while (string-match "\\s-\\s-+" string) ; Collapse spaces
(setq string (replace-match " " t t string)))
(while (string-match "([^()]*$" string) ; Strip incomplete parens at end
(setq string (substring string 0 (match-beginning 0))))
string)
;;; FIXME HARDER: Completion of single SPC should
;;; be "" or possibly nil.
(defun lyskom-complete-command (string predicate all)
"Completion function for LysKOM commands."
(when (string-match "^\\s-+" string)
(setq string (substring string (match-end 0))))
(let ((alternatives nil)
(m-string (lyskom-command-match-string-regexp string))
(u-string (lyskom-unicase string))
(exact nil))
(lyskom-traverse el lyskom-command-alternatives
(when (and (string-match m-string (elt el 2))
(or (null predicate) (funcall predicate el)))
(setq alternatives (cons (if (eq all 'lyskom-lookup) el (elt el 0)) alternatives))
(if (eq (match-end 0) (length (elt el 2))) (setq exact el))))
(if (string-equal u-string (elt el 3)) (setq exact el))))
(cond
((eq all 'lyskom-lookup) (and exact (elt exact 1)))
((eq all 'lambda) exact)
(all alternatives)
((null alternatives) nil)
((and (= (length alternatives) 1) exact) t)
(t (lyskom-maybe-recode-string
(lyskom-complete-string alternatives))))))
(t (let ((tmp (lyskom-complete-string alternatives)))
(lyskom-maybe-recode-string
(if (string-match (concat (regexp-quote (lyskom-unicase tmp)) "\\s-") u-string)
(concat tmp " ")
tmp)))))))
(defun lyskom-command-complete-word ()
(interactive)
(let ((completion (try-completion (buffer-string)
minibuffer-completion-table
minibuffer-completion-predicate)))
(cond ((null completion) (minibuffer-message " [No match]") nil)
((eq completion t) nil)
(t (let* ((tmp (buffer-string)))
(when (string-equal (lyskom-unicase completion)
(lyskom-unicase tmp))
(if (stringp (setq tmp (try-completion
(concat tmp " ")
minibuffer-completion-table
minibuffer-completion-predicate)))
(setq completion tmp)))
(if (string-equal (lyskom-unicase completion)
(lyskom-unicase (buffer-string)))
(progn (minibuffer-completion-help) nil)
(erase-buffer)
(insert completion)
t))))))
(defun lyskom-start-of-command (function &optional may-interrupt)
......
......@@ -348,16 +348,18 @@ Ask for the name of the person, the conference to add him/her to."
(def-kom-command kom-change-priority (&optional conf)
"Change the priority of a conference."
(interactive)
(let* ((conf-stat (if conf (blocking-do 'get-conf-stat conf)
(lyskom-read-conf-stat
(lyskom-get-string 'change-priority-for-q)
'(all) nil "" t)))
(mship (lyskom-get-membership (conf-stat->conf-no conf-stat) t)))
(mship (lyskom-get-membership (conf-stat->conf-no conf-stat) t))
(kom-membership-default-priority nil))
(blocking-do-multiple ((who (get-conf-stat lyskom-pers-no))
(pers-stat (get-pers-stat lyskom-pers-no)))
(cond ((null mship)
(lyskom-format-insert 'not-member-of-conf conf))
(cond ((and (null mship) conf-stat)
(lyskom-format-insert 'not-member-of-conf conf-stat))
((null conf-stat)
(lyskom-format-insert 'no-such-conf))
(t (lyskom-add-member-answer
(lyskom-try-add-member conf-stat who pers-stat nil
'change-priority-for t)
......
......@@ -1976,7 +1976,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-get-string 'need-library))
(let* ((expr (or exprx
(lyskom-with-lyskom-minibuffer
(read-from-minibuffer
(lyskom-read-from-minibuffer
(lyskom-get-string 'calc-expression)
nil nil nil 'lyskom-expression-history))))
(result (calc-eval expr)))
......@@ -2020,7 +2020,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-get-string 'label-secret))))
(setq label
(lyskom-with-lyskom-minibuffer
(read-from-minibuffer
(lyskom-read-from-minibuffer
(lyskom-get-string 'label-what-label))))
(blocking-do
'modify-text-info
......@@ -2050,7 +2050,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-get-string 'label-secret))))
(setq label
(lyskom-with-lyskom-minibuffer
(read-from-minibuffer
(lyskom-read-from-minibuffer
(lyskom-get-string 'label-what-label))))
(blocking-do
'modify-conf-info
......
......@@ -397,7 +397,34 @@ string to search in."
&optional predicate require-match
init hist def inherit-input-method)
(completing-read prompt table predicate require-match init hist)))))
(eval-and-compile
(cond ((eval-when-compile (string-match "XEmacs" (emacs-version)))
(defun lyskom-read-from-minibuffer (prompt
&optional initial-contents
keymap read hist default-value
inherit-input-method)
(read-from-minibuffer prompt
initial-contents
keymap
read
hist)))
((eval-when-compile (> emacs-major-version 19))
(fset 'lyskom-read-from-minibuffer
(symbol-function 'read-from-minibuffer)))
(t (defun lyskom-read-from-minibuffer (prompt
&optional initial-contents
keymap read hist default-value
inherit-input-method)
(read-from-minibuffer prompt
initial-contents
keymap
read
hist)))))
(lyskom-external-function temp-minibuffer-message)
(lyskom-provide-function minibuffer-message (message)
(temp-minibuffer-message message))
(lyskom-provide-function last (x &optional n)
......
......@@ -109,8 +109,10 @@ lyskom-@@CLIENTVERSION@@.el: $(HEADER) $(SOURCES)
install: lyskom-@@CLIENTVERSION@@.elc
cp lyskom-@@CLIENTVERSION@@.el lyskom-@@CLIENTVERSION@@.elc $(LISPDIR)
ln -sf $(LISPDIR)/lyskom-@@CLIENTVERSION@@.el $(LISPDIR)/lyskom.el
ln -sf $(LISPDIR)/lyskom-@@CLIENTVERSION@@.elc $(LISPDIR)/lyskom.elc
rm -f $(LISPDIR)/lyskom.el
ln -s $(LISPDIR)/lyskom-@@CLIENTVERSION@@.el $(LISPDIR)/lyskom.el
ln -s $(LISPDIR)/lyskom.elc
ln -s $(LISPDIR)/lyskom-@@CLIENTVERSION@@.elc $(LISPDIR)/lyskom.elc
clean:
$(RM) lyskom-@@CLIENTVERSION@@.el
......
......@@ -104,7 +104,10 @@
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. It also contains a pre-built client.
The client is also available as an RPM 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
......
......@@ -1051,7 +1051,7 @@ given, prepend each line with your commenting prefix (or '>')."
(cond
((null current-prefix-arg)
(string-to-int
(read-from-minibuffer
(lyskom-read-from-minibuffer
(format "%s" (lyskom-get-string 'which-text-include)))))
((prefix-numeric-value current-prefix-arg)))))
(let ((buffer (current-buffer))
......
......@@ -529,7 +529,7 @@ If NEWLINE is non-nil, insert a newline after the header."
lyskom-filter-predicate-list
t)
nil t))
(setq argstring (read-from-minibuffer
(setq argstring (lyskom-read-from-minibuffer
(lyskom-format 'filter-edit-insert-arg what pred)))
(setq what (cdr (assoc what rev-what)))
......
......@@ -459,8 +459,9 @@ Otherwise return nil."
(if (null subject)
(setq subject lyskom-current-subject))
(setq subject
(read-from-minibuffer (lyskom-get-string 'filter-subject)
subject))
(lyskom-read-from-minibuffer
(lyskom-get-string 'filter-subject)
subject))
(setq filter (cons (cons 'subject subject) filter))
(setq conf (lyskom-read-conf-no
(lyskom-get-string 'filter-in-conf)
......@@ -613,9 +614,9 @@ the current text"
(if conf-stat
(progn
(setq text
(read-from-minibuffer (lyskom-get-string
'filter-which-text)
(or text "")))
(lyskom-read-from-minibuffer (lyskom-get-string
'filter-which-text)
(or text "")))
(setq filter (cons (cons 'text text) filter))
(setq conf (lyskom-read-conf-no
(lyskom-get-string 'filter-in-conf)
......
......@@ -1347,7 +1347,7 @@ customize buffer but do not save them to the server."
;;;
(defun lyskom-widget-string-action (widget &optional event)
(let ((tmp (read-from-minibuffer
(let ((tmp (lyskom-read-from-minibuffer
(format "%s: " (widget-get widget ':tag))
(widget-value widget))))
(widget-value-set widget tmp)
......
......@@ -3101,7 +3101,7 @@ i servern. Annars sparas det i din .emacs.")
lngre n normalt.")
(kom-postpone-default-doc . "\
Antalet inlgg som skall uppskjutas med Uppskjuta lsning.")
Antalet inlgg som inte skall uppskjutas med Uppskjuta lsning.")
(kom-allow-incompleteness-doc . "\
Pslaget betyder att klienten inte vntar p att information om alla
......@@ -3247,7 +3247,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-write-texts-in-window-tag . "Skriv inlgg: ")
(kom-prioritize-in-window-tag . "Prioritera mten: ")
(kom-edit-filters-in-window-tag . "ndra filter: ")
(kom-view-commented-in-window-tag . "terse kommenterer: ")
(kom-view-commented-in-window-tag . "terse kommentarer: ")
(kom-list-membership-in-window-tag . "Lista medlemskap: ")
(kom-user-prompt-format-tag . "Promptformat:")
......
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