all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacsclient does not raise frame
@ 2017-12-31 15:33 Rusi
  2018-01-01  4:05 ` Rusi
  0 siblings, 1 reply; 4+ messages in thread
From: Rusi @ 2017-12-31 15:33 UTC (permalink / raw)
  To: help-gnu-emacs

With a lot of jumping through hoops Ive managed to get firefox to
call emacs(client) and save links+description(title)+selection(in firefox; optional) into an org mode capture buffer.

However the call to emacsclient does not raise the frame... At least not consistently

Currently my hack is to write my own shell wrapper to emacsclient doing

wmctrl -c emacs
emacsclient -c $*
wmctrl -a emacs

Is there some other thing I dont know to raise the emacs frame?

Also the -c I am forced to use because without it, if there is not an existing
frame (emacs started in --daemon mode) it does not work


Emacs 25.1.1
Gnome-Unity 


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

* Re: Emacsclient does not raise frame
  2017-12-31 15:33 Emacsclient does not raise frame Rusi
@ 2018-01-01  4:05 ` Rusi
  2018-01-03 11:55   ` Andrew Savonichev
       [not found]   ` <mailman.6761.1514980510.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Rusi @ 2018-01-01  4:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Sunday, December 31, 2017 at 9:03:41 PM UTC+5:30, Rusi wrote:
> With a lot of jumping through hoops Ive managed to get firefox to
> call emacs(client) and save links+description(title)+selection(in firefox; optional) into an org mode capture buffer.
> 
> However the call to emacsclient does not raise the frame... At least not consistently
> 
> Currently my hack is to write my own shell wrapper to emacsclient doing
> 
> wmctrl -c emacs
> emacsclient -c $*
> wmctrl -a emacs
> 
> Is there some other thing I dont know to raise the emacs frame?
> 
> Also the -c I am forced to use because without it, if there is not an existing
> frame (emacs started in --daemon mode) it does not work
> 
> 
> Emacs 25.1.1
> Gnome-Unity

Best Ive come to is this (my wrapper of emacsclient)

#!/bin/bash
if wmctrl -a emacs;  then
    emacsclient -n $*
else
    emacsclient -n -c $*
fi

There really needs to be an emacsclient option for this:
Because currently if
- emacs is started as --daemon
- emacsclient is started without -c

It tries to open non-GUI emacs
So it works if the client is run from a shell
And fails if started from another script (in my case firefox)


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

* Re: Emacsclient does not raise frame
  2018-01-01  4:05 ` Rusi
@ 2018-01-03 11:55   ` Andrew Savonichev
       [not found]   ` <mailman.6761.1514980510.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Savonichev @ 2018-01-03 11:55 UTC (permalink / raw)
  To: Rusi; +Cc: help-gnu-emacs

Hi Rusi,

> Because currently if
> - emacs is started as --daemon
> - emacsclient is started without -c
>
> It tries to open non-GUI emacs

So  your problem is that if no emacs frame is running, emacsclient without '-c'
creates a new terminal frame instead of a new GUI frame?

In this case, I don't know any built-in way to do this without going
into elisp hacking
around `frame-list', `frame-parameters' and `make-frame-on-display'.

> Ive managed to get firefox to call emacs(client) and save
> links+description(title)+selection(in firefox; optional) into an org mode capture buffer.

Can you share the solution for Firefox?

    - Andrew



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

* Re: Emacsclient does not raise frame
       [not found]   ` <mailman.6761.1514980510.27995.help-gnu-emacs@gnu.org>
@ 2018-01-03 12:13     ` Rusi
  0 siblings, 0 replies; 4+ messages in thread
From: Rusi @ 2018-01-03 12:13 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, January 3, 2018 at 5:25:13 PM UTC+5:30, Andrew Savonichev wrote:
> Hi Rusi,
> 
> > Because currently if
> > - emacs is started as --daemon
> > - emacsclient is started without -c
> >
> > It tries to open non-GUI emacs
> 
> So  your problem is that if no emacs frame is running, emacsclient without '-c'
> creates a new terminal frame instead of a new GUI frame?
> 
> In this case, I don't know any built-in way to do this without going
> into elisp hacking
> around `frame-list', `frame-parameters' and `make-frame-on-display'.

Its really just a little bug: Emacs tries to open itself in a terminal even when there is none!

> 
> > Ive managed to get firefox to call emacs(client) and save
> > links+description(title)+selection(in firefox; optional) into an org mode capture buffer.
> 
> Can you share the solution for Firefox?

This is more convoluted than I can describe in short!!

There is this bookmark put into the bookmark toolbar of firefox

javascript:location.href='org-protocol://capture?'+'&url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection());


The receiving template is:

(setq org-capture-templates '(("w" "Web site"
			       item
			       (file+headline "~/org/inbox.org" "Web")
			       "%a\n%i")))


Nevertheless getting org-protocol registered with firefox is one headache
Figuring out when a ".desktop" file is used and when a normal executable is another


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

end of thread, other threads:[~2018-01-03 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-31 15:33 Emacsclient does not raise frame Rusi
2018-01-01  4:05 ` Rusi
2018-01-03 11:55   ` Andrew Savonichev
     [not found]   ` <mailman.6761.1514980510.27995.help-gnu-emacs@gnu.org>
2018-01-03 12:13     ` Rusi

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.