Commit 2ed2ec93 authored by David Byers's avatar David Byers
Browse files

Support send-comments-to

Hopefully better support for language selection
Minor code cleanup
parent b719e906
2002-04-21 David Byers <david.byers@swipnet.se>
* lyskom-buttons.el (lyskom-make-button-menu): Temporarily bind
lyskom-language to lyskom-global-language to avoid changing
language in the popup menu.
* check-strings.el (lcs-check-language-vars): New function.
(lyskom-check-strings): Check for missing language-specific
variables.
* english-strings.el: Added lyskom-unread-title-format
and lyskom-unread-mode-line.
Better default language selection:
* option-edit.el (lyskom-mark-association): Changed help-echo to
default-help-echo.
(lyskom-name): Same here.
(lyskom-command): Same here.
* lyskom-rest.el (lyskom-is-loaded): Get default language from
environment variables KOMLANGUAGE or LANG, if they are set and
kom-default-language was not. Otherwise
(lyskom-language-from-environment): New function.
* language.el (lyskom-define-language): Don't set language here.
It will be set in lyskom-rest.el.
Better language switching:
* startup.el (kom-start-anew): Pass scope parameter to
lyskom-set-language.
* commands2.el (kom-change-language): Pass scope parameter to
lyskom-set-language.
* language.el (lyskom-language-strings): Added SCOPE parameter.
(lyskom-get-string-internal): Honor scope in
lyskom-language-strings.
(lyskom-language-var): Added SCOPE parameter.
(lyskom-set-language-vars): Added SCOPE parameter. Honor scope
when setting language-specific variables.
* vars.el.in (lyskom-language): Made this setting buffer-local
again.
Cleanup mapcars and macro definitions:
* language.el (lyskom-set-language-vars): Removed function before
lambda.
(lyskom-set-language-keymaps): Same here.
(lyskom-get-strings): Same here.
(lyskom-string-check-category): Same here.
(lyskom-language-var): Use backquote for macro definition.
(lyskom-language-keymap): Ditto.
(lyskom-language-strings): Ditto.
2002-04-20 Per Cederqvist <ceder@ceder.dyndns.org>
Implemented "View diff"/"Se diff":
......@@ -8,13 +62,49 @@
* swedish-strings.el (lyskom-command): Added kom-diff-texts.
(lyskom-help-strings): Ditto.
* english-strings.el (lyskom-command): Added kom-diff-texts.
* compatibility.el (make-temp-file): Provide it if it is missing.
2002-04-20 David Byers <david.byers@swipnet.se>
Support context-sensitive error reporting:
* vars.el.in (lyskom-error-codes): New variable.
* lyskom-rest.el (lyskom-insert-error): Added error-descriptions
parameter for context-sensitive error reporting.
(lyskom-report-command-answer): Added error-descriptions
parameter.
(lyskom-get-error-text): Added error-descriptions parameter.
Fix bug 467:
* lyskom-rest.el (lyskom-prot-a-format-aux-item-flags): Rename
reserved1 to dont-garb as per the specification.
* komtypes.el (aux-item-flags): Renamed reserved1 field to
dont-garb, as per the specification.
* english-strings.el, swedish-strings.el: Changed aux-item flag
"reserved1" to "dont-garb".
Support send-comments-to:
* commands2.el (kom-redirect-comments): New command.
* edit-text.el (lyskom-edit-send-check-recipients): Completely
rewrite checking of commented author.
Clean up the code:
* lyskom-rest.el (lyskom-prot-a-format-misc-item): Changed case of
all pseudo misc-info types to UPPERCASE to match real misc-infos.
* edit-text.el: Changed case of all pseudo misc-info types to
UPPERCASE to match real misc-infos. Changed explicit lists of
recipient types to lyskom-recpt-types-list.
* All files: Changed case of all pseudo misc-info types to
UPPERCASE to match real misc-infos.
Move binding of 'a' to 'x' in the swedish keymaps:
* commands2.el (kom-obsolete-extended-command-binding): New
command. Note that this command is temporary and will only ever be
......@@ -385,6 +475,7 @@
--with-default-language.
2002-03-24 Joel Rosdahl <joel@lysator.liu.se>
* Release of 0.46.2-BETA-2 (approximately: there was originally no
ChangeLog entry for this release). This entry was added after the
fact by David Byers.
......
......@@ -634,6 +634,15 @@ return non-nil if the item is to be included in the list."
(lyskom-format 'creating-software-aux (aux-item->data item))
(lyskom-aux-item-terminating-button item obj))))
(defun lyskom-print-send-comments-to (item &optional obj)
(when (string-match "^\\([0-9]+\\)" (aux-item->data item))
(let ((conf-no (string-to-int (match-string 1 (aux-item->data item)))))
(lyskom-format-insert 'status-send-comments-to
conf-no
(lyskom-aux-item-terminating-button item obj)))))
(defun lyskom-parse-world-readable ()
(and (looking-at (regexp-quote
(lyskom-get-string 'world-readable-text-edit-aux)))
......
......@@ -36,6 +36,7 @@
(lcs-setup-message-buffer))
(lcs-message t "Checking variables")
(lcs-check-language-vars)
(lcs-check-lyskom-commands (mapcar 'car
(lcs-all-category-string
'lyskom-command)))
......@@ -44,7 +45,7 @@
(lcs-check-key-bindings (mapcar 'car (lcs-all-category-string
'lyskom-command))
'lyskom-mode-map)
(mapcar 'lcs-check-category lyskom-language-categories)
(mapcar (lambda (x) (lcs-check-category (car x))) lyskom-language-categories)
(lcs-message t "Checking customizeable variables")
(lcs-check-customize-variables)
......@@ -55,6 +56,22 @@
(or noninteractive
(display-buffer lcs-message-buffer)))
(defun lcs-check-language-vars ()
"Check that all language-specific variables exist in all languages"
(mapcar (lambda (var)
(setq var (car var))
(let ((missing
(delq nil
(mapcar
(lambda (lang)
(setq lang (car lang))
(unless (assq lang (get var 'lyskom-language-var))
lang))
lyskom-languages))))
(when missing
(lcs-message nil "(%s) Missing languages: %s" var missing))))
lyskom-language-vars))
(defun lcs-check-lyskom-commands (commands)
"Check the lyskom-commands variable"
(let ((tmp (copy-sequence lyskom-commands)))
......
......@@ -415,14 +415,14 @@ as TYPE. If no such misc-info, return NIL"
nil)))
(if (= tono lyskom-pers-no)
(lyskom-edit-text lyskom-proc
(lyskom-create-misc-list 'recpt tono)
(lyskom-create-misc-list 'RECPT tono)
"" "")
(lyskom-edit-text lyskom-proc
(if (lyskom-get-membership tono)
(lyskom-create-misc-list 'recpt tono)
(lyskom-create-misc-list 'RECPT tono)
(lyskom-create-misc-list
'recpt tono
'recpt lyskom-pers-no))
'RECPT tono
'RECPT lyskom-pers-no))
"" "")))))
(quit (signal 'quit nil))))
......@@ -856,7 +856,7 @@ This does lyskom-end-of-command"
(if conf
(lyskom-dispatch-edit-text lyskom-proc
(lyskom-create-misc-list
'recpt
'RECPT
(server-info->conf-pres-conf
lyskom-server-info))
conf-name ""
......@@ -1057,8 +1057,8 @@ BCCREP is a list of all recipient that are going to be bcc-recipients."
(let* ((member nil)
(recver (lyskom-create-misc-list
(cond
((eq type 'comment) 'comm-to)
((eq type 'footnote) 'footn-to)
((eq type 'comment) 'COMM-TO)
((eq type 'footnote) 'FOOTN-TO)
(t (signal 'lyskom-internal-error
(list "Unknown comment type" type))))
(text-stat->text-no text-stat)))
......@@ -1075,9 +1075,9 @@ BCCREP is a list of all recipient that are going to be bcc-recipients."
(append recver
(list
(cons (cond
((memq confno ccrep) 'cc-recpt)
((memq confno bccrep) 'bcc-recpt)
(t 'recpt))
((memq confno ccrep) 'CC-RECPT)
((memq confno bccrep) 'BCC-RECPT)
(t 'RECPT))
commno))))
(if (lyskom-get-membership commno)
(setq member t))
......@@ -1087,7 +1087,7 @@ BCCREP is a list of all recipient that are going to be bcc-recipients."
;; any of the recipients.
(when (not member)
(setq recver (append recver
(list (cons 'recpt lyskom-pers-no)))))
(list (cons 'RECPT lyskom-pers-no)))))
(lyskom-edit-text lyskom-proc
recver
subject "")))
......@@ -1154,12 +1154,12 @@ that text instead."
(lyskom-edit-text lyskom-proc
(if (= (text-stat->author text-stat) lyskom-pers-no)
(lyskom-create-misc-list
'recpt
'RECPT
(text-stat->author text-stat))
(lyskom-create-misc-list
'comm-to (text-stat->text-no text-stat)
'recpt (text-stat->author text-stat)
'recpt lyskom-pers-no))
'COMM-TO (text-stat->text-no text-stat)
'RECPT (text-stat->author text-stat)
'RECPT lyskom-pers-no))
subject ""))))))
......@@ -1301,9 +1301,9 @@ TYPE is either 'pres or 'motd, depending on what should be changed."
(append
(lyskom-get-recipients-from-misc-list
(text-stat->misc-info-list text-stat))
(list 'comm-to
(list 'COMM-TO
(conf-stat->presentation conf-stat)))
(list 'recpt
(list 'RECPT
(cond
((eq type 'motd)
(server-info->motd-conf lyskom-server-info))
......@@ -1602,7 +1602,7 @@ Args: CONF-STAT MEMBERSHIP"
(lyskom-insert-string 'no-in-conf)
(lyskom-tell-internat 'kom-tell-write-text)
(lyskom-edit-text lyskom-proc
(lyskom-create-misc-list 'recpt
(lyskom-create-misc-list 'RECPT
recpt)
"" ""))))
......@@ -3610,7 +3610,7 @@ footnotes) to it as read in the server."
'lyskom-last-added-rcpt
'who-to-add-q
'adding-name-as-recipient
'recpt))
'RECPT))
(def-kom-command kom-add-copy (text-no)
"Add a recipient to a text."
......@@ -3619,7 +3619,7 @@ footnotes) to it as read in the server."
'lyskom-last-added-ccrcpt
'who-to-add-copy-q
'adding-name-as-copy
'cc-recpt))
'CC-RECPT))
(def-kom-command kom-add-bcc (text-no)
"Add a recipient to a text."
......@@ -3628,7 +3628,7 @@ footnotes) to it as read in the server."
'lyskom-last-added-bccrcpt
'who-to-add-bcc-q
'adding-name-as-copy
'bcc-recpt))
'BCC-RECPT))
(defun lyskom-add-helper (text-no last-variable who-prompt doing-prompt type)
(let* ((conf (blocking-do 'get-conf-stat (lyskom-default-value last-variable)))
......@@ -3641,11 +3641,11 @@ footnotes) to it as read in the server."
(when (and target text-no)
(when (and (eq type 'recpt)
(when (and (eq type 'RECPT)
kom-confirm-add-recipients
(not (lyskom-j-or-n-p (lyskom-format 'really-add-as-recpt-q
target))))
(setq type 'cc-recpt
(setq type 'CC-RECPT
doing-prompt 'adding-name-as-copy))
(lyskom-set-default last-variable (conf-stat->conf-no target))
......@@ -3722,7 +3722,7 @@ The value of RECIPIENTS should be the result of a call to
(lyskom-format-insert 'moving-name source target text-stat)
(lyskom-set-default 'lyskom-last-added-rcpt (conf-stat->conf-no target))
(lyskom-set-default 'lyskom-last-sub-rcpt (conf-stat->conf-no source))
(lyskom-move-recipient text-no source target 'recpt)))))
(lyskom-move-recipient text-no source target 'RECPT)))))
(lyskom-format-insert 'no-such-text-no text-no))))
......
......@@ -2024,7 +2024,8 @@ Return-value: 'no-session if there is no suitable session to switch to
nil
'lyskom-language-history)))
(when (lyskom-string-assoc language table)
(lyskom-set-language (cdr (lyskom-string-assoc language table))))))
(lyskom-set-language (cdr (lyskom-string-assoc language table))
'local))))
......@@ -2838,6 +2839,46 @@ to the first text that NEW is a comment or footnote to."
(list aux-item)))))
;;; ================================================================
;;; Add send-comments-to
;;;
(def-kom-command kom-redirect-comments ()
"Add extended information to your letterbox that causes some other
conference to be added as a recipient to comments to your texts when
someone posts them in a conference you are not a member of.
Note that this functionality depends on the client. Not all clients
will honor this redirection."
(interactive)
(let* ((conf-stat (lyskom-read-conf-stat 'redirect-for-whom
'(pers) nil nil t))
(redirect-to (lyskom-read-conf-stat 'redirect-to-which-conf
'(pers conf) nil nil t))
(old-redirect (car (lyskom-get-aux-item
(conf-stat->aux-items conf-stat)
33))))
(lyskom-format-insert 'redirecting-comments-to
conf-stat redirect-to old-redirect)
(lyskom-report-command-answer
(blocking-do 'modify-conf-info
(conf-stat->conf-no conf-stat)
(and old-redirect (list (aux-item->aux-no old-redirect)))
(list (lyskom-create-aux-item
0
33
nil nil
(lyskom-create-aux-item-flags
nil nil nil nil
nil nil nil nil)
0
(format "%d" (conf-stat->conf-no redirect-to)))))
nil
'((illegal-aux-item . kom-redirect-comments-e48)
(aux-item-permission . kom-redirect-comments-e48))))
)
;;; ================================================================
;;; Temporary function for when we moved kom-extended-command from a
;;; to x.
......
......@@ -598,6 +598,14 @@ Otherwise treat \\ in NEWTEXT string as special:
"Dummy function that raises an error."
(error "w32-shell-execute undefined"))
;; This code looks the way it does in order to avoid warnings in
;; Emacs 21.
(eval-and-compile
(condition-case nil
(symbol-value ':default-help-echo)
(error (set ':default-help-echo ':default-help-echo))))
;;; Local Variables:
;;; eval: (put 'lyskom-provide-macro 'lisp-indent-hook 2)
......
This diff is collapsed.
......@@ -153,7 +153,7 @@
(lyskom-language-ending-mismatch lyskom-message newyeareve en sv)
;;; Formely known as lyskom-strings
(lyskom-language-strings lyskom-message en
(lyskom-language-strings local lyskom-message en
'(
; From vars.el:
; From komtypes.el: nil
......@@ -521,7 +521,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(comment-keep-recpt-p ."Should %#1s remain a recipient? ")
(comment-all-relevant-p . "There are multiple recipients. Are they all relevant? ")
(please-edit-recipients . "Modify the recipient list and send the text again.")
(add-recipient-p . "Add recipient %#1P? ")
(add-recipient-p . "Add recipient%#2?b%[ %#2M to reach%]%[%] %#1P? ")
(checking-rcpt . "Checking recipients...")
(checking-rcpt-done . "Checking recipients...done")
(checking-comments . "Checking commented texts...")
......@@ -603,6 +603,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(recommended-conf-aux . "Recommended conference: %#1M <%#1m> %#2s\n")
(status-read-faq-aux-item . "Read FAQ: %15#2n for %#1?z%[%#1M <%#1m>%]%[the server%] %#3s\n")
(status-rejected-recommendation-aux-item . "Rejected recommendation for: %#1M %#2s\n")
(status-send-comments-to . "Redirect comments to: %#1M <%#1m> %#2s\n")
(Everybody . "Everyone")
(show-members-list-also-q . "List members? ")
......@@ -1112,8 +1113,8 @@ You should set it to a better value.\n")
(prompt-several-messages . "(%d messages)")
(prompt-single-message . "(%d message)")
(re-edit-text-prompt . "Edit the text that couldn't be created")
(text-buffer-missing . "The text buffer no longer exists.\n")
(re-edit-text-prompt . "Edit the text that couldn't be created")
(go-to-pri-conf-prompt . "Go to next prioritized conference")
(read-pri-text-conf . "Read next prioritized text")
(review-next-text-prompt . "Review next text")
......@@ -1489,7 +1490,7 @@ Contents: \"%#9s\"
(which-aux-item-inherit . "Set the inherit-flag? ")
(which-aux-item-secret . "Set the secret-flag? ")
(which-aux-item-anonymous . "Set the anonymous-flag? ")
(which-aux-item-rsv1 . "Set the reserved1-flag? ")
(which-aux-item-rsv1 . "Set the dont-garb-flag? ")
(which-aux-item-rsv2 . "Set the reserved2-flag? ")
(which-aux-item-rsv3 . "Set the reserved3-flag? ")
(which-aux-item-rsv4 . "Set the reserved4-flag? ")
......@@ -1682,10 +1683,17 @@ Number of sessions: %21#1d (total)
(has-recommended-conf . "%#1P has recommended conference %#2M. Do you want to become a member?\n")
(accept-recommendation . "Join conference %#1M? ")
(accepting-recommendataion . "Joining recommended conference %#1M...")
(redirect-for-whom . "Redirect comments for whom: ")
(redirect-to-which-conf . "Redirect comments to: ")
(redirecting-comments-to . "Redirecting comments for %#1P to %#2M%#3?b%[ (old %#1M)%]%[%]...")
(kom-redirect-comments-e49 . "You do not have permission to perform this redirection")
(kom-redirect-comments-e48 . "Comment redirection is not supported by the server")
))
(lyskom-language-var lyskom-month-names en
(lyskom-language-var local lyskom-month-names en
'(("jan" . 1) ("january" . 1)
("feb" . 2) ("february" . 2)
("mar" . 3) ("march" . 3)
......@@ -1705,7 +1713,7 @@ Number of sessions: %21#1d (total)
;;; Formely known as lyskom-commands
(lyskom-language-strings lyskom-command en
(lyskom-language-strings local lyskom-command en
'(
(kom-help . "Help")
(kom-slow-mode . "Long commands")
......@@ -1883,9 +1891,10 @@ Number of sessions: %21#1d (total)
(kom-review-server-faq . "Review server FAQ")
(kom-change-server-faq . "Change server FAQ")
(kom-recommend-conference . "Recommend cnoference")
(kom-redirect-comments . "Redirect comments")
))
(lyskom-language-var lyskom-language-codes en
(lyskom-language-var global lyskom-language-codes en
'((aa . "Afar")
(ab . "Abkhazian")
(af . "Afrikaans")
......@@ -2027,7 +2036,7 @@ Number of sessions: %21#1d (total)
(zu . "Zulu")
(-- . "Unknown language (%#1s)")))
(lyskom-language-strings lyskom-menu en
(lyskom-language-strings global lyskom-menu en
'((lyskom . "LysKOM")
(read . "Read")
(dont-read . "Jump")
......@@ -2061,13 +2070,13 @@ Number of sessions: %21#1d (total)
;;(defvar lyskom-swascii-commands nil
;; "The swascii-versions of lyskom-commands.")
(lyskom-language-var lyskom-onoff-table en
(lyskom-language-var local lyskom-onoff-table en
'(("on" . on) ("off" . off)))
(lyskom-language-var lyskom-filter-predicate-list en
(lyskom-language-var local lyskom-filter-predicate-list en
'(("=" . nil) ("!=" . t)))
(lyskom-language-var lyskom-filter-what en
(lyskom-language-var local lyskom-filter-what en
'((author . "Author")
(author-no . "Author (number)")
(author-re . "Author (regexp)")
......@@ -2079,7 +2088,7 @@ Number of sessions: %21#1d (total)
(text . "Contents")
(text . "Contents (regexp)")))
(lyskom-language-var lyskom-filter-actions en
(lyskom-language-var local lyskom-filter-actions en
'((skip-text . "Skip")
(dontshow . "Don't show")
(read . "Exclude from filter")
......@@ -2345,9 +2354,9 @@ Number of sessions: %21#1d (total)
(define-key lyskom-en-prioritize-mode-map "\M-\C-i" 'kom-previous-link)
)
(lyskom-language-var lyskom-prioritize-header-lines en 2)
(lyskom-language-var local lyskom-prioritize-header-lines en 2)
(lyskom-language-var lyskom-prioritize-header en
(lyskom-language-var local lyskom-prioritize-header en
" Prio Conference
-----------------------------------------------------------------------------
")
......@@ -2384,7 +2393,7 @@ Number of sessions: %21#1d (total)
(define-key lyskom-en-customize-map (kbd "?") 'lyskom-customize-help)
)
(lyskom-language-strings lyskom-custom-strings en
(lyskom-language-strings local lyskom-custom-strings en
'(
;;
;; Widget strings
......@@ -3624,14 +3633,14 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
;;;; yet. People who know how to use it are smart enough to do it
;;;; right.
(lyskom-language-var kom-ansaphone-default-reply en
(lyskom-language-var local kom-ansaphone-default-reply en
"I am not reading LysKOM right now. Please write a letter instead.")
;;;; ============================================================
;;;; Other language-dependent variables
;;;;
(lyskom-language-var kom-ispell-dictionary en
(lyskom-language-var local kom-ispell-dictionary en
"english")
......@@ -3653,7 +3662,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(eval-when-compile (defvar kom-tell-phrases))
(lyskom-language-strings kom-tell-phrases en
(lyskom-language-strings local kom-tell-phrases en
'((kom-tell-silence . "") ; Why ?
(kom-tell-send . "Is trying to post a text.")
(kom-tell-login . "Is entering LysKOM.")
......@@ -3675,7 +3684,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(if (and (boundp 'kom-tell-phrases)
kom-tell-phrases)
(lyskom-language-strings kom-tell-phrases en
(lyskom-language-strings local kom-tell-phrases en
(mapcar (function
(lambda (x)
(cond ((and (consp x)
......@@ -3693,11 +3702,11 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
;; Placed here because this must NOT be evaluated before
;; kom-tell-phrases is defined:
(lyskom-language-var kom-mercial en (lyskom-get-string 'kom-tell-wait
(lyskom-language-var local kom-mercial en (lyskom-get-string 'kom-tell-wait
'kom-tell-phrases))
(lyskom-language-strings lyskom-error-texts en
(lyskom-language-strings local lyskom-error-texts en
'((error-0 . "No error")
(error-2 . "Not yet implemented")
(error-3 . "No longer implemented")
......@@ -3754,8 +3763,13 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(error-54 . "Invalid membership type")
))
(lyskom-language-var global lyskom-unread-mode-line en
(lyskom-make-lyskom-unread-mode-line))
(lyskom-language-var global lyskom-unread-title-format en
(lyskom-make-lyskom-unread-title-format))
(provide 'lyskom-strings)
;;; english-strings ends here
......@@ -307,8 +307,8 @@ The text to add is passed in TEXT-NO"
(if (and text-stat text-mass)
(append (lyskom-get-recipients-from-misc-list
(text-stat->misc-info-list text-stat))
(list 'comm-to (text-stat->text-no text-stat)))
(list 'recpt (conf-stat->conf-no conf-stat))))
(list 'COMM-TO (text-stat->text-no text-stat)))
(list 'RECPT (conf-stat->conf-no conf-stat))))
subject
body
'lyskom-change-faq-2
......
......@@ -673,7 +673,7 @@ Both vectors should be of the same length."
;;; aux-item
(def-komtype aux-item-flags deleted inherit secret anonymous
reserved1 reserved2 reserved3 reserved4)
dont-garb reserved2 reserved3 reserved4)
(def-komtype aux-item aux-no
tag
......
......@@ -44,38 +44,49 @@ Each entry is a pair (SYMBOL . (NAME NAME ...)) where symbol is the symbol
used for identification, and the NAMEs are names of the language.")
(defvar lyskom-language-categories nil
"Categories of language-specific variables.")
"Categories of language-specific variables.
Each element is a cons cell (NAME . SCOPE), where NAME is the name of
the category and SCOPE is its scope (global or local).")
(defvar lyskom-language-vars nil
"A list of all language-dependent variables.")
"A list of all language-dependent variables.
Each element is a cons cell (NAME . SCOPE), where NAME is the name of
the category and SCOPE is its scope (global or local).")
(defun lyskom-language-var-internal (var language val)
(defun lyskom-language-var-internal (scope var language val)
"Defines a language-local variable value."
(or (memq var lyskom-language-vars)
(or (assq var lyskom-language-vars)
(setq lyskom-language-vars
(cons var lyskom-language-vars