aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorGlenn Morris2012-04-16 19:57:09 -0400
committerGlenn Morris2012-04-16 19:57:09 -0400
commit121b8917ec329a6bbc292ad02f5c4e39d164fff5 (patch)
tree04108b805e878cd7456cd9d55eada3f35fbb6027 /lisp/vc
parentf53a85a90a16970fe9dc15294a2ebdb984369c97 (diff)
downloademacs-121b8917ec329a6bbc292ad02f5c4e39d164fff5.tar.gz
emacs-121b8917ec329a6bbc292ad02f5c4e39d164fff5.zip
Replace independent implementations of string-prefix-p
* vc/vc.el (vc-string-prefix-p): * vc/pcvs-util.el (cvs-string-prefix-p): * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p): * mpc.el (mpc-string-prefix-p): Make all of these into obsolete aliases for string-prefix-p. Update callers. * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/pcvs-util.el4
-rw-r--r--lisp/vc/pcvs.el14
-rw-r--r--lisp/vc/vc-dir.el14
-rw-r--r--lisp/vc/vc-dispatcher.el3
-rw-r--r--lisp/vc/vc.el12
5 files changed, 20 insertions, 27 deletions
diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index b300247e552..a3c525cb896 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -182,9 +182,7 @@ arguments. If ARGS is not a list, no argument will be passed."
182 (if oneline (line-end-position) (point-max)))) 182 (if oneline (line-end-position) (point-max))))
183 (file-error nil))) 183 (file-error nil)))
184 184
185(defun cvs-string-prefix-p (str1 str2) 185(define-obsolete-function-alias 'cvs-string-prefix-p 'string-prefix-p "24.2")
186 "Tell whether STR1 is a prefix of STR2."
187 (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
188 186
189;;;; 187;;;;
190;;;; file names 188;;;; file names
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 9ba65cda143..6aec24755b5 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -432,8 +432,8 @@ If non-nil, NEW means to create a new buffer no matter what."
432 (case cvs-reuse-cvs-buffer 432 (case cvs-reuse-cvs-buffer
433 (always t) 433 (always t)
434 (subdir 434 (subdir
435 (or (cvs-string-prefix-p default-directory dir) 435 (or (string-prefix-p default-directory dir)
436 (cvs-string-prefix-p dir default-directory))) 436 (string-prefix-p dir default-directory)))
437 (samedir (string= default-directory dir))) 437 (samedir (string= default-directory dir)))
438 (return buffer))))) 438 (return buffer)))))
439 ;; we really have to create a new buffer: 439 ;; we really have to create a new buffer:
@@ -887,7 +887,7 @@ RM-MSGS if non-nil means remove messages."
887 (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE) 887 (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)
888 (not (when first-dir (setq first-dir nil) t)) 888 (not (when first-dir (setq first-dir nil) t))
889 (or (eq rm-dirs 'all) 889 (or (eq rm-dirs 'all)
890 (not (cvs-string-prefix-p 890 (not (string-prefix-p
891 (cvs-fileinfo->dir last-fi) 891 (cvs-fileinfo->dir last-fi)
892 (cvs-fileinfo->dir fi))) 892 (cvs-fileinfo->dir fi)))
893 (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty)) 893 (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty))
@@ -1839,7 +1839,7 @@ Signal an error if there is no backup file."
1839 (setq buffer-file-name (expand-file-name buffer-file-name)) 1839 (setq buffer-file-name (expand-file-name buffer-file-name))
1840 (let (ret) 1840 (let (ret)
1841 (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) 1841 (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
1842 (when (cvs-string-prefix-p 1842 (when (string-prefix-p
1843 (expand-file-name (cvs-fileinfo->full-name fi) dir) 1843 (expand-file-name (cvs-fileinfo->full-name fi) dir)
1844 buffer-file-name) 1844 buffer-file-name)
1845 (setq ret t))) 1845 (setq ret t)))
@@ -2261,7 +2261,7 @@ With prefix argument, prompt for cvs flags."
2261(defun cvs-dir-member-p (fileinfo dir) 2261(defun cvs-dir-member-p (fileinfo dir)
2262 "Return true if FILEINFO represents a file in directory DIR." 2262 "Return true if FILEINFO represents a file in directory DIR."
2263 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)) 2263 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
2264 (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) 2264 (string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
2265 2265
2266(defun cvs-execute-single-file (fi extractor program constant-args) 2266(defun cvs-execute-single-file (fi extractor program constant-args)
2267 "Internal function for `cvs-execute-single-file-list'." 2267 "Internal function for `cvs-execute-single-file-list'."
@@ -2392,7 +2392,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2392 (set-buffer cvs-buf) 2392 (set-buffer cvs-buf)
2393 ;; look for a corresponding pcl-cvs buffer 2393 ;; look for a corresponding pcl-cvs buffer
2394 (when (and (eq major-mode 'cvs-mode) 2394 (when (and (eq major-mode 'cvs-mode)
2395 (cvs-string-prefix-p default-directory dir)) 2395 (string-prefix-p default-directory dir))
2396 (let ((subdir (substring dir (length default-directory)))) 2396 (let ((subdir (substring dir (length default-directory))))
2397 (set-buffer buffer) 2397 (set-buffer buffer)
2398 (set (make-local-variable 'cvs-buffer) cvs-buf) 2398 (set (make-local-variable 'cvs-buffer) cvs-buf)
@@ -2423,7 +2423,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2423 (set-buffer cvs-buf) 2423 (set-buffer cvs-buf)
2424 ;; look for a corresponding pcl-cvs buffer 2424 ;; look for a corresponding pcl-cvs buffer
2425 (when (and (eq major-mode 'cvs-mode) 2425 (when (and (eq major-mode 'cvs-mode)
2426 (cvs-string-prefix-p default-directory file)) 2426 (string-prefix-p default-directory file))
2427 (let* ((file (substring file (length default-directory))) 2427 (let* ((file (substring file (length default-directory)))
2428 (fi (cvs-create-fileinfo 2428 (fi (cvs-create-fileinfo
2429 (if (string= "0" version) 2429 (if (string= "0" version)
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 33611b4eafd..4c32eea2f72 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1,6 +1,6 @@
1;;; vc-dir.el --- Directory status display under VC 1;;; vc-dir.el --- Directory status display under VC
2 2
3;; Copyright (C) 2007-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 4
5;; Author: Dan Nicolaescu <dann@ics.uci.edu> 5;; Author: Dan Nicolaescu <dann@ics.uci.edu>
6;; Keywords: vc tools 6;; Keywords: vc tools
@@ -556,7 +556,7 @@ If a prefix argument is given, move by that many lines."
556 (let ((data (ewoc-data crt)) 556 (let ((data (ewoc-data crt))
557 (dir (vc-dir-node-directory crt))) 557 (dir (vc-dir-node-directory crt)))
558 (and (vc-dir-fileinfo->directory data) 558 (and (vc-dir-fileinfo->directory data)
559 (vc-string-prefix-p dir argdir) 559 (string-prefix-p dir argdir)
560 (vc-dir-fileinfo->marked data) 560 (vc-dir-fileinfo->marked data)
561 (setq found data)))) 561 (setq found data))))
562 found)) 562 found))
@@ -818,7 +818,7 @@ child files."
818 data) 818 data)
819 (while 819 (while
820 (and (setq crt (ewoc-next vc-ewoc crt)) 820 (and (setq crt (ewoc-next vc-ewoc crt))
821 (vc-string-prefix-p dir 821 (string-prefix-p dir
822 (progn 822 (progn
823 (setq data (ewoc-data crt)) 823 (setq data (ewoc-data crt))
824 (vc-dir-node-directory crt)))) 824 (vc-dir-node-directory crt))))
@@ -846,7 +846,7 @@ If it is a file, return the corresponding cons for the file itself."
846 data) 846 data)
847 (while 847 (while
848 (and (setq crt (ewoc-next vc-ewoc crt)) 848 (and (setq crt (ewoc-next vc-ewoc crt))
849 (vc-string-prefix-p dir (progn 849 (string-prefix-p dir (progn
850 (setq data (ewoc-data crt)) 850 (setq data (ewoc-data crt))
851 (vc-dir-node-directory crt)))) 851 (vc-dir-node-directory crt))))
852 (unless (vc-dir-fileinfo->directory data) 852 (unless (vc-dir-fileinfo->directory data)
@@ -878,10 +878,10 @@ If it is a file, return the corresponding cons for the file itself."
878 children 878 children
879 dname) 879 dname)
880 ;; Find DIR 880 ;; Find DIR
881 (while (and crt (not (vc-string-prefix-p 881 (while (and crt (not (string-prefix-p
882 dirname (vc-dir-node-directory crt)))) 882 dirname (vc-dir-node-directory crt))))
883 (setq crt (ewoc-next vc-ewoc crt))) 883 (setq crt (ewoc-next vc-ewoc crt)))
884 (while (and crt (vc-string-prefix-p 884 (while (and crt (string-prefix-p
885 dirname 885 dirname
886 (setq dname (vc-dir-node-directory crt)))) 886 (setq dname (vc-dir-node-directory crt))))
887 (let ((data (ewoc-data crt))) 887 (let ((data (ewoc-data crt)))
@@ -915,7 +915,7 @@ If it is a file, return the corresponding cons for the file itself."
915 (if (not (derived-mode-p 'vc-dir-mode)) 915 (if (not (derived-mode-p 'vc-dir-mode))
916 (push status-buf drop) 916 (push status-buf drop)
917 (let ((ddir default-directory)) 917 (let ((ddir default-directory))
918 (when (vc-string-prefix-p ddir file) 918 (when (string-prefix-p ddir file)
919 (if (file-directory-p file) 919 (if (file-directory-p file)
920 (progn 920 (progn
921 (vc-dir-resync-directory-files file) 921 (vc-dir-resync-directory-files file)
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index ec1b127dd19..95c15030953 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -537,13 +537,12 @@ editing!"
537 (kill-buffer (current-buffer))))) 537 (kill-buffer (current-buffer)))))
538 538
539(declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) 539(declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
540(declare-function vc-string-prefix-p "vc" (prefix string))
541 540
542(defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info) 541(defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info)
543 "Resync all buffers that visit files in DIRECTORY." 542 "Resync all buffers that visit files in DIRECTORY."
544 (dolist (buffer (buffer-list)) 543 (dolist (buffer (buffer-list))
545 (let ((fname (buffer-file-name buffer))) 544 (let ((fname (buffer-file-name buffer)))
546 (when (and fname (vc-string-prefix-p directory fname)) 545 (when (and fname (string-prefix-p directory fname))
547 (with-current-buffer buffer 546 (with-current-buffer buffer
548 (vc-resynch-buffer fname keep noquery reset-vc-info)))))) 547 (vc-resynch-buffer fname keep noquery reset-vc-info))))))
549 548
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 4cbbf47c2d6..ab7e587eb79 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1,6 +1,6 @@
1;;; vc.el --- drive a version-control system from within Emacs 1;;; vc.el --- drive a version-control system from within Emacs
2 2
3;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
4 4
5;; Author: FSF (see below for full credits) 5;; Author: FSF (see below for full credits)
6;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6;; Maintainer: Andre Spiegel <spiegel@gnu.org>
@@ -847,7 +847,7 @@ been updated to their corresponding values."
847 (if (file-directory-p file) 847 (if (file-directory-p file)
848 (dolist (buffer (buffer-list)) 848 (dolist (buffer (buffer-list))
849 (let ((fname (buffer-file-name buffer))) 849 (let ((fname (buffer-file-name buffer)))
850 (when (and fname (vc-string-prefix-p file fname)) 850 (when (and fname (string-prefix-p file fname))
851 (push fname flist)))) 851 (push fname flist))))
852 (push file flist))) 852 (push file flist)))
853 ,form 853 ,form
@@ -900,7 +900,7 @@ use."
900 (lambda (arg) 900 (lambda (arg)
901 (message "arg %s" arg) 901 (message "arg %s" arg)
902 (and (file-directory-p arg) 902 (and (file-directory-p arg)
903 (vc-string-prefix-p (expand-file-name arg) def-dir))))))) 903 (string-prefix-p (expand-file-name arg) def-dir)))))))
904 (let ((default-directory repo-dir)) 904 (let ((default-directory repo-dir))
905 (vc-call-backend bk 'create-repo)) 905 (vc-call-backend bk 'create-repo))
906 (throw 'found bk)))) 906 (throw 'found bk))))
@@ -2809,11 +2809,7 @@ to provide the `find-revision' operation instead."
2809 2809
2810 2810
2811;; These things should probably be generally available 2811;; These things should probably be generally available
2812 2812(define-obsolete-function-alias 'vc-string-prefix-p 'string-prefix-p "24.2")
2813(defun vc-string-prefix-p (prefix string)
2814 (let ((lpref (length prefix)))
2815 (and (>= (length string) lpref)
2816 (eq t (compare-strings prefix nil nil string nil lpref)))))
2817 2813
2818(defun vc-file-tree-walk (dirname func &rest args) 2814(defun vc-file-tree-walk (dirname func &rest args)
2819 "Walk recursively through DIRNAME. 2815 "Walk recursively through DIRNAME.