diff --git a/src/ChangeLog b/src/ChangeLog index 6ede1b8823d7f819b8960cc1af9b5439164a2007..9219b42ec6c7160f3d72dc02ccac1a99ca2d4449 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,51 @@ +2002-05-22 David Byers <david.byers@swipnet.se> + + * utilities.el (lyskom-get-color-highlight): Handle the case of + the color parameter being nil. + +2002-05-21 David Byers <david.byers@swipnet.se> + + Fix bug 561: + * lyskom-rest.el (lyskom-get-error-text): Renamed call to + lyskom-get-string-internal. + + * check-strings.el (lcs-check-customize-variables): Renamed call + to lyskom-get-string-internal. + + * option-edit.el (lyskom-widget-command-value-create): Use + lyskom-try-get-string instead of lyskom-get-string-internal. + + * language.el (lyskom-try-get-string): Renamed from + lyskom-get-string-internal. + (lyskom-get-string): Renamed call to lyskom-get-string-internal. + (lyskom-get-string-sol): Same. + (lyskom-get-menu-string): Same. + + Fix bug 531: + * view-text.el (lyskom-print-text): Use lyskom-truncate-to-lines + so we can take the setting of truncate-lines into account. Check + truncation settings using numberp. + + * utilities.el (lyskom-truncate-to-lines): New function. + + Fix bug 529: + * commands2.el (kom-obsolete-who-is-on-in-conference): New + function. + + * swedish-strings.el (lyskom-sv-mode-map): Added key binding lv. + + Fix bug 566: + * services.el (initiate-get-map): Updated docstring. + + Fix bug 532: + * swedish-strings.el,english-strings.el (lyskom-messages): Removed + information about passive memberships by priority (it doesn't work + that way now). Changed wording of priority-q. + + Fix bug 530: + * commands1.el (kom-move-text-tree): Fix bug that caused only + every other text to be moved. + 2002-05-08 David Byers <david.byers@swipnet.se> Bug 516: diff --git a/src/check-strings.el b/src/check-strings.el index 2d788af5319f19b9e14aaab4d258169524d1f693..6a9aec5d16cfe4c4b2d5e28de7b2edc0e09b1e0d 100644 --- a/src/check-strings.el +++ b/src/check-strings.el @@ -273,11 +273,11 @@ Check that all server-stored variables are customizeable." (if (memq var cust-vars-in-buffer) (lcs-message nil "(%s:%s) Variable declared as missing in custom buffer." 'lyskom-custom-variables var)) - (if (lyskom-get-string-internal (intern (format "%s-tag" var)) + (if (lyskom-try-get-string (intern (format "%s-tag" var)) 'Lyskom-custom-strings) (lcs-message nil "(%s:%s) Tag string for variable declared as missing." 'lyskom-custom-strings var)) - (if (lyskom-get-string-internal (intern (format "%s-doc" var)) + (if (lyskom-try-get-string (intern (format "%s-doc" var)) 'lyskom-custom-strings) (lcs-message nil "(%s:%s) Doc string for variable declared as missing." 'lyskom-custom-strings var))) @@ -287,12 +287,12 @@ Check that all server-stored variables are customizeable." ((not (memq var cust-vars-in-buffer)) (lcs-message nil "(%s:%s) Variable not in customize buffer." 'lyskom-customize-buffer-format var)) - (t (unless (lyskom-get-string-internal + (t (unless (lyskom-try-get-string (intern (format "%s-tag" var)) 'lyskom-custom-strings) (lcs-message nil "(%s:%s) No tag string" 'lyskom-custom-strings var)) - (unless (lyskom-get-string-internal + (unless (lyskom-try-get-string (intern (format "%s-doc" var)) 'lyskom-custom-strings) (lcs-message nil "(%s:%s) No doc string" diff --git a/src/commands1.el b/src/commands1.el index f9f55152b5f6a9ab19890f718bb4696dcb42cf4a..df4bfb8e46940cb906761fc2cf9b4dc1c8c83f9a 100644 --- a/src/commands1.el +++ b/src/commands1.el @@ -3813,7 +3813,7 @@ recipient to remove and target the recipient to add to text-stat." ;; Use memoing to ensure that we don't loop. (unless (memq text-to-move done) - (setq done (cons (car to-do) done)) + (setq done (cons text-to-move done)) ;; Check that the text has the source as a ;; recipient. If not, skip to the next in the diff --git a/src/commands2.el b/src/commands2.el index f04d5aa64f8704a0619ebb7854133b59e8786768..879c7a37cac430596d75bfcc2d3384dbc5fed587 100644 --- a/src/commands2.el +++ b/src/commands2.el @@ -2926,3 +2926,11 @@ Tryck p (ding)) (read-from-minibuffer (lyskom-format "%#1@Tryck return eller enter f�r att g� vidare: " '(face kom-warning-face)))) + + +(defun kom-obsolete-who-is-on-in-conference () + "Temporary function for when we moved kom-who-is-on-in-conference from l v to +v m" + (interactive) + (lyskom-insert-before-prompt "Kommandot \"Vilka (�r inloggade i) m�te\" �r flyttat till v m\n")) + diff --git a/src/english-strings.el b/src/english-strings.el index 913c55f4ef4fc1588593aed2b89a2164c86fe75a..310d9a33d3ed0bc342b76438badba8cbcc78140b 100644 --- a/src/english-strings.el +++ b/src/english-strings.el @@ -292,7 +292,7 @@ Be ashamed of being You! You have a very good reason.\n\n") (who-to-add . "Whom do you want to add? ") (where-to-add . "To which conference? ") (where-to-add-self . "Join which conference? ") - (priority-q . "Conference priority? (0 (passive membership), 1 (low) - 255 (high)) ") + (priority-q . "Priority of your membership? (0 (low) - 255 (high)) ") (done . "done.\n") (cancelled . "cancelled.\n") (nope . "didn't work.\n") diff --git a/src/language.el b/src/language.el index 63a0e5c0d99776f28fb55058908becd5ab1ead3b..db720051c5fd0513e6a28500eeb6bbef93022d5e 100644 --- a/src/language.el +++ b/src/language.el @@ -210,7 +210,7 @@ assoc list." (lyskom-internal-error (message "Bad kom-tell-phrases: missing %s" key) ""))) -(defsubst lyskom-get-string-internal (symbol category) +(defsubst lyskom-try-get-string (symbol category) (cdr (assq (if (eq (cdr (assq category lyskom-language-categories)) 'local) lyskom-language lyskom-global-language) @@ -222,7 +222,7 @@ assoc list." (defun lyskom-get-string (symbol &optional category) "Returns string associated with SYMBOL" - (or (lyskom-get-string-internal symbol (or category 'lyskom-message)) + (or (lyskom-try-get-string symbol (or category 'lyskom-message)) (lyskom-get-string-error 'lyskom-get-string symbol (or category 'lyskom-message)))) @@ -231,10 +231,10 @@ assoc list." "Returns string associated with SYMBOL If kom-long-lines is set, return the long form of the string, if it exists." (or (and kom-long-lines - (lyskom-get-string-internal (intern (concat (symbol-name symbol) + (lyskom-try-get-string (intern (concat (symbol-name symbol) "-long")) (or category 'lyskom-message))) - (lyskom-get-string-internal symbol + (lyskom-try-get-string symbol (or category 'lyskom-message)) (lyskom-get-string-error 'lyskom-get-string symbol @@ -256,8 +256,8 @@ lyskom-define-language." Looks for the 'lyskom-menu category, or 'lyskom-command if 'lyskom-menu is not found." (encode-coding-string - (or (lyskom-get-string-internal symbol 'lyskom-menu) - (lyskom-get-string-internal symbol 'lyskom-command) + (or (lyskom-try-get-string symbol 'lyskom-menu) + (lyskom-try-get-string symbol 'lyskom-command) (lyskom-get-string-error 'lyskom-get-menu-string symbol 'lyskom-menu)) 'iso-8859-1)) diff --git a/src/lyskom-rest.el b/src/lyskom-rest.el index 354f7be66fd4f51f5805b9bc8160453538ef822f..9f251a693ec768a4a469b3980b1265f0efd6af3d 100644 --- a/src/lyskom-rest.el +++ b/src/lyskom-rest.el @@ -132,9 +132,9 @@ (if custom-error (lyskom-get-string custom-error) (or - (lyskom-get-string-internal (intern (concat "error-" - (number-to-string errno))) - 'lyskom-error-texts) + (lyskom-try-get-string (intern (concat "error-" + (number-to-string errno))) + 'lyskom-error-texts) (lyskom-format 'error-not-found errno))))) (defun lyskom-report-command-answer (answer &optional errno error-descriptions) diff --git a/src/option-edit.el b/src/option-edit.el index e9a8c21fd4f2d7619b70ececed19f4922ae9ffe9..30441238be76d73aaa74a37ab903c3c7e15eb6cc 100644 --- a/src/option-edit.el +++ b/src/option-edit.el @@ -1353,7 +1353,7 @@ customize buffer but do not save them to the server." (string (save-excursion (set-buffer lyskom-buffer) (cond ((null value) "") - (t (or (lyskom-get-string value 'lyskom-command) + (t (or (lyskom-try-get-string value 'lyskom-command) (lyskom-format (lyskom-custom-string 'unknown-command) (symbol-name value)))))))) diff --git a/src/services.el b/src/services.el index 5513819d7ee34492a55b5724356289ac57aeac17..cec620699e46d3067151c72853408f09f473d993 100644 --- a/src/services.el +++ b/src/services.el @@ -520,7 +520,7 @@ Args: KOM-QUEUE HANDLER COMMENT-TEXT-NO TEXT-NO &rest DATA." no-of-texts &rest data-list) "Get mapping from local to global text-nos for CONF-NO from server. Args: KOM-QUEUE HANDLER CONF-NO FIRST-LOCAL NO-OF-TEXTS DATA-LIST. -Use initiate-get-map instead. This function has severe performance losses +Use z-initiate-get-map instead. This function has severe performance losses with big maps." (lyskom-server-call (lyskom-call kom-queue lyskom-ref-no handler data-list 'lyskom-parse-map) diff --git a/src/swedish-strings.el b/src/swedish-strings.el index b67de27f2e132d0e8931b6da8e7d283c45da4758..a599b5efd21d28d40f5fcb46c4d56011914a26fa 100644 --- a/src/swedish-strings.el +++ b/src/swedish-strings.el @@ -266,7 +266,7 @@ Guran vill helst s (who-to-add . "Vem vill du addera? ") (where-to-add . "Vilket m�te skall han/hon adderas till? ") (where-to-add-self . "Vilket m�te vill du bli medlem i? ") - (priority-q . "Prioritet p� m�tet? (0 (passivt medlemskap), 1 (l�g) - 255 (h�g)) ") + (priority-q . "Prioritet p� ditt medlemskap i m�tet? (0 (l�g) - 255 (h�g)) ") (done . "klart.\n") (cancelled . "avbrutet.\n") (nope . "det gick inte.\n") @@ -2625,6 +2625,7 @@ Visar vilka som f (define-key lyskom-sv-mode-map (kbd "e") 'kom-set-unread) (define-key lyskom-sv-mode-map (kbd "a") 'kom-obsolete-extended-command-binding) + (define-key lyskom-sv-mode-map (kbd "l v") 'kom-obsolete-who-is-on-in-conference) (define-key lyskom-sv-mode-map (kbd "x") 'kom-extended-command) (define-key lyskom-sv-mode-map (kbd "<SPC>") 'kom-next-command) (define-key lyskom-sv-mode-map (kbd "<RET>") 'kom-line-next-command) diff --git a/src/utilities.el b/src/utilities.el index d3ee6150d137d40dde2e0dd458d9e94774846513..aa93af6fe3cd7e34a33e54536066ee5033f7f44c 100644 --- a/src/utilities.el +++ b/src/utilities.el @@ -1444,6 +1444,39 @@ in the 20th century") nil))) +;;; ================================================================ +;;; String truncation +;;; + +(defun lyskom-truncate-to-lines (string threshold show-lines &optional width) + "If STRING is more than THRESHOLD lines on screen, truncate it to SHOW-LINES. +Optional argument WIDTH is thw window width to use instead of window-width. + +This function takes the setting of truncate-lines into account, so +the resulting string may not have SHOW-LINES newline characters. + +Result is eq to STRING when no truncation is required. + +The result is approximate when truncate-lines is non-nil since different +Emacsen use a different number of characters for the continuation marks +at the end of broken lines. We assume one character continuation marks." + (let ((line-length (if truncate-lines lyskom-max-int (- (or width (window-width)) 1))) + (count 0) + (end nil) + (pos 0)) + (while (and (< pos (length string)) (< count threshold)) + (setq count (1+ count)) + (let ((next (string-match "\\(\n\\|\\'\\)" string pos))) + (if (> (- next pos) line-length) + (setq pos (+ pos line-length)) + (setq pos (match-end 0)))) + (when (= count show-lines) + (setq end pos))) + + (if (>= count threshold) + (substring string 0 end) + string))) + ;;; ================================================================ ;;; Color model manipulations @@ -1457,18 +1490,19 @@ COLOR is a list of R G and B components from 0 to 65535. DISTANCE is a non-negative integer no larger than 1.0, that in some way specifies how far away from the original color the new color should be." - (let* ((hls (lyskom-rgb-to-hls (mapcar (lambda (x) (/ x 65535.0)) color))) - (l (elt hls 1))) - (if (> l 0.6) - (setq l (- l distance)) - (setq l (+ l distance))) - (cond ((> l 1.0) (setq l 1.0)) - ((< l 0.0) (setq l 0.0))) - (aset hls 1 l) - - (apply 'format "#%02x%02x%02x" - (mapcar (lambda (c) (round (* 255 c))) - (lyskom-hls-to-rgb hls))))) + (when color + (let* ((hls (lyskom-rgb-to-hls (mapcar (lambda (x) (/ x 65535.0)) color))) + (l (elt hls 1))) + (if (> l 0.6) + (setq l (- l distance)) + (setq l (+ l distance))) + (cond ((> l 1.0) (setq l 1.0)) + ((< l 0.0) (setq l 0.0))) + (aset hls 1 l) + + (apply 'format "#%02x%02x%02x" + (mapcar (lambda (c) (round (* 255 c))) + (lyskom-hls-to-rgb hls)))))) (defun lyskom-string-to-rgb (color) diff --git a/src/view-text.el b/src/view-text.el index d7c9f6a74ca4bf939eda6bf1df23c88e7b3c4763..99ba68b9a786dd9db52c7fc88ee1753595b883bc 100644 --- a/src/view-text.el +++ b/src/view-text.el @@ -869,21 +869,17 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO FLAT-REVIEW." ;; (setq t1 (point-max)) ;; Truncate body if flat-review and long text - (if (and flat-review kom-truncate-show-lines kom-truncate-threshold) - (let ((lines 0) - (pos 0) - (show-lines (min kom-truncate-show-lines - kom-truncate-threshold)) - last-line) - (while (and pos (setq pos (string-match "\n" body pos))) - (setq pos (1+ pos)) - (setq lines (1+ lines)) - (if (= lines show-lines) - (setq last-line (1- pos))) - (if (>= lines kom-truncate-threshold) - (setq body (substring body 0 last-line) - pos nil - truncated t))))) + (when (and flat-review + (numberp kom-truncate-show-lines) + (numberp kom-truncate-threshold)) + (let* ((truncated-body + (lyskom-truncate-to-lines body + kom-truncate-threshold + (min kom-truncate-show-lines + kom-truncate-threshold)))) + (unless (eq truncated-body body) + (setq body truncated-body + truncated t)))) (let ((lyskom-current-function-phase 'body)) (lyskom-format-insert "%#2$%#1t\n"