;ELC ;;; Compiled by mwolson@grepfind.mwolson.org on Thu Jan 24 00:15:30 2008 ;;; from file /stuff/proj/emacs/dvc/mwolson/lisp/dvc-utils.el ;;; in Emacs version 23.0.50.2 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`dvc-utils.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require dvc-defs ewoc dvc-emacs] 2) #@31 Execute BODY if in GNU/Emacs. (defalias 'dvc-do-in-gnu-emacs '(macro . #[(&rest body) "\301B\207" [body progn] 2 (#$ . 686)])) (put 'dvc-do-in-gnu-emacs 'lisp-indent-hook 'defun) #@28 Execute BODY if in XEmacs. (defalias 'dvc-do-in-xemacs '(macro . #[(&rest body) "\300\207" [nil] 1 (#$ . 872)])) (byte-code "\301\302\303\304#\210\305B\306\307!\207" [current-load-list put dvc-do-in-xemacs lisp-indent-hook defun dvc-mouse-2 (lambda (#1=#:defconst-tmp-var) (defconst dvc-mouse-2 #1#)) [mouse-2]] 4) #@53 Call FUNCTION with ARGS as parameters if it exists. (defalias 'dvc-funcall-if-exists '(macro . #[(function &rest args) "\302!\205 \303\304D BB\207" [function args fboundp funcall quote] 3 (#$ . 1195)])) #@53 Strip the final newline from STRING if there's one. (defalias 'dvc-strip-final-newline #[(string) "\211GSH\301=\203\302GSO\207\207" [string 10 0] 3 (#$ . 1407)]) #@258 Same behavior as GNU Emacs's `add-to-list', but also works on XEmacs. LIST-VAR is a symbol representing the list to be modified. ELEMENT is the element to be added to the list. If APPEND is non-nil, add the item to the end of the list instead of the front. (defalias 'dvc-add-to-list #[(list-var element &optional append) "\303 \n#\207" [list-var element append add-to-list] 4 (#$ . 1582)]) #@1150 Split STRING into substrings bounded by matches for SEPARATORS. The beginning and end of STRING, and each match for SEPARATORS, are splitting points. The substrings matching SEPARATORS are removed, and the substrings between the splitting points are collected as a list, which is returned. If SEPARATORS is non-nil, it should be a regular expression matching text which separates, but is not part of, the substrings. If nil it defaults to `split-string-default-separators', normally "[ \f\t\n\r\v]+", and OMIT-NULLS is forced to t. If OMIT-NULLS is t, zero-length substrings are omitted from the list (so that for the default value of SEPARATORS leading and trailing whitespace are effectively trimmed). If nil, all zero-length substrings are retained, which correctly parses CSV format, for example. Note that the effect of `(split-string STRING)' is the same as `(split-string STRING split-string-default-separators t)'). In the rare case that you wish to retain zero-length substrings when splitting on whitespace, use `(split-string STRING split-string-default-separators)'. Modifies the match data; use `save-match-data' if necessary. (defalias 'dvc-split-string #[(string &optional separators omit-nulls) "\203 \202 \306?\206\n\307\310\211\n \311\n\f\f\2036 \307\224U\2036 \fGW\2036 T\2027 #\203` \fGW\203`\306 \204Q \307\224W\203Z\f \307\224O B\307\225\202 \204m \fGW\203u\f \310O B \237-\207" [separators omit-nulls split-string-default-separators list notfirst start t 0 nil string-match rexp keep-nulls string] 5 (#$ . 1982)]) (byte-code "\301\302!\204\303B\304\303!\204\305\303\306\"\210\307\310\311\"\210\307\302\312\"\210\301\207" [current-load-list fboundp dired-delete-file dired-re-no-dot default-boundp set-default "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" defalias dired-make-relative #[(file &optional dir ignore) "\204 G\303V\203\303H\304U\203\305!\306\307\310!P\n\"\203*\n\303\225\311O\207\n\207" [dir default-directory file 0 126 expand-file-name string-match "^" regexp-quote nil] 4 "Convert FILE (an absolute file name) to a name relative to DIR.\nIf this is impossible, return FILE unchanged.\nDIR must be a directory name, not a file name."] #[(file &optional recursive) "\304\305 !@\306=\204\307 !\202L\n\203I\310 \306 #\211\203I\n\311=\2040\312\313\314\315 !\"!\203I\n\316=\2038\311\203I\317@\n\"\210A\211\204<\320 !)\207" [files file recursive dired-re-no-dot nil file-attributes t delete-file directory-files always yes-or-no-p format "Recursive delete of %s " dired-make-relative top dired-delete-file delete-directory] 6 "Delete FILE or directory (possibly recursively if optional RECURSIVE is true.)\nRECURSIVE determines what to do with a non-empty directory. If RECURSIVE is:\nNil, do not delete.\n`always', delete recursively without asking.\n`top', ask for each directory at top level.\nAnything else, ask for each sub-directory."]] 3) #@152 Sets $HOME to DIR, safely. `setenv' is not sufficient because `abbreviated-home-dir' would then be incorrectly set, breaking a lot of Emacs function. (defalias 'dvc-sethome #[(dir) "\302\303\"\210\304\211\207" [dir abbreviated-home-dir setenv "HOME" nil] 3 (#$ . 4943)]) #@874 Read directory name, prompting with PROMPT and completing in directory DIR. Value is not expanded---you must call `expand-file-name' yourself. Default name to DEFAULT-DIRNAME if user exits with the same non-empty string that was inserted by this function. (If DEFAULT-DIRNAME is omitted, the current buffer's directory is used, except that if INITIAL is specified, that combined with DIR is used.) If the user exits with an empty minibuffer, this function returns an empty string. (This can only happen if the user erased the pre-inserted contents or if `insert-default-directory' is nil.) Fourth arg MUSTMATCH non-nil means require existing directory's name. Non-nil and non-t means also require confirmation after completion. Fifth arg INITIAL specifies text to start with. DIR should be an absolute directory name. It defaults to the value of `default-directory'. (defalias 'dvc-read-directory-name #[(prompt &optional dir default-dirname mustmatch initial) "\306\307!\203\307 \n \f%\207 \204 \n\204$\f\203\" \fP\202# \310 \n \f%\207" [prompt dir default-dirname mustmatch initial default-directory fboundp read-directory-name read-file-name] 6 (#$ . 5224)]) #@166 Create a tarball with the content of DIR. If DIR does not yet exist, wait until it does exist. Then create the tarball TGZ-FILE-NAME and remove the contents of DIR. (defalias 'dvc-create-tarball-from-intermediate-directory #[(dir tgz-file-name) "\302!\204 \303\304!\210\202\305\306\307\211\211\310 \311\312!\313!& \210\305\314\307\211\211\315&\210\316\317 \"\207" [dir tgz-file-name file-exists-p sit-for 0.01 call-process "tar" nil "cfz" "-C" file-name-directory file-name-nondirectory "rm" "-rf" message "Created tarball %s"] 11 (#$ . 6410)]) (byte-code "\302B\303\302!\204\304\302\305\306 \307\")\"\210\307\207" [current-load-list string dvc-digits default-boundp set-default "0123456789" append nil] 5) #@42 Returns non-nil if CHARACTER is a digit. (defalias 'dvc-digit-char-p #[(character) " \235\207" [character dvc-digits] 2 (#$ . 7136)]) #@239 Position of ITEM in list, or nil if not found. Return 0 if ITEM is the first element of SEQ. If an optional argument COMP-FUNC is given, COMP-FUNC is used to compare ITEM with an item of SEQ; returning t means the two items are the same. (defalias 'dvc-position #[(item seq &optional comp-func) "\305 \204\n\306 \203 \f @\"\204 A\nT\202\n \205$\n*\207" [seq seq-int pos comp-func item 0 eq] 3 (#$ . 7278)]) #@162 Return a unique string designating PATH. If PATH is a directory,the returned contains one and exactly one trailing slash. If PATH is nil, then nil is returned. (defalias 'dvc-uniquify-file-name #[(path) "\205\301\302\303!\203\304!\202!!\207" [path file-truename expand-file-name file-directory-p file-name-as-directory] 5 (#$ . 7705)]) #@54 Add MODE to `uniquify-list-buffers-directory-modes'. (defalias 'dvc-add-uniquify-directory-mode #[(mode) "\301\302!\210\303\304!\205\305\304\"\207" [mode require uniquify boundp uniquify-list-buffers-directory-modes add-to-list] 3 (#$ . 8058)]) #@46 Temporary directory for some DVC operations. (defvar dvc-temp-directory "/tmp" (#$ . 8312)) #@111 Generate a temporary file name based on FILE. The path for the file name can be set via `dvc-temp-directory'. (defalias 'dvc-make-temp-name #[(file) "\302\303! P!\207" [dvc-temp-directory file make-temp-name dvc-uniquify-file-name] 3 (#$ . 8411)]) #@85 Return the content of BUFFER as a string. Strips the final newline if there is one. (defalias 'dvc-buffer-content #[(buffer) "rq\210\301edb\210`Sf\302=\203`S\202`\")\207" [buffer buffer-substring-no-properties 10] 4 (#$ . 8666)]) (byte-code "\301B\302\301!\204\303\301\304\"\210\304\207" [current-load-list dvc-ewoc-create-needs-newline default-boundp set-default nil] 3) #@195 Possibly insert a trailing newline after PRETTY-PRINTER call. Work around `ewoc-create' interface change: oldest versions automatically added a trailing newline, whereas newest versions do not. (defalias 'dvc-ewoc-create-api-select #[(pretty-printer) "\203\302\303 \304B\305BBB\207 \207" [dvc-ewoc-create-needs-newline pretty-printer lambda (elem) (elem) ((insert "\n"))] 4 (#$ . 9054)]) #@341 Add to string STR the face FACE. Optionally, also add the text properties KEYMAP, MENU and HELP. If KEYMAP is a symbol, (symbol-value KEYMAP) is used as a keymap; and `substitute-command-keys' result against (format "\{%s}" (symbol-name keymap)) is appended to HELP. If HELP is nil and if MENU is non nil, the MENU title is used as HELP. (defalias 'dvc-face-add #[(str face &optional keymap menu help) "\203\214\306 ! 9\205\307\310\311\312 !\"! \203 \2027\2057\211A@);\2057\211A@)\f\203Q\203M\313\314\313\f\260\202R\f\202R  9\203^ J\202_ \315\316\nG\317\320\321 \205x\322\323\303 \324\257\205\201\325D\"BBBB\n$\210\n-\207 \207" [dvc-highlight str strcpy keymap key-help help copy-sequence substitute-command-keys format "\\{%s}" symbol-name "\n" "================" add-text-properties 0 face font-lock-face append mouse-face highlight help-echo dvc-cmenu menu x prefix-help long-help] 15 (#$ . 9452)]) (put 'dvc-face-add 'byte-optimizer 'byte-compile-inline-expand) #@60 If CONDITION then add TEXT the face FACE1, else add FACE2. (defalias 'dvc-face-add-with-condition #[(condition text face1 face2) "\203\247 \n\306\211\211\203\243\307! 9\205(\310\311\312\313 !\"! \2032 \202H\f\205H\f\211A@);\205H\f\211A@)\203e\203`\314\315\314\260\202f\202f  9\203r J\202s \316\317G\320\321\322 \205\215\323\324\305 \325\257\f\205\224\326\fD\"BBBB$\210-\202\245-\207 \306\211\211\203G\307! 9\205\314\310\311\312\313 !\"! \203\326 \202\354\f\205\354\f\211A@);\205\354\f\211A@)\203 \203\314\315\314\260\202\n\202\n  9\203 J\202 \316\317G\320\321\322 \2051\323\324\305 \325\257\f\2058\326\fD\"BBBB$\210-\202I-\207" [condition text face1 help menu keymap nil copy-sequence substitute-command-keys format "\\{%s}" symbol-name "\n" "================" add-text-properties 0 face font-lock-face append mouse-face highlight help-echo dvc-cmenu str dvc-highlight strcpy key-help x prefix-help long-help face2] 15 (#$ . 10476)]) #@38 Turn on highline mode or equivalent. (defalias 'dvc-flash-line-on #[nil "\300 \207" [hl-line-mode] 1 (#$ . 11553)]) #@39 Turn off highline mode or equivalent. (defalias 'dvc-flash-line-off #[nil "\300 \207" [hl-line-mode] 1 (#$ . 11675)]) #@25 Flash the current line. (defalias 'dvc-flash-line #[nil "p\301 \210\302\303!\210q\210\304 )\207" [buffer dvc-flash-line-on sit-for 1000 dvc-flash-line-off] 2 (#$ . 11799)]) #@72 *Indicate whether debugging messages should be printed by `dvc-trace'. (defvar dvc-debug nil (#$ . -11980)) #@141 Display the trace message MSG. Same as `message' if `dvc-debug' is non-nil. Does nothing otherwise. Please use it for your debug messages. (defalias 'dvc-trace #[(&rest msg) "\205 \302\303\304 @P A#\207" [dvc-debug msg apply message "dvc: "] 4 (#$ . 12095)]) #@36 Display the line the cursor is in. (defalias 'dvc-trace-current-line #[nil "\300\301\214~\210\302 )\303\304 `\"\303`\305 \"$\207" [dvc-trace "Current-line(%s)=%s[_]%s" dvc-line-number-at-pos buffer-substring-no-properties line-beginning-position line-end-position] 7 (#$ . 12363)]) #@131 Topological sort of the dependancy graph. Root comes last. It's a macro so that it remains available after (unload-feature ...). (defalias 'dvc-features-list '(macro . #[nil "\300\207" ['(dvc-site dvc-version dvc-tips dvc-buffers dvc-core dvc-defs dvc-diff dvc-emacs dvc-lisp dvc-revlog dvc-revlist dvc-log dvc-register dvc-ui dvc-unified dvc-utils dvc-xemacs xhg-core xhg-dvc xhg-gnus xhg tla-dvc tla-bconfig tla-browse tla-tests tla tla-core tla-autoconf tla-defs tla-gnus baz-dvc baz bzr-core bzr-dvc bzr-revlist bzr-revision bzr xgit-annotate xgit-dvc xgit-gnus xgit-log xgit-revision xgit-core xgit)] 1 (#$ . 12652)])) #@132 Unloads DVC. run `unload-feature' for each DVC feature. TODO: should also remove the hooks setup by DVC (`file-find-hook', ...). (defalias 'dvc-unload #[nil "\302\303\211\203 @\304!\203\305\306\"\210 A\211\204*\304\307!\205(\305\307\306\"\207" [feature #1=#:--cl-dolist-temp-- (dvc-site dvc-version dvc-tips dvc-buffers dvc-core dvc-defs dvc-diff dvc-emacs dvc-lisp dvc-revlog dvc-revlist dvc-log dvc-register dvc-ui dvc-unified dvc-utils dvc-xemacs xhg-core xhg-dvc xhg-gnus xhg tla-dvc tla-bconfig tla-browse tla-tests tla tla-core tla-autoconf tla-defs tla-gnus baz-dvc baz bzr-core bzr-dvc bzr-revlist bzr-revision bzr xgit-annotate xgit-dvc xgit-gnus xgit-log xgit-revision xgit-core xgit) nil featurep unload-feature t dvc-autoloads] 4 (#$ . 13284) nil]) #@250 Reload DVC (usually for debugging purpose). With prefix arg, prompts for the DIRECTORY in which DVC should be loaded. Useful to switch from one branch to the other. If a Makefile is present in the directory where DVC is to be loaded, run "make". (defalias 'dvc-reload #[(&optional directory) "\203\304\305\306!!\307 \n\"B)\304\305\306!!\310\311!\203\"\312\313!\210)\314 \210\315\316!\207" [directory current-path load-path default-directory file-name-directory locate-library "dvc-core" remove file-exists-p "Makefile" shell-command "make" dvc-unload require dvc-autoloads] 4 (#$ . 14067) (list (when current-prefix-arg (let* ((other (dvc-read-directory-name "Load DVC from: ")) (lispdir (concat (file-name-as-directory other) "lisp"))) (if (file-directory-p lispdir) lispdir other))))]) #@147 Return a regexp string which matches exactly STRING and nothing else. Special characters are escaped to leave STRING in a suitable form for Arch. (defalias 'dvc-regexp-quote #[(string) "\302!\303\304\305 #)\207" [string quoted regexp-quote replace-regexp-in-string "\\([{}()|]\\)" "\\\\\\1"] 4 (#$ . 14873)]) #@47 Return sexp pretty printed by `pp-to-string'. (defalias 'dvc-pp-to-string #[(sexp) "\304\305\211\306 !+\207" [print-length print-level print-readably sexp t nil pp-to-string] 3 (#$ . 15190)]) #@86 Variable should be local to each buffer. Function used to refresh the current buffer (defvar dvc-buffer-refresh-function nil (#$ . 15391)) (make-variable-buffer-local 'dvc-buffer-refresh-function) #@281 Return a directory name which is the root of some project tree. Either prompt from the user or use the current directory. The behavior can be changed according to the value of `dvc-read-project-tree-mode'. PROMPT is used as a user prompt, and DIRECTORY is the default directory. (defalias 'dvc-read-project-tree-maybe #[(&optional prompt directory) "\305\206 \306\"\211\206\206  \206\307\f\310=\203'\305\311 !!\202m\f\312=\203F\203@\n\2039\n\202m\313\314\"\202m\311 !\202m\f\315=\203X\n\206m\305\311 !!\202m\f\316=\203i\n\206m\313\314\"\202m\313\317\f\"+\207" [directory default-directory root prompt dvc-read-project-tree-mode dvc-tree-root t "Use directory: " always dvc-read-directory-name unless-specified error "%s directory is not a DVC managed directory" sometimes never "`%s': wrong value for dvc-read-project-tree-mode"] 4 (#$ . 15595)]) #@63 Call the function specified by `dvc-buffer-refresh-function'. (defalias 'dvc-generic-refresh #[nil "\305\211\n\203 \n )\202\306\307!*\207" [dvc-read-project-tree-mode dvc-read-directory-mode dvc-buffer-refresh-function dvc-buffer-current-active-dvc dvc-temp-current-active-dvc never message "I don't know how to refresh this buffer"] 2 (#$ . 16479) nil]) #@315 Create function to move up or down in `dvc-revlist-cookie'. EWOC-DIRECTION is either `ewoc-next' or `ewoc-prev'. FUNCTION is the name of the function to declare. COOKIE is the ewoc to navigate in. if ONLY-UNMERGED is non-nil, then, navigate only through revisions not merged by another revision in the same list. (defalias 'dvc-make-move-fn '(macro . #[(ewoc-direction function cookie &optional only-unmerged) "\304\305\306\307\310\311 DD\312\313\n \314BB\315BBDD\316\317\312\320 \321BB\n \322BBF\323\312\n \324BBEE\316\317\312\320 \325BBE\323\312\n\326=\203B\327\202C\326 \330BBEE\331BBBB\257\207" [function cookie ewoc-direction only-unmerged defun nil (interactive) let* elem ewoc-locate next or (elem) (elem) while and if ((not (and (eq (car (ewoc-data next)) 'entry-patch) (eq (nth 4 (ewoc-data next)) 'nobody))) (eq (car (ewoc-data next)) 'separator)) (next) setq (next) ((not (and (eq (car (ewoc-data next)) 'entry-patch) (eq (nth 4 (ewoc-data next)) 'nobody))) (eq (car (ewoc-data next)) 'separator)) ewoc-next ewoc-prev (next) ((when next (goto-char (ewoc-location next))))] 14 (#$ . 16848)])) #@78 If BUFFER exists, show it, scroll and return non-nil. Otherwise, return nil. (defalias 'dvc-scroll-maybe #[(buffer up-or-down) "\303!\205\304!p\305!\210\n\203\306\307\310\217\210\305 !*\207" [buffer buf visible buffer-live-p dvc-buffer-visible-p pop-to-buffer nil (funcall up-or-down 2) ((error (message "Can't scroll anymore.")))] 3 (#$ . 17962) nil]) #@120 Present user with a choice of actions, labeled by COMMENT. CHOICES is a list of pairs containing (symbol description). (defalias 'dvc-offer-choices #[(comment choices) "\306\307\n\307\211\203) @ \310\311@!@!\312\211A@)\313\260 A\211\204\f*\314 \2036 \315 Q\2027 !*\207" [choice msg choices #1=#:--cl-dolist-temp-- x comment "use " nil key-description where-is-internal " (" ") " error "; "] 6 (#$ . 18331)]) #@172 Read a string in the minibuffer, with completion. Set `dvc-completing-read-function' to determine which function to use. See `completing-read' for a description of ARGS. (defalias 'dvc-completing-read #[(&rest args) "\302 \"\207" [dvc-completing-read-function args apply] 3 (#$ . 18761)]) #@125 Return a list of strings (normally file names relative to tree root) from the file ".dvc-exclude" in `default-directory'. (defalias 'dvc-default-excluded-files #[nil "\302\303!\205-\304\305!\306\216rq\210\307\303!\210\310`dW\203+\311 `\312 {C\"\313y\210\202 ,\207" [#1=#:temp-buffer result file-readable-p ".dvc-exclude" generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) insert-file-contents nil append point-at-eol 1] 4 (#$ . 19059)]) #@54 Edit the file ".dvc-exclude" in `default-directory'. (defalias 'dvc-edit-exclude #[nil "\300\301!\207" [find-file ".dvc-exclude"] 2 (#$ . 19571) nil]) (provide 'dvc-utils)