Commits

Anonymous committed 167f4c2

added psvn and enabled idle-highlight

Comments (0)

Files changed (3)

              (display-time)
 
 (idle-highlight t)
+(add-hook 'python-mode-hook 'idle-highlight)
 
 (put 'narrow-to-region 'disabled nil)
+(require 'psvn)

elpa/idle-highlight-1.0/idle-highlight-autoloads.el

 ;;
 ;;; Code:
 
-
+
 ;;;### (autoloads (idle-highlight) "idle-highlight" "idle-highlight.el"
 ;;;;;;  (18870 59736))
 ;;; Generated autoloads from idle-highlight.el
 \(fn &optional ARG)" t nil)
 
 ;;;***
-
+
 ;;;### (autoloads nil nil ("idle-highlight-pkg.el") (18870 59736
 ;;;;;;  908032))
 
 ;;;***
-
+
 ;; Local Variables:
 ;; version-control: never
 ;; no-byte-compile: t
+;;; psvn.el --- Subversion interface for emacs
+;; Copyright (C) 2002-2009 by Stefan Reichoer
+
+;; Author: Stefan Reichoer <stefan@xsteve.at>
+;; $Id: psvn.el 35820 2009-02-11 21:35:14Z xsteve $
+
+;; psvn.el is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; psvn.el is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary
+
+;; psvn.el is tested with GNU Emacs 21.3 on windows, debian linux,
+;; freebsd5, red hat el4, ubuntu edgy with svn 1.4.0
+
+;; psvn.el needs at least svn 1.1.0
+;; if you upgrade to a higher version, you need to do a fresh checkout
+
+;; psvn.el is an interface for the revision control tool subversion
+;; (see http://subversion.tigris.org)
+;; psvn.el provides a similar interface for subversion as pcl-cvs for cvs.
+;; At the moment the following commands are implemented:
+;;
+;; M-x svn-status: run 'svn -status -v'
+;; M-x svn-examine (like pcl-cvs cvs-examine) is alias for svn-status
+;;
+;; and show the result in the svn-status-buffer-name buffer (normally: *svn-status*).
+;; If svn-status-verbose is set to nil, only "svn status" without "-v"
+;; is run. Currently you have to toggle this variable manually.
+;; This buffer uses svn-status mode in which the following keys are defined:
+;; g     - svn-status-update:               run 'svn status -v'
+;; M-s   - svn-status-update:               run 'svn status -v'
+;; C-u g - svn-status-update:               run 'svn status -vu'
+;; =     - svn-status-show-svn-diff         run 'svn diff'
+;; l     - svn-status-show-svn-log          run 'svn log'
+;; i     - svn-status-info                  run 'svn info'
+;; r     - svn-status-revert                run 'svn revert'
+;; X v   - svn-status-resolved              run 'svn resolved'
+;; U     - svn-status-update-cmd            run 'svn update'
+;; M-u   - svn-status-update-cmd            run 'svn update'
+;; c     - svn-status-commit                run 'svn commit'
+;; a     - svn-status-add-file              run 'svn add --non-recursive'
+;; A     - svn-status-add-file-recursively  run 'svn add'
+;; +     - svn-status-make-directory        run 'svn mkdir'
+;; R     - svn-status-mv                    run 'svn mv'
+;; C     - svn-status-cp                    run 'svn cp'
+;; D     - svn-status-rm                    run 'svn rm'
+;; M-c   - svn-status-cleanup               run 'svn cleanup'
+;; k     - svn-status-lock                  run 'svn lock'
+;; K     - svn-status-unlock                run 'svn unlock'
+;; b     - svn-status-blame                 run 'svn blame'
+;; X e   - svn-status-export                run 'svn export'
+;; RET   - svn-status-find-file-or-examine-directory
+;; ^     - svn-status-examine-parent
+;; ~     - svn-status-get-specific-revision
+;; E     - svn-status-ediff-with-revision
+;; X X   - svn-status-resolve-conflicts
+;; S g   - svn-status-grep-files
+;; S s   - svn-status-search-files
+;; s     - svn-status-show-process-buffer
+;; h     - svn-status-pop-to-partner-buffer
+;; e     - svn-status-toggle-edit-cmd-flag
+;; ?     - svn-status-toggle-hide-unknown
+;; _     - svn-status-toggle-hide-unmodified
+;; m     - svn-status-set-user-mark
+;; u     - svn-status-unset-user-mark
+;; $     - svn-status-toggle-elide
+;; w     - svn-status-copy-current-line-info
+;; DEL   - svn-status-unset-user-mark-backwards
+;; * !   - svn-status-unset-all-usermarks
+;; * ?   - svn-status-mark-unknown
+;; * A   - svn-status-mark-added
+;; * M   - svn-status-mark-modified
+;; * P   - svn-status-mark-modified-properties
+;; * D   - svn-status-mark-deleted
+;; * *   - svn-status-mark-changed
+;; * .   - svn-status-mark-by-file-ext
+;; * %   - svn-status-mark-filename-regexp
+;; * s   - svn-status-store-usermarks
+;; * l   - svn-status-load-usermarks
+;; .     - svn-status-goto-root-or-return
+;; f     - svn-status-find-file
+;; o     - svn-status-find-file-other-window
+;; C-o   - svn-status-find-file-other-window-noselect
+;; v     - svn-status-view-file-other-window
+;; I     - svn-status-parse-info
+;; V     - svn-status-svnversion
+;; P l   - svn-status-property-list
+;; P s   - svn-status-property-set
+;; P d   - svn-status-property-delete
+;; P e   - svn-status-property-edit-one-entry
+;; P i   - svn-status-property-ignore-file
+;; P I   - svn-status-property-ignore-file-extension
+;; P C-i - svn-status-property-edit-svn-ignore
+;; P k   - svn-status-property-set-keyword-list
+;; P K i - svn-status-property-set-keyword-id
+;; P K d - svn-status-property-set-keyword-date
+;; P y   - svn-status-property-set-eol-style
+;; P x   - svn-status-property-set-executable
+;; P m   - svn-status-property-set-mime-type
+;; H     - svn-status-use-history
+;; x     - svn-status-update-buffer
+;; q     - svn-status-bury-buffer
+
+;; C-x C-j - svn-status-dired-jump
+
+;; The output in the buffer contains this header to ease reading
+;; of svn output:
+;;   FPH BASE CMTD Author   em File
+;; F = Filemark
+;; P = Property mark
+;; H = History mark
+;; BASE = local base revision
+;; CMTD = last committed revision
+;; Author = author of change
+;; em = "**" or "(Update Available)" [see `svn-status-short-mod-flag-p']
+;;      if file can be updated
+;; File = path/filename
+;;
+
+;; To use psvn.el put the following line in your .emacs:
+;; (require 'psvn)
+;; Start the svn interface with M-x svn-status
+
+;; The latest version of psvn.el can be found at:
+;;   http://www.xsteve.at/prg/emacs/psvn.el
+;; Or you can check it out from the subversion repository:
+;;   svn co http://svn.collab.net/repos/svn/trunk/contrib/client-side/emacs emacs-svn
+
+;; TODO:
+;; * shortcut for svn propset svn:keywords "Date" psvn.el
+;; * docstrings for the functions
+;; * perhaps shortcuts for ranges, dates
+;; * when editing the command line - offer help from the svn client
+;; * finish svn-status-property-set
+;; * Add repository browser
+;; * Get rid of all byte-compiler warnings
+;; * SVK working copy support
+;; * multiple independent buffers in svn-status-mode
+;; There are "TODO" comments in other parts of this file as well.
+
+;; Overview over the implemented/not (yet) implemented svn sub-commands:
+;; * add                       implemented
+;; * blame                     implemented
+;; * cat                       implemented
+;; * checkout (co)             implemented
+;; * cleanup                   implemented
+;; * commit (ci)               implemented
+;; * copy (cp)                 implemented
+;; * delete (del, remove, rm)  implemented
+;; * diff (di)                 implemented
+;; * export                    implemented
+;; * help (?, h)
+;; * import                    used         (in svn-admin-create-trunk-directory)
+;; * info                      implemented
+;; * list (ls)                 implemented
+;; * lock                      implemented
+;; * log                       implemented
+;; * merge
+;; * mkdir                     implemented
+;; * move (mv, rename, ren)    implemented
+;; * propdel (pdel)            implemented
+;; * propedit (pedit, pe)      not needed
+;; * propget (pget, pg)        used         (in svn-status-property-edit)
+;; * proplist (plist, pl)      implemented
+;; * propset (pset, ps)        used         (in svn-prop-edit-do-it)
+;; * resolved                  implemented
+;; * revert                    implemented
+;; * status (stat, st)         implemented
+;; * switch (sw)
+;; * unlock                    implemented
+;; * update (up)               implemented
+
+;; For the not yet implemented commands you should use the command line
+;; svn client. If there are user requests for any missing commands I will
+;; probably implement them.
+
+;; There is also limited support for the web-based software project management and bug/issue tracking system trac
+;; Trac ticket links can be enabled in the *svn-log* buffers when using the following:
+;; (setq svn-log-link-handlers '(trac-ticket-short))
+
+;; ---------------------------
+;; Frequently asked questions:
+;; ---------------------------
+
+;; Q1: I need support for user names with blanks/spaces
+;; A1: Add the user names to svn-user-names-including-blanks and set the
+;;     svn-pre-parse-status-hook.
+;;     The problem is, that the user names and the file names from the svn status
+;;     output can both contain blanks. Blanks in file names are supported.
+;;     the svn-user-names-including-blanks list is used to replace the spaces
+;;     in the user names with - to overcome this problem
+
+;; Q2: My svn-update command it taking a really long time. How can I
+;;     see what's going on?
+;; A2: In the *svn-status* buffer press "s".
+
+;; Q3: How do I enter a username and password?
+;; A3: In the *svn-status* buffer press "s", switch to the
+;;     *svn-process* buffer and press enter. You will be prompted for
+;;     username and password.
+
+;; Q4: What does "?", "M", and "C" in the first column of the
+;;     *svn-status* buffer mean?
+;; A4: "?" means the file(s) is not under Subversion control
+;;     "M" means you have a locally modified file
+;;     "C" means there is a conflict
+;;     "@$&#!" means someone is saying nasty things to you
+
+
+;; Comments / suggestions and bug reports are welcome!
+
+;; Development notes
+;; -----------------
+
+;; "svn-" is the package prefix used in psvn.el.  There are also longer
+;; prefixes which clarify the code and help symbol completion, but they
+;; are not intended to prevent name clashes with other packages.  All
+;; interactive commands meant to be used only in a specific mode should
+;; have names beginning with the name of that mode: for example,
+;; "svn-status-add-file" in "svn-status-mode".  "psvn" should be used
+;; only in names of files, customization groups, and features.  If SVK
+;; support is ever added, it should use "svn-svk-" when no existing
+;; prefix is applicable.
+
+;; Many of the variables marked as `risky-local-variable' are probably
+;; impossible to abuse, as the commands that read them are used only in
+;; buffers that are not visiting any files.  Better safe than sorry.
+
+;;; Code:
+
+(require 'easymenu)
+
+(eval-when-compile (require 'dired))
+(eval-when-compile (require 'ediff-util))
+(eval-when-compile (require 'ediff-wind))
+(eval-when-compile (require 'elp))
+(eval-when-compile (require 'pp))
+
+(condition-case nil
+    (progn
+      (require 'diff-mode))
+  (error nil))
+
+(defconst svn-psvn-revision "$Id: psvn.el 35820 2009-02-11 21:35:14Z xsteve $"
+  "The revision number of psvn.")
+
+;;; user setable variables
+(defcustom svn-status-verbose t
+  "*Add '-v' to svn status call.
+This can be toggled with \\[svn-status-toggle-svn-verbose-flag]."
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-log-edit-file-name "++svn-log++"
+  "*Name of a saved log file.
+This can be either absolute, or relative to the default directory
+of the `svn-log-edit-buffer-name' buffer."
+  :type 'file
+  :group 'psvn)
+(put 'svn-log-edit-file-name 'risky-local-variable t)
+(defcustom svn-log-edit-insert-files-to-commit t
+  "*Insert the filelist to commit in the *svn-log* buffer"
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-log-edit-show-diff-for-commit nil
+  "*Show the diff being committed when you run `svn-status-commit.'."
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-log-edit-use-log-edit-mode
+  (and (condition-case nil (require 'log-edit) (error nil)) t)
+  "*Use log-edit-mode as base for svn-log-edit-mode
+This variable takes effect only when psvn.el is being loaded."
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-log-edit-paragraph-start
+  "$\\|[ \t]*$\\|##.*$\\|\\*.*:.*$\\|[ \t]+(.+):.*$"
+  "*Value used for `paragraph-start' in `svn-log-edit-buffer-name' buffer."
+  :type 'regexp
+  :group 'psvn)
+(defcustom svn-log-edit-paragraph-separate "$\\|##.*$"
+  "*Value used for `paragraph-separate' in `svn-log-edit-buffer-name' buffer."
+  :type 'regexp
+  :group 'psvn)
+(defcustom svn-status-hide-unknown nil
+  "*Hide unknown files in `svn-status-buffer-name' buffer.
+This can be toggled with \\[svn-status-toggle-hide-unknown]."
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-status-hide-unmodified nil
+  "*Hide unmodified files in `svn-status-buffer-name' buffer.
+This can be toggled with \\[svn-status-toggle-hide-unmodified]."
+  :type 'boolean
+  :group 'psvn)
+(defcustom svn-status-sort-status-buffer t
+  "*Whether to sort the `svn-status-buffer-name' buffer.
+
+Setting this variable to nil speeds up \\[M-x svn-status], however the
+listing may then become incorrect.
+
+This can be toggled with \\[svn-status-toggle-sort-status-buffer]."
+  :type 'boolean
+  :group 'psvn)
+
+(defcustom svn-status-ediff-delete-temporary-files nil
+  "*Whether to delete temporary ediff files. If set to ask, ask the user"
+  :type '(choice (const t)
+                 (const nil)
+                 (const ask))
+  :group 'psvn)
+
+(defcustom svn-status-changelog-style 'changelog
+  "*The changelog style that is used for `svn-file-add-to-changelog'.
+Possible values are:
+ 'changelog: use `add-change-log-entry-other-window'
+ 'svn-dev: use commit messages that are used by the svn developers
+ a function: This function is called to add a new entry to the changelog file.
+"
+  :type '(set (const changelog)
+              (const svn-dev))
+  :group 'psvn)
+
+(defcustom svn-status-unmark-files-after-list '(commit revert)
+  "*List of operations after which all user marks will be removed.
+Possible values are: commit, revert."
+  :type '(set (const commit)
+              (const revert))
+  :group 'psvn)
+
+(defcustom svn-status-preserve-window-configuration t
+  "*Try to preserve the window configuration."
+  :type 'boolean
+  :group 'psvn)
+
+(defcustom svn-status-auto-revert-buffers t
+  "*Auto revert buffers that have changed on disk."
+  :type 'boolean
+  :group 'psvn)
+
+(defcustom svn-status-fancy-file-state-in-modeline t
+  "*Show a color dot in the modeline that describes the state of the current file."
+  :type 'boolean
+  :group 'psvn)
+
+(defcustom svn-status-negate-meaning-of-arg-commands '()
+  "*List of operations that should use a negated meaning of the prefix argument.
+The supported functions are `svn-status' and `svn-status-set-user-mark'."
+  :type '(set (function-item svn-status)
+              (function-item svn-status-set-user-mark))
+  :group 'psvn)
+
+(defcustom svn-status-svn-executable "svn"
+  "*The name of the svn executable.
+This can be either absolute or looked up on `exec-path'."
+  ;; Don't use (file :must-match t).  It doesn't know about `exec-path'.
+  :type 'file
+  :group 'psvn)
+(put 'svn-status-svn-executable 'risky-local-variable t)
+
+(defcustom svn-status-default-export-directory "~/" "*The default directory that is suggested svn export."
+  :type 'file
+  :group 'psvn)
+
+(defcustom svn-status-svn-environment-var-list '("LC_MESSAGES=C" "LC_ALL=")
+  "*A list of environment variables that should be set for that svn process.
+Each element is either a string \"VARIABLE=VALUE\" which will be added to
+the environment when svn is run, or just \"VARIABLE\" which causes that
+variable to be entirely removed from the environment.
+
+The default setting is '(\"LC_MESSAGES=C\" \"LC_ALL=\"). This ensures that the svn command
+line client does not output localized strings. psvn.el relies on the english
+messages."
+  :type '(repeat string)
+  :group 'psvn)
+(put 'svn-status-svn-environment-var-list 'risky-local-variable t)
+
+(defcustom svn-browse-url-function nil
+  ;; If the user hasn't changed `svn-browse-url-function', then changing
+  ;; `browse-url-browser-function' should affect psvn even after it has
+  ;; been loaded.
+  "Function to display a Subversion related WWW page in a browser.
+So far, this is used only for \"trac\" issue tracker integration.
+By default, this is nil, which means use `browse-url-browser-function'.
+Any non-nil value overrides that variable, with the same syntax."
+  ;; It would be nice to show the full list of browsers supported by
+  ;; browse-url, but (custom-variable-type 'browse-url-browser-function)
+  ;; returns just `function' if browse-url has not yet been loaded,
+  ;; and there seems to be no easy way to autoload browse-url when
+  ;; the custom-type of svn-browse-url-function is actually needed.
+  ;; So I'll only offer enough choices to cover all supported types.
+  :type `(choice (const :tag "Specified by `browse-url-browser-function'" nil)
+                 (function :value browse-url-default-browser
+                           ;; In XEmacs 21.4.17, the `function' widget matches
+                           ;; all objects.  Constrain it here so that alists
+                           ;; fall through to the next choice.  Accept either
+                           ;; a symbol (fbound or not) or a lambda expression.
+                           :match ,(lambda (widget value)
+                                     (or (symbolp value) (functionp value))))
+                 (svn-alist :tag "Regexp/function association list"
+                            :key-type regexp :value-type function
+                            :value (("." . browse-url-default-browser))))
+  :link '(emacs-commentary-link "browse-url")
+  :group 'psvn)
+;; (put 'svn-browse-url-function 'risky-local-variable t)
+;; already implied by "-function" suffix
+
+(defcustom svn-status-window-alist
+  '((diff "*svn-diff*") (log "*svn-log*") (info t) (blame t) (proplist t) (update t))
+  "An alist to specify which windows should be used for svn command outputs.
+The following keys are supported: diff, log, info, blame, proplist, update.
+The following values can be given:
+nil       ... show in `svn-process-buffer-name' buffer
+t         ... show in dedicated *svn-info* buffer
+invisible ... don't show the buffer (eventually useful for update)
+a string  ... show in a buffer named string"
+  :type '(svn-alist
+          :key-type symbol
+          :value-type (group
+                       (choice
+                        (const :tag "Show in *svn-process* buffer" nil)
+                        (const :tag "Show in dedicated *svn-info* buffer" t)
+                        (const :tag "Don't show the output" invisible)
+                        (string :tag "Show in a buffer named"))))
+  :options '(diff log info blame proplist update)
+  :group 'psvn)
+
+(defcustom svn-status-short-mod-flag-p t
+  "*Whether the mark for out of date files is short or long.
+
+If this variable is is t, and a file is out of date (i.e., there is a newer
+version in the repository than the working copy), then the file will
+be marked by \"**\"
+
+If this variable is nil, and the file is out of date then the longer phrase
+\"(Update Available)\" is used.
+
+In either case the mark gets the face
+`svn-status-update-available-face', and will only be visible if
+`\\[svn-status-update]' is run with a prefix argument"
+  :type '(choice (const :tag "Short \"**\"" t)
+                 (const :tag "Long \"(Update Available)\"" nil))
+  :group 'psvn)
+
+(defvar svn-status-debug-level 0 "The psvn.el debugging verbosity level.
+The higher the number, the more debug messages are shown.
+
+See `svn-status-message' for the meaning of values for that variable.")
+
+(defvar svn-bookmark-list nil "A list of locations for a quick access via `svn-status-via-bookmark'")
+;;(setq svn-bookmark-list '(("proj1" . "~/work/proj1")
+;;                          ("doc1" . "~/docs/doc1")))
+
+(defvar svn-status-buffer-name "*svn-status*" "Name for the svn status buffer")
+(defvar svn-process-buffer-name " *svn-process*" "Name for the svn process buffer")
+(defvar svn-log-edit-buffer-name "*svn-log-edit*" "Name for the svn log-edit buffer")
+
+(defcustom svn-status-use-header-line
+  (if (boundp 'header-line-format) t 'inline)
+  "*Whether a header line should be used.
+When t: Use the emacs header line
+When 'inline: Insert the header line in the `svn-status-buffer-name' buffer
+Otherwise: Don't display a header line"
+  :type '(choice (const :tag "Show column titles as a header line" t)
+                 (const :tag "Insert column titles as text in the buffer" inline)
+                 (other :tag "No column titles" nil))
+  :group 'psvn)
+
+;;; default arguments to pass to svn commands
+;; TODO: When customizing, an option menu or completion might be nice....
+(defcustom svn-status-default-log-arguments '("-v")
+  "*List of arguments to pass to svn log.
+\(used in `svn-status-show-svn-log'; override these by giving prefixes\)."
+  :type '(repeat string)
+  :group 'psvn)
+(put 'svn-status-default-log-arguments 'risky-local-variable t)
+
+(defcustom svn-status-default-commit-arguments '()
+  "*List of arguments to pass to svn commit.
+If you don't like recursive commits, set this value to (\"-N\")
+or mark the directory before committing it.
+Do not put an empty string here, except as an argument of an option:
+Subversion and the operating system may treat that as a file name
+equivalent to \".\", so you would commit more than you intended."
+  :type '(repeat string)
+  :group 'psvn)
+(put 'svn-status-default-commit-arguments 'risky-local-variable t)
+
+(defcustom svn-status-default-diff-arguments '("-x" "--ignore-eol-style")
+  "*A list of arguments that is passed to the svn diff command.
+When the built in diff command is used,
+the following options are available: --ignore-eol-style, --ignore-space-change,
+--ignore-all-space, --ignore-eol-style.
+The following setting ignores eol style changes and all white space changes:
+'(\"-x\" \"--ignore-eol-style --ignore-all-space\")
+
+If you'd like to suppress whitespace changes using the external diff command
+use the following value:
+'(\"--diff-cmd\" \"diff\" \"-x\" \"-wbBu\")
+
+"
+  :type '(repeat string)
+  :group 'psvn)
+(put 'svn-status-default-diff-arguments 'risky-local-variable t)
+
+(defcustom svn-status-default-status-arguments '()
+  "*A list of arguments that is passed to the svn status command.
+The following options are available: --ignore-externals
+
+"
+  :type '(repeat string)
+  :group 'psvn)
+(put 'svn-status-default-status-arguments 'risky-local-variable t)
+
+(defcustom svn-status-default-blame-arguments '("-x" "--ignore-eol-style")
+  "*A list of arguments that is passed to the svn blame command.
+See `svn-status-default-diff-arguments' for some examples."
+  :type '(repeat string)
+  :group 'psvn)
+
+(put 'svn-status-default-blame-arguments 'risky-local-variable t)
+
+(defvar svn-trac-project-root nil
+  "Path for an eventual existing trac issue tracker.
+This can be set with \\[svn-status-set-trac-project-root].")
+
+(defvar svn-status-module-name nil
+  "*A short name for the actual project.
+This can be set with \\[svn-status-set-module-name].")
+
+(defvar svn-status-branch-list nil
+  "*A list of known branches for the actual project
+This can be set with \\[svn-status-set-branch-list].
+
+The list contains full repository paths or shortcuts starting with \#
+\# at the beginning is replaced by the repository url.
+\#1\# has the special meaning that all paths below the given directory
+will be considered for interactive selections.
+
+A useful setting might be: '\(\"\#trunk\" \"\#1\#tags\" \"\#1\#branches\")")
+
+(defvar svn-status-load-state-before-svn-status t
+  "*Whether to automatically restore state from ++psvn.state file before running svn-status.")
+
+(defvar svn-log-link-handlers nil "A list of link handlers in *svn-log* buffers.
+These link handlers must be registered via `svn-log-register-link-handler'")
+
+;;; hooks
+(defvar svn-status-mode-hook nil "Hook run when entering `svn-status-mode'.")
+(defvar svn-log-edit-mode-hook nil "Hook run when entering `svn-log-edit-mode'.")
+(defvar svn-log-edit-done-hook nil "Hook run after commiting files via svn.")
+;; (put 'svn-log-edit-mode-hook 'risky-local-variable t)
+;; (put 'svn-log-edit-done-hook 'risky-local-variable t)
+;; already implied by "-hook" suffix
+
+(defvar svn-post-process-svn-output-hook nil "Hook that can be used to preprocess the output from svn.
+The function `svn-status-remove-control-M' can be useful for that hook")
+
+(when (eq system-type 'windows-nt)
+  (add-hook 'svn-post-process-svn-output-hook 'svn-status-remove-control-M))
+
+(defvar svn-status-svn-process-coding-system (when (boundp 'locale-coding-system) locale-coding-system)
+  "The coding system that is used for the svn command line client.
+It is used in svn-run, if it is not nil.")
+
+(defvar svn-status-svn-file-coding-system 'undecided-unix
+  "The coding system that is used to save files that are loaded as
+parameter or data files via the svn command line client.
+It is used in the following functions: `svn-prop-edit-do-it', `svn-log-edit-done'.
+You could set it to 'utf-8")
+
+(defcustom svn-status-use-ido-completion
+  (fboundp 'ido-completing-read)
+  "*Use ido completion functionality."
+  :type 'boolean
+  :group 'psvn)
+
+(defvar svn-status-completing-read-function
+  (if svn-status-use-ido-completion 'ido-completing-read 'completing-read))
+
+;;; experimental features
+(defvar svn-status-track-user-input nil "Track user/password queries.
+This feature is implemented via a process filter.
+It is an experimental feature.")
+
+(defvar svn-status-refresh-info nil "Whether `svn-status-update-buffer' should call `svn-status-parse-info'.")
+
+;;; Customize group
+(defgroup psvn nil
+  "Subversion interface for Emacs."
+  :group 'tools)
+
+(defgroup psvn-faces nil
+  "psvn faces."
+  :group 'psvn)
+
+
+(eval-and-compile
+  (require 'cl)
+  (defconst svn-xemacsp (featurep 'xemacs))
+  (if svn-xemacsp
+      (require 'overlay)
+    (require 'overlay nil t)))
+
+(defcustom svn-status-display-full-path nil
+  "Specifies how the filenames look like in the listing.
+If t, their full path name will be displayed, else only the filename."
+  :type 'boolean
+  :group 'psvn)
+
+(defcustom svn-status-prefix-key [(control x) (meta s)]
+  "Prefix key for the psvn commands in the global keymap."
+  :type '(choice (const [(control x) ?v ?S])
+                 (const [(super s)])
+                 (const [(hyper s)])
+                 (const [(control x) ?v])
+                 (const [(control x) ?V])
+                 (sexp))
+  :group 'psvn
+  :set  (lambda (var value)
+          (if (boundp var)
+              (global-unset-key (symbol-value var)))
+          (set var value)
+          (global-set-key (symbol-value var) 'svn-global-keymap)))
+
+(defcustom svn-admin-default-create-directory "~/"
+  "*The default directory that is suggested for `svn-admin-create'."
+  :type 'string
+  :group 'psvn)
+
+(defvar svn-status-custom-hide-function nil
+  "A function that receives a line-info and decides whether to hide that line.
+See psvn.el for an example function.")
+;; (put 'svn-status-custom-hide-function 'risky-local-variable t)
+;; already implied by "-function" suffix
+
+
+;; Use the normally used mode for files ending in .~HEAD~, .~BASE~, ...
+(add-to-list 'auto-mode-alist '("\\.~?\\(HEAD\\|BASE\\|PREV\\)~?\\'" ignore t))
+
+;;; internal variables
+(defvar svn-status-directory-history nil "List of visited svn working directories.")
+(defvar svn-process-cmd nil)
+(defvar svn-status-info nil)
+(defvar svn-status-filename-to-buffer-position-cache (make-hash-table :test 'equal :weakness t))
+(defvar svn-status-base-info nil "The parsed result from the svn info command.")
+(defvar svn-status-initial-window-configuration nil)
+(defvar svn-status-default-column 23)
+(defvar svn-status-default-revision-width 4)
+(defvar svn-status-default-author-width 9)
+(defvar svn-status-line-format " %c%c%c %4s %4s %-9s")
+(defvar svn-start-of-file-list-line-number 0)
+(defvar svn-status-files-to-commit nil
+  "List of files to commit at `svn-log-edit-done'.
+This is always set together with `svn-status-recursive-commit'.")
+(defvar svn-status-recursive-commit nil
+  "Non-nil if the next commit should be recursive.
+This is always set together with `svn-status-files-to-commit'.")
+(defvar svn-log-edit-update-log-entry nil
+  "Revision number whose log entry is being edited.
+This is nil if the log entry is for a new commit.")
+(defvar svn-status-pre-commit-window-configuration nil)
+(defvar svn-status-pre-propedit-window-configuration nil)
+(defvar svn-status-head-revision nil)
+(defvar svn-status-root-return-info nil)
+(defvar svn-status-property-edit-must-match-flag nil)
+(defvar svn-status-propedit-property-name nil "The property name for the actual svn propset command")
+(defvar svn-status-propedit-file-list nil)
+(defvar svn-status-mode-line-process "")
+(defvar svn-status-mode-line-process-status "")
+(defvar svn-status-mode-line-process-edit-flag "")
+(defvar svn-status-edit-svn-command nil)
+(defvar svn-status-update-previous-process-output nil)
+(defvar svn-pre-run-asynch-recent-keys nil)
+(defvar svn-pre-run-mode-line-process nil)
+(defvar svn-status-temp-dir
+  (expand-file-name
+   (or
+    (when (boundp 'temporary-file-directory) temporary-file-directory) ;emacs
+    ;; XEmacs 21.4.17 can return "/tmp/kalle" from (temp-directory).
+    ;; `file-name-as-directory' adds a slash so we can append a file name.
+    (when (fboundp 'temp-directory) (file-name-as-directory (temp-directory)))
+    "/tmp/")) "The directory that is used to store temporary files for psvn.")
+;; Because `temporary-file-directory' is not a risky local variable in
+;; GNU Emacs 22.0.51, we don't mark `svn-status-temp-dir' as such either.
+(defvar svn-temp-suffix (make-temp-name "."))
+(put 'svn-temp-suffix 'risky-local-variable t)
+(defvar svn-status-temp-file-to-remove nil)
+(put 'svn-status-temp-file-to-remove 'risky-local-variable t)
+(defvar svn-status-temp-arg-file (concat svn-status-temp-dir "svn.arg" svn-temp-suffix))
+(put 'svn-status-temp-arg-file 'risky-local-variable t)
+(defvar svn-status-options nil)
+(defvar svn-status-remote)
+(defvar svn-status-commit-rev-number nil)
+(defvar svn-status-update-rev-number nil)
+(defvar svn-status-operated-on-dot nil)
+(defvar svn-status-last-commit-author nil)
+(defvar svn-status-elided-list nil)
+(defvar svn-status-last-output-buffer-name nil "The buffer name for the buffer that holds the output from the last executed svn command")
+(defvar svn-status-pre-run-svn-buffer nil)
+(defvar svn-status-update-list nil)
+(defvar svn-transient-buffers)
+(defvar svn-ediff-windows)
+(defvar svn-ediff-result)
+(defvar svn-status-last-diff-options nil)
+(defvar svn-status-blame-file-name nil)
+(defvar svn-status-blame-revision nil)
+(defvar svn-admin-last-repository-dir nil "The last repository url for various operations.")
+(defvar svn-last-cmd-ring (make-ring 30) "Ring that holds the last executed svn commands (for debugging purposes)")
+(defvar svn-status-cached-version-string nil)
+(defvar svn-client-version nil "The version number of the used svn client")
+(defvar svn-status-get-line-information-for-file nil)
+(defvar svn-status-base-dir-cache (make-hash-table :test 'equal :weakness nil))
+(defvar svn-status-usermark-storage (make-hash-table :test 'equal :weakness nil))
+(defvar svn-log-registered-link-handlers (make-hash-table :test 'eql :weakness nil))
+
+(defvar svn-status-partner-buffer nil "The partner buffer for this svn related buffer")
+(make-variable-buffer-local 'svn-status-partner-buffer)
+
+;; Emacs 21 defines these in ediff-init.el but it seems more robust
+;; to just declare the variables here than try to load that file.
+;; It is Ediff's job to declare these as risky-local-variable if needed.
+(defvar ediff-buffer-A)
+(defvar ediff-buffer-B)
+(defvar ediff-buffer-C)
+(defvar ediff-quit-hook)
+
+;; Ditto for log-edit.el.
+(defvar log-edit-initial-files)
+(defvar log-edit-callback)
+(defvar log-edit-listfun)
+
+;; Ediff does not use this variable in GNU Emacs 20.7, GNU Emacs 21.4,
+;; nor XEmacs 21.4.17.  However, pcl-cvs (a.k.a. pcvs) does.
+;; TODO: Check if this should be moved into the "svn-" namespace.
+(defvar ediff-after-quit-destination-buffer)
+
+;; That is an example for the svn-status-custom-hide-function:
+;; Note: For many cases it is a better solution to ignore files or
+;; file extensions via the svn-ignore properties (on P i, P I)
+;; (setq svn-status-custom-hide-function 'svn-status-hide-pyc-files)
+;; (defun svn-status-hide-pyc-files (info)
+;;   "Hide all pyc files in the `svn-status-buffer-name' buffer."
+;;   (let* ((fname (svn-status-line-info->filename-nondirectory info))
+;;          (fname-len (length fname)))
+;;     (and (> fname-len 4) (string= (substring fname (- fname-len 4)) ".pyc"))))
+
+;;; faces
+(defface svn-status-marked-face
+  '((((type tty) (class color)) (:foreground "green" :weight light))
+    (((class color) (background light)) (:foreground "green3"))
+    (((class color) (background dark)) (:foreground "palegreen2"))
+    (t (:weight bold)))
+  "Face to highlight the mark for user marked files in svn status buffers."
+  :group 'psvn-faces)
+
+(defface svn-status-marked-popup-face
+  '((((type tty) (class color)) (:foreground "green" :weight light))
+    (((class color) (background light)) (:foreground "green3"))
+    (((class color) (background dark)) (:foreground "palegreen2"))
+    (t (:weight bold)))
+  "Face to highlight the actual file, if a popup menu is activated."
+  :group 'psvn-faces)
+
+(defface svn-status-update-available-face
+  '((((type tty) (class color)) (:foreground "magenta" :weight light))
+    (((class color) (background light)) (:foreground "magenta"))
+    (((class color) (background dark)) (:foreground "yellow"))
+    (t (:weight bold)))
+  "Face used to highlight the 'out of date' mark.
+\(i.e., the mark used when there is a newer version in the repository
+than the working copy.\)
+
+See also `svn-status-short-mod-flag-p'."
+  :group 'psvn-faces)
+
+;based on cvs-filename-face
+(defface svn-status-directory-face
+  '((((type tty) (class color)) (:foreground "lightblue" :weight light))
+    (((class color) (background light)) (:foreground "blue4"))
+    (((class color) (background dark)) (:foreground "lightskyblue1"))
+    (t (:weight bold)))
+  "Face for directories in *svn-status* buffers.
+See `svn-status--line-info->directory-p' for what counts as a directory."
+  :group 'psvn-faces)
+
+;based on font-lock-comment-face
+(defface svn-status-filename-face
+  '((((class color) (background light)) (:foreground "chocolate"))
+    (((class color) (background dark)) (:foreground "beige")))
+  "Face for non-directories in *svn-status* buffers.
+See `svn-status--line-info->directory-p' for what counts as a directory."
+  :group 'psvn-faces)
+
+;not based on anything, may be horribly ugly!
+(defface svn-status-symlink-face
+  '((((class color) (background light)) (:foreground "cornflower blue"))
+    (((class color) (background dark)) (:foreground "cyan")))
+  "Face for symlinks in *svn-status* buffers.
+
+This is the face given to the actual link (i.e., the versioned item),
+the target of the link gets either `svn-status-filename-face' or
+`svn-status-directory-face'."
+  :group 'psvn-faces)
+
+;based on font-lock-warning-face
+(defface svn-status-locked-face
+  '((t
+     (:weight bold :foreground "Red")))
+  "Face for the phrase \"[ LOCKED ]\" `svn-status-buffer-name' buffers."
+  :group 'psvn-faces)
+
+;based on vhdl-font-lock-directive-face
+(defface svn-status-switched-face
+  '((((class color)
+      (background light))
+     (:foreground "CadetBlue"))
+    (((class color)
+      (background dark))
+     (:foreground "Aquamarine"))
+    (t
+     (:bold t :italic t)))
+  "Face for the phrase \"(switched)\" non-directories in svn status buffers."
+  :group 'psvn-faces)
+
+(if svn-xemacsp
+    (defface svn-status-blame-highlight-face
+      '((((type tty) (class color)) (:foreground "green" :weight light))
+        (((class color) (background light)) (:foreground "green3"))
+        (((class color) (background dark)) (:foreground "palegreen2"))
+        (t (:weight bold)))
+      "Default face for highlighting a line in svn status blame mode."
+      :group 'psvn-faces)
+  (defface svn-status-blame-highlight-face
+    '((t :inherit highlight))
+    "Default face for highlighting a line in svn status blame mode."
+    :group 'psvn-faces))
+
+(if svn-xemacsp
+    (defface svn-log-partner-highlight-face
+      '((((type tty) (class color)) (:foreground "yellow" :weight light))
+        (((class color) (background light)) (:foreground "gold"))
+        (((class color) (background dark)) (:foreground "gold"))
+        (t (:weight bold)))
+      "Default face for highlighting the partner in svn log mode."
+      :group 'psvn-faces)
+  (defface svn-log-partner-highlight-face
+  '((((class color) (background light))
+     (:background "light goldenrod" :weight bold))
+    (t (:weight bold)))
+    "Default face for highlighting the partner in svn log mode."
+    :group 'psvn-faces))
+
+(defface svn-status-blame-rev-number-face
+  '((((class color) (background light)) (:foreground "DarkGoldenrod"))
+    (((class color) (background dark)) (:foreground "LightGoldenrod"))
+    (t (:weight bold :slant italic)))
+  "Face to highlight revision numbers in the svn-blame mode."
+  :group 'psvn-faces)
+
+(defvar svn-highlight t)
+;; stolen from PCL-CVS
+(defun svn-add-face (str face &optional keymap)
+  "Return string STR decorated with the specified FACE.
+If `svn-highlight' is nil then just return STR."
+  (when svn-highlight
+    ;; Do not use `list*'; cl.el might not have been loaded.  We could
+    ;; put (require 'cl) at the top but let's try to manage without.
+    (add-text-properties 0 (length str)
+                         `(face ,face
+                                mouse-face highlight)
+;; 18.10.2004: the keymap parameter is not used (yet) in psvn.el
+;;                           ,@(when keymap
+;;                               `(mouse-face highlight
+;;                                 local-map ,keymap)))
+                         str))
+  str)
+
+(defun svn-status-maybe-add-face (condition text face)
+  "If CONDITION then add FACE to TEXT.
+Else return TEXT unchanged."
+  (if condition
+      (svn-add-face text face)
+    text))
+
+(defun svn-status-choose-face-to-add (condition text face1 face2)
+  "If CONDITION then add FACE1 to TEXT, else add FACE2 to TEXT."
+  (if condition
+      (svn-add-face text face1)
+    (svn-add-face text face2)))
+
+(defun svn-status-maybe-add-string (condition string face)
+  "If CONDITION then return STRING decorated with FACE.
+Otherwise, return \"\"."
+  (if condition
+      (svn-add-face string face)
+    ""))
+
+;; compatibility
+;; emacs 20
+(defalias 'svn-point-at-eol
+  (if (fboundp 'point-at-eol) 'point-at-eol 'line-end-position))
+(defalias 'svn-point-at-bol
+  (if (fboundp 'point-at-bol) 'point-at-bol 'line-beginning-position))
+(defalias 'svn-read-directory-name
+  (if (fboundp 'read-directory-name) 'read-directory-name 'read-file-name))
+
+(eval-when-compile
+  (if (not (fboundp 'gethash))
+      (require 'cl-macs)))
+(defalias 'svn-puthash (if (fboundp 'puthash) 'puthash 'cl-puthash))
+
+;; emacs 21
+(if (fboundp 'line-number-at-pos)
+    (defalias 'svn-line-number-at-pos 'line-number-at-pos)
+  (defun svn-line-number-at-pos (&optional pos)
+    "Return (narrowed) buffer line number at position POS.
+If POS is nil, use current buffer location."
+    (let ((opoint (or pos (point))) start)
+      (save-excursion
+        (goto-char (point-min))
+        (setq start (point))
+        (goto-char opoint)
+        (forward-line 0)
+        (1+ (count-lines start (point)))))))
+
+(defun svn-substring-no-properties (string &optional from to)
+  (if (fboundp 'substring-no-properties)
+      (substring-no-properties string from to)
+    (substring string (or from 0) to)))
+
+; xemacs
+;; Evaluate the defsubst at compile time, so that the byte compiler
+;; knows the definition and can inline calls.  It cannot detect the
+;; defsubst automatically from within the if form.
+(eval-and-compile
+  (if (fboundp 'match-string-no-properties)
+      (defalias 'svn-match-string-no-properties 'match-string-no-properties)
+    (defsubst svn-match-string-no-properties (match)
+      (buffer-substring-no-properties (match-beginning match) (match-end match)))))
+
+;; XEmacs 21.4.17 does not have an `alist' widget.  Define a replacement.
+;; To find out whether the `alist' widget exists, we cannot check just
+;; (get 'alist 'widget-type), because GNU Emacs 21.4 defines it in
+;; "wid-edit.el", which is not preloaded; it will be autoloaded when
+;; `widget-create' is called.  Instead, we call `widgetp', which is
+;; also autoloaded from "wid-edit.el".  XEmacs 21.4.17 does not have
+;; `widgetp' either, so we check that first.
+(if (and (fboundp 'widgetp) (widgetp 'alist))
+    (define-widget 'svn-alist 'alist
+      "An association list.
+Use this instead of `alist', for XEmacs 21.4 compatibility.")
+  (define-widget 'svn-alist 'list
+    "An association list.
+Use this instead of `alist', for XEmacs 21.4 compatibility."
+    :convert-widget 'svn-alist-convert-widget
+    :tag "Association List"
+    :key-type 'sexp
+    :value-type 'sexp)
+  (defun svn-alist-convert-widget (widget)
+    (let* ((value-type (widget-get widget :value-type))
+           (option-widgets (loop for option in (widget-get widget :options)
+                             collect `(cons :format "%v"
+                                            (const :format "%t: %v\n"
+                                                   :tag "Key"
+                                                   ,option)
+                                            ,value-type))))
+      (widget-put widget :args
+                  `(,@(when option-widgets
+                        `((set :inline t :format "%v"
+                               ,@option-widgets)))
+                    (editable-list :inline t
+                                   (cons :format "%v"
+                                         ,(widget-get widget :key-type)
+                                         ,value-type)))))
+    widget))
+
+;; process launch functions
+(defvar svn-call-process-function (if (fboundp 'process-file) 'process-file 'call-process))
+(defvar svn-start-process-function (if (fboundp 'start-file-process) 'start-file-process 'start-process))
+
+
+;;; keymaps
+
+(defvar svn-global-keymap nil "Global keymap for psvn.el.
+To bind this to a different key, customize `svn-status-prefix-key'.")
+(put 'svn-global-keymap 'risky-local-variable t)
+(when (not svn-global-keymap)
+  (setq svn-global-keymap (make-sparse-keymap))
+  (define-key svn-global-keymap (kbd "v") 'svn-status-version)
+  (define-key svn-global-keymap (kbd "s") 'svn-status-this-directory)
+  (define-key svn-global-keymap (kbd "b") 'svn-status-via-bookmark)
+  (define-key svn-global-keymap (kbd "h") 'svn-status-use-history)
+  (define-key svn-global-keymap (kbd "u") 'svn-status-update-cmd)
+  (define-key svn-global-keymap (kbd "=") 'svn-status-show-svn-diff)
+  (define-key svn-global-keymap (kbd "f =") 'svn-file-show-svn-diff)
+  (define-key svn-global-keymap (kbd "f e") 'svn-file-show-svn-ediff)
+  (define-key svn-global-keymap (kbd "f l") 'svn-status-show-svn-log)
+  (define-key svn-global-keymap (kbd "f b") 'svn-status-blame)
+  (define-key svn-global-keymap (kbd "f a") 'svn-file-add-to-changelog)
+  (define-key svn-global-keymap (kbd "f r") 'svn-file-revert)
+  (define-key svn-global-keymap (kbd "c") 'svn-status-commit)
+  (define-key svn-global-keymap (kbd "S") 'svn-status-switch-to-status-buffer)
+  (define-key svn-global-keymap (kbd "o") 'svn-status-pop-to-status-buffer))
+
+(defvar svn-status-diff-mode-map ()
+  "Keymap used in `svn-status-diff-mode' for additional commands that are not defined in diff-mode.")
+(put 'svn-status-diff-mode-map 'risky-local-variable t) ;for Emacs 20.7
+
+(when (not svn-status-diff-mode-map)
+  (setq svn-status-diff-mode-map (copy-keymap diff-mode-shared-map))
+  (define-key svn-status-diff-mode-map [?g] 'revert-buffer)
+  (define-key svn-status-diff-mode-map [?s] 'svn-status-pop-to-status-buffer)
+  (define-key svn-status-diff-mode-map [?c] 'svn-status-diff-pop-to-commit-buffer)
+  (define-key svn-status-diff-mode-map [?w] 'svn-status-diff-save-current-defun-as-kill))
+
+(defvar svn-global-trac-map ()
+  "Subkeymap used in `svn-global-keymap' for trac issue tracker commands.")
+(put 'svn-global-trac-map 'risky-local-variable t) ;for Emacs 20.7
+(when (not svn-global-trac-map)
+  (setq svn-global-trac-map (make-sparse-keymap))
+  (define-key svn-global-trac-map (kbd "w") 'svn-trac-browse-wiki)
+  (define-key svn-global-trac-map (kbd "t") 'svn-trac-browse-timeline)
+  (define-key svn-global-trac-map (kbd "m") 'svn-trac-browse-roadmap)
+  (define-key svn-global-trac-map (kbd "s") 'svn-trac-browse-source)
+  (define-key svn-global-trac-map (kbd "r") 'svn-trac-browse-report)
+  (define-key svn-global-trac-map (kbd "i") 'svn-trac-browse-ticket)
+  (define-key svn-global-trac-map (kbd "c") 'svn-trac-browse-changeset)
+  (define-key svn-global-keymap (kbd "t") svn-global-trac-map))
+
+;; The setter of `svn-status-prefix-key' makes a binding in the global
+;; map refer to the `svn-global-keymap' symbol, rather than directly
+;; to the keymap.  Emacs then implicitly uses the symbol-function.
+;; This has the advantage that `describe-bindings' (C-h b) can show
+;; the name of the keymap and link to its documentation.
+(defalias 'svn-global-keymap svn-global-keymap)
+;; `defalias' of GNU Emacs 21.4 doesn't allow a docstring argument.
+(put 'svn-global-keymap 'function-documentation
+     '(documentation-property 'svn-global-keymap 'variable-documentation t))
+
+
+;; named after SVN_WC_ADM_DIR_NAME in svn_wc.h
+(defun svn-wc-adm-dir-name ()
+  "Return the name of the \".svn\" subdirectory or equivalent."
+  (if (and (eq system-type 'windows-nt)
+           (getenv "SVN_ASP_DOT_NET_HACK"))
+      "_svn"
+    ".svn"))
+
+(defun svn-log-edit-file-name (&optional curdir)
+  "Get the name of the saved log edit file
+If curdir, return `svn-log-edit-file-name'
+Otherwise position svn-log-edit-file-name in the root directory of this working copy"
+  (if curdir
+      svn-log-edit-file-name
+    (concat (svn-status-base-dir) svn-log-edit-file-name)))
+
+(defun svn-status-message (level &rest args)
+  "If LEVEL is lower than `svn-status-debug-level' print ARGS using `message'.
+
+Guideline for numbers:
+1 - error messages, 3 - non-serious error messages, 5 - messages for things
+that take a long time, 7 - not very important messages on stuff, 9 - messages
+inside loops."
+  (if (<= level svn-status-debug-level)
+      (apply 'message args)))
+
+(defun svn-status-flatten-list (list)
+  "Flatten any lists within ARGS, so that there are no sublists."
+  (loop for item in list
+        if (listp item) nconc (svn-status-flatten-list item)
+        else collect item))
+
+(defun svn-status-window-line-position (w)
+  "Return the window line at point for window W, or nil if W is nil."
+  (svn-status-message 3 "About to count lines; selected window is %s" (selected-window))
+  (and w (count-lines (window-start w) (point))))
+
+;;;###autoload
+(defun svn-checkout (repos-url path)
+  "Run svn checkout REPOS-URL PATH."
+  (interactive (list (read-string "Checkout from repository Url: ")
+                     (svn-read-directory-name "Checkout to directory: ")))
+  (svn-run t t 'checkout "checkout" repos-url (expand-file-name path)))
+
+;;;###autoload (defalias 'svn-examine 'svn-status)
+(defalias 'svn-examine 'svn-status)
+
+;;;###autoload
+(defun svn-status (dir &optional arg)
+  "Examine the status of Subversion working copy in directory DIR.
+If ARG is -, allow editing of the parameters. One could add -N to
+run svn status non recursively to make it faster.
+For every other non nil ARG pass the -u argument to `svn status', which
+asks svn to connect to the repository and check to see if there are updates
+there.
+
+If there is no .svn directory, examine if there is CVS and run
+`cvs-examine'. Otherwise ask if to run `dired'."
+  (interactive (list (svn-read-directory-name "SVN status directory: "
+                                              nil default-directory nil)
+                     current-prefix-arg))
+  (let ((svn-dir (format "%s%s"
+                         (file-name-as-directory dir)
+                         (svn-wc-adm-dir-name)))
+        (cvs-dir (format "%sCVS" (file-name-as-directory dir))))
+    (cond
+     ((file-directory-p svn-dir)
+      (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
+      (svn-status-1 dir arg))
+     ((and (file-directory-p cvs-dir)
+           (fboundp 'cvs-examine))
+      (cvs-examine dir nil))
+     (t
+      (when (y-or-n-p
+             (format
+              (concat
+               "%s "
+               "is not Subversion controlled (missing %s "
+               "directory). "
+               "Run dired instead? ")
+              dir
+              (svn-wc-adm-dir-name)))
+        (dired dir))))))
+
+(defvar svn-status-display-new-status-buffer nil)
+(defun svn-status-1 (dir &optional arg)
+  "Examine DIR. See `svn-status' for more information."
+  (unless (file-directory-p dir)
+    (error "%s is not a directory" dir))
+  (setq dir (file-name-as-directory dir))
+  (when svn-status-load-state-before-svn-status
+    (unless (string= dir (car svn-status-directory-history))
+      (let ((default-directory dir))    ;otherwise svn-status-base-dir looks in the wrong place
+        (svn-status-load-state t))))
+  (setq svn-status-directory-history (delete dir svn-status-directory-history))
+  (add-to-list 'svn-status-directory-history dir)
+  (if (string= (buffer-name) svn-status-buffer-name)
+      (setq svn-status-display-new-status-buffer nil)
+    (setq svn-status-display-new-status-buffer t)
+    ;;(message "psvn: Saving initial window configuration")
+    (setq svn-status-initial-window-configuration
+          (current-window-configuration)))
+  (let* ((cur-buf (current-buffer))
+         (status-buf (get-buffer-create svn-status-buffer-name))
+         (proc-buf (get-buffer-create svn-process-buffer-name))
+         (want-edit (eq arg '-))
+         (status-option (if want-edit
+                            (if svn-status-verbose "-v" "")
+                          (if svn-status-verbose
+                              (if arg "-uv" "-v")
+                            (if arg "-u" "")))))
+    (save-excursion
+      (set-buffer status-buf)
+      (setq default-directory dir)
+      (set-buffer proc-buf)
+      (setq default-directory dir
+            svn-status-remote (when arg t))
+      (set-buffer cur-buf)
+      (if want-edit
+          (let ((svn-status-edit-svn-command t))
+            (svn-run t t 'status "status" svn-status-default-status-arguments status-option))
+        (svn-run t t 'status "status" svn-status-default-status-arguments status-option)))))
+
+(defun svn-status-this-directory (arg)
+  "Run `svn-status' for the `default-directory'"
+  (interactive "P")
+  (svn-status default-directory arg))
+
+(defun svn-status-use-history ()
+  "Interactively select a different directory from `svn-status-directory-history'."
+  (interactive)
+  (let* ((in-status-buffer (eq major-mode 'svn-status-mode))
+         (hist (if in-status-buffer (cdr svn-status-directory-history) svn-status-directory-history))
+         (dir (funcall svn-status-completing-read-function "svn-status on directory: " hist))
+         (svn-status-buffer (get-buffer svn-status-buffer-name))
+         (svn-buffer-available (and svn-status-buffer
+                                    (with-current-buffer svn-status-buffer-name (string= default-directory dir)))))
+    (if (file-directory-p dir)
+        (if svn-buffer-available
+            (svn-status-switch-to-status-buffer)
+          (unless svn-status-refresh-info
+            (setq svn-status-refresh-info 'once))
+          (svn-status dir))
+      (error "%s is not a directory" dir))))
+
+(defun svn-had-user-input-since-asynch-run ()
+  (not (equal (recent-keys) svn-pre-run-asynch-recent-keys)))
+
+(defun svn-process-environment ()
+  "Construct the environment for the svn process.
+It is a combination of `svn-status-svn-environment-var-list' and
+the usual `process-environment'."
+  ;; If there are duplicate elements in `process-environment', then GNU
+  ;; Emacs 21.4 guarantees that the first one wins; but GNU Emacs 20.7
+  ;; and XEmacs 21.4.17 don't document what happens.  We'll just remove
+  ;; any duplicates ourselves, then.  This also gives us an opportunity
+  ;; to handle the "VARIABLE" syntax that none of them supports.
+  (loop with found = '()
+        for elt in (append svn-status-svn-environment-var-list
+                           process-environment)
+        for has-value = (string-match "=" elt)
+        for name = (substring elt 0 has-value)
+        unless (member name found)
+          do (push name found)
+          and when has-value
+            collect elt))
+
+(defun svn-run (run-asynchron clear-process-buffer cmdtype &rest arglist)
+  "Run svn with arguments ARGLIST.
+
+If RUN-ASYNCHRON is t then run svn asynchronously.
+
+If CLEAR-PROCESS-BUFFER is t then erase the contents of the
+`svn-process-buffer-name' buffer before commencing.
+
+CMDTYPE is a symbol such as 'mv, 'revert, or 'add, representing the
+command to run.
+
+ARGLIST is a list of arguments \(which must include the command name,
+for example: '(\"revert\" \"file1\"\)
+ARGLIST is flattened and any every nil value is discarded.
+
+If the variable `svn-status-edit-svn-command' is non-nil then the user
+can edit ARGLIST before running svn.
+
+The hook svn-pre-run-hook allows to monitor/modify the ARGLIST."
+  (setq arglist (svn-status-flatten-list arglist))
+  (if (eq (process-status "svn") nil)
+      (progn
+        (when svn-status-edit-svn-command
+          (setq arglist (append
+                         (list (car arglist))
+                         (split-string
+                          (read-from-minibuffer
+                           (format "svn %s flags: " (car arglist))
+                           (mapconcat 'identity (cdr arglist) " ")))))
+          (when (eq svn-status-edit-svn-command t)
+            (svn-status-toggle-edit-cmd-flag t))
+          (message "svn-run %s: %S" cmdtype arglist))
+        (run-hooks 'svn-pre-run-hook)
+        (unless (eq mode-line-process 'svn-status-mode-line-process)
+          (setq svn-pre-run-mode-line-process mode-line-process)
+          (setq mode-line-process 'svn-status-mode-line-process))
+        (setq svn-status-pre-run-svn-buffer (current-buffer))
+        (let* ((proc-buf (get-buffer-create svn-process-buffer-name))
+               (svn-exe svn-status-svn-executable)
+               (svn-proc))
+          (when (listp (car arglist))
+            (setq arglist (car arglist)))
+          (save-excursion
+            (set-buffer proc-buf)
+            (unless (file-executable-p default-directory)
+              (message "psvn: workaround in %s needed: %s no longer exists" (current-buffer) default-directory)
+              (cd (expand-file-name "~")))
+            (setq buffer-read-only nil)
+            (buffer-disable-undo)
+            (fundamental-mode)
+            (if clear-process-buffer
+                (delete-region (point-min) (point-max))
+              (goto-char (point-max)))
+            (setq svn-process-cmd cmdtype)
+            (setq svn-status-last-commit-author nil)
+            (setq svn-status-mode-line-process-status (format " running %s" cmdtype))
+            (svn-status-update-mode-line)
+            (sit-for 0.1)
+            (ring-insert svn-last-cmd-ring (list (current-time-string) arglist default-directory))
+            (if run-asynchron
+                (progn
+                  ;;(message "running asynchron: %s %S" svn-exe arglist)
+                  (setq svn-pre-run-asynch-recent-keys (recent-keys))
+                  (let ((process-environment (svn-process-environment))
+                        (process-connection-type nil))
+                    ;; Communicate with the subprocess via pipes rather
+                    ;; than via a pseudoterminal, so that if the svn+ssh
+                    ;; scheme is being used, SSH will not ask for a
+                    ;; passphrase via stdio; psvn.el is currently unable
+                    ;; to answer such prompts.  Instead, SSH will run
+                    ;; x11-ssh-askpass if possible.  If Emacs is being
+                    ;; run on a TTY without $DISPLAY, this will fail; in
+                    ;; such cases, the user should start ssh-agent and
+                    ;; then run ssh-add explicitly.
+                    (setq svn-proc (apply svn-start-process-function "svn" proc-buf svn-exe arglist)))
+                  (when svn-status-svn-process-coding-system
+                    (set-process-coding-system svn-proc svn-status-svn-process-coding-system
+                                               svn-status-svn-process-coding-system))
+                  (set-process-sentinel svn-proc 'svn-process-sentinel)
+                  (when svn-status-track-user-input
+                    (set-process-filter svn-proc 'svn-process-filter)))
+              ;;(message "running synchron: %s %S" svn-exe arglist)
+              (let ((process-environment (svn-process-environment)))
+                ;; `call-process' ignores `process-connection-type' and
+                ;; never opens a pseudoterminal.
+                (apply svn-call-process-function svn-exe nil proc-buf nil arglist))
+              (setq svn-status-last-output-buffer-name svn-process-buffer-name)
+              (run-hooks 'svn-post-process-svn-output-hook)
+              (setq svn-status-mode-line-process-status "")
+              (svn-status-update-mode-line)
+              (when svn-pre-run-mode-line-process
+                (setq mode-line-process svn-pre-run-mode-line-process)
+                (setq svn-pre-run-mode-line-process nil))))))
+    (error "You can only run one svn process at once!")))
+
+(defun svn-process-sentinel-fixup-path-seperators ()
+    "Convert all path separators to UNIX style.
+\(This is a no-op unless `system-type' is windows-nt\)"
+  (when (eq system-type 'windows-nt)
+      (save-excursion
+        (goto-char (point-min))
+        (while (search-forward "\\" nil t)
+          (replace-match "/")))))
+
+(defun svn-process-sentinel (process event)
+  ;;(princ (format "Process: %s had the event `%s'" process event)))
+  ;;(save-excursion
+  (let ((act-buf (current-buffer)))
+    (when svn-pre-run-mode-line-process
+      (with-current-buffer svn-status-pre-run-svn-buffer
+        (setq mode-line-process svn-pre-run-mode-line-process))
+      (setq svn-pre-run-mode-line-process nil))
+    (set-buffer (process-buffer process))
+    (setq svn-status-mode-line-process-status "")
+    (svn-status-update-mode-line)
+    (cond ((string= event "finished\n")
+           (run-hooks 'svn-post-process-svn-output-hook)
+           (cond ((eq svn-process-cmd 'status)
+                  ;;(message "svn status finished")
+                  (svn-process-sentinel-fixup-path-seperators)
+                  (svn-parse-status-result)
+                  (svn-status-apply-elide-list)
+                  (when svn-status-update-previous-process-output
+                    (set-buffer (process-buffer process))
+                    (delete-region (point-min) (point-max))
+                    (insert "Output from svn command:\n")
+                    (insert svn-status-update-previous-process-output)
+                    (goto-char (point-min))
+                    (setq svn-status-update-previous-process-output nil))
+                  (when svn-status-update-list
+                    ;; (message "Using svn-status-update-list: %S" svn-status-update-list)
+                    (save-excursion
+                      (svn-status-update-with-command-list svn-status-update-list))
+                    (setq svn-status-update-list nil))
+                  (when svn-status-display-new-status-buffer
+                    (set-window-configuration svn-status-initial-window-configuration)
+                    (if (svn-had-user-input-since-asynch-run)
+                        (message "svn status finished")
+                      (switch-to-buffer svn-status-buffer-name))))
+                 ((eq svn-process-cmd 'log)
+                  (svn-status-show-process-output 'log t)
+                  (pop-to-buffer svn-status-last-output-buffer-name)
+                  (svn-log-view-mode)
+                  (forward-line 2)
+                  (unless (looking-at "Changed paths:")
+                    (forward-line 1))
+                  (font-lock-fontify-buffer)
+                  (message "svn log finished"))
+                 ((eq svn-process-cmd 'info)
+                  (svn-status-show-process-output 'info t)
+                  (message "svn info finished"))
+                 ((eq svn-process-cmd 'ls)
+                  (svn-status-show-process-output 'info t)
+                  (message "svn ls finished"))
+                 ((eq svn-process-cmd 'diff)
+                  (svn-status-activate-diff-mode)
+                  (message "svn diff finished"))
+                 ((eq svn-process-cmd 'parse-info)
+                  (svn-status-parse-info-result))
+                 ((eq svn-process-cmd 'blame)
+                  (svn-status-show-process-output 'blame t)
+                  (when svn-status-pre-run-svn-buffer
+                    (with-current-buffer svn-status-pre-run-svn-buffer
+                      (unless (eq major-mode 'svn-status-mode)
+                        (let ((src-line-number (svn-line-number-at-pos)))
+                          (pop-to-buffer (get-buffer svn-status-last-output-buffer-name))
+                          (goto-line src-line-number)))))
+                  (with-current-buffer (get-buffer svn-status-last-output-buffer-name)
+                    (svn-status-activate-blame-mode))
+                  (message "svn blame finished"))
+                 ((eq svn-process-cmd 'commit)
+                  (svn-process-sentinel-fixup-path-seperators)
+                  (svn-status-remove-temp-file-maybe)
+                  (when (member 'commit svn-status-unmark-files-after-list)
+                    (svn-status-unset-all-usermarks))
+                  (svn-status-update-with-command-list (svn-status-parse-commit-output))
+                  (svn-revert-some-buffers)
+                  (run-hooks 'svn-log-edit-done-hook)
+                  (setq svn-status-files-to-commit nil
+                        svn-status-recursive-commit nil)
+                  (if (null svn-status-commit-rev-number)
+                      (message "No revision to commit.")
+                    (message "svn: Committed revision %s." svn-status-commit-rev-number)))
+                 ((eq svn-process-cmd 'update)
+                  (svn-status-show-process-output 'update t)
+                  (setq svn-status-update-list (svn-status-parse-update-output))
+                  (svn-revert-some-buffers)
+                  (svn-status-update)
+                  (if (car svn-status-update-rev-number)
+                      (message "svn: Updated to revision %s." (cadr svn-status-update-rev-number))
+                    (message "svn: At revision %s." (cadr svn-status-update-rev-number))))
+                 ((eq svn-process-cmd 'add)
+                  (svn-status-update-with-command-list (svn-status-parse-ar-output))
+                  (message "svn add finished"))
+                 ((eq svn-process-cmd 'lock)
+                  (svn-status-update)
+                  (message "svn lock finished"))
+                 ((eq svn-process-cmd 'unlock)
+                  (svn-status-update)
+                  (message "svn unlock finished"))
+                 ((eq svn-process-cmd 'mkdir)
+                  (svn-status-update)
+                  (message "svn mkdir finished"))
+                 ((eq svn-process-cmd 'revert)
+                  (when (member 'revert svn-status-unmark-files-after-list)
+                    (svn-status-unset-all-usermarks))
+                  (svn-revert-some-buffers)
+                  (svn-status-update)
+                  (message "svn revert finished"))
+                 ((eq svn-process-cmd 'resolved)
+                  (svn-status-update)
+                  (message "svn resolved finished"))
+                 ((eq svn-process-cmd 'rm)
+                  (svn-status-update-with-command-list (svn-status-parse-ar-output))
+                  (message "svn rm finished"))
+                 ((eq svn-process-cmd 'cleanup)
+                  (message "svn cleanup finished"))
+                 ((eq svn-process-cmd 'proplist)
+                  (svn-status-show-process-output 'proplist t)
+                  (message "svn proplist finished"))
+                 ((eq svn-process-cmd 'checkout)
+                  (svn-status default-directory))
+                 ((eq svn-process-cmd 'proplist-parse)
+                  (svn-status-property-parse-property-names))
+                 ((eq svn-process-cmd 'propset)
+                  (svn-status-remove-temp-file-maybe)
+                  (if (member svn-status-propedit-property-name '("svn:keywords"))
+                      (svn-status-update-with-command-list (svn-status-parse-property-output))
+                    (svn-status-update)))
+                 ((eq svn-process-cmd 'propdel)
+                  (svn-status-update))))
+          ((string= event "killed\n")
+           (message "svn process killed"))
+          ((string-match "exited abnormally" event)
+           (while (accept-process-output process 0 100))
+           ;; find last error message and show it.
+           (goto-char (point-max))
+           (if (re-search-backward "^svn: " nil t)
+               (let ((error-strings)
+                     (beginning-of-buffer))
+                 (while (and (looking-at "^svn: ") (not beginning-of-buffer))
+                   (setq error-strings (append error-strings (list (buffer-substring-no-properties (+ 5 (svn-point-at-bol)) (svn-point-at-eol)))))
+                   (setq beginning-of-buffer (bobp))
+                   (forward-line -1))
+                 (svn-process-handle-error (mapconcat 'identity (reverse error-strings) "\n")))
+             (message "svn failed: %s" event)))
+          (t
+           (message "svn process had unknown event: %s" event))
+          (svn-status-show-process-output nil t))))
+
+(defvar svn-process-handle-error-msg nil)
+(defvar svn-handle-error-function nil
+  "A function that will be called with an error string received from the svn client.
+When this function resets `svn-process-handle-error-msg' to nil, the default error handling
+(just show the error message) is not executed.")
+(defun svn-process-handle-error (error-msg)
+  (let ((svn-process-handle-error-msg error-msg))
+    (when (functionp svn-handle-error-function)
+      (funcall svn-handle-error-function error-msg))
+    (when svn-process-handle-error-msg
+      (electric-helpify 'svn-process-help-with-error-msg))))
+
+(defun svn-process-help-with-error-msg ()
+  (interactive)
+  (let ((help-msg (cadr (assoc svn-process-handle-error-msg
+                               '(("Cannot non-recursively commit a directory deletion"
+                                  "Please unmark all files and position point at the directory you would like to remove.\nThen run commit again."))))))
+    (if help-msg
+        (save-excursion
+          (with-output-to-temp-buffer (help-buffer)
+            (princ (format "svn failed: %s\n\n%s" svn-process-handle-error-msg help-msg))))
+      (message "svn failed:\n%s" svn-process-handle-error-msg))))
+
+
+(defun svn-process-filter (process str)
+  "Track the svn process output and ask user questions in the minibuffer when appropriate."
+  (save-window-excursion
+    (set-buffer svn-process-buffer-name)
+    ;;(message "svn-process-filter: %s" str)
+    (goto-char (point-max))
+    (insert str)
+    (save-excursion
+      (goto-char (svn-point-at-bol))
+      (when (looking-at "Password for '\\(.+\\)': ")
+        ;(svn-status-show-process-buffer)
+        (let ((passwd (read-passwd
+                       (format "Enter svn password for %s: " (match-string 1)))))
+          (svn-process-send-string-and-newline passwd t)))
+      (when (looking-at "Username: ")
+        (let ((user-name (read-string "Username for svn operation: ")))
+          (svn-process-send-string-and-newline user-name)))
+      (when (looking-at "(R)eject, accept (t)emporarily or accept (p)ermanently")
+        (svn-status-show-process-buffer)
+        (let ((answer (read-string "(R)eject, accept (t)emporarily or accept (p)ermanently? ")))
+          (svn-process-send-string (substring answer 0 1)))))))
+
+(defun svn-revert-some-buffers (&optional tree)
+  "Reverts all buffers visiting a file in TREE that aren't modified.
+To be run after a commit, an update or a merge."
+  (interactive)
+  (let ((tree (or (svn-status-base-dir) tree)))
+    (dolist (buffer (buffer-list))
+      (with-current-buffer buffer
+        (when (not (buffer-modified-p))
+          (let ((file (buffer-file-name)))
+            (when file
+              (let ((root (svn-status-base-dir (file-name-directory file)))
+                    (point-pos (point)))
+                (when (and root
+                           (string= root tree)
+                           ;; buffer is modified and in the tree TREE.
+                           svn-status-auto-revert-buffers)
+                  (when svn-status-fancy-file-state-in-modeline
+                    (svn-status-update-modeline))
+                  ;; (message "svn-revert-some-buffers: %s %s" (buffer-file-name) (verify-visited-file-modtime (current-buffer)))
+                  ;; Keep the buffer if the file doesn't exist
+                  (when (and (file-exists-p file) (not (verify-visited-file-modtime (current-buffer))))
+                    (revert-buffer t t)
+                    (goto-char point-pos)))))))))))
+
+(defun svn-parse-rev-num (str)
+  (if (and str (stringp str)
+           (save-match-data (string-match "^[0-9]+" str)))
+      (string-to-number str)
+    -1))
+
+(defsubst svn-status-make-ui-status ()
+  "Make a ui-status structure for a file in a svn working copy.
+The initial values in the structure returned by this function
+are good for a file or directory that the user hasn't seen before.
+
+The ui-status structure keeps track of how the file or directory
+should be displayed in svn-status mode.  Updating the svn-status
+buffer from the working copy preserves the ui-status if possible.
+User commands modify this structure; each file or directory must
+thus have its own copy.
+
+Currently, the ui-status is a list (USER-MARK USER-ELIDE).
+USER-MARK is non-nil iff the user has marked the file or directory,
+  typically with `svn-status-set-user-mark'.  To read USER-MARK,
+  call `svn-status-line-info->has-usermark'.
+USER-ELIDE is non-nil iff the user has elided the file or directory
+  from the svn-status buffer, typically with `svn-status-toggle-elide'.
+  To read USER-ELIDE, call `svn-status-line-info->user-elide'.
+
+Call `svn-status-line-info->ui-status' to access the whole ui-status
+structure."
+  (list nil nil))
+
+(defun svn-status-make-dummy-dirs (dir-list old-ui-information)
+  "Calculate additionally necessary directories that were not shown in the output
+of 'svn status'"
+  ;; (message "svn-status-make-dummy-dirs %S" dir-list)
+  (let ((candidate)
+        (base-dir))
+    (dolist (dir dir-list)
+      (setq base-dir (file-name-directory dir))
+      (while base-dir
+        ;;(message "dir: %S dir-list: %S, base-dir: %S" dir dir-list base-dir)
+        (setq candidate (replace-regexp-in-string "/+$" "" base-dir))
+        (setq base-dir (file-name-directory candidate))
+        ;; (message "dir: %S, candidate: %S" dir candidate)
+        (add-to-list 'dir-list candidate))))
+  ;; (message "svn-status-make-dummy-dirs %S" dir-list)
+  (append (mapcar (lambda (dir)
+                    (svn-status-make-line-info
+                     dir
+                     (gethash dir old-ui-information)))
+                  dir-list)
+          svn-status-info))
+
+(defun svn-status-make-line-info (&optional
+                                  path
+                                  ui
+                                  file-mark prop-mark
+                                  local-rev last-change-rev
+                                  author
+                                  update-mark
+                                  locked-mark
+                                  with-history-mark
+                                  switched-mark
+                                  locked-repo-mark
+                                  psvn-extra-info)
+  "Create a new line-info from the given arguments
+Anything left nil gets a sensible default.
+nb: LOCKED-MARK refers to the kind of locks you get after an error,
+    LOCKED-REPO-MARK is the kind managed with `svn lock'"
+  (list (or ui (svn-status-make-ui-status))
+        (or file-mark ? )
+        (or prop-mark ? )
+        (or path "")
+        (or local-rev ? )
+        (or last-change-rev ? )
+        (or author "")
+        update-mark
+        locked-mark
+        with-history-mark
+        switched-mark
+        locked-repo-mark
+        psvn-extra-info))
+
+(defvar svn-user-names-including-blanks nil "A list of svn user names that include blanks.
+To add support for the names \"feng shui\" and \"mister blank\", place the following in your .emacs:
+ (setq svn-user-names-including-blanks '(\"feng shui\" \"mister blank\"))
+ (add-hook 'svn-pre-parse-status-hook 'svn-status-parse-fixup-user-names-including-blanks)
+")
+;;(setq svn-user-names-including-blanks '("feng shui" "mister blank"))
+;;(add-hook 'svn-pre-parse-status-hook 'svn-status-parse-fixup-user-names-including-blanks)
+
+(defun svn-status-parse-fixup-user-names-including-blanks ()
+  "Helper function to allow user names that include blanks.
+Add this function to the `svn-pre-parse-status-hook'. The variable
+`svn-user-names-including-blanks' must be configured to hold all user names that contain
+blanks. This function replaces the blanks with '-' to allow further processing with
+the usual parsing functionality in `svn-parse-status-result'."
+  (when svn-user-names-including-blanks
+    (goto-char (point-min))
+    (let ((search-string (concat " \\(" (mapconcat 'concat svn-user-names-including-blanks "\\|") "\\) ")))
+      (save-match-data
+        (save-excursion
+          (while (re-search-forward search-string (point-max) t)
+            (replace-match (replace-regexp-in-string " " "-" (match-string 1)) nil nil nil 1)))))))
+
+(defun svn-parse-status-result ()
+  "Parse the `svn-process-buffer-name' buffer.
+The results are used to build the `svn-status-info' variable."
+  (setq svn-status-head-revision nil)
+  (save-excursion
+    (let ((old-ui-information (svn-status-ui-information-hash-table))
+          (svn-marks)
+          (svn-file-mark)
+          (svn-property-mark)
+          (svn-wc-locked-mark)
+          (svn-repo-locked-mark)
+          (svn-with-history-mark)
+          (svn-switched-mark)
+          (svn-update-mark)
+          (local-rev)
+          (last-change-rev)
+          (author)
+          (path)
+          (dir)
+          (revision-width svn-status-default-revision-width)
+          (author-width svn-status-default-author-width)
+          (svn-marks-length (if svn-status-verbose
+                                (if svn-status-remote
+                                    8 6)
+                              (if svn-status-remote
+                                  ;; not verbose
+                                  8 7)))
+          (dir-set '("."))
+          (externals-map (make-hash-table :test 'equal))
+          (skip-double-external-dir-entry-name nil))
+      (set-buffer svn-process-buffer-name)
+      (setq svn-status-info nil)
+      (run-hooks 'svn-pre-parse-status-hook)
+      (goto-char (point-min))
+      (while (< (point) (point-max))
+        (cond
+         ((= (svn-point-at-eol) (svn-point-at-bol)) ;skip blank lines
+          nil)
+         ((looking-at "Status against revision:[ ]+\\([0-9]+\\)")
+          ;; the above message appears for the main listing plus once for each svn:externals entry
+          (unless svn-status-head-revision
+            (setq svn-status-head-revision (match-string 1))))
+         ((looking-at "Performing status on external item at '\\(.*\\)'")
+          ;; The *next* line has info about the directory named in svn:externals
+          ;; [ie the directory in (match-string 1)]
+          ;; we should parse it, and merge the info with what we have already know
+          ;; but for now just ignore the line completely
+          ; (forward-line)
+          ;;  Actually, this seems to not always be the case
+          ;;  I have an example where we are in an svn:external which
+          ;;  is itself inside a svn:external, this need not be true:
+          ;;  the next line is not 'X dir' but just 'dir', so we
+          ;;  actually need to parse that line, or the results will
+          ;;  not contain dir!
+          ;; so we should merge lines 'X dir' with ' dir', but for now
+          ;; we just leave both in the results
+
+          ;; My attempt to merge the lines uses skip-double-external-dir-entry-name
+          ;; and externals-map
+          (setq skip-double-external-dir-entry-name (svn-match-string-no-properties 1))
+          ;; (message "Going to skip %s" skip-double-external-dir-entry-name)
+          nil)
+         ((looking-at "--- Changelist") ; skip svn changelist header lines
+          ;; See: http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
+          nil)
+         (t
+          (setq svn-marks (buffer-substring (point) (+ (point) svn-marks-length))
+                svn-file-mark (elt svn-marks 0)         ; 1st column - M,A,C,D,G,? etc
+                svn-property-mark (elt svn-marks 1)     ; 2nd column - M,C (properties)
+                svn-wc-locked-mark (elt svn-marks 2)    ; 3rd column - L or blank
+                svn-with-history-mark (elt svn-marks 3) ; 4th column - + or blank
+                svn-switched-mark (elt svn-marks 4)     ; 5th column - S or blank
+                svn-repo-locked-mark (elt svn-marks 5)) ; 6th column - K,O,T,B or blank
+          (when svn-status-remote
+              (setq svn-update-mark (elt svn-marks 7))) ; 8th column - * or blank
+          (when (eq svn-property-mark ?\ )     (setq svn-property-mark nil))
+          (when (eq svn-wc-locked-mark ?\ )    (setq svn-wc-locked-mark nil))
+          (when (eq svn-with-history-mark ?\ ) (setq svn-with-history-mark nil))
+          (when (eq svn-switched-mark ?\ )     (setq svn-switched-mark nil))
+          (when (eq svn-update-mark ?\ )       (setq svn-update-mark nil))
+          (when (eq svn-repo-locked-mark ?\ )  (setq svn-repo-locked-mark nil))
+          (forward-char svn-marks-length)
+          (skip-chars-forward " ")
+          ;; (message "after marks: '%s'" (buffer-substring (point) (line-end-position)))
+          (cond
+           ((looking-at "\\([-?]\\|[0-9]+\\) +\\([-?]\\|[0-9]+\\) +\\([^ ]+\\) *\\(.+\\)$")
+            (setq local-rev (svn-parse-rev-num (match-string 1))
+                  last-change-rev (svn-parse-rev-num (match-string 2))
+                  author (match-string 3)
+                  path (match-string 4)))
+           ((looking-at "\\([-?]\\|[0-9]+\\) +\\([^ ]+\\)$")
+            (setq local-rev (svn-parse-rev-num (match-string 1))
+                  last-change-rev -1
+                  author "?"
+                  path (match-string 2)))
+           ((looking-at "\\(.*\\)")
+            (setq path (match-string 1)
+                  local-rev -1
+                  last-change-rev -1
+                  author (if (eq svn-file-mark ?X) "" "?"))) ;clear author of svn:externals dirs
+           (t
+            (error "Unknown status line format")))
+          (unless path (setq path "."))
+          (setq dir (file-name-directory path))
+          (if (and (not svn-status-verbose) dir)
+              (let ((dirname (directory-file-name dir)))
+                (if (not (member dirname dir-set))
+                    (setq dir-set (cons dirname dir-set)))))
+          (if (and skip-double-external-dir-entry-name (string= skip-double-external-dir-entry-name path))
+              ;; merge this entry to a previous saved one
+              (let ((info (gethash path externals-map)))
+                ;; (message "skip-double-external-dir-entry-name: %s - path: %s" skip-double-external-dir-entry-name path)
+                (if info
+                    (progn
+                      (svn-status-line-info->set-localrev info local-rev)
+                      (svn-status-line-info->set-lastchangerev info last-change-rev)
+                      (svn-status-line-info->set-author info author)
+                      (svn-status-message 3 "merging entry for %s to %s" path info)
+                      (setq skip-double-external-dir-entry-name nil))
+                  (message "psvn: %s not handled correct, please report this case." path)))
+            (setq svn-status-info
+                  (cons (svn-status-make-line-info path
+                                                   (gethash path old-ui-information)
+                                                   svn-file-mark
+                                                   svn-property-mark
+                                                   local-rev
+                                                   last-change-rev
+                                                   author
+                                                   svn-update-mark
+                                                   svn-wc-locked-mark
+                                                   svn-with-history-mark
+                                                   svn-switched-mark
+                                                   svn-repo-locked-mark
+                                                   nil) ;;psvn-extra-info
+                        svn-status-info)))
+          (when (eq svn-file-mark ?X)
+            (svn-puthash (match-string 1) (car svn-status-info) externals-map)
+            (svn-status-message 3 "found external: %s %S" (match-string 1) (car svn-status-info)))
+          (setq revision-width (max revision-width
+                                    (length (number-to-string local-rev))
+                                    (length (number-to-string last-change-rev))))
+          (setq author-width (max author-width (length author)))))
+        (forward-line 1))
+      (unless svn-status-verbose
+        (setq svn-status-info (svn-status-make-dummy-dirs dir-set
+                                                          old-ui-information)))
+      (setq svn-status-default-column
+            (+ 6 revision-width revision-width author-width
+               (if svn-status-short-mod-flag-p 3 0)))
+      (setq svn-status-line-format (format " %%c%%c%%c %%%ds %%%ds %%-%ds"
+                                           revision-width
+                                           revision-width
+                                           author-width))
+      (setq svn-status-info (nreverse svn-status-info))
+      (when svn-status-sort-status-buffer
+        (setq svn-status-info (sort svn-status-info 'svn-status-sort-predicate))))))
+
+;;(string-lessp "." "%") => nil
+;(svn-status-sort-predicate '(t t t ".") '(t t t "%")) => t
+(defun svn-status-sort-predicate (a b)
+  "Return t if A should appear before B in the `svn-status-buffer-name' buffer.
+A and B must be line-info's."
+  (string-lessp (concat (svn-status-line-info->full-path a) "/")
+                (concat (svn-status-line-info->full-path b) "/")))
+
+(defun svn-status-remove-temp-file-maybe ()
+  "Remove any (no longer required) temporary files created by psvn.el."
+  (when svn-status-temp-file-to-remove
+    (when (file-exists-p svn-status-temp-file-to-remove)
+      (delete-file svn-status-temp-file-to-remove))
+    (when (file-exists-p svn-status-temp-arg-file)
+      (delete-file svn-status-temp-arg-file))
+    (setq svn-status-temp-file-to-remove nil)))
+
+(defun svn-status-remove-control-M ()
+  "Remove ^M at end of line in the whole buffer."
+  (interactive)
+  (let ((buffer-read-only nil))
+    (save-match-data
+      (save-excursion
+        (goto-char (point-min))
+        (while (re-search-forward "\r$" (point-max) t)
+          (replace-match "" nil nil))))))
+
+(condition-case nil
+    ;;(easy-menu-add-item nil '("tools") ["SVN Status" svn-status t] "PCL-CVS")
+    (easy-menu-add-item nil '("tools") ["SVN Status" svn-status t])
+  (error (message "psvn: could not install menu")))
+
+(defvar svn-status-mode-map () "Keymap used in `svn-status-mode' buffers.")
+(put 'svn-status-mode-map 'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-mark-map ()
+  "Subkeymap used in `svn-status-mode' for mark commands.")
+(put 'svn-status-mode-mark-map      'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-property-map ()
+  "Subkeymap used in `svn-status-mode' for property commands.")
+(put 'svn-status-mode-property-map  'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-options-map ()
+  "Subkeymap used in `svn-status-mode' for option commands.")
+(put 'svn-status-mode-options-map   'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-trac-map ()
+  "Subkeymap used in `svn-status-mode' for trac issue tracker commands.")
+(put 'svn-status-mode-trac-map      'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-extension-map ()
+  "Subkeymap used in `svn-status-mode' for some seldom used commands.")
+(put 'svn-status-mode-extension-map 'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-branch-map ()
+  "Subkeymap used in `svn-status-mode' for branching commands.")
+(put 'svn-status-mode-extension-map 'risky-local-variable t) ;for Emacs 20.7
+(defvar svn-status-mode-search-map ()
+  "Subkeymap used in `svn-status-mode' for search commands.")
+(put 'svn-status-mode-search-map      'risky-local-variable t) ;for Emacs 20.7
+
+(when (not svn-status-mode-map)
+  (setq svn-status-mode-map (make-sparse-keymap))
+  (suppress-keymap svn-status-mode-map)
+  ;; Don't use (kbd "<return>"); it's unreachable with GNU Emacs 21.3 on a TTY.
+  (define-key svn-status-mode-map (kbd "RET") 'svn-status-find-file-or-examine-directory)
+  (define-key svn-status-mode-map (kbd "<mouse-2>") 'svn-status-mouse-find-file-or-examine-directory)
+  (define-key svn-status-mode-map (kbd "^") 'svn-status-examine-parent)
+  (define-key svn-status-mode-map (kbd "s") 'svn-status-show-process-buffer)
+  (define-key svn-status-mode-map (kbd "h") 'svn-status-pop-to-partner-buffer)
+  (define-key svn-status-mode-map (kbd "f") 'svn-status-find-files)
+  (define-key svn-status-mode-map (kbd "o") 'svn-status-find-file-other-window)
+  (define-key svn-status-mode-map (kbd "C-o") 'svn-status-find-file-other-window-noselect)
+  (define-key svn-status-mode-map (kbd "v") 'svn-status-view-file-other-window)
+  (define-key svn-status-mode-map (kbd "e") 'svn-status-toggle-edit-cmd-flag)
+  (define-key svn-status-mode-map (kbd "g") 'svn-status-update)
+  (define-key svn-status-mode-map (kbd "M-s") 'svn-status-update) ;; PCL-CVS compatibility
+  (define-key svn-status-mode-map (kbd "q") 'svn-status-bury-buffer)
+  (define-key svn-status-mode-map (kbd "x") 'svn-status-redraw-status-buffer)
+  (define-key svn-status-mode-map (kbd "H") 'svn-status-use-history)
+  (define-key svn-status-mode-map (kbd "m") 'svn-status-set-user-mark)
+  (define-key svn-status-mode-map (kbd "u") 'svn-status-unset-user-mark)
+  ;; This matches a binding of `dired-unmark-all-files' in `dired-mode-map'
+  ;; of both GNU Emacs and XEmacs.  It seems unreachable with XEmacs on
+  ;; TTY, but if that's a problem then its Dired needs fixing too.
+  ;; Or you could just use "*!".
+  (define-key svn-status-mode-map "\M-\C-?" 'svn-status-unset-all-usermarks)
+  ;; The key that normally deletes characters backwards should here
+  ;; instead unmark files backwards.  In GNU Emacs, that would be (kbd
+  ;; "DEL") aka [?\177], but XEmacs treats those as [(delete)] and
+  ;; would bind a key that normally deletes forwards.  [(backspace)]
+  ;; is unreachable with GNU Emacs on a tty.  Try to recognize the
+  ;; dialect and act accordingly.
+  ;;
+  ;; XEmacs has a `delete-forward-p' function that checks the
+  ;; `delete-key-deletes-forward' option.  We don't use those, for two
+  ;; reasons: psvn.el may be loaded before user customizations, and
+  ;; XEmacs allows simultaneous connections to multiple devices with
+  ;; different keyboards.
+  (define-key svn-status-mode-map
+              (if (member (kbd "DEL") '([(delete)] [delete]))
+                  [(backspace)]         ; XEmacs
+                (kbd "DEL"))            ; GNU Emacs
+              'svn-status-unset-user-mark-backwards)
+  (define-key svn-status-mode-map (kbd "$") 'svn-status-toggle-elide)
+  (define-key svn-status-mode-map (kbd "w") 'svn-status-copy-current-line-info)
+  (define-key svn-status-mode-map (kbd ".") 'svn-status-goto-root-or-return)
+  (define-key svn-status-mode-map (kbd "I") 'svn-status-parse-info)
+  (define-key svn-status-mode-map (kbd "V") 'svn-status-svnversion)
+  (define-key svn-status-mode-map (kbd "?") 'svn-status-toggle-hide-unknown)
+  (define-key svn-status-mode-map (kbd "_") 'svn-status-toggle-hide-unmodified)
+  (define-key svn-status-mode-map (kbd "a") 'svn-status-add-file)
+  (define-key svn-status-mode-map (kbd "A") 'svn-status-add-file-recursively)
+  (define-key svn-status-mode-map (kbd "+") 'svn-status-make-directory)
+  (define-key svn-status-mode-map (kbd "R") 'svn-status-mv)
+  (define-key svn-status-mode-map (kbd "C") 'svn-status-cp)
+  (define-key svn-status-mode-map (kbd "D") 'svn-status-rm)
+  (define-key svn-status-mode-map (kbd "c") 'svn-status-commit)
+  (define-key svn-status-mode-map (kbd "M-c") 'svn-status-cleanup)
+  (define-key svn-status-mode-map (kbd "k") 'svn-status-lock)
+  (define-key svn-status-mode-map (kbd "K") 'svn-status-unlock)
+  (define-key svn-status-mode-map (kbd "U") 'svn-status-update-cmd)
+  (define-key svn-status-mode-map (kbd "M-u") 'svn-status-update-cmd)
+  (define-key svn-status-mode-map (kbd "r") 'svn-status-revert)
+  (define-key svn-status-mode-map (kbd "l") 'svn-status-show-svn-log)
+  (define-key svn-status-mode-map (kbd "i") 'svn-status-info)
+  (define-key svn-status-mode-map (kbd "b") 'svn-status-blame)
+  (define-key svn-status-mode-map (kbd "=") 'svn-status-show-svn-diff)
+  ;; [(control ?=)] is unreachable on TTY, but you can use "*u" instead.
+  ;; (Is the "u" mnemonic for something?)
+  (define-key svn-status-mode-map (kbd "C-=") 'svn-status-show-svn-diff-for-marked-files)
+  (define-key svn-status-mode-map (kbd "~") 'svn-status-get-specific-revision)
+  (define-key svn-status-mode-map (kbd "E") 'svn-status-ediff-with-revision)
+
+  (define-key svn-status-mode-map (kbd "n") 'svn-status-next-line)
+  (define-key svn-status-mode-map (kbd "p") 'svn-status-previous-line)
+  (define-key svn-status-mode-map (kbd "<down>") 'svn-status-next-line)
+  (define-key svn-status-mode-map (kbd "<up>") 'svn-status-previous-line)
+  (define-key svn-status-mode-map (kbd "C-x C-j") 'svn-status-dired-jump)
+  (define-key svn-status-mode-map [down-mouse-3] 'svn-status-popup-menu))
+
+(when (not svn-status-mode-mark-map)
+  (setq svn-status-mode-mark-map (make-sparse-keymap))
+  (define-key svn-status-mode-map (kbd "*") svn-status-mode-mark-map)
+  (define-key svn-status-mode-mark-map (kbd "!") 'svn-status-unset-all-usermarks)
+  (define-key svn-status-mode-mark-map (kbd "?") 'svn-status-mark-unknown)
+  (define-key svn-status-mode-mark-map (kbd "A") 'svn-status-mark-added)
+  (define-key svn-status-mode-mark-map (kbd "M") 'svn-status-mark-modified)
+  (define-key svn-status-mode-mark-map (kbd "P") 'svn-status-mark-modified-properties)
+  (define-key svn-status-mode-mark-map (kbd "D") 'svn-status-mark-deleted)
+  (define-key svn-status-mode-mark-map (kbd "*") 'svn-status-mark-changed)
+  (define-key svn-status-mode-mark-map (kbd ".") 'svn-status-mark-by-file-ext)
+  (define-key svn-status-mode-mark-map (kbd "%") 'svn-status-mark-filename-regexp)
+  (define-key svn-status-mode-mark-map (kbd "s") 'svn-status-store-usermarks)
+  (define-key svn-status-mode-mark-map (kbd "l") 'svn-status-load-usermarks)
+  (define-key svn-status-mode-mark-map (kbd "u") 'svn-status-show-svn-diff-for-marked-files))
+
+(when (not svn-status-mode-search-map)
+  (setq svn-status-mode-search-map (make-sparse-keymap))
+  (define-key svn-status-mode-search-map (kbd "g") 'svn-status-grep-files)
+  (define-key svn-status-mode-search-map (kbd "s") 'svn-status-search-files)
+  (define-key svn-status-mode-map (kbd "S") svn-status-mode-search-map))
+
+(when (not svn-status-mode-property-map)
+  (setq svn-status-mode-property-map (make-sparse-keymap))
+  (define-key svn-status-mode-property-map (kbd "l") 'svn-status-property-list)
+  (define-key svn-status-mode-property-map (kbd "s") 'svn-status-property-set)
+  (define-key svn-status-mode-property-map (kbd "d") 'svn-status-property-delete)
+  (define-key svn-status-mode-property-map (kbd "e") 'svn-status-property-edit-one-entry)
+  (define-key svn-status-mode-property-map (kbd "i") 'svn-status-property-ignore-file)
+  (define-key svn-status-mode-property-map (kbd "I") 'svn-status-property-ignore-file-extension)
+  ;; XEmacs 21.4.15 on TTY (vt420) converts `C-i' to `TAB',
+  ;; which [(control ?i)] won't match.  Handle it separately.
+  ;; On GNU Emacs, the following two forms bind the same key,
+  ;; reducing clutter in `where-is'.
+  (define-key svn-status-mode-property-map [(control ?i)] 'svn-status-property-edit-svn-ignore)
+  (define-key svn-status-mode-property-map (kbd "TAB") 'svn-status-property-edit-svn-ignore)
+  (define-key svn-status-mode-property-map (kbd "k") 'svn-status-property-set-keyword-list)
+  (define-key svn-status-mode-property-map (kbd "Ki") 'svn-status-property-set-keyword-id)
+  (define-key svn-status-mode-property-map (kbd "Kd") 'svn-status-property-set-keyword-date)
+  (define-key svn-status-mode-property-map (kbd "y") 'svn-status-property-set-eol-style)
+  (define-key svn-status-mode-property-map (kbd "x") 'svn-status-property-set-executable)
+  (define-key svn-status-mode-property-map (kbd "m") 'svn-status-property-set-mime-type)
+  ;; TODO: Why is `svn-status-select-line' in `svn-status-mode-property-map'?
+  (define-key svn-status-mode-property-map (kbd "RET") 'svn-status-select-line)
+  (define-key svn-status-mode-map (kbd "P") svn-status-mode-property-map))
+(when (not svn-status-mode-extension-map)
+  (setq svn-status-mode-extension-map (make-sparse-keymap))
+  (define-key svn-status-mode-extension-map (kbd "v") 'svn-status-resolved)
+  (define-key svn-status-mode-extension-map (kbd "X") 'svn-status-resolve-conflicts)
+  (define-key svn-status-mode-extension-map (kbd "e") 'svn-status-export)
+  (define-key svn-status-mode-map (kbd "X") svn-status-mode-extension-map))
+(when (not svn-status-mode-options-map)
+  (setq svn-status-mode-options-map (make-sparse-keymap))
+  (define-key svn-status-mode-options-map (kbd "s") 'svn-status-save-state)
+  (define-key svn-status-mode-options-map (kbd "l") 'svn-status-load-state)
+  (define-key svn-status-mode-options-map (kbd "x") 'svn-status-toggle-sort-status-buffer)
+  (define-key svn-status-mode-options-map (kbd "v") 'svn-status-toggle-svn-verbose-flag)
+  (define-key svn-status-mode-options-map (kbd "f") 'svn-status-toggle-display-full-path)
+  (define-key svn-status-mode-options-map (kbd "t") 'svn-status-set-trac-project-root)
+  (define-key svn-status-mode-options-map (kbd "n") 'svn-status-set-module-name)
+  (define-key svn-status-mode-options-map (kbd "c") 'svn-status-set-changelog-style)
+  (define-key svn-status-mode-options-map (kbd "b") 'svn-status-set-branch-list)
+  (define-key svn-status-mode-map (kbd "O") svn-status-mode-options-map))
+(when (not svn-status-mode-trac-map)
+  (setq svn-status-mode-trac-map (make-sparse-keymap))
+  (define-key svn-status-mode-trac-map (kbd "w") 'svn-trac-browse-wiki)
+  (define-key svn-status-mode-trac-map (kbd "t") 'svn-trac-browse-timeline)
+  (define-key svn-status-mode-trac-map (kbd "m") 'svn-trac-browse-roadmap)
+  (define-key svn-status-mode-trac-map (kbd "r") 'svn-trac-browse-report)
+  (define-key svn-status-mode-trac-map (kbd "s") 'svn-trac-browse-source)
+  (define-key svn-status-mode-trac-map (kbd "i") 'svn-trac-browse-ticket)
+  (define-key svn-status-mode-trac-map (kbd "c") 'svn-trac-browse-changeset)
+  (define-key svn-status-mode-map (kbd "T") svn-status-mode-trac-map))
+(when (not svn-status-mode-branch-map)
+  (setq svn-status-mode-branch-map (make-sparse-keymap))
+  (define-key svn-status-mode-branch-map (kbd "d") 'svn-branch-diff)
+  (define-key svn-status-mode-map (kbd "B") svn-status-mode-branch-map))
+
+(easy-menu-define svn-status-mode-menu svn-status-mode-map
+  "'svn-status-mode' menu"
+  '("SVN"
+    ["svn status" svn-status-update t]
+    ["svn update" svn-status-update-cmd t]
+    ["svn commit" svn-status-commit t]
+    ["svn log" svn-status-show-svn-log t]
+    ["svn info" svn-status-info t]
+    ["svn blame" svn-status-blame t]
+    ("Diff"
+     ["svn diff current file" svn-status-show-svn-diff t]
+     ["svn diff marked files" svn-status-show-svn-diff-for-marked-files t]
+     ["svn ediff current file" svn-status-ediff-with-revision t]
+     ["svn resolve conflicts" svn-status-resolve-conflicts]
+     )
+    ("Search"
+     ["Grep marked files" svn-status-grep-files t]
+     ["Search marked files" svn-status-search-files t]
+     )
+    ["svn cat ..." svn-status-get-specific-revision t]
+    ["svn add" svn-status-add-file t]
+    ["svn add recursively" svn-status-add-file-recursively t]
+    ["svn mkdir..." svn-status-make-directory t]
+    ["svn mv..." svn-status-mv t]
+    ["svn cp..." svn-status-cp t]
+    ["svn rm..." svn-status-rm t]
+    ["svn export..." svn-status-export t]
+    ["Up Directory" svn-status-examine-parent t]
+    ["Elide Directory" svn-status-toggle-elide t]
+    ["svn revert" svn-status-revert t]
+    ["svn resolved" svn-status-resolved t]
+    ["svn cleanup" svn-status-cleanup t]
+    ["svn lock" svn-status-lock t]
+    ["svn unlock" svn-status-unlock t]
+    ["Show Process Buffer" svn-status-show-process-buffer t]
+    ("Branch"
+     ["diff" svn-branch-diff t]
+     ["Set Branch list" svn-status-set-branch-list t]
+     )
+    ("Property"
+     ["svn proplist" svn-status-property-list t]
+     ["Set Multiple Properties..." svn-status-property-set t]
+     ["Edit One Property..." svn-status-property-edit-one-entry t]
+     ["svn propdel..." svn-status-property-delete t]
+     "---"
+     ["svn:ignore File..." svn-status-property-ignore-file t]
+     ["svn:ignore File Extension..." svn-status-property-ignore-file-extension t]
+     ["Edit svn:ignore Property" svn-status-property-edit-svn-ignore t]
+     "---"
+     ["Edit svn:keywords List" svn-status-property-set-keyword-list t]
+     ["Add/Remove Id to/from svn:keywords" svn-status-property-set-keyword-id t]
+     ["Add/Remove Date to/from svn:keywords" svn-status-property-set-keyword-date t]
+     "---"
+     ["Select svn:eol-style" svn-status-property-set-eol-style t]
+     ["Set svn:executable" svn-status-property-set-executable t]
+     ["Set svn:mime-type" svn-status-property-set-mime-type t]
+     )
+    ("Options"
+     ["Save Options" svn-status-save-state t]
+     ["Load Options" svn-status-load-state t]
+     ["Set Trac project root" svn-status-set-trac-project-root t]
+     ["Set Short module name" svn-status-set-module-name t]
+     ["Set Changelog style" svn-status-set-changelog-style t]
+     ["Set Branch list" svn-status-set-branch-list t]
+     ["Sort the *svn-status* buffer" svn-status-toggle-sort-status-buffer
+      :style toggle :selected svn-status-sort-status-buffer]
+     ["Use -v for svn status calls" svn-status-toggle-svn-verbose-flag
+      :style toggle :selected svn-status-verbose]
+     ["Display full path names" svn-status-toggle-display-full-path
+      :style toggle :selected svn-status-display-full-path]
+     )
+    ("Trac"
+     ["Browse wiki" svn-trac-browse-wiki t]
+     ["Browse timeline" svn-trac-browse-timeline t]
+     ["Browse roadmap" svn-trac-browse-roadmap t]
+     ["Browse source" svn-trac-browse-source t]
+     ["Browse report" svn-trac-browse-report t]
+     ["Browse ticket" svn-trac-browse-ticket t]
+     ["Browse changeset" svn-trac-browse-changeset t]
+     ["Set Trac project root" svn-status-set-trac-project-root t]
+     )
+    "---"
+    ["Edit Next SVN Cmd Line" svn-status-toggle-edit-cmd-flag t]
+    ["Work Directory History..." svn-status-use-history t]
+    ("Mark / Unmark"
+     ["Mark" svn-status-set-user-mark t]
+     ["Unmark" svn-status-unset-user-mark t]
+     ["Unmark all" svn-status-unset-all-usermarks t]
+     "---"
+     ["Mark/Unmark unknown" svn-status-mark-unknown t]
+     ["Mark/Unmark modified" svn-status-mark-modified t]
+     ["Mark/Unmark modified properties" svn-status-mark-modified-properties t]
+     ["Mark/Unmark added" svn-status-mark-added t]
+     ["Mark/Unmark deleted" svn-status-mark-deleted t]
+     ["Mark/Unmark modified/added/deleted" svn-status-mark-changed t]
+     ["Mark/Unmark filename by extension" svn-status-mark-by-file-ext t]
+     ["Mark/Unmark filename by regexp" svn-status-mark-filename-regexp t]
+     ["Store Usermarks" svn-status-store-usermarks t]
+     ["Load Usermarks" svn-status-load-usermarks t]
+     )
+    ["Hide Unknown" svn-status-toggle-hide-unknown
+     :style toggle :selected svn-status-hide-unknown]
+    ["Hide Unmodified" svn-status-toggle-hide-unmodified
+     :style toggle :selected svn-status-hide-unmodified]
+    ["Show Client versions" svn-status-version t]
+    ["Prepare bug report" svn-prepare-bug-report t]
+    ))
+
+(defvar svn-status-file-popup-menu-list
+  '(["open" svn-status-find-file-other-window t]
+    ["svn diff" svn-status-show-svn-diff t]
+    ["svn commit" svn-status-commit t]
+    ["svn log" svn-status-show-svn-log t]
+    ["svn blame" svn-status-blame t]
+    ["mark" svn-status-set-user-mark t]
+    ["unmark" svn-status-unset-user-mark t]
+    ["svn add" svn-status-add-file t]
+    ["svn add recursively" svn-status-add-file-recursively t]
+    ["svn mv..." svn-status-mv t]
+    ["svn rm..." svn-status-rm t]
+    ["svn lock" svn-status-lock t]
+    ["svn unlock" svn-status-unlock t]
+    ["svn info" svn-status-info t]
+    ) "A list of menu entries for `svn-status-popup-menu'")
+
+;; extend svn-status-file-popup-menu-list via:
+;; (add-to-list 'svn-status-file-popup-menu-list ["commit" svn-status-commit t])
+
+(defun svn-status-popup-menu (event)
+  "Display a file specific popup menu"
+  (interactive "e")
+  (mouse-set-point event)
+  (let* ((line-info (svn-status-get-line-information))
+         (name (svn-status-line-info->filename line-info)))
+    (when line-info
+      (easy-menu-define svn-status-actual-popup-menu nil nil
+        (append (list name) svn-status-file-popup-menu-list))
+      (svn-status-face-set-temporary-during-popup
+       'svn-status-marked-popup-face (svn-point-at-bol) (svn-point-at-eol)
+       svn-status-actual-popup-menu))))
+
+(defun svn-status-face-set-temporary-during-popup (face begin end menu &optional prefix)
+  "Put FACE on BEGIN and END in the buffer during Popup MENU.
+PREFIX is passed to `popup-menu'."
+  (let (o)
+    (unwind-protect
+        (progn
+          (setq o (make-overlay begin end))
+          (overlay-put o 'face face)
+          (sit-for 0)
+