unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24305: 25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace)
@ 2016-08-24 22:17 Max Canal
  2016-08-25  5:35 ` Tino Calancha
  0 siblings, 1 reply; 3+ messages in thread
From: Max Canal @ 2016-08-24 22:17 UTC (permalink / raw)
  To: 24305






In GNU Emacs 25.1.2 (x86_64-unknown-linux-gnu)
 of 2016-08-15 built on blackbox
Repository revision: 8d681476bd44a2f843030579a5bbf5a248488afb
System Description:	Trisquel GNU/Linux 7.0, Belenos

Configured using:
 'configure --without-sound --without-x --without-xpm --without-jpeg
 --without-png --without-rsvg --without-imagemagick --without-tiff
 --without-gif'

Configured features:
GPM DBUS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 ZLIB

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase
cl-lib mail-prsvr mail-utils regexp-opt dired term/xterm xterm time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list newcomment elisp-mode lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify multi-tty make-network-process emacs)

Memory information:
((conses 16 87307 7050)
 (symbols 48 18871 0)
 (miscs 40 46 88)
 (strings 32 14467 4505)
 (string-bytes 1 413195)
 (vectors 16 9723)
 (vector-slots 8 380240 16732)
 (floats 8 148 265)
 (intervals 56 317 0)
 (buffers 976 20)
 (heap 1024 34761 640))




Description:
Trying to replace '\n' (inserted with C-q C-j) in Dired mode with Q
(dired-do-find-regexp-and-replace) does not work anymore. 
This was tested in v25.1.2 (rc2) with -Q flag

Good luck with that, let me know if you need more infos! :)





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

* bug#24305: 25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace)
  2016-08-24 22:17 bug#24305: 25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace) Max Canal
@ 2016-08-25  5:35 ` Tino Calancha
  2016-08-25 14:33   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Tino Calancha @ 2016-08-25  5:35 UTC (permalink / raw)
  To: 24305; +Cc: mc.maxcanal, dgutov, tino.calancha


Thank you for the report.

As reported in NEWS file, since Emas 25.1 the key 'Q' is bound
to a new command 'dired-do-find-regexp-and-replace'.  The key 'A'
is also bound to a new command: dired-do-find-regexp.

The old commands use Emacs regexp engine, while the new commands
use grep: this may cause that regexps which previously
matched results, with the new commands don't match anymore.

That seems the case in your example: the old command matches '\n', but
the new one cannot:
;; old command
(let ((file "/tmp/bug24305/file"))
   (with-temp-file file
     (insert "\n"))
   (dired-other-window (file-name-directory file))
   (dired-goto-file file)
   (when (null (dired-do-search "\n"))
     (message "Found new line!")))

;; new command
(let ((file "/tmp/bug24305/file"))
   (with-temp-file file
     (insert "\n"))
   (dired-other-window (file-name-directory file))
   (dired-goto-file file)
   (save-excursion (dired-mark 1))
   (dired-do-find-regexp "\n"))

In your example, 'dired-do-find-regexp-and-replace' internally builds
the following `find' command (using `xref--rgrep-command'):
find /tmp/bug24305  -type f \( -iname file \) -exec grep --color -i -nH -e 
'\n' {} +

As you have noticed, this command fails.
Following commands would work:
find /tmp/bug24305  -type f \( -iname file \) -exec grep --color -i -nH -e 
'^$' {} +
find /tmp/bug24305  -type f \( -iname file \) -exec  grep --color -i -nH 
-e '
' {} +

Maybe `xref--rgrep-command' might be updated to account for this?

In the meantime, as a temporary solution, you might wish to restore the
previous bindings.  For instance, adding following in your .emacs file:
(require 'dired-aux)
(define-key dired-mode-map "A" 'dired-do-search)
(define-key dired-mode-map "Q" 'dired-do-query-replace-regexp)

Tino






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

* bug#24305: 25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace)
  2016-08-25  5:35 ` Tino Calancha
@ 2016-08-25 14:33   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2016-08-25 14:33 UTC (permalink / raw)
  To: Tino Calancha; +Cc: mc.maxcanal, 24305, dgutov

> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Thu, 25 Aug 2016 14:35:52 +0900 (JST)
> Cc: mc.maxcanal@gmail.com, dgutov@yandex.ru, tino.calancha@gmail.com
> 
> As reported in NEWS file, since Emas 25.1 the key 'Q' is bound
> to a new command 'dired-do-find-regexp-and-replace'.  The key 'A'
> is also bound to a new command: dired-do-find-regexp.
> 
> The old commands use Emacs regexp engine, while the new commands
> use grep: this may cause that regexps which previously
> matched results, with the new commands don't match anymore.
> 
> That seems the case in your example: the old command matches '\n', but
> the new one cannot:

The doc string says:

  REGEXP should use constructs supported by your local ‘grep’ command.

IOW, the '\n' should be replaced by something Grep supports, like $ or
some such (I don't think I understand the exact use case to give a
100% accurate advice).

In any case, this is a duplicate of bug#23426, which see (well, the
beginning, before the discussion went haywire).





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

end of thread, other threads:[~2016-08-25 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 22:17 bug#24305: 25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace) Max Canal
2016-08-25  5:35 ` Tino Calancha
2016-08-25 14:33   ` Eli Zaretskii

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