[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: attaching a file in dired mode

From: Katsumi Yamaoka
Subject: Re: attaching a file in dired mode
Date: Wed, 25 Feb 2009 11:26:12 +0900
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux)

>>>>> Glenn Morris wrote:
> That's probably fine, if the message says something like:
> "You must run Gnus, or customize `gnus-dired-mail-mode', first"

> Or, how about something like changing the default value of
> gnus-dired-mail-mode to something like:

> (if (featurep 'gnus) 'gnus-user-agent
>   'mail-user-agent)

At last I discovered what causes the Gnus logo screen.  That is
the following snippet that has been put in gnus.el:

(eval-when (load)
  (let ((command (format "%s" this-command)))
    (when (string-match "gnus" command)
      (if (string-match "gnus-other-frame" command)
          (gnus-get-buffer-create gnus-group-buffer)

It is evaluated when gnus.elc is being autoloaded.  Note that
what causes that autoloading then is `gnus-dired-attach', of
which the name matches "gnus".  So, how about faking the value
of `this-command'?  The patch is below.  Could you try it?

> emacs -Q
> C-x d
> M-x turn-on-gnus-dired-mode
> mark file
> C-c C-m C-a

This works well for me.  I don't know why I don't observe bug
1060, i.e. ``void-variable gnus-article-reply'', though.  Do you
still get that error?

In addition, `gnus-dired-attach' seems to have been written
before I improved Gnus' `compose-mail' handling.  Now it should
work with `gnus-user-agent' and the `gnus-setup-message' macro
is not necessary.


--- gnus-dired.el~      2009-02-23 10:54:53 +0000
+++ gnus-dired.el       2009-02-25 02:23:18 +0000
@@ -53,7 +53,6 @@
 ;; Autoloads to avoid byte-compiler warnings.  These are used only if the user
 ;; customizes `gnus-dired-mail-mode' to use Message and/or Gnus.
 (autoload 'message-buffers "message")
-(autoload 'gnus-setup-message "gnus-msg" nil nil 'macro)
 (autoload 'gnus-print-buffer "gnus-sum")
 (defvar gnus-dired-mode nil
@@ -162,9 +161,17 @@
                                   nil t)))
        ;; setup a new mail composition buffer
-       (if (eq gnus-dired-mail-mode 'gnus-user-agent)
-           (gnus-setup-message 'message (message-mail))
-         ;; FIXME: Is this the right thing?
+       (let ((mail-user-agent gnus-dired-mail-mode)
+             ;; A workaround to prevent Gnus from displaying the Gnus
+             ;; logo when invoking this command without loading Gnus.
+             ;; Gnus demonstrates it when gnus.elc is being loaded if
+             ;; a command of which the name is prefixed with "gnus"
+             ;; causes that autoloading.  See the code in question,
+             ;; that is the one first found in gnus.el by performing
+             ;; `C-s this-command'.
+             (this-command (if (eq gnus-dired-mail-mode 'gnus-user-agent)
+                               'gnoose-dired-attach
+                             this-command)))
        (setq destination (current-buffer)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]