Commit b61829bb authored by Linus Tolke Y's avatar Linus Tolke Y
Browse files

Support for lucid-emacs. Now it works for lucid also.

parent 55f53871
Tue Jun 16 00:34:42 1992 Linus Tolke Y (linus@robin)
* commands2.el, completing-read.el, edit-text.el, lyskom-rest.el
(keymaps are no longer always arrays): Works no for lucid-emacs.
Sat Jun 13 18:50:21 1992 Linus Tolke Y (linus@robert) Sat Jun 13 18:50:21 1992 Linus Tolke Y (linus@robert)
* swedish-string.el (*-mode-map): replaced * swedish-string.el (*-mode-map): replaced
......
...@@ -850,7 +850,17 @@ Format is 23:29 if the text is written today. Otherwise 04-01." ...@@ -850,7 +850,17 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(defun lyskom-help () (defun lyskom-help ()
"Prints a short list of alternatives when you don't know what you can do." "Prints a short list of alternatives when you don't know what you can do."
(interactive) (interactive)
(let* ((tohere (substring (this-command-keys) 0 -1)) (let* ((tohere (cond
((stringp (this-command-keys))
(substring (this-command-keys) 0 -1))
(t ;This is the case in the lucid-emacs.
(let* ((tck (this-command-keys))
(newvec (make-vector (1- (length tck)) nil))
(r 0))
(while (< r (length newvec))
(aset newvec r (aref tck r))
(++ r))
newvec))))
(binding (key-binding tohere)) (binding (key-binding tohere))
(keymap (cond (keymap (cond
((and (symbolp binding) ((and (symbolp binding)
...@@ -858,6 +868,15 @@ Format is 23:29 if the text is written today. Otherwise 04-01." ...@@ -858,6 +868,15 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(symbol-function binding)) (symbol-function binding))
(t binding))) (t binding)))
(keylis (cond (keylis (cond
((fboundp 'map-keymap)
(and keymap
(let (list)
(map-keymap
(function
(lambda (event function)
(setq list (cons (cons event function) list))))
keymap t)
(nreverse list))))
((vectorp keymap) ((vectorp keymap)
(let ((lis nil) (let ((lis nil)
(r 0)) (r 0))
...@@ -874,8 +893,12 @@ Format is 23:29 if the text is written today. Otherwise 04-01." ...@@ -874,8 +893,12 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(mapconcat (mapconcat
(function (function
(lambda (arg) (lambda (arg)
(format "%c - %s" (format "%s - %s"
(car arg) (if (fboundp 'map-keymap)
(if (symbolp (car arg))
(format "%s" (car arg))
(format "%c" (car arg)))
(format "%c" (car arg)))
(or (lyskom-command-name (cdr arg)) (or (lyskom-command-name (cdr arg))
(and (keymapp (cdr arg)) (and (keymapp (cdr arg))
(lyskom-get-string 'multiple-choice)) (lyskom-get-string 'multiple-choice))
......
...@@ -289,7 +289,9 @@ When C-G is pressed then lyskom-end-of-command is evaled." ...@@ -289,7 +289,9 @@ When C-G is pressed then lyskom-end-of-command is evaled."
(and completion-buffer (and completion-buffer
(get-buffer-window completion-buffer))) (get-buffer-window completion-buffer)))
(use-local-map lyskom-completing-map) (use-local-map lyskom-completing-map)
(setq unread-command-char last-command-char)) (if (fboundp 'map-keymap) ;Special for lucid-emacs.
(setq unread-command-event last-command-event)
(setq unread-command-char last-command-char)))
(defun lyskom-complete-and-edit (conf-stats what (defun lyskom-complete-and-edit (conf-stats what
...@@ -407,9 +409,16 @@ parst matching ([^)]) in string and alist are disgarded." ...@@ -407,9 +409,16 @@ parst matching ([^)]) in string and alist are disgarded."
(if lyskom-initial-completing-map (if lyskom-initial-completing-map
nil nil
(let ((i (length (setq lyskom-initial-completing-map (make-keymap))))) (setq lyskom-initial-completing-map (make-keymap))
(while (>= (setq i (1- i)) 0) (if (fboundp 'map-keymap) ;lucid-emacs' way of doing things.
(aset lyskom-initial-completing-map i 'lyskom-hack-minibuf))) (map-keymap
(function (lambda (keydesc binding)
(define-key lyskom-initial-completing-map keydesc
'lyskom-hack-minibuf)))
global-map)
(let ((i (length lyskom-initial-completing-map)))
(while (>= (setq i (1- i)) 0)
(aset lyskom-initial-completing-map i 'lyskom-hack-minibuf))))
(define-key lyskom-initial-completing-map "\C-g" 'lyskom-complete-quit)) (define-key lyskom-initial-completing-map "\C-g" 'lyskom-complete-quit))
......
...@@ -340,7 +340,9 @@ Entry to this mode runs lyskom-edit-mode-hook." ...@@ -340,7 +340,9 @@ Entry to this mode runs lyskom-edit-mode-hook."
(defun kom-edit-insert-digit-text () (defun kom-edit-insert-digit-text ()
(interactive) (interactive)
(setq unread-command-char last-command-char) (if (fboundp 'map-keymap) ;Special for lucid-emacs
(setq unread-command-event last-command-event)
(setq unread-command-char last-command-char))
(call-interactively 'kom-edit-insert-text nil)) (call-interactively 'kom-edit-insert-text nil))
...@@ -735,16 +737,24 @@ BUG: does not descend in the maps." ...@@ -735,16 +737,24 @@ BUG: does not descend in the maps."
(t (t
(let ((map (copy-keymap oldmap)) (let ((map (copy-keymap oldmap))
(r 0)) (r 0))
(if (arrayp newmap) (cond
(while (< r (length newmap)) ((fboundp 'map-keymap) ;Special for lucid-emacs
(if (aref newmap r) (map-keymap
(define-key map (char-to-string r) (aref newmap r)))
(setq r (1+ r)))
(mapcar
(function (function
(lambda (ele) (lambda (event function)
(define-key map (char-to-string (car ele)) (cdr ele)))) (define-key map event function)))
(cdr newmap))) newmap))
((arrayp newmap)
(while (< r (length newmap))
(if (aref newmap r)
(define-key map (char-to-string r) (aref newmap r)))
(setq r (1+ r))))
(t
(mapcar
(function
(lambda (ele)
(define-key map (char-to-string (car ele)) (cdr ele))))
(cdr newmap))))
map)))) map))))
......
No preview for this file type
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