all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: bug-gnu-emacs@gnu.org
Subject: bug#7488: 24.0.50; format-decode-region acts on whole buffer, not on region
Date: Mon, 29 Nov 2010 11:27:40 +0000	[thread overview]
Message-ID: <pvhpbp58z7wz.fsf@gmx.li> (raw)
In-Reply-To: <6A85A72454A944B98ADFC09FCA3AC821@us.oracle.com>

Drew Adams wrote:
> emacs -Q

> ;; On Windows, load cygwin-mount.el and setup-cygwin.el, from Emacs wiki:
> http://www.emacswiki.org/cgi-bin/wiki?action=index;match=%5C.(el%7Ctar)(%5C.gz)%
> 3F%24

format-decode-run-method seems to ignore the values of its region
arguments (assuming the buffer is narrowed maybe?)

Here's a patch:

From d1bc7ad648e75979169765d6384314a21c9dcf17 Mon Sep 17 00:00:00 2001
From: Lawrence Mitchell <wence@gmx.li>
Date: Mon, 29 Nov 2010 11:24:57 +0000
Subject: [PATCH] Make format-decode-run-method pay attention to region arguments.

Instead of assuming a narrowed buffer and apply the decoding method to
the whole buffer, use the passed in values of FROM and TO.
---
 lisp/ChangeLog |    6 ++++++
 lisp/format.el |    3 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 58fce7a..9a12f5e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-29  Lawrence Mitchell  <lawrence.mitchell@ed.ac.uk>
+
+	* format.el (format-decode-run-method): Use values of FROM and TO
+	rather than point-min and point-max to operate on the region
+	correctly.
+
 2010-11-15  Agustín Martín  <agustin.martin@hispalinux.es>
 
 	* textmodes/flyspell.el (flyspell-generic-progmode-verify):
diff --git a/lisp/format.el b/lisp/format.el
index 0436187..b4277ef 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -181,8 +181,7 @@ it should be a Lisp function.  Decoding is done for the given BUFFER."
 	;; We should perhaps go via a temporary buffer and copy it
 	;; back, in case of errors.
 	(if (and (zerop (save-window-excursion
-			  (shell-command-on-region (point-min) (point-max)
-						   method t t
+			  (shell-command-on-region from to method t t
 						   error-buff)))
 		 ;; gzip gives zero exit status with bad args, for instance.
 		 (zerop (with-current-buffer error-buff
-- 
1.7.2.2.180.g9841a.dirty






  reply	other threads:[~2010-11-29 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-26 17:34 bug#7488: 24.0.50; format-decode-region acts on whole buffer, not on region Drew Adams
2010-11-29 11:27 ` Lawrence Mitchell [this message]
2010-12-06 19:36   ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pvhpbp58z7wz.fsf@gmx.li \
    --to=wence@gmx.li \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.