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> 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: Fix bug 457:
* aux-items.el (send-comments-to): Changed into to info. * aux-items.el (send-comments-to): Changed into to info.
(mx-reject-forward): Added text-name property. (mx-reject-forward): Added text-name property.
......
...@@ -2660,6 +2660,10 @@ Select whether to execute command or keyboard macro.") ...@@ -2660,6 +2660,10 @@ Select whether to execute command or keyboard macro.")
(prompt-for-text-no . "Prompt for text number") (prompt-for-text-no . "Prompt for text number")
(all-others . "All others")
(some-person . "Person")
(format-html . "Format HTML:")
;; ;;
;; Misc doc strings ;; Misc doc strings
;; ;;
...@@ -3566,6 +3570,9 @@ be saved in the server. Otherwise it will be saved in your .emacs.") ...@@ -3566,6 +3570,9 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-edit-hide-add-button-doc . "\ (kom-edit-hide-add-button-doc . "\
When this is on, an [Add...] button will be shown after the list of When this is on, an [Add...] button will be shown after the list of
recipients and auxiliary information when writing a new text.") 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.") ...@@ -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-dashed-lines-tag . "Color dashed lines around messages:")
(kom-async-highlight-text-body-tag . "Color message backgrounds:") (kom-async-highlight-text-body-tag . "Color message backgrounds:")
(kom-edit-hide-add-button-tag . "Show add button when writing texts:") (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." ...@@ -1430,9 +1430,10 @@ Deferred insertions are not supported."
((or (= format-letter ?d) ((or (= format-letter ?d)
(= format-letter ?o) (= format-letter ?o)
(= format-letter ?x)) (= format-letter ?x))
(setq result (if (integerp arg) (setq result (cond ((integerp arg)
(format (format "%%%c" format-letter) (format (format "%%%c" format-letter) arg))
arg) ((and (floatp arg) (= format-letter ?d))
(format "%0.0f" arg))
(signal 'lyskom-internal-error (signal 'lyskom-internal-error
(list 'lyskom-format (list 'lyskom-format
": argument error (expected int)"))))) ": argument error (expected int)")))))
...@@ -1932,7 +1933,7 @@ Deferred insertions are not supported." ...@@ -1932,7 +1933,7 @@ Deferred insertions are not supported."
(setq tmp nil)) (setq tmp nil))
(setq tmp (cdr tmp))) (setq tmp (cdr tmp)))
result)))) result))))
(formatted (and fn (funcall fn text)))) (formatted (and fn (funcall fn text text-stat))))
;; (when (eq t lyskom-last-text-format-flags) ;; (when (eq t lyskom-last-text-format-flags)
;; (lyskom-signal-reformatted-text ;; (lyskom-signal-reformatted-text
...@@ -1989,39 +1990,22 @@ in lyskom-messages." ...@@ -1989,39 +1990,22 @@ in lyskom-messages."
(error (lyskom-ignore var))))) (error (lyskom-ignore var)))))
(defun lyskom-format-html (text) (defun lyskom-format-html (text text-stat)
(when (condition-case e (progn (require 'w3) t) (error nil)) ;; Find settings for this author
(add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text) (let ((author-setting (and text-stat (or (assq (text-stat->author text-stat)
(lyskom-signal-reformatted-text 'reformat-html) kom-format-html-authors)
(substring text 5))) (assq t kom-format-html-authors)))))
(when (and (cdr author-setting)
;;;(defun lyskom-format-html (text) (condition-case e (progn (require 'w3) t) (error nil)))
;;; (condition-case e (require 'w3) (error nil)) (add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text)
;;; (let ((tmpbuf (lyskom-get-buffer-create 'lyskom-html " lyskom-html" t))) (lyskom-signal-reformatted-text 'reformat-html)
;;; (unwind-protect (if (string-match "^html:" text)
;;; (save-excursion (substring text 5)
;;; (set-buffer tmpbuf) text))))
;;; (insert (substring text 5))
;;; (insert " ") ; So we can adjust the extents
;;; (w3-region (point-max) (point-min))
;;; (let ((tmp nil)) (defun lyskom-format-enriched (text text-stat)
;;; (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)
(if (not (fboundp 'format-decode-buffer)) (if (not (fboundp 'format-decode-buffer))
nil nil
(let ((tmpbuf (lyskom-generate-new-buffer "lyskom-enriched"))) (let ((tmpbuf (lyskom-generate-new-buffer "lyskom-enriched")))
...@@ -2036,7 +2020,7 @@ in lyskom-messages." ...@@ -2036,7 +2020,7 @@ in lyskom-messages."
) )
(kill-buffer tmpbuf))))) (kill-buffer tmpbuf)))))
(defun lyskom-format-ö (text) (defun lyskom-format-ö (text text-stat)
(cond ((string= text "") "") (cond ((string= text "") "")
(t (t
(save-excursion (save-excursion
......
...@@ -181,6 +181,7 @@ ...@@ -181,6 +181,7 @@
[kom-show-imported-envelope-sender] [kom-show-imported-envelope-sender]
[kom-smileys] [kom-smileys]
[kom-w3-simplify-body] [kom-w3-simplify-body]
[kom-format-html-authors]
"\n" "\n"
[kom-highlight-first-line] [kom-highlight-first-line]
[kom-highlight-dashed-lines] [kom-highlight-dashed-lines]
...@@ -694,6 +695,10 @@ customize buffer but do not save them to the server." ...@@ -694,6 +695,10 @@ customize buffer but do not save them to the server."
(kom-show-personal-message-date (toggle (on off))) (kom-show-personal-message-date (toggle (on off)))
(kom-mercial (string)) (kom-mercial (string))
(kom-w3-simplify-body (toggle (on off))) (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-bury-buffers (toggle (on off)))
(kom-ansaphone-replies (ansaphone)) (kom-ansaphone-replies (ansaphone))
(kom-complete-numbers-before-names (toggle (on off))) (kom-complete-numbers-before-names (toggle (on off)))
......
...@@ -2714,6 +2714,10 @@ kommandot \"Spara variabler\".\n\n") ...@@ -2714,6 +2714,10 @@ kommandot \"Spara variabler\".\n\n")
(prompt-for-text-no . "Frga efter textnummer") (prompt-for-text-no . "Frga efter textnummer")
(all-others . "Alla andra")
(some-person . "Person")
(format-html . "Formattera HTML:")
;; ;;
;; Misc doc strings ;; Misc doc strings
;; ;;
...@@ -3627,6 +3631,9 @@ i servern. Annars sparas det i din .emacs.") ...@@ -3627,6 +3631,9 @@ i servern. Annars sparas det i din .emacs.")
(kom-edit-hide-add-button-doc . "\ (kom-edit-hide-add-button-doc . "\
Om detta r pslaget s kommer knappen [Addera...] att visas efter Om detta r pslaget s kommer knappen [Addera...] att visas efter
mottagare och tillggsinformation nr man skriver inlgg.") 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.") ...@@ -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-dashed-lines-tag . "Annorlunda bakgrundsfrg fre och efter meddelanden:")
(kom-async-highlight-text-body-tag . "Annorlunda bakgrundsfrg p 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-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." ...@@ -2482,6 +2482,13 @@ See lyskom-compute-char-classes."
"*Strip color information from body tag." "*Strip color information from body tag."
server) 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 (def-kom-var lyskom-format-special
'(("html" . lyskom-format-html) '(("html" . lyskom-format-html)
("enriched" . lyskom-format-enriched) ("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