GNU bug report logs - #39154
27.0.60; Use character history in zap-up-to-char

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 16 Jan 2020 18:50:01 UTC

Severity: wishlist

Found in version 27.0.60

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 39154 in the body.
You can then email your comments to 39154 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to juri <at> linkov.net, bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Thu, 16 Jan 2020 18:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to juri <at> linkov.net, bug-gnu-emacs <at> gnu.org. (Thu, 16 Jan 2020 18:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.60; Use character history in zap-up-to-char
Date: Thu, 16 Jan 2020 19:49:12 +0100
X-Debbugs-Cc: Juri Linkov <juri <at> linkov.net>
Severity: wishlist

While zapping I saw in the news about recent `zap-to-char' changes...
( I mean Emacs news, I don't watch TV! :-| )

We might want to extend that to cover `zap-up-to-char' as well; as many others,
I weardly use the former, but I often use the latter.

--8<-----------------------------cut here---------------start------------->8---
commit 5436b891aadaf649ae6ab3e204b74c76bfa4e6f8
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Thu Jan 16 19:30:03 2020 +0100

    Use character history in zap-up-to-char
    
    Extend commit
    'Add CHARS arg to read-char-from-minibuffer compatible with read-char-choice.'
    (04ab67470706f1c66bdf08e4078ea3dffd79b41e)
    to `zap-up-to-char'.
    
    * lisp/misc.el (lisp/misc.el): Use same interactive specification
    as in `zap-to-char'.
    * etc/NEWS (): Mention zap-up-to-char as well.

diff --git a/etc/NEWS b/etc/NEWS
index d6eb5d9e66..08e8907a2c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -603,10 +603,10 @@ navigation and editing of large files.
 
 +++
 ** 'zap-to-char' now uses the history of characters you used to zap to.
-'zap-to-char' uses the new 'read-char-from-minibuffer' function to allow
-navigating through the history of characters that have been input.
-This is mostly useful for characters that have complex input methods
-where inputting the character again may involve many keystrokes.
+'zap-to-char' and 'zap-up-to-char' use the new 'read-char-from-minibuffer'
+function to allow navigating through the history of characters that
+have been input.  This is mostly useful for characters that have complex
+input methods where inputting the character again may involve many keystrokes.
 
 +++
 ** 'save-some-buffers' now has a new action in the prompt: 'C-f' will
diff --git a/lisp/misc.el b/lisp/misc.el
index 05244a6ea2..8b6b7a7e0d 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -69,7 +69,9 @@ zap-up-to-char
 Case is ignored if `case-fold-search' is non-nil in the current buffer.
 Goes backward if ARG is negative; error if CHAR not found.
 Ignores CHAR at point."
-  (interactive "p\ncZap up to char: ")
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+		     (read-char-from-minibuffer "Zap to char: "
+						nil 'read-char-history)))
   (let ((direction (if (>= arg 0) 1 -1)))
     (kill-region (point)
 		 (progn
--8<-----------------------------cut here---------------end--------------->8---


In GNU Emacs 27.0.60 (build 52, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2020-01-16 built on calancha-pc.dy.bbexcite.jp
Repository revision: 52080b5778cbe535c331fa14539aecd88f2be0a0
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Thu, 16 Jan 2020 18:58:01 GMT) Full text and rfc822 format available.

Message #8 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 39154 <at> debbugs.gnu.org
Cc: juri linkov <juri <at> linkov.net>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Thu, 16 Jan 2020 19:56:55 +0100
From: Tino Calancha <tino.calancha <at> gmail.com>

>diff --git a/lisp/misc.el b/lisp/misc.el
>index 05244a6ea2..8b6b7a7e0d 100644
>--- a/lisp/misc.el
>+++ b/lisp/misc.el
>@@ -69,7 +69,9 @@ zap-up-to-char
> Case is ignored if `case-fold-search' is non-nil in the current buffer.
> Goes backward if ARG is negative; error if CHAR not found.
> Ignores CHAR at point."
>-  (interactive "p\ncZap up to char: ")
>+  (interactive (list (prefix-numeric-value current-prefix-arg)
>+		     (read-char-from-minibuffer "Zap to char: "
>+						nil 'read-char-history)))
>   (let ((direction (if (>= arg 0) 1 -1)))
>     (kill-region (point)

Typo above, it should read '"Zap up to char: "', as follows:

>+		     (read-char-from-minibuffer "Zap up to char: "

Sorry for that :-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Fri, 17 Jan 2020 00:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Fri, 17 Jan 2020 02:18:57 +0200
> While zapping I saw in the news about recent `zap-to-char' changes...
> ( I mean Emacs news, I don't watch TV! :-| )

These are old news, these changes were made a long time ago -
more than 2 months have passed.

> We might want to extend that to cover `zap-up-to-char' as well; as many others,
> I weardly use the former, but I often use the latter.

Thanks, zap-up-to-char definitely needs the same treatment.

BTW, why we added only isearch-yank-until-char corresponding to zap-to-char,
but not an isearch command corresponding to zap-up-to-char?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Sat, 18 Jan 2020 14:38:02 GMT) Full text and rfc822 format available.

Message #14 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 39154 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Sat, 18 Jan 2020 15:37:42 +0100 (CET)

On Fri, 17 Jan 2020, Juri Linkov wrote:

> BTW, why we added only isearch-yank-until-char corresponding to zap-to-char,
> but not an isearch command corresponding to zap-up-to-char?
I wasn't aware about that function; I like it! It saves typing.

After playing with it, I see that above function corresponds to 
`zap-up-to-char' (i.e., it doesn't add CHAR to the search string).

The following changes might be worth:
- A rename, or an alias, of above function to `isearch-yank-up-to-char'
- Add similar funtion `iseach-yank-to-char' (i.e. one that inserts CHAR
  in the seach string).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Mon, 20 Jan 2020 00:43:03 GMT) Full text and rfc822 format available.

Message #17 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Mon, 20 Jan 2020 02:24:30 +0200
>> BTW, why we added only isearch-yank-until-char corresponding to zap-to-char,
>> but not an isearch command corresponding to zap-up-to-char?
> I wasn't aware about that function; I like it! It saves typing.
>
> After playing with it, I see that above function corresponds to
> `zap-up-to-char' (i.e., it doesn't add CHAR to the search string).

Indeed.

> The following changes might be worth:
> - A rename, or an alias, of above function to `isearch-yank-up-to-char'

Better to leave alone the name of the existing command since
"up-to-char" and "until-char" are synonyms.

> - Add similar funtion `iseach-yank-to-char' (i.e. one that inserts CHAR
>   in the seach string).

Yes, this is a good name consistent with zap-to-char.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Thu, 23 Jan 2020 13:52:02 GMT) Full text and rfc822 format available.

Message #20 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 39154 <at> debbugs.gnu.org
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Thu, 23 Jan 2020 14:51:23 +0100
Juri Linkov <juri <at> linkov.net> writes:

> Better to leave alone the name of the existing command since
> "up-to-char" and "until-char" are synonyms.
>
>> - Add similar funtion `iseach-yank-to-char' (i.e. one that inserts CHAR
>>   in the seach string).
>
> Yes, this is a good name consistent with zap-to-char.

We have discussed two topics in this report, thus I am proposing the
following two commits:

I) Adjust interactive specificaion for `zap-up-to-char':

--8<-----------------------------cut here---------------start------------->8---
commit fe77bb9c2793fd7856c514f41e7a2ce4ccbc4f18
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Thu Jan 23 14:42:29 2020 +0100

    Use character history in zap-up-to-char
    
    Extend commit
    'Add CHARS arg to read-char-from-minibuffer compatible with read-char-choice.'
    (04ab67470706f1c66bdf08e4078ea3dffd79b41e)
    to `zap-up-to-char'.
    
    * lisp/misc.el (lisp/misc.el): Use same interactive specification
    as in `zap-to-char' (Bug#39154).
    * etc/NEWS (Editing Changes in Emacs 27.1): Mention zap-up-to-char as well.

diff --git a/etc/NEWS b/etc/NEWS
index 792851e5af..2228a4bd25 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -603,10 +603,10 @@ navigation and editing of large files.
 
 +++
 ** 'zap-to-char' now uses the history of characters you used to zap to.
-'zap-to-char' uses the new 'read-char-from-minibuffer' function to allow
-navigating through the history of characters that have been input.
-This is mostly useful for characters that have complex input methods
-where inputting the character again may involve many keystrokes.
+'zap-to-char' and 'zap-up-to-char' use the new 'read-char-from-minibuffer'
+function to allow navigating through the history of characters that
+have been input.  This is mostly useful for characters that have complex
+input methods where inputting the character again may involve many keystrokes.
 
 +++
 ** 'save-some-buffers' now has a new action in the prompt: 'C-f' will
diff --git a/lisp/misc.el b/lisp/misc.el
index 05244a6ea2..af5725555b 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -69,7 +69,9 @@ zap-up-to-char
 Case is ignored if `case-fold-search' is non-nil in the current buffer.
 Goes backward if ARG is negative; error if CHAR not found.
 Ignores CHAR at point."
-  (interactive "p\ncZap up to char: ")
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+		     (read-char-from-minibuffer "Zap up to char: "
+						nil 'read-char-history)))
   (let ((direction (if (>= arg 0) 1 -1)))
     (kill-region (point)
 		 (progn
--8<-----------------------------cut here---------------end--------------->8---


II) Add new command `isearch-yank-to-char'.
  - It is desirable to add a keybinding for it as well.  Tentatively, I
  have used C-M-p in this patch; please, suggest me the one that fit better.
  

--8<-----------------------------cut here---------------start------------->8---
commit 97ffdf08dc5311989d8ee8fa0a07ce0f6695c021
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Thu Jan 23 14:42:34 2020 +0100

    Add command isearch-yank-to-char
    
    * lisp/isearch.el (isearch-yank-to-char): New command; bind it to
    C-M-p at isearch-mode-map (Bug#39154).
    
    * etc/NEWS (Search and Replace): Announce it.
    
    * doc/emacs/search.texi (Isearch Yank): Update the manual.

diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 16916617a2..0ebae16d99 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -283,6 +283,14 @@ Isearch Yank
 useful for keyboard macros, for example in programming languages or
 markup languages in which that character marks a token boundary.  With
 a prefix numeric argument of @var{n}, the command appends everything
+from point up to the @var{n}th occurrence of the specified character.
+
+@kindex C-M-p @r{(Incremental search)}
+@findex isearch-yank-to-char
+  Likewise, @kbd{C-M-p} (@code{isearch-yank-to-char}) appends to
+the search string everything from point to the next occurrence of
+a specified character (including that character).  With
+a prefix numeric argument of @var{n}, the command appends everything
 from point to the @var{n}th occurrence of the specified character.
 
 @kindex C-y @r{(Incremental search)}
diff --git a/etc/NEWS b/etc/NEWS
index 2228a4bd25..10dd121c50 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1803,7 +1803,9 @@ highlight in one iteration while processing the full buffer.
 'C-M-z' invokes new function 'isearch-yank-until-char', which yanks
 everything from point up to but not including the specified
 character into the search string.  This is especially useful for
-keyboard macros.
+keyboard macros.  Likewise, 'C-M-p' calls the new function
+'isearch-yank-to-char', which yanks everything from point to
+the specified character (including it)  into the search string.
 
 'C-M-w' in isearch changed from 'isearch-del-char' to the new function
 'isearch-yank-symbol-or-char'.  'isearch-del-char' is now bound to
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ddf9190dc6..cb52e4ffd4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -709,6 +709,7 @@ isearch-mode-map
     (define-key map "\M-\C-y" 'isearch-yank-char)
     (define-key map    "\C-y" 'isearch-yank-kill)
     (define-key map "\M-\C-z" 'isearch-yank-until-char)
+    (define-key map "\M-\C-p" 'isearch-yank-to-char)
     (define-key map "\M-s\C-e" 'isearch-yank-line)
 
     (define-key map "\M-s\M-<" 'isearch-beginning-of-buffer)
@@ -1004,6 +1005,8 @@ isearch-forward
  string and search for it.
 Type \\[isearch-yank-until-char] to yank from point until the next instance of a
  specified character onto end of search string and search for it.
+Type \\[isearch-yank-to-char] to yank from point to the next instance of a
+ specified character onto end of search string and search for it.
 Type \\[isearch-yank-line] to yank rest of line onto end of search string\
  and search for it.
 Type \\[isearch-yank-kill] to yank the last string of killed text.
@@ -2593,6 +2596,24 @@ isearch-yank-until-char
                    (sit-for 2)))
                 (point)))))
 
+(defun isearch-yank-to-char (char &optional arg)
+  "Pull everything to next instance of CHAR from buffer into search string.
+Interactively, prompt for CHAR.
+If optional ARG is non-nil, pull to next ARGth instance of CHAR.
+
+See `isearch-yank-until-char' for a similar command that pull everything
+until CHAR, i.e. it doesn't include CHAR."
+  (interactive "cYank to character: \np")
+  (isearch-yank-internal
+   (lambda () (let ((inhibit-field-text-motion t))
+                (condition-case nil
+                    (progn
+                      (search-forward (char-to-string char) nil nil arg))
+                  (search-failed
+                   (message "`%c' not found" char)
+                   (sit-for 2)))
+                (point)))))
+
 (defun isearch-yank-line (&optional arg)
   "Pull rest of line from buffer into search string.
 If optional ARG is non-nil, yank the next ARG lines."

--8<-----------------------------cut here---------------end--------------->8---

Patches on top of emacs-27 commit
'Minor doc string clarification in use-hard-newlines'
(7d1e9c943ffa3ded122ef3c8755e05dfb5e9c33f)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Thu, 23 Jan 2020 18:17:02 GMT) Full text and rfc822 format available.

Message #23 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Thu, 23 Jan 2020 20:16:00 +0200
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Thu, 23 Jan 2020 14:51:23 +0100
> Cc: 39154 <at> debbugs.gnu.org
> 
>     * etc/NEWS (Editing Changes in Emacs 27.1): Mention zap-up-to-char as well.

This should go to master, not to emacs-27.  No new features on the
release branch, please, unless they are so important that we really
cannot do without them.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Sat, 25 Jan 2020 19:44:02 GMT) Full text and rfc822 format available.

Message #26 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39154 <at> debbugs.gnu.org, juri <at> linkov.net,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Sat, 25 Jan 2020 20:43:37 +0100 (CET)

On Thu, 23 Jan 2020, Eli Zaretskii wrote:

>> From: Tino Calancha <tino.calancha <at> gmail.com>
>> Date: Thu, 23 Jan 2020 14:51:23 +0100
>> Cc: 39154 <at> debbugs.gnu.org
>>
>>     * etc/NEWS (Editing Changes in Emacs 27.1): Mention zap-up-to-char as well.
>
> This should go to master, not to emacs-27.  No new features on the
> release branch, please, unless they are so important that we really
> cannot do without them.

OK, I got it.  Thanks for let me know :-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Tue, 28 Jan 2020 23:54:01 GMT) Full text and rfc822 format available.

Message #29 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 29 Jan 2020 01:49:23 +0200
> II) Add new command `isearch-yank-to-char'.

Thanks.

>   - It is desirable to add a keybinding for it as well.  Tentatively, I
>   have used C-M-p in this patch; please, suggest me the one that fit better.

Sorry, C-M-p can't be overridden because C-M-p is bound globally to
'backward-list', so C-M-p should exit Isearch and run this command.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Sun, 02 Feb 2020 13:55:01 GMT) Full text and rfc822 format available.

Message #32 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 39154 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Sun, 2 Feb 2020 14:54:01 +0100 (CET)

On Wed, 29 Jan 2020, Juri Linkov wrote:

>>   - It is desirable to add a keybinding for it as well.  Tentatively, I
>>   have used C-M-p in this patch; please, suggest me the one that fit better.
>
> Sorry, C-M-p can't be overridden because C-M-p is bound globally to
> 'backward-list', so C-M-p should exit Isearch and run this command.
I see.
We might add the command without keybinding (adding a TODO comment in the 
code); we always can add a sensible binding later.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Wed, 05 Feb 2020 07:22:01 GMT) Full text and rfc822 format available.

Message #35 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 39154 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 5 Feb 2020 08:21:22 +0100 (CET)

Juri, do we have a similar command (as those pulling things into the 
search string) that pulls the region?

I mean something as the following code (I find useful having a 
binding for it in isearch-mode-map):

(defun my-isearch-yank-selection (beg end)
  "Pull selection into search string."
  (interactive
   (let ((region (and (use-region-p) (region-bounds))))
     (unless region (user-error "No selected region"))
     (list (caar region) (cdar region))))
  (isearch-yank-internal
   (lambda () (goto-char (if (= (point) beg) end beg))
     (when select-active-regions (deactivate-mark))
     (point))))


If we don't have it I can open a separated bug report for it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Wed, 05 Feb 2020 15:23:01 GMT) Full text and rfc822 format available.

Message #38 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: 39154 <at> debbugs.gnu.org
Subject: RE: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 5 Feb 2020 07:22:17 -0800 (PST)
> do we have a similar command (as those pulling things into the
> search string) that pulls the region?

Does `isearch-yank-kill' (`C-y') do what you want?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Wed, 05 Feb 2020 19:47:02 GMT) Full text and rfc822 format available.

Message #41 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 39154 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: RE: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 5 Feb 2020 20:46:08 +0100 (CET)

On Wed, 5 Feb 2020, Drew Adams wrote:

>> do we have a similar command (as those pulling things into the
>> search string) that pulls the region?
>
> Does `isearch-yank-kill' (`C-y') do what you want?
That's true, in my case this works because I set 
`select-enable-primary' non-nil; quite similar, but not exactly
the same thing: the command I am suggesting should work regardless
on the user settings (ie, emacs -Q).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Wed, 05 Feb 2020 21:13:01 GMT) Full text and rfc822 format available.

Message #44 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: RE: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 5 Feb 2020 13:10:40 -0800 (PST)
> >> do we have a similar command (as those pulling things into the
> >> search string) that pulls the region?
> >
> > Does `isearch-yank-kill' (`C-y') do what you want?
>
> That's true, in my case this works because I set
> `select-enable-primary' non-nil;

I kinda guessed that.  (Me too: I have non-nil
`select-enable-clipboard'.  There's also
`select-active-regions'.)

> quite similar, but not exactly the same thing:
> the command I am suggesting should work
> regardless on the user settings (ie, emacs -Q).

OK, but why?  Do you really see a use case for
a separate such thing for Isearch?  If a user
typically doesn't want mere selection to also
copy to the `kill-ring' or primary or whatever,
would she want a selection during Isearch to be
available for yanking?

I'm not objecting - just trying to understand
why we'd want both `isearch-yank-kill' and
what you propose.

---

On the other hand, because the secondary
selection is a different critter entirely from
the primary (clipboard...), a separate Isearch
yank command for it makes sense to me.

(I have it as `isearch-yank-secondary', and I
bind it to both `C-M-y' and `C-y 2' in Isearch.
I bind `isearch-yank-kill' to `C-y C-y'.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Wed, 05 Feb 2020 22:42:02 GMT) Full text and rfc822 format available.

Message #47 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Wed, 05 Feb 2020 23:56:22 +0200
> Juri, do we have a similar command (as those pulling things into the search
> string) that pulls the region?
>
> I mean something as the following code (I find useful having a binding for
> it in isearch-mode-map):
>
> (defun my-isearch-yank-selection (beg end)
>   "Pull selection into search string."
>   (interactive
>    (let ((region (and (use-region-p) (region-bounds))))
>      (unless region (user-error "No selected region"))
>      (list (caar region) (cdar region))))
>   (isearch-yank-internal
>    (lambda () (goto-char (if (= (point) beg) end beg))
>      (when select-active-regions (deactivate-mark))
>      (point))))
>
>
> If we don't have it I can open a separated bug report for it.

Yes, please open a new separate bug report, and then also
add links to the recent emacs-devel discussions:

https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html
https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39154; Package emacs. (Fri, 25 Sep 2020 11:29:01 GMT) Full text and rfc822 format available.

Message #50 received at 39154 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39154 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#39154: 27.0.60; Use character history in zap-up-to-char
Date: Fri, 25 Sep 2020 13:28:37 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

> We have discussed two topics in this report, thus I am proposing the
> following two commits:
>
> I) Adjust interactive specificaion for `zap-up-to-char':
>
> commit fe77bb9c2793fd7856c514f41e7a2ce4ccbc4f18
> Author: Tino Calancha <tino.calancha <at> gmail.com>
> Date:   Thu Jan 23 14:42:29 2020 +0100
>
>     Use character history in zap-up-to-char

I've now applied this patch to Emacs 28; it seems "obviously correct" to
do the same as zap-to-char here.

> II) Add new command `isearch-yank-to-char'.
>   - It is desirable to add a keybinding for it as well.  Tentatively, I
>   have used C-M-p in this patch; please, suggest me the one that fit better.

There was pushback here on both the key binding and the utility of the
command.  I have no opinion on the latter; all those keybindings in
isearch are kinda obscure to me, but they have lots of fans, I've
noticed.

So I'm closing this bug report; if this is something that should be
explored further, opening a new bug report for this would be welcome.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 39154 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Sep 2020 11:29: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. (Sat, 24 Oct 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.