Re: [O] [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

2015-09-10 Thread Dmitri Makarov
Hello Alan,

If you haven't pushed the patch yet, here is attached an updated
patch, with a correction in the commit message, and a minor correction
in one of the comments.

Regards,

Dmitri


On Thu, Sep 10, 2015 at 11:28 AM, Alan Schmitt
<alan.schm...@polytechnique.org> wrote:
> On 2015-09-09 17:59, Dmitri Makarov <dmaka...@alumni.stanford.edu> writes:
>
>> This is refactored patch that uses org-mac-paste-applescript-links
>
> LGTM (with a tiny caveat that I can fix: the first line of the commit
> message should not end with a dot). Nicolas, can I push this?
>
> Thanks,
>
> Alan
>
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Last week athmospheric CO₂ average (Updated September 6, 2015, Mauna Loa 
> Obs.):
> 377.86 ppm
From c5c378360e1a0a84f465b7cf9da685ea511d5e34 Mon Sep 17 00:00:00 2001
From: Dmitri Makarov <dmaka...@alumni.stanford.edu>
Date: Wed, 9 Sep 2015 17:24:42 +0200
Subject: [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat

* contrib/lisp/org-mac-link.el: Add new link type "acrobat" to grab
  links to documents open in Adobe Acrobat application.
---
 contrib/lisp/org-mac-link.el | 60 +++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index 5e0f891..4e1150e 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -169,6 +169,12 @@
   :group 'org-mac-link
   :type 'boolean)
 
+(defcustom org-mac-grab-Acrobat-app-p t
+  "Add menu option [A]crobat to grab page links from Acrobat.app."
+  :tag "Grab Acrobat.app page links"
+  :group 'org-mac-link
+  :type 'boolean)
+
 (defgroup org-mac-flagged-mail nil
   "Options foring linking to flagged Mail.app messages."
   :tag "Org Mail.app"
@@ -211,7 +217,8 @@ When done, go grab the link, and insert it at point."
("v" "imperator" org-mac-vimperator-insert-frontmost-url 
,org-mac-grab-Firefox+Vimperator-p)
("c" "hrome" org-mac-chrome-insert-frontmost-url 
,org-mac-grab-Chrome-app-p)
("t" "ogether" org-mac-together-insert-selected 
,org-mac-grab-Together-app-p)
-   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)))
+   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)
+   ("A" "crobat" org-mac-acrobat-insert-page 
,org-mac-grab-Acrobat-app-p)))
  (menu-string (make-string 0 ?x))
  input)
 
@@ -543,6 +550,57 @@ The links are of the form ::split::."
   (interactive)
   (insert (org-mac-skim-get-page)))
 
+;; Handle links from Adobe Acrobat Pro.app
+;;
+;; Original code & idea by Christopher Suckling (org-mac-protocol)
+;;
+;; The URI format is path_to_pdf_file::page_number
+
+(org-add-link-type "acrobat" 'org-mac-acrobat-open)
+
+(defun org-mac-acrobat-open (uri)
+  "Visit page of pdf in Acrobat"
+  (let* ((page (when (string-match "::\\(.+\\)\\'" uri)
+ (match-string 1 uri)))
+ (document (substring uri 0 (match-beginning 0
+(do-applescript
+ (concat
+  "tell application \"Adobe Acrobat Pro\"\n"
+  "  activate\n"
+  "  set theDoc to \"" document "\"\n"
+  "  set thePage to " page "\n"
+  "  open theDoc\n"
+  "  tell PDF Window 1\n"
+  "goto page thePage\n"
+  "  end tell\n"
+  "end tell"
+
+;; The applescript returns link in the format
+;; "adobe:path_to_pdf_file::page_number::split::document_title, p.page_label"
+
+(defun as-get-acrobat-page-link ()
+  (do-applescript
+   (concat
+"tell application \"Adobe Acrobat Pro\"\n"
+"  set theDoc to active doc\n"
+"  set theWindow to (PDF Window 1 of theDoc)\n"
+"  set thePath to (file alias of theDoc)\n"
+"  set theTitle to (name of theWindow)\n"
+"  set thePage to (page number of theWindow)\n"
+"  set theLabel to (label text of (page thePage of theWindow))\n"
+"end tell\n"
+"set theResult to \"acrobat:\" & thePath & \"::\" & thePage & 
\"::split::\" & theTitle & \", p.\" & theLabel\n"
+"return theResult as string\n")))
+
+(defun org-mac-acrobat-get-page ()
+  (interactive)
+  (message "Applescript: Getting Acrobat page link...")
+  (org-mac-paste-applescript-links (as-get-acrobat-page-link)))
+
+(defun org-mac-acrobat-insert-page ()
+  (interactive)
+  (insert (org-mac-acrobat-get-page)))
+
 
 ;; Handle links from Microsoft Outlook.app
 
-- 
2.5.1



Re: [O] [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

2015-09-10 Thread Dmitri Makarov
Attached is the patch with requested corrections. I hope now this
small patch is sufficiently well commented.

Regards,

Dmitri


On Thu, Sep 10, 2015 at 11:57 AM, Nicolas Goaziou
<m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Dmitri Makarov <dmaka...@alumni.stanford.edu> writes:
>
>> If you haven't pushed the patch yet, here is attached an updated
>> patch, with a correction in the commit message, and a minor correction
>> in one of the comments.
>
> Thank you. Some comments follow.
>
>> > On Thu, Sep 10, 2015 at 11:28 AM, Alan Schmitt 
>> > <alan.schm...@polytechnique.org> wrote:
>
>>> LGTM (with a tiny caveat that I can fix: the first line of the commit
>>> message should not end with a dot). Nicolas, can I push this?
>
> Sure. However, it would be nice to fix the two minor issues below.
>
>> From: Dmitri Makarov <dmaka...@alumni.stanford.edu>
>> Date: Wed, 9 Sep 2015 17:24:42 +0200
>> Subject: [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat
>>
>> * contrib/lisp/org-mac-link.el: Add new link type "acrobat" to grab
>>   links to documents open in Adobe Acrobat application.
>
> You need to mention new functions and variables in the commit message.
>
>> +(defun as-get-acrobat-page-link ()
>
> Wrong namespace. It should be prefixed with "org-mac-".
>
>
> Regards,
>
> --
> Nicolas Goaziou
From ada3e9afbcadb6020b8e4949b49afc1243f8278d Mon Sep 17 00:00:00 2001
From: Dmitri Makarov <dmaka...@alumni.stanford.edu>
Date: Wed, 9 Sep 2015 17:24:42 +0200
Subject: [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat

Add new link type "acrobat" to grab links to documents open in Adobe
Acrobat application.

* contrib/lisp/org-mac-link.el (org-mac-acrobat-open): Open Adobe
  Acrobat document pointed to by a link.
* contrib/lisp/org-mac-link.el (org-mac-as-get-acrobat-page-link):
  Invoke applescript to generate a link to an open and active Adobe
  Acrobat document.
* contrib/lisp/org-mac-link.el (org-mac-acrobat-get-page,
  org-mac-acrobat-insert-page): methods used when an Adobe Acrobat link
  grab request is issued or a link is clicked in an org document.
* contrib/lisp/org-mac-link.el (org-mac-grab-Acrobat-app-p): predicate
  that enables grabbing Adobe Acrobat links.
---
 contrib/lisp/org-mac-link.el | 60 +++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index 5e0f891..01556f7 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -169,6 +169,12 @@
   :group 'org-mac-link
   :type 'boolean)
 
+(defcustom org-mac-grab-Acrobat-app-p t
+  "Add menu option [A]crobat to grab page links from Acrobat.app."
+  :tag "Grab Acrobat.app page links"
+  :group 'org-mac-link
+  :type 'boolean)
+
 (defgroup org-mac-flagged-mail nil
   "Options foring linking to flagged Mail.app messages."
   :tag "Org Mail.app"
@@ -211,7 +217,8 @@ When done, go grab the link, and insert it at point."
("v" "imperator" org-mac-vimperator-insert-frontmost-url 
,org-mac-grab-Firefox+Vimperator-p)
("c" "hrome" org-mac-chrome-insert-frontmost-url 
,org-mac-grab-Chrome-app-p)
("t" "ogether" org-mac-together-insert-selected 
,org-mac-grab-Together-app-p)
-   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)))
+   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)
+   ("A" "crobat" org-mac-acrobat-insert-page 
,org-mac-grab-Acrobat-app-p)))
  (menu-string (make-string 0 ?x))
  input)
 
@@ -543,6 +550,57 @@ The links are of the form ::split::."
   (interactive)
   (insert (org-mac-skim-get-page)))
 
+;; Handle links from Adobe Acrobat Pro.app
+;;
+;; Original code & idea by Christopher Suckling (org-mac-protocol)
+;;
+;; The URI format is path_to_pdf_file::page_number
+
+(org-add-link-type "acrobat" 'org-mac-acrobat-open)
+
+(defun org-mac-acrobat-open (uri)
+  "Visit page of pdf in Acrobat"
+  (let* ((page (when (string-match "::\\(.+\\)\\'" uri)
+ (match-string 1 uri)))
+ (document (substring uri 0 (match-beginning 0
+(do-applescript
+ (concat
+  "tell application \"Adobe Acrobat Pro\"\n"
+  "  activate\n"
+  "  set theDoc to \"" document "\"\n"
+  "  set thePage to " page "\n"
+  "  open theDoc\n"
+  "  tell PDF Window 1\n"
+  "goto page thePage\n"
+  "  end tell\n"
+  "end te

[O] [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

2015-09-09 Thread Dmitri Makarov
This is my second attempt to submit a patch that enables grabbing
links from Adobe Acrobat Pro.

Regards,

Dmitri
From b9feb9b3ebd618d0fc8e82dc266d62e8252775ed Mon Sep 17 00:00:00 2001
From: Dmitri Makarov <dmaka...@alumni.stanford.edu>
Date: Wed, 24 Jun 2015 12:22:44 +0200
Subject: [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

* contrib/lisp/org-mac-link.el: Add new link type "acrobat" to grab
  links to documents open in Adobe Acrobat application.
---
 contrib/lisp/org-mac-link.el | 72 +++-
 1 file changed, 71 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index c991dfa..119de8f 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -165,6 +165,12 @@
   :group 'org-mac-link
   :type 'boolean)
 
+(defcustom org-mac-grab-Acrobat-app-p t
+  "Add menu option [A]crobat to grab page links from Acrobat.app."
+  :tag "Grab Acrobat.app page links"
+  :group 'org-mac-link
+  :type 'boolean)
+
 (defgroup org-mac-flagged-mail nil
   "Options foring linking to flagged Mail.app messages."
   :tag "Org Mail.app"
@@ -207,7 +213,8 @@ When done, go grab the link, and insert it at point."
("v" "imperator" org-mac-vimperator-insert-frontmost-url 
,org-mac-grab-Firefox+Vimperator-p)
("c" "hrome" org-mac-chrome-insert-frontmost-url 
,org-mac-grab-Chrome-app-p)
("t" "ogether" org-mac-together-insert-selected 
,org-mac-grab-Together-app-p)
-   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)))
+   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)
+   ("A" "crobat" org-mac-acrobat-insert-page 
,org-mac-grab-Acrobat-app-p)))
  (menu-string (make-string 0 ?x))
  input)
 
@@ -571,6 +578,69 @@ The links are of the form ::split::."
   (interactive)
   (insert (org-mac-skim-get-page)))
 
+;; Handle links from Adobe Acrobat Pro.app
+;;
+;; Original code & idea by Christopher Suckling (org-mac-protocol)
+;;
+;; The URI format is path_to_pdf_file::page_number
+
+(org-add-link-type "acrobat" 'org-mac-acrobat-open)
+
+(defun org-mac-acrobat-open (uri)
+  "Visit page of pdf in Acrobat"
+  (let* ((page (when (string-match "::\\(.+\\)\\'" uri)
+ (match-string 1 uri)))
+ (document (substring uri 0 (match-beginning 0
+(do-applescript
+ (concat
+  "tell application \"Adobe Acrobat Pro\"\n"
+  "  activate\n"
+  "  set theDoc to \"" document "\"\n"
+  "  set thePage to " page "\n"
+  "  open theDoc\n"
+  "  tell PDF Window 1\n"
+  "goto page thePage\n"
+  "  end tell\n"
+  "end tell"
+
+;; The applescript returns link in the format
+;; path_to_pdf_file::document_title::page_number::page_label
+
+(defun as-get-acrobat-page-link ()
+  (do-applescript
+   (concat
+"tell application \"Adobe Acrobat Pro\"\n"
+"  set theDoc to active doc\n"
+"  set theWindow to (PDF Window 1 of theDoc)\n"
+"  set thePath to (file alias of theDoc)\n"
+"  set theTitle to (name of theWindow)\n"
+"  set thePage to (page number of theWindow)\n"
+"  set theLabel to (label text of (page thePage of theWindow))\n"
+"end tell\n"
+"set theResult to thePath & \"::\" & theTitle & \"::\" & thePage & \"::\" 
& theLabel\n"
+"return theResult as string\n")))
+
+(defun org-mac-acrobat-get-page ()
+  (interactive)
+  (message "Applescript: Getting Acrobat page link...")
+  (let* ((descriptor (as-get-acrobat-page-link))
+ (components (split-string descriptor "::"))
+ (path (car components))
+ (title (nth 1 components))
+ (page (nth 2 components))
+ (label (nth 3 components))
+ (link (concat "acrobat:" path "::" page))
+ (description (concat title ", p." label))
+ (org-link))
+(when (not (string= link ""))
+  (setq org-link (org-make-link-string link description)))
+(kill-new org-link)
+org-link))
+
+(defun org-mac-acrobat-insert-page ()
+  (interactive)
+  (insert (org-mac-acrobat-get-page)))
+
 
 ;; Handle links from Microsoft Outlook.app
 
-- 
2.5.1



Re: [O] [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

2015-09-09 Thread Dmitri Makarov
This is refactored patch that uses org-mac-paste-applescript-links

Regards,

Dmitri


On Wed, Sep 9, 2015 at 4:11 PM, Alan Schmitt
<alan.schm...@polytechnique.org> wrote:
> Hello,
>
> On 2015-09-09 12:42, Dmitri Makarov <dmaka...@alumni.stanford.edu> writes:
>
>> This is my second attempt to submit a patch that enables grabbing
>> links from Adobe Acrobat Pro.
>
> I do not have Acrobat to test, but I have a small comment.
>
>> +(defun org-mac-acrobat-get-page ()
>> +  (interactive)
>> +  (message "Applescript: Getting Acrobat page link...")
>> +  (let* ((descriptor (as-get-acrobat-page-link))
>> + (components (split-string descriptor "::"))
>> + (path (car components))
>> + (title (nth 1 components))
>> + (page (nth 2 components))
>> + (label (nth 3 components))
>> + (link (concat "acrobat:" path "::" page))
>> + (description (concat title ", p." label))
>> + (org-link))
>> +(when (not (string= link ""))
>> +  (setq org-link (org-make-link-string link description)))
>> +(kill-new org-link)
>> +org-link))
>
> Could you reuse `org-mac-paste-applescript-links' for this? For that,
> you need to add the "acrobat:" and the ", p." bits in the AppleScript
> (as is done for Skim).
>
> Best,
>
> Alan
>
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Last week athmospheric CO₂ average (Updated September 6, 2015, Mauna Loa 
> Obs.):
> 377.86 ppm
From 6d4fbeeda9bbc7a31c6cbd48a45238f8a3efe54f Mon Sep 17 00:00:00 2001
From: Dmitri Makarov <dmaka...@alumni.stanford.edu>
Date: Wed, 9 Sep 2015 17:24:42 +0200
Subject: [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

* contrib/lisp/org-mac-link.el: Add new link type "acrobat" to grab
  links to documents open in Adobe Acrobat application.
---
 contrib/lisp/org-mac-link.el | 60 +++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index 5e0f891..c2fb60e 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -169,6 +169,12 @@
   :group 'org-mac-link
   :type 'boolean)
 
+(defcustom org-mac-grab-Acrobat-app-p t
+  "Add menu option [A]crobat to grab page links from Acrobat.app."
+  :tag "Grab Acrobat.app page links"
+  :group 'org-mac-link
+  :type 'boolean)
+
 (defgroup org-mac-flagged-mail nil
   "Options foring linking to flagged Mail.app messages."
   :tag "Org Mail.app"
@@ -211,7 +217,8 @@ When done, go grab the link, and insert it at point."
("v" "imperator" org-mac-vimperator-insert-frontmost-url 
,org-mac-grab-Firefox+Vimperator-p)
("c" "hrome" org-mac-chrome-insert-frontmost-url 
,org-mac-grab-Chrome-app-p)
("t" "ogether" org-mac-together-insert-selected 
,org-mac-grab-Together-app-p)
-   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)))
+   ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p)
+   ("A" "crobat" org-mac-acrobat-insert-page 
,org-mac-grab-Acrobat-app-p)))
  (menu-string (make-string 0 ?x))
  input)
 
@@ -543,6 +550,57 @@ The links are of the form ::split::."
   (interactive)
   (insert (org-mac-skim-get-page)))
 
+;; Handle links from Adobe Acrobat Pro.app
+;;
+;; Original code & idea by Christopher Suckling (org-mac-protocol)
+;;
+;; The URI format is path_to_pdf_file::page_number
+
+(org-add-link-type "acrobat" 'org-mac-acrobat-open)
+
+(defun org-mac-acrobat-open (uri)
+  "Visit page of pdf in Acrobat"
+  (let* ((page (when (string-match "::\\(.+\\)\\'" uri)
+ (match-string 1 uri)))
+ (document (substring uri 0 (match-beginning 0
+(do-applescript
+ (concat
+  "tell application \"Adobe Acrobat Pro\"\n"
+  "  activate\n"
+  "  set theDoc to \"" document "\"\n"
+  "  set thePage to " page "\n"
+  "  open theDoc\n"
+  "  tell PDF Window 1\n"
+  "goto page thePage\n"
+  "  end tell\n"
+  "end tell"
+
+;; The applescript returns link in the format
+;; path_to_pdf_file::document_title::page_number::page_label
+
+(defun as-get-acrobat-page-link ()
+  (do-applescript
+   (concat
+"tell application \"Adobe Acrobat Pro\"\n"
+"  set theDoc to active doc\n"
+"  set theWindow to (PDF Window 1 of theDoc)\n"
+&qu

Re: [O] Bug: property :CLOCK_MODELINE_TOTAL: today has no effect.

2015-08-16 Thread Dmitri Makarov
 15:55]--[2015-04-27 Mon 16:04] =  0:09
   CLOCK: [2015-04-27 Mon 15:38]--[2015-04-27 Mon 15:41] =  0:03
   CLOCK: [2015-04-27 Mon 15:03]--[2015-04-27 Mon 15:13] =  0:10
   CLOCK: [2015-04-27 Mon 14:39]--[2015-04-27 Mon 14:52] =  0:13
   CLOCK: [2015-04-27 Mon 14:27]--[2015-04-27 Mon 14:29] =  0:02
   CLOCK: [2015-04-27 Mon 13:18]--[2015-04-27 Mon 14:24] =  1:06
   CLOCK: [2015-04-27 Mon 10:35]--[2015-04-27 Mon 10:40] =  0:05
   CLOCK: [2015-04-27 Mon 10:15]--[2015-04-27 Mon 10:34] =  0:19
   CLOCK: [2015-04-27 Mon 08:50]--[2015-04-27 Mon 09:39] =  0:49
   CLOCK: [2015-04-26 Sun 21:12]--[2015-04-26 Sun 21:33] =  0:21
   CLOCK: [2015-04-26 Sun 19:09]--[2015-04-26 Sun 19:38] =  0:29
   CLOCK: [2015-04-26 Sun 17:59]--[2015-04-26 Sun 18:05] =  0:06
   CLOCK: [2015-04-26 Sun 17:06]--[2015-04-26 Sun 17:33] =  0:27
   CLOCK: [2015-04-26 Sun 14:47]--[2015-04-26 Sun 16:54] =  2:07
   CLOCK: [2015-04-26 Sun 14:14]--[2015-04-26 Sun 14:31] =  0:17
   CLOCK: [2015-04-26 Sun 13:22]--[2015-04-26 Sun 13:49] =  0:27
   CLOCK: [2015-04-26 Sun 12:59]--[2015-04-26 Sun 13:05] =  0:06
   CLOCK: [2015-04-26 Sun 11:52]--[2015-04-26 Sun 12:01] =  0:09
   CLOCK: [2015-04-26 Sun 10:38]--[2015-04-26 Sun 10:45] =  0:07
   CLOCK: [2015-04-26 Sun 09:36]--[2015-04-26 Sun 10:08] =  0:32
   CLOCK: [2015-04-26 Sun 08:20]--[2015-04-26 Sun 09:11] =  0:51
   CLOCK: [2015-04-26 Sun 07:51]--[2015-04-26 Sun 08:07] =  0:16
   CLOCK: [2015-04-25 Sat 22:01]--[2015-04-25 Sat 22:50] =  0:49
   CLOCK: [2015-04-25 Sat 20:20]--[2015-04-25 Sat 21:26] =  1:06
   CLOCK: [2015-04-25 Sat 19:56]--[2015-04-25 Sat 20:04] =  0:08
   CLOCK: [2015-04-25 Sat 18:11]--[2015-04-25 Sat 18:19] =  0:08
   CLOCK: [2015-04-25 Sat 16:20]--[2015-04-25 Sat 17:44] =  1:24
   CLOCK: [2015-04-25 Sat 12:23]--[2015-04-25 Sat 14:34] =  2:11
   CLOCK: [2015-04-25 Sat 11:58]--[2015-04-25 Sat 11:59] =  0:01
   CLOCK: [2015-04-25 Sat 10:04]--[2015-04-25 Sat 11:29] =  1:25
   CLOCK: [2015-04-25 Sat 09:32]--[2015-04-25 Sat 09:51] =  0:19
   CLOCK: [2015-04-25 Sat 09:05]--[2015-04-25 Sat 09:17] =  0:12
   CLOCK: [2015-04-24 Fri 21:12]--[2015-04-24 Fri 21:29] =  0:17
   CLOCK: [2015-04-24 Fri 19:38]--[2015-04-24 Fri 20:35] =  0:57
   CLOCK: [2015-04-24 Fri 17:31]--[2015-04-24 Fri 18:35] =  1:04
   CLOCK: [2015-04-24 Fri 16:37]--[2015-04-24 Fri 17:14] =  0:37
   CLOCK: [2015-04-24 Fri 14:29]--[2015-04-24 Fri 16:11] =  1:42
   CLOCK: [2015-04-24 Fri 12:36]--[2015-04-24 Fri 13:54] =  1:18
   CLOCK: [2015-04-24 Fri 08:44]--[2015-04-24 Fri 10:12] =  1:28
   :END:
   :PROPERTIES:
   :CLOCK_MODELINE_TOTAL: today
   :ID:   5715AAB9-600E-483D-ABDB-0EFEA081920C
   :END:
   [2015-04-24 Fri 08:40]
   ok.

Regards,

Dmitri


On Sun, Aug 16, 2015 at 6:10 PM, Kyle Meyer k...@kyleam.com wrote:
 Dmitri Makarov dmak...@gmail.com writes:

 After update to Org-mode version 8.3.1 (8.3.1-16-gf6aa53-elpa) the
 property CLOCK_MODELINE_TOTAL value today has no effect.  The
 modeline timing for a task display the total time for the task, not
 the time since the start of the current day.

 GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.4.0, NS appkit-1348.17
 Version 10.10.4 (Build 14E46)) of 2015-08-12

 I'm unable to reproduce this (using emacs -Q with Org 8.3.1-95-g25b02e
 and Emacs 25.0.50.1) on the following example.

 * h
 :PROPERTIES:
 :CLOCK_MODELINE_TOTAL: today
 :END:
 :LOGBOOK:
 CLOCK: [2015-08-16 Sun 02:53]--[2015-08-16 Sun 08:53] =  6:00
 CLOCK: [2015-08-15 Mon 02:53]--[2015-08-15 Mon 08:53] =  6:00
 :END:

 Running 'C-c C-x C-i' on above reports 6:00 in the modeline.
 s/today/all/ shows 12:00.  Does the above work correctly for you?  If
 so, can you provide a minimal example that doesn't work for you?

 --
 Kyle



[O] Bug: property :CLOCK_MODELINE_TOTAL: today has no effect.

2015-08-16 Thread Dmitri Makarov
After update to Org-mode version 8.3.1 (8.3.1-16-gf6aa53-elpa) the
property CLOCK_MODELINE_TOTAL value today has no effect.  The
modeline timing for a task display the total time for the task, not
the time since the start of the current day.

GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.4.0, NS appkit-1348.17
Version 10.10.4 (Build 14E46)) of 2015-08-12


Regards,

Dmitri



Re: [O] Bug: property :CLOCK_MODELINE_TOTAL: today has no effect.

2015-08-16 Thread Dmitri Makarov
The problem seems to be in the order of :PROPERTIES: v. :LOGBOOK:.  If
I move :PROPERTIES: above :LOGBOOK: block in the file, then the mode
line starts displaying the correct time for the task.  It used to work
before the regardless of the ordering the :PROPERTIES: and :LOGBOOK:
blocks, so I considered it a bug. Also, it's 'org-mode' that put the
blocks in the specific order I have in my file, since I didn't
manually typed the PROPERTIES: and :LOGBOOK: into the file in a
particular order.

Regards,

Dmitri


On Sun, Aug 16, 2015 at 6:10 PM, Kyle Meyer k...@kyleam.com wrote:
 Dmitri Makarov dmak...@gmail.com writes:

 After update to Org-mode version 8.3.1 (8.3.1-16-gf6aa53-elpa) the
 property CLOCK_MODELINE_TOTAL value today has no effect.  The
 modeline timing for a task display the total time for the task, not
 the time since the start of the current day.

 GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.4.0, NS appkit-1348.17
 Version 10.10.4 (Build 14E46)) of 2015-08-12

 I'm unable to reproduce this (using emacs -Q with Org 8.3.1-95-g25b02e
 and Emacs 25.0.50.1) on the following example.

 * h
 :PROPERTIES:
 :CLOCK_MODELINE_TOTAL: today
 :END:
 :LOGBOOK:
 CLOCK: [2015-08-16 Sun 02:53]--[2015-08-16 Sun 08:53] =  6:00
 CLOCK: [2015-08-15 Mon 02:53]--[2015-08-15 Mon 08:53] =  6:00
 :END:

 Running 'C-c C-x C-i' on above reports 6:00 in the modeline.
 s/today/all/ shows 12:00.  Does the above work correctly for you?  If
 so, can you provide a minimal example that doesn't work for you?

 --
 Kyle



[O] [PATCH] org-mac-link.el: Handle links to/from Adobe Acrobat.

2015-06-24 Thread Dmitri Makarov
https://github.com/dmakarov/org-mode/commit/b9feb9b3ebd618d0fc8e82dc266d62e8252775ed

g...@github.com:dmakarov/org-mode.git

* contrib/lisp/org-mac-link.el: Add new link type acrobat to grab
  links to documents open in Adobe Acrobat application.


Regards,

Dmitri



[O] graphviz dot block export and evaluate

2012-09-28 Thread Dmitri Makarov
Hi all,

Has anyone successfully exported and evaluated src blocks with graphviz dot 
code?
I'm trying to export this block

   #+BEGIN_SRC dot :export both
 digraph G {
   A - B
 }
   #+END_SRC

and I'm getting the error

org-babel-exp processing...
executing Dot code block...
file-name-extension: Wrong type argument: stringp, nil

How do you debug such problems?

Regards,

Dmitri




Re: [O] graphviz dot block export and evaluate

2012-09-28 Thread Dmitri Makarov
Hi Tom and Bastien,

Thank you, your answers helped a lot.
My fault that I used export not exports and that I didn't read the section 
Specific header arguments in the Org manual.

Thanks!

Dmitri

On Sep 28, 2012, at 7:14 PM, t...@tsdye.com (Thomas S. Dye) wrote:

 Dmitri Makarov dmak...@gmail.com writes:
 
 Hi all,
 
 Has anyone successfully exported and evaluated src blocks with
 graphviz dot code?
 I'm trying to export this block
 
   #+BEGIN_SRC dot :export both
 digraph G {
   A - B
 }
   #+END_SRC
 
 and I'm getting the error
 
 org-babel-exp processing...
 executing Dot code block...
 file-name-extension: Wrong type argument: stringp, nil
 
 How do you debug such problems?
 
 Regards,
 
 Dmitri
 
 Aloha Dmitri,
 
 Currently, you can debug such problems by looking at the source code of
 ob-dot.el.  Or, by asking the list, as you did.
 
 Your example is lacking a :file header argument.  dot source code blocks
 produce graphics files and babel leaves it to the user to name the
 output file.  The file-name-extension function is looking for the value
 of the :file header argument, so that it can configure the call to dot.
 It is expecting to see a string, but gets nil because the header
 argument is absent.
 
 Also, the correct keyword is :exports, with a final s.
 
 You can find an example of dot code use here:
 http://www.jstatsoft.org/v46/i03
 
 hth,
 Tom
 -- 
 Thomas S. Dye
 http://www.tsdye.com




Re: [O] htmlize doesn't work in --batch mode

2012-09-19 Thread Dmitri Makarov
Hi Bastien

I actually wrote an ant script that controls the off-line publishing.
It's fairly simple, assuming ELPA packages installed in ~/.emacs.d/elpa

Another important thing to note is that font-lock-mode is not enabled by default
in --batch mode.  So I ended up writing an extra .el file that is loaded
specifically for off-line publishing.

I'll paste here the relevant fragments to share in case somebody wants to do
something similar

Here are fragments of org.el loaded by emacs --batch command:

(defun common-hook-actions ()
  Peform actions common for all programming language modes
  (font-lock-mode 1)
  ;; a series of set-face-attribute commands to define the
  ;; fontification for SRC blocks
  (set-face-attribute 'font-lock-builtin-face nil
  :slant 'normal
  :weight 'normal
  :underline nil
  :foreground #FF)
  ;; more of the same
)

(add-hook 'c-mode-hook
  (lambda ()
(common-hook-actions)))

;; more mode-hooks can be added

(setq org-publish-timestamp-directory ../.org-timestamps/)
;; at this point I have (setq org-publish-project-alist
;; for the projects we need to publish

And this is a fragment of my build.xml:

  target name=find-htmlize
  description=Find the latest installation of emacs htmlize package
property environment=env/
exec executable=find
  outputproperty=find-output
  resultproperty=find-result
  arg value=${env.HOME}/.emacs.d/elpa/
  arg value=-type/
  arg value=d/
  arg value=-name/
  arg value=htmlize*/
  redirector
outputfilterchain
  tailfilter lines=1/
/outputfilterchain
  /redirector
/exec
condition property=htmlize
   value=${find-output}
   else=htmlize
  available file=${find-output} type=dir/
/condition
  /target

  target name=publish
  depends=find-htmlize
  description=Generate HTML and save into web directory on the local 
disk
condition property=emacs
   value=/usr/local/bin/emacs
   else=emacs
  available file=/usr/local/bin/emacs/
/condition
exec executable=${emacs} dir=org failonerror=true
  arg value=--batch/
  arg value=-l/
  arg value=org.el/
  arg value=--eval/
  arg value=(progn (add-to-list 'load-path quot;${htmlize}quot;) 
(load-library quot;htmlizequot;))/
  arg value=-f/
  arg value=org-publish-all/
/exec
  /target

All of the above creates completely autonomous publishing project. We actually
use it collaboratively, so other people can checkout the repository, edit org
files, build html (or pdf) from the org project and publish updated content on
the web-server without having to modify their ~/.emacs (or ~/.emacs.d/init.el)
files.  Everything is done with two simple shell commands invoking ant.

I hope somebody will find this useful.

Regards,

Dmitri

On Sep 19, 2012, at 7:03 PM, Bastien b...@altern.org wrote:

 Hi Dmitri,
 
 Dmitri Makarov dmak...@gmail.com writes:
 
 If anyone interested, it's easy to explicitly load the required ELPA
 packages in batch mode.  For example, the following command loads htmlize
 for publishing org files in batch mode
 
 emacs --batch -l ~/.emacs.d/init.el --eval (progn (add-to-list 'load-path
 \~/.emacs.d/elpa/htmlize-20120616.1716\) (require 'htmlize)) -f
 org-publish-all
 
 It should be easy to include such a command in a makefile or build.xml and
 automatically locate the latest installation of necessary packages rather
 than explicitly specifying the path.
 
 I let Achim be the final judge on this -- my intuitions in this areas
 are just too fragile.  But my gut feeling is that this would be too
 complicated, and the solution above is simple enough.
 
 Still I wonder why ELPA packages are not loaded by default in --batch
 mode even though (package-initialize) is being evaluated.
 
 Please ask this on the emacs-devel mailing list, I'm sure this will help
 many other users.  Several users (including me) have been puzzled by the
 way ELPA packages are loaded/initialized in Emacs.
 
 Best,
 
 -- 
 Bastien




[O] htmlize doesn't work in --batch mode

2012-09-14 Thread Dmitri Makarov
If anyone interested, it's easy to explicitly load the required ELPA packages 
in batch mode.  For example, the following command loads htmlize for publishing 
org files in batch mode

emacs --batch -l ~/.emacs.d/init.el --eval (progn (add-to-list 'load-path 
\~/.emacs.d/elpa/htmlize-20120616.1716\) (require 'htmlize)) -f 
org-publish-all

It should be easy to include such a command in a makefile or build.xml and 
automatically locate the latest installation of necessary packages rather than 
explicitly specifying the path.

Still I wonder why ELPA packages are not loaded by default in --batch mode even 
though (package-initialize) is being evaluated.

Regards,

Dmitri




[O] htmlize doesn't work in --batch mode

2012-09-11 Thread Dmitri Makarov
Hi all,

I'm having a problem with offline exports.
If I run emacs in --batch mode like this

emacs -batch -l ~/.emacs.d/init.el -eval '(org-publish-all)'

it doesn't seem to load the packages installed by the ELPA package manager.
In particular it doesn't load htmlize package and also loads the bundled org
version 7.8.11 whereas I have newer version 7.9.1 installed in packages.

Also, it seems for the new version of org to take over the bundled org
package when I run emacs in normal window mode I have to invoke
(require 'org-install) from after-init-hook like this

(add-hook 'after-init-hook
  (lambda ()
(load-file ~/.emacs.d/org.el)))

org.el among other things includes (require 'org-install)

If I place (require 'org-install) directly in my init.el,
emacs loads the org package bundled with the emacs installation,
not the one installed by the package manager, probably because
package-initialize is evaluated after init.el has been loaded.

Is this normal?  Did anyone have the same problem?
My emacs version is GNU Emacs 24.2.1.

I hope my questions make sense, as I don't really have much experience with 
emacs package management, and it seems difficult to describe the problem 
clearly.
I apologize for this is not being an org-mode question, but since many org users
use htmlize, I figure some of them probably want to export their org files
in batch mode, and perhaps they've faced the same issues with packages
in batch mode that I'm having.

Regards,

Dmitri