LINUX.ORG.RU

История изменений

Исправление theNamelessOne, (текущая версия) :

но ведь наверняка кто-нибудь уже написал какой-нибудь isearch-backward-kill-word

Вот только что написал.

(defun isearch-backward-kill-word ()
  (interactive)
  (if (null (cdr isearch-cmds))
      (ding)
    (let* ((current (string-reverse (isearch--state-string (car isearch-cmds))))
           (match (string-match "[[:word:]][^[:word:]]" current)))
      (while (and (not (null (cdr isearch-cmds)))
                  (or (null match)
                      (>= match 0)))
        (setf isearch-cmds (cdr isearch-cmds)
              match (if (null match) match (1- match))))
      (isearch--set-state (car isearch-cmds))))
  (isearch-update))

Добавь binding к isearch-mode-map:

(define-key isearch-mode-map (kbd "M-DEL") #'isearch-backward-kill-word)

Исходная версия theNamelessOne, :

но ведь наверняка кто-нибудь уже написал какой-нибудь isearch-backward-kill-word

Вот только что написал.

(defun isearch-backward-kill-word ()
  (interactive)
  (if (null (cdr isearch-cmds))
      (ding)
    (let* ((current (string-reverse (isearch--state-string (car isearch-cmds))))
           (match (string-match "[[:word:]][^[:word:]]" current)))
      (message "!!! string %S" current)
      (message "!!! match %S" match)
      (while (and (not (null (cdr isearch-cmds)))
                  (or (null match)
                      (>= match 0)))
        (setf isearch-cmds (cdr isearch-cmds)
              match (if (null match) match (1- match))))
      (isearch--set-state (car isearch-cmds))))
  (isearch-update))

Добавь binding к isearch-mode-map:

(define-key isearch-mode-map (kbd "M-DEL") #'isearch-backward-kill-word)