Commit 95746c24 authored by Peter Liljenberg's avatar Peter Liljenberg
Browse files

Komplement till *: + simulerar högermusknapptryck så man kan stega

igenom menyalternativen i minibuffern.
parent 2da58cc5
......@@ -60,6 +60,9 @@ tar-arkivet.
** Man kan citatmarkera text vid editering av ett inlägg med
comment-region.
** Man kan simulera högerknapptryckning med + för att kunna använda
menyer med tangentbordet.
* Tilläggsinformation
......
Thu Jul 23 15:03:10 1998 Peter Liljenberg <petli@lysator.liu.se>
* lyskom-buttons.el (lyskom-keyboard-menu):
(lyskom-button-menu):
(kom-menu-button-press): Skrev kom-menu-button-press som
komplement till kom-button-press.
* view-mode.el (lyskom-view-mode-map): Se ovan.
* english-strings.el (lyskom-en-edit-mode-map):
(lyskom-en-mode-map):
(lyskom-en-prioritize-mode-map): Se ovan.
* swedish-strings.el (lyskom-sv-mode-map):
(lyskom-sv-prioritize-mode-map):
(lyskom-sv-edit-mode-map): Se ovan.
Wed Jul 8 13:12:48 1998 David Kagedal <davidk@lysator.liu.se>
* startup.el (lyskom): Den frgade inte om man ville fortstta med
......
......@@ -77,6 +77,7 @@
(define-key lyskom-en-edit-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-en-edit-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-en-edit-mode-map "\C-c*" 'kom-button-press)
(define-key lyskom-en-edit-mode-map "\C-c+" 'kom-menu-button-press)
(define-key lyskom-en-edit-mode-map "\C-c\C-c" 'kom-edit-send)
(define-key lyskom-en-edit-mode-map "\C-c\C-s" 'kom-ispell-message)
(define-key lyskom-en-edit-mode-map "\C-c\C-k" 'kom-edit-quit)
......@@ -1051,6 +1052,8 @@ On since %#8s%#9s")
(doing-nowhere-conn . "but is")
(waiting-for-membership . "Waiting for the membership list to be fetched...%d/%d")
(keyboard-menu-help . "Next: SPC Prev: DEL Select: RET Cancel: ESC")
;; From slow.el
(no-such-command . "There is no such command.\n")
(command-completions . "You may mean one of the following:\n %#1s\n")
......@@ -1522,6 +1525,7 @@ Contents: \"%#9s\"
(define-key lyskom-en-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-en-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-en-mode-map "*" 'kom-button-press)
(define-key lyskom-en-mode-map "+" 'kom-menu-button-press)
(define-key lyskom-en-mode-map "\C-i" 'kom-next-link)
(define-key lyskom-en-mode-map "\M-\C-i" 'kom-previous-link)
......@@ -1698,6 +1702,7 @@ Contents: \"%#9s\"
(define-key lyskom-en-prioritize-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-en-prioritize-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-en-prioritize-mode-map "*" 'kom-button-press)
(define-key lyskom-en-prioritize-mode-map "+" 'kom-menu-button-press)
(define-key lyskom-en-prioritize-mode-map "?" 'kom-prioritize-help)
(define-key lyskom-en-prioritize-mode-map "\C-k" 'kom-prioritize-select)
(define-key lyskom-en-prioritize-mode-map "\C-y" 'kom-prioritize-yank)
......
......@@ -119,6 +119,11 @@ on such functions see the documentation for lyskom-add-button-action."
(interactive)
(lyskom-button-press (point)))
(defun kom-menu-button-press ()
"Simulate a menu mouse button press at point."
(interactive)
(lyskom-button-menu (point) 'key))
(defun kom-button-click (event &optional do-default)
"Execute the default action of the active area under the mouse.
If optional argument do-default is non-nil, call the default binding of
......@@ -229,11 +234,106 @@ If there is no active area, then do something else."
;; from simple keymaps to be title-less. A list consisting
;; of a single keymap works better. A patch is submittet to
;; the GNU folks. /davidk
(let* ((menu (lyskom-make-button-menu title actl
buf arg text)))
(lyskom-do-popup-menu menu event))))))
(if (eq event 'key)
(lyskom-keyboard-menu title actl buf arg text)
(let* ((menu (lyskom-make-button-menu title actl
buf arg text)))
(lyskom-do-popup-menu menu event)))))))
(defun lyskom-keyboard-menu-get-event (prompt)
"Returns `prev', `next', `select', `cancel' or `help'."
(lyskom-xemacs-or-gnu
(let ((event (next-command-event nil prompt)))
(if (eq (event-type event) 'key-press)
(cdr (assq (event-key event)
'((space . next)
(down . next)
(?n . next)
(?d . next)
(delete . prev)
(backspace . prev)
(up . prev)
(?p . prev)
(?u . prev)
(return . select)
(linefeed . select)
(escape . cancel)
(?q . cancel)
(?h . help))))
))
(progn
(lyskom-message "%s" prompt)
(cdr (assq (read-event)
'((32 . next)
(down . next)
(?n . next)
(?\C-n . next)
(?d . next)
(delete . prev)
(backspace . prev)
(up . prev)
(?p . prev)
(?\C-p . prev)
(?u . prev)
(return . select)
(linefeed . select)
(?\C-j . select)
(escape . cancel)
(?q . cancel)
(?\C-h . help))))
)))
(defun lyskom-keyboard-menu (title entries buf arg text)
"Do a keyboard menu selection."
(let ((cursor-in-echo-area t)
(entry entries)
(going t)
prefix
event)
(let ((maxlen 0)
(e entries))
(while e
(if (> (length (car (car e))) maxlen)
(setq maxlen (length (car (car e)))))
(setq e (cdr e)))
(setq prefix (substring title 0
(min (length title)
(- (window-width (minibuffer-window))
maxlen 3)))))
(while going
(setq event (lyskom-keyboard-menu-get-event
(format "%s: %s" prefix (car (car entry)))))
(cond
;; Next menu item
((eq event 'next)
(setq entry (or (cdr entry) entries)))
;; Previous menu item
((eq event 'prev)
(let ((e entries)
(l nil))
(while (and e (not (eq (cdr e) entry)))
(setq l e
e (cdr e)))
(setq entry (or e l))))
;; Select
((eq event 'select)
(if entry
(progn
(setq going nil)
(funcall (cdr (car entry)) buf arg text))))
;; Help
((eq event 'help)
(lyskom-keyboard-menu-get-event
(lyskom-get-string 'keyboard-menu-help)))
;; Escape
((eq event 'cancel)
(setq going nil))))))
(defun lyskom-button-press (pos)
"Execute the default action of the active area at POS if any."
......
......@@ -84,6 +84,7 @@
(define-key lyskom-sv-edit-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-sv-edit-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-sv-edit-mode-map "\C-c*" 'kom-button-press)
(define-key lyskom-sv-edit-mode-map "\C-c+" 'kom-menu-button-press)
(define-key lyskom-sv-edit-mode-map "\C-c\C-i" 'lyskom-sv-edit-insert-prefix)
(define-key lyskom-sv-edit-mode-map "\C-c\C-c" 'kom-edit-send)
(define-key lyskom-sv-edit-mode-map "\C-c\C-s" 'kom-ispell-message)
......@@ -1068,6 +1069,8 @@ Uppkopplad sedan %#8s%#9s")
(doing-nowhere-conn . "men r")
(waiting-for-membership . "Vntar p att medlemskapslistan ska lsas in...%d/%d")
(keyboard-menu-help . "Nsta: SPC Freg: DEL Utfr: RET Avbryt: ESC")
;; From slow.el
(no-such-command . "Det finns inget sdant kommando.\n")
(command-completions . "Du kan mena ngon av fljande:\n %#1s\n")
......@@ -1320,7 +1323,7 @@ Inneh
(kom-fast-reply . "Snabb replik")
(kom-agree . "Hlla med")
))
(lyskom-language-var lyskom-language-codes sv
......@@ -1574,6 +1577,7 @@ Inneh
(define-key lyskom-sv-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-sv-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-sv-mode-map "*" 'kom-button-press)
(define-key lyskom-sv-mode-map "+" 'kom-menu-button-press)
(define-key lyskom-sv-mode-map "\C-i" 'kom-next-link)
(define-key lyskom-sv-mode-map "\M-\C-i" 'kom-previous-link)
......@@ -1762,6 +1766,7 @@ Inneh
(define-key lyskom-sv-prioritize-mode-map (lyskom-keys [down-mouse-3]) 'kom-popup-menu)
(define-key lyskom-sv-prioritize-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-sv-prioritize-mode-map "*" 'kom-button-press)
(define-key lyskom-sv-prioritize-mode-map "+" 'kom-menu-button-press)
(define-key lyskom-sv-prioritize-mode-map "?" 'kom-prioritize-help)
(define-key lyskom-sv-prioritize-mode-map "\C-k" 'kom-prioritize-select)
(define-key lyskom-sv-prioritize-mode-map "\C-y" 'kom-prioritize-yank)
......
......@@ -59,6 +59,7 @@
nil
(setq lyskom-view-mode-map (make-sparse-keymap))
(define-key lyskom-view-mode-map "*" 'kom-button-press)
(define-key lyskom-view-mode-map "+" 'kom-menu-button-press)
(define-key lyskom-view-mode-map "\t" 'kom-next-link)
(define-key lyskom-view-mode-map [(meta tab)] 'kom-previous-link)
(define-key lyskom-view-mode-map (lyskom-keys [mouse-2]) 'kom-button-click)
......
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