* info-mode image alt text display (patch)
@ 2007-03-25 21:27 Kevin Ryde
2007-03-27 10:25 ` Nick Roberts
2007-03-27 16:43 ` Richard Stallman
0 siblings, 2 replies; 5+ messages in thread
From: Kevin Ryde @ 2007-03-25 21:27 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
I'd like to propose this change to get Info-display-images-node
showing the the text alternative parts of @image blobs, if the tty
can't show the graphics. Such text is of course provided specifically
for when the graphics can't be shown. It can be an ascii art
rendition, or merely a few words about what you could have seen.
2007-03-25 Kevin Ryde <user42@zip.com.au>
* info.el (Info-display-images-node): On a text-only terminal, show
the "text" or "alt" parts of the image blobs.
You can see the effect on the foo.info file below. Currently the
images are only blank lines, with my change it comes out like
This is an alt bit.
This is a text bit from a .txt file.
Or if no text parts at all then you get:
[image:foo.png]
foo.texi and bar.txt below are the sources. Copy any random png files
to create foo.png and bar.png.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info.el.image-alts.diff --]
[-- Type: text/x-diff, Size: 2194 bytes --]
*** info.el.~1.497.~ 2007-03-12 10:14:41.000000000 +1100
--- info.el 2007-03-25 11:23:26.000000000 +1000
***************
*** 1315,1330 ****
nil t)
(let* ((start (match-beginning 1))
(parameter-alist (Info-split-parameter-string (match-string 2)))
! (src (cdr (assoc-string "src" parameter-alist)))
! (image-file (if src (if (file-name-absolute-p src) src
! (concat default-directory src))
! ""))
! (image (if (file-exists-p image-file)
! (create-image image-file)
! "[broken image]")))
! (if (not (get-text-property start 'display))
! (add-text-properties
! start (point) `(display ,image rear-nonsticky (display)))))))
(set-buffer-modified-p nil)))
;; Texinfo 4.7 adds cookies of the form ^@^H[NAME CONTENTS ^@^H].
--- 1315,1339 ----
nil t)
(let* ((start (match-beginning 1))
(parameter-alist (Info-split-parameter-string (match-string 2)))
! (src (cdr (assoc-string "src" parameter-alist))))
! (if (display-images-p)
! (let* ((image-file (if src (if (file-name-absolute-p src) src
! (concat default-directory src))
! ""))
! (image (if (file-exists-p image-file)
! (create-image image-file)
! "[broken image]")))
! (if (not (get-text-property start 'display))
! (add-text-properties
! start (point) `(display ,image rear-nonsticky (display)))))
! ;; text-only display, show alternative text if provided, or
! ;; otherwise a clue that there's meant to be a picture
! (delete-region start (point))
! (insert (or (cdr (assoc-string "text" parameter-alist))
! (cdr (assoc-string "alt" parameter-alist))
! (and src
! (concat "[image:" src "]"))
! "[image]"))))))
(set-buffer-modified-p nil)))
;; Texinfo 4.7 adds cookies of the form ^@^H[NAME CONTENTS ^@^H].
[-- Attachment #3: foo.info --]
[-- Type: application/octet-stream, Size: 371 bytes --]
[-- Attachment #4: foo.texi --]
[-- Type: application/x-texinfo, Size: 253 bytes --]
[-- Attachment #5: bar.txt --]
[-- Type: text/plain, Size: 37 bytes --]
This is a text bit from a .txt file.
[-- Attachment #6: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-29 15:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-25 21:27 info-mode image alt text display (patch) Kevin Ryde
2007-03-27 10:25 ` Nick Roberts
2007-03-27 16:43 ` Richard Stallman
2007-03-27 22:19 ` Nick Roberts
2007-03-29 15:32 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.