Commit 81eba27b authored by David Kågedal's avatar David Kågedal
Browse files

Ytterligare modifikationer på defer-koden, och ett faces-hack

parent a551d5f2
Mon May 6 00:27:19 1996 David Kgedal <davidk@lysator.liu.se>
* vars.el.in (lyskom-faces): Ny variabel.
Leta efter X-resurser som bestmmer utseendet p faces.
* deferred-insert.el (lyskom-defer-insertion): Gjorde s att man
anger serveranrop p samma stt som i blocking-do.
* view-text.el (lyskom-print-header-comm): Skrev om.
(lyskom-insert-deferred-header-comm): Skrev om.
(lyskom-insert-header-comm): Skrev om.
* deferred-insert.el (lyskom-replace-deferred): Gjorde om till en
funktion.
(lyskom-deferred-insert-conf): Gr om drefter.
Sun May 5 03:18:19 1996 David Kgedal <davidk@lysator.liu.se>
* Makefile (PARTS-EL): Flyttade deferred-insert.el till HEADER-EL.
......
......@@ -55,11 +55,17 @@
;;; data. This should normally only contain a
;;; single format atom using argument 1
;;; (i.e. "%#1P").
;;; DATA - any data that you want to send to HANDLER.
;;; DATA - any data that you might want to use in
;;; HANDLER.
;;;
;;; 3. Call `lyskom-defer-insertion' with the defer-info as argument.
;;;
;;; 4. Sit back and watch it work.
;;; 4. Write a handler function that takes two arguments, the server
;;; reply and the defer-info. This function should replace the
;;; temporary text. A convenient way to do this is to use
;;; `lyskom-replace-deferred'.
;;;
;;; 5. Sit back and watch it work.
;;;
;;; Notes:
;;;
......@@ -71,7 +77,8 @@
;;; least the POS parameter is determined before any text is
;;; inserted.
;;;
;;; You should only defer text if kom-deferred-printing is non-nil.
;;;
......@@ -108,61 +115,39 @@
"Defer insertion of something.
The insertion will be at (point)."
(goto-char (defer-info->pos defer-info))
(funcall (defer-info->server-call defer-info)
(funcall (intern-soft (concat "initiate-"
(symbol-name (defer-info->server-call
defer-info))))
'deferred
(defer-info->handler defer-info)
(defer-info->call-par defer-info)
defer-info))
(defmacro lyskom-replace-deferred (defer-info &rest body)
(defun lyskom-replace-deferred (defer-info &rest replacement-data)
"Replace some defered text."
(append (list 'save-excursion
(list 'goto-char (list 'defer-info->pos defer-info)))
body
(list
(list 'let (list (list 'inhibit-read-only t))
(list 'delete-char (list 'defer-info->del-chars defer-info)))
(list 'set-marker (list 'defer-info->pos defer-info) nil))))
(save-excursion
(goto-char (defer-info->pos defer-info))
(apply 'lyskom-format-insert-at-point
(defer-info->format defer-info)
replacement-data)
(let ((inhibit-read-only t))
(delete-char (defer-info->del-chars defer-info)))
(set-marker (defer-info->pos defer-info) nil)))
(put 'lyskom-replace-deferred 'edebug-form-spec '(eval body))
(put 'lyskom-replace-deferred 'lisp-indent-function 1)
(defun lyskom-deferred-insert-conf (conf-stat defer-info)
"Insert the name of a conference at a previously reserved place."
(lyskom-replace-deferred defer-info
(if (null conf-stat)
(lyskom-format-insert-at-point
(defer-info->format defer-info)
(lyskom-format
(or (defer-info->data defer-info)
(if (conf-type->letterbox (conf-stat->conf-type conf-stat))
(if (= (defer-info->call-par defer-info) 0)
'person-is-anonymous
'person-does-not-exist)
'conference-does-not-exist))
(defer-info->call-par defer-info)))
(lyskom-format-insert-at-point (defer-info->format defer-info)
conf-stat))))
(lyskom-replace-deferred
defer-info
(if (null conf-stat)
(lyskom-format
(or (defer-info->data defer-info)
(if (conf-type->letterbox (conf-stat->conf-type conf-stat))
(if (= (defer-info->call-par defer-info) 0)
'person-is-anonymous
'person-does-not-exist)
'conference-does-not-exist))
(defer-info->call-par defer-info))
conf-stat)))
;;;(defun lyskom-deferred-insert-conf (conf-stat defer-info)
;;; "Insert the name of a conference at a previously reserved place."
;;; (save-excursion
;;; (goto-char (defer-info->pos defer-info))
;;; (if (null conf-stat)
;;; (lyskom-format-insert-at-point
;;; (defer-info->format defer-info)
;;; (lyskom-format
;;; (or (defer-info->data defer-info)
;;; (if (conf-type->letterbox (conf-stat->conf-type conf-stat))
;;; (if (= (defer-info->call-par defer-info) 0)
;;; 'person-is-anonymous
;;; 'person-does-not-exist)
;;; 'conference-does-not-exist))
;;; (defer-info->call-par defer-info)))
;;; (lyskom-format-insert-at-point (defer-info->format defer-info)
;;; conf-stat))
;;; (let ((inhibit-read-only t))
;;; (delete-char (defer-info->del-chars defer-info)))
;;; (set-marker (defer-info->pos defer-info) nil)))
......@@ -620,6 +620,12 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
(footnote-to-text . "Footnote to article %#1n")
(comment-in-text . "Comment in article %#1n")
(footnote-in-text . "Footnote in article %#1n")
(comment-to-text-by . "Comment to article %#1n by %#2P")
(footnote-to-text-by . "Footnote to article %#1n by %#2P")
(comment-in-text-by . "Footnote in article %#1n by %#2P")
(footnote-in-text-by . "Footnote in article %#1n by %#2P")
(written-by . " by %#1P\n")
; From async.el:
......
No preview for this file type
......@@ -636,6 +636,12 @@ M\344rk kuvertet \"LysKOM buggrapport f\366r elispklienten\".\n\n")
(footnote-to-text . "Fotnot till text %#1n")
(comment-in-text . "Kommentar i text %#1n")
(footnote-in-text . "Fotnot i text %#1n")
(comment-to-text-by . "Kommentar till text %#1n av %#2P")
(footnote-to-text-by . "Fotnot till text %#1n av %#2P")
(comment-in-text-by . "Kommentar i text %#1n av %#2P")
(footnote-in-text-by . "Fotnot i text %#1n av %#2P")
(written-by . " av %#1P\n")
; From async.el:
......
......@@ -1128,6 +1128,13 @@ the value of kom-tell-phrases for fun.")
;; Set up default faces in case no face scheme is selected
;;
(defvar lyskom-faces
'(kom-active-face kom-url-face kom-me-face kom-highlight-face
kom-text-face kom-subject-face kom-text-no-face
kom-friends-face kom-presence-face
kom-first-line-face)
"This is a list of the faces that LysKOM uses.")
(defvar lyskom-face-schemes
'((default
(kom-active-face default "blue4" nil)
......@@ -1210,7 +1217,7 @@ to be bold with yellow text on a red background."
(error nil)))
(defun lyskom-set-face-scheme (scheme)
(defun lyskom-set-face-scheme (scheme &optional)
"Set the LysKOM color and face scheme to SCHEME. Valid schemes are listed
in lyskom-face-schemes."
(let ((tmp (assoc scheme lyskom-face-schemes)))
......@@ -1219,13 +1226,43 @@ in lyskom-face-schemes."
(mapcar
(function
(lambda (spec)
(copy-face (or (elt spec 1) 'default) (elt spec 0))
(copy-face (or (elt spec 1) 'default) (elt spec 0))
(if (elt spec 2)
(lyskom-set-face-foreground (elt spec 0) (elt spec 2)))
(if (elt spec 3)
(lyskom-set-face-background (elt spec 0) (elt spec 3)))))
(cdr tmp))))))
(cdr tmp))))))
(lyskom-set-face-scheme kom-default-face-scheme)
;;; Look for X resources specifying faces.
(if (eq window-system 'x)
(let* ((set-p (function
(lambda (face-name resource)
(x-get-resource (concat face-name ".attribute" resource)
(concat "Face.Attribute" resource)))))
(on-p (function
(lambda (face-name resource)
(let ((set (funcall set-p face-name resource)))
(cond ((null set) nil)
((member (downcase set) '("on" "true")) 'on)
(t 'off)))))))
(mapcar
(function
(lambda (face)
(let* ((face-name (symbol-name face))
(fg (funcall set-p face-name "Foreground"))
(bg (funcall set-p face-name "Background"))
(bl (funcall on-p face-name "Bold"))
(it (funcall on-p face-name "Italic"))
(ul (funcall on-p face-name "Underline")))
(if fg (set-face-foreground face fg))
(if bg (set-face-background face bg))
(if (eq bl 'on) (make-face-bold face nil t))
(if (eq bl 'off) (make-face-unbold face nil t))
(if (eq it 'on) (make-face-italic face nil t))
(if (eq it 'off) (make-face-unitalic face nil t))
(if ul (set-face-underline-p face (eq ul 'on))))))
lyskom-faces)))
......
......@@ -441,33 +441,59 @@ Args: TEXT-STAT of the text being read."
(defun lyskom-print-header-comm (text misc)
"Get author of TEXT-NO and print a header line."
(let ((text-stat (if kom-deferred-printing
(let ((type (misc-info->type misc))
(text-stat (if kom-deferred-printing
(cache-get-text-stat text)
(blocking-do 'get-text-stat text))))
;; Print information about the link
(if text-stat
(progn
(lyskom-insert-header-comm text-stat misc
'lyskom-format-insert))
(lyskom-insert-header-comm text-stat misc))
(let ((defer-info (lyskom-create-defer-info
'initiate-get-text-stat
'get-text-stat
text
'lyskom-insert-deferred-header-comm
(point-max-marker)
(1+ (length lyskom-defer-indicator))
"%#1s"
(length lyskom-defer-indicator)
nil ; Filled in later
misc)))
(lyskom-format-insert "%#1s\n" lyskom-defer-indicator)
(lyskom-defer-insertion defer-info)))))
(lyskom-defer-insertion defer-info)))
;; Print information about who added the link
(if (misc-info->sent-at misc)
(lyskom-format-insert 'send-at (lyskom-return-date-and-time
(misc-info->sent-at misc))))
(if (misc-info->sender misc)
(lyskom-format-insert 'sent-by (misc-info->sender misc)))))
(defun lyskom-insert-deferred-header-comm (text-stat defer-info)
(lyskom-replace-deferred defer-info
(lyskom-insert-header-comm text-stat (defer-info->data defer-info)
'lyskom-format-insert-at-point)))
(let* ((author (if text-stat (text-stat->author text-stat) nil))
(misc (defer-info->data defer-info))
(type (misc-info->type misc))
fmt data)
(cond
((eq type 'COMM-TO)
(setq fmt (if author 'comment-to-text-by 'comment-to-text)
data (misc-info->comm-to misc)))
((eq type 'FOOTN-TO)
(setq fmt (if author 'footnote-to-text-by 'footnote-to-text)
data (misc-info->footn-to misc)))
((eq type 'COMM-IN)
(setq fmt (if author 'comment-in-text-by 'comment-in-text)
data (misc-info->comm-in misc)))
((eq type 'FOOTN-IN)
(setq fmt (if author 'footnote-in-text-by 'footnote-in-text)
data(misc-info->footn-in misc))))
(set-defer-info->format defer-info fmt)
; Note: author is ignored if fmt is not *-by
(lyskom-replace-deferred defer-info data author)))
(defun lyskom-insert-header-comm (text-stat misc insertfun)
(defun lyskom-insert-header-comm (text-stat misc)
"Get author of TEXT-NO and print a header line."
;;+++ error kommer att se annorlunda ut.
(let ((author (if text-stat
......@@ -476,23 +502,16 @@ Args: TEXT-STAT of the text being read."
(type (misc-info->type misc)))
(cond
((eq type 'COMM-TO)
(funcall insertfun 'comment-to-text (misc-info->comm-to misc)))
(lyskom-format-insert 'comment-to-text (misc-info->comm-to misc)))
((eq type 'FOOTN-TO)
(funcall insertfun 'footnote-to-text (misc-info->footn-to misc)))
(lyskom-format-insert 'footnote-to-text (misc-info->footn-to misc)))
((eq type 'COMM-IN)
(funcall insertfun 'comment-in-text (misc-info->comm-in misc)))
(lyskom-format-insert 'comment-in-text (misc-info->comm-in misc)))
((eq type 'FOOTN-IN)
(funcall insertfun 'footnote-in-text (misc-info->footn-in misc))))
(lyskom-format-insert 'footnote-in-text (misc-info->footn-in misc))))
(if author
(funcall insertfun 'written-by author)
(lyskom-insert-at-point "\n"))
;; Print information about who added the link
(if (misc-info->sent-at misc)
(funcall insertfun 'send-at (lyskom-return-date-and-time
(misc-info->sent-at misc))))
(if (misc-info->sender misc)
(funcall insertfun 'sent-by (misc-info->sender misc)))))
(lyskom-format-insert 'written-by author)
(lyskom-insert-at-point "\n"))))
......
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