aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
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
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')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/mpc.el9
-rw-r--r--lisp/textmodes/tex-mode.el15
-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
8 files changed, 37 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 906adf26971..280bfe769a2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,14 @@
4 4
52012-04-16 Glenn Morris <rgm@gnu.org> 52012-04-16 Glenn Morris <rgm@gnu.org>
6 6
7 * vc/vc.el (vc-string-prefix-p):
8 * vc/pcvs-util.el (cvs-string-prefix-p):
9 * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p):
10 * mpc.el (mpc-string-prefix-p):
11 Make all of these into obsolete aliases for string-prefix-p.
12 Update callers.
13 * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers.
14
7 * textmodes/two-column.el: Move custom options to the start. 15 * textmodes/two-column.el: Move custom options to the start.
8 (frame-width): Remove compat definition. 16 (frame-width): Remove compat definition.
9 (2C-associate-buffer, 2C-dissociate): 17 (2C-associate-buffer, 2C-dissociate):
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 614f2bd6806..d2203a4deab 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1,6 +1,6 @@
1;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8; lexical-binding: t -*- 1;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8; lexical-binding: t -*-
2 2
3;; Copyright (C) 2006-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca> 5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Keywords: multimedia 6;; Keywords: multimedia
@@ -184,10 +184,7 @@ numerically rather than lexicographically."
184 (abs res)) 184 (abs res))
185 res)))))))) 185 res))))))))
186 186
187(defun mpc-string-prefix-p (str1 str2) 187(define-obsolete-function-alias 'mpc-string-prefix-p 'string-prefix-p "24.2")
188 ;; FIXME: copied from pcvs-util.el.
189 "Tell whether STR1 is a prefix of STR2."
190 (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
191 188
192;; This can speed up mpc--song-search significantly. The table may grow 189;; This can speed up mpc--song-search significantly. The table may grow
193;; very large, tho. It's only bounded by the fact that it gets flushed 190;; very large, tho. It's only bounded by the fact that it gets flushed
@@ -1690,7 +1687,7 @@ Return non-nil if a selection was deactivated."
1690 (process-put (mpc-proc) prop 1687 (process-put (mpc-proc) prop
1691 (delq nil 1688 (delq nil
1692 (mapcar (lambda (x) 1689 (mapcar (lambda (x)
1693 (if (mpc-string-prefix-p name x) 1690 (if (string-prefix-p name x)
1694 nil x)) 1691 nil x))
1695 new))))) 1692 new)))))
1696 (mpc-tagbrowser-refresh))) 1693 (mpc-tagbrowser-refresh)))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 9472d7df879..af00531137a 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1492,8 +1492,8 @@ Puts point on a blank line between them."
1492 1492
1493(defvar latex-complete-bibtex-cache nil) 1493(defvar latex-complete-bibtex-cache nil)
1494 1494
1495(defun latex-string-prefix-p (str1 str2) 1495(define-obsolete-function-alias 'latex-string-prefix-p
1496 (eq t (compare-strings str1 nil nil str2 0 (length str1)))) 1496 'string-prefix-p "24.2")
1497 1497
1498(defvar bibtex-reference-key) 1498(defvar bibtex-reference-key)
1499(declare-function reftex-get-bibfile-list "reftex-cite.el" ()) 1499(declare-function reftex-get-bibfile-list "reftex-cite.el" ())
@@ -1507,7 +1507,7 @@ Puts point on a blank line between them."
1507 keys) 1507 keys)
1508 (if (and (eq (car latex-complete-bibtex-cache) 1508 (if (and (eq (car latex-complete-bibtex-cache)
1509 (reftex-get-bibfile-list)) 1509 (reftex-get-bibfile-list))
1510 (latex-string-prefix-p (nth 1 latex-complete-bibtex-cache) 1510 (string-prefix-p (nth 1 latex-complete-bibtex-cache)
1511 key)) 1511 key))
1512 ;; Use the cache. 1512 ;; Use the cache.
1513 (setq keys (nth 2 latex-complete-bibtex-cache)) 1513 (setq keys (nth 2 latex-complete-bibtex-cache))
@@ -2051,10 +2051,7 @@ IN can be either a string (with the same % escapes in it) indicating
2051OUT describes the output file and is either a %-escaped string 2051OUT describes the output file and is either a %-escaped string
2052 or nil to indicate that there is no output file.") 2052 or nil to indicate that there is no output file.")
2053 2053
2054;; defsubst* gives better byte-code than defsubst. 2054(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.2")
2055(defsubst* tex-string-prefix-p (str1 str2)
2056 "Return non-nil if STR1 is a prefix of STR2"
2057 (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
2058 2055
2059(defun tex-guess-main-file (&optional all) 2056(defun tex-guess-main-file (&optional all)
2060 "Find a likely `tex-main-file'. 2057 "Find a likely `tex-main-file'.
@@ -2069,7 +2066,7 @@ of the current buffer."
2069 (with-current-buffer buf 2066 (with-current-buffer buf
2070 (when (and (cond 2067 (when (and (cond
2071 ((null all) (equal dir default-directory)) 2068 ((null all) (equal dir default-directory))
2072 ((eq all 'sub) (tex-string-prefix-p default-directory dir)) 2069 ((eq all 'sub) (string-prefix-p default-directory dir))
2073 (t)) 2070 (t))
2074 (stringp tex-main-file)) 2071 (stringp tex-main-file))
2075 (throw 'found (expand-file-name tex-main-file))))) 2072 (throw 'found (expand-file-name tex-main-file)))))
@@ -2078,7 +2075,7 @@ of the current buffer."
2078 (with-current-buffer buf 2075 (with-current-buffer buf
2079 (when (and (cond 2076 (when (and (cond
2080 ((null all) (equal dir default-directory)) 2077 ((null all) (equal dir default-directory))
2081 ((eq all 'sub) (tex-string-prefix-p default-directory dir)) 2078 ((eq all 'sub) (string-prefix-p default-directory dir))
2082 (t)) 2079 (t))
2083 buffer-file-name 2080 buffer-file-name
2084 ;; (or (easy-mmode-derived-mode-p 'latex-mode) 2081 ;; (or (easy-mmode-derived-mode-p 'latex-mode)
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.