commit-id: 7e22c2b0445eef582dde9b38054afaf3e24da348

(N.B.:  This is on Emacs 22.2.1, though only a couple 
        of these items are version-specific.)

so the byte compiler is tripping over a number of undefined
functions/variables, notably:

   magit-submode
     -- defvar needs to be earlier
   line-move-visual
     -- introduced in Emacs 23;
        eval-when-compile:defvar to nil should suffice
   read-input
     -- obsolete; use read-string
   ediff-*
     -- magit-interactive-resolve needs (require 'ediff)
        needs eval-when-compile:require
   pcomplete-parse-buffer-arguments
     -- needs eval-when-compile:require
   server-running-p
     -- magit-interactive-rebase needs (require 'server)
        needs eval-when-compile:require
        introduced in Emacs 23,
        (**) needs definition for Emacs 22 
        
Full list of warnings is below, before the patch.

The patch addresses all of the above except for (**).
It applies on top of the one in <[email protected]>

(...and if you're NOT actually applying that one, then there
will be an additional issue with start-file-process not being
defined in Emacs 22 as discussed in that thread; this patch
is otherwise independent...)

Re: (**):  As things stand, magit-interactive-rebase will die
immediately in Emacs 22.

Not quite sure what to do about this one.  

Putting in a (semantically correct) definition of
server-running-p to be (lambda () :other), i.e., the "we
don't know, so assume yes" return value, may lead to worse
behavior later.  I'm imagining someone starting an interactive 
rebase which then crashes and leaves things in a bad state
because it can't run emacsclient.  On the other hand,
this MAY be a general problem with magit-interactive-rebase
since even in Emacs 23, server-running-p can always return
:other if it can't determine whether the server is running),
... it's not something I've tried yet, so I'm leaving it 
alone for now.

Full transcript with list of warnings
-------------------------------------
$ make
emacs --batch --eval '(byte-compile-file "magit.el")'
Loading 00debian-vars...
Loading /etc/emacs22/site-start.d/35elib-startup.el (source)...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...
Loading /etc/emacs/site-start.d/50festival.el (source)...
Loading /etc/emacs/site-start.d/50gettext.el (source)...
Loading /etc/emacs/site-start.d/50git-core.el (source)...
Loading /etc/emacs/site-start.d/50noweb.el (source)...
Loading /etc/emacs22/site-start.d/50pcl-cvs-startup.el (source)...
Loading /etc/emacs/site-start.d/50psvn.el (source)...
Loading /etc/emacs22/site-start.d/50vm-init.el (source)...

In magit-goto-next-section:
magit.el:801:21:Warning: reference to free variable `magit-submode'

In magit-goto-previous-section:
magit.el:842:24:Warning: reference to free variable `magit-submode'
Loading cl-extra...

In magit-show-only-files:
magit.el:1015:11:Warning: reference to free variable `magit-submode'

In magit-show-only-files-all:
magit.el:1024:11:Warning: reference to free variable `magit-submode'

In magit-mode:
magit.el:1621:9:Warning: assignment to free variable `line-move-visual'

In magit-svn-find-rev:
magit.el:2538:11:Warning: `read-input' is an obsolete function (as of Emacs
    22.1); use `read-string' instead.
magit.el:2539:14:Warning: `read-input' is an obsolete function (as of Emacs
    22.1); use `read-string' instead.

In magit-interactive-resolve:
magit.el:3834:35:Warning: reference to free variable `ediff-buffer-A'
magit.el:3835:35:Warning: reference to free variable `ediff-buffer-B'
magit.el:3836:35:Warning: reference to free variable `ediff-buffer-C'
magit.el:3837:42:Warning: reference to free variable `ediff-ancestor-buffer'

In end of data:
magit.el:3861:1:Warning: the following functions are not known to be defined:
    pcomplete-parse-buffer-arguments, server-running-p, ediff-cleanup-mess
Wrote .../magit.elc
$ 

The Patch
---------

diff --git a/magit.el b/magit.el
index 0c2f223..0b3df34 100644
--- a/magit.el
+++ b/magit.el
@@ -275,8 +275,16 @@ Many Magit faces inherit from this one by default."
     (defalias 'magit-start-process 'start-file-process)
     (defalias 'magit-start-process 'start-process))
 
+(eval-when-compile
+  (when (< emacs-major-version 23)
+    (defvar line-move-visual nil)))
+
 ;;; Utilities
 
+(defvar magit-submode nil)
+(make-variable-buffer-local 'magit-submode)
+(put 'magit-submode 'permanent-local t)
+
 (defun magit-use-region-p ()
   (if (fboundp 'use-region-p)
       (use-region-p)
@@ -1561,10 +1569,6 @@ FUNC should leave point at the end of the modified 
region"
 
 (put 'magit-mode 'mode-class 'special)
 
-(defvar magit-submode nil)
-(make-variable-buffer-local 'magit-submode)
-(put 'magit-submode 'permanent-local t)
-
 (defvar magit-refresh-function nil)
 (make-variable-buffer-local 'magit-refresh-function)
 (put 'magit-refresh-function 'permanent-local t)
@@ -2541,9 +2545,9 @@ Given a prefix-arg then the merge will be squashed."
 
 (defun magit-svn-find-rev (rev &optional branch)
   (interactive
-   (list (read-input "SVN revision: ")
+   (list (read-string "SVN revision: ")
          (if current-prefix-arg
-             (read-input "In branch: "))))
+             (read-string "In branch: "))))
   (let* ((sha (apply 'magit-git-string
                      `("svn"
                        "find-rev"
@@ -2802,6 +2806,8 @@ If USE-CACHE is non nil, use the cached information."
        (magit-set merge-branch "branch" branch "merge"))
     (magit-run-git-async "pull" "-v")))
 
+(eval-when-compile (require 'pcomplete))
+
 (defun magit-shell-command (command)
   (interactive "sCommand: ")
   (require 'pcomplete)
@@ -3665,10 +3671,13 @@ Prefix arg means justify as well."
      (kill-new info)
      (message "%s" info))))
 
+(eval-when-compile (require 'server))
+
 (defun magit-interactive-rebase ()
   "Start a git rebase -i session, old school-style."
   (interactive)
-  (unless (server-running-p)
+  (require 'server)
+  (unless (magit-server-running-p)
     (server-start))
   (let* ((section (get-text-property (point) 'magit-section))
         (commit (and (member 'commit (magit-section-context-type section))
@@ -3808,7 +3817,10 @@ With prefix force the removal even it it hasn't been 
merged."
 (defvar magit-ediff-file)
 (defvar magit-ediff-windows)
 
+(eval-when-compile (require 'ediff))
+
 (defun magit-interactive-resolve (file)
+  (require 'ediff)
   (let ((merge-status (magit-git-string "ls-files" "-u" "--" file))
        (base-buffer (generate-new-buffer (concat file ".base")))
        (our-buffer (generate-new-buffer (concat file ".current")))



-- 
Subscription settings: http://groups.google.com/group/magit/subscribe?hl=en

Reply via email to