From: Kim F. Storm Date: Mon, 13 Nov 2006 22:05:06 +0000 (+0000) Subject: (ido-copy-current-word): C-o copies region if active. X-Git-Tag: emacs-pretest-22.0.91~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1b5929b9895e90b16205591f5cb573328c911a5d;p=emacs.git (ido-copy-current-word): C-o copies region if active. --- diff --git a/lisp/ido.el b/lisp/ido.el index b414dcec145..97e285916d6 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -2917,18 +2917,21 @@ If repeated, insert text from buffer instead." (let ((word (save-excursion (set-buffer ido-entry-buffer) (let ((p (point)) start-line end-line start-name name) - (beginning-of-line) - (setq start-line (point)) - (end-of-line) - (setq end-line (point)) - (goto-char p) - (if (re-search-backward "[^-_a-zA-Z0-9:./\\~@]" start-line 1) - (forward-char 1)) - (setq start-name (point)) - (re-search-forward "[-_a-zA-Z0-9:./\\~@]*" end-line 1) - (if (= start-name (point)) - nil - (buffer-substring-no-properties start-name (point))))))) + (if (and mark-active (/= p (mark))) + (setq start-name (mark)) + (beginning-of-line) + (setq start-line (point)) + (end-of-line) + (setq end-line (point)) + (goto-char p) + (if (re-search-backward "[^-_a-zA-Z0-9:./\\~@]" start-line 1) + (forward-char 1)) + (setq start-name (point)) + (re-search-forward "[-_a-zA-Z0-9:./\\~@]*" end-line 1) + (if (= start-name (point)) + (setq start-name nil))) + (and start-name + (buffer-substring-no-properties start-name (point))))))) (if (cond ((not word) nil) ((string-match "\\`[~/]" word)