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
lyskom-elisp-client
lyskom-elisp-client
Commits
336feb9e
Commit
336feb9e
authored
Oct 01, 2000
by
Per Cederqvist
Browse files
kom-list-re performs a case insensitive match if a prefix argument is
given.
parent
f73178ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/ChangeLog
View file @
336feb9e
2000-10-01 Per Cederqvist <ceder@moria>
* commands1.el (lyskom-make-re-case-insensitive): New function.
(kom-list-re): Be case insensitive if a prefix arg is given.
* vars.el.in (lyskom-char-classes): New variable.
* utilities.el (lyskom-default-collate-table): Doc-string
improved. Value fixed.
(lyskom-compute-char-classes): New function.
* startup.el (lyskom): Set lyskom-char-classes.
* lyskom-rest.el: Set a default value for lyskom-char-classes.
2000-09-15 David Byers <davby@ida.liu.se>
* command.el (lyskom-command-complete-word): Prevent multiple
...
...
src/commands1.el
View file @
336feb9e
...
...
@@ -1630,10 +1630,78 @@ If you are not member in the conference it will be flagged with an asterisk."
;;; ================================================================
;;; Lista med regexpar - List regexp
(
def-kom-command
kom-list-re
(
regexp
)
"List all persons and conferences whose name matches REGEXP."
(
defun
lyskom-make-re-case-insensitive
(
re
)
"Convert the regexp RE to a case insensitive regexp."
(
unless
lyskom-char-classes
(
setq
lyskom-char-classes
(
lyskom-compute-char-classes
lyskom-collate-table
)))
(
let
((
res
nil
)
(
input
(
split-string
re
""
))
val
)
(
while
input
(
cond
;; Copy "[]" character sets literally.
((
string=
(
car
input
)
"["
)
(
setq
res
(
cons
"["
res
))
(
setq
input
(
cdr
input
))
(
when
input
;Handle "[]asdf]" properly.
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
)))
(
while
(
and
input
(
not
(
string=
(
car
input
)
"]"
)))
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
)))
(
when
input
;Don't forget the terminating "]".
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
))))
;; Copy backslashed sequences literally.
((
string=
(
car
input
)
"\\"
)
(
setq
res
(
cons
"\\"
res
))
(
setq
input
(
cdr
input
))
(
when
input
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
))))
;; Copy special characters literally.
((
member
(
car
input
)
'
(
"("
")"
"|"
"+"
"*"
"?"
))
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
)))
;; Create "[]" character sets for equivalent characters.
((
setq
val
(
cdr-safe
(
assoc
(
aref
(
car
input
)
0
)
lyskom-char-classes
)))
(
setq
res
(
cons
"["
res
))
(
if
(
member
"]"
val
)
;"]" must come first.
(
setq
res
(
cons
"]"
res
)))
(
while
val
(
cond
((
string=
"]"
(
car
val
)))
;already handled
((
string=
"-"
(
car
val
))
(
setq
res
(
cons
"---"
res
)))
(
t
(
setq
res
(
cons
(
car
val
)
res
))))
(
setq
val
(
cdr
val
)))
(
setq
res
(
cons
"]"
res
))
(
setq
input
(
cdr
input
)))
;; Copy other characters literally.
(
t
(
setq
res
(
cons
(
car
input
)
res
))
(
setq
input
(
cdr
input
)))))
(
apply
'concat
(
nreverse
res
))))
(
def-kom-command
kom-list-re
(
regexp
&optional
case-insensitive
)
"List all persons and conferences whose name matches REGEXP.
If the optional argument CASE-INSENSITIVE is true, the regexp will be
converted so that the search is case insensitive."
(
interactive
(
list
(
lyskom-read-string
(
lyskom-get-string
'search-re
))))
(
lyskom-get-string
'search-re
))
current-prefix-arg
))
(
if
case-insensitive
(
setq
regexp
(
lyskom-make-re-case-insensitive
regexp
)))
(
lyskom-format-insert
'matching-regexp
regexp
)
(
let
((
conf-list
(
blocking-do
're-z-lookup
regexp
1
1
)))
(
if
conf-list
...
...
src/lyskom-rest.el
View file @
336feb9e
...
...
@@ -3555,6 +3555,11 @@ One parameter - the prompt string."
nil
(
setq-default
lyskom-collate-table
lyskom-default-collate-table
)
;; We should set lyskom-char-classes to
;; (lyskom-compute-char-classes lyskom-collate-table))
;; but that currently fails under Emacs 20.7, because
;; lyskom-default-collate-table isn't set properly.
(
setq-default
lyskom-char-classes
nil
)
(
lyskom-set-language
lyskom-language
)
(
unless
(
or
(
memq
'lyskom-unread-mode-line
global-mode-string
)
(
rassq
'lyskom-unread-mode-line
global-mode-string
))
...
...
src/startup.el
View file @
336feb9e
...
...
@@ -262,6 +262,7 @@ See lyskom-mode for details."
(
when
(
lyskom-have-call
85
)
(
setq
lyskom-collate-table
(
blocking-do
'get-collate-table
))
(
setq
lyskom-char-classes
nil
)
(
lyskom-update-command-completion
))
(
if
(
not
(
zerop
(
server-info->motd-of-lyskom
lyskom-server-info
)))
...
...
@@ -835,6 +836,7 @@ to see, set of call."
(
setq
lyskom-do-when-done
(
cons
kom-do-when-done
kom-do-when-done
))
(
setq
lyskom-output-queues
(
make-vector
10
nil
))
(
setq
lyskom-collate-table
lyskom-default-collate-table
)
(
setq
lyskom-char-classes
nil
)
(
let
((
i
0
))
(
while
(
<
i
10
)
(
aset
lyskom-output-queues
i
(
lyskom-queue-create
))
...
...
src/utilities.el
View file @
336feb9e
...
...
@@ -310,7 +310,11 @@ TYPE should be `list' or `vector'."
(
defvar
lyskom-default-collate-table
"\000\001\002\003\004\005\006\007\010 \012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]~\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237!AAAA[]ACEEEEIIIINOOOO\\OUUUYYAAAA[]ACEEEEIIIINOOOO\\OUUUYY"
"String mapping lowercase to uppercase and equivalents to each others."
)
"String mapping characters to their collate class.
Lowercase, uppercase and other equivalents are mapped to the same class.
The class number defines a proper sorting order."
)
(
defsubst
lyskom-maybe-recode-string
(
s
&optional
coding
force
)
"Change the encoding of S for when multibyte characters are not supported.
...
...
@@ -377,6 +381,53 @@ is non-nil."
(
error
nil
)))
(
defun
lyskom-compute-char-classes
(
map
)
"Find out which characters that are equivalent according to MAP.
MAP should be a collate table.
The return value is an assoc list, which characters as keys, and a
list of single-character strings as values. Only characters that are
equivalent to at least one more character is returned in the assoc
list.
Example: if this function returns
((97 \"A\" \"a\")
(65 \"A\" \"a\")
(48 \"O\" \"o\" \"0\")
(111 \"O\" \"o\" \"0\")
(79 \"O\" \"o\" \"0\"))
it means that a and A are equivalent, and o, O and 0 are equivalent.
All other characters are unique."
(
lyskom-save-excursion
(
and
lyskom-buffer
(
set-buffer
lyskom-buffer
))
(
let
((
ix
(
length
map
))
(
cls-to-strings
nil
))
;assoc-list from equivalence class to
;list of chars
(
while
(
>
ix
0
)
(
setq
ix
(
1-
ix
))
(
let*
((
cls
(
aref
map
ix
))
(
str
(
decode-coding-string
(
concat
(
vector
ix
))
lyskom-server-coding-system
))
(
elem
(
assoc
cls
cls-to-strings
)))
(
if
elem
(
rplacd
elem
(
cons
str
(
cdr
elem
)))
(
setq
cls-to-strings
(
cons
(
list
cls
str
)
cls-to-strings
)))))
(
let
((
res
nil
))
(
while
cls-to-strings
(
let
((
lst
(
cdar
cls-to-strings
)))
(
if
(
>
(
length
lst
)
1
)
(
while
lst
(
setq
res
(
cons
(
cons
(
string-to-char
(
car
lst
))
(
cdar
cls-to-strings
))
res
))
(
setq
lst
(
cdr
lst
)))))
(
setq
cls-to-strings
(
cdr
cls-to-strings
)))
res
))))
;; Stolen from thingatpt.el
;; FIXME: We may not really need this function. Check the callers.
...
...
src/vars.el.in
View file @
336feb9e
...
...
@@ -2086,7 +2086,12 @@ an unknown person.")
"Microseconds timeout for accept-process-output."
)
(
def-kom-var
lyskom-collate-table
nil
"Table mapping characters to equivalent characters."
"Table mapping characters to an equivalence class."
inherited
)
(
def-kom-var
lyskom-char-classes
nil
"An assoc list from character to a list of equivalent strings.
See lyskom-compute-char-classes."
inherited
)
(
def-kom-var
lyskom-dont-read-user-area
nil
...
...
Write
Preview
Markdown
is supported
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