all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how can tell emacs not to load desktop when invoked by mutt?
@ 2003-04-24  1:04 wang yin
  2003-04-24  1:45 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: wang yin @ 2003-04-24  1:04 UTC (permalink / raw)


Hi,

I set my mutt's editor variable to "emacs -nw" :)
But I use the "desktop package". So every time I reply a mail, emacs
will start over again and load ~/.emacs

I have desktop sessions saved with the desktop package.
And loading the session is slow. I don't want these lines to be
executed from time to time when I reply or compose mail:


(load "desktop") 
(desktop-load-default) 
(desktop-read)


But I'm new to Emacs, and I don't know how to tell emacs it's invoked
by mutt. The hint to emacs, I think it that it's file name is
/tmp/mutt-myloginname-date.

Can anyone give an example how to set a conditional? Thanks!


-- 
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24  1:04 how can tell emacs not to load desktop when invoked by mutt? wang yin
@ 2003-04-24  1:45 ` David Kastrup
  2003-04-24  6:17   ` wang yin
  2003-04-24  7:29   ` Alan Mackenzie
  2003-04-24  9:37 ` Ehud Karni
       [not found] ` <mailman.5147.1051177074.21513.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 13+ messages in thread
From: David Kastrup @ 2003-04-24  1:45 UTC (permalink / raw)


wang yin <wy@wangyin.com> writes:

> I set my mutt's editor variable to "emacs -nw" :)
> But I use the "desktop package". So every time I reply a mail, emacs
> will start over again and load ~/.emacs

You rather want to look up "emacsclient" in th Emacs manual.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24  1:45 ` David Kastrup
@ 2003-04-24  6:17   ` wang yin
  2003-04-24  7:29   ` Alan Mackenzie
  1 sibling, 0 replies; 13+ messages in thread
From: wang yin @ 2003-04-24  6:17 UTC (permalink / raw)


No. emacsclide will send the buffer to a emacs server. But I don't
want to switch to another window.

Or I misunderstood emacsclient?

-- 
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24  1:45 ` David Kastrup
  2003-04-24  6:17   ` wang yin
@ 2003-04-24  7:29   ` Alan Mackenzie
  2003-04-24 11:41     ` Robert Marshall
  1 sibling, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2003-04-24  7:29 UTC (permalink / raw)


David Kastrup <dak@gnu.org> wrote on 24 Apr 2003 03:45:44 +0200:
> wang yin <wy@wangyin.com> writes:

>> I set my mutt's editor variable to "emacs -nw" :)
>> But I use the "desktop package". So every time I reply a mail, emacs
>> will start over again and load ~/.emacs

> You rather want to look up "emacsclient" in th Emacs manual.

That's not to say that "emacs --no-desktop" wouldn't be a useful thing.

Particularly when debugging problems which happen at start-up (which I
was doing last night), or when one wants "just" to edit a quick textfile.

In fact, this ability to start quickly is an excellent reason to use vim
or even notepad.

> -- 
> David Kastrup, Kriemhildstr. 15, 44793 Bochum

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24  1:04 how can tell emacs not to load desktop when invoked by mutt? wang yin
  2003-04-24  1:45 ` David Kastrup
@ 2003-04-24  9:37 ` Ehud Karni
       [not found] ` <mailman.5147.1051177074.21513.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Ehud Karni @ 2003-04-24  9:37 UTC (permalink / raw)
  Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24 Apr 2003 09:04:51 +0800, wang yin <wy@wangyin.com> wrote:
> 
> (load "desktop") 
> (desktop-load-default) 
> (desktop-read)
> 
> Can anyone give an example how to set a conditional? Thanks!

I think the other replies to this post (emacsclient) are good but
there was no direct answer to the question. Here is my proposal:

1. Run the `mutt' command through a script.
2. Add an environment variable MUTT=ON.
3. Wrap your desktop loading in ~/.emcas :
          
    (or (string-equal (or (getenv "MUTT") "-") "ON")
        (progn
           (load "desktop")
           (desktop-load-default)
           (desktop-read)))

Ehud.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+p7BTLFvTvpjqOY0RApzbAJ96hdbdIzYbhdHBK+7NsYZEd32jSACfcSS5
7/CHb0zCsMY0263fBWwbqHk=
=7pHI
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24  7:29   ` Alan Mackenzie
@ 2003-04-24 11:41     ` Robert Marshall
  0 siblings, 0 replies; 13+ messages in thread
From: Robert Marshall @ 2003-04-24 11:41 UTC (permalink / raw)


On Thu, 24 Apr 2003, Alan Mackenzie wrote:

> David Kastrup <dak@gnu.org> wrote on 24 Apr 2003 03:45:44 +0200:
>> wang yin <wy@wangyin.com> writes:
> 
>>> I set my mutt's editor variable to "emacs -nw" :) But I use the
>>> "desktop package". So every time I reply a mail, emacs will start
>>> over again and load ~/.emacs
> 
>> You rather want to look up "emacsclient" in th Emacs manual.
> 
> That's not to say that "emacs --no-desktop" wouldn't be a useful
> thing.
> 

True, I have the following for when I want a fast start and I don't
care what I was looking at last session

      ;; some cheating here ....
  (setq desktop-basefilename
	(convert-standard-filename ".emacs.desktop"))

  (if (and (file-exists-p (concat "~/" desktop-basefilename))
	   (yes-or-no-p "Load desktop? "))
      (progn
	(require 'desktop)
        ....
but that may be too much noise for some!

Robert
-- 
Poetry's not window cleaning.
It breaks the glass.
-- Chase Twichell

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
       [not found] ` <mailman.5147.1051177074.21513.help-gnu-emacs@gnu.org>
@ 2003-04-24 18:36   ` Jiri Pejchal
  2003-04-24 22:09     ` Johan Bockgård
  2003-04-25  4:46   ` wang yin
  1 sibling, 1 reply; 13+ messages in thread
From: Jiri Pejchal @ 2003-04-24 18:36 UTC (permalink / raw)


"Ehud Karni" <ehud@unix.mvs.co.il> writes:

> > Can anyone give an example how to set a conditional? Thanks!
> 
> I think the other replies to this post (emacsclient) are good but
> there was no direct answer to the question. Here is my proposal:
> 
> 1. Run the `mutt' command through a script.
> 2. Add an environment variable MUTT=ON.
> 3. Wrap your desktop loading in ~/.emcas :
>           
>     (or (string-equal (or (getenv "MUTT") "-") "ON")
>         (progn
>            (load "desktop")
>            (desktop-load-default)
>            (desktop-read)))

Can emacs somehow test the command it was invoked with

emacs -nw /tmp/mutt-...

contains the string mutt?

Jiri Pejchal

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-24 18:36   ` Jiri Pejchal
@ 2003-04-24 22:09     ` Johan Bockgård
  0 siblings, 0 replies; 13+ messages in thread
From: Johan Bockgård @ 2003-04-24 22:09 UTC (permalink / raw)


Jiri Pejchal <xpejchal@fi.muni.cz> writes:
>
> Can emacs somehow test the command it was invoked with
>
> emacs -nw /tmp/mutt-...

C-h v command-line-args

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
       [not found] ` <mailman.5147.1051177074.21513.help-gnu-emacs@gnu.org>
  2003-04-24 18:36   ` Jiri Pejchal
@ 2003-04-25  4:46   ` wang yin
  2003-04-26 17:07     ` Glenn Morris
  2003-04-27 11:48     ` Kai Großjohann
  1 sibling, 2 replies; 13+ messages in thread
From: wang yin @ 2003-04-25  4:46 UTC (permalink / raw)


Thank you! This is almost what I want!

Can you tell me how can I use regexp to match the file name that mutt
tell emacs to edit: /tmp/mutt-mylogin-date in elisp?

Then I can use the following elisp(in pseudo-code):

(or (regexp-match ("/tmp/mutt-[^-]+-[0-9-]+", file-name))
        (progn
           (load "desktop")
           (desktop-load-default)
           (desktop-read)))


If I got this done, the problem is solved perfectly :)

So please tell me how to program the predict:
(regexp-match ("/tmp/mutt-[^-]+-[0-9-]+", file-name))


-- 
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-25  4:46   ` wang yin
@ 2003-04-26 17:07     ` Glenn Morris
  2003-04-27 11:48     ` Kai Großjohann
  1 sibling, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2003-04-26 17:07 UTC (permalink / raw)


wang yin wrote:

> Can you tell me how can I use regexp to match the file name that mutt
> tell emacs to edit: /tmp/mutt-mylogin-date in elisp?
>
> Then I can use the following elisp(in pseudo-code):
>
> (or (regexp-match ("/tmp/mutt-[^-]+-[0-9-]+", file-name))
>         (progn
>            (load "desktop")
>            (desktop-load-default)
>            (desktop-read)))

Do you really need to be that precise about the mutt file name?
Surely "/tmp/mutt-" is good enough...

(unless
    (catch 'found
      (dolist (arg command-line-args)
        (if (string-match "^/tmp/mutt-" arg)
            (throw 'found t))))
  (load "desktop")
  (dekstop-load-default)
  (desktop-read))

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-25  4:46   ` wang yin
  2003-04-26 17:07     ` Glenn Morris
@ 2003-04-27 11:48     ` Kai Großjohann
  2003-04-28  2:09       ` Michael Herman
       [not found]       ` <mailman.5267.1051495772.21513.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 13+ messages in thread
From: Kai Großjohann @ 2003-04-27 11:48 UTC (permalink / raw)


wang yin <wy@wangyin.com> writes:

> Then I can use the following elisp(in pseudo-code):
>
> (or (regexp-match ("/tmp/mutt-[^-]+-[0-9-]+", file-name))
>         (progn
>            (load "desktop")
>            (desktop-load-default)
>            (desktop-read)))

How about another approach entirely?  You start Emacs, then say M-x
server-start RET, and you configure mutt to invoke emacsclient
instead of emacs.

-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
  2003-04-27 11:48     ` Kai Großjohann
@ 2003-04-28  2:09       ` Michael Herman
       [not found]       ` <mailman.5267.1051495772.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Herman @ 2003-04-28  2:09 UTC (permalink / raw)


On Sun, Apr 27, 2003 at 01:48:52PM +0200, Kai Großjohann wrote:
>wang yin <wy@wangyin.com> writes:
>
>> Then I can use the following elisp(in pseudo-code):
>>
>> (or (regexp-match ("/tmp/mutt-[^-]+-[0-9-]+", file-name))
>>         (progn
>>            (load "desktop")
>>            (desktop-load-default)
>>            (desktop-read)))
>
>How about another approach entirely?  You start Emacs, then say M-x
>server-start RET, and you configure mutt to invoke emacsclient
>instead of emacs.
>
I've tried that before and the problem is the focus.  I was able to
make emacsclient rise up and take the focus but when finishing the
e-mail and closing the buffer, the focus does not return to the Mutt
window.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how can tell emacs not to load desktop when invoked by mutt?
       [not found]       ` <mailman.5267.1051495772.21513.help-gnu-emacs@gnu.org>
@ 2003-04-28  6:07         ` Kai Großjohann
  0 siblings, 0 replies; 13+ messages in thread
From: Kai Großjohann @ 2003-04-28  6:07 UTC (permalink / raw)


Michael Herman <michael-lists@thehermans.org> writes:

> I've tried that before and the problem is the focus.  I was able to
> make emacsclient rise up and take the focus but when finishing the
> e-mail and closing the buffer, the focus does not return to the Mutt
> window.

Maybe it works if you tell Emacs to open a new frame for each
connection.

You'd want to create the frame from server-switch-hook or
server-visit-hook, and you'd want to delete the frame again from
server-done-hook.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-04-28  6:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-24  1:04 how can tell emacs not to load desktop when invoked by mutt? wang yin
2003-04-24  1:45 ` David Kastrup
2003-04-24  6:17   ` wang yin
2003-04-24  7:29   ` Alan Mackenzie
2003-04-24 11:41     ` Robert Marshall
2003-04-24  9:37 ` Ehud Karni
     [not found] ` <mailman.5147.1051177074.21513.help-gnu-emacs@gnu.org>
2003-04-24 18:36   ` Jiri Pejchal
2003-04-24 22:09     ` Johan Bockgård
2003-04-25  4:46   ` wang yin
2003-04-26 17:07     ` Glenn Morris
2003-04-27 11:48     ` Kai Großjohann
2003-04-28  2:09       ` Michael Herman
     [not found]       ` <mailman.5267.1051495772.21513.help-gnu-emacs@gnu.org>
2003-04-28  6:07         ` Kai Großjohann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.