summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-11-13 22:05:06 +0000
committerKim F. Storm <storm@cua.dk>2006-11-13 22:05:06 +0000
commit1b5929b9895e90b16205591f5cb573328c911a5d (patch)
tree80f4f85930c70e12dd3db9d73a5b3e2cbf2b2108 /lisp
parent7e9c3923fa96a7c965d22842e01195056f09aead (diff)
downloademacs-1b5929b9895e90b16205591f5cb573328c911a5d.tar.gz
(ido-copy-current-word): C-o copies region if active.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ido.el27
1 files 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)