Commit 34b417f4 authored by David Byers's avatar David Byers
Browse files

Nya knappfunktioner, lite dokumentationsdndringar

parent 0c9b96e5
No preview for this file type
...@@ -31,6 +31,37 @@ ...@@ -31,6 +31,37 @@
;;;; ;;;;
(defun lyskom-add-button-action (type text func)
"Add a new action to the popup menu for a class of objects.
Arguments are TYPE, the type of object to adjust, TEXT the menu text
for the action and FUNC, the function to call when the action is
selected. By default TYPE may be any one of text, conf, pers or url
although users can add other types.
FUNC must be a function with three arguments, BUFFER, ARGUMENT and
TEXT. BUFFER is the LysKOM buffer that the command should use, TEXT
is the text of the selected button and ARGUMENT is the data argument
associated with the object. For button type text it is a text
number. For types conf and pers it is the conference number for the
object. For URLs it is the text of the URL (a string) or NIL. For
other (user-defined) types, it is a string.
For more information on button types and arguments, see the
documentation for the variable lyskom-text-buttons."
(nconc (nth 3 (assq type lyskom-button-actions))
(list (cons text func))))
(defun lyskom-set-default-button-action (type func)
"Set the default action for buttons of the type TYPE to FUNC.
FUNC must be a valid button action function. For more information
on such functions see the documentation for lyskom-add-button-action."
(let ((el (assq type lyskom-button-actions)))
(setcdr (nthcdr 1 el)
(cons func (nthcdr 3 el)))))
(defun kom-previous-link (num) (defun kom-previous-link (num)
"Move the cursor to the previous active area in the LysKOM buffer." "Move the cursor to the previous active area in the LysKOM buffer."
(interactive "p") (interactive "p")
...@@ -240,9 +271,15 @@ FACE is the default text face for the button." ...@@ -240,9 +271,15 @@ FACE is the default text face for the button."
'mouse-face 'kom-highlight-face 'mouse-face 'kom-highlight-face
'lyskom-button-text text 'lyskom-button-text text
'lyskom-button-type type 'lyskom-button-type type
'lyskom-button-arg nil 'lyskom-button-arg arg
'lyskom-buffer lyskom-buffer)) 'lyskom-buffer lyskom-buffer))
(t nil)))) (t
(list 'face (or face 'kom-active-face)
'mouse-face 'kom-highlight-face
'lyskom-button-text text
'lyskom-button-type type
'lyskom-button-arg arg
'lyskom-buffer lyskom-buffer)))))
(if (and lyskom-executing-command (if (and lyskom-executing-command
lyskom-current-command lyskom-current-command
(assq lyskom-current-command hints)) (assq lyskom-current-command hints))
......
...@@ -273,7 +273,9 @@ overridden. It is a list containing elements (COMMAND . HINT) where COMMAND is ...@@ -273,7 +273,9 @@ overridden. It is a list containing elements (COMMAND . HINT) where COMMAND is
as interactive LysKOM command and HINT is a function to call. When a button as interactive LysKOM command and HINT is a function to call. When a button
is generated while the command COMMAND is being executed, HINT is used as a is generated while the command COMMAND is being executed, HINT is used as a
hint for a new default action. The user has the option to ignore or used the hint for a new default action. The user has the option to ignore or used the
hint.") hint.
Also see the function \"kom-add-button-action\".")
(defvar lyskom-text-buttons (defvar lyskom-text-buttons
......
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