From 65adcfc3900343d696e84740d53481d447110ac7 Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Wed, 3 Jul 2024 18:44:50 +0200 Subject: Rearrange order of functions, no code changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Müller --- ebuild-mode.el | 61 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/ebuild-mode.el b/ebuild-mode.el index aa63cbc..010d414 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -252,6 +252,37 @@ Returns non-nil if A is less than B by Gentoo keyword ordering." (defvar ebuild-mode-menu) +;;; Compatibility code. + +(eval-when-compile + (unless (fboundp 'static-if) + (defmacro static-if (cond then &rest else) ; from APEL + "Like `if', but evaluate COND at compile time." + (if (eval cond) + then + `(progn ,@else))) + )) + +(defun ebuild-mode-time-string (format-string &optional time) + "Use FORMAT-STRING to format the time value TIME. +Calls `format-time-string' (which see) for the UTC time zone. +Compatibility function for XEmacs." + (if (and (featurep 'xemacs) + (not (function-allows-args #'format-time-string 3))) + ;; format-time-string in older XEmacs versions can take only two + ;; arguments. Version 21.5.35 still doesn't support a time zone + ;; as third argument, but accepts non-nil to mean Universal Time. + (let ((process-environment (copy-sequence process-environment)) + (tz (getenv "TZ"))) + (unwind-protect + (progn + (setenv "TZ" "UTC") + (format-time-string format-string time)) + ;; This is needed because setenv handles TZ specially. + ;; So, restoring the environment is not enough. + (setenv "TZ" tz))) + (format-time-string format-string time t))) + ;;; Font-lock. (eval-when-compile @@ -309,26 +340,6 @@ of the elements." ;;; Mode definitions. -(defun ebuild-mode-time-string (format-string &optional time) - "Use FORMAT-STRING to format the time value TIME. -Calls `format-time-string' (which see) for the UTC time zone. -Compatibility function for XEmacs." - (if (and (featurep 'xemacs) - (not (function-allows-args #'format-time-string 3))) - ;; format-time-string in older XEmacs versions can take only two - ;; arguments. Version 21.5.35 still doesn't support a time zone - ;; as third argument, but accepts non-nil to mean Universal Time. - (let ((process-environment (copy-sequence process-environment)) - (tz (getenv "TZ"))) - (unwind-protect - (progn - (setenv "TZ" "UTC") - (format-time-string format-string time)) - ;; This is needed because setenv handles TZ specially. - ;; So, restoring the environment is not enough. - (setenv "TZ" tz))) - (format-time-string format-string time t))) - (defun ebuild-mode-tabify () "Tabify whitespace at beginning of lines." ;; We cannot use the following since XEmacs doesn't support tabify-regexp. @@ -934,16 +945,6 @@ in a Gentoo profile." ["Insert package.mask tag line" ebuild-mode-insert-tag-line] ["Customize ebuild-mode" (customize-group 'ebuild)])) - -(eval-when-compile - (unless (fboundp 'static-if) - (defmacro static-if (cond then &rest else) ; from APEL - "Like `if', but evaluate COND at compile time." - (if (eval cond) - then - `(progn ,@else))) - )) - (static-if (fboundp 'sh-must-be-shell-mode) ;; make TAB key work (defadvice sh-must-be-shell-mode -- cgit v1.2.3-65-gdbad