summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/crm.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-07-07 12:43:14 +0000
committerMiles Bader <miles@gnu.org>2005-07-07 12:43:14 +0000
commitd3e4babdd1267fb5690a17949196640a47c6f159 (patch)
tree968a42dfa187e492f9ce188aaf669d0cebf4bfe2 /lisp/emacs-lisp/crm.el
parenteeb88b27e1dbd3f412aa684d44e4a784f6e536a2 (diff)
parenta5717394ea6fbd7ea179c362646f4495f88245cb (diff)
downloademacs-d3e4babdd1267fb5690a17949196640a47c6f159.tar.gz
emacs-d3e4babdd1267fb5690a17949196640a47c6f159.tar.bz2
emacs-d3e4babdd1267fb5690a17949196640a47c6f159.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-68
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 459-473) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 86-87) - Update from CVS
Diffstat (limited to 'lisp/emacs-lisp/crm.el')
-rw-r--r--lisp/emacs-lisp/crm.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 572c658d0fc..8e52a42921a 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -20,8 +20,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
@@ -197,9 +197,10 @@ If an element is found, bind:
respectively,
and return t."
- (let* ((minibuffer-string (buffer-string))
- (end-index (or (string-match "," minibuffer-string (1- (point)))
- (1- (point-max))))
+ (let* ((prompt-end (minibuffer-prompt-end))
+ (minibuffer-string (buffer-substring prompt-end (point-max)))
+ (end-index (or (string-match "," minibuffer-string (- (point) prompt-end))
+ (- (point-max) prompt-end)))
(target-string (substring minibuffer-string 0 end-index))
(index (or (string-match
(concat crm-separator "\\([^" crm-separator "]*\\)$")
@@ -213,9 +214,10 @@ and return t."
(progn
;;
(setq crm-beginning-of-element (match-beginning 1))
- (setq crm-end-of-element end-index)
+ (setq crm-end-of-element (+ end-index prompt-end))
;; string to the left of the current element
- (setq crm-left-of-element (substring target-string 0 (match-beginning 1)))
+ (setq crm-left-of-element
+ (substring target-string 0 (match-beginning 1)))
;; the current element
(setq crm-current-element (match-string 1 target-string))
;; string to the right of the current element
@@ -287,7 +289,7 @@ The meanings of the return values are:
(if completedp
(progn
- (erase-buffer)
+ (delete-region (minibuffer-prompt-end) (point-max))
(insert crm-left-of-element completion)
;; (if crm-complete-up-to-point
;; (insert crm-separator))
@@ -480,7 +482,7 @@ This function is modeled after `minibuffer_complete_and_exit' in src/minibuf.c"
(setq result
(catch 'crm-exit
- (if (eq (point-min) (point-max))
+ (if (eq (minibuffer-prompt-end) (point-max))
(throw 'crm-exit t))
;; TODO: this test is suspect?
@@ -506,7 +508,8 @@ This function is modeled after `minibuffer_complete_and_exit' in src/minibuf.c"
nil
(if (equal result "check")
(let ((check-strings
- (crm-strings-completed-p (buffer-string))))
+ (crm-strings-completed-p
+ (buffer-substring (minibuffer-prompt-end) (point-max)))))
;; check all of minibuffer
(if (eq check-strings t)
(throw 'exit nil)