Location: [EMAIL PROTECTED] http://arch.sxemacs.org/2004/

Revision: xtla--xemacs--0.9--patch-2
Archive: [EMAIL PROTECTED]
Creator: Steve Youngs <[EMAIL PROTECTED]>
Date: Thu Nov 18 12:37:13 EST 2004
Standard-date: 2004-11-18 02:37:13 GMT
Modified-files: configure.ac lisp/Makefile.in
    lisp/contrib/ewoc.el lisp/xtla-build.el
    lisp/xtla-core.el lisp/xtla-defs.el lisp/xtla-xemacs.el
    lisp/xtla.el
New-patches: [EMAIL PROTECTED]
Summary: Major overhaul of the build system.
Keywords: 

This patch vastly improves the Xtla build system, making it simpler,
cleaner, and easier to maintain.  While at the same time keeping all of
the previous functionality of the system.

All compile time warnings and errors in the main code base (ie, except
for what's in contrib) have been eliminated, at least on XEmacs (sorry, I
don't have GNU/Emacs to test there).

One difference from the old build system is that now all the .el files
from $srcdir/lisp and $srcdir/lisp/contrib are copied into $builddir/lisp
and $builddir/lisp/contrib respectively (obviously, this does not happen
if you are building "in-tree").

* configure.ac (XTLA_OTHERDIRS): Add `FIXME' comment, this function is
  not DTRT when it is unset.

* lisp/Makefile.in (OTHERDIRS): Don't include `contrib' as it is already
  added to the load-path during the build.  Also guard against a bug in
  configure.ac that causes this to be set to "OTHERDIRS".

* lisp/Makefile.in (EXTRA_OPTS): Remove path to xtla-build.  It's in the
  load-path at compile time so specifying the path here is redundant.

* lisp/Makefile.in (PUSHPATH): Re-write using nothing but lisp, making it
  far easier to understand, and also making it work for XEmacs.

* lisp/Makefile.in (contrib/%.elc): Get rid of the insanity of creating a
  tmp directory and compiling there which was causing all sorts of
  problems with being able to set a load-path.  This target is now far
  simpler, easier to understand, and DTRT in all situations...

    building "in-tree"
    building in a subdir with relative paths to the source
    building in a subdir with absolute paths to the source
    building "out-of-tree" with relative paths to the source
    building "out-of-tree" with absolute paths to the source

* lisp/Makefile.in (%.elc): Ditto.

* lisp/Makefile.in (xtla-version.el): No need to enclose [EMAIL PROTECTED]@'
  in quotes in the printf.

* lisp/contrib/ewoc.el (ewoc-locate): Remove unused local variable
  `footer'. 

* lisp/xtla-build.el: Remove all the defaliases that were aliasing
  functions to 'ignore.  This is now handled in a much cleaner and safer
  way via some new macros in xtla-defs.el.  See...

    `tla--do-in-gnu-emacs'
    `tla--do-in-xemacs'
    `tla--funcall-if-exists' 

* lisp/xtla-core.el (tla--get-buffer-create): Remove unused local
  variable `name'.  It was actually being bound twice and the first time
  wasn't being used.

* lisp/xtla-core.el (tla-process-running): Move definition to before the
  first time it is used to avoid an unnecessary byte-compiler warning.

* lisp/xtla-core.el (tla--install-buffer-menu): Use
  `tla--do-in-gnu-emacs' and `tla--do-in-xemacs' to safely avoid
  byte-compiler warnings and generate correct code for both emacsen.

* lisp/xtla-core.el (tla--mouse-event-p): Ditto.

* lisp/xtla-defs.el (tla--do-in-gnu-emacs): New.  Use this when you want
  to do something in GNU/Emacs but not in XEmacs.  It'll generate the
  correct code for GNU/Emacs and avoid byte-compiler warnings in XEmacs.

* lisp/xtla-defs.el (tla--do-in-xemacs): New.  Use this when you want
  to do something in XEmacs but not in GNU/Emacs.  It'll generate the
  correct code for XEmacs and avoid byte-compiler warnings in GNU/Emacs.

* lisp/xtla-defs.el (tla--funcall-if-exists): New.  Call a function if
  and only if it exists and avoid byte-compiler warnings if the function
  doesn't exist.

* lisp/xtla-defs.el (clone-process): Moved here from xtla-xemacs.el as it
  was being called before xtla-xemacs.el was loaded.

* lisp/xtla-defs.el ("Xtla" submenu): Use `tla--do-in-gnu-emacs' and
  `tla--do-in-xemacs' to generate correct code and avoid byte-compiler
  warnings in both emacsen. 

* lisp/xtla-xemacs.el (clone-process): Removed.  This is now in
  xtla-defs.el because it was being called before xtla-xemacs.el was
  being loaded.

* lisp/xtla.el (tla--mouse-avoidance-point-position): Wrap in
  `tla--do-in-gnu-emacs'.  In XEmacs this is defaliased to
  `mouse-avoidance-point-position'. 

* lisp/xtla.el (tla-name-read-help): Wrap the call to `help-setup-xref'
  in `tla--funcall-if-exists' instead of testing for featurep 'xemacs.
  Ensuring that if XEmacs ever gets `help-setup-xref' the xtla code won't
  need to be changed.

* lisp/xtla.el (smerge-mode): defvar it at compile time to avoid
  byte-compiler warnings if smerge isn't installed.

* lisp/xtla.el (tla-conflicts-finish): Call the smerge functions with
  `tla--funcall-if-exists' to avoid byte-compiler warnings if smerge
  isn't installed.

* lisp/xtla.el (tla--merged-rev): defvar at compile time.  Needed for
  `tla--set-merged-patches'. 

* lisp/xtla.el (tla--set-merged-patches): Use `tla--merged-rev', setq'ing
  it to the value of the locally-bound `merged-rev' and then use
  `tla--merged-rev' in the lambda instead of `merged-rev'.  This is done
  because the lambda will not inherit locally bound variables declared
  outside of itself.

* lisp/xtla.el (tla--partner-create-menu): Use `tla--funcall-if-exists'
  to avoid byte-compiler warnings in XEmacs.  Also add a `FIXME' comment
  because this function does nothing in XEmacs and it probably should.

* lisp/xtla.el (tla--flash-line-on): Use `tla--funcall-if-exists' to
  generate correct code and avoid byte-compiler warnings in both
  emacsen instead of using this ugly hack...

    ;; lint trap: avoid byte-compiler warnings
    (eval-when-compile
      (unless (fboundp 'highline-off)
        (defun highline-off ()))
      (unless (fboundp 'highline-on)
        (defun highline-on ())))

* lisp/xtla.el (tla--flash-line-off): Ditto.

* lisp/xtla.el (tla-find-file-hook): Use `tla--funcall-if-exists' to
  avoid byte-compiler warnings if smerge isn't installed.



* added files

    {arch}/xtla/xtla--xemacs/xtla--xemacs--0.9/[EMAIL PROTECTED]

* modified files

--- orig/configure.ac
+++ mod/configure.ac
@@ -54,6 +54,8 @@
     $1="`echo $$1 | sed -e 's/:/ /g'`";;
   esac ])
 
+dnl FIXME: This is broken, if it is left at the default (unset) the
+dnl literal, `OTHERDIRS' gets subst into the Makefile.
 # --with-other-dir option
 AC_DEFUN([XTLA_OTHERDIRS],
   [ XTLA_ARG_SUBST([OTHERDIRS], [other-dirs], [DIRS],


--- orig/lisp/Makefile.in
+++ mod/lisp/Makefile.in
@@ -22,8 +22,17 @@
 EMACS_FLAVOR = @EMACS_FLAVOR@
 EMACS_VERSION = @EMACS_VERSION@
 
-# Other settings
-OTHERDIRS = contrib @OTHERDIRS@
+# Other settings 
+
+# FIXME: Work around a bug in configure.ac (could somebody please fix the
+# real problem there).  What's happening is that if `--with-other-dir' is
+# not set (the default), its value is the literal `OTHERDIRS'.  There is
+# a corresponding fixme comment in configure.ac.
+OTHERDIRS = @OTHERDIRS@
+ifeq ('x$(OTHERDIRS)','xOTHERDIRS')
+OTHERDIRS =
+endif
+
 SYMLINKS = @SYMLINKS@
 LINKPATH = @LINKPATH@
 
@@ -36,7 +45,7 @@
         contrib/ewoc.el
 XSRCS = auto-autoloads.el custom-load.el xtla-version.el
 PACKAGEDIR = @lispdir@
-EXTRA_OPTS = -l @[EMAIL PROTECTED]
+EXTRA_OPTS = -l xtla-build
 endif
 
 AUTOLOAD_PACKAGE_NAME = (setq autoload-package-name \"xtla\")
@@ -108,34 +117,29 @@
        done ;
 
 ##############################################################################
+PUSHPATH = -eval \
+       \("progn \
+           (push (file-truename \"@[EMAIL PROTECTED]") load-path) \
+           (push (file-truename \"@[EMAIL PROTECTED]") load-path) \
+          (let* ((path-separator \" \") \
+                 (paths (split-path \"$(OTHERDIRS)\"))) \
+            (while paths \
+              (push (car paths) load-path) \
+              (setq paths (cdr paths))))"\)
 
-# Note that ".." is actually "." -- the lisp build directory -- because
-# the build-rules for .elc files use a temporary subdir
-PUSHPATH= -eval "`\
-          dir="@abs_srcdir@ @[EMAIL PROTECTED]/ .. $(OTHERDIRS)" ;\
-          echo \(setq load-path \(append \(list ; \
-          for i in $$dir ; do \
-             echo \(expand-file-name \\"$$i\\"\)\ ; \
-          done ;\
-          echo \) load-path\)\) ; \
-          `"
 
 contrib/%.elc: @[EMAIL PROTECTED]
        mkdir -p contrib
-       @echo Compiling $< for ${EMACS_FLAVOR}
-       @tmpdir=elc.$$$$; mkdir $$tmpdir; cp $< $$tmpdir; cd $$tmpdir ; \
-       ($(EMACS_PROG) -batch -q $(PUSHPATH) $(EXTRA_OPTS) $(BYTECOMP) 
$$(basename $*.el) && \
-       mkdir -p ../$$(dirname $*) && \
-       echo mv $$(basename $@) ../$@ && mv $$(basename $@) ../$@); \
-       cd ../ ; $(RM) -rf $$tmpdir
+       @if test ! -f @[EMAIL PROTECTED] ; then \
+               cp $< contrib ;                       \
+       fi ; cd contrib ;                             \
+       $(EMACS_PROG) -batch -q $(BYTECOMP) $*.el
 
 %.elc:
-       @echo "Compiling ${firstword $^} for ${EMACS_FLAVOR}"
-       @tmpdir=elc.$$$$; mkdir $$tmpdir; cp  ${firstword $^} $$tmpdir; cd 
$$tmpdir ; \
-       ($(EMACS_PROG) -batch -q $(PUSHPATH) $(EXTRA_OPTS) $(BYTECOMP) 
$(@:%.elc=%.el) && \
-       mkdir -p ../$$(dirname $*) && \
-       echo mv $$(basename $@) ../$@ && mv $$(basename $@) ../$@) ; \
-       cd ../ ; $(RM) -rf $$tmpdir
+       @if test ! -f ./$(@:%.elc=%.el) ; then        \
+               cp $(firstword $^) ./ ;               \
+       fi
+       $(EMACS_PROG) -batch -q $(PUSHPATH) $(EXTRA_OPTS) $(BYTECOMP) 
$(@:%.elc=%.el)
 
 ##############################################################################
 # Dependencies
@@ -191,9 +195,9 @@
        printf "%s" '(defconst tla-version "' >> $@
        if [ "x$(RELEASE_ID)" != "x" ]; then \
                printf "%s (%s)" $(RELEASE_ID) \
-               `$(TLA) logs -f -d "@top_srcdir@" | tail -1` >> $@; \
+               `$(TLA) logs -f -d @top_srcdir@ | tail -1` >> $@; \
        else \
-               printf "%s" `$(TLA) logs -f -d "@top_srcdir@" | tail -1` >> $@; 
\
+               printf "%s" `$(TLA) logs -f -d @top_srcdir@ | tail -1` >> $@; \
        fi
        echo '")' >> $@
        echo "(provide 'xtla-version)" >> $@


--- orig/lisp/contrib/ewoc.el
+++ mod/lisp/contrib/ewoc.el
@@ -432,7 +432,7 @@
 If the EWOC is empty, nil is returned."
   (unless pos (setq pos (point)))
   (ewoc--set-buffer-bind-dll-let* ewoc
-      ((footer (ewoc--footer ewoc)))
+      ()
 
     (cond
      ;; Nothing present?


--- orig/lisp/xtla-build.el
+++ mod/lisp/xtla-build.el
@@ -50,16 +50,7 @@
   (autoload 'view-file-other-window "view-less" nil t)
   (autoload 'view-mode "view-less" nil t)
   (autoload 'with-electric-help "ehelp")
-  (defalias 'compute-motion 'ignore)
-  (defalias 'define-key-after 'ignore)
-  (defalias 'easy-menu-create-menu 'ignore)
-  (defalias 'event-basic-type 'ignore)
-  (defalias 'help-setup-xref 'ignore)
-  (defalias 'hl-line-mode 'ignore)
-  (defalias 'smerge-find-conflict 'ignore)
-  (defalias 'smerge-mode 'ignore)
-  (defalias 'tla--mouse-avoidance-point-position 
'mouse-avoidance-point-position)
-  (defalias 'window-edges 'ignore))
+  (defalias 'tla--mouse-avoidance-point-position 
'mouse-avoidance-point-position))
 
-;;; xtlahack.el ends here
+;;; xtla-build.el ends here
 ;; arch-tag: dfc914ba-8da6-470b-995b-03b09cd66592


--- orig/lisp/xtla-core.el
+++ mod/lisp/xtla-core.el
@@ -188,7 +188,6 @@
   ;; Inspired from `cvs-get-buffer-create'
   (let* ((path (or path default-directory))
          (elem (assoc type tla--buffer-type-alist))
-         (name (cadr elem))
          (mode (caddr elem)))
     (or (tla--get-buffer type path mode)
         ;; Buffer couldn't be reused. Create one
@@ -623,6 +622,14 @@
                               (ewoc-locate tla--log-cookie))))))
     ))
 
+(defvar tla-process-running nil
+  "List of tla processes running.
+A value of nil indicates no processes are running.
+
+The list is a list of pairs (process event) where EVENT is the event
+corresponding to the beginning of the execution of process.  It can be
+used to get more info about the process.")
+
 (defmacro tla--switch-to-buffer-macro (function accessor)
   "Define a FUNCTION for switching to the buffer associated with some event.
 ACCESSOR is a function for retrieving the appropriate buffer from a
@@ -926,14 +933,6 @@
             (unless output-buffer (tla--kill-process-buffer output-buf))
             (unless error-buffer (tla--kill-process-buffer error-buf))))))))
 
-(defvar tla-process-running nil
-  "List of tla processes running.
-A value of nil indicates no processes are running.
-
-The list is a list of pairs (process event) where EVENT is the event
-corresponding to the beginning of the execution of process.  It can be
-used to get more info about the process.")
-
 (defun tla--kill-process-maybe (buffer)
   "Prompts and possibly kill process whose related buffer is BUFFER."
   (let ((process-list nil))
@@ -1480,29 +1479,31 @@
   "Install the buffer menu."
   (if (featurep 'xemacs)
       ;; See tla-xemacs-buffers-menu in xtla-xemacs.el
-      (add-submenu nil '("Tla-Buffers" :filter tla-xemacs-buffers-menu) nil)
+      (tla--do-in-xemacs
+       (add-submenu nil '("Tla-Buffers" :filter tla-xemacs-buffers-menu) nil))
     ;; GNU Emacs
-    (let ((xtla-menu (or (lookup-key global-map [menu-bar tools xtla])
-                         (lookup-key global-map [menu-bar tools Xtla]))))
-      (when (and xtla-menu (not (integerp xtla-menu)))
-        (define-key-after
-          xtla-menu
-          [tla-buffers]
-          (cons "Tla-Buffers" (tla--buffers-menu)))))
-    (let ((map (and
-                (current-local-map)
-                (or (lookup-key (current-local-map) [menu-bar])
-                    (define-key (current-local-map) [menu-bar]
-                      (make-keymap))))))
-      (when map
-        (apply (if (functionp 'define-key-after)
-                   'define-key-after
-                 'define-key)
-               map
-               [tla-buffers]
-               (cons "Tla-Buffers" (tla--buffers-menu))
-               nil)))
-    (add-hook 'menu-bar-update-hook 'tla--install-buffer-menu nil t)))
+    (tla--do-in-gnu-emacs
+      (let ((xtla-menu (or (lookup-key global-map [menu-bar tools xtla])
+                          (lookup-key global-map [menu-bar tools Xtla]))))
+       (when (and xtla-menu (not (integerp xtla-menu)))
+         (define-key-after
+           xtla-menu
+           [tla-buffers]
+           (cons "Tla-Buffers" (tla--buffers-menu)))))
+      (let ((map (and
+                 (current-local-map)
+                 (or (lookup-key (current-local-map) [menu-bar])
+                     (define-key (current-local-map) [menu-bar]
+                       (make-keymap))))))
+       (when map
+         (apply (if (functionp 'define-key-after)
+                    'define-key-after
+                  'define-key)
+                map
+                [tla-buffers]
+                (cons "Tla-Buffers" (tla--buffers-menu))
+                nil)))
+      (add-hook 'menu-bar-update-hook 'tla--install-buffer-menu nil t))))
 
 ;; TODO: Use tla--archive-tree.
 (defun tla--version-head (archive category branch version)
@@ -2660,9 +2661,9 @@
 (defsubst tla--mouse-event-p (event)
   "Return true if EVENT is a mouse-related event."
   (if (featurep 'xemacs)
-      (button-event-p event)
-    (string-match "mouse" (format "%S" (event-basic-type event)))
-    ))
+      (tla--do-in-xemacs (button-event-p event))
+    (tla--do-in-gnu-emacs
+      (string-match "mouse" (format "%S" (event-basic-type event))))))
 
 ;; ----------------------------------------------------------------------------
 ;; Face manipulators


--- orig/lisp/xtla-defs.el
+++ mod/lisp/xtla-defs.el
@@ -55,6 +55,53 @@
 (eval-and-compile
   (require 'easymenu))
 
+;; Macros to generate correct code for different emacs variants
+;; This doesn't really belong here, but then again it doesn't "fit"
+;; anywhere else.
+;;;###autoload
+(defmacro tla--do-in-gnu-emacs (&rest body)
+  "Execute BODY if in GNU/Emacs."
+  (unless running-xemacs `(progn ,@body)))
+(put 'tla--do-in-gnu-emacs 'lisp-indent-hook 'defun)
+
+;;;###autoload
+(defmacro tla--do-in-xemacs (&rest body)
+  "Execute BODY if in XEmacs."
+  (when running-xemacs `(progn ,@body)))
+(put 'tla--do-in-xemacs 'lisp-indent-hook 'defun)
+
+(defmacro tla--funcall-if-exists (function &rest args)
+  "Call FUNCTION with ARGS as parameters if it exists."
+  (if (fboundp function)
+      `(funcall ',function ,@args)))
+
+(unless (functionp 'clone-process)
+  (defun clone-process (process &optional newname)
+    "Create a twin copy of PROCESS.
+If NEWNAME is nil, it defaults to PROCESS' name;
+NEWNAME is modified by adding or incrementing <N> at the end as necessary.
+If PROCESS is associated with a buffer, the new process will be associated
+  with the current buffer instead.
+Returns nil if PROCESS has already terminated."
+    (setq newname (or newname (process-name process)))
+    (if (string-match "<[0-9]+>\\'" newname)
+        (setq newname (substring newname 0 (match-beginning 0))))
+    (when (memq (process-status process) '(run stop open))
+      (let* ((process-connection-type (process-tty-name process))
+             (old-kwoq (process-kill-without-query process nil))
+             (new-process
+              (if (memq (process-status process) '(open))
+                  (apply 'open-network-stream newname
+                         (if (process-buffer process) (current-buffer)))
+                (apply 'start-process newname
+                       (if (process-buffer process) (current-buffer))
+                       (process-command process)))))
+        (process-kill-without-query new-process old-kwoq)
+        (process-kill-without-query process old-kwoq)
+        (set-process-filter new-process (process-filter process))
+        (set-process-sentinel new-process (process-sentinel process))
+        new-process))))
+
 ;; ----------------------------------------------------------------------------
 ;; Key bindings
 ;; ----------------------------------------------------------------------------
@@ -1115,12 +1162,8 @@
 ;;
 ;;;###autoload
 (easy-menu-add-item
- (if (boundp 'menu-bar-tools-menu)
-     menu-bar-tools-menu
-   nil)
- (if (boundp 'menu-bar-tools-menu)
-     nil
-   '("Tools"))
+ (or (tla--do-in-gnu-emacs menu-bar-tools-menu) nil)
+ (or (tla--do-in-xemacs '("Tools")) nil)
  '("Xtla"
    ["Browse Archives" tla-archives t]
    ["Show Bookmarks" tla-bookmarks t]


--- orig/lisp/xtla-xemacs.el
+++ mod/lisp/xtla-xemacs.el
@@ -110,33 +110,6 @@
     (match-string arg string)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(unless (functionp 'clone-process)
-  (defun clone-process (process &optional newname)
-    "Create a twin copy of PROCESS.
-If NEWNAME is nil, it defaults to PROCESS' name;
-NEWNAME is modified by adding or incrementing <N> at the end as necessary.
-If PROCESS is associated with a buffer, the new process will be associated
-  with the current buffer instead.
-Returns nil if PROCESS has already terminated."
-    (setq newname (or newname (process-name process)))
-    (if (string-match "<[0-9]+>\\'" newname)
-        (setq newname (substring newname 0 (match-beginning 0))))
-    (when (memq (process-status process) '(run stop open))
-      (let* ((process-connection-type (process-tty-name process))
-             (old-kwoq (process-kill-without-query process nil))
-             (new-process
-              (if (memq (process-status process) '(open))
-                  (apply 'open-network-stream newname
-                         (if (process-buffer process) (current-buffer)))
-                (apply 'start-process newname
-                       (if (process-buffer process) (current-buffer))
-                       (process-command process)))))
-        (process-kill-without-query new-process old-kwoq)
-        (process-kill-without-query process old-kwoq)
-        (set-process-filter new-process (process-filter process))
-        (set-process-sentinel new-process (process-sentinel process))
-        new-process))))
-
 (unless (functionp 'clone-buffer)
   (defun clone-buffer (&optional newname display-flag)
     "Create a twin copy of the current buffer.


--- orig/lisp/xtla.el
+++ mod/lisp/xtla.el
@@ -139,7 +139,6 @@
   (when (locate-library "hl-line")
     (require 'hl-line)))
 
-
 ;; ----------------------------------------------------------------------------
 ;; Internal variables
 ;; ----------------------------------------------------------------------------
@@ -390,23 +389,24 @@
 (defun tla--mouse-avoidance-point-position (point)
   "Return the position of POINT as (FRAME X . Y).
 Analogous to `mouse-position'.  Copied from avoid.el."
-  (let* ((w (selected-window))
-         (edges (window-edges w))
-         (list
-          (compute-motion (max (window-start w) (point-min)) ; start pos
-                          ;; window-start can be < point-min if the
-                          ;; latter has changed since the last redisplay
-                          '(0 . 0)      ; start XY
-                          point         ; stop pos
-                          (cons (window-width) (window-height)) ; stop XY: none
-                          (1- (window-width)) ; width
-                          (cons (window-hscroll w) 0) ; 0 may not be right?
-                          (selected-window))))
-    ;; compute-motion returns (pos HPOS VPOS prevhpos contin)
-    ;; we want:               (frame hpos . vpos)
-    (cons (selected-frame)
-          (cons (+ (car edges)       (car (cdr list)))
-                (+ (car (cdr edges)) (car (cdr (cdr list))))))))
+  (tla--do-in-gnu-emacs
+    (let* ((w (selected-window))
+          (edges (window-edges w))
+          (list
+           (compute-motion (max (window-start w) (point-min)) ; start pos
+                           ;; window-start can be < point-min if the
+                           ;; latter has changed since the last redisplay
+                           '(0 . 0)    ; start XY
+                           point       ; stop pos
+                           (cons (window-width) (window-height)) ; stop XY: 
none
+                           (1- (window-width)) ; width
+                           (cons (window-hscroll w) 0) ; 0 may not be right?
+                           (selected-window))))
+      ;; compute-motion returns (pos HPOS VPOS prevhpos contin)
+      ;; we want:               (frame hpos . vpos)
+      (cons (selected-frame)
+           (cons (+ (car edges)       (car (cdr list)))
+                 (+ (car (cdr edges)) (car (cdr (cdr list)))))))))
 
 (defun tla--generic-popup-menu-by-keyboard (prefix)
   "Popup a menu defined in the text property under the point.
@@ -563,9 +563,9 @@
                           (make-string (max 0 (- 5 (length keys1))) ?\ )
                           (symbol-name func))))))
     (goto-char (point-min))
-    (if (not (featurep 'xemacs))
-        (help-setup-xref (list 'tla-name-read-help)
-                         (interactive-p))))
+    (tla--funcall-if-exists 
+     help-setup-xref (list 'tla-name-read-help)
+     (interactive-p)))
   (display-buffer (current-buffer))
   (toggle-read-only 1))
 
@@ -2321,6 +2321,9 @@
 (defvar tla-mine-string "TREE")
 (defvar tla-his-string "MERGE-SOURCE")
 
+(eval-when-compile
+  (defvar smerge-mode))
+
 ;;;###autoload
 (defun tla-conflicts-finish ()
   "Command to delete .rej file after conflicts resolution.
@@ -2331,11 +2334,11 @@
         (when (and
                (save-excursion
                  (goto-char (point-min))
-                 (smerge-find-conflict))
+                 (tla--funcall-if-exists smerge-find-conflict))
                (not (y-or-n-p (concat "Buffer still has diff3 markers. "
                                       "Delete .rej file anyway? "))))
           (error "Not deleting .rej file"))
-        (smerge-mode -1))
+        (tla--funcall-if-exists smerge-mode -1))
     (when (not (y-or-n-p (concat "Buffer is not in in smerge-mode. "
                                  "Delete .rej file anyway? ")))
       (error "Not deleting .rej file")))
@@ -3725,16 +3728,20 @@
   (set (make-local-variable 'tla-revision-merge-by-computed) t)
   )
 
+(eval-when-compile
+  (defvar tla--merged-rev))
+
 (defun tla--set-merged-patches (rev)
   "Set the \"merged-by\" field for other revisions according to REV.
 
 Adds REV to the list of all patches merged by REV."
   (dolist (merged-rev (tla--revision-merges rev))
+    (setq tla--merged-rev merged-rev)
     (tla--revision-ewoc-map
      `(lambda (rev-to-fill)
         (when (equal (tla--name-construct
                       (tla--revision-revision rev-to-fill))
-                     merged-rev)
+                     tla--merged-rev)
           (setf (tla--revision-merged-by rev-to-fill)
                 (cons ,(tla--name-construct
                         (tla--revision-revision rev))
@@ -5816,24 +5823,24 @@
         (tla-partner-add version))
       version)))
 
+;; FIXME: Currently does nothing in XEmacs.
 (defun tla--partner-create-menu (action &optional prompt)
   "Create the partner menu with ACTION using PROMPT as the menu name."
   (let ((list (tla-partner-list)))
-    (if (featurep 'xemacs)
-        nil;; XEMACS-TODO
-      (easy-menu-create-menu prompt
-                             (mapcar
-                              (lambda (item)
-                                (let ((v (make-vector 3 nil)))
-                                  (aset v 0 item)             ; name
-                                  (aset v 1 `(,action ,item))
-                                  (aset v 2 t)                ; enable
-                                  ;;(aset v 3 :style)
-                                  ;;(aset v 4 'radio)
-                                  ;;(aset v 5 :selected)
-                                  ;;(aset v 6 (if ...))
-                                  v))
-                              list)))))
+    (tla--funcall-if-exists
+     easy-menu-create-menu prompt
+     (mapcar
+      (lambda (item)
+       (let ((v (make-vector 3 nil)))
+         (aset v 0 item)               ; name
+         (aset v 1 `(,action ,item))
+         (aset v 2 t)                  ; enable
+         ;;(aset v 3 :style)
+         ;;(aset v 4 'radio)
+         ;;(aset v 5 :selected)
+         ;;(aset v 6 (if ...))
+         v))
+      list))))
 
 ;; ----------------------------------------------------------------------------
 ;; tla-inventory-mode:
@@ -8090,28 +8097,15 @@
     (error "No master buffer"))
   (tla-switch-to-buffer tla--changes-buffer-master-buffer))
 
-;; lint trap: avoid byte-compiler warnings
-(eval-when-compile
-  (unless (fboundp 'highline-off)
-    (defun highline-off ()))
-  (unless (fboundp 'highline-on)
-    (defun highline-on ())))
-
 (defun tla--flash-line-on ()
   "Turn on highline mode or equivalent."
-  (cond
-   ((functionp 'hl-line-mode)
-    (hl-line-mode 1))
-   ((functionp 'highline-on)
-    (highline-on))))
+  (or (tla--funcall-if-exists hl-line-mode)
+      (tla--funcall-if-exists highline-on)))
 
 (defun tla--flash-line-off ()
   "Turn off highline mode or equivalent."
-  (cond
-   ((functionp 'hl-line-mode)
-    (hl-line-mode -1))
-   ((functionp 'highline-off)
-    (highline-off))))
+  (or (tla--funcall-if-exists hl-line-mode)
+      (tla--funcall-if-exists highline-off)))
 
 (defun tla--flash-line ()
   "Flash the current line."
@@ -8367,9 +8361,7 @@
 Enter smerge mode if the file has conflicts (detected by the presence
 of a .rej file)."
   (when (tla-file-has-conflict-p (buffer-file-name))
-    (condition-case nil
-        (smerge-mode 1)
-      (error nil)))
+    (tla--funcall-if-exists smerge-mode 1))
   (let (link file result)
     (when (and (if (boundp 'vc-ignore-vc-files)
                    (not vc-ignore-vc-files)




Reply via email to