emacs-devel
[Top][All Lists]
Advanced

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

Re: Word search


From: Juri Linkov
Subject: Re: Word search
Date: Tue, 11 Mar 2008 00:38:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>> Keeping C-w to specify word search in the minibuffer is necessary
>> for backward compatibility.  When we find a better method to toggle
>> word search, we could remove the description of the old method
>> from the manual, and remove its code in later releases.
>
> Backward compatibility with old elisp packages is important.
> Backward compatibility with old Emacs users is a bit less important.

Then we could use C-w for something more useful like getting the next
word from the buffer and appending it to the search string in the
minibuffer.  This would be very convenient since this is exactly what
C-w does in isearch mode.

This will allow us finally to get rid of isearch-yank-char-in-minibuffer
which does almost the same but in an unpredictable way.

I also noticed a similar command `bookmark-yank-word' in bookmark.el.
But when the mark is active, it doesn't kill the region.  I think
it should check for the active mark, and call `kill-region' in this
case like:

(defun bookmark-yank-word ()
  (interactive)
  ;; get the next word from the buffer and append it to the name of
  ;; the bookmark currently being set.
  (if mark-active
      (kill-region (point) (mark))
    (let ((string (save-excursion
                    (set-buffer bookmark-current-buffer)
                    (goto-char bookmark-yank-point)
                    (buffer-substring-no-properties
                     (point)
                     (progn
                       (forward-word 1)
                       (setq bookmark-yank-point (point)))))))
      (insert string))))

Generally, the logic could be the following: when C-w will fail anyway
due to the absence of the active mark in the minibuffer, do a different
action like pulling the next word from the buffer to the minibuffer.

BTW, in bookmark.el I see:

    ;; This C-u binding might not be very useful any more now that we
    ;; provide access to the default via the standard M-n binding.
    ;; Maybe we should just remove it?  --Stef-08
    (define-key map "\C-u" 'bookmark-insert-current-bookmark)

I agree that this is unnecessary any more, and if no one will object,
maybe we could just remove it?

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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