Sync up with Pterodactyl Gnus v0.92.
[elisp/gnus.git-] / lisp / gnus-util.el
index 775cb43..7adedd6 100644 (file)
      (when (gnus-buffer-exists-p buf)
        (kill-buffer buf))))
 
-(static-if (fboundp 'point-at-bol)
-    (fset 'gnus-point-at-bol 'point-at-bol)
-  (static-if (fboundp 'line-beginning-position)
-      (fset 'gnus-point-at-bol 'line-beginning-position)
-    (defun gnus-point-at-bol ()
-      "Return point at the beginning of the line."
-      (let ((p (point)))
-       (beginning-of-line)
-       (prog1
-           (point)
-         (goto-char p))))))
-
-(static-if (fboundp 'point-at-eol)
-    (fset 'gnus-point-at-eol 'point-at-eol)
-  (static-if (fboundp 'line-end-position)
-      (fset 'gnus-point-at-eol 'line-end-position)
-    (defun gnus-point-at-eol ()
-      "Return point at the end of the line."
-      (let ((p (point)))
-       (end-of-line)
-       (prog1
-           (point)
-         (goto-char p))))))
+(static-cond
+ ((fboundp 'point-at-bol)
+  (fset 'gnus-point-at-bol 'point-at-bol))
+ ((fboundp 'line-beginning-position)
+  (fset 'gnus-point-at-bol 'line-beginning-position))
+ (t
+  (defun gnus-point-at-bol ()
+    "Return point at the beginning of the line."
+    (let ((p (point)))
+      (beginning-of-line)
+      (prog1
+         (point)
+       (goto-char p))))
+  ))
+(static-cond
+ ((fboundp 'point-at-eol)
+  (fset 'gnus-point-at-eol 'point-at-eol))
+ ((fboundp 'line-end-position)
+  (fset 'gnus-point-at-eol 'line-end-position))
+ (t
+  (defun gnus-point-at-eol ()
+    "Return point at the end of the line."
+    (let ((p (point)))
+      (end-of-line)
+      (prog1
+         (point)
+       (goto-char p))))
+  ))
 
 (defun gnus-delete-first (elt list)
   "Delete by side effect the first occurrence of ELT as a member of LIST."
@@ -973,6 +978,33 @@ ARG is passed to the first function."
        (throw 'found nil)))
     t))
 
+(static-if (boundp 'MULE)
+    (defun gnus-write-active-file-as-coding-system (coding-system file hashtb)
+      (let ((output-coding-system coding-system))
+       (with-temp-file file
+         (mapatoms
+          (lambda (sym)
+            (when (and sym
+                       (boundp sym)
+                       (symbol-value sym))
+              (insert (format "%s %d %d y\n"
+                              (symbol-name sym) (cdr (symbol-value sym))
+                              (car (symbol-value sym))))))
+          hashtb))))
+  (defun gnus-write-active-file-as-coding-system (coding-system file hashtb)
+    (let ((coding-system-for-write coding-system))
+      (with-temp-file file
+       (mapatoms
+        (lambda (sym)
+          (when (and sym
+                     (boundp sym)
+                     (symbol-value sym))
+            (insert (format "%s %d %d y\n"
+                            (symbol-name sym) (cdr (symbol-value sym))
+                            (car (symbol-value sym))))))
+        hashtb))))
+  )
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here