* Determine if emacs or emacsclient was run with filename(s) as commandline argument.
@ 2013-05-10 20:40 Constantin Kulikov
2013-05-12 7:26 ` Bernardo
0 siblings, 1 reply; 4+ messages in thread
From: Constantin Kulikov @ 2013-05-10 20:40 UTC (permalink / raw)
To: help-gnu-emacs
Is there a way to know if emacs was run with filename argument?
Example:
emacsclinet -c "/some/path/some_file"
It'l create new emacs frame and open 'some_file'. Can I somehow determine
or detect opening files from commandline?
I tried setting up `before-make-frame-hook', `after-make-frame-functions'
and `find-file-hook' and I discovered that find-file-hook is last hook that
executed so I can't differentiate 'command line file opening' from regular
user action.
Why I need it:
I wrote some elisp code that saves window configuration on frame
destruction and restores it on new frame creation. emacsclient -c is set as
my $EDITOR. I need some way to detect case when some program calls the
$EDITOR with file name as argument because in that case I don't need to
restore window configuration.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Determine if emacs or emacsclient was run with filename(s) as commandline argument.
2013-05-10 20:40 Determine if emacs or emacsclient was run with filename(s) as commandline argument Constantin Kulikov
@ 2013-05-12 7:26 ` Bernardo
[not found] ` <CAFkz2yoey4G0pTbu2f_9kcZTVxNYbnyBr1w=9K77CQA_NcoMkg@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Bernardo @ 2013-05-12 7:26 UTC (permalink / raw)
To: Constantin Kulikov; +Cc: help-gnu-emacs
> Is there a way to know if emacs was run with filename argument?
command-line-args?
,----
| command-line-args is a variable defined in `C source code'.
| Its value is ("~/EmacsTrunk/src/emacs")
|
| Documentation:
| Args passed by shell to Emacs, as a list of strings.
| Many arguments are deleted from the list as they are processed.
`----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Fwd: Determine if emacs or emacsclient was run with filename(s) as commandline argument.
[not found] ` <CAFkz2yoey4G0pTbu2f_9kcZTVxNYbnyBr1w=9K77CQA_NcoMkg@mail.gmail.com>
@ 2013-05-12 7:41 ` Constantin Kulikov
2013-05-12 10:56 ` Constantin Kulikov
0 siblings, 1 reply; 4+ messages in thread
From: Constantin Kulikov @ 2013-05-12 7:41 UTC (permalink / raw)
To: help-gnu-emacs
Looks like it's always `("emacs")' for emacsclient -c file, or it's
processed and set to that value before any of hooks that I can set.
I discovered that before-make-frame-hook and after-make-frame-functions is
triggered before the find-file-hook, but command-line-args is `("emacs")'
in each of this hooks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Determine if emacs or emacsclient was run with filename(s) as commandline argument.
2013-05-12 7:41 ` Fwd: " Constantin Kulikov
@ 2013-05-12 10:56 ` Constantin Kulikov
0 siblings, 0 replies; 4+ messages in thread
From: Constantin Kulikov @ 2013-05-12 10:56 UTC (permalink / raw)
To: help-gnu-emacs
found server-visit-hook, will try use it
On 12 May 2013 11:41, Constantin Kulikov <zxnotdead@gmail.com> wrote:
> Looks like it's always `("emacs")' for emacsclient -c file, or it's
> processed and set to that value before any of hooks that I can set.
> I discovered that before-make-frame-hook and after-make-frame-functions is
> triggered before the find-file-hook, but command-line-args is `("emacs")'
> in each of this hooks.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-12 10:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-10 20:40 Determine if emacs or emacsclient was run with filename(s) as commandline argument Constantin Kulikov
2013-05-12 7:26 ` Bernardo
[not found] ` <CAFkz2yoey4G0pTbu2f_9kcZTVxNYbnyBr1w=9K77CQA_NcoMkg@mail.gmail.com>
2013-05-12 7:41 ` Fwd: " Constantin Kulikov
2013-05-12 10:56 ` Constantin Kulikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).