summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el33
1 files changed, 3 insertions, 30 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index becb2a7faba..e9c064b89e8 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1398,35 +1398,8 @@ Moves point to the end of the new text."
newtext)
;; Remove all text properties.
(set-text-properties 0 (length newtext) nil newtext))
- ;; Maybe this should be in subr.el.
- ;; You'd think this is trivial to do, but details matter if you want
- ;; to keep markers "at the right place" and be robust in the face of
- ;; after-change-functions that may themselves modify the buffer.
- (let ((prefix-len 0))
- ;; Don't touch markers in the shared prefix (if any).
- (while (and (< prefix-len (length newtext))
- (< (+ beg prefix-len) end)
- (eq (char-after (+ beg prefix-len))
- (aref newtext prefix-len)))
- (setq prefix-len (1+ prefix-len)))
- (unless (zerop prefix-len)
- (setq beg (+ beg prefix-len))
- (setq newtext (substring newtext prefix-len))))
- (let ((suffix-len 0))
- ;; Don't touch markers in the shared suffix (if any).
- (while (and (< suffix-len (length newtext))
- (< beg (- end suffix-len))
- (eq (char-before (- end suffix-len))
- (aref newtext (- (length newtext) suffix-len 1))))
- (setq suffix-len (1+ suffix-len)))
- (unless (zerop suffix-len)
- (setq end (- end suffix-len))
- (setq newtext (substring newtext 0 (- suffix-len))))
- (goto-char beg)
- (let ((length (- end beg))) ;Read `end' before we insert the text.
- (insert-and-inherit newtext)
- (delete-region (point) (+ (point) length)))
- (forward-char suffix-len)))
+ (replace-region-contents beg end newtext 0.1 nil 'inherit)
+ (goto-char (+ beg (length newtext))))
(defcustom completion-cycle-threshold nil
"Number of completion candidates below which cycling is used.
@@ -2951,7 +2924,7 @@ This calls the function that `completion-in-region-function' specifies
\(passing the same four arguments that it received) to do the work,
and returns whatever it does. The return value should be nil
if there was no valid completion, else t."
- (cl-assert (<= start (point)) (<= (point) end))
+ (cl-assert (<= start (point) end) t)
(funcall completion-in-region-function start end collection predicate))
(defcustom read-file-name-completion-ignore-case