unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* Re: info-mode image alt text display (patch)
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2007-03-27 10:25 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: emacs-devel

 > 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]

Yes, I like this.  I must admit that I didn't even know you could display
images in info files, and have never seen one that does, but leaving
everything blank on a text-only terminal is clearly confusing.

Is it possible to do the something similar for the toolbar?  For example,
instead of the usual GUD toolbar, to have on a text-only terminal:

[print][print*][go][next][step][finish][up][down][info]

where each item is clickable with the mouse using t-mouse.el.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: info-mode image alt text display (patch)
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2007-03-27 16:43 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: emacs-devel

This is a good change.  Would someone please install it?

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

* Re: info-mode image alt text display (patch)
  2007-03-27 16:43 ` Richard Stallman
@ 2007-03-27 22:19   ` Nick Roberts
  2007-03-29 15:32     ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Roberts @ 2007-03-27 22:19 UTC (permalink / raw)
  To: rms; +Cc: Kevin Ryde, emacs-devel

 > This is a good change.  Would someone please install it?

Done.  I've assumed Kevin has an assignment for Emacs.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: info-mode image alt text display (patch)
  2007-03-27 22:19   ` Nick Roberts
@ 2007-03-29 15:32     ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2007-03-29 15:32 UTC (permalink / raw)
  To: Nick Roberts; +Cc: user42, emacs-devel

    Done.  I've assumed Kevin has an assignment for Emacs.

He does.

^ 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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).