emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: "Gregory J. Grubbs" <gregory@dynapse.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Handling phone calls
Date: Fri, 13 Nov 2009 14:28:50 -0500	[thread overview]
Message-ID: <87skci1ax9.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: 87ocn6p7e2.fsf@dynapse.com

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

      reply	other threads:[~2009-11-13 19:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skci1ax9.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=gregory@dynapse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).