emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recentish C-s M-y change


From: Gregory Heytings
Subject: Re: Recentish C-s M-y change
Date: Wed, 30 Dec 2020 11:13:18 +0000
User-agent: Alpine 2.22 (NEB 394 2020-01-19)



Thanks, now I see that not everyone wants the old keybinding back.


Would it not be possible to use C-u to have both behaviors? With the following code C-s C-y M-y... and C-s M-y M-y... work as before, and C-s C-u C-y and C-s C-u M-y use the new feature.

(defun isearch-yank-select ()
  (with-isearch-suspended
   (let ((string (read-from-kill-ring)))
     (if (and isearch-case-fold-search
              (eq 'not-yanks search-upper-case))
         (setq string (downcase string)))
     (if isearch-regexp (setq string (regexp-quote string)))
     (setq isearch-yank-flag t)
     (setq isearch-new-string (concat isearch-string string)
           isearch-new-message (concat isearch-message
                                       (mapconcat 'isearch-text-char-description
                                                  string ""))))))

(defun isearch-yank-pop (&optional arg)
  "Replace just-yanked search string with previously killed string."
  (interactive "p")
  (if (and arg (> arg 1))
      (isearch-yank-select)
    (if (not (memq last-command '(isearch-yank-kill isearch-yank-pop)))
        (isearch-yank-kill)
      (isearch-pop-state)
      (isearch-yank-string (current-kill 1)))))

(defun isearch-yank-kill (&optional arg)
  "Pull string from kill ring into search string."
  (interactive "p")
  (unless isearch-mode (isearch-mode t))
  (if (and arg (> arg 1))
      (isearch-yank-select)
    (isearch-yank-string (current-kill 0))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]