Gnus development mailing list
 help / color / mirror / Atom feed
* X-Face support in XEmacs
@ 1996-03-25 16:05 Pekka Marjola
  1996-03-25 18:08 ` Steven L Baur
  1996-04-03 16:07 ` Mark Borges
  0 siblings, 2 replies; 9+ messages in thread
From: Pekka Marjola @ 1996-03-25 16:05 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 213 bytes --]


Since XEmacs can show X-Face without external processes, shouldn't
something like this be included in gnus-xmas.el? (Coincidentally, I was
planning to rip exactly same code from VM, but never bothered :)

# pema

[-- Attachment #2: gnus-xemacs-x-face.el --]
[-- Type: application/octet-stream, Size: 1159 bytes --]

;; X-Face inline for XEmacs
;; Based on the VM (thanks Kyle) code.
;; glenn@mathcs.emory.edu  1/16/96
(defvar gnus-xface-cache (make-vector 29 0))
(defun gnus-article-x-face-xemacs-inline (beg end)
  "Display X-Face header inline for XEmacs."
	    (let (xf e gl)
	      (make-face 'gnus-xface)
	      (set-face-background 'gnus-xface "white")
	      (set-face-foreground 'gnus-xface "black")

	      (setq xf (concat "X-Face: "
			       (buffer-substring beg end)))
	      (setq gl (intern xf gnus-xface-cache))
	      (if (boundp gl)
		  (setq gl (symbol-value gl))
		(set gl (make-glyph xf))
		(setq gl (symbol-value gl))
		(set-glyph-face gl 'gnus-xface))
	      (goto-char (point-min))
	      (re-search-forward "^From: " nil t)
	      ;; We display the face.
	      (setq e (make-extent (point) (point)))
	      (set-extent-property e 'gnus-xface t)
	      (set-extent-begin-glyph e gl)))

(setq gnus-article-x-face-command 'gnus-article-x-face-xemacs-inline)
;; This hook needs to go after gnus-article-highlight and/or
;; gnus-article-hide-headers-if-wanted (unsure exactly which).
(add-hook 'gnus-article-display-hook 'gnus-article-display-x-face t)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-25 16:05 X-Face support in XEmacs Pekka Marjola
@ 1996-03-25 18:08 ` Steven L Baur
  1996-03-26  7:07   ` Pekka Marjola
  1996-03-26  9:53   ` Jens Lautenbacher
  1996-04-03 16:07 ` Mark Borges
  1 sibling, 2 replies; 9+ messages in thread
From: Steven L Baur @ 1996-03-25 18:08 UTC (permalink / raw)


Support for X-Face is already built into the Tools for MIME package,
so effectively, it's already supported.  Gnus need do nothing more.

Regards,
-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be proofread for $250/hour.
Andrea Seastrand: For your vote on the Telecom bill, I will vote for anyone
except you in November.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-25 18:08 ` Steven L Baur
@ 1996-03-26  7:07   ` Pekka Marjola
  1996-03-26  8:17     ` Pekka Marjola
  1996-03-26  9:53   ` Jens Lautenbacher
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka Marjola @ 1996-03-26  7:07 UTC (permalink / raw)


"Steven" == Steven L Baur <steve@miranova.com> writes:

Steven> Support for X-Face is already built into the Tools for MIME package,
Steven> so effectively, it's already supported.  Gnus need do nothing more.

I know that, but it uses external process by default and not everyone
uses TM. (OK, I do, but that's beside the point :)

# pema


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-26  7:07   ` Pekka Marjola
@ 1996-03-26  8:17     ` Pekka Marjola
  0 siblings, 0 replies; 9+ messages in thread
From: Pekka Marjola @ 1996-03-26  8:17 UTC (permalink / raw)


"PeMa" == Pekka Marjola <marjola@shire.ntc.nokia.com> writes:

PeMa> "Steven" == Steven L Baur <steve@miranova.com> writes:
Steven> Support for X-Face is already built into the Tools for MIME package,
Steven> so effectively, it's already supported.  Gnus need do nothing more.

PeMa> I know that, but TM uses external process by default and not everyone
PeMa> uses TM. (OK, I do, but that's beside the point :)

... and X-Face is not really MIME stuff.

# pema


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-25 18:08 ` Steven L Baur
  1996-03-26  7:07   ` Pekka Marjola
@ 1996-03-26  9:53   ` Jens Lautenbacher
  1996-03-27  7:04     ` Pekka Marjola
  1 sibling, 1 reply; 9+ messages in thread
From: Jens Lautenbacher @ 1996-03-26  9:53 UTC (permalink / raw)


>>>>> "SLB" == Steven L Baur <steve@miranova.com> writes:

    SLB> Support for X-Face is already built into the Tools for MIME
    SLB> package, so effectively, it's already supported.  Gnus need
    SLB> do nothing more.

Unfortunately I never got this one to work. But maybe I don't
understand how it is supposed to work: Should it display X-faces
automatically inside the buffer as the proposed code of the original
poster does? Or does it spawn a xv? How does it react if the message
has no mime header?

I think something that simple as the proposed piece of code should be
added to gnus, at least until tm is oficially added to (X)Emacs.

Cheers,
	Jens


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-26  9:53   ` Jens Lautenbacher
@ 1996-03-27  7:04     ` Pekka Marjola
  1996-03-29 18:51       ` Wes Hardaker
  0 siblings, 1 reply; 9+ messages in thread
From: Pekka Marjola @ 1996-03-27  7:04 UTC (permalink / raw)


"Jens" == Jens Lautenbacher <jtl@tkm.physik.uni-karlsruhe.de> writes:

>>>>>> "SLB" == Steven L Baur <steve@miranova.com> writes:
SLB> Support for X-Face is already built into the Tools for MIME
SLB> package, so effectively, it's already supported.  Gnus need
SLB> do nothing more.

Jens> Unfortunately I never got this one to work. But maybe I don't
Jens> understand how it is supposed to work: Should it display X-faces
Jens> automatically inside the buffer as the proposed code of the original
Jens> poster does? Or does it spawn a xv? How does it react if the message
Jens> has no mime header?

There is no specific support in Gnus for showing X-Face in XEmacs
currently... Using xv is kinda silly. It also requires netpbm package.

Anyway, I noticed that x-face displaying hook must be added after
other hooks are there (otherwise highlighting stuff etc. are never
added):

(add-hook 'gnus-startup-hook
	  '(lambda ()
	     (add-hook 'gnus-article-display-hook
		       'gnus-article-display-x-face t)))


Jens> I think something that simple as the proposed piece of code should be
Jens> added to gnus, at least until tm is oficially added to (X)Emacs.

Well, tm uses external processes to show X-Face, too. (It shows X-Face
in article buffer, though.) X-Face support is in precompiled XEmacs
binaries, so most XEmacs users should be able to use internal method.

IMNSHO X-Face support should in both Gnus and tm, as it is now. It's
not MIME thing, but for completeness (everyone does not use Gnus :( ),
tm should have it, too. Until tm is used almost always/automatically
with Gnus, if ever, it shouldn't be removed from Gnus.

# pema



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-27  7:04     ` Pekka Marjola
@ 1996-03-29 18:51       ` Wes Hardaker
  1996-04-01  6:51         ` Pekka Marjola
  0 siblings, 1 reply; 9+ messages in thread
From: Wes Hardaker @ 1996-03-29 18:51 UTC (permalink / raw)
  Cc: ding

>>>>> "Pekka" == Pekka Marjola <marjola@bilbo.ntc.nokia.com> writes:

    Pekka> There is no specific support in Gnus for showing X-Face in
    Pekka> XEmacs currently... Using xv is kinda silly. It also
    Pekka> requires netpbm package.

Well, I really really really should write docs for the gnus-picon.el
file.  It allows you to display them in the buffer instead (though it
still requires running an external process instead of converting the
face internally like it should).

(setq gnus-picons-display-where 'picons)   ;  default -- its own buffer
(setq gnus-picons-display-where 'article)  ;  something you probably
                                           ;  have displayed without 
                                           ;  recustomizing
(add-hook 'gnus-article-display-hook 'gnus-picons-article-display-x-face)

I guess I'll try to get docs in by next week at the latest...
                                                                _____ 
Wes Hardaker                                                   / ___ \
Department of Electrical and Computer Engineering             / /   \//\
University of California at Davis        __________________  \--/    /--\
Davis CA  95616                         /     Recycle!     \  \//\___/ /
(hardaker@ece.ucdavis.edu)             / It's not too late! \   \_____/


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-29 18:51       ` Wes Hardaker
@ 1996-04-01  6:51         ` Pekka Marjola
  0 siblings, 0 replies; 9+ messages in thread
From: Pekka Marjola @ 1996-04-01  6:51 UTC (permalink / raw)


"Wes" == Wes Hardaker <hardaker@ece.ucdavis.edu> writes:

>>>>>> "Pekka" == Pekka Marjola <marjola@bilbo.ntc.nokia.com> writes:
Pekka> There is no specific support in Gnus for showing X-Face in
Pekka> XEmacs currently... Using xv is kinda silly. It also
Pekka> requires netpbm package.

Wes> Well, I really really really should write docs for the gnus-picon.el
Wes> file.  It allows you to display them in the buffer instead (though it
Wes> still requires running an external process instead of converting the
Wes> face internally like it should).

Yes, I know that. I read all X-Face code in sgnus, but since there
wasn't proper thing :) I added that piece of code. I don't have picons
nor netpbm package installed here, so gnus-picon.el as such is
useless. Basically gnus-picon.el requires external stuff (picons db),
but X-Face does not... I don't really think xv should be used in
XEmacs even though picons are not used. And I like to show X-Face in
the From: line as in VM :)

Anyway, internal method should be added somewhere :-P

-- 
Pekka Marjola :: pema@iki.fi :: http://www.iki.fi/pema/ :: +358-40-551 4842
===========================================================================
	Quidquid latine dictum sit, altum viditur.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: X-Face support in XEmacs
  1996-03-25 16:05 X-Face support in XEmacs Pekka Marjola
  1996-03-25 18:08 ` Steven L Baur
@ 1996-04-03 16:07 ` Mark Borges
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Borges @ 1996-04-03 16:07 UTC (permalink / raw)


>> On 25 Mar 1996 18:05:42 +0200,
>> Pekka Marjola(p) wrote:

p> Since XEmacs can show X-Face without external processes, shouldn't
p> something like this be included in gnus-xmas.el? (Coincidentally, I
p> was planning to rip exactly same code from VM, but never bothered

Appended is an alternative patch to gnus-xmas.el that works for me. 

I like it more better because it has different behavior than the one
based on Kyle's work (background/foreground faces are definable by
user, optional hiding of X-Face data, maybe something else, I forget).

If you don't have highlight headers loaded (or don't want to use it)
you'll have to uncomment the line containing the call to
gnus-xmas-embed-xface-to-pixmap() below).

  -mb-

--- gnus-xmas.el.orig	Tue Apr  2 06:58:56 1996
+++ gnus-xmas.el	Tue Apr  2 09:58:35 1996
@@ -422,7 +422,8 @@
   (fset 'gnus-tree-minimize 'gnus-xmas-tree-minimize)
   (fset 'gnus-appt-select-lowest-window 
 	'gnus-xmas-appt-select-lowest-window)
-  (fset 'gnus-mail-strip-quoted-names 'gnus-xmas-mail-strip-quoted-names)
+  (if (< emacs-minor-version 14)
+      (fset 'gnus-mail-strip-quoted-names 'gnus-xmas-mail-strip-quoted-names))
   (fset 'gnus-make-local-hook 'make-local-variable)
 
   (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
@@ -434,6 +435,15 @@
   (add-hook 'gnus-binary-mode-hook 'gnus-xmas-binary-menu-add)
   (add-hook 'gnus-grouplens-mode-hook 'gnus-xmas-grouplens-menu-add)
 
+  ;; Note that this hook into gnus-article-display-hook needs to be
+  ;; run last --  hence the trailing t (for append). Alternatively,
+  ;; you could comment it out and have the users put it in their
+  ;; gnus-init-file instead; this may be the right thing to do anyway,
+  ;; since the decision is left to the user to enable it or not. But
+  ;; then again, if one has xface support compiled in one should use
+  ;; it. So I don't know. Lars? <mdb>
+  (add-hook 'gnus-article-display-hook '(lambda() (gnus-xmas-embed-xface t)) t)
+
   (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar)
   (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar))
 
@@ -742,6 +752,100 @@
 	    (after-find-file error (not nowarn)))))
       buf)))
 
+
+;;; gnus-xmas-embed-xface() --- embed an X-Face in the article buffer.
+;;; Coded by Mark Borges <mdb@cdc.noaa.gov>, based on original ideas
+;;; in highlight-headers.el by Jamie Zawinski (which see).
+;;; 
+;;; The auxilliary function gnus-xmas-embed-xface-to-pixmap() is
+;;; called to do the actual conversion.
+;;; The variable gnus-xmas-embed-xface-p is consulted to determine if
+;;; xface conversion is possible.
+;;;
+
+(defvar gnus-xmas-embed-xface-p (featurep 'xface)
+  "*If true, then the bitmap in an X-Face header will be displayed
+in the buffer.")
+
+(defun gnus-xmas-embed-xface (&optional hide-data)
+  "Search for an X-Face header line; if found, display next to the From line.
+Optional argument HIDE-DATA makes the original X-Face header invisible.
+"
+  ;; make sure a face exists
+  (if (find-face 'x-face)
+      nil
+    (make-face 'x-face)
+    (or (face-differs-from-default-p 'x-face)
+	(progn 
+	  (set-face-background 'x-face "white")
+	  (set-face-foreground 'x-face "black"))))
+
+  ;; delete previous highlighting
+  (map-extents (function (lambda (extent ignore)
+			   (if (extent-property extent 'is-xface)
+			       (delete-extent extent))
+			   nil))
+	       (current-buffer) (point-min) (point-max))
+
+  (save-excursion
+    (let* (e)
+
+      (goto-char (point-min))
+      ;;
+      (cond
+       ( (and gnus-xmas-embed-xface-p
+	      (re-search-forward "^X-Face: *\\(.*\\(\n[ \t].*\\)*\n\\)" nil t))
+	 (setq e (make-extent (match-beginning 0) (match-end 0)))
+
+	 ;; if requested, make the whole header invisible
+	 (if hide-data
+	     (set-extent-property e 'invisible t))
+	 
+	 ;; now extract the xface and put it somewhere interesting
+;	 (let ((xface (gnus-xmas-embed-xface-to-pixmap
+	 (let ((xface (highlight-headers-x-face-to-pixmap
+		       (match-beginning 1)
+		       (match-end 1))))
+	   (if (not xface)
+	       nil ; just leave the header invisible if we can't convert   
+		   ; the face for some reason 
+	     (cond
+	      ( (save-excursion
+		  (goto-char (point-min))
+		  (save-excursion (re-search-forward "^From: *"
+						     nil t)))
+		(setq e (make-extent (match-end 0)
+				     (match-end 0))))
+	      (t
+	       ;; okay, make the beginning of the the invisible
+	       ;; move forward to only hide the modem noise...
+	       (set-extent-endpoints e
+				     (match-beginning 2)
+				     (1- (match-end 2)))
+	       ;; kludge: if a zero-length extent exists at the
+	       ;; starting point of an invisible extent, then
+	       ;; it's invisible... even if the invisible extent
+	       ;; is start-open.  
+	       (setq e (make-extent (1- (match-beginning 2))
+				    (match-beginning 2)))
+	       ))
+	     (set-extent-property e 'is-xface t)
+	     (set-extent-end-glyph e xface))
+	   )
+	 )))
+    ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; auxilliary function for X-Face header conversion:
+(defun gnus-xmas-embed-xface-to-pixmap (start end)
+  (let* ((string (if (stringp start) start (buffer-substring start end))))
+    (if (featurep 'xface)
+	(let ((new-face (make-glyph (concat "X-Face: " string))))
+	  (set-glyph-face new-face 'x-face)
+	  new-face)
+      (message "This cannot happen when called from gnus-xmas-embed-xface!")
+      ))
+  )
 (defun gnus-xmas-mail-strip-quoted-names (address)
   "Protect mail-strip-quoted-names from NIL input.
 XEmacs compatibility workaround."


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1996-04-03 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-25 16:05 X-Face support in XEmacs Pekka Marjola
1996-03-25 18:08 ` Steven L Baur
1996-03-26  7:07   ` Pekka Marjola
1996-03-26  8:17     ` Pekka Marjola
1996-03-26  9:53   ` Jens Lautenbacher
1996-03-27  7:04     ` Pekka Marjola
1996-03-29 18:51       ` Wes Hardaker
1996-04-01  6:51         ` Pekka Marjola
1996-04-03 16:07 ` Mark Borges

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).