From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.devel Subject: info-mode image alt text display (patch) Date: Mon, 26 Mar 2007 07:27:04 +1000 Message-ID: <87ejnd580n.fsf@zip.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1174854514 22603 80.91.229.12 (25 Mar 2007 20:28:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Mar 2007 20:28:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 25 22:28:27 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HVZKE-00006u-Gm for ged-emacs-devel@m.gmane.org; Sun, 25 Mar 2007 22:28:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVZMO-000147-CB for ged-emacs-devel@m.gmane.org; Sun, 25 Mar 2007 15:30:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HVZLH-0000es-I8 for emacs-devel@gnu.org; Sun, 25 Mar 2007 16:29:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HVZLG-0000eS-Mp for emacs-devel@gnu.org; Sun, 25 Mar 2007 16:29:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVZLG-0000eJ-8v for emacs-devel@gnu.org; Sun, 25 Mar 2007 15:29:30 -0500 Original-Received: from mailout1-8.pacific.net.au ([61.8.2.215] helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HVZJ4-0005nD-V5 for emacs-devel@gnu.org; Sun, 25 Mar 2007 16:27:15 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id C1E30328253 for ; Mon, 26 Mar 2007 06:27:10 +1000 (EST) Original-Received: from localhost (ppp2B1F.dyn.pacific.net.au [61.8.43.31]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id B4DB227403 for ; Mon, 26 Mar 2007 06:27:09 +1000 (EST) Original-Received: from gg by localhost with local (Exim 4.63) (envelope-from ) id 1HVaEy-0001gf-FU for emacs-devel@gnu.org; Mon, 26 Mar 2007 07:27:04 +1000 User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68547 Archived-At: --=-=-= 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 * 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=info.el.image-alts.diff *** 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]. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=foo.info Content-Transfer-Encoding: base64 VGhpcyBpcyBmb28uaW5mbywgcHJvZHVjZWQgYnkgbWFrZWluZm8gdmVyc2lvbiA0LjguOTAgZnJv bSBmb28udGV4aS4KCh8KRmlsZTogZm9vLmluZm8sICBOb2RlOiBUb3AsICBQcmV2OiAoZGlyKSwg IFVwOiAoZGlyKQoKRm9vCioqKgoKAAhbaW1hZ2Ugc3JjPSJmb28ucG5nIiBhbHQ9IlRoaXMgaXMg YW4gYWx0IGJpdC4iAAhdCgoACFtpbWFnZSBzcmM9ImJhci5wbmciIHRleHQ9IlRoaXMgaXMgYSB0 ZXh0IGJpdCBmcm9tIGEgLnR4dCBmaWxlLgoiAAhdCgpPciBpZiBubyB0ZXh0IHBhcnRzIGF0IGFs bCB0aGVuIHlvdSBnZXQ6CgAIW2ltYWdlIHNyYz0iZm9vLnBuZyIACF0KCgofClRhZyBUYWJsZToK Tm9kZTogVG9wfzcwCh8KRW5kIFRhZyBUYWJsZQo= --=-=-= Content-Type: application/x-texinfo Content-Disposition: attachment; filename=foo.texi \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename foo.info @comment %**end of header @node Top, , (dir), (dir) @top Foo @image{foo,,,This is an alt bit.} @image{bar} Or if no text parts at all then you get: @* @image{foo} @bye --=-=-= Content-Disposition: attachment; filename=bar.txt This is a text bit from a .txt file. --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--