Commit def7a32c authored by David Byers's avatar David Byers
Browse files

Fixed bugs 562, 531, 529, 532, 530 and one with color creation on ttys.

parent 78131dbb
2002-05-22 David Byers <>
* utilities.el (lyskom-get-color-highlight): Handle the case of
the color parameter being nil.
2002-05-21 David Byers <>
Fix bug 561:
* lyskom-rest.el (lyskom-get-error-text): Renamed call to
* 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): 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
* 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 <>
Bug 516:
......@@ -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))
(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))
(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))
(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))
(lcs-message nil "(%s:%s) No doc string"
......@@ -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
......@@ -2926,3 +2926,11 @@ Tryck p
(lyskom-format "%#1@Tryck return eller enter fr 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"
(lyskom-insert-before-prompt "Kommandot \"Vilka (r inloggade i) mte\" r flyttat till v m\n"))
......@@ -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")
......@@ -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)
......@@ -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
(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)
(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
......@@ -256,8 +256,8 @@ lyskom-define-language."
Looks for the 'lyskom-menu category, or 'lyskom-command
if 'lyskom-menu is not found."
(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))
......@@ -132,9 +132,9 @@
(if custom-error
(lyskom-get-string custom-error)
(lyskom-get-string-internal (intern (concat "error-"
(number-to-string errno)))
(lyskom-try-get-string (intern (concat "error-"
(number-to-string errno)))
(lyskom-format 'error-not-found errno)))))
(defun lyskom-report-command-answer (answer &optional errno error-descriptions)
......@@ -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-custom-string 'unknown-command)
(symbol-name value))))))))
......@@ -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.
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-call kom-queue lyskom-ref-no handler data-list 'lyskom-parse-map)
......@@ -266,7 +266,7 @@ Guran vill helst s
(who-to-add . "Vem vill du addera? ")
(where-to-add . "Vilket mte skall han/hon adderas till? ")
(where-to-add-self . "Vilket mte vill du bli medlem i? ")
(priority-q . "Prioritet p mtet? (0 (passivt medlemskap), 1 (lg) - 255 (hg)) ")
(priority-q . "Prioritet p ditt medlemskap i mtet? (0 (lg) - 255 (hg)) ")
(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)
......@@ -1444,6 +1444,39 @@ in the 20th century")
;;; ================================================================
;;; 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)
;;; ================================================================
;;; 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)
......@@ -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
(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
(min kom-truncate-show-lines
(unless (eq truncated-body body)
(setq body truncated-body
truncated t))))
(let ((lyskom-current-function-phase 'body))
(lyskom-format-insert "%#2$%#1t\n"
Supports Markdown
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