[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Xemacs glyph support for emacswiki
From: |
Anselm Levskaya |
Subject: |
[emacs-wiki-discuss] Xemacs glyph support for emacswiki |
Date: |
Mon, 3 Jan 2005 00:04:01 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Allowing Xemacs to display glyphs is quite simple. The changes needed (on a
slightly older version of emacswiki) are as follows:
(defun emacs-wiki-xemacs-glyph (filename)
"Autodetection hack for creating the appropriate Xemacs glyph, given a
filename with a supported extension."
(let ((case-fold-search nil)
myglyph)
;; scan filename to determine image type
(cond ((string-match "jp\\(e\\)?g" filename)
(setq myglyph (make-glyph (vector 'jpeg :file filename) 'buffer))
)
((string-match "gif" filename)
(setq myglyph (make-glyph (vector 'gif :file filename) 'buffer))
)
((string-match "png" filename)
(setq myglyph (make-glyph (vector 'png :file filename) 'buffer))
))
myglyph
))
;;NOTE: create-image doesn't work w. Xemacs
(defun emacs-wiki-inline-image (beg end url &optional desc)
"Inline locally available images."
(let ((filename
(cond
((string-match "\\`file:\\(.+\\)" url)
(match-string 1 url))
((string-match "/" url)
(expand-file-name url (symbol-value
emacs-wiki-inline-relative-to))))
))
(if (and filename (file-readable-p filename))
(cond ((featurep 'xemacs)
(add-text-properties beg end (list 'invisible t
'end-glyph
(emacs-wiki-xemacs-glyph filename)
'help-echo (or desc url)))
)
((t)
(add-text-properties beg end (list 'display (create-image
filename)
'help-echo (or desc url))))
))
))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [emacs-wiki-discuss] Xemacs glyph support for emacswiki,
Anselm Levskaya <=