emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Handling phone calls
@ 2008-02-09 22:55 Bernt Hansen
  2008-02-10  7:42 ` Carsten Dominik
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bernt Hansen @ 2008-02-09 22:55 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I spent some time today tuning my org setup for handling incoming phone
calls.  As a contractor I need to clock time spent talking to customers
for billing purposes.  I used to (before this morning) use tags for
phone calls and I had a list of ONGOING tasks with :@phone: as a tag
but this wasn't very convenient to use.

Today I spent some time reviewing the remember documentation and I came
up with the following setup.  I thought I'd share it in case anyone else
finds it useful.

---

I have multiple clients and one org file per client.  Here is a sample
layout:

  - todo.org        - my personal tasks
  - client1.org     - tasks for client 1
  - otherclient.org - tasks for client 2
  - norang.org      - tasks for my company

When I need to create a new task I have the following
remember templates set up:

,----[ .emacs remember setup ]
| (custom-set-variables
|  '(org-remember-store-without-prompt t)
|  '(org-remember-templates
|    (quote (("todo" ?t "* TODO %?\n  %u" "~/org/todo.org" "Tasks")
| 	   ("client1" ?c "* TODO %?\n  %u" "~/org/client1.org" "Tasks")
| 	   ("otherclient" ?o "* TODO %?\n  %u" "~/org/otherclient.org" "Tasks")
| 	   ("norang" ?n "* TODO %?\n  %u" "~/org/norang.org" "Tasks"))))
|  '(remember-annotation-functions (quote (org-remember-annotation)))
|  '(remember-handler-functions (quote (org-remember-handler))))
`----

To create a new task I just hit C-M-r and enter the appropriate template
and fill in the task details.

I set up a second set of templates for phone calls:

,----[ .emacs remember functions ]
| (setq my-phone-remember-templates
|       (quote (("client1" ?c "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/client1.org" "Tasks")
| 	      ("otherclient" ?o "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/otherclient.org" "Tasks")
| 	      ("norang" ?n "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/norang.org" "Tasks")
| 	      ("phone call" ?p "* Phone Call - %? - \n  :CLOCK-IN:" "~/org/todo.org" "Tasks"))))
| 
| (global-set-key (kbd "<f9> p") 'my-phone-call)
| 
| (defun my-phone-call ()
|   (interactive)
|   (let ((org-remember-templates my-phone-remember-templates))
|     (bbdb (read-string "Who is calling: ") nil)
|     (other-window 1)
|     (org-remember)))
| 
| (add-hook 'remember-mode-hook 'my-start-clock-if-needed)
| (defun my-start-clock-if-needed ()
|   (save-excursion
|     (goto-char (point-min))
|     (when (re-search-forward ":CLOCK-IN:" nil t)
|        (replace-match "")
|        (org-clock-in))))
| 
| (require 'remember)
| (global-set-key (kbd "C-M-r") 'org-remember)
| (add-hook 'remember-mode-hook 'org-remember-apply-template)
`----

Thanks Carsten for the my-start-clock-if-needed function which I stole
off the org-mode mailing list :)

---

So I'm happily clocking time on some task I'm working on and the phone
rings...  I pick up the phone, find out who I'm talking to and type
f9-p and enter a name at the prompt

Who is calling: Joe User

which looks up the person in my bbdb database and fills in the remember
template then I select the appropriate template for the client org file
I want to create the task in and it fills in something like this:

,----[ Remember buffer entry for phone calls ]
| ## Filing location: Select interactively, default, or last used:
| ##     C-u C-c C-c  to select file and header location interactively.
| ##         C-c C-c  "~/org/norang.org" -> "* Tasks"
| ## C-u C-u C-c C-c  "~/org/client1.org" -> "* Tasks"
| ## To switch templates, use `C-M-r'.  To abort use `C-c C-k'.
| 
| * Phone Call - Joe User - Some Client Company
|   CLOCK: [2008-02-09 Sat 17:36]
|   <cursor is here, Start typing notes right away>
`----

When I'm done with the call C-c C-c stops the clock and files the task
under * Tasks in whatever file I picked using the template above.
C-u C-u C-M-r jumps to the task and I can refile it to the appropriate
spot with C-c C-w.

I'm sure this can be improved upon but it's already a lot better than
what I had before.

Happy organizing!

-Bernt

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

* Re: Handling phone calls
  2008-02-09 22:55 Handling phone calls Bernt Hansen
@ 2008-02-10  7:42 ` Carsten Dominik
  2008-02-10 11:09   ` Bastien
  2008-02-24  1:20 ` Nick Dokos
  2009-11-13 19:11 ` Gregory J. Grubbs
  2 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-02-10  7:42 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 5195 bytes --]

Excellent description, I just made an entry for this in the
new Org-mode FAQ in Worg: http://129.199.80.1/~guerry/worg/org-faq.html
The entry is not yet there as of Sunday, 8:39 CET, so we will now find  
out how
quickly Bastien will update the HTML version.

I think we should do more like this:  Put gmane pointers to
good writeups into the faq, or even directly convert these posts to org
and put them into a faq.  emacs-orgmode@gnu.org is becoming a  
knowledgebase.
This is a corner in parameter space where Worg can really shine:   
Whenever you see
a particularly useful post, head over to worg and greate a link to it.

- Carsten

On Feb 9, 2008, at 11:55 PM, Bernt Hansen wrote:

> Hi all,
>
> I spent some time today tuning my org setup for handling incoming  
> phone
> calls.  As a contractor I need to clock time spent talking to  
> customers
> for billing purposes.  I used to (before this morning) use tags for
> phone calls and I had a list of ONGOING tasks with :@phone: as a tag
> but this wasn't very convenient to use.
>
> Today I spent some time reviewing the remember documentation and I  
> came
> up with the following setup.  I thought I'd share it in case anyone  
> else
> finds it useful.
>
> ---
>
> I have multiple clients and one org file per client.  Here is a sample
> layout:
>
>  - todo.org        - my personal tasks
>  - client1.org     - tasks for client 1
>  - otherclient.org - tasks for client 2
>  - norang.org      - tasks for my company
>
> When I need to create a new task I have the following
> remember templates set up:
>
> ,----[ .emacs remember setup ]
> | (custom-set-variables
> |  '(org-remember-store-without-prompt t)
> |  '(org-remember-templates
> |    (quote (("todo" ?t "* TODO %?\n  %u" "~/org/todo.org" "Tasks")
> | 	   ("client1" ?c "* TODO %?\n  %u" "~/org/client1.org" "Tasks")
> | 	   ("otherclient" ?o "* TODO %?\n  %u" "~/org/otherclient.org"  
> "Tasks")
> | 	   ("norang" ?n "* TODO %?\n  %u" "~/org/norang.org" "Tasks"))))
> |  '(remember-annotation-functions (quote (org-remember-annotation)))
> |  '(remember-handler-functions (quote (org-remember-handler))))
> `----
>
> To create a new task I just hit C-M-r and enter the appropriate  
> template
> and fill in the task details.
>
> I set up a second set of templates for phone calls:
>
> ,----[ .emacs remember functions ]
> | (setq my-phone-remember-templates
> |       (quote (("client1" ?c "* Phone Call - %:name - %:company 
> \n  :CLOCK-IN:%?" "~/org/client1.org" "Tasks")
> | 	      ("otherclient" ?o "* Phone Call - %:name - %:company 
> \n  :CLOCK-IN:%?" "~/org/otherclient.org" "Tasks")
> | 	      ("norang" ?n "* Phone Call - %:name - %:company\n  :CLOCK- 
> IN:%?" "~/org/norang.org" "Tasks")
> | 	      ("phone call" ?p "* Phone Call - %? - \n  :CLOCK-IN:" "~/ 
> org/todo.org" "Tasks"))))
> |
> | (global-set-key (kbd "<f9> p") 'my-phone-call)
> |
> | (defun my-phone-call ()
> |   (interactive)
> |   (let ((org-remember-templates my-phone-remember-templates))
> |     (bbdb (read-string "Who is calling: ") nil)
> |     (other-window 1)
> |     (org-remember)))
> |
> | (add-hook 'remember-mode-hook 'my-start-clock-if-needed)
> | (defun my-start-clock-if-needed ()
> |   (save-excursion
> |     (goto-char (point-min))
> |     (when (re-search-forward ":CLOCK-IN:" nil t)
> |        (replace-match "")
> |        (org-clock-in))))
> |
> | (require 'remember)
> | (global-set-key (kbd "C-M-r") 'org-remember)
> | (add-hook 'remember-mode-hook 'org-remember-apply-template)
> `----
>
> Thanks Carsten for the my-start-clock-if-needed function which I stole
> off the org-mode mailing list :)
>
> ---
>
> So I'm happily clocking time on some task I'm working on and the phone
> rings...  I pick up the phone, find out who I'm talking to and type
> f9-p and enter a name at the prompt
>
> Who is calling: Joe User
>
> which looks up the person in my bbdb database and fills in the  
> remember
> template then I select the appropriate template for the client org  
> file
> I want to create the task in and it fills in something like this:
>
> ,----[ Remember buffer entry for phone calls ]
> | ## Filing location: Select interactively, default, or last used:
> | ##     C-u C-c C-c  to select file and header location  
> interactively.
> | ##         C-c C-c  "~/org/norang.org" -> "* Tasks"
> | ## C-u C-u C-c C-c  "~/org/client1.org" -> "* Tasks"
> | ## To switch templates, use `C-M-r'.  To abort use `C-c C-k'.
> |
> | * Phone Call - Joe User - Some Client Company
> |   CLOCK: [2008-02-09 Sat 17:36]
> |   <cursor is here, Start typing notes right away>
> `----
>
> When I'm done with the call C-c C-c stops the clock and files the task
> under * Tasks in whatever file I picked using the template above.
> C-u C-u C-M-r jumps to the task and I can refile it to the appropriate
> spot with C-c C-w.
>
> I'm sure this can be improved upon but it's already a lot better than
> what I had before.
>
> Happy organizing!
>
> -Bernt
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 6918 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Handling phone calls
  2008-02-10  7:42 ` Carsten Dominik
@ 2008-02-10 11:09   ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2008-02-10 11:09 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

> Excellent description, I just made an entry for this in the
> new Org-mode FAQ in Worg: http://129.199.80.1/~guerry/worg/org-faq.html
> The entry is not yet there as of Sunday, 8:39 CET, so we will now find out how
> quickly Bastien will update the HTML version.

Done.  

Note: the ugly IP-based url will be fixed as soon as the IT guys in my
lab will repair the server - sorry for that.

> I think we should do more like this:  Put gmane pointers to
> good writeups into the faq, or even directly convert these posts to org
> and put them into a faq.  emacs-orgmode@gnu.org is becoming a knowledgebase.
> This is a corner in parameter space where Worg can really shine:  Whenever you
> see
> a particularly useful post, head over to worg and greate a link to it.

I strongly second this! 

-- 
Bastien

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

* Re: Handling phone calls
  2008-02-09 22:55 Handling phone calls Bernt Hansen
  2008-02-10  7:42 ` Carsten Dominik
@ 2008-02-24  1:20 ` Nick Dokos
  2009-11-13 19:11 ` Gregory J. Grubbs
  2 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2008-02-24  1:20 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

I tried to get your phone handling method running on my system, more for
education than for need. I had problems setting it up but I did get an
education !-)

The problem that I had is that when the Remember buffer was set up, the
entry contained the CLOCK-IN marker but no clock was running.  After
some head scratching, I found out that the sequencing seemed to be
wrong:

   my-phone-call() ->
     locally set the org-remember-templates to the special my-phone-remember-templates
     get a name and search bbdb
     call org-remember() ->
       call remember() ->
         run the remember-annotation-functions
         call remember-mode() ->
           run the remember-mode-hook functions

Now the value of remember-mode-hook was 

    (my-start-clock-if-needed org-remember-apply-template)

because of my initialization sequence: I first set up orgmode and
remember and then set up the phone handling: add-hook added
my-start-clock-if-needed to the beginning of the list - but that's
exactly backwards: when the hook is run, my-start-clock-if-needed is run
first, finds no CLOCK-IN marker in the remember buffer and does nothing;
then org-remember-apply-template is run and adds the template to the
remember buffer, CLOCK-IN marker and all.

I fixed the problem by modifying the add-hook invocation to add the
my-start-clock-if-needed function to the end of the hook:

(add-hook 'remember-mode-hook 'my-start-clock-if-needed 'append)

and everything seems to work properly.

I hope the fix and the explanation help anybody who is trying to
set this up.

BTW, thanks very much for posting this! I think this is the kind of
thing that can help org newbies like me get their heads around its
capabilities.  I've been taking baby steps into more capabilities and I
find that the documentation, good as it is, leaves me wondering about
how to use a particular feature (the usual questions that I have seen on
the list start with "what good is such-and-such?", where you can
substitute e.g tags, properties, dynamic blocks, column-view etc in the
question) and conversely, what org feature(s) could I use in order to
solve such-and-such a problem? Part of the problem is of course that org
provides mechanisms and it is up to you to figure out the best way (or
perhaps a good way - or even a bad way!) to get it done. So having
non-trivial, interesting, but simple to implement solutions to problems
such as the one you posed is indeed very welcome.

Regards,
Nick

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

* Re: Handling phone calls
  2008-02-09 22:55 Handling phone calls Bernt Hansen
  2008-02-10  7:42 ` Carsten Dominik
  2008-02-24  1:20 ` Nick Dokos
@ 2009-11-13 19:11 ` Gregory J. Grubbs
  2009-11-13 19:28   ` Bernt Hansen
  2 siblings, 1 reply; 6+ messages in thread
From: Gregory J. Grubbs @ 2009-11-13 19:11 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

[non-phone call comments snipped]
> I set up a second set of templates for phone calls:
>
> ,----[ .emacs remember functions ]
> | (setq my-phone-remember-templates
> |       (quote (("client1" ?c "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/client1.org" "Tasks")
> | 	      ("otherclient" ?o "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/otherclient.org" "Tasks")
> | 	      ("norang" ?n "* Phone Call - %:name - %:company\n  :CLOCK-IN:%?" "~/org/norang.org" "Tasks")
> | 	      ("phone call" ?p "* Phone Call - %? - \n  :CLOCK-IN:" "~/org/todo.org" "Tasks"))))
> | 
> | (global-set-key (kbd "<f9> p") 'my-phone-call)
> | 
> | (defun my-phone-call ()
> |   (interactive)
> |   (let ((org-remember-templates my-phone-remember-templates))
> |     (bbdb (read-string "Who is calling: ") nil)
> |     (other-window 1)
> |     (org-remember)))
> | 
> | (add-hook 'remember-mode-hook 'my-start-clock-if-needed)
> | (defun my-start-clock-if-needed ()
> |   (save-excursion
> |     (goto-char (point-min))
> |     (when (re-search-forward ":CLOCK-IN:" nil t)
> |        (replace-match "")
> |        (org-clock-in))))
> | 
> | (require 'remember)
> | (global-set-key (kbd "C-M-r") 'org-remember)
> | (add-hook 'remember-mode-hook 'org-remember-apply-template)
> `----
>
> Thanks Carsten for the my-start-clock-if-needed function which I stole
> off the org-mode mailing list :)
>
> ---
>
> So I'm happily clocking time on some task I'm working on and the phone
> rings...  I pick up the phone, find out who I'm talking to and type
> f9-p and enter a name at the prompt
>
> Who is calling: Joe User
>
> which looks up the person in my bbdb database and fills in the remember
> template then I select the appropriate template for the client org file
> I want to create the task in and it fills in something like this:
>
> ,----[ Remember buffer entry for phone calls ]
> | ## Filing location: Select interactively, default, or last used:
> | ##     C-u C-c C-c  to select file and header location interactively.
> | ##         C-c C-c  "~/org/norang.org" -> "* Tasks"
> | ## C-u C-u C-c C-c  "~/org/client1.org" -> "* Tasks"
> | ## To switch templates, use `C-M-r'.  To abort use `C-c C-k'.
> | 
> | * Phone Call - Joe User - Some Client Company
> |   CLOCK: [2008-02-09 Sat 17:36]
> |   <cursor is here, Start typing notes right away>
> `----
>
> When I'm done with the call C-c C-c stops the clock and files the task
> under * Tasks in whatever file I picked using the template above.
> C-u C-u C-M-r jumps to the task and I can refile it to the appropriate
> spot with C-c C-w.
>
> I'm sure this can be improved upon but it's already a lot better than
> what I had before.
>
> Happy organizing!
>
> -Bernt

Bernt, I have been happily using your phone call templates and the BBDB
integration.  The one thing that was bugging me was when someone calls
who is not in my BBDB database (quite a high percentage, since I don't
make much use of BBDB).  I wanted the prompt to let me quickly enter any
name, and fill in the BBDB content if it was there.  

My revamped template looks like this: 
--8<---------------cut here---------------start------------->8---
(setq my-phone-remember-templates
      (quote (
      ;; ... client templates deleted ... 
      	      ("phone call" ?p "* Phone Call - %(gjg/bbdb-name) - %(gjg/bbdb-company)  %T\n  :CLOCK-IN:+ %?%&" "~/projects/notes.org" "Phone Calls"))))
--8<---------------cut here---------------end--------------->8---

Rather than using the variables for BBDB, I am using custom functions to
return name and company; those will return values from the BBDB record
if it was found, otherwise the name function returns what I entered
at the prompt, and the company function returns the empty string.

--8<---------------cut here---------------start------------->8---
(defvar gjg/remember-phone-record nil
  "Either BBDB record vector, or person's name as a string, or nil")

(defun my-phone-call ()
  (interactive)
  (let* ((org-remember-templates my-phone-remember-templates)
	 (myname (completing-read "Who is calling: " (bbdb-hashtable) 'bbdb-completion-predicate 'confirm))
	 (my-bbdb-name (if (> (length myname) 0) myname nil)))
    (setq gjg/remember-phone-record 
	  (or (first (bbdb-search (bbdb-records) my-bbdb-name nil nil))
	      myname))
    (other-window 1)
    (org-remember)))

(defun gjg/bbdb-name ()
  "Return full name of saved bbdb record, or empty string - for use in Remember templates"
  (if (and gjg/remember-phone-record (vectorp gjg/remember-phone-record))
      (bbdb-record-name gjg/remember-phone-record)
      (or gjg/remember-phone-record "")))

(defun gjg/bbdb-company ()
  "Return company of saved bbdb record, or empty string - for use in Remember templates"
  (if (and gjg/remember-phone-record (vectorp gjg/remember-phone-record))
      (bbdb-record-company gjg/remember-phone-record)
      ""))
--8<---------------cut here---------------end--------------->8---

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

* Re: Handling phone calls
  2009-11-13 19:11 ` Gregory J. Grubbs
@ 2009-11-13 19:28   ` Bernt Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2009-11-13 19:28 UTC (permalink / raw)
  To: Gregory J. Grubbs; +Cc: emacs-orgmode

gregory@dynapse.com (Gregory J. Grubbs) writes:

> Bernt, I have been happily using your phone call templates and the BBDB
> integration.  The one thing that was bugging me was when someone calls
> who is not in my BBDB database (quite a high percentage, since I don't
> make much use of BBDB).  I wanted the prompt to let me quickly enter any
> name, and fill in the BBDB content if it was there.  
>
> My revamped template looks like this: 
> --8<---------------cut here---------------start------------->8---
> (setq my-phone-remember-templates
>       (quote (
>       ;; ... client templates deleted ... 
>       	      ("phone call" ?p "* Phone Call - %(gjg/bbdb-name) - %(gjg/bbdb-company)  %T\n  :CLOCK-IN:+ %?%&" "~/projects/notes.org" "Phone Calls"))))
> --8<---------------cut here---------------end--------------->8---
>
> Rather than using the variables for BBDB, I am using custom functions to
> return name and company; those will return values from the BBDB record
> if it was found, otherwise the name function returns what I entered
> at the prompt, and the company function returns the empty string.
>
> --8<---------------cut here---------------start------------->8---
> (defvar gjg/remember-phone-record nil
>   "Either BBDB record vector, or person's name as a string, or nil")
>
> (defun my-phone-call ()
>   (interactive)
>   (let* ((org-remember-templates my-phone-remember-templates)
> 	 (myname (completing-read "Who is calling: " (bbdb-hashtable) 'bbdb-completion-predicate 'confirm))
> 	 (my-bbdb-name (if (> (length myname) 0) myname nil)))
>     (setq gjg/remember-phone-record 
> 	  (or (first (bbdb-search (bbdb-records) my-bbdb-name nil nil))
> 	      myname))
>     (other-window 1)
>     (org-remember)))
>
> (defun gjg/bbdb-name ()
>   "Return full name of saved bbdb record, or empty string - for use in Remember templates"
>   (if (and gjg/remember-phone-record (vectorp gjg/remember-phone-record))
>       (bbdb-record-name gjg/remember-phone-record)
>       (or gjg/remember-phone-record "")))
>
> (defun gjg/bbdb-company ()
>   "Return company of saved bbdb record, or empty string - for use in Remember templates"
>   (if (and gjg/remember-phone-record (vectorp gjg/remember-phone-record))
>       (bbdb-record-company gjg/remember-phone-record)
>       ""))
> --8<---------------cut here---------------end--------------->8---

Hi Gregory,

Thanks very much for sharing this.  This looks like a nice improvement
to me.

Thanks for sharing your setup!

Regards,
Bernt

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

end of thread, other threads:[~2009-11-13 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09 22:55 Handling phone calls Bernt Hansen
2008-02-10  7:42 ` Carsten Dominik
2008-02-10 11:09   ` Bastien
2008-02-24  1:20 ` Nick Dokos
2009-11-13 19:11 ` Gregory J. Grubbs
2009-11-13 19:28   ` Bernt Hansen

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