help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Emacs into focus


From: Richard G Riley
Subject: Re: Emacs into focus
Date: Sun, 10 Aug 2008 00:08:04 +0200
User-agent: Emacs 22.2.1/No Gnus v0.11

Richard G Riley <address@hidden> writes:

> Can someone recommend the best way to have emacs come to the foreground
> on a Linux desktop? I'm trying to get emacsclient wired up properly so I
> can handle mailto URLS from iceweasel (firefox) properly. I have tried:
>
> ,----
> | /usr/bin/emacsclient -e "(progn (raise-frame)(message-mail (substring 
> \"$1\" 7) \"Subject\"  '((\"from\"  \"Richard Riley<address@hidden>\"))))"
> `----
>
> But raise-frame does not seem to work on my Gnome desktop.
>
> Replacing raise-frame with (bring-on-top)
>
> where
>
> ,----
> | (defun bring-on-top()
> |   (interactive)
> |    (x-send-client-message
> |     nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_FULLSCREEN" 1))
> | )
> `----
>
> Does work but removes the WM border from the emacs frame.
>
> Does anyone have a cleaner solution?
>
> regards
>
> r.

In case this helps anyone else:

After digging around this was the best I came up with where (on Debian)
emacs.bash is a symbolic link to /usr/share/emacs/22.2/etc/emacs.bash

,---- gnus-mailto.sh ----
| #!/bin/sh
| wmctrl -a emacs22
| source ~/bin/emacs.bash
| edit --eval "(progn (johnsu01/mailto \"$1\"))" 
`----

and the necessary function to bring up posting styles I borrowed from
John Sullivans tips and added the gnus-alive-p check:

http://journal.wjsullivan.net/185095.html

,----
| (require 'gnus-util)
| 
| (defun johnsu01/mailto (url)
|   "Follow a mailto URL as passed from Iceweasel, prompting for a posting 
style."
|   (unless(gnus-alive-p)
|     (gnus))
| 
|   (message "Url is : %s" url)
| 
|   (let ((gnus-newsgroup-name
|          (completing-read "Use posting style of group: "
|                           gnus-active-hashtb nil
|                           (gnus-read-active-file-p))))
|     (setq url (url-unhex-string url))
|     (browse-url-mail url))
|   ;; message-mail does not do anything with the body argument, so we have to.
|   (if (string-match (regexp-quote "?") url)
|       (let* ((start (match-end 0))
|              (args (url-parse-query-string
|                     (substring url start nil)))
|              (body (cadr (assoc-string "body" args t))))
|         (when body
|           (switch-to-buffer (car (message-buffers)))
|           (save-excursion
|             (message-goto-body)
|             (insert body)))))
|   )
`----

On my debian system edit() does not actually start emacs if its not
already running but I think that might be a bug on my system at the
moment.



reply via email to

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