Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peter Liljenberg
lyskom-elisp-client
Commits
121344d2
Commit
121344d2
authored
Sep 01, 2000
by
David Byers
Browse files
Hantera klickbara saker i långsamma kommandon.
Bättre utfyllnad av kommandon.
parent
19cf057d
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/ChangeLog
View file @
121344d2
2000-09-01 David Byers <davby@ida.liu.se>
* command.el (lyskom-complete-command): Fix. We didn't handle
check for exact match properly. Fix unibyte incompatibility.
(lyskom-read-extended-command): Use lyskom-complete-command.
(lyskom-ok-command): Work the elements from
lyskom-command-alternatives.
* vars.el.in (lyskom-command-alternatives): Made a minibuffer
variable.
(lyskom-is-administrator): Same here.
* command.el (lyskom-ok-command): Rewrote to work with new
completion thingy.
Buttons and menus in slow mode:
* slow.el (kom-expand-slow-command-or-next-link): New command.
(kom-slow-click-or-yank): New command.
(kom-slow-button-press): New command.
(kom-slow-menu-button-press): New command.
(kom-expand-slow-command-or-next-link): New command.
(lyskom-slow-on-prompt-line): New function.
2000-08-31 David Byers <davby@ida.liu.se>
* slow.el (kom-slow-start-of-line): Do the right thing when not on
the last line of the buffer.
2000-08-31 Ulrik Haugen <qha@lysator.liu.se>
* lyskom-rest.el (lyskom-trim-buffer): Saves point and mark and
...
...
src/command.el
View file @
121344d2
...
...
@@ -190,9 +190,8 @@
(
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
))))
(
not
(
memq
(
elt
alternative
1
)
lyskom-admin-removed-commands
))
(
not
(
memq
(
elt
alternative
1
)
lyskom-noadmin-removed-commands
))))
(
defun
kom-extended-command
()
"Read a LysKOM function name and call the function."
...
...
@@ -206,45 +205,44 @@
"Reads and returns a command"
(
let*
((
completion-ignore-case
t
)
(
minibuffer-setup-hook
minibuffer-setup-hook
)
(
alternatives
(
mapcar
(
lambda
(
pair
)
(
cons
(
cdr
pair
)
(
car
pair
)))
(
lyskom-get-strings
lyskom-commands
'lyskom-command
)))
;;;
(alternatives (mapcar
;;; (lambda (pair)
;;; (cons
;;; (cdr pair)
;;; (car pair)))
;;;
(lyskom-get-strings lyskom-commands
;;;
'lyskom-command)))
(
name
nil
)
(
prefix-text
(
cond
((
eq
prefix-arg
'-
)
"- "
)
((
equal
prefix-arg
'
(
4
))
"C-u "
)
((
integerp
prefix-arg
)
(
format
"%d "
prefix-arg
))
((
and
(
consp
prefix-arg
)
(
integerp
(
car
prefix-arg
)))
(
format
"%d "
(
car
prefix-arg
)))
(
t
nil
)))
((
equal
prefix-arg
'
(
4
))
"C-u "
)
((
integerp
prefix-arg
)
(
format
"%d "
prefix-arg
))
((
and
(
consp
prefix-arg
)
(
integerp
(
car
prefix-arg
)))
(
format
"%d "
(
car
prefix-arg
)))
(
t
nil
)))
(
prompt
(
if
prefix-text
(
concat
prefix-text
(
lyskom-get-string
'extended-command
))
(
lyskom-get-string
'extended-command
))))
(
lyskom-with-lyskom-minibuffer
(
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
))))
'lyskom-complete-command
(
lambda
(
alt
)
(
lyskom-ok-command
alt
lyskom-is-administrator
))
t
nil
'lyskom-command-history
))
(
lyskom-lookup-command-by-name
name
(
lambda
(
alt
)
(
lyskom-ok-command
alt
lyskom-is-administrator
))))))
(
defun
lyskom-update-command-completion
()
"Build a list of alternatives for completion of LysKOM commands.
FIXME: Do this only when changing the language or logging in."
Each list element is a vector [NAME COMMAND CANONICAL]. NAME is the
command name, COMMAND is the command and CANONICAL is the name
transformed for matching."
(
setq
lyskom-command-alternatives
(
mapcar
(
lambda
(
el
)
(
vector
(
cdr
el
)
...
...
@@ -260,19 +258,23 @@ FIXME: Do this only when changing the language or logging in."
(
defun
lyskom-complete-command
(
string
predicate
all
)
"Completion function for LysKOM commands."
(
let
((
alternatives
nil
)
(
string
(
lyskom-completing-match-string-regexp
string
)))
(
m-string
(
lyskom-completing-match-string-regexp
string
))
(
exact
nil
))
(
lyskom-traverse
el
lyskom-command-alternatives
(
when
(
and
(
string-match
string
(
elt
el
2
))
(
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
))))
(
setq
alternatives
(
cons
(
if
(
eq
all
'lyskom-lookup
)
el
(
elt
el
0
))
alternatives
))
(
if
(
eq
(
match-end
0
)
(
length
(
elt
el
2
)))
(
setq
exact
t
))))
(
cond
((
eq
all
'lyskom-lookup
)
(
elt
(
car
alternatives
)
1
))
((
eq
all
'lambda
)
(
=
(
length
alternatives
)
1
))
((
eq
all
'lambda
)
(
or
(
=
(
length
alternatives
)
1
)
exact
)
)
(
all
alternatives
)
((
null
alternatives
)
nil
)
((
eq
(
length
alternatives
)
1
)
t
)
(
t
(
lyskom-complete-string
alternatives
)))))
((
=
(
length
alternatives
)
1
)
(
if
(
string-equal
string
(
lyskom-maybe-recode-string
(
car
alternatives
)))
t
(
lyskom-maybe-recode-string
(
car
alternatives
))))
(
t
(
lyskom-maybe-recode-string
(
lyskom-complete-string
alternatives
))))))
...
...
src/commands2.el
View file @
121344d2
...
...
@@ -2432,7 +2432,7 @@ The variable kom-keep-alive-interval controls the frequency of the request."
(
or
conf-no
(
lyskom-read-conf-no
(
lyskom-get-string
'conf-to-check-mship-of
)
'
(
all
)
nil
nil
t
))))
(
if
(
lyskom-is-member
pers-no
conf
-no
)
(
if
(
lyskom-is-member
conf-no
pers
-no
)
(
lyskom-format-insert
'pers-is-member-of-conf
pers-no
conf-no
)
(
lyskom-format-insert
'pers-is-not-member-of-conf
pers-no
conf-no
))))
src/compatibility.el
View file @
121344d2
...
...
@@ -443,6 +443,10 @@ then this returns nil. Otherwise, it returns an index into the buffer
visible in the event's window."
(
car
(
cdr
(
event-start
e
))))
(
lyskom-provide-function
event-closest-point
(
e
)
"Return the character position closest to the mouse event EVENT."
(
car
(
cdr
(
event-start
e
))))
(
lyskom-provide-function
event-glyph
(
e
))
...
...
src/slow.el
View file @
121344d2
...
...
@@ -42,10 +42,20 @@
"Mode map for the `slow' lyskom command mode."
)
(
define-key
lyskom-slow-mode-map
(
kbd
"RET"
)
'kom-parse-command-and-execute
)
(
define-key
lyskom-slow-mode-map
(
kbd
"TAB"
)
'kom-expand-slow-command
)
(
define-key
lyskom-slow-mode-map
(
kbd
"SPC"
)
'kom-expand-slow-or-next-command
)
(
define-key
lyskom-slow-mode-map
(
kbd
"C-a"
)
'kom-slow-start-of-line
)
(
define-key
lyskom-slow-mode-map
(
kbd
"?"
)
'kom-slow-list-completions
)
(
define-key
lyskom-slow-mode-map
(
kbd
"*"
)
'kom-slow-button-press
)
(
define-key
lyskom-slow-mode-map
(
kbd
"="
)
'kom-slow-menu-button-press
)
(
define-key
lyskom-slow-mode-map
(
kbd
"TAB"
)
'kom-expand-slow-command-or-next-link
)
(
define-key
lyskom-slow-mode-map
(
kbd
"M-TAB"
)
'kom-previous-link
)
(
define-key
lyskom-slow-mode-map
(
kbd
"C-i"
)
'kom-expand-slow-command-or-next-link
)
(
define-key
lyskom-slow-mode-map
(
kbd
"M-C-i"
)
'kom-previous-link
)
(
define-key
lyskom-slow-mode-map
(
kbd
(
lyskom-keys
'button2
))
'kom-slow-click-or-yank
)
(
define-key
lyskom-slow-mode-map
(
kbd
(
lyskom-keys
'button2up
))
'kom-mouse-null
)
(
define-key
lyskom-slow-mode-map
(
kbd
(
lyskom-keys
'button3
))
'kom-popup-menu
)
(
define-key
lyskom-slow-mode-map
(
kbd
(
lyskom-keys
'button3up
))
'kom-mouse-null
)
(
defun
lyskom-slow-start-of-line
()
"Move point to start of command, after LysKOM prompt."
...
...
@@ -72,9 +82,42 @@ If no text is entered, nil is returned."
nil
(
buffer-substring
(
point
)
(
point-max
))))
(
defun
lyskom-slow-on-prompt-line
(
&optional
where
)
"Return non-nil if point is on the line containing the prompt.
Currently the prompt is assumed to be on the last line of the buffer."
(
eq
(
save-excursion
(
when
where
(
goto-char
where
))
(
beginning-of-line
)
(
point
))
(
save-excursion
(
goto-char
(
point-max
))
(
beginning-of-line
)
(
point
))))
(
defun
kom-slow-click-or-yank
(
event
)
"Click on a LysKOM button or do the default action if after the prompt."
(
interactive
"@e"
)
(
let
((
pos
(
event-closest-point
event
)))
(
if
(
and
(
lyskom-slow-on-prompt-line
pos
)
(
<=
(
save-excursion
(
lyskom-slow-start-of-line
)
pos
)))
(
let
((
fn
(
lookup-key
global-map
(
this-command-keys
))))
(
when
(
commandp
fn
)
(
call-interactively
fn
)))
(
kom-button-click
event
))))
(
defun
kom-slow-button-press
()
"Run kom-button-press unless on the prompt line."
(
interactive
)
(
if
(
lyskom-slow-on-prompt-line
)
(
call-interactively
'self-insert-command
)
(
kom-button-press
)))
(
defun
kom-slow-menu-button-press
()
"Run kom-menu-button-press unless on the prompt line."
(
interactive
)
(
if
(
lyskom-slow-on-prompt-line
)
(
call-interactively
'self-insert-command
)
(
kom-menu-button-press
)))
(
defun
kom-slow-start-of-line
()
"Move to the beginning of line or start of command if on the prompt line."
(
interactive
)
(
lyskom-slow-start-of-line
))
(
if
(
lyskom-slow-on-prompt-line
)
(
lyskom-slow-start-of-line
)
(
beginning-of-line
)))
(
defun
lyskom-expand-slow-command
(
try-exact
eager-completion
)
(
let*
((
saved-point
(
point-marker
))
...
...
@@ -125,6 +168,14 @@ If no text is entered, nil is returned."
(
t
(
signal
'lyskom-internal-error
'
()))))))
command
))
(
defun
kom-expand-slow-command-or-next-link
()
"If on the prompt line, run kom-expand-slow-command.
Otherwise run kom-next-link."
(
interactive
)
(
if
(
lyskom-slow-on-prompt-line
)
(
call-interactively
'kom-expand-slow-command
)
(
call-interactively
'kom-next-link
)))
(
defun
kom-expand-slow-command
(
&optional
try-exact
)
"Tries to complete the command at point.
If optional TRY-EXACT is non-nil, look for an exact match.
...
...
src/swedish-strings.el
View file @
121344d2
...
...
@@ -690,7 +690,7 @@ M
(not-logged-in . "
Du
r
inte
inloggad.
")
;; Used for kom-is-person-member-of-conference:
(pers-to-check-mship-for . "
Vem
var
s
medlemskap
vill
du
underska?
") ;-)
(pers-to-check-mship-for . "
Vems
medlemskap
vill
du
underska?
") ;-)
(conf-to-check-mship-of . "
...
i
vilket
mte?
")
(conf-is-empty . "
Mtet
%#1M
r
tomt.\n
")
(pers-is-member-of-conf . "
Ja,
%#1P
r
medlem
i
mtet
%#2M.\n
")
...
...
src/vars.el.in
View file @
121344d2
...
...
@@ -1037,7 +1037,8 @@ at random and used. This element may be a string, function or list."
(
def-kom-var
lyskom-command-alternatives
nil
"Possible command completions."
local
)
local
minibuffer
)
(
def-kom-var
kom-trim-buffer-minimum
4096
"*This number of bytes rounded to a whole line is the amount of text trimmed
...
...
@@ -2052,7 +2053,8 @@ an unknown person.")
(
def-kom-var
lyskom-is-administrator
nil
"This variable is t if the user is in administrator mode and nil otherwise."
local
)
local
minibuffer
)
(
def-kom-var
lyskom-last-personal-message-sender
""
"Name of sender of last personal message received"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment