emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] phone links...


From: Robert Goldman
Subject: Re: [O] phone links...
Date: Wed, 03 Apr 2013 10:05:57 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

On 4/3/13 Apr 3 -9:52 AM, Michael Strey wrote:
> This gives me the opportunitie to publish my own attempt to implement
> telephone functionality into org.  I'm using Linphone
> (http://www.linphone.org/) instead of Skype.

Thanks!  I am folding the linphone code in to make org-phone more generic.  

Question: why the removal of "(0)"?  For international calls?  Why "(0)" only,
instead of any 0 prefix?

Also, do you ever want to remove it anywhere but as a prefix?  
If so, maybe DELETE is the wrong function call.

Current draft:

;;;---------------------------------------------------------------------------
;;; org-phone.el
;;; Add support for "phone:" links to phone numbers.
;;; Optional support for calling them with skype
;;;---------------------------------------------------------------------------

;;; Copyright (C) 2013 Free Software Foundation, Inc.

;; Author: Robert P. Goldman <rpgoldman at sift dot net>
;; Homepage: http://orgmode.org
;; Version: 0.02

;; This file is not yet part of GNU Emacs.
(require 'org)

(org-add-link-type "phone" 'org-phone-open)
;; not sure whether we need/want this yet...
;;(add-hook 'org-store-link-functions 'org-phone-store-link)

(defcustom org-phone-function 'org-phone-call
  "The Emacs function to be used to call a phone number.
By default, a simple function that uses shell-command to 
apply org-phone-call-command (qv.) to the phone number."
  :group 'org-link
  :type 'symbol)

(defcustom org-phone-call-command "skype-call"
  "The executable command to be used to call a phone number.
This should be a script that starts the call and returns: it
should not block."
  :group 'org-link
  :type 'string)


(defun org-phone-open (phone-number)
  "Phone the number PHONE-NUMBER.
PHONE-NUMBER should be a string for a PSTN phone number."
  (funcall org-phone-function phone-number))

(defun org-phone-call (phone-number)
  (shell-command (format "%s %s"
                         org-phone-call-command
                         phone-number)))
  
(defun trim-phone-number (phone-number)
  "Remove whitespaces from a telephone number"
  (mapconcat 'identity
             (delete "(0)" (split-string phone-number "[ /-]")) ""))
  

;; (defun org-phone-store-link ()
;;   "Store a link to a phone number."
;;     ;; This is a man page, we do make this link
;;     (let* ((page (org-man-get-page-name))
;;         (link (concat "man:" page))
;;         (description (format "Manpage for %s" page)))
;;       (org-store-link-props
;;        :type "man"
;;        :link link
;;        :description description))))


(provide 'org-phone)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]