From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: shyam@swathanthran.in (Shyam | =?UTF-8?Q?=E0=B4=B6=E0=B5=8D=E0=B4=AF=E0=B4=BE=E0=B4=82_?= =?UTF-8?Q?=E0=B4=95=E0=B4=BE=E0=B4=B0=E0=B4=A8=E0=B4=BE=E0=B4=9F=E0=B5=8D=E0=B4=9F=E0=B5=8D? Newsgroups: gmane.emacs.bugs Subject: bug#6639: 24.0.50; [PATCH]image-mode: Sliced Images cannot be scrolled up Date: Thu, 15 Jul 2010 14:18:25 +0530 Message-ID: <87r5j5ruzq.fsf@shyam.laptop> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1279208786 16366 80.91.229.12 (15 Jul 2010 15:46:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Jul 2010 15:46:26 +0000 (UTC) To: 6639@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 15 17:46:24 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OZQdj-0006JH-9o for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Jul 2010 17:46:23 +0200 Original-Received: from localhost ([127.0.0.1]:53920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZQdj-0007ld-25 for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Jul 2010 11:46:23 -0400 Original-Received: from [140.186.70.92] (port=59205 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZOz8-0000Cb-OP for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 10:00:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZOz7-0007SB-8f for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 10:00:22 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48157) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZOz7-0007Rw-7A for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 10:00:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OZOdV-0002Gp-Sg; Thu, 15 Jul 2010 09:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: shyam@swathanthran.in (Shyam | =?UTF-8?Q?=E0=B4=B6=E0=B5=8D=E0=B4=AF=E0=B4=BE=E0=B4=82_?= =?UTF-8?Q?=E0=B4=95=E0=B4=BE=E0=B4=B0=E0=B4=A8=E0=B4=BE=E0=B4=9F=E0=B5=8D=E0=B4=9F=E0=B5=8D?= | Karanatt) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Jul 2010 13:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6639 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12792010768719 (code B ref -1); Thu, 15 Jul 2010 13:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Jul 2010 13:37:56 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZOdP-0002Ga-Qw for submit@debbugs.gnu.org; Thu, 15 Jul 2010 09:37:56 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZK7K-00083a-30 for submit@debbugs.gnu.org; Thu, 15 Jul 2010 04:48:31 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:57695) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OZK7U-0005Dm-1m for submit@debbugs.gnu.org; Thu, 15 Jul 2010 04:48:40 -0400 Original-Received: from [140.186.70.92] (port=46385 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZK7R-0003z2-I4 for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 04:48:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZK7P-0003fi-RT for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 04:48:37 -0400 Original-Received: from oakford.webserversystems.com ([74.54.107.139]:35619) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZK7P-0003fE-MX for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 04:48:35 -0400 Original-Received: from [117.204.84.84] (helo=shyam.laptop.shyam.laptop) by oakford.webserversystems.com with esmtpa (Exim 4.69) (envelope-from ) id 1OZK7K-00021y-LM for bug-gnu-emacs@gnu.org; Thu, 15 Jul 2010 03:48:31 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - oakford.webserversystems.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - swathanthran.in X-Source: X-Source-Args: X-Source-Dir: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Thu, 15 Jul 2010 09:37:54 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 15 Jul 2010 09:38:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 15 Jul 2010 11:46:14 -0400 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38560 --=-=-= trying to scroll up a sliced image, shows an error, "image-next-line: Invalid image specification" Steps to reproduce the error: 1)Open a pdf file in doc-view mode, and slice the image by pressing "s s"( i.e doc-view-set-slice), and giving the parameters. 2)scroll the page with C-n or image-next-line or image-scroll-up That shows the error message "image-next-line: Invalid image specification" OR 1)open an image file "~/test-image.png", or insert an image file to a buffer with: (insert-image (create-image "~/test-image.png")). 2) set, slice property for the image with add-text-properties function, for example: (let ((inhibit-read-only t) (X 50) (Y 50) (WIDTH 300) (HEIGHT 300)) (add-text-properties (point-min) (point-max) `(display (,(list 'slice X Y WIDTH HEIGHT) (image :type png :file "~/test-image.png"))))) 3)Scroll up the image by pressing C-n(i.e image-next-line) or M-x image-scroll-up that shows the following messages: image-next-line: Invalid image specification Or with (setq debug-on-error t) you get this: Debugger entered--Lisp error: (error "Invalid image specification") image-size(((slice 50 50 300 300) (image :type png :file "~/page-15.png"))) image-next-line(1) call-interactively(image-next-line nil nil) image-next-line in image-mode.el is relying on function image-size, which is to be fed with the image display property of the form (image ...). But if the image is sliced, it will have (slice ..) display property attached, which image-next-line is not taking care of. The patch attached, checks if it is a an image property. If there is slice property, it takes the image height from the slice property instead. It also won't mind having other display properties than image and slice too to be included on display properties, as it assoc's the value of image and slice. I saw the bug while reading ebooks on doc-view with margins sliced out. Happy Hacking Shyam K In GNU Emacs 24.0.50.2 (i686-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-06-01 on shyam.laptop Windowing system distributor `The X.Org Foundation', version 11.0.10801902 configured using `configure '--prefix=/usr/'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=image-mode_image-next-line.patch Content-Description: Patch for image-mode.el # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: shyam@swathanthran.in-20100715075217-cvwlhocdru9xcxkh # author: Shyam Karanatt # target_branch: file:///media/sda5/home/shyam/bazaar-\ # emacs/emacs/clean-trunk/ # testament_sha1: d49bcb73c9113f671bfbafd26c333a809b85cbec # timestamp: 2010-07-15 13:29:40 +0530 # base_revision_id: yamaoka@jpl.org-20100715005613-1hdb4741v79szq8v # # Begin patch === modified file 'lisp/image-mode.el' --- lisp/image-mode.el 2010-07-14 15:57:54 +0000 +++ lisp/image-mode.el 2010-07-15 07:52:17 +0000 @@ -157,9 +157,15 @@ ((< n 0) (image-set-window-vscroll (max 0 (+ (window-vscroll) n)))) (t - (let* ((image (image-get-display-property)) + (let* ((image-display (image-get-display-property)) + (image (if (eq (car image-display) 'image) + image-display + (assoc 'image image-display))) + (slice (assoc 'slice image-display)) (edges (window-inside-edges)) (win-height (- (nth 3 edges) (nth 1 edges))) - (img-height (ceiling (cdr (image-size image))))) + (img-height (if slice + (nth 4 slice) + (ceiling (cdr (image-size image)))))) (image-set-window-vscroll (min (max 0 (- img-height win-height)) (+ n (window-vscroll)))))))) --=-=-=--