aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKenichi Handa2010-10-02 11:05:56 +0900
committerKenichi Handa2010-10-02 11:05:56 +0900
commit58ff7eb1527a999044bbd99a07e372e7d442ca7a (patch)
tree444641c566ff2abb1cfabb0b8e64583471b6b3a5 /lisp
parent1911a33b9dc4beefaf75f67719ea7f6cf447b3ff (diff)
parentb336bfcdf39f1e4d35bff4a7bd01d3b4bca8f516 (diff)
downloademacs-58ff7eb1527a999044bbd99a07e372e7d442ca7a.tar.gz
emacs-58ff7eb1527a999044bbd99a07e372e7d442ca7a.zip
merge emacs-23
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/minibuffer.el22
2 files changed, 28 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 22cc8f3a3ed..696941f93cd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12010-09-30 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuffer.el (completion--replace):
4 Better preserve markers (bug#7138).
5
12010-09-29 Juanma Barranquero <lekktu@gmail.com> 62010-09-29 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * server.el (server-process-filter): Doc fix. 8 * server.el (server-process-filter): Doc fix.
@@ -10,8 +15,8 @@
10 15
11 * Makefile.in (ELCFILES): Update. 16 * Makefile.in (ELCFILES): Update.
12 17
13 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Avoid 18 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
14 infinite recursion on erroneous lambda form. (Bug#7114) 19 Avoid infinite recursion on erroneous lambda form. (Bug#7114)
15 20
162010-09-27 Kenichi Handa <handa@m17n.org> 212010-09-27 Kenichi Handa <handa@m17n.org>
17 22
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 93a222053f6..9a477020421 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -475,10 +475,30 @@ in the last `cdr'."
475(defun completion--replace (beg end newtext) 475(defun completion--replace (beg end newtext)
476 "Replace the buffer text between BEG and END with NEWTEXT. 476 "Replace the buffer text between BEG and END with NEWTEXT.
477Moves point to the end of the new text." 477Moves point to the end of the new text."
478 ;; This should be in subr.el. 478 ;; Maybe this should be in subr.el.
479 ;; You'd think this is trivial to do, but details matter if you want 479 ;; You'd think this is trivial to do, but details matter if you want
480 ;; to keep markers "at the right place" and be robust in the face of 480 ;; to keep markers "at the right place" and be robust in the face of
481 ;; after-change-functions that may themselves modify the buffer. 481 ;; after-change-functions that may themselves modify the buffer.
482 (let ((prefix-len 0))
483 ;; Don't touch markers in the shared prefix (if any).
484 (while (and (< prefix-len (length newtext))
485 (< (+ beg prefix-len) end)
486 (eq (char-after (+ beg prefix-len))
487 (aref newtext prefix-len)))
488 (setq prefix-len (1+ prefix-len)))
489 (unless (zerop prefix-len)
490 (setq beg (+ beg prefix-len))
491 (setq newtext (substring newtext prefix-len))))
492 (let ((suffix-len 0))
493 ;; Don't touch markers in the shared suffix (if any).
494 (while (and (< suffix-len (length newtext))
495 (< beg (- end suffix-len))
496 (eq (char-before (- end suffix-len))
497 (aref newtext (- (length newtext) suffix-len 1))))
498 (setq suffix-len (1+ suffix-len)))
499 (unless (zerop suffix-len)
500 (setq end (- end suffix-len))
501 (setq newtext (substring newtext 0 (- suffix-len)))))
482 (goto-char beg) 502 (goto-char beg)
483 (insert newtext) 503 (insert newtext)
484 (delete-region (point) (+ (point) (- end beg)))) 504 (delete-region (point) (+ (point) (- end beg))))