Commit 8f29d190 authored by David Byers's avatar David Byers
Browse files

New configuration for which commands prompt for text numbers.

parent 60b97745
2001-05-30 David Byers <davby@ida.liu.se>
* option-edit.el (lyskom-customize-buffer-format): Add
kom-text-no-prompts.
(lyskom-custom-variables): Add kom-text-no-prompts.
(lyskom-widget-functions): Add cons widget type.
(lyskom-cons-widget): New function.
* command.el (lyskom-read-extended-command): Added prompt
argument.
2001-05-29 David Byers <davby@ida.liu.se>
* vars.el.in (kom-text-no-prompts): New variable.
(lyskom-text-no-prompts-defaults): New variable
(kom-prompt-for-text-no): Removed this variable.
* utilities.el (lyskom-read-text-no-prompt-p): New function
abstracts text-no prompting configuration.
(lyskom-read-text-no-prefix-arg): Use it.
2001-05-30 Joel Rosdahl <joel@rosdahl.net>
* swedish-strings.el (lyskom-message): New string:
......
......@@ -201,10 +201,13 @@
(fnc (call-interactively fnc))
(t (kom-next-command)))) )
(defun lyskom-read-extended-command (&optional prefix-arg)
(defun lyskom-read-extended-command (&optional prefix-arg prompt)
"Reads and returns a command"
(let* ((completion-ignore-case t)
(minibuffer-setup-hook minibuffer-setup-hook)
(base-prompt (cond ((null prompt) (lyskom-get-string 'extended-command))
((symbolp prompt) (lyskom-get-string prompt))
(t prompt)))
(alternatives (mapcar
(lambda (pair)
(cons
......@@ -223,8 +226,8 @@
(format "%d " (car prefix-arg)))
(t nil)))
(prompt (if prefix-text
(concat prefix-text (lyskom-get-string 'extended-command))
(lyskom-get-string 'extended-command))))
(concat prefix-text base-prompt)
base-prompt)))
(lyskom-with-lyskom-minibuffer
(setq name (lyskom-completing-read prompt
......
......@@ -2385,6 +2385,8 @@ Select whether to execute command or keyboard macro.")
(symbolic-mark-name . "Symbolic name: ")
(mark-type-to-assoc . "Mark type to associate with: ")
(prompt-for-text-no . "Prompt for text number")
;;
;; Misc doc strings
;;
......@@ -3206,11 +3208,9 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
network connection to the LysKOM server active. If your network connection
shuts down after a period of inactivity, set this to approximately half
that period and use the command `Keep connection alive'.")
(kom-prompt-for-text-no-doc . "\
These commands will always prompt for text numbers, unless one is
specified via a prefix argument. Commands that are not listed will
assume a suitable default and only prompt if the prefix argument is
zero.")
(kom-text-no-prompts-doc . "\
Specifies which commands will always prompt for text numbers and which
will not. Commands that are not listed here will use default behavior.")
(kom-saved-file-name-doc . "\
Specifies the default file to archive texts in. The client will always
prompt for the file name, using this as the default.")
......@@ -3404,7 +3404,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-server-priority-breaks-tag . "Prompt to go to next LysKOM:")
(kom-complete-numbers-before-names-tag . "Read conference numbers before names:")
(kom-keep-alive-interval-tag . "Keep connection alive interval:")
(kom-prompt-for-text-no-tag . "Commands that prompt for text numbers:")
(kom-text-no-prompts-tag . "How commands prompt for text numbers:")
(kom-saved-file-name-tag . "File to archive texts in:")
(kom-follow-attachments-tag . "Read imported attachments as texts:")
(kom-show-unread-in-frame-title-tag . "Show unread indicator in title bar:")
......
......@@ -78,7 +78,7 @@
[kom-presence-messages]
[kom-presence-messages-in-buffer]
"\n"
[kom-prompt-for-text-no]
[kom-text-no-prompts]
[kom-page-before-command]
[kom-deferred-printing]
[kom-max-buffer-size]
......@@ -672,7 +672,9 @@ customize buffer but do not save them to the server."
(kom-ansaphone-replies (ansaphone))
(kom-complete-numbers-before-names (toggle (on off)))
(kom-keep-alive-interval (number))
(kom-prompt-for-text-no (repeat (command nil :tag command)))
(kom-text-no-prompts (repeat (cons ((command nil :tag command :format "%[%t%]: %v")
(toggle (yes no) :tag prompt-for-text-no :format "%[%t%]: %v")
))))
(kom-saved-file-name (file))
(kom-follow-attachments (toggle (yes no)))
(kom-show-unread-in-frame-title (toggle (yes no)))
......@@ -693,6 +695,7 @@ customize buffer but do not save them to the server."
(number . lyskom-number-widget)
(const . lyskom-item-widget)
(repeat . lyskom-repeat-widget)
(cons . lyskom-cons-widget)
(kbd-macro . lyskom-kbd-macro-widget)
(url-viewer . lyskom-url-viewer-widget)
(ispell-dictionary . lyskom-ispell-dictionary-widget)
......@@ -1096,6 +1099,15 @@ customize buffer but do not save them to the server."
(list (lyskom-widget-convert-specification args)))
propl))
(defun lyskom-cons-widget (type &optional args propl)
(lyskom-build-simple-widget-spec
'cons
(list ':format "%v\n"
':tag ""
':args (list (lyskom-widget-convert-specification (elt args 0))
(lyskom-widget-convert-specification (elt args 1))))
propl))
(defun lyskom-choice-widget (type &optional args propl)
(lyskom-build-simple-widget-spec
'menu-choice
......@@ -1302,7 +1314,9 @@ customize buffer but do not save them to the server."
(widget-value-set widget
(save-excursion
(set-buffer lyskom-buffer)
(lyskom-read-extended-command)))
(lyskom-read-extended-command nil (concat
(widget-get widget ':tag)
": "))))
(widget-setup))
(defun lyskom-widget-command-value-create (widget)
......
......@@ -2819,6 +2819,8 @@ till ett visst m
(symbolic-mark-name . "Symboliskt namn: ")
(mark-type-to-assoc . "Markeringstyp att associera till: ")
(prompt-for-text-no . "Frga efter textnummer")
;;
;; Misc doc strings
;;
......@@ -3645,10 +3647,10 @@ i servern. Annars sparas det i din .emacs.")
hlla ntverkskopplingen till LysKOM-servern aktiv. Om din frbindelse
kopplar ned efter en stunds inaktivitet s kan du stta detta till ungefr
hlften och sedan ge kommandot \"Hll frbindelsen aktiv\".")
(kom-prompt-for-text-no-doc . "\
Dessa kommandon kommer alltid att frga efter textnummer om man inte
anger ngot explicit med prefixargument. Kommaondon som inte str med
hr kommer att gissa ett textnummer och inte frga.")
(kom-text-no-prompts-doc . "\
Den r instllningen styr vilka kommandon som alltid frgar efter
textnummer (om man inte anger ett explicit som prefixargument). Fr
kommandon som inte str med hr anvnds inbyggda standardinstllningar.")
(kom-saved-file-name-doc . "\
Anger vilken fil som inlgg skall arkiveras till. Klienten kommer nd
att frga, men detta blir det frifyllda svaret.")
......@@ -3841,7 +3843,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-server-priority-breaks-tag . "Byt till LysKOM med olsta:")
(kom-complete-numbers-before-names-tag . "Ls mtesnummer fre mtesnamn:")
(kom-keep-alive-interval-tag . "Intervall fr hll frbindelsen igng:")
(kom-prompt-for-text-no-tag . "Kommandon som skall frga efter textnummer:")
(kom-text-no-prompts-tag . "Hur kommandon frgar efter textnummer:")
(kom-saved-file-name-tag . "Fil att arkivera inlgg i:")
(kom-follow-attachments-tag . "Ls importerade bilagor som vanligt:")
(kom-show-unread-in-frame-title-tag . "Visa olstamarkering i titelraden:")
......
......@@ -593,6 +593,11 @@ The value is actually the element of LIST whose car equals KEY."
;;; ============================================================
;;; Prefix arguments
(defun lyskom-read-text-no-prompt-p (command)
"Return non-nil if the COMMAND should prompt for a text number."
(let ((check (assq command kom-text-no-prompts)))
(if check (cdr check) (memq command lyskom-text-no-prompts-defaults))))
(defun lyskom-read-text-no-prefix-arg (prompt &optional always-read default)
"Call in interactive list to read text-no.
If optional argument ALWAYS-READ is non-nil the user is prompted if an
......@@ -621,7 +626,7 @@ number means use that text as the default."
(cond
((null current-prefix-arg)
(if (or always-read
(memq lyskom-current-command kom-prompt-for-text-no)
(lyskom-read-text-no-prompt-p lyskom-current-command)
(null default))
(lyskom-read-number prompt default)
default))
......
......@@ -2162,7 +2162,7 @@ set to that text."
"List of patterns to filter during this session."
local)
(def-kom-var kom-prompt-for-text-no
(def-kom-var lyskom-text-no-prompts-defaults
'(kom-delete-text
kom-view
kom-write-footnote
......@@ -2183,7 +2183,14 @@ set to that text."
kom-add-no-comments
kom-add-private-answer
kom-add-request-confirm)
"*Commands that prompt for a text number rather than assume a default."
"Commands that prompt for a text number rather than assume a default."
inherited)
(def-kom-var kom-text-no-prompts nil
"*Configure which commands ask for text numbers.
A list containing pairs of (COMMAND . VALUE). If VALUE is non-nil, COMMAND
will prompt for text numbers. If VALUE is nil, COMMAND will use a suitable
default value."
server
inherited)
......
......@@ -1038,6 +1038,8 @@ Args: TEXT-STAT of the text being read."
(type (misc-info->type misc))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat)
17)))
(read-mx-from (car (lyskom-get-aux-item (text-stat->aux-items read-text-stat)
17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat)
16)))
(mx-attachments-in (lyskom-get-text-attachments read-text-stat))
......@@ -1047,6 +1049,7 @@ Args: TEXT-STAT of the text being read."
(lyskom-get-aux-item (text-stat->aux-items
read-text-stat) 10100)))
(content-type "")
(read-content-type "")
fmt data)
(setq author (or (lyskom-format-mx-author mx-from mx-author) author))
......@@ -1061,18 +1064,29 @@ Args: TEXT-STAT of the text being read."
(aux-item->data content-type))))
(setq content-type ""))
(if (and read-mx-from
(setq read-content-type
(car (lyskom-get-aux-item (text-stat->aux-items
read-text-stat) 1))))
(progn (string-match "^\\(\\S-+\\)" (aux-item->data read-content-type))
(setq read-content-type (format "(%s) "
(aux-item->data read-content-type))))
(setq read-content-type ""))
(cond
((eq type 'COMM-TO)
(setq fmt (cond ((memq (misc-info->comm-to misc) mx-belongs-to)
'attachment-to-text)
(author 'comment-to-text-by)
(t 'comment-to-text))
content-type read-content-type
data (misc-info->comm-to misc)))
((eq type 'FOOTN-TO)
(setq fmt (cond ((memq (misc-info->footn-to misc) mx-belongs-to)
'attachment-to-text)
(author 'footnote-to-text-by)
(t 'footnote-to-text))
content-type read-content-type
data (misc-info->footn-to misc)))
((eq type 'COMM-IN)
(setq fmt (cond ((memq (misc-info->comm-in misc) mx-attachments-in)
......@@ -1099,6 +1113,7 @@ Args: TEXT-STAT of the text being read."
(text-stat->author text-stat)
nil))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(read-mx-from (car (lyskom-get-aux-item (text-stat->aux-items read-text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-attachments-in (lyskom-get-text-attachments read-text-stat))
(mx-belongs-to (mapcar
......@@ -1106,6 +1121,7 @@ Args: TEXT-STAT of the text being read."
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10100)))
(content-type "")
(read-content-type "")
(is-attachment nil)
(type (misc-info->type misc)))
......@@ -1122,6 +1138,15 @@ Args: TEXT-STAT of the text being read."
(aux-item->data content-type))))
(setq content-type ""))
(if (and read-mx-from
(setq read-content-type
(car (lyskom-get-aux-item (text-stat->aux-items
read-text-stat) 1))))
(progn (string-match "^\\(\\S-+\\)" (aux-item->data read-content-type))
(setq read-content-type (format "(%s) "
(aux-item->data read-content-type))))
(setq read-content-type ""))
(cond
((eq type 'COMM-TO)
......@@ -1131,7 +1156,7 @@ Args: TEXT-STAT of the text being read."
'comment-to-text)
(misc-info->comm-to misc)
nil
content-type))
read-content-type))
((eq type 'FOOTN-TO)
(lyskom-format-insert (if (and (memq (misc-info->footn-to misc) mx-belongs-to)
(setq is-attachment t))
......@@ -1139,7 +1164,7 @@ Args: TEXT-STAT of the text being read."
'footnote-to-text)
(misc-info->footn-to misc)
nil
content-type))
read-content-type))
((eq type 'COMM-IN)
(lyskom-format-insert (if (and (memq (misc-info->comm-in misc) mx-attachments-in)
(setq is-attachment t))
......
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