mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
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.
This commit is contained in:
parent
f53a85a90a
commit
121b8917ec
8 changed files with 37 additions and 42 deletions
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
2012-04-16 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* 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):
|
||||
|
|
|
|||
|
|
@ -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 <monnier@iro.umontreal.ca>
|
||||
;; Keywords: multimedia
|
||||
|
|
@ -184,10 +184,7 @@ numerically rather than lexicographically."
|
|||
(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 @@ Return non-nil if a selection was deactivated."
|
|||
(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)))
|
||||
|
|
|
|||
|
|
@ -1492,8 +1492,8 @@ Puts point on a blank line between them."
|
|||
|
||||
(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 @@ Puts point on a blank line between them."
|
|||
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 @@ IN can be either a string (with the same % escapes in it) indicating
|
|||
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 @@ of the current buffer."
|
|||
(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 @@ of the current buffer."
|
|||
(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)
|
||||
|
|
|
|||
|
|
@ -182,9 +182,7 @@ arguments. If ARGS is not a list, no argument will be passed."
|
|||
(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
|
||||
|
|
|
|||
|
|
@ -432,8 +432,8 @@ If non-nil, NEW means to create a new buffer no matter what."
|
|||
(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 @@ RM-MSGS if non-nil means remove messages."
|
|||
(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 @@ Signal an error if there is no backup file."
|
|||
(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 @@ With prefix argument, prompt for cvs flags."
|
|||
(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 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
|
|||
(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 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
|
|||
(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)
|
||||
|
|
|
|||
|
|
@ -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 <dann@ics.uci.edu>
|
||||
;; Keywords: vc tools
|
||||
|
|
@ -556,7 +556,7 @@ If a prefix argument is given, move by that many lines."
|
|||
(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 @@ child files."
|
|||
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 @@ If it is a file, return the corresponding cons for the file itself."
|
|||
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 @@ If it is a file, return the corresponding cons for the file itself."
|
|||
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 it is a file, return the corresponding cons for the file itself."
|
|||
(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)
|
||||
|
|
|
|||
|
|
@ -537,13 +537,12 @@ editing!"
|
|||
(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))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <spiegel@gnu.org>
|
||||
|
|
@ -847,7 +847,7 @@ been updated to their corresponding values."
|
|||
(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 @@ use."
|
|||
(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 @@ to provide the `find-revision' operation instead."
|
|||
|
||||
|
||||
;; 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue