unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: emacs-devel@gnu.org
Subject: Add xwidget-webkit-isearch-yank-kill
Date: Wed, 10 Nov 2021 18:15:47 +0800	[thread overview]
Message-ID: <878rxw71v0.fsf@yahoo.com> (raw)
In-Reply-To: 878rxw71v0.fsf.ref@yahoo.com

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

I added a command that behaves like `isearch-yank-kill' to xwidget
webkit isearch.

Does anyone want to make a comment before I push it?  Thanks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-xwidget-webkit-isearch-yank-kill.patch --]
[-- Type: text/x-patch, Size: 2314 bytes --]

From 108b234ec7d4b00e08786c0f0a17514ea50951a0 Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Wed, 10 Nov 2021 18:13:22 +0800
Subject: [PATCH] Add `xwidget-webkit-isearch-yank-kill'

* lisp/xwidget.el: Bind C-y to xwidget-webkit-yank-kill in incremental
search.
(xwidget-webkit-isearch-mode): Update doc string.
(xwidget-webkit-yank-kill): New function.
---
 lisp/xwidget.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index cad464b5b2..cc149cf197 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -947,6 +947,7 @@ xwidget-webkit-isearch-mode-map
 (define-key xwidget-webkit-isearch-mode-map "\C-g" 'xwidget-webkit-isearch-exit)
 (define-key xwidget-webkit-isearch-mode-map "\C-r" 'xwidget-webkit-isearch-backward)
 (define-key xwidget-webkit-isearch-mode-map "\C-s" 'xwidget-webkit-isearch-forward)
+(define-key xwidget-webkit-isearch-mode-map "\C-y" 'xwidget-webkit-isearch-yank-kill)
 (define-key xwidget-webkit-isearch-mode-map "\t" 'xwidget-webkit-isearch-printing-char)
 
 (let ((meta-map (make-keymap)))
@@ -968,6 +969,9 @@ xwidget-webkit-isearch-mode
 \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-forward] to move forward, and
 \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-backward] to move backward.
 
+To insert the string at the front of the kill ring into the
+search query, type \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-yank-kill].
+
 Press \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-exit] to exit incremental search."
   :keymap xwidget-webkit-isearch-mode-map
   (if xwidget-webkit-isearch-mode
@@ -977,6 +981,15 @@ xwidget-webkit-isearch-mode
         (xwidget-webkit-isearch--update))
     (xwidget-webkit-finish-search (xwidget-webkit-current-session))))
 
+(defun xwidget-webkit-isearch-yank-kill ()
+  "Pull string from kill ring and append it to the current query."
+  (interactive)
+  (unless xwidget-webkit-isearch-mode
+    (xwidget-webkit-isearch-mode t))
+  (setq xwidget-webkit-isearch--string
+        (concat xwidget-webkit-isearch--string
+                (current-kill 0)))
+  (xwidget-webkit-isearch--update))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defvar xwidget-view-list)              ; xwidget.c
-- 
2.31.1


       reply	other threads:[~2021-11-10 10:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878rxw71v0.fsf.ref@yahoo.com>
2021-11-10 10:15 ` Po Lu [this message]
2021-11-10 11:43   ` Add xwidget-webkit-isearch-yank-kill Po Lu
2021-11-10 11:45     ` Lars Ingebrigtsen
2021-11-10 11:46       ` Po Lu
2021-11-10 14:03     ` Eli Zaretskii
2021-11-10 14:00   ` Eli Zaretskii
2021-11-11  0:28     ` Po Lu
2021-11-11  6:53       ` Eli Zaretskii
2021-11-11  6:55         ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rxw71v0.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).