GNU bug report logs -
#24305
25.1; dired can't replace '\n' in file content (dired-do-find-regexp-and-replace)
Previous Next
Reported by: Max Canal <mc.maxcanal <at> gmail.com>
Date: Wed, 24 Aug 2016 22:58:02 UTC
Severity: normal
Merged with 23426
Found in versions 25.0.93, 25.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24305 in the body.
You can then email your comments to 24305 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24305
; Package
emacs
.
(Wed, 24 Aug 2016 22:58:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Max Canal <mc.maxcanal <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 24 Aug 2016 22:58:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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! :)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24305
; Package
emacs
.
(Thu, 25 Aug 2016 05:37:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 24305 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24305
; Package
emacs
.
(Thu, 25 Aug 2016 14:34:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 24305 <at> debbugs.gnu.org (full text, mbox):
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Thu, 25 Aug 2016 14:35:52 +0900 (JST)
> Cc: mc.maxcanal <at> gmail.com, dgutov <at> yandex.ru, tino.calancha <at> 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).
Forcibly Merged 23426 24305.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 25 Aug 2016 15:35:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 23 Sep 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.