Commit 4037affd authored by David Byers's avatar David Byers
Browse files

Fixed bug 573.

We can now format floating point numbers as integers
parent b315838b
2002-06-12 David Byers <david.byers@swipnet.se>
Fix bug 573:
* lyskom-rest.el: (lyskom-format-aux-help): Support formatting
floating-point numbers since that's what we'll get when the ints
from the server are too large for Emacs.
(lyskom-format-html): Look at kom-format-html-authors to decide
whether to format HTML or not.
* vars.el.in (kom-format-html-authors): New variable.
* lyskom-rest.el (lyskom-format-html): Only delete first five
characters if we're looking at html:
Fix bug 457:
* aux-items.el (send-comments-to): Changed into to info.
(mx-reject-forward): Added text-name property.
......
......@@ -2660,6 +2660,10 @@ Select whether to execute command or keyboard macro.")
(prompt-for-text-no . "Prompt for text number")
(all-others . "All others")
(some-person . "Person")
(format-html . "Format HTML:")
;;
;; Misc doc strings
;;
......@@ -3566,6 +3570,9 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-edit-hide-add-button-doc . "\
When this is on, an [Add...] button will be shown after the list of
recipients and auxiliary information when writing a new text.")
(kom-format-html-authors-doc . "\
This setting controls which author's HTML messages that the client will
attempt to format.")
;;
......@@ -3741,6 +3748,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-async-highlight-dashed-lines-tag . "Color dashed lines around messages:")
(kom-async-highlight-text-body-tag . "Color message backgrounds:")
(kom-edit-hide-add-button-tag . "Show add button when writing texts:")
(kom-format-html-authors-tag . "Format HTML-messages per author:")
)
)
......
......@@ -1430,9 +1430,10 @@ Deferred insertions are not supported."
((or (= format-letter ?d)
(= format-letter ?o)
(= format-letter ?x))
(setq result (if (integerp arg)
(format (format "%%%c" format-letter)
arg)
(setq result (cond ((integerp arg)
(format (format "%%%c" format-letter) arg))
((and (floatp arg) (= format-letter ?d))
(format "%0.0f" arg))
(signal 'lyskom-internal-error
(list 'lyskom-format
": argument error (expected int)")))))
......@@ -1932,7 +1933,7 @@ Deferred insertions are not supported."
(setq tmp nil))
(setq tmp (cdr tmp)))
result))))
(formatted (and fn (funcall fn text))))
(formatted (and fn (funcall fn text text-stat))))
;; (when (eq t lyskom-last-text-format-flags)
;; (lyskom-signal-reformatted-text
......@@ -1989,39 +1990,22 @@ in lyskom-messages."
(error (lyskom-ignore var)))))
(defun lyskom-format-html (text)
(when (condition-case e (progn (require 'w3) t) (error nil))
(add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text)
(lyskom-signal-reformatted-text 'reformat-html)
(substring text 5)))
;;;(defun lyskom-format-html (text)
;;; (condition-case e (require 'w3) (error nil))
;;; (let ((tmpbuf (lyskom-get-buffer-create 'lyskom-html " lyskom-html" t)))
;;; (unwind-protect
;;; (save-excursion
;;; (set-buffer tmpbuf)
;;; (insert (substring text 5))
;;; (insert " ") ; So we can adjust the extents
;;; (w3-region (point-max) (point-min))
;;; (let ((tmp nil))
;;; (map-extents
;;; (lambda (e x)
;;; (if (zerop (- (extent-start-position e)
;;; (extent-end-position e)))
;;; (set-extent-endpoints e (extent-start-position e)
;;; (1+ (extent-end-position e))))
;;; (progn
;;; (set-extent-property e 'duplicable t)
;;; (set-extent-property e 'replicable t))
;;; nil))
;;; (setq tmp (buffer-string))
;;; (add-text-properties 0 (length tmp) '(end-closed nil) tmp)
;;; tmp)))))
(defun lyskom-format-enriched (text)
(defun lyskom-format-html (text text-stat)
;; Find settings for this author
(let ((author-setting (and text-stat (or (assq (text-stat->author text-stat)
kom-format-html-authors)
(assq t kom-format-html-authors)))))
(when (and (cdr author-setting)
(condition-case e (progn (require 'w3) t) (error nil)))
(add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text)
(lyskom-signal-reformatted-text 'reformat-html)
(if (string-match "^html:" text)
(substring text 5)
text))))
(defun lyskom-format-enriched (text text-stat)
(if (not (fboundp 'format-decode-buffer))
nil
(let ((tmpbuf (lyskom-generate-new-buffer "lyskom-enriched")))
......@@ -2036,7 +2020,7 @@ in lyskom-messages."
)
(kill-buffer tmpbuf)))))
(defun lyskom-format-ö (text)
(defun lyskom-format-ö (text text-stat)
(cond ((string= text "") "")
(t
(save-excursion
......
......@@ -181,6 +181,7 @@
[kom-show-imported-envelope-sender]
[kom-smileys]
[kom-w3-simplify-body]
[kom-format-html-authors]
"\n"
[kom-highlight-first-line]
[kom-highlight-dashed-lines]
......@@ -694,6 +695,10 @@ customize buffer but do not save them to the server."
(kom-show-personal-message-date (toggle (on off)))
(kom-mercial (string))
(kom-w3-simplify-body (toggle (on off)))
(kom-format-html-authors (repeat (cons ((choice ((person nil :tag some-person :lyskom-predicate (pers))
(const (all-others t) :format "%t\n"))
:format "%[%v%]")
(toggle (yes no) :tag format-html)))))
(kom-bury-buffers (toggle (on off)))
(kom-ansaphone-replies (ansaphone))
(kom-complete-numbers-before-names (toggle (on off)))
......
......@@ -2714,6 +2714,10 @@ kommandot \"Spara variabler\".\n\n")
(prompt-for-text-no . "Frga efter textnummer")
(all-others . "Alla andra")
(some-person . "Person")
(format-html . "Formattera HTML:")
;;
;; Misc doc strings
;;
......@@ -3627,6 +3631,9 @@ i servern. Annars sparas det i din .emacs.")
(kom-edit-hide-add-button-doc . "\
Om detta r pslaget s kommer knappen [Addera...] att visas efter
mottagare och tillggsinformation nr man skriver inlgg.")
(kom-format-html-authors-doc . "\
Den hr instllningen styr vilka frfattares HTML-meddelanden som
elispklienten kommer att frska formattera.")
;;
......@@ -3802,6 +3809,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-async-highlight-dashed-lines-tag . "Annorlunda bakgrundsfrg fre och efter meddelanden:")
(kom-async-highlight-text-body-tag . "Annorlunda bakgrundsfrg p meddelanden:")
(kom-edit-hide-add-button-tag . "Visa Addera-knappen nr man skriver inlgg:")
(kom-format-html-authors-tag . "Formattera HTML-meddelanden per frfattare:")
)
)
......
......@@ -2482,6 +2482,13 @@ See lyskom-compute-char-classes."
"*Strip color information from body tag."
server)
(def-kom-var kom-format-html-authors '((t . t))
"*Controls from which authors we accept HTML.
Each element of this list is a cons cell (PERS . VAL), where PERS is
a person number and VAL is t or nil. If VAL is t, then we format HTML
written by PERS. Otherwise not."
server)
(def-kom-var lyskom-format-special
'(("html" . lyskom-format-html)
("enriched" . lyskom-format-enriched)
......
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