From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregory@dynapse.com (Gregory J. Grubbs) Subject: Re: Handling phone calls Date: Fri, 13 Nov 2009 12:11:17 -0700 Message-ID: <87ocn6p7e2.fsf@dynapse.com> References: <87tzkhoi45.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N91Yl-0005Rq-IJ for emacs-orgmode@gnu.org; Fri, 13 Nov 2009 14:11:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N91Yg-0005R2-Lt for emacs-orgmode@gnu.org; Fri, 13 Nov 2009 14:11:50 -0500 Received: from [199.232.76.173] (port=44711 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N91Yg-0005Qz-G2 for emacs-orgmode@gnu.org; Fri, 13 Nov 2009 14:11:46 -0500 Received: from lo.gmane.org ([80.91.229.12]:49585) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N91Yf-0006dD-VX for emacs-orgmode@gnu.org; Fri, 13 Nov 2009 14:11:46 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1N91Yc-0002wh-14 for emacs-orgmode@gnu.org; Fri, 13 Nov 2009 20:11:42 +0100 Received: from 72.42.83.192 ([72.42.83.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Nov 2009 20:11:42 +0100 Received: from gregory by 72.42.83.192 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Nov 2009 20:11:42 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bernt Hansen 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 " 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] > | > `---- > > 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---