[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107944: Replace independent implemen
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107944: Replace independent implementations of string-prefix-p |
Date: |
Mon, 16 Apr 2012 19:57:09 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107944
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2012-04-16 19:57:09 -0400
message:
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.
modified:
lisp/ChangeLog
lisp/mpc.el
lisp/textmodes/tex-mode.el
lisp/vc/pcvs-util.el
lisp/vc/pcvs.el
lisp/vc/vc-dir.el
lisp/vc/vc-dispatcher.el
lisp/vc/vc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-04-16 20:13:38 +0000
+++ b/lisp/ChangeLog 2012-04-16 23:57:09 +0000
@@ -4,6 +4,14 @@
2012-04-16 Glenn Morris <address@hidden>
+ * 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.
+
* textmodes/two-column.el: Move custom options to the start.
(frame-width): Remove compat definition.
(2C-associate-buffer, 2C-dissociate):
=== modified file 'lisp/mpc.el'
--- a/lisp/mpc.el 2012-01-19 07:21:25 +0000
+++ b/lisp/mpc.el 2012-04-16 23:57:09 +0000
@@ -1,6 +1,6 @@
;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8;
lexical-binding: t -*-
-;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
;; Author: Stefan Monnier <address@hidden>
;; Keywords: multimedia
@@ -184,10 +184,7 @@
(abs res))
res))))))))
-(defun mpc-string-prefix-p (str1 str2)
- ;; FIXME: copied from pcvs-util.el.
- "Tell whether STR1 is a prefix of STR2."
- (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'mpc-string-prefix-p 'string-prefix-p "24.2")
;; This can speed up mpc--song-search significantly. The table may grow
;; very large, tho. It's only bounded by the fact that it gets flushed
@@ -1690,7 +1687,7 @@
(process-put (mpc-proc) prop
(delq nil
(mapcar (lambda (x)
- (if (mpc-string-prefix-p name x)
+ (if (string-prefix-p name x)
nil x))
new)))))
(mpc-tagbrowser-refresh)))
=== modified file 'lisp/textmodes/tex-mode.el'
--- a/lisp/textmodes/tex-mode.el 2012-04-09 13:05:48 +0000
+++ b/lisp/textmodes/tex-mode.el 2012-04-16 23:57:09 +0000
@@ -1492,8 +1492,8 @@
(defvar latex-complete-bibtex-cache nil)
-(defun latex-string-prefix-p (str1 str2)
- (eq t (compare-strings str1 nil nil str2 0 (length str1))))
+(define-obsolete-function-alias 'latex-string-prefix-p
+ 'string-prefix-p "24.2")
(defvar bibtex-reference-key)
(declare-function reftex-get-bibfile-list "reftex-cite.el" ())
@@ -1507,7 +1507,7 @@
keys)
(if (and (eq (car latex-complete-bibtex-cache)
(reftex-get-bibfile-list))
- (latex-string-prefix-p (nth 1 latex-complete-bibtex-cache)
+ (string-prefix-p (nth 1 latex-complete-bibtex-cache)
key))
;; Use the cache.
(setq keys (nth 2 latex-complete-bibtex-cache))
@@ -2051,10 +2051,7 @@
OUT describes the output file and is either a %-escaped string
or nil to indicate that there is no output file.")
-;; defsubst* gives better byte-code than defsubst.
-(defsubst* tex-string-prefix-p (str1 str2)
- "Return non-nil if STR1 is a prefix of STR2"
- (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.2")
(defun tex-guess-main-file (&optional all)
"Find a likely `tex-main-file'.
@@ -2069,7 +2066,7 @@
(with-current-buffer buf
(when (and (cond
((null all) (equal dir default-directory))
- ((eq all 'sub) (tex-string-prefix-p default-directory
dir))
+ ((eq all 'sub) (string-prefix-p default-directory dir))
(t))
(stringp tex-main-file))
(throw 'found (expand-file-name tex-main-file)))))
@@ -2078,7 +2075,7 @@
(with-current-buffer buf
(when (and (cond
((null all) (equal dir default-directory))
- ((eq all 'sub) (tex-string-prefix-p default-directory
dir))
+ ((eq all 'sub) (string-prefix-p default-directory dir))
(t))
buffer-file-name
;; (or (easy-mmode-derived-mode-p 'latex-mode)
=== modified file 'lisp/vc/pcvs-util.el'
--- a/lisp/vc/pcvs-util.el 2012-01-19 07:21:25 +0000
+++ b/lisp/vc/pcvs-util.el 2012-04-16 23:57:09 +0000
@@ -182,9 +182,7 @@
(if oneline (line-end-position) (point-max))))
(file-error nil)))
-(defun cvs-string-prefix-p (str1 str2)
- "Tell whether STR1 is a prefix of STR2."
- (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'cvs-string-prefix-p 'string-prefix-p "24.2")
;;;;
;;;; file names
=== modified file 'lisp/vc/pcvs.el'
--- a/lisp/vc/pcvs.el 2012-01-23 08:45:59 +0000
+++ b/lisp/vc/pcvs.el 2012-04-16 23:57:09 +0000
@@ -432,8 +432,8 @@
(case cvs-reuse-cvs-buffer
(always t)
(subdir
- (or (cvs-string-prefix-p default-directory dir)
- (cvs-string-prefix-p dir default-directory)))
+ (or (string-prefix-p default-directory dir)
+ (string-prefix-p dir default-directory)))
(samedir (string= default-directory dir)))
(return buffer)))))
;; we really have to create a new buffer:
@@ -887,7 +887,7 @@
(eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)
(not (when first-dir (setq first-dir nil) t))
(or (eq rm-dirs 'all)
- (not (cvs-string-prefix-p
+ (not (string-prefix-p
(cvs-fileinfo->dir last-fi)
(cvs-fileinfo->dir fi)))
(and (eq type 'DIRCHANGE) (eq rm-dirs 'empty))
@@ -1839,7 +1839,7 @@
(setq buffer-file-name (expand-file-name buffer-file-name))
(let (ret)
(dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
- (when (cvs-string-prefix-p
+ (when (string-prefix-p
(expand-file-name (cvs-fileinfo->full-name fi) dir)
buffer-file-name)
(setq ret t)))
@@ -2261,7 +2261,7 @@
(defun cvs-dir-member-p (fileinfo dir)
"Return true if FILEINFO represents a file in directory DIR."
(and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
- (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
+ (string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
(defun cvs-execute-single-file (fi extractor program constant-args)
"Internal function for `cvs-execute-single-file-list'."
@@ -2392,7 +2392,7 @@
(set-buffer cvs-buf)
;; look for a corresponding pcl-cvs buffer
(when (and (eq major-mode 'cvs-mode)
- (cvs-string-prefix-p default-directory dir))
+ (string-prefix-p default-directory dir))
(let ((subdir (substring dir (length default-directory))))
(set-buffer buffer)
(set (make-local-variable 'cvs-buffer) cvs-buf)
@@ -2423,7 +2423,7 @@
(set-buffer cvs-buf)
;; look for a corresponding pcl-cvs buffer
(when (and (eq major-mode 'cvs-mode)
- (cvs-string-prefix-p default-directory file))
+ (string-prefix-p default-directory file))
(let* ((file (substring file (length default-directory)))
(fi (cvs-create-fileinfo
(if (string= "0" version)
=== modified file 'lisp/vc/vc-dir.el'
--- a/lisp/vc/vc-dir.el 2012-01-19 07:21:25 +0000
+++ b/lisp/vc/vc-dir.el 2012-04-16 23:57:09 +0000
@@ -1,6 +1,6 @@
;;; vc-dir.el --- Directory status display under VC
-;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
;; Author: Dan Nicolaescu <address@hidden>
;; Keywords: vc tools
@@ -556,7 +556,7 @@
(let ((data (ewoc-data crt))
(dir (vc-dir-node-directory crt)))
(and (vc-dir-fileinfo->directory data)
- (vc-string-prefix-p dir argdir)
+ (string-prefix-p dir argdir)
(vc-dir-fileinfo->marked data)
(setq found data))))
found))
@@ -818,7 +818,7 @@
data)
(while
(and (setq crt (ewoc-next vc-ewoc crt))
- (vc-string-prefix-p dir
+ (string-prefix-p dir
(progn
(setq data (ewoc-data crt))
(vc-dir-node-directory crt))))
@@ -846,7 +846,7 @@
data)
(while
(and (setq crt (ewoc-next vc-ewoc crt))
- (vc-string-prefix-p dir (progn
+ (string-prefix-p dir (progn
(setq data (ewoc-data crt))
(vc-dir-node-directory crt))))
(unless (vc-dir-fileinfo->directory data)
@@ -878,10 +878,10 @@
children
dname)
;; Find DIR
- (while (and crt (not (vc-string-prefix-p
+ (while (and crt (not (string-prefix-p
dirname (vc-dir-node-directory crt))))
(setq crt (ewoc-next vc-ewoc crt)))
- (while (and crt (vc-string-prefix-p
+ (while (and crt (string-prefix-p
dirname
(setq dname (vc-dir-node-directory crt))))
(let ((data (ewoc-data crt)))
@@ -915,7 +915,7 @@
(if (not (derived-mode-p 'vc-dir-mode))
(push status-buf drop)
(let ((ddir default-directory))
- (when (vc-string-prefix-p ddir file)
+ (when (string-prefix-p ddir file)
(if (file-directory-p file)
(progn
(vc-dir-resync-directory-files file)
=== modified file 'lisp/vc/vc-dispatcher.el'
--- a/lisp/vc/vc-dispatcher.el 2012-01-19 07:21:25 +0000
+++ b/lisp/vc/vc-dispatcher.el 2012-04-16 23:57:09 +0000
@@ -537,13 +537,12 @@
(kill-buffer (current-buffer)))))
(declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
-(declare-function vc-string-prefix-p "vc" (prefix string))
(defun vc-resynch-buffers-in-directory (directory &optional keep noquery
reset-vc-info)
"Resync all buffers that visit files in DIRECTORY."
(dolist (buffer (buffer-list))
(let ((fname (buffer-file-name buffer)))
- (when (and fname (vc-string-prefix-p directory fname))
+ (when (and fname (string-prefix-p directory fname))
(with-current-buffer buffer
(vc-resynch-buffer fname keep noquery reset-vc-info))))))
=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el 2012-03-24 13:23:23 +0000
+++ b/lisp/vc/vc.el 2012-04-16 23:57:09 +0000
@@ -1,6 +1,6 @@
;;; vc.el --- drive a version-control system from within Emacs
-;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
;; Author: FSF (see below for full credits)
;; Maintainer: Andre Spiegel <address@hidden>
@@ -847,7 +847,7 @@
(if (file-directory-p file)
(dolist (buffer (buffer-list))
(let ((fname (buffer-file-name buffer)))
- (when (and fname (vc-string-prefix-p file fname))
+ (when (and fname (string-prefix-p file fname))
(push fname flist))))
(push file flist)))
,form
@@ -900,7 +900,7 @@
(lambda (arg)
(message "arg %s" arg)
(and (file-directory-p arg)
- (vc-string-prefix-p (expand-file-name arg) def-dir)))))))
+ (string-prefix-p (expand-file-name arg) def-dir)))))))
(let ((default-directory repo-dir))
(vc-call-backend bk 'create-repo))
(throw 'found bk))))
@@ -2809,11 +2809,7 @@
;; These things should probably be generally available
-
-(defun vc-string-prefix-p (prefix string)
- (let ((lpref (length prefix)))
- (and (>= (length string) lpref)
- (eq t (compare-strings prefix nil nil string nil lpref)))))
+(define-obsolete-function-alias 'vc-string-prefix-p 'string-prefix-p "24.2")
(defun vc-file-tree-walk (dirname func &rest args)
"Walk recursively through DIRNAME.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107944: Replace independent implementations of string-prefix-p,
Glenn Morris <=