- (unless (message-in-body-p) (goto-char (point-max)))
- (mml-insert-empty-tag 'part
- 'type type
- ;; icicles redefines read-file-name and returns a
- ;; string w/ text properties :-/
- 'filename (mm-substring-no-properties file)
- 'disposition (or disposition "attachment")
- 'description description))
+ ;; Don't move point if this command is invoked inside the message header.
+ (let ((head (unless (message-in-body-p)
+ (prog1
+ (point)
+ (goto-char (point-max))))))
+ (mml-insert-empty-tag 'part
+ 'type type
+ ;; icicles redefines read-file-name and returns a
+ ;; string w/ text properties :-/
+ 'filename (mm-substring-no-properties file)
+ 'disposition (or disposition "attachment")
+ 'description description)
+ (when head
+ (unless (prog1
+ (pos-visible-in-window-p)
+ (goto-char head))
+ (message "The file \"%s\" has been attached at the end of the message"
+ (file-name-nondirectory file))))))