unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search
@ 2017-01-31 17:56 Eric Hanchrow
  2017-02-01  0:23 ` Juri Linkov
  2017-02-14  0:00 ` Juri Linkov
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Hanchrow @ 2017-01-31 17:56 UTC (permalink / raw)
  To: 25591

[-- Attachment #1: Type: text/plain, Size: 6659 bytes --]

I don't know if this is a bug, but it's disappointing and inconvenient.

Start emacs with -Q, and type into the *scratch* buffer these 10 characters:

    I ate this

Now do C-a to move point to the beginning of the line.

Now replace the symbol "i" with "u":

   M-s _ i M-% u RET !

So far, so good: we are looking at

   U at this

which is correct.

Now try to repeat the replacement:

   C-a M-% RET !

This changes the "i" in "this" to a u, even though that "i" isn't an
independent symbol.  I was hoping that it would do nothing.



In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu)
 of 2017-01-12 built on dev-dsk-erichan-2b-i-833ca944.us-west-2.amazon.com
Repository revision: f0eb70d8935be90f7c03e187c12d9b60e7214cc6
Configured using:
 'configure --with-x-toolkit=no --without-x'

Configured features:
JPEG SOUND GPM NOTIFY LIBSELINUX LIBXML2 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  projectile-mode: t
  global-hl-line-mode: t
  savehist-mode: t
  shell-dirtrack-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  ido-everywhere: t
  diff-auto-refine-mode: t
  which-function-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-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:
Saving file
/local/home/erichan/git-repositories/work/EMSEscalationService/src/EMSEscalationService/ems_escalation_service/ticket_status_synchronizer.py...
Wrote
/local/home/erichan/git-repositories/work/EMSEscalationService/src/EMSEscalationService/ems_escalation_service/ticket_status_synchronizer.py
Discard hunk? (y or n) y [2 times]
Mark set [2 times]
Replaced 6 occurrences
Saving file
/local/home/erichan/git-repositories/work/EMSEscalationService/src/EMSEscalationService/ems_escalation_service/ticket_status_synchronizer.py...
Wrote
/local/home/erichan/git-repositories/work/EMSEscalationService/src/EMSEscalationService/ems_escalation_service/ticket_status_synchronizer.py
Quit
compilation-arguments is ((git  log -1 --oneline ; export
ENVROOT=$(brazil-bootstrap --environmentType test-runtime); export
BRAZIL_CONFIG="--root $ENVROOT"; $ENVROOT/bin/python -m pytest --cov-report
term-missing -rsx --showlocals )  compilation-mode nil nil)
compilation-arguments looks like a brazil thang; turning off font-lock-mode

Load-path shadows:
None found.

Features:
(shadow mail-extr emacsbug sendmail ruby-mode conf-mode magit-extras
sh-script smie executable network-stream nsm starttls url-http url-gw
url-cache url-auth disp-table url-handlers tabify man sort ispell
nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs git-rebase magit-ediff
compare-w find-dired twb-find-dired log-view vc vc-dispatcher
tramp-cache etags xref project esh-var esh-io esh-cmd esh-opt esh-ext
esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util image
jka-compr ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff dired-aux wdired dabbrev yasnippet
magit-obsolete magit-blame magit-stash magit-bisect magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-branch
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert
magit-process magit-margin magit-mode magit-git crm magit-section
magit-popup git-commit magit-utils log-edit message rfc822 mml mml-sec
epg mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader pcvs-util add-log with-editor
async-bytecomp async server dash ffap projectile misearch multi-isearch
hl-line term/xterm xterm amz-bmds amz-shell amz-brazil-cache savehist
bookmark flymake python tramp-sh tramp tramp-compat tramp-loaddefs
trampver shell json map edit-list browse-kill-ring advice eww mm-url
gnus gnus-ems nnheader mail-utils url-queue url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse url-vars mailcap shr dom subr-x browse-url ws-butler wat
derived autorevert filenotify recentf tree-widget ido vc-git diff-mode
ibuf-ext ibuffer ibuf-macs dired-x dired grep compile find-func edmacro
kmacro rotate face-remap which-func imenu s ucs-normalize amz-common
amz-p4 amz-auto tls gnutls erc-list erc-menu erc-join erc-ring
erc-networks erc-pcomplete pcomplete comint regexp-opt ansi-color ring
erc-track erc-match erc-button wid-edit erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat format-spec auth-source cl-seq
eieio eieio-core gnus-util time-date mm-util help-fns mail-prsvr
password-cache thingatpt pp use-package diminish cl-macs cl bind-key
easy-mmode finder-inf info tool-bar package epg-config seq byte-opt gv
bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs
pcase cl-lib rx 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 inotify multi-tty
make-network-process emacs)

Memory information:
((conses 16 593724 53943)
 (symbols 48 51673 0)
 (miscs 40 7554 4507)
 (strings 32 123285 13115)
 (string-bytes 1 3844947)
 (vectors 16 64681)
 (vector-slots 8 999591 77052)
 (floats 8 703 3997)
 (intervals 56 28388 4733)
 (buffers 976 125)
 (heap 1024 38541 3559))

[-- Attachment #2: Type: text/html, Size: 8638 bytes --]

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

* bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search
  2017-01-31 17:56 bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search Eric Hanchrow
@ 2017-02-01  0:23 ` Juri Linkov
  2017-02-14  0:00 ` Juri Linkov
  1 sibling, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2017-02-01  0:23 UTC (permalink / raw)
  To: Eric Hanchrow; +Cc: 25591

> I don't know if this is a bug, but it's disappointing and inconvenient.
>
> Start emacs with -Q, and type into the *scratch* buffer these 10 characters:
>
>     I ate this
>
> Now do C-a to move point to the beginning of the line.
>
> Now replace the symbol "i" with "u":
>
>    M-s _ i M-% u RET !
>
> So far, so good: we are looking at
>
>    U at this
>
> which is correct.
>
> Now try to repeat the replacement:
>
>    C-a M-% RET !
>
> This changes the "i" in "this" to a u, even though that "i" isn't an
> independent symbol.  I was hoping that it would do nothing.

Thanks for the feature request, or you might call it a bug
since it doesn't do what you expect.

We discussed this for isearch a while ago, where the proposal was
for ‘C-s C-s’ to reuse the search type from a previous search.
You rightfully want the same for ‘M-% RET’ to reuse a previous
replacement type.

The main problem in https://debbugs.gnu.org/22479 was to find a suitable
data structure complementary to the existing history lists to keep
search/replacement meta-data as well.





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

* bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search
  2017-01-31 17:56 bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search Eric Hanchrow
  2017-02-01  0:23 ` Juri Linkov
@ 2017-02-14  0:00 ` Juri Linkov
  2017-02-14  0:32   ` Eric Hanchrow
  1 sibling, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2017-02-14  0:00 UTC (permalink / raw)
  To: Eric Hanchrow; +Cc: 25591

> I don't know if this is a bug, but it's disappointing and inconvenient.
>
> Start emacs with -Q, and type into the *scratch* buffer these 10 characters:
>
>     I ate this
>
> Now do C-a to move point to the beginning of the line.
>
> Now replace the symbol "i" with "u":
>
>    M-s _ i M-% u RET !
>
> So far, so good: we are looking at
>
>    U at this
>
> which is correct.
>
> Now try to repeat the replacement:
>
>    C-a M-% RET !
>
> This changes the "i" in "this" to a u, even though that "i" isn't an
> independent symbol.  I was hoping that it would do nothing.

But what if you mistakenly invoked the replacement in wrong mode,
and want to repeat the same replacement in the right one?  E.g.
first entered replacement strings in regexp replacement mode:

C-M-% i RET u RET

and then realized you want apply the same replacement strings
in word mode:

C-u M-% RET

Should it perform word replacement as explicitly stated
by the prefix arg C-u, or use a previous replacement type
(in this case, regexp replacement) remembered in the
replacement history?





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

* bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search
  2017-02-14  0:00 ` Juri Linkov
@ 2017-02-14  0:32   ` Eric Hanchrow
  2017-02-14 23:11     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Hanchrow @ 2017-02-14  0:32 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 25591

[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]

Hm, I wasn't aware that M-% interprets the prefix arg to mean "word
replace".  My instinct says it should honor the explicit C-u.

On Tue, Feb 14, 2017 at 12:09 AM Juri Linkov <juri@linkov.net> wrote:

> I don't know if this is a bug, but it's disappointing and inconvenient.
>
> Start emacs with -Q, and type into the *scratch* buffer these 10
characters:
>
>     I ate this
>
> Now do C-a to move point to the beginning of the line.
>
> Now replace the symbol "i" with "u":
>
>    M-s _ i M-% u RET !
>
> So far, so good: we are looking at
>
>    U at this
>
> which is correct.
>
> Now try to repeat the replacement:
>
>    C-a M-% RET !
>
> This changes the "i" in "this" to a u, even though that "i" isn't an
> independent symbol.  I was hoping that it would do nothing.

But what if you mistakenly invoked the replacement in wrong mode,
and want to repeat the same replacement in the right one?  E.g.
first entered replacement strings in regexp replacement mode:

C-M-% i RET u RET

and then realized you want apply the same replacement strings
in word mode:

C-u M-% RET

Should it perform word replacement as explicitly stated
by the prefix arg C-u, or use a previous replacement type
(in this case, regexp replacement) remembered in the
replacement history?

[-- Attachment #2: Type: text/html, Size: 2731 bytes --]

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

* bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search
  2017-02-14  0:32   ` Eric Hanchrow
@ 2017-02-14 23:11     ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2017-02-14 23:11 UTC (permalink / raw)
  To: Eric Hanchrow; +Cc: 25591

> Hm, I wasn't aware that M-% interprets the prefix arg to mean "word
> replace".  My instinct says it should honor the explicit C-u.

Even in your example, wouldn't it be confusing if after typing

C-a M-% RET !

and seeing this non-symbol prompt

Query replace (default i → u):

replacement will still be symbol-based
(because the previous replacement was symbol-based)?

To be not confusing the prompt should show explicitly
the replacement type, e.g. in case of symbol replacement:

Query replace symbol (default i → u):

When we'll store the replacement type in the history,
then maybe display previous replacements in the minibuffer like

Query replace (default symbol i → u):

then typing M-p will pull a previous replacement into the minibuffer,
e.g. word-based:

Query replace (default symbol i → u): word foo → bar

where “word” is intangible part of the prompt.

>>> I don't know if this is a bug, but it's disappointing and inconvenient.
>>>
>>> Start emacs with -Q, and type into the *scratch* buffer these 10 characters:
>>>
>>>     I ate this
>>>
>>> Now do C-a to move point to the beginning of the line.
>>>
>>> Now replace the symbol "i" with "u":
>>>
>>>    M-s _ i M-% u RET !
>>>
>>> So far, so good: we are looking at
>>>
>>>    U at this
>>>
>>> which is correct.
>>>
>>> Now try to repeat the replacement:
>>>
>>>    C-a M-% RET !
>>>
>>> This changes the "i" in "this" to a u, even though that "i" isn't an
>>> independent symbol.  I was hoping that it would do nothing.
>>
>> But what if you mistakenly invoked the replacement in wrong mode,
>> and want to repeat the same replacement in the right one?  E.g.
>> first entered replacement strings in regexp replacement mode:
>>
>> C-M-% i RET u RET
>>
>> and then realized you want apply the same replacement strings
>> in word mode:
>>
>> C-u M-% RET
>>
>> Should it perform word replacement as explicitly stated
>> by the prefix arg C-u, or use a previous replacement type
>> (in this case, regexp replacement) remembered in the
>> replacement history?





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

end of thread, other threads:[~2017-02-14 23:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 17:56 bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search Eric Hanchrow
2017-02-01  0:23 ` Juri Linkov
2017-02-14  0:00 ` Juri Linkov
2017-02-14  0:32   ` Eric Hanchrow
2017-02-14 23:11     ` Juri Linkov

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