git.el: Define the propertize function if needed, for XEmacs compatibility.
Also use `concat' instead of `format' in the pretty-printer since format doesn't preserve properties under XEmacs. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Alexandre Julliard committed
Jan 9, 2007 at 21:27 UTC
03d311eda2d8c2d23855b9d3e904c7648925ab56
1 file changed
+13
-5
contrib/emacs/git.el
+13
-5
@@ -280,6 +280,15 @@ and returns the process output as a string."
280
(git-run-command nil nil "update-index" "--info-only" "--add" "--" (file-relative-name ignore-name)))
281
(git-add-status-file (if created 'added 'modified) (file-relative-name ignore-name))))
282
283
+; propertize definition for XEmacs, stolen from erc-compat
284
+(eval-when-compile
285
+ (unless (fboundp 'propertize)
286
+ (defun propertize (string &rest props)
287
+ (let ((string (copy-sequence string)))
288
+ (while props
289
+ (put-text-property 0 (length string) (nth 0 props) (nth 1 props) string)
290
+ (setq props (cddr props)))
291
+ string))))
292
293
;;;; Wrappers for basic git commands
294
;;;; ------------------------------------------------------------
@@ -448,11 +457,10 @@ and returns the process output as a string."
457
458
(defun git-fileinfo-prettyprint (info)
459
"Pretty-printer for the git-fileinfo structure."
451
- (insert (format " %s %s %s %s%s"
452
- (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ")
453
- (git-status-code-as-string (git-fileinfo->state info))
454
- (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info))
455
- (git-escape-file-name (git-fileinfo->name info))
460
+ (insert (concat " " (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ")
461
+ " " (git-status-code-as-string (git-fileinfo->state info))
462
+ " " (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info))
463
+ " " (git-escape-file-name (git-fileinfo->name info))
464
(git-rename-as-string info))))
465
466
(defun git-parse-status (status)