(first 't1)
(last 't2))
(when (consp function)
- (if (eq (car function) 'not)
- (setq function (cadr function)
- first 't2
- last 't1)
- (error "Invalid sort spec: %s" function)))
+ (cond
+ ;; Reversed spec.
+ ((eq (car function) 'not)
+ (setq function (cadr function)
+ first 't2
+ last 't1))
+ ((gnus-functionp function)
+ )
+ (t
+ (error "Invalid sort spec: %s" function))))if
(if (cdr funs)
`(or (,function ,first ,last)
(and (not (,function ,last ,first))
;; Write the buffer.
(write-region (point-min) (point-max) file nil 'quietly))
+(defun gnus-write-buffer-as-binary (file)
+ "Write the current buffer's contents to FILE without code conversion."
+ ;; Make sure the directory exists.
+ (gnus-make-directory (file-name-directory file))
+ ;; Write the buffer.
+ (write-region-as-binary (point-min) (point-max) file nil 'quietly))
+
+(defun gnus-write-buffer-as-coding-system (file coding-system)
+ "Write the current buffer's contents to FILE with code conversion."
+ ;; Make sure the directory exists.
+ (gnus-make-directory (file-name-directory file))
+ ;; Write the buffer.
+ (write-region-as-coding-system
+ (point-min) (point-max) file coding-system nil 'quietly))
+
(defun gnus-delete-file (file)
"Delete FILE if it exists."
(when (file-exists-p file)
(let ((file-buffer (create-file-buffer filename)))
(save-excursion
(set-buffer file-buffer)
- (let ((require-final-newline nil)
- (coding-system-for-write 'binary))
- (gnus-write-buffer filename)))
+ (let ((require-final-newline nil))
+ (gnus-write-buffer-as-binary filename)))
(kill-buffer file-buffer))
(error "Output file does not exist")))
(set-buffer tmpbuf)
;; Decide whether to append to a file or to an Emacs buffer.
(let ((outbuf (get-file-buffer filename)))
(if (not outbuf)
- (let ((buffer-read-only nil)
- (coding-system-for-write 'binary))
+ (let ((buffer-read-only nil))
(save-excursion
(goto-char (point-max))
(forward-char -2)
(insert "\n"))
(insert "\n"))
(goto-char (point-max))
- (append-to-file (point-min) (point-max) filename)))
+ (write-region-as-binary (point-min) (point-max)
+ filename 'append)))
;; File has been visited, in buffer OUTBUF.
(set-buffer outbuf)
(let ((buffer-read-only nil))
(when win
(set-window-start win (or point (point))))))
+(defun gnus-annotation-in-region-p (b e)
+ (if (= b e)
+ (eq (cadr (memq 'gnus-undeletable (text-properties-at b))) t)
+ (text-property-any b e 'gnus-undeletable t)))
+
(provide 'gnus-util)
;;; gnus-util.el ends here