From unknown Sun Jun 15 07:59:27 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#6639 <6639@debbugs.gnu.org> To: bug#6639 <6639@debbugs.gnu.org> Subject: Status: 24.0.50; [PATCH]image-mode: Sliced Images cannot be scrolled up Reply-To: bug#6639 <6639@debbugs.gnu.org> Date: Sun, 15 Jun 2025 14:59:27 +0000 retitle 6639 24.0.50; [PATCH]image-mode: Sliced Images cannot be scrolled up reassign 6639 emacs submitter 6639 shyam@swathanthran.in (Shyam | =E0=B4=B6=E0=B5=8D=E0=B4=AF= =E0=B4=BE=E0=B4=82 =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) severity 6639 normal tag 6639 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 15 09:37:56 2010 Received: (at submit) by debbugs.gnu.org; 15 Jul 2010 13:37:56 +0000 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 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.1 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 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 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 From: shyam@swathanthran.in (Shyam | =?utf-8?B?4LS24LWN4LSv4LS+4LSCIA==?= =?utf-8?B?4LSV4LS+4LSw4LSo4LS+4LSf4LWN4LSf4LWN?= | Karanatt) To: bug-gnu-emacs@gnu.org Subject: 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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) --=-=-= 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)))))))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 16 09:56:57 2010 Received: (at 6639) by debbugs.gnu.org; 16 Jul 2010 13:56:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZlPM-0005BK-Hg for submit@debbugs.gnu.org; Fri, 16 Jul 2010 09:56:57 -0400 Received: from oakford.webserversystems.com ([74.54.107.139]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZj8a-00047w-Rn for 6639@debbugs.gnu.org; Fri, 16 Jul 2010 07:31:29 -0400 Received: from [117.204.80.23] (helo=shyam.laptop.shyam.laptop) by oakford.webserversystems.com with esmtpa (Exim 4.69) (envelope-from ) id 1OZj8m-00034c-DA for 6639@debbugs.gnu.org; Fri, 16 Jul 2010 06:31:41 -0500 From: shyam@swathanthran.in (Shyam | =?utf-8?B?4LS24LWN4LSv4LS+4LSCIA==?= =?utf-8?B?4LSV4LS+4LSw4LSo4LS+4LSf4LWN4LSf4LWN?= | Karanatt) To: 6639@debbugs.gnu.org Subject: [PATCH]image-mode: making image-mode functions to consider slice property Date: Fri, 16 Jul 2010 17:01:28 +0530 Message-ID: <87eif3hddb.fsf@shyam.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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 - debbugs.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-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: 6639 X-Mailman-Approved-At: Fri, 16 Jul 2010 09:56:54 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.9 (---) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Transfer-Encoding: quoted-printable I forgot to look for other calls to image-size. Looking through the whole emacs code, only image-mode seems to be making calls to image-size, which can possibly be including slice property. So Now, I wrote a wrapper over image-size function which calculates size From=20slice property if available, or calls image-size if, only image property is available. The patch is attached. Happy Hacking Shyam K --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=image-mode_image-display-size.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch for making image-mode functions to consider slice property # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: shyam@swathanthran.in-20100716100307-6y92sw2p0xmgd7mj # author: Shyam Karanatt # testament_sha1: 71e9837d7961814d5fcb0f63955e2485584ea1e7 # timestamp: 2010-07-16 16:32:50 +0530 # base_revision_id: yamaoka@jpl.org-20100715005613-1hdb4741v79szq8v #=20 # Begin patch =3D=3D=3D modified file 'lisp/image-mode.el' =2D-- lisp/image-mode.el 2010-07-14 15:57:54 +0000 +++ lisp/image-mode.el 2010-07-16 10:03:07 +0000 @@ -128,6 +128,28 @@ =20 (declare-function image-size "image.c" (spec &optional pixels frame)) =20 +(defun image-display-size (spec &optional pixels frame) +"Wrapper around image-size to considers \(slice ..\) display property in S= PEC. +If SPEC is an image display property, call `image-size' with arguments. +If SPEC is list of properties having image and slice properties in it,=20 +calculate size from slice.=20 +If slice is not in the list but image is, call `image-size' with image. +If SPEC is a list without having image display property in it,=20 + error about invalid image specification." + (if (eq (car spec) 'image) + (image-size spec pixels frame) + (let ((image (assoc 'image spec)) + (slice (assoc 'slice spec))) + (cond ((and image slice) + (if pixels=20 + (cons (nth 3 slice) (nth 4 slice)) + (cons (/ (float (nth 3 slice)) (frame-char-width frame)) + (/ (float (nth 4 slice)) (frame-char-height frame))))) + (image + (image-size image pixels frame)) + (t + (error "Invalid image specification: %s" spec)))))) + (defun image-forward-hscroll (&optional n) "Scroll image in current window to the left by N character widths. Stop if the right edge of the image is reached." @@ -139,7 +161,7 @@ (let* ((image (image-get-display-property)) (edges (window-inside-edges)) (win-width (- (nth 2 edges) (nth 0 edges))) =2D (img-width (ceiling (car (image-size image))))) + (img-width (ceiling (car (image-display-size image))))) (image-set-window-hscroll (min (max 0 (- img-width win-width)) (+ n (window-hscroll)))))))) =20 @@ -160,7 +182,7 @@ (let* ((image (image-get-display-property)) (edges (window-inside-edges)) (win-height (- (nth 3 edges) (nth 1 edges))) =2D (img-height (ceiling (cdr (image-size image))))) + (img-height (ceiling (cdr (image-display-size image))))) (image-set-window-vscroll (min (max 0 (- img-height win-height)) (+ n (window-vscroll)))))))) =20 @@ -233,7 +255,7 @@ (let* ((image (image-get-display-property)) (edges (window-inside-edges)) (win-width (- (nth 2 edges) (nth 0 edges))) =2D (img-width (ceiling (car (image-size image))))) + (img-width (ceiling (car (image-display-size image))))) (image-set-window-hscroll (max 0 (- img-width win-width))))) =20 (defun image-bob () @@ -248,9 +270,9 @@ (let* ((image (image-get-display-property)) (edges (window-inside-edges)) (win-width (- (nth 2 edges) (nth 0 edges))) =2D (img-width (ceiling (car (image-size image)))) + (img-width (ceiling (car (image-display-size image)))) (win-height (- (nth 3 edges) (nth 1 edges))) =2D (img-height (ceiling (cdr (image-size image))))) + (img-height (ceiling (cdr (image-display-size image))))) (image-set-window-hscroll (max 0 (- img-width win-width))) (image-set-window-vscroll (max 0 (- img-height win-height))))) =20 @@ -264,7 +286,7 @@ (interactive) (let* ((saved (frame-parameter nil 'image-mode-saved-size)) (display (image-get-display-property)) =2D (size (image-size display))) + (size (image-display-size display))) (if (and saved (eq (caar saved) (frame-width)) (eq (cdar saved) (frame-height))) --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBAgAGBQJMQEMQAAoJEBatuUAvO6Tr+38H/1uokgEmu7xG91/ZRsLVzOWL 2fQzodWsq6jiUu8LNYgv8YK0mp356pUyAAzpnAO+mD6z3OsaN/dNFOwyi7knknle sH1pfxSaLQf648jzW7DslVcY5bT85I6xpl2iQAEZRFQ4aAdKrzxFiaQl4QrS5tHg 9YjISTMzo1OYD5s6AO6d8YLgW+BtfvTpcMKLj92/6nlxXBWfno9whEj3X3hUYhHm asmXcPYjdq9iDeiN9Tb71K2HBY5PvJxYeqDdgi7qTi531nuaLnFfwptd4VZ/BD9G MaT6vPGDCkwXHxiw6hCX0sM8oQqoEkxLZKqt3pIyO5yj6QLSXM2eF2NdxPYvw3Q= =Br2f -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 17 17:51:12 2010 Received: (at 6639) by debbugs.gnu.org; 17 Jul 2010 21:51:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaFHr-0006VL-9P for submit@debbugs.gnu.org; Sat, 17 Jul 2010 17:51:11 -0400 Received: from pantheon-po45.its.yale.edu ([130.132.50.79]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaFHp-0006V4-M2 for 6639@debbugs.gnu.org; Sat, 17 Jul 2010 17:51:10 -0400 Received: from furry (173-14-147-246-NewEngland.hfc.comcastbusiness.net [173.14.147.246]) (authenticated bits=0) by pantheon-po45.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o6HLpQJx013204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 17 Jul 2010 17:51:26 -0400 Received: by furry (Postfix, from userid 1000) id D400FC013; Sat, 17 Jul 2010 17:51:25 -0400 (EDT) From: Chong Yidong To: shyam@swathanthran.in (Shyam | =?utf-8?B?4LS24LWN4LSv4LS+4LSCIOC0lQ==?= =?utf-8?B?4LS+4LSw4LSo4LS+4LSf4LWN4LSf4LWN?= | Karanatt) Subject: Re: bug#6639: [PATCH]image-mode: making image-mode functions to consider slice property References: <87r5j5ruzq.fsf@shyam.laptop> <87eif3hddb.fsf@shyam.laptop> Date: Sat, 17 Jul 2010 17:51:25 -0400 In-Reply-To: <87eif3hddb.fsf@shyam.laptop> (shyam@swathanthran.in's message of "Fri, 16 Jul 2010 17:01:28 +0530") Message-ID: <8739vh6ale.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6639 Cc: 6639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) shyam@swathanthran.in (Shyam | =E0=B4=B6=E0=B5=8D=E0=B4=AF=E0=B4=BE=E0=B4= =82 =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) writes: > I forgot to look for other calls to image-size. Looking through the > whole emacs code, only image-mode seems to be making calls to > image-size, which can possibly be including slice property. > > So Now, I wrote a wrapper over image-size function which calculates size > From slice property if available, or calls image-size if, only image > property is available. > > The patch is attached. Thanks. I have committed your patch to the emacs-23 branch. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 17 17:51:24 2010 Received: (at control) by debbugs.gnu.org; 17 Jul 2010 21:51:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaFI4-0006Vw-I1 for submit@debbugs.gnu.org; Sat, 17 Jul 2010 17:51:24 -0400 Received: from pantheon-po44.its.yale.edu ([130.132.50.78]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaFI2-0006Vd-Ae for control@debbugs.gnu.org; Sat, 17 Jul 2010 17:51:22 -0400 Received: from furry (173-14-147-246-NewEngland.hfc.comcastbusiness.net [173.14.147.246]) (authenticated bits=0) by pantheon-po44.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o6HLpdFZ007402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 17 Jul 2010 17:51:39 -0400 Received: by furry (Postfix, from userid 1000) id 1EA6AC013; Sat, 17 Jul 2010 17:51:39 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 6639 Date: Sat, 17 Jul 2010 17:51:39 -0400 Message-ID: <87vd8d22vo.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) close 6639 thanks From unknown Sun Jun 15 07:59:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 15 Aug 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator