From 1b5929b9895e90b16205591f5cb573328c911a5d Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 13 Nov 2006 22:05:06 +0000 Subject: [PATCH] (ido-copy-current-word): C-o copies region if active. --- lisp/ido.el | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) 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) -- 2.39.5