summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-07-03 18:44:50 +0200
committerUlrich Müller <ulm@gentoo.org>2024-07-03 18:44:50 +0200
commit65adcfc3900343d696e84740d53481d447110ac7 (patch)
tree090932b48dbcce471cc119fc5fdd2f6da07d3eb9
parentReplace nested ifs with cond (diff)
downloadebuild-mode-65adcfc3900343d696e84740d53481d447110ac7.tar.gz
ebuild-mode-65adcfc3900343d696e84740d53481d447110ac7.tar.bz2
ebuild-mode-65adcfc3900343d696e84740d53481d447110ac7.zip
Rearrange order of functions, no code changes
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ebuild-mode.el61
1 files 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