emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107764: * lisp/comint.el (comint--co


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107764: * lisp/comint.el (comint--common-quoted-suffix): Check string boundary
Date: Wed, 04 Apr 2012 12:06:59 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107764
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11158
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2012-04-04 12:06:59 -0400
message:
  * lisp/comint.el (comint--common-quoted-suffix): Check string boundary
  before comparing.
  * lisp/pcomplete.el (pcomplete--common-quoted-suffix): Idem.
modified:
  lisp/ChangeLog
  lisp/comint.el
  lisp/pcomplete.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-04 09:19:32 +0000
+++ b/lisp/ChangeLog    2012-04-04 16:06:59 +0000
@@ -1,3 +1,9 @@
+2012-04-04  Stefan Monnier  <address@hidden>
+
+       * comint.el (comint--common-quoted-suffix): Check string boundary
+       before comparing (bug#11158).
+       * pcomplete.el (pcomplete--common-quoted-suffix): Idem.
+
 2012-04-04  Chong Yidong  <address@hidden>
 
        * minibuffer.el (completion-extra-properties): Doc fix.

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2012-03-15 08:00:43 +0000
+++ b/lisp/comint.el    2012-04-04 16:06:59 +0000
@@ -3069,24 +3069,25 @@
 (defun comint--common-quoted-suffix (s1 s2)
   ;; FIXME: Copied in pcomplete.el.
   "Find the common suffix between S1 and S2 where S1 is the expanded S2.
-S1 is expected to be the unquoted and expanded version of S1.
+S1 is expected to be the unquoted and expanded version of S2.
 Returns (PS1 . PS2), i.e. the shortest prefixes of S1 and S2, such that
 S1 = (concat PS1 SS1) and S2 = (concat PS2 SS2) and
 SS1 = (unquote SS2)."
   (let* ((cs (comint--common-suffix s1 s2))
          (ss1 (substring s1 (- (length s1) cs)))
          (qss1 (comint-quote-filename ss1))
-         qc)
+         qc s2b)
     (if (and (not (equal ss1 qss1))
              (setq qc (comint-quote-filename (substring ss1 0 1)))
-             (eq t (compare-strings s2 (- (length s2) cs (length qc) -1)
-                                    (- (length s2) cs -1)
+            (setq s2b (- (length s2) cs (length qc) -1))
+            (>= s2b 0)                 ;bug#11158.
+             (eq t (compare-strings s2 s2b (- (length s2) cs -1)
                                     qc nil nil)))
         ;; The difference found is just that one char is quoted in S2
         ;; but not in S1, keep looking before this difference.
         (comint--common-quoted-suffix
          (substring s1 0 (- (length s1) cs))
-         (substring s2 0 (- (length s2) cs (length qc) -1)))
+         (substring s2 0 s2b))
       (cons (substring s1 0 (- (length s1) cs))
             (substring s2 0 (- (length s2) cs))))))
 

=== modified file 'lisp/pcomplete.el'
--- a/lisp/pcomplete.el 2012-01-19 07:21:25 +0000
+++ b/lisp/pcomplete.el 2012-04-04 16:06:59 +0000
@@ -387,24 +387,25 @@
 (defun pcomplete--common-quoted-suffix (s1 s2)
   ;; FIXME: Copied in comint.el.
   "Find the common suffix between S1 and S2 where S1 is the expanded S2.
-S1 is expected to be the unquoted and expanded version of S1.
+S1 is expected to be the unquoted and expanded version of S2.
 Returns (PS1 . PS2), i.e. the shortest prefixes of S1 and S2, such that
 S1 = (concat PS1 SS1) and S2 = (concat PS2 SS2) and
 SS1 = (unquote SS2)."
   (let* ((cs (comint--common-suffix s1 s2))
          (ss1 (substring s1 (- (length s1) cs)))
          (qss1 (pcomplete-quote-argument ss1))
-         qc)
+         qc s2b)
     (if (and (not (equal ss1 qss1))
              (setq qc (pcomplete-quote-argument (substring ss1 0 1)))
-             (eq t (compare-strings s2 (- (length s2) cs (length qc) -1)
-                                    (- (length s2) cs -1)
+            (setq s2b (- (length s2) cs (length qc) -1))
+            (>= s2b 0)                 ;bug#11158.
+             (eq t (compare-strings s2 s2b (- (length s2) cs -1)
                                     qc nil nil)))
         ;; The difference found is just that one char is quoted in S2
         ;; but not in S1, keep looking before this difference.
         (pcomplete--common-quoted-suffix
          (substring s1 0 (- (length s1) cs))
-         (substring s2 0 (- (length s2) cs (length qc) -1)))
+         (substring s2 0 s2b))
       (cons (substring s1 0 (- (length s1) cs))
             (substring s2 0 (- (length s2) cs))))))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]