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: Sat, 02 Jan 2021 09:03:15 +0000
User-agent: Alpine 2.22 (NEB 394 2020-01-19)


In isearch-mode-map at least, the number of changes on control keys during the last twenty years or so is very small: C-u (to allow arguments to subcommands), C-h (to enable help on the isearch-mode-map keys) and C-x (to allow C-x 8 RET).

Recent discussion shows there has been at least one more -- C-y. And I recall C-w. And C-e, I think.


No, as I wrote a few lines above in the message you are replying to, C-y and C-w are bound in isearch-mode-map since at least 1992.

C-y was isearch-yank-line until 2011; it then became isearch-yank-kill.

C-w was isearch-yank-word until 2004; it then became isearch-yank-word-or-char.

C-e is not (and AFAIK was never) bound in isearch-mode-map, at least not in vanilla Emacs.

Anyway, this moves the discussion away from my proposal, which was to bind C-u C-y and C-u M-y to the new isearch-yank-pop feature. I include the code (which changes a few lines in isearch.el) again:

(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]