Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 56586:0731f4f165af
(mouse-avoidance-point-position): Use window-inside-edges
and call compute-motion with nil for topos and width to get proper
usable width and height for both window and non-window systems.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 02 Aug 2004 15:19:24 +0000 |
parents | e6932c8dd59b |
children | e9a6cbc8ca5e |
rev | line source |
---|---|
56406 | 1 ;;; mh-gnus.el --- Make MH-E compatible with installed version of Gnus. |
2 | |
3 ;; Copyright (C) 2003 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu> | |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | |
7 ;; Keywords: mail | |
8 ;; See: mh-e.el | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;;; Change Log: | |
30 | |
31 ;;; Code: | |
32 | |
33 (load "mm-decode" t t) ; Non-fatal dependency | |
34 (load "mm-uu" t t) ; Non-fatal dependency | |
35 (load "mailcap" t t) ; Non-fatal dependency | |
36 (load "smiley" t t) ; Non-fatal dependency | |
37 | |
38 (defmacro mh-defun-compat (function arg-list &rest body) | |
39 "This is a macro to define functions which are not defined. | |
40 It is used for Gnus utility functions which were added recently. If FUNCTION | |
41 is not defined then it is defined to have argument list, ARG-LIST and body, | |
42 BODY." | |
43 (let ((defined-p (fboundp function))) | |
44 (unless defined-p | |
45 `(defun ,function ,arg-list ,@body)))) | |
46 (put 'mh-defun-compat 'lisp-indent-function 'defun) | |
47 | |
48 (defmacro mh-defmacro-compat (function arg-list &rest body) | |
49 "This is a macro to define functions which are not defined. | |
50 It is used for Gnus utility functions which were added recently. If FUNCTION | |
51 is not defined then it is defined to have argument list, ARG-LIST and body, | |
52 BODY." | |
53 (let ((defined-p (fboundp function))) | |
54 (unless defined-p | |
55 `(defmacro ,function ,arg-list ,@body)))) | |
56 (put 'mh-defmacro-compat 'lisp-indent-function 'defun) | |
57 | |
58 ;; Copy of original function from gnus-util.el | |
59 (mh-defun-compat gnus-local-map-property (map) | |
60 "Return a list suitable for a text property list specifying keymap MAP." | |
61 (cond (mh-xemacs-flag (list 'keymap map)) | |
62 ((>= emacs-major-version 21) (list 'keymap map)) | |
63 (t (list 'local-map map)))) | |
64 | |
65 ;; Copy of original function from mm-decode.el | |
66 (mh-defun-compat mm-merge-handles (handles1 handles2) | |
67 (append (if (listp (car handles1)) handles1 (list handles1)) | |
68 (if (listp (car handles2)) handles2 (list handles2)))) | |
69 | |
70 ;; Copy of function from mm-decode.el | |
71 (mh-defun-compat mm-set-handle-multipart-parameter (handle parameter value) | |
72 ;; HANDLE could be a CTL. | |
73 (if handle | |
74 (put-text-property 0 (length (car handle)) parameter value | |
75 (car handle)))) | |
76 | |
77 ;; Copy of original macro is in mm-decode.el | |
78 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) | |
79 `(get-text-property 0 ,parameter (car ,handle))) | |
80 | |
81 (mh-do-in-xemacs (defvar default-enable-multibyte-characters)) | |
82 | |
83 ;; Copy of original function in mm-decode.el | |
84 (mh-defun-compat mm-readable-p (handle) | |
85 "Say whether the content of HANDLE is readable." | |
86 (and (< (with-current-buffer (mm-handle-buffer handle) | |
87 (buffer-size)) 10000) | |
88 (mm-with-unibyte-buffer | |
89 (mm-insert-part handle) | |
90 (and (eq (mm-body-7-or-8) '7bit) | |
91 (not (mm-long-lines-p 76)))))) | |
92 | |
93 ;; Copy of original function in mm-bodies.el | |
94 (mh-defun-compat mm-long-lines-p (length) | |
95 "Say whether any of the lines in the buffer is longer than LENGTH." | |
96 (save-excursion | |
97 (goto-char (point-min)) | |
98 (end-of-line) | |
99 (while (and (not (eobp)) | |
100 (not (> (current-column) length))) | |
101 (forward-line 1) | |
102 (end-of-line)) | |
103 (and (> (current-column) length) | |
104 (current-column)))) | |
105 | |
106 (mh-defun-compat mm-keep-viewer-alive-p (handle) | |
107 ;; Released Gnus doesn't keep handles associated with externally displayed | |
108 ;; MIME parts. So this will always return nil. | |
109 nil) | |
110 | |
111 (mh-defun-compat mm-destroy-parts (list) | |
112 "Older emacs don't have this function." | |
113 nil) | |
114 | |
115 ;;; This is mm-save-part from gnus 5.10 since that function in emacs21.2 is | |
116 ;;; buggy (the args to read-file-name are incorrect). When all supported | |
117 ;;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
118 ;;; function and rename calls to mh-mm-save-part to mm-save-part. | |
119 (defun mh-mm-save-part (handle) | |
120 "Write HANDLE to a file." | |
121 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
122 (filename (mail-content-type-get | |
123 (mm-handle-disposition handle) 'filename)) | |
124 file) | |
125 (when filename | |
126 (setq filename (file-name-nondirectory filename))) | |
127 (setq file (read-file-name "Save MIME part to: " | |
128 (or mm-default-directory | |
129 default-directory) | |
130 nil nil (or filename name ""))) | |
131 (setq mm-default-directory (file-name-directory file)) | |
132 (and (or (not (file-exists-p file)) | |
133 (yes-or-no-p (format "File %s already exists; overwrite? " | |
134 file))) | |
135 (mm-save-part-to-file handle file)))) | |
136 | |
137 (provide 'mh-gnus) | |
138 ;;; Local Variables: | |
139 ;;; no-byte-compile: t | |
140 ;;; no-update-autoloads: t | |
141 ;;; End: | |
56409
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
142 |
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
143 ;; arch-tag: 1e3638af-cad3-4c69-8427-bc8eb6e5e4fa |
56406 | 144 ;;; mh-gnus.el ends here |