* running remember with emacsclient - how to get a new frame
@ 2007-09-06 11:09 pete phillips
2007-09-06 12:39 ` Tassilo Horn
2007-09-06 13:08 ` Jason F. McBrayer
0 siblings, 2 replies; 7+ messages in thread
From: pete phillips @ 2007-09-06 11:09 UTC (permalink / raw)
To: emacs-orgmode
Hi
I want to bind a keyboard key to run
/usr/bin/emacsclient.emacs-snapshot -e "(remember)"
so that whatever I am doing I can easily and quickly add a note to my
org file using remember.
However, when I run
/usr/bin/emacsclient.emacs-snapshot -e "(remember)"
from the command line, the prompt comes up in an existing buffer
(usually on another virtual desktop as well!) which I have to go
searching for.
Is there anything I can pass to emacs using emacsclient which will force
it to open up a new frame on my current desktop ? (and preferably close
the frame once I have hit ^C^C)
Pete
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 11:09 running remember with emacsclient - how to get a new frame pete phillips
@ 2007-09-06 12:39 ` Tassilo Horn
2007-09-06 13:08 ` Jason F. McBrayer
1 sibling, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2007-09-06 12:39 UTC (permalink / raw)
To: emacs-orgmode
pete phillips <pete@smtl.co.uk> writes:
Hi Pete,
> Is there anything I can pass to emacs using emacsclient which will force
> it to open up a new frame on my current desktop ? (and preferably close
> the frame once I have hit ^C^C)
I think this should work.
(add-hook 'server-switch-hook 'make-frame)
(add-hook 'server-done-hook 'delete-frame)
Probably you need to `C-x #' in the new frame to close it.
Bye,
Tassilo
--
Fighting patents one by one will never eliminate the danger of software
patents, any more than swatting mosquitoes will eliminate malaria.
(Richard M. Stallman)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 11:09 running remember with emacsclient - how to get a new frame pete phillips
2007-09-06 12:39 ` Tassilo Horn
@ 2007-09-06 13:08 ` Jason F. McBrayer
2007-09-06 14:46 ` pete phillips
2007-09-06 21:30 ` Scott Jaderholm
1 sibling, 2 replies; 7+ messages in thread
From: Jason F. McBrayer @ 2007-09-06 13:08 UTC (permalink / raw)
To: pete phillips; +Cc: emacs-orgmode
pete phillips <pete@smtl.co.uk> writes:
> Hi
>
> I want to bind a keyboard key to run
>
> /usr/bin/emacsclient.emacs-snapshot -e "(remember)"
I define this function in my .emacs:
(defun my-remember nil
(progn (select-frame
(make-frame '((name . "*Remember*") )))
(raise-frame)
(remember)))
And this additional code to close the frame if remember was opened in
its own frame:
(setq remember-all-handler-functions t)
(setq remember-handler-functions
'(org-remember-handler
(lambda nil
(let* ((frame-names-alist (make-frame-names-alist))
(frame (cdr (assoc "*Remember*" frame-names-alist))))
(if frame
(delete-frame frame t))))))
And use a script called 'remember' that runs:
emacsclient -n --eval '(my-remember)'
I've got quite a bit of other code to make emacsclient maximally
desktop-environment-friendly --- emacsclient always opening in new
frames, closing frames killing the associated buffer,
server-done closing the frame, a script to either start emacs or use
emacsclient as needed, running emacs with the initial frame unmapped,
letting you delete all visible frames, and a .desktop file that wraps
the aforementioned script. One of these days I should package it all
up, but it's kind of all over the place.
--
+-----------------------------------------------------------+
| Jason F. McBrayer jmcbray@carcosa.net |
| If someone conquers a thousand times a thousand others in |
| battle, and someone else conquers himself, the latter one |
| is the greatest of all conquerors. --- The Dhammapada |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 13:08 ` Jason F. McBrayer
@ 2007-09-06 14:46 ` pete phillips
2007-09-06 21:30 ` Scott Jaderholm
1 sibling, 0 replies; 7+ messages in thread
From: pete phillips @ 2007-09-06 14:46 UTC (permalink / raw)
To: Jason F. McBrayer; +Cc: emacs-orgmode
>>>>> "Jason" == Jason F McBrayer <jmcbray@carcosa.net> writes:
Jason> I define this function in my .emacs:
Many thanks for that. It works perfectly. I have function key F9 bound
in xbindkeys to run the remember command, and after ^C the frame
disappears. Superb.
Pete
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 13:08 ` Jason F. McBrayer
2007-09-06 14:46 ` pete phillips
@ 2007-09-06 21:30 ` Scott Jaderholm
2007-09-06 22:31 ` John Wiegley
2007-09-07 9:42 ` Jason F. McBrayer
1 sibling, 2 replies; 7+ messages in thread
From: Scott Jaderholm @ 2007-09-06 21:30 UTC (permalink / raw)
To: Jason F. McBrayer; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 379 bytes --]
On 9/6/07, Jason F. McBrayer <jmcbray@carcosa.net> wrote:
> I define this function in my .emacs:
>
> (defun my-remember nil
> (progn (select-frame
> (make-frame '((name . "*Remember*") )))
> (raise-frame)
> (remember)))
>
Jason,
This is great. How would you make it so that the frame displays with
remember as the only window ?
Thank you,
Scott
[-- Attachment #1.2: Type: text/html, Size: 830 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 21:30 ` Scott Jaderholm
@ 2007-09-06 22:31 ` John Wiegley
2007-09-07 9:42 ` Jason F. McBrayer
1 sibling, 0 replies; 7+ messages in thread
From: John Wiegley @ 2007-09-06 22:31 UTC (permalink / raw)
To: emacs-orgmode
"Scott Jaderholm" <jaderholm@gmail.com> writes:
> On 9/6/07, Jason F. McBrayer <jmcbray@carcosa.net> wrote:
>
>> I define this function in my .emacs:
>>
>> (defun my-remember nil
>> (progn (select-frame
>> (make-frame '((name . "*Remember*") )))
>> (raise-frame)
>> (remember)))
>>
>
> Jason,
>
> This is great. How would you make it so that the frame displays with
> remember as the only window ?
I've made changes to remember.el to support this kind of usage. Just replace
the `remember' function in your remember.el file with the following.
John
(defcustom remember-in-new-frame nil
"Non-nil means use a separate frame for capturing remember data."
:type 'boolean
:group 'remember)
;;;###autoload
(defun remember (&optional initial)
"Remember an arbitrary piece of data.
With a prefix, uses the region as INITIAL."
(interactive
(list (when current-prefix-arg
(buffer-substring (point) (mark)))))
(funcall (if remember-in-new-frame
#'frame-configuration-to-register
#'window-configuration-to-register) remember-register)
(let* ((annotation
(if remember-run-all-annotation-functions-flag
(mapconcat 'identity
(delq nil (mapcar 'funcall remember-annotation-functions))
"\n")
(run-hook-with-args-until-success
'remember-annotation-functions)))
(buf (get-buffer-create remember-buffer)))
(run-hooks 'remember-before-remember-hook)
(funcall (if remember-in-new-frame
#'switch-to-buffer-other-frame
#'switch-to-buffer-other-window) buf)
(if remember-in-new-frame
(set-window-dedicated-p
(get-buffer-window (current-buffer) (selected-frame)) t))
(remember-mode)
(when (= (point-max) (point-min))
(when initial (insert initial))
(setq remember-annotation annotation)
(when remember-initial-contents (insert remember-initial-contents))
(when (and (stringp annotation)
(not (equal annotation "")))
(insert "\n\n" annotation))
(setq remember-initial-contents nil)
(goto-char (point-min)))
(message "Use C-c C-c to remember the data.")))
;;;###autoload
(defun remember-other-frame (&optional initial)
(interactive
(list (when current-prefix-arg
(buffer-substring (point) (mark)))))
(let ((remember-in-new-frame t))
(remember initial)))
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: running remember with emacsclient - how to get a new frame
2007-09-06 21:30 ` Scott Jaderholm
2007-09-06 22:31 ` John Wiegley
@ 2007-09-07 9:42 ` Jason F. McBrayer
1 sibling, 0 replies; 7+ messages in thread
From: Jason F. McBrayer @ 2007-09-07 9:42 UTC (permalink / raw)
To: Scott Jaderholm; +Cc: emacs-orgmode
"Scott Jaderholm" <jaderholm@gmail.com> writes:
> This is great. How would you make it so that the frame displays with remember
> as the only window ?
I have this in my .emacs, which I didn't post before as it wasn't
precisely relevant to the question asked:
(add-hook 'remember-mode-hook 'delete-other-windows)
Perhaps not the most elegant solution, since if you're using remember by
hand (not popping it up in a new frame), your window layout won't be
restored after you finish with remember. But it's good enough for me.
--
+-----------------------------------------------------------+
| Jason F. McBrayer jmcbray@carcosa.net |
| If someone conquers a thousand times a thousand others in |
| battle, and someone else conquers himself, the latter one |
| is the greatest of all conquerors. --- The Dhammapada |
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-09-07 9:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-06 11:09 running remember with emacsclient - how to get a new frame pete phillips
2007-09-06 12:39 ` Tassilo Horn
2007-09-06 13:08 ` Jason F. McBrayer
2007-09-06 14:46 ` pete phillips
2007-09-06 21:30 ` Scott Jaderholm
2007-09-06 22:31 ` John Wiegley
2007-09-07 9:42 ` Jason F. McBrayer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).