emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture/remember in Emacs 24.4.1?
@ 2014-10-27  4:59 Benjamin Slade
  2014-10-27  9:27 ` Marco Wahl
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Slade @ 2014-10-27  4:59 UTC (permalink / raw)
  To: emacs-orgmode

I had the following snippets in my .emacs which allowed me to call up a
mini-emacsclient frame to quickly add notes and TODOs etc.  It doesn't
seem to work anymore (it comes up, but as soon as I choose [t], [n]
etc. it disappears).  Is there an updated recommendation on how to do
this?

###################################
(defcustom remember-frame-alist nil
"Additional frame parameters for dedicated remember frame."
:type 'alist
:group 'remember)

(defadvice remember (around remember-frame-parameters activate)
"Set some frame parameters for the remember frame."
(let ((default-frame-alist (append remember-frame-alist default-frame-alist)))
ad-do-it))

;;;

(defun make-remember-frame ()
  "turn the current frame into a small popup frame for remember mode;
 this is meant to be called with 
      emacsclient -c -e '(make-remember-frame)'"
  (modify-frame-parameters nil
			   '( (name . "*Remember*") ;; must be same as in mode-hook below  
			      (width .  80)
			      (height . 20)
			      (vertical-scroll-bars . nil)
			      (menu-bar-lines . nil)
			      (tool-bar-lines . nil)))
  (set-frame-parameter (selected-frame) 'alpha '(85 50))
  (org-capture)
  (when (fboundp 'x-focus-frame) (x-focus-frame nil)) ;; X only....
  (delete-other-windows)
  ) 

;; when we're in such a remember-frame, close it when done. (doesn't work when cancelled...)
(add-hook 'org-capture-mode-hook
	  (lambda()
	    (define-key org-capture-mode-map (kbd "C-c C-c")
	      '(lambda()(interactive)
		 (let ((capture-frame-p 
			(string= (frame-parameter nil 'name) "*Remember*")))
		   (when capture-frame-p (make-frame-invisible))  ;; hide quickly
		   (org-capture-finalize)
		   (when capture-frame-p (delete-frame)))))))


(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/Documents/Org/ToDo.org" "Captured Tasks")
	 "* TODO %?\n  %i\n  %a")
        ("n" "Notes" entry (file+headline "~/Documents/Org/Notes.org" "Captured Notes")
	 "* %?\nEntered on %U\n  %i\n  %a")
	("m" "Meetings" entry (file "~/Documents/Org/Meetings.org" )
	 "* %?\n %i\n  %a")
	("c" "Clipboard" entry (file+headline "~/Documents/Org/Notes.org" "Captured Notes")
	 "* %x %?\nEntered on %U\n  %i\n  %a")))
######################################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dr Benjamin Slade
pgp fingerprint: 21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{sent by mu4e on Emacs running under GNU/Linux}
(Choose Linux, Choose Freedom)

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

* Re: org-capture/remember in Emacs 24.4.1?
  2014-10-27  4:59 org-capture/remember in Emacs 24.4.1? Benjamin Slade
@ 2014-10-27  9:27 ` Marco Wahl
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Wahl @ 2014-10-27  9:27 UTC (permalink / raw)
  To: emacs-orgmode

Hi Benjamin,

Benjamin Slade <slade@jnanam.net> writes:

> I had the following snippets in my .emacs which allowed me to call up a
> mini-emacsclient frame to quickly add notes and TODOs etc.  It doesn't
> seem to work anymore (it comes up, but as soon as I choose [t], [n]
> etc. it disappears).  Is there an updated recommendation on how to do
> this?
>
> ###################################
> (defcustom remember-frame-alist nil
> "Additional frame parameters for dedicated remember frame."
> :type 'alist
> :group 'remember)
>
> (defadvice remember (around remember-frame-parameters activate)
> "Set some frame parameters for the remember frame."
> (let ((default-frame-alist (append remember-frame-alist default-frame-alist)))
> ad-do-it))
>
> ;;;
>
> (defun make-remember-frame ()
>   "turn the current frame into a small popup frame for remember mode;
>  this is meant to be called with 
>       emacsclient -c -e '(make-remember-frame)'"
>   (modify-frame-parameters nil
> 			   '( (name . "*Remember*") ;; must be same as in mode-hook below  
> 			      (width .  80)
> 			      (height . 20)
> 			      (vertical-scroll-bars . nil)
> 			      (menu-bar-lines . nil)
> 			      (tool-bar-lines . nil)))
>   (set-frame-parameter (selected-frame) 'alpha '(85 50))
>   (org-capture)
>   (when (fboundp 'x-focus-frame) (x-focus-frame nil)) ;; X only....
>   (delete-other-windows)
>   ) 
>
> ;; when we're in such a remember-frame, close it when done. (doesn't work when cancelled...)
> (add-hook 'org-capture-mode-hook
> 	  (lambda()
> 	    (define-key org-capture-mode-map (kbd "C-c C-c")
> 	      '(lambda()(interactive)
> 		 (let ((capture-frame-p 
> 			(string= (frame-parameter nil 'name) "*Remember*")))
> 		   (when capture-frame-p (make-frame-invisible))  ;; hide quickly
> 		   (org-capture-finalize)
> 		   (when capture-frame-p (delete-frame)))))))
>
>
> (setq org-capture-templates
>       '(("t" "Todo" entry (file+headline "~/Documents/Org/ToDo.org" "Captured Tasks")
> 	 "* TODO %?\n  %i\n  %a")
>         ("n" "Notes" entry (file+headline "~/Documents/Org/Notes.org" "Captured Notes")
> 	 "* %?\nEntered on %U\n  %i\n  %a")
> 	("m" "Meetings" entry (file "~/Documents/Org/Meetings.org" )
> 	 "* %?\n %i\n  %a")
> 	("c" "Clipboard" entry (file+headline "~/Documents/Org/Notes.org" "Captured Notes")
> 	 "* %x %?\nEntered on %U\n  %i\n  %a")))

Your code works for me (Emacs 25 with a current Org from the git
repo).

Just guessing: Do you have installed a further hook for deleting frames
in certain situations which might be the wrongdoer?


HTH,  Marco
-- 
http://www.wahlzone.de
GPG: 0x0A3AE6F2

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

end of thread, other threads:[~2014-10-27  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-27  4:59 org-capture/remember in Emacs 24.4.1? Benjamin Slade
2014-10-27  9:27 ` Marco Wahl

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).