unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14637: recent viper-mode regression
@ 2013-06-16 22:59 Jim Meyering
  2013-06-18 20:25 ` Juri Linkov
       [not found] ` <handler.14637.D14637.13715874305307.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Jim Meyering @ 2013-06-16 22:59 UTC (permalink / raw)
  To: 14637

Hello,
I periodically use built-from-git emacs and noticed that in the
last couple of weeks a common command in viper-mode, "!Ggrep ..."
had begun to malfunction.  Normally, !G<cmd> runs CMD on the contents
of the buffer (from the line with point to EOF) and replaces those
lines with the output of the command.

Now, however, it merely appends the result, instead of replacing the
source lines.

E.g., if you run this,

  seq 10 > k; emacs -q -nw -f viper-mode k

then type "!Ggrep 3", you'll end up with this in your buffer:
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  3

Instead, the buffer should (and used to) contain this single line:

  3





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

* bug#14637: recent viper-mode regression
  2013-06-16 22:59 bug#14637: recent viper-mode regression Jim Meyering
@ 2013-06-18 20:25 ` Juri Linkov
  2013-06-19  0:28   ` Stefan Monnier
       [not found] ` <handler.14637.D14637.13715874305307.notifdone@debbugs.gnu.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2013-06-18 20:25 UTC (permalink / raw)
  To: Jim Meyering; +Cc: 14637-done

> Now, however, it merely appends the result, instead of replacing the
> source lines.

I know nothing about viper-mode, but apparently this regression is
caused by revno:112695 that now requires for the callers of
`shell-command-on-region' to explicitly specify its argument REPLACE
as documented in its docstring for a long time.  However, this fix
breaks such callers that don't care about providing the correct
non-nil REPLACE argument to behave according to the documentation.
Grepping for `shell-command-on-region' revealed the exhaustive list
of the callers that are fixed now with this patch to set both args
OUTPUT-BUFFER and REPLACE to the same value in unison:

=== modified file 'lisp/emulation/vi.el'
--- lisp/emulation/vi.el	2012-09-17 05:41:04 +0000
+++ lisp/emulation/vi.el	2013-06-18 20:17:20 +0000
@@ -1148,7 +1148,8 @@ (defun vi-shell-op (motion-command arg &
       (cond ((null shell-command)
 	     (setq shell-command (read-string "!" nil))
 	     (setq vi-last-shell-command shell-command)))
-      (shell-command-on-region begin end shell-command (not (vi-prefix-char-value arg)))
+      (shell-command-on-region begin end shell-command (not (vi-prefix-char-value arg))
+			                               (not (vi-prefix-char-value arg)))
       t)))
 
 (defun vi-shift-op (motion-command arg amount)

=== modified file 'lisp/emulation/vip.el'
--- lisp/emulation/vip.el	2013-03-12 02:08:21 +0000
+++ lisp/emulation/vip.el	2013-06-18 20:17:24 +0000
@@ -775,7 +775,7 @@ (defun vip-execute-com (m-com val com)
 		  (if (= com ?!)
 		      (setq vip-last-shell-com (vip-read-string "!"))
 		    vip-last-shell-com)
-		  t)))
+		  t t)))
 	      ((= com ?=)
 	       (save-excursion
 		 (set-mark vip-com-point)
@@ -3042,7 +3042,7 @@ (defun ex-command ()
 	  (goto-char beg)
 	  (set-mark end)
 	  (vip-enlarge-region (point) (mark))
-	  (shell-command-on-region (point) (mark) command t))
+	  (shell-command-on-region (point) (mark) command t t))
 	(goto-char beg)))))
 
 (defun ex-line-no ()

=== modified file 'lisp/emulation/viper-cmd.el'
--- lisp/emulation/viper-cmd.el	2013-05-22 03:21:30 +0000
+++ lisp/emulation/viper-cmd.el	2013-06-18 20:17:31 +0000
@@ -1548,7 +1548,7 @@ (defun viper-exec-bang (m-com com)
 		(car viper-shell-history)
 		))
        viper-last-shell-com)
-     t)))
+     t t)))
 
 (defun viper-exec-equals (m-com com)
   (save-excursion

=== modified file 'lisp/emulation/viper-ex.el'
--- lisp/emulation/viper-ex.el	2013-05-22 03:21:30 +0000
+++ lisp/emulation/viper-ex.el	2013-06-18 20:17:34 +0000
@@ -2176,7 +2176,7 @@ (defun ex-command ()
 	  (goto-char beg)
 	  (set-mark end)
 	  (viper-enlarge-region (point) (mark t))
-	  (shell-command-on-region (point) (mark t) command t))
+	  (shell-command-on-region (point) (mark t) command t t))
 	(goto-char beg)))))
 
 (defun ex-compile ()

=== modified file 'lisp/mh-e/mh-alias.el'
--- lisp/mh-e/mh-alias.el	2013-01-01 09:11:05 +0000
+++ lisp/mh-e/mh-alias.el	2013-06-18 20:17:37 +0000
@@ -141,7 +141,7 @@ (defun mh-alias-local-users ()
             (insert-file-contents "/etc/passwd")))
        ((stringp mh-alias-local-users)
         (insert mh-alias-local-users "\n")
-        (shell-command-on-region (point-min) (point-max) mh-alias-local-users t)
+        (shell-command-on-region (point-min) (point-max) mh-alias-local-users t t)
         (goto-char (point-min))))
       (while  (< (point) (point-max))
         (cond






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

* bug#14637: recent viper-mode regression
  2013-06-18 20:25 ` Juri Linkov
@ 2013-06-19  0:28   ` Stefan Monnier
  2013-06-19 20:53     ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-06-19  0:28 UTC (permalink / raw)
  To: 14637; +Cc: jim

> Grepping for `shell-command-on-region' revealed the exhaustive list
> of the callers that are fixed now with this patch to set both args
> OUTPUT-BUFFER and REPLACE to the same value in unison:

Do all the callers need to be fixed?  Most of them?  A minority only?
If it's not just a minority, then maybe the better fix is to revert
revno:112695 (or at least change it) so that existing code doesn't need
to be changed.


        Stefan





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

* bug#14637: closed (Re: bug#14637: recent viper-mode regression)
       [not found] ` <handler.14637.D14637.13715874305307.notifdone@debbugs.gnu.org>
@ 2013-06-19  8:56   ` Jim Meyering
  0 siblings, 0 replies; 6+ messages in thread
From: Jim Meyering @ 2013-06-19  8:56 UTC (permalink / raw)
  To: 14637

GNU bug Tracking System wrote:
> Your bug report
>
> #14637: recent viper-mode regression
>
> which was filed against the emacs package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 14637@debbugs.gnu.org.

Confirmed.
Thank you for tracking that down and fixing it!





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

* bug#14637: recent viper-mode regression
  2013-06-19  0:28   ` Stefan Monnier
@ 2013-06-19 20:53     ` Juri Linkov
  2013-06-20  2:02       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2013-06-19 20:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14637

>> Grepping for `shell-command-on-region' revealed the exhaustive list
>> of the callers that are fixed now with this patch to set both args
>> OUTPUT-BUFFER and REPLACE to the same value in unison:
>
> Do all the callers need to be fixed?  Most of them?  A minority only?
> If it's not just a minority, then maybe the better fix is to revert
> revno:112695 (or at least change it) so that existing code doesn't need
> to be changed.

I fixed all the callers that missed the required REPLACE arg:
5 were in vi mode, and 1 in mh-e.  They are just a minority
out of total 25 occurrences of `shell-command-on-region'.





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

* bug#14637: recent viper-mode regression
  2013-06-19 20:53     ` Juri Linkov
@ 2013-06-20  2:02       ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-06-20  2:02 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 14637

> I fixed all the callers that missed the required REPLACE arg:
> 5 were in vi mode, and 1 in mh-e.  They are just a minority
> out of total 25 occurrences of `shell-command-on-region'.

OK, then, go ahead, thank you,


        Stefan





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

end of thread, other threads:[~2013-06-20  2:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-16 22:59 bug#14637: recent viper-mode regression Jim Meyering
2013-06-18 20:25 ` Juri Linkov
2013-06-19  0:28   ` Stefan Monnier
2013-06-19 20:53     ` Juri Linkov
2013-06-20  2:02       ` Stefan Monnier
     [not found] ` <handler.14637.D14637.13715874305307.notifdone@debbugs.gnu.org>
2013-06-19  8:56   ` bug#14637: closed (Re: bug#14637: recent viper-mode regression) Jim Meyering

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).