]> git.eshelyaron.com Git - emacs.git/commitdiff
(ido-copy-current-word): C-o copies region if active.
authorKim F. Storm <storm@cua.dk>
Mon, 13 Nov 2006 22:05:06 +0000 (22:05 +0000)
committerKim F. Storm <storm@cua.dk>
Mon, 13 Nov 2006 22:05:06 +0000 (22:05 +0000)
lisp/ido.el

index b414dcec145e91fb5b103e7c6faf153a01d5181e..97e285916d6098941669a7159ea3324ca07f2fbd 100644 (file)
@@ -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)