Re: [PATCH] manual: Fix publish stylesheet

2021-04-18 Thread Erik Hetzner
Oops, noticed a few additional problems. See attached patch.

>From 14de709f224a45cb1beee5b1c1444b1454161891 Mon Sep 17 00:00:00 2001
From: Erik Hetzner 
Date: Sun, 18 Apr 2021 21:47:04 -0700
Subject: [PATCH] manual: Fix publish options

* doc/org-manual.org (Publishing sample configuration):
* doc/org-guide.org (Publishing):
Fix stylesheet setting in publish: :style is not a valid option; use
:html-head instead. :table-of-contents is not a valid option; use
:with-toc instead. :publishing-function is required.
---
 doc/org-guide.org  | 9 +
 doc/org-manual.org | 8 
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/doc/org-guide.org b/doc/org-guide.org
index ea3040bba..3daf8d3c7 100644
--- a/doc/org-guide.org
+++ b/doc/org-guide.org
@@ -2334,12 +2334,13 @@ example:
 (setq org-publish-project-alist
   '(("org"
  :base-directory "~/org/"
+ :publishing-function org-html-publish-to-html
  :publishing-directory "~/public_html"
  :section-numbers nil
- :table-of-contents nil
- :style "")))
+ :with-toc nil
+ :html-head "")))
 #+end_src
 
 - {{{kbd(C-c C-e P x)}}} ::
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 914649f6e..b4eff22ad 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -16324,10 +16324,10 @@ directory on the local machine.
  :publishing-function org-html-publish-to-html
  :publishing-directory "~/public_html"
  :section-numbers nil
- :table-of-contents nil
- :style "")))
+ :with-toc nil
+ :html-head "")))
 #+end_src
 
 *** Example: complex publishing configuration
-- 
2.30.2


On Sun, 18 Apr 2021 21:47:04 -0700,
Erik Hetzner  wrote:
> 
> * doc/org-manual.org (Publishing sample configuration):
> * doc/org-guide.org (Publishing):
> Fix stylesheet setting in publish: :style is not a valid option; use
> :html-head instead.
> ---
> A small fix for the manual which I believe is necessary (:style does not 
> appear to be a valid option any more). My copyright assignment paperwork is 
> on file. Thank you!
> 
>  doc/org-guide.org  | 6 +++---
>  doc/org-manual.org | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/org-guide.org b/doc/org-guide.org
> index ea3040bba..3715982f6 100644
> --- a/doc/org-guide.org
> +++ b/doc/org-guide.org
> @@ -2337,9 +2337,9 @@ example:
>   :publishing-directory "~/public_html"
>   :section-numbers nil
>   :table-of-contents nil
> - :style " -href=\"../other/mystyle.css\"
> -type=\"text/css\"/>")))
> + :html-head " +href=\"../other/mystyle.css\"
> +type=\"text/css\"/>")))
>  #+end_src
>  
>  - {{{kbd(C-c C-e P x)}}} ::
> diff --git a/doc/org-manual.org b/doc/org-manual.org
> index 914649f6e..593c848cf 100644
> --- a/doc/org-manual.org
> +++ b/doc/org-manual.org
> @@ -16325,9 +16325,9 @@ directory on the local machine.
>   :publishing-directory "~/public_html"
>   :section-numbers nil
>   :table-of-contents nil
> - :style " -href=\"../other/mystyle.css\"
> -type=\"text/css\"/>")))
> + :html-head " +href=\"../other/mystyle.css\"
> +type=\"text/css\"/>")))
>  #+end_src
>  
>  *** Example: complex publishing configuration
> -- 
> 2.30.2
> 
> 
> 


[PATCH] manual: Fix publish stylesheet

2021-04-18 Thread Erik Hetzner
* doc/org-manual.org (Publishing sample configuration):
* doc/org-guide.org (Publishing):
Fix stylesheet setting in publish: :style is not a valid option; use
:html-head instead.
---
A small fix for the manual which I believe is necessary (:style does not appear 
to be a valid option any more). My copyright assignment paperwork is on file. 
Thank you!

 doc/org-guide.org  | 6 +++---
 doc/org-manual.org | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/org-guide.org b/doc/org-guide.org
index ea3040bba..3715982f6 100644
--- a/doc/org-guide.org
+++ b/doc/org-guide.org
@@ -2337,9 +2337,9 @@ example:
  :publishing-directory "~/public_html"
  :section-numbers nil
  :table-of-contents nil
- :style "")))
+ :html-head "")))
 #+end_src
 
 - {{{kbd(C-c C-e P x)}}} ::
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 914649f6e..593c848cf 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -16325,9 +16325,9 @@ directory on the local machine.
  :publishing-directory "~/public_html"
  :section-numbers nil
  :table-of-contents nil
- :style "")))
+ :html-head "")))
 #+end_src
 
 *** Example: complex publishing configuration
-- 
2.30.2




Re: [PATCH] org-id: Fix behavior when `org-id-extra-values' is a symbol

2020-07-04 Thread Erik Hetzner
On Sat, 04 Jul 2020 12:32:11 -0700, Erik Hetzner  wrote:
> 
> * lisp/org-id.el (org-id-update-id-locations): When
> `org-id-extra-values' is a symbol, it should be evaluated as a
> variable.
>
> […]

Sorry, got the variable name wrong in the description. That should be
`org-id-extra-files'. See attached, fixed, patch.

filename="0001-org-id-Fix-behavior-when-org-id-extra-files-is-a-sym.patch"
Content-Transfer-Encoding: 8bit

>From a87a4b567f2cc86a2eb502fd40238f463ca83daa Mon Sep 17 00:00:00 2001
From: Erik Hetzner  Date: Sat, 4 Jul 2020 12:12:00 -0700
Subject: [PATCH] org-id: Fix behavior when `org-id-extra-files' is a
symbol

* lisp/org-id.el (org-id-update-id-locations): When
`org-id-extra-files' is a symbol, it should be evaluated as a
variable.

In 37a5020bb, `org-id-update-id-locations' was rewritten, and the
functionality to allow the variable `org-id-extra-files' to be a
symbol that references another variable was removed. This changes
restores that functionality.
---
 lisp/org-id.el | 4 +++- 1 file changed, 3 insertions(+), 1
 deletion(-)

diff --git a/lisp/org-id.el b/lisp/org-id.el index
9456b0629..387d8268b 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el
@@ -495,7 +495,9 @@ When FILES is given, scan also these files."
 ;; Agenda files and all associated archives.
 (org-agenda-files t org-id-search-archives)
 ;; Explicit extra files.
- (unless (symbolp org-id-extra-files) org-id-extra-files) + (if
(symbolp org-id-extra-files) + (symbol-value org-id-extra-files) +
org-id-extra-files)
 ;; All files known to have IDs. org-id-files
 ;; Additional files from function call.
-- 
2.27.0



[PATCH] org-id: Fix behavior when `org-id-extra-values' is a symbol

2020-07-04 Thread Erik Hetzner
* lisp/org-id.el (org-id-update-id-locations): When
`org-id-extra-values' is a symbol, it should be evaluated as a
variable.

In 37a5020bb, `org-id-update-id-locations' was rewritten, and the
functionality to allow the variable `org-id-extra-values' to be a
symbol that references another variable was removed.  This change
restores that functionality.
---
 lisp/org-id.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-id.el b/lisp/org-id.el
index 9456b0629..387d8268b 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -495,7 +495,9 @@ When FILES is given, scan also these files."
 ;; Agenda files and all associated archives.
 (org-agenda-files t org-id-search-archives)
 ;; Explicit extra files.
-(unless (symbolp org-id-extra-files) org-id-extra-files)
+(if (symbolp org-id-extra-files)
+   (symbol-value org-id-extra-files)
+ org-id-extra-files)
 ;; All files known to have IDs.
 org-id-files
 ;; Additional files from function call.
-- 
2.27.0




Re: [O] [PATCH] org-attach: Use relative path for git annex

2016-04-06 Thread Erik Hetzner
Hi Nicolas,

I don’t believe it was ever applied, nor was it superseded by another. This was
to fix a problem with testing older versions of git-annex. I believe David
remove git-annex on the buildbot, which stopped it from failing, because it was
not being tested.

If you need me to make any changes to this patch, let me know. Thank you!

best, Erik

On Wed, 06 Apr 2016 06:12:42 -0700,
Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> 
> Hello,
> 
> Erik Hetzner <e...@e6h.org> writes:
> 
> > * lisp/org-attach.el (org-attach-annex-get-maybe): Use relative path as
> >   argument for git annex. Fixes error in test with version 3 of git
> >   annex.
> 
> It seems like I lost track on this one. Could you tell me about the
> status of this patch? I doesn't seem to be applied. Was it superseded by
> another one?
> 
> Thank you.
> 
> Regards,
> 
> -- 
> Nicolas Goaziou



[O] [PATCH] org-attach: Use relative path for git annex

2016-02-26 Thread Erik Hetzner
* lisp/org-attach.el (org-attach-annex-get-maybe): Use relative path as
  argument for git annex. Fixes error in test with version 3 of git
  annex.
---
 lisp/org-attach.el | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index ebea435..cf8a1ca 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -299,22 +299,23 @@ the ATTACH_DIR property) their own attachment directory."
 (defun org-attach-annex-get-maybe (path)
   "Call git annex get PATH (via shell) if using git annex.
 Signals an error if the file content is not available and it was not 
retrieved."
-  (when (and (org-attach-use-annex)
-(not
- (string-equal
-  "found"
-  (shell-command-to-string
-   (format "git annex find --format=found --in=here %s"
-   (shell-quote-argument path))
-(let ((should-get
-  (if (eq org-attach-annex-auto-get 'ask)
-  (y-or-n-p (format "Run git annex get %s? " path))
-org-attach-annex-auto-get)))
-  (if should-get
- (progn (message "Running git annex get \"%s\"." path)
-(call-process "git" nil nil nil "annex" "get" path))
-   (error "File %s stored in git annex but it is not available, and was 
not retrieved"
-  path)
+  (let ((path-relative (file-relative-name path)))
+(when (and (org-attach-use-annex)
+  (not
+   (string-equal
+"found"
+(shell-command-to-string
+ (format "git annex find --format=found --in=here %s"
+ (shell-quote-argument path-relative))
+  (let ((should-get
+(if (eq org-attach-annex-auto-get 'ask)
+(y-or-n-p (format "Run git annex get %s? " path-relative))
+  org-attach-annex-auto-get)))
+   (if should-get
+   (progn (message "Running git annex get \"%s\"." path-relative)
+  (call-process "git" nil nil nil "annex" "get" path-relative))
+ (error "File %s stored in git annex but it is not available, and was 
not retrieved"
+path))

 (defun org-attach-commit ()
   "Commit changes to git if `org-attach-directory' is properly initialized.
--
2.5.0



[O] [PATCH] org-attach: Fix git annex test directories

2016-02-14 Thread Erik Hetzner
* testing/lisp/test-org-attach-annex.el: `default-directory' should end
  in a slash to function properly. This was causing test failures on
  older versions of git-annex.
---
Thanks for bearing with me on getting git-annex to work properly. This fixes an
issue with running tests on debian with older versions of git-annex.

testing/lisp/test-org-attach-annex.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testing/lisp/test-org-attach-annex.el 
b/testing/lisp/test-org-attach-annex.el
index 44b4ad0..29c5c7a 100644
--- a/testing/lisp/test-org-attach-annex.el
+++ b/testing/lisp/test-org-attach-annex.el
@@ -24,7 +24,7 @@
 (require 'cl-lib)
 
 (defmacro test-org-attach-annex/with-annex ( body)
-  `(let ((tmpdir (make-temp-file "org-annex-test" t)))
+  `(let ((tmpdir (make-temp-file "org-annex-test" t "/")))
  (unwind-protect
 (let ((default-directory tmpdir)
   (org-attach-directory tmpdir))
@@ -41,7 +41,7 @@
  (should-not (org-attach-use-annex
 
   ;; test with non annex directory
-  (let ((tmpdir (make-temp-file "org-annex-test" t)))
+  (let ((tmpdir (make-temp-file "org-annex-test" t "/")))
  (unwind-protect
 (let ((default-directory tmpdir)
   (org-attach-directory tmpdir))
@@ -52,7 +52,7 @@
 (ert-deftest test-org-attach/get-maybe ()
   (test-org-attach-annex/with-annex
(let ((path (expand-file-name "test-file"))
-(annex-dup (make-temp-file "org-annex-test" t)))
+(annex-dup (make-temp-file "org-annex-test" t "/")))
  (with-temp-buffer
(insert "hello world\n")
(write-file path))
-- 
2.5.0





Re: [O] [PATCH] org-attach.el: Get attachments from git annex

2016-02-10 Thread Erik Hetzner
Hi Achim

On Tue, 09 Feb 2016 14:19:25 -0800,
Achim Gratz  wrote:
>
>
> […]
>
> Well, the best solution would be to have an option for git-annex to
> switch off that lockdown thing.  Since that's not going to happen soon
> or anytime, try something like:
>
> $(RMR) $(testdir) || { $(CHMOD) -R u+w $(testdir); $(RMR) $(testdir) }
>
> which of course requires the addition of
>
> CHMOD = chmod
>
> in mk/defaults.mk.

Can you explain how this improves on what I had? The time spent appears to be
the same on my system (tested after clearing the filesystem cache):

$ time /bin/sh -c "if [ -d /tmp/tmp-orgtest/ ] ; then chmod u+w -R 
/tmp/tmp-orgtest/ ; fi ; rm -rf /tmp/orbit-egh/"

real0m0.219s
user0m0.004s
sys 0m0.000s

$ time /bin/sh -c "rm -rf /tmp/tmp-orgtest || { chmod -R u+w /tmp/tmp-orgtest; 
rm -rf /tmp/tmp-orgtest ; }"
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test11629xxf/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test11629knZ/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied

real0m0.240s
user0m0.000s
sys 0m0.012s

> But it seems that direct mode (however deprecated it is) would allow us
> to do exactly the thing we want, so maybe if the tests would put that
> repo in direct mode we wouldn't even need to do that.  But that doesn't
> seem to work in a v6 repo unless annex.thin is set to true.  What version
> are you testing?

git-annex version: 5.20150731-1build1. In any case, direct mode is a rather
different use case, as I understand it.

best, Erik



Re: [O] [PATCH] org-attach.el: Get attachments from git annex

2016-02-09 Thread Erik Hetzner
Hi Achim,

On Tue, 09 Feb 2016 11:40:54 -0800,
Achim Gratz <strom...@nexgo.de> wrote:
>
> Erik Hetzner writes:
> > Sorry - I misunderstood how `org-test-for-executable' works. I’ll fix the 
> > issue.
>
> Thanks.
>
> > As for the rm -rf, it does not work in the way you suggest, at least on 
> > ubuntu
> > GNU/Linux. Here is the result I get locally without the chmod:
>
> For pete's sake, what are the permissions?  As I said, the only reason I
> see that is happening is if the directory containing the files is mode
> 55x.  And that would either be spectactularly stupid or exceptionally
> clever, although I tend toward the first interpretation.  In any case,
> you'd need to make the directories writable to fix this, but not the
> files.  There might be a config option that you could/should set to
> avoid this bit of cleverness or nuisance by git-annex..

Here are the permissions:

0755 /tmp/tmp-orgtest/
0700 /tmp/tmp-orgtest/org-annex-test19785b6F/
0775 /tmp/tmp-orgtest/org-annex-test19785b6F/.git/
0775 /tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/
0775 /tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/objects/
0775 /tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/objects/jm/
0775 /tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/objects/jm/P2/
0555 
/tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/
0444 
/tmp/tmp-orgtest/org-annex-test19785b6F/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447

I presume this is to maintain the integrity of the file contents in the
repository.

It would be possible to drop these files after the test (using git annex drop
--force), but if something goes wrong there the rm -rf would not clean up the
test directory properly. If you think that is a better solution I can do that.

best, Erik



Re: [O] [PATCH] org-attach.el: Get attachments from git annex

2016-02-08 Thread Erik Hetzner
On Sun, 07 Feb 2016 12:48:20 -0800,
Achim Gratz <strom...@nexgo.de> wrote:
> 
> Erik Hetzner writes:
> > Thank you for all your feedback on this code! I’m really happy with how it
> > turned out, and glad it is in master now.
> 
> Please fix the tests to not fail (preferrably not run) if git-annex is
> not installed.
> 
> Also, revert the patch to mk/targets.mk; $(RMR) already includes the
> '--force' flag, so it can remove write protected files just fine.  If
> it's write protecting directories then that would be stupid, but still
> no reason to chmod all files.

Hi Achim,

Sorry - I misunderstood how `org-test-for-executable' works. I’ll fix the issue.

As for the rm -rf, it does not work in the way you suggest, at least on ubuntu
GNU/Linux. Here is the result I get locally without the chmod:

make cleantest
make[1]: Entering directory '/home/egh/c/org-mode'
rm -fr /tmp/tmp-orgtest
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test18033fml/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test18033Scf/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test172167kl/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied
rm: cannot remove 
‘/tmp/tmp-orgtest/org-annex-test17216uaf/.git/annex/objects/jm/P2/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447/SHA256E-s12--a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447’:
 Permission denied
mk/targets.mk:163: recipe for target 'cleantest' failed
make[1]: *** [cleantest] Error 1
make[1]: Leaving directory '/home/egh/c/org-mode'
mk/targets.mk:103: recipe for target 'test' failed
make: *** [test] Error 2

If you have a better suggestion to this issue I’d love to know! I’m not sure
what the best fix is here.

best, Erik



[O] [PATCH] testing/lisp/test-org-attach-annex.el: New file

2016-02-08 Thread Erik Hetzner
* testing/lisp/test-org-attach-annex.el: Move all org-attach tests that
  use git-annex to this file, which can test for the presence of
  git-annex. Prevents tests failing on systems where git-annex is not
  installed.
---
 testing/lisp/test-org-attach-annex.el | 96 ++
 testing/lisp/test-org-attach.el   | 97 ---
 2 files changed, 96 insertions(+), 97 deletions(-)
 create mode 100644 testing/lisp/test-org-attach-annex.el
 delete mode 100644 testing/lisp/test-org-attach.el

diff --git a/testing/lisp/test-org-attach-annex.el 
b/testing/lisp/test-org-attach-annex.el
new file mode 100644
index 000..44b4ad0
--- /dev/null
+++ b/testing/lisp/test-org-attach-annex.el
@@ -0,0 +1,96 @@
+;;; test-org-annex-attach.el --- Tests for Org Attach with git-annex
+;;
+;; Copyright (c) 2016 Erik Hetzner
+;; Authors: Erik Hetzner
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(org-test-for-executable "git-annex")
+(require 'org-attach)
+(require 'cl-lib)
+
+(defmacro test-org-attach-annex/with-annex ( body)
+  `(let ((tmpdir (make-temp-file "org-annex-test" t)))
+ (unwind-protect
+(let ((default-directory tmpdir)
+  (org-attach-directory tmpdir))
+  (shell-command "git init")
+  (shell-command "git annex init")
+  ,@body
+
+(ert-deftest test-org-attach/use-annex ()
+  (test-org-attach-annex/with-annex
+   (let ((org-attach-git-annex-cutoff 1))
+ (should (org-attach-use-annex)))
+
+   (let ((org-attach-git-annex-cutoff nil))
+ (should-not (org-attach-use-annex
+
+  ;; test with non annex directory
+  (let ((tmpdir (make-temp-file "org-annex-test" t)))
+ (unwind-protect
+(let ((default-directory tmpdir)
+  (org-attach-directory tmpdir))
+  (shell-command "git init")
+  (should-not (org-attach-use-annex)))
+   (delete-directory tmpdir 'recursive
+
+(ert-deftest test-org-attach/get-maybe ()
+  (test-org-attach-annex/with-annex
+   (let ((path (expand-file-name "test-file"))
+(annex-dup (make-temp-file "org-annex-test" t)))
+ (with-temp-buffer
+   (insert "hello world\n")
+   (write-file path))
+ (shell-command "git annex add test-file")
+ (shell-command "git annex sync")
+ ;; Set up remote & copy files there
+ (let ((annex-original default-directory)
+  (default-directory annex-dup))
+   (shell-command (format "git clone %s ." (shell-quote-argument 
annex-original)))
+   (shell-command "git annex init dup")
+   (shell-command (format "git remote add original %s" 
(shell-quote-argument annex-original)))
+   (shell-command "git annex get test-file")
+   (shell-command "git annex sync"))
+ (shell-command (format "git remote add dup %s" (shell-quote-argument 
annex-dup)))
+ (shell-command "git annex sync")
+ (shell-command "git annex drop --force test-file")
+ ;; test getting the file from the dup when we should ALWAYS get
+ (should (not (file-exists-p (file-symlink-p (expand-file-name 
"test-file")
+ (let ((org-attach-annex-auto-get t))
+   (org-attach-annex-get-maybe (expand-file-name "test-file"))
+   ;; check that the file has the right contents
+   (with-temp-buffer
+(insert-file-contents path)
+(should (string-equal "hello world\n" (buffer-string)
+ ;; test getting the file from the dup when we should NEVER get
+ (shell-command "git annex drop --force test-file")
+ (let ((org-attach-annex-auto-get nil))
+   (should-error (org-attach-annex-get-maybe (expand-file-name 
"test-file"
+ (let ((org-attach-annex-auto-get 'ask)
+  (called nil))
+   (flet ((y-or-n-p (prompt)
+  (setq called 'was-called)
+  t))
+(org-attach-annex-get-maybe (expand-file-name "test-file"))
+;; check that the file has the right contents
+(with-temp-buffer
+  (insert-file-contents path)
+  (should (string-equal "hello wo

Re: [O] [PATCH] org-attach.el: Get attachments from git annex

2016-02-07 Thread Erik Hetzner
Hi Rasmus and Kyle,

On Sat, 06 Feb 2016 04:18:55 -0800,
Rasmus  wrote:
>
> Hi Erik and Kyle,
>
> Sorry for the delay, I was traveling this week.  I’m happy with the patch now
> and it has been pushed to master.

Thank you for all your feedback on this code! I’m really happy with how it
turned out, and glad it is in master now.

best, Erik

--
Sent from my free software system .



Re: [O] make test hangs (master)

2016-02-02 Thread Erik Hetzner
Hi Nicolas,

On Tue, 02 Feb 2016 09:49:10 -0800,
Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> Erik Hetzner <e...@e6h.org> writes:
>
> > […]
> >
> >   [ hangs here ]
>
> FWIW, I cannot reproduce it.

Thank you for trying. It’s consistent on my machine, but may be an interaction
with other environment variables. If anyone else encounters the issue, at least
they will have this thread to reference.

best, Erik

--
Sent from my free software system <http://fsf.org/>.



Re: [O] [PATCH] org-attach.el: Get attachments from git annex

2016-01-31 Thread Erik Hetzner
Hi Rasmus,

Thanks again for the feedback!

On Wed, 27 Jan 2016 14:20:59 -0800,
Rasmus <ras...@gmx.us> wrote:
> 
> Hi Erik,
> 
> Thanks for the updated patch!
> 
> A couple of more comments follow.
> I hope I’m not being too annoying! 

Not at all, I appreciate it.

> Erik Hetzner <e...@e6h.org> writes:
> 
> > +(defcustom org-attach-annex-confirm-get-function #'y-or-n-p
> > +  "Function to call to confirm if Org should call git annex get if 
> > necessary.
> > +If t, always get, if nil, never get."
> 
> 
> Please note that the function should accept one argument cf. your code
> below.  Also, I wonder if there’s really a point in having the increased
> flexibility of a function over just: t, nil and ’ask.

This is a good point - I was following the pattern of
`org-confirm-shell-link-function' but I don’t think that in this case
it is necessary.

> > +  :group 'org-attach
> > +  :package-version '(Org . "8.3")
> > +  :type '(choice
> > + (const :tag "confirm with y-or-n" y-or-n-p)
> > + (const :tag "always get from annex if necessary" t)
> > + (const :tag "never get from annex" nil)))
> 
> Nitpick: package version should be org 9.  You should add :version tag as
> well.  Probably "25.1" is good.  Then we can mass-update them all when we
> are allowed to merge...

Thank you, I wasn’t sure what to use here.

> > +(defun org-attach-annex-get-maybe (path)
> > +  "Call git annex get PATH if using git annex."
> > +  (when (and (org-attach-use-annex)
> > +(not (string-equal "found"
> > +   (shell-command-to-string
> > +(format "git annex find --format=found 
> > --in=here %s" (shell-quote-argument path))
> > +(if (if (functionp org-attach-annex-confirm-get-function)
> > +   (funcall org-attach-annex-confirm-get-function (format "Run git 
> > annex get %s? " path))
> > + org-attach-annex-confirm-get-function)
> > +   (progn (message "Running git annex get \"%s\"." path)
> > +  (call-process "git" nil nil nil "annex" "get" path))
> > +  (error "File %s stored in git annex but it is not available, and was 
> > not retrieved" path
> 
> Can’t you factor out the inner "if", e.g. to an outer let?  Shouldn’t you
> check the return of annex get and show a warning or an error if it fails?
> It seems the error is only called if the inner if fails (in which case the
> error message is not precise since we didn’t try to retrieve the file).

This has been since refactored, but the point about the error remains. The
reason I used `error' is that the user has been attempting to open the file. If
the content is unavailable, then surely the attempt to open the file will be
unsuccessful. Perhaps a more clear docstring in `org-attach-annex-get-maybe' is
in order, though.

> >  (defun org-attach-commit ()
> 
> Looks fine. 
> 
> >  cleantest:
> > +# git annex makes files 444, change to user writable so we can delete them
> > +   if [ -d $(testdir) ] ; then chmod u+w -R $(testdir) ; fi
> > $(RMR) $(testdir)
> 
> I wonder if it would be better to directly target the files you use?  I
> don’t think there’s a case where changing the mod of the testdir is a
> problem though

Since it is about to be removed via =rm -rf= it doesn’t seem worth worrying
about it :)

best, Erik

> 
> > +;;; test-org-attach.el --- Tests for Org Attach
> 
> Skipped again...
> 
> -- 
> Slowly unravels in a ball of yarn and the devil collects it



[O] [PATCH] org-attach.el: Get attachments from git annex

2016-01-26 Thread Erik Hetzner
h-git-annex-cutoff))
+  (call-process "git" nil nil nil "annex" "add" new-or-modified)
+(call-process "git" nil nil nil "add" new-or-modified))
+   (incf changes))
(dolist (deleted
 (split-string
  (shell-command-to-string "git ls-files -z --deleted") "\0" t))
@@ -465,8 +492,10 @@ If IN-EMACS is non-nil, force opening in Emacs."
 (file (if (= (length files) 1)
   (car files)
 (completing-read "Open attachment: "
- (mapcar #'list files) nil t
-(org-open-file (expand-file-name file attach-dir) in-emacs)))
+ (mapcar #'list files) nil t)))
+ (path (expand-file-name file attach-dir)))
+(org-attach-annex-get-maybe path)
+(org-open-file path in-emacs)))
 
 (defun org-attach-open-in-emacs ()
   "Open attachment, force opening in Emacs.
diff --git a/mk/targets.mk b/mk/targets.mk
index d390fdb..cab65cb 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -158,4 +158,6 @@ cleandocs:
-$(FIND) doc -name \*~ -exec $(RM) {} \;
 
 cleantest:
+# git annex makes files 444, change to user writable so we can delete them
+   if [ -d $(testdir) ] ; then chmod u+w -R $(testdir) ; fi
$(RMR) $(testdir)
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
new file mode 100644
index 000..b0cfb58
--- /dev/null
+++ b/testing/lisp/test-org-attach.el
@@ -0,0 +1,95 @@
+;;; test-org-attach.el --- Tests for Org Attach
+;;
+;; Copyright (c) 2016 Erik Hetzner
+;; Authors: Erik Hetzner
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'org-attach)
+
+(cl-defmacro test-org-attach-annex/with-annex ( body)
+  `(let ((tmpdir (make-temp-file "org-annex-test" t)))
+ (unwind-protect
+(let ((default-directory tmpdir)
+  (org-attach-directory tmpdir))
+  (shell-command "git init")
+  (shell-command "git annex init")
+  ,@body
+
+(ert-deftest test-org-attach/use-annex ()
+  (org-test-for-executable "git-annex")
+  (test-org-attach-annex/with-annex
+   (let ((org-attach-git-annex-cutoff 1))
+ (should (org-attach-use-annex)))
+
+   (let ((org-attach-git-annex-cutoff nil))
+ (should-not (org-attach-use-annex
+
+  ;; test with non annex directory
+  (let ((tmpdir (make-temp-file "org-annex-test" t)))
+ (unwind-protect
+(let ((default-directory tmpdir)
+  (org-attach-directory tmpdir))
+  (shell-command "git init")
+  (should-not (org-attach-use-annex)))
+   (delete-directory tmpdir 'recursive
+
+(ert-deftest test-org-attach/get-maybe ()
+  (org-test-for-executable "git-annex")
+  (test-org-attach-annex/with-annex
+   (let ((path (expand-file-name "test-file"))
+(annex-dup (make-temp-file "org-annex-test" t)))
+ (with-temp-buffer
+   (insert "hello world\n")
+   (write-file path))
+ (shell-command "git annex add test-file")
+ (shell-command "git annex sync")
+ ;; Set up remote & copy files there
+ (let ((annex-original default-directory)
+  (default-directory annex-dup))
+   (shell-command (format "git clone %s ." (shell-quote-argument 
annex-original)))
+   (shell-command "git annex init dup")
+   (shell-command (format "git remote add original %s" 
(shell-quote-argument annex-original)))
+   (shell-command "git annex get test-file")
+   (shell-command "git annex sync"))
+ (shell-command (format "git remote add dup %s" (shell-quote-argument 
annex-dup)))
+ (shell-command "git annex sync")
+ (shell-command "git annex drop --force test-file")
+ ;; test getting the file from the dup when we should ALWAYS get
+ (should (not (file-exists-p (file-symlink-p (expand-file-name 
"test-file")
+ (let ((org-attach-annex-confirm-get-function t))
+   (org-attach-annex-get-maybe (expand-file-name "test-file"))
+   ;; check that the file has t

Re: [O] make test hangs (master)

2016-01-26 Thread Erik Hetzner
On Mon, 25 Jan 2016 21:51:05 -0800,
Erik Hetzner <e...@e6h.org> wrote:
> 
> Hi all,
> 
> make test is hanging on my environment, on the babel sh tests.

[…]

It turns out the issue is my prompt, that is, the value of the =PS1= environment
variable, which contains a lambda (λ, U+03BB). I suspect the following will fail
for all:

  $ PS1="λ " emacs -Q --batch -L lisp/ -L testing/ -L testing/lisp -l 
lisp/org.el -l lisp/org-id.el -l testing/org-test.el --eval "(progn 
(org-reload) (setq org-confirm-babel-evaluate nil) (org-babel-do-load-languages 
'org-babel-load-languages '((emacs-lisp . t) (shell . t) (org . t" -f 
org-test-run-batch-tests
  …
 passed   70/443  test-ob-shell/dont-insert-spaces-on-expanded-bodies
  [ hangs here ]

It is easy enough to set =PS1= to something sane in the Makefile, but this might
be an issue with ob-shell.el. Unfortunately I don’t understand ob-shell.el well
enough to fix this.

best, Erik



Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-26 Thread Erik Hetzner
On Mon, 25 Jan 2016 23:40:33 -0800,
Kyle Meyer <k...@kyleam.com> wrote:
> 
> Erik Hetzner <e...@e6h.org> writes:
> 
> […]
> > * mk/targets.mk: Fix cleantest target to for deleting git annex repos.
> ^^
> Typo

Thank you!


> […]
> 
> s/if/when/

I’m sorry, you said this before, but I’ve always used =if= except in the case
where I’d otherwise need =progn=. Is the principle here that =when= should be
used when there is no else block? Is there a style guide that I should be
referring to before submitting patches?

> [...]
> 
> > - (mapcar #'list files) nil t
> > -(org-open-file (expand-file-name file attach-dir) in-emacs)))
> > + (mapcar #'list files) nil t)))
> > + (path (expand-file-name file attach-dir)))
> > +(org-attach-annex-get-maybe path)
> > +(org-open-file path in-emacs)))
> 
> I think it's a mistake to always run git annex get and to remove the
> message, because this process can hang if all the repos with the file
> are unavailable.
> 
> This is also one of the reasons why I think there should be an option to
> turn off automatic fetching.  Users should be able to stop org-attach
> from trying to make connections.

I have to admit I am reluctant to add another option to org-mode. What do you
think about a y-or-n-p if the file needs fetching that will ask if the user
would like to get the file from git annex?

best, Erik
--
Sent from my free software system <http://fsf.org/>.



Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-25 Thread Erik Hetzner
Hi Rasmus,

Thanks for the thoughtful feedback.

On Mon, 25 Jan 2016 13:19:56 -0800,
Rasmus <ras...@gmx.us> wrote:
>
> Hi Erik,
>
> Thanks for the patch.
>
> Note that between git-annex v6 and annex.largefiles most of the checking
> is unnecessary.  In my opinion it would be much more useful to start
> ripping out annex specific code, though the automatic fetching should be
> added.

I agree, but I think this should be a separate patch.

> Erik Hetzner <e...@e6h.org> writes:
>
> > +(defun org-attach-use-annex ()
> > +  "Return non-nil if git annex can be used."
> > +  (let ((git-dir (vc-git-root (expand-file-name org-attach-directory
> > +(and org-attach-git-annex-cutoff
> > + (or (file-exists-p (expand-file-name "annex" git-dir))
> > + (file-exists-p (expand-file-name ".git/annex" git-dir))
>
> Seems fine, but I wonder if it wouldn’t be better to check the exit code
> of say an annex command and relies on its checking.  E.g. on my system
>
> (zerop (shell-command "cd ~/annex/doc.annex/ && git annex info --fast" 
> nil)) => t
> (zerop (shell-command "cd ~/src/code/org-mode && git annex info --fast" 
> nil )) => nil

This would be great, but it returns t for my non-annex git repos. I’m not sure
why the behavior is different for you.

> AFAIK annex will check if get should get anything.  If that’s correct, I’d
> prefer to just rely on however git annex get checks files.

That makes sense. I’ll change that code. The only disadvantage here is that it
is no longer clear to me how to tell if the content was fetched, if we want to
notify the user.

> > +(dolist (new-or-modified
> > + (split-string
> > +  (shell-command-to-string
> > +   "git ls-files -zmo --exclude-standard") "\0" t))
>
> When I run this command in one of my annex repos I get:
>
>  fatal: This operation must be run in a work tree
>
> Maybe you are assuming indirect mode?

This code is unchanged from org-attach.el.
http://git-annex.branchable.com/direct_mode/#index5h2 says: “you cannot git
commit or git pull” in direct mode - so I’m curious if direct mode would work at
all with org-attach?

> > +  (if (and (org-attach-use-annex)
>
> wouldn’t it be better to bind the return value of (org-attach-use-annex)
> rather than call it once per file to be added?  Since there’s no dir
> argument, I guess it won’t change.

Good call.

> > +   (>= (nth 7 (file-attributes new-or-modified))
> > +   org-attach-git-annex-cutoff))
>
> If people want this they can use annex.largefiles.  Reimplementing
> annex.largefiles is not within Org’s domain.  It’s even more the case with
> annex v6.

I’m happy to make that change, but I feel it should be a separate patch.

> > +  (call-process "git" nil nil nil "annex" "add" 
> > new-or-modified)
> > +(call-process "git" nil nil nil "add" new-or-modified))
>
> In git annex v6 you don’t need to call "git annex add" (but can).  In git
> annex v5 you don’t need to call "git add".
>
> To be compatible between with both v5 and v6 you can just call "git annex
> add", I guess.

I’ll leave it, then. Thanks for the information.

> > +++ b/testing/lisp/test-org-attach.el
> > @@ -0,0 +1,81 @@
> > +;;; test-org-attach.el --- Tests for Org Attach
> > +;;
> > +;; Copyright (c) 2016 Erik Hetzner
> > +;; Authors: Erik Hetzner
>
> I did not check this part.

Thank you, Rasmus, for the detailed review!

best, Erik



[O] make test hangs (master)

2016-01-25 Thread Erik Hetzner
Hi all,

make test is hanging on my environment, on the babel sh tests.

Environment:
- ubuntu (15.10)
- GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6) of 2015-09-17 on 
lgw01-52, modified by Debian
- org-mode git master (c74b99a75b26f3ee3ee296ba9996afcbd6f915de)

The tests that seem to fail are in testing/lisp/test-ob-shell.el:

- test-ob-shell/dont-insert-spaces-on-expanded-bodies
- test-ob-shell/dont-error-on-empty-results
- test-ob-shell/session

They seem to run OK if I run them manually, but not from batch mode.

best, Erik
--
Sent from my free software system .



[O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-25 Thread Erik Hetzner
* org-attach.el (org-attach-use-annex): New function to check if git
  annex should be used.
  (org-attach-annex-get-maybe): New function to get a file from git
  annex if necessary.
  (org-annex-open): Automatically fetch attached files from git annex when
  opening if necessary.
* testing/lisp/test-org-annex.el: New file for testing org-attach. Only
  contains code for testing org-attach with git annex at the moment.
* mk/targets.mk: Fix cleantest target to for deleting git annex repos.
---
Changes per Rasmus’s feedback.

lisp/org-attach.el  | 43 ++
 mk/targets.mk   |  2 +
 testing/lisp/test-org-attach.el | 81 +
 3 files changed, 110 insertions(+), 16 deletions(-)
 create mode 100644 testing/lisp/test-org-attach.el

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index e6ad4b1..1085ad3 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -270,29 +270,38 @@ the ATTACH_DIR property) their own attachment directory."
   (org-entry-put nil "ATTACH_DIR_INHERIT" "t")
   (message "Children will inherit attachment directory"))
 
+(defun org-attach-use-annex ()
+  "Return non-nil if git annex can be used."
+  (let ((git-dir (vc-git-root (expand-file-name org-attach-directory
+(and org-attach-git-annex-cutoff
+ (or (file-exists-p (expand-file-name "annex" git-dir))
+ (file-exists-p (expand-file-name ".git/annex" git-dir))
+
+(defun org-attach-annex-get-maybe (path)
+  "Call git annex get PATH if using git annex."
+  (if (org-attach-use-annex)
+  (call-process "git" nil nil nil "annex" "get" path)))
+
 (defun org-attach-commit ()
   "Commit changes to git if `org-attach-directory' is properly initialized.
 This checks for the existence of a \".git\" directory in that directory."
   (let* ((dir (expand-file-name org-attach-directory))
 (git-dir (vc-git-root dir))
+(use-annex (org-attach-use-annex))
 (changes 0))
 (when (and git-dir (executable-find "git"))
   (with-temp-buffer
(cd dir)
-   (let ((have-annex
-  (and org-attach-git-annex-cutoff
-   (or (file-exists-p (expand-file-name "annex" git-dir))
-   (file-exists-p (expand-file-name ".git/annex" 
git-dir))
- (dolist (new-or-modified
-  (split-string
-   (shell-command-to-string
-"git ls-files -zmo --exclude-standard") "\0" t))
-   (if (and have-annex
-(>= (nth 7 (file-attributes new-or-modified))
-org-attach-git-annex-cutoff))
-   (call-process "git" nil nil nil "annex" "add" new-or-modified)
- (call-process "git" nil nil nil "add" new-or-modified))
-   (incf changes)))
+(dolist (new-or-modified
+ (split-string
+  (shell-command-to-string
+   "git ls-files -zmo --exclude-standard") "\0" t))
+  (if (and use-annex
+   (>= (nth 7 (file-attributes new-or-modified))
+   org-attach-git-annex-cutoff))
+  (call-process "git" nil nil nil "annex" "add" new-or-modified)
+(call-process "git" nil nil nil "add" new-or-modified))
+   (incf changes))
(dolist (deleted
 (split-string
  (shell-command-to-string "git ls-files -z --deleted") "\0" t))
@@ -465,8 +474,10 @@ If IN-EMACS is non-nil, force opening in Emacs."
 (file (if (= (length files) 1)
   (car files)
 (completing-read "Open attachment: "
- (mapcar #'list files) nil t
-(org-open-file (expand-file-name file attach-dir) in-emacs)))
+ (mapcar #'list files) nil t)))
+ (path (expand-file-name file attach-dir)))
+(org-attach-annex-get-maybe path)
+(org-open-file path in-emacs)))
 
 (defun org-attach-open-in-emacs ()
   "Open attachment, force opening in Emacs.
diff --git a/mk/targets.mk b/mk/targets.mk
index d390fdb..8eb02fd 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -158,4 +158,6 @@ cleandocs:
-$(FIND) doc -name \*~ -exec $(RM) {} \;
 
 cleantest:
+   # git annex makes files 444, change to user writableso we can delete 
them
+   chmod u+w -R $(testdir)
$(RMR) $(testdir)
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
new file mode 100644
index 000..7f02e2d
--- /dev/null
+++ b/testing/lisp/test-org-attach.el
@@ -0,0 +1,81 @@
+;;; test-org-attach.el --- T

Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-24 Thread Erik Hetzner
* org-attach.el (org-attach-use-annex): New function to check if git
  annex should be used.
  (org-attach-annex-fetch-maybe): New function to fetch a file from git
  annex if necessary.
  (org-annex-open): Automatically fetch attached files from git annex when
  opening if necessary.
* testing/lisp/test-org-annex.el: New file for testing org-attach.  Only
  contains code for testing org-attach with git annex at the moment.
---
I have finally updated this patch per the feedback on the list. I have also
added some tests of the git annex attach code.

Thanks for all the feedback.

 lisp/org-attach.el  | 46 +++
 testing/lisp/test-org-attach.el | 81 +
 2 files changed, 111 insertions(+), 16 deletions(-)
 create mode 100644 testing/lisp/test-org-attach.el

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index e6ad4b1..3500e26 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -270,6 +270,22 @@ the ATTACH_DIR property) their own attachment directory."
   (org-entry-put nil "ATTACH_DIR_INHERIT" "t")
   (message "Children will inherit attachment directory"))
 
+(defun org-attach-use-annex ()
+  "Return non-nil if git annex can be used."
+  (let ((git-dir (vc-git-root (expand-file-name org-attach-directory
+(and org-attach-git-annex-cutoff
+ (or (file-exists-p (expand-file-name "annex" git-dir))
+ (file-exists-p (expand-file-name ".git/annex" git-dir))
+
+(defun org-attach-annex-fetch-maybe (path)
+  "Fetch PATH from git annex if necessary."
+  (when (and (org-attach-use-annex)
+(not (string-equal "found"
+   (shell-command-to-string
+(format "git annex find --format=found 
--in=here %s" (shell-quote-argument path))
+(message "Fetching \"%s\" using git annex." path)
+(call-process "git" nil nil nil "annex" "get" path)))
+
 (defun org-attach-commit ()
   "Commit changes to git if `org-attach-directory' is properly initialized.
 This checks for the existence of a \".git\" directory in that directory."
@@ -279,20 +295,16 @@ This checks for the existence of a \".git\" directory in 
that directory."
 (when (and git-dir (executable-find "git"))
   (with-temp-buffer
(cd dir)
-   (let ((have-annex
-  (and org-attach-git-annex-cutoff
-   (or (file-exists-p (expand-file-name "annex" git-dir))
-   (file-exists-p (expand-file-name ".git/annex" 
git-dir))
- (dolist (new-or-modified
-  (split-string
-   (shell-command-to-string
-"git ls-files -zmo --exclude-standard") "\0" t))
-   (if (and have-annex
-(>= (nth 7 (file-attributes new-or-modified))
-org-attach-git-annex-cutoff))
-   (call-process "git" nil nil nil "annex" "add" new-or-modified)
- (call-process "git" nil nil nil "add" new-or-modified))
-   (incf changes)))
+(dolist (new-or-modified
+ (split-string
+  (shell-command-to-string
+   "git ls-files -zmo --exclude-standard") "\0" t))
+  (if (and (org-attach-use-annex)
+   (>= (nth 7 (file-attributes new-or-modified))
+   org-attach-git-annex-cutoff))
+  (call-process "git" nil nil nil "annex" "add" new-or-modified)
+(call-process "git" nil nil nil "add" new-or-modified))
+   (incf changes))
(dolist (deleted
 (split-string
  (shell-command-to-string "git ls-files -z --deleted") "\0" t))
@@ -465,8 +477,10 @@ If IN-EMACS is non-nil, force opening in Emacs."
 (file (if (= (length files) 1)
   (car files)
 (completing-read "Open attachment: "
- (mapcar #'list files) nil t
-(org-open-file (expand-file-name file attach-dir) in-emacs)))
+ (mapcar #'list files) nil t)))
+ (path (expand-file-name file attach-dir)))
+(org-attach-annex-fetch-maybe path)
+    (org-open-file path in-emacs)))
 
 (defun org-attach-open-in-emacs ()
   "Open attachment, force opening in Emacs.
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
new file mode 100644
index 000..7f435bd
--- /dev/null
+++ b/testing/lisp/test-org-attach.el
@@ -0,0 +1,81 @@
+;;; test-org-attach.el --- Tests for Org Attach
+;;
+;; Copyrig

Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-05 Thread Erik Hetzner
Thanks for the feedback, Kyle! I will make these changes and resubmit.

And thanks for the pointer to =git annex find PATH=. I think I can use that to
check if a file needs to be fetched.

(more below)

On Mon, 04 Jan 2016 22:21:41 -0800,
Kyle Meyer  wrote:
> 
> Thanks for the patch.
>
> […]
> 
> > + (org-attach-use-annex)
> > + (not (file-exists-p (file-symlink-p path
> > +(call-process "git" nil nil nil "annex" "get" path))
> 
> - Should this display a message before calling "git annex get" to let the
>   user know what's happening in case fetching the file takes some time?

That would make sense. I’ll change it.

> - Should there be a setting the controls whether attachments are
>   automatically fetched?

I don’t see why. If a file is managed in git annex and the user is trying to
open it, I can’t imagine why they wouldn’t want it fetched.

best, Erik
--
Sent from my free software system .



Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-05 Thread Erik Hetzner
Hi Rasmus,

On Tue, 05 Jan 2016 01:56:39 -0800,
Rasmus  wrote:
> 
> Hi Erik,
> 
> 
> For long prose like this I'd just export the patch (git format-patch)
> and attach it to an email like this.  But this is also fine...  Perhaps
> Kyle's method is more pro.

Thanks! I’m not sure which seems better either.

> […]
> 
> This is a good idea.  Though really this sounds like something that
> should be done by the git annex assistant rather than per application.
> 
> Has Joey spoken for or against automatic fetching of content when
> requested?

If a user prefers to use git annex assistant or preferred content that shouldn’t
interfere with this. But to my mind, opening an attachment is a pretty clear
indication of the user’s desire to fetch the file from git annex, so it would be
nice to do it.

> > (It would be nice to have Org do the same thing when exporting to HTML 
> as well,
> > if the git annex file is an image that is being exported as an 
> embedded image
> > link, but I can’t figure out how to do that.)
> 
> A stronger argument for for first figuring out whether it 

Well, I think it would have been nice, but the “preferred content” feature you
reference below seems like it could cover most of this. And, while I think that
trying to open an attachment is a pretty clear indication that the user wants to
fetch the file from git annex, exporting is much less clear. I’m pretty
convinced that Kyle is right that git annex support belongs in org-attach, but
not elsewhere.

> […]
> 
> IMO we should get rid of org-attach-git-annex-cutoff and point to
> preferred content:
> 
>   http://git-annex.branchable.com/preferred_content/
> 
> E.g. I might have a small mp3 file.  There's no point in storing it with
> git rather than git annex.
> 
> When preferred content is set up, I think git annex add will do the
> right thing.

I’m not certain how preferred content works, but it doesn’t seem to apply to
which content is added to git annex (as opposed to added to the git repo
itself), which is what org-attach-git-annex-cutoff does.

> Can you ask annex if it's an annexed file?  A symlink in an annexed 
> folder,
> to a usb disk that is not attached would pass this test.  But the 
> indication would be wrong.

Thanks! I’m going to use Kyle’s suggestion here, to use =git annex find PATH=.

best, Erik
--
Sent from my free software system .



[O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-04 Thread Erik Hetzner
* org-attach.el (org-attach-use-annex): New function to check if git
  annex should be used.
  (org-annex-open): Automatically fetch attached files from git annex when
  opening if appropriate.
---
 lisp/org-attach.el | 41 +
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index b3cd7b7..b3fde48 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -270,6 +270,14 @@ the ATTACH_DIR property) their own attachment directory."
   (org-entry-put nil "ATTACH_DIR_INHERIT" "t")
   (message "Children will inherit attachment directory"))
 
+(defun org-attach-use-annex ()
+  "Return true if we should use git annex for attachments."
+  (let* ((dir (expand-file-name org-attach-directory))
+(git-dir (vc-git-root dir)))
+(and org-attach-git-annex-cutoff
+ (or (file-exists-p (expand-file-name "annex" git-dir))
+ (file-exists-p (expand-file-name ".git/annex" git-dir))
+
 (defun org-attach-commit ()
   "Commit changes to git if `org-attach-directory' is properly initialized.
 This checks for the existence of a \".git\" directory in that directory."
@@ -279,20 +287,16 @@ This checks for the existence of a \".git\" directory in 
that directory."
 (when (and git-dir (executable-find "git"))
   (with-temp-buffer
(cd dir)
-   (let ((have-annex
-  (and org-attach-git-annex-cutoff
-   (or (file-exists-p (expand-file-name "annex" git-dir))
-   (file-exists-p (expand-file-name ".git/annex" 
git-dir))
- (dolist (new-or-modified
-  (split-string
-   (shell-command-to-string
-"git ls-files -zmo --exclude-standard") "\0" t))
-   (if (and have-annex
-(>= (nth 7 (file-attributes new-or-modified))
-org-attach-git-annex-cutoff))
-   (call-process "git" nil nil nil "annex" "add" new-or-modified)
- (call-process "git" nil nil nil "add" new-or-modified))
-   (incf changes)))
+(dolist (new-or-modified
+ (split-string
+  (shell-command-to-string
+   "git ls-files -zmo --exclude-standard") "\0" t))
+  (if (and (org-attach-use-annex)
+   (>= (nth 7 (file-attributes new-or-modified))
+   org-attach-git-annex-cutoff))
+  (call-process "git" nil nil nil "annex" "add" new-or-modified)
+(call-process "git" nil nil nil "add" new-or-modified))
+   (incf changes))
(dolist (deleted
 (split-string
  (shell-command-to-string "git ls-files -z --deleted") "\0" t))
@@ -465,8 +469,13 @@ If IN-EMACS is non-nil, force opening in Emacs."
 (file (if (= (length files) 1)
   (car files)
 (org-icompleting-read "Open attachment: "
-  (mapcar 'list files) nil t
-(org-open-file (expand-file-name file attach-dir) in-emacs)))
+  (mapcar 'list files) nil t)))
+ (path (expand-file-name file attach-dir)))
+(if (and (file-symlink-p path)
+ (org-attach-use-annex)
+ (not (file-exists-p (file-symlink-p path
+(call-process "git" nil nil nil "annex" "get" path))
+(org-open-file path in-emacs)))
 
 (defun org-attach-open-in-emacs ()
   "Open attachment, force opening in Emacs.
-- 
2.5.0




Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

2016-01-04 Thread Erik Hetzner
On Mon, 04 Jan 2016 21:09:55 -0800,
Erik Hetzner <e...@e6h.org> wrote:
>
> * org-attach.el (org-attach-use-annex): New function to check if git
>   annex should be used.
>   (org-annex-open): Automatically fetch attached files from git annex when
>   opening if appropriate.

[…]

Hi all,

I couldn’t figure out how to add a comment to my patch, so here is a little more
commentary.

Right now, if you use git to sync your Org files and git annex to manage your
(large) attachments, and are on a different computer from the one you were using
when you added the attachment, you will typically have a dangling symlink to
your attachment until you call =get annex get PATH=. (This is how git annex is
intended to work.)

This patch automatically calls =git annex get PATH= when you open the attachment
from Org, if the file has not been fetched already.

(It would be nice to have Org do the same thing when exporting to HTML as well,
if the git annex file is an image that is being exported as an embedded image
link, but I can’t figure out how to do that.)

I have signed copyright assignment papers with the FSF.

best, Erik
--
Sent from my free software system <http://fsf.org/>.



Re: [O] Favorite way of syncing?

2015-09-11 Thread Erik Hetzner
Hi Tobias,

On Fri, 11 Sep 2015 06:59:31 -0700,
Tobias Frischholz  wrote:
> 
> Hey there!
> 
> I was wondering what is your favorite way of syncing your org files and 
> everything.
> I’ve checked out unison, but I want more of an automated system that 
> synchronizes my two clients via an SSH server.

> […]

I finally settled on the following (although syncthing looks
promising):

1. git for my 2 org dirs (for home & work)

2. git-annex to manage attachments (I have a local patch to
automatically get annex files from a repo when opening, but haven’t
submitted it yet)

3. git-auto-commit-mode with the following setup:

  ;; auto-commit to git if the file is in one of my notes repos
  (defun egh:maybe-git-auto-commit-mode ()
(let* ((bfn (buffer-file-name))
   (root (and bfn (vc-git-root (buffer-file-name
   (full-root (and root (expand-file-name root
  (if (or (string-equal full-root "/home/egh/c/notes/h/")
  (string-equal full-root "/home/egh/c/notes/w/"))
  (git-auto-commit-mode +1

  (add-hook 'org-mode-hook #'egh:maybe-git-auto-commit-mode)
  (setq-default gac-automatically-push-p t)

4. A simple script called morning to sync it up:
Hope that helps!

  #!/bin/sh
  cd ~/c/notes/h
  git pull origin master
  git annex copy --fast --to=cloud
  git annex sync

best, Erik
--
Sent from my free software system .



Re: [O] emacs & org mode for scholars questions

2015-09-02 Thread Erik Hetzner
Hi Rasmus,

On Wed, 02 Sep 2015 04:00:50 -0700,
Rasmus  wrote:
> 
> Hi,
>
> Thanks, I really enjoyed them.  One technical question.  Why do the flow
> of the slides sometimes change from L→R to T→B?  It's quite confusing and
> makes it hard to go back and forth between slides (IMO of course).  None
> of your slides seem optional.

What Jorge said. I’m not a huge fan but I didn’t bother to fix it.
Since I used org-reveal it looks easily fixed, see:

  https://github.com/yjwen/org-reveal#the-hlevel

> If find whom you choose to mention by name in the Org part particular.
> E.g. add-on authors are named, the original author isn't mentioned, but
> his profession is, ob is mentioned, but the main author isn't mentioned...

That’s a good point, thanks! I’ll update the slides to include authors
of all packages mentioned.

> > Latex v. plain text
> > [...]
> > But the [ox] toolchains can be fragile [...]
> 
> {{citation needed}}

I was thinking in particular of the org -> pandoc toolchain. I agree
that org export is pretty rock-solid.

> > One thing that I came out of the conference thinking was that a
> > curated meta-package for Emacs (like elpy) that brought together tools
> > for scholarly writers (in LaTeX and markdown and org-mode) might be a
> > great help for Emacs beginners.
> 
> IMO, we should aim to DISTRIBUTE the needed packages *within* Emacs and
> have SANE defaults.  Even with package.el, maintaining software on a
> computer that you do not have full access to, can be a pain.  The value of
> "batteries included" cannot be emphasized enough!  Instead of adding
> another project to github, it would be better to fix it in Emacs.
>
> EmacsW32 is great in this regard 'cause it's a just a zip, which you can
> use even on constrained systems.  I still have to install AUCTEX and ESS
> "manually", but at least package.el can handle compressed archives.

I think that getting a lot of packages into Emacs and changing the
defaults is a much bigger project, that I wouldn’t be able to help out
with.

best, Erik
--
Sent from my free software system .



Re: [O] emacs & org mode for scholars questions

2015-09-02 Thread Erik Hetzner
Thanks, John.

I was really blown away by org-ref. It’s a great package. I love, for
instance, the citation displayed in the minibuffer when the cursor is
on a cite. If you need help with the MELPA packaging process, let me
know.

best, Erik

On Wed, 02 Sep 2015 03:40:42-0700,
John Kitchin <jkitc...@andrew.cmu.edu> wrote:
> 
> Cool! Thanks for the shout out to org-ref!
> 
> my jmax starter package (http://github.com/jkitchin/jmax) is basically
> designed for the last point you described. I use it with students (41
> this semester!) as a standalone "package". It isn't as polished as
> prelude or others, but it allows them to do things like I do out of the
> box.
> 
> The conference sounds like it was fun! Best wishes,
> 
> Erik Hetzner writes:
> 
> > Hi all,
> >
> > Thanks for all your responses! They were a great help when putting
> > together my talk. I’ve posted my slides from EmacsConf 2015 here:
> >
> >   http://www.e6h.org/talks/emacsconf-2015/index.html
> >
> > I think the planners are planning to post videos as soon as they can
> > get them edited to
> >
> >   http://emacsconf2015.org/
> >
> > EmacsConf 2015 was a lot of fun. Almost everyone there was an Org mode
> > user, which was no great surprise.
> >
> > One thing that I came out of the conference thinking was that a
> > curated meta-package for Emacs (like elpy) that brought together tools
> > for scholarly writers (in LaTeX and markdown and org-mode) might be a
> > great help for Emacs beginners.
> >
> > best, Erik
> >
> > On Mon, 24 Aug 2015 22:38:30 -0700,
> > Erik Hetzner <e...@e6h.org> wrote:
> >>
> >> Hi all,
> >>
> >> I am going to be giving a talk on how Emacs can help support scholars,
> >> especially those who are using plain text and doing reproducible
> >> research, at “Emacsconf 2015” in San Francisco this Saturday (the
> >> 29th).
> >>
> >> I have done some work on managing references using Emacs & pandoc, but
> >> what I’d like to focus on in this talk is why Emacs is a great tool
> >> for scholarly writers (both scientists and humanists) and what Emacs
> >> developers should be concentrating on to make it an even better tool
> >> for the scholarly community.
> >>
> >> I’m wondering if you any of you might have any suggestions about what
> >> you would like to see Emacs do better to support the scholarly writing
> >> community.
> >>
> >> Thanks for any help you can provide!
> >>
> >> best, Erik Hetzner
> >> --
> >> Sent from my free software system <http://fsf.org/>.
> >>
> >>
> 
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu



Re: [O] emacs & org mode for scholars questions

2015-09-01 Thread Erik Hetzner
Hi all,

Thanks for all your responses! They were a great help when putting
together my talk. I’ve posted my slides from EmacsConf 2015 here:

  http://www.e6h.org/talks/emacsconf-2015/index.html

I think the planners are planning to post videos as soon as they can
get them edited to

  http://emacsconf2015.org/

EmacsConf 2015 was a lot of fun. Almost everyone there was an Org mode
user, which was no great surprise.

One thing that I came out of the conference thinking was that a
curated meta-package for Emacs (like elpy) that brought together tools
for scholarly writers (in LaTeX and markdown and org-mode) might be a
great help for Emacs beginners.

best, Erik

On Mon, 24 Aug 2015 22:38:30 -0700,
Erik Hetzner <e...@e6h.org> wrote:
> 
> Hi all,
> 
> I am going to be giving a talk on how Emacs can help support scholars,
> especially those who are using plain text and doing reproducible
> research, at “Emacsconf 2015” in San Francisco this Saturday (the
> 29th).
> 
> I have done some work on managing references using Emacs & pandoc, but
> what I’d like to focus on in this talk is why Emacs is a great tool
> for scholarly writers (both scientists and humanists) and what Emacs
> developers should be concentrating on to make it an even better tool
> for the scholarly community.
> 
> I’m wondering if you any of you might have any suggestions about what
> you would like to see Emacs do better to support the scholarly writing
> community.
> 
> Thanks for any help you can provide!
> 
> best, Erik Hetzner
> --
> Sent from my free software system <http://fsf.org/>.
> 
> 



[O] [PATCH] org-mime: Use `compose-mail' to send mail

2015-08-29 Thread Erik Hetzner
* contrib/lisp/org-mime.el (org-mime-compose): Use `compose-mail' to
send mail.  Allows customization via `mail-user-agent'.

TINYCHANGE
---
 contrib/lisp/org-mime.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 078ebef..682f635 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -285,7 +285,7 @@ otherwise export the entire body.
 
 (defun org-mime-compose (body fmt file optional to subject headers)
   (require 'message)
-  (message-mail to subject headers nil)
+  (compose-mail to subject headers nil)
   (message-goto-body)
   (let ((bhook
 (lambda (body fmt)
-- 
2.1.4




[O] emacs org mode for scholars questions

2015-08-24 Thread Erik Hetzner
Hi all,

I am going to be giving a talk on how Emacs can help support scholars,
especially those who are using plain text and doing reproducible
research, at “Emacsconf 2015” in San Francisco this Saturday (the
29th).

I have done some work on managing references using Emacs  pandoc, but
what I’d like to focus on in this talk is why Emacs is a great tool
for scholarly writers (both scientists and humanists) and what Emacs
developers should be concentrating on to make it an even better tool
for the scholarly community.

I’m wondering if you any of you might have any suggestions about what
you would like to see Emacs do better to support the scholarly writing
community.

Thanks for any help you can provide!

best, Erik Hetzner
--
Sent from my free software system http://fsf.org/.



Re: [O] John's amazing indexing posts

2015-07-27 Thread Erik Hetzner
Hi Oleh,

On Mon, 27 Jul 2015 06:19:35 -0700,
Oleh Krehel ohwoeo...@gmail.com wrote:
 
 
 Hi Erik,
 
 Erik Hetzner e...@e6h.org writes:
  I previously hooked up org with recoll with pretty good results.
  ...
  http://www.lesbonscomptes.com/recoll/
 
 Thanks for the link. I tried it, and it actually works great on my
 system (unlike swish-e). And I did no configuration of mimeinfo, I only
 told it to index my whole org/ directory.

Of course! I’ve forgotten exactly what I was intending to accomplish
by converting to HTML - I believe I was generating citations - but
recoll should be able to index plain text without issue. This will
probably work better for org files, as well, since you can search the
complete content.

 If anyone is interested, I've added an Emacs interface to recallq (a
 shell tool that comes with recoll that you have to build yourself).  See
 counsel-recoll command from
 https://github.com/abo-abo/swiper/blob/master/counsel.el.
 
 Initially, this command gives you a list of files that match the
 query. After selecting the file, it's searched for the current query.
 Unfortunately, the -A (abstract) switch isn't as useful as the context
 that e.g. grep gives, so I went only with the file names.

This is great, especially for me, as I’ve been using ivy lately.

I believe that you can rewrite using the recoll tool directly instead
of recollq, using `recoll -t -b 'search string'`:

(defun counsel-recoll-function (string optional _pred rest _unused)
  Grep in the current directory for STRING.
  (if ( (length string) 3)
  (counsel-more-chars 3)
(counsel--async-command
 (format recoll -t -b '%s' string))
nil))

If you use `recoll -A -t 'search string'` and do some post processing
you could get snippets, too. I can’t see how to do that easily with
counsel--async-command, though.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] John's amazing indexing posts

2015-07-26 Thread Erik Hetzner
Hi all,

I previously hooked up org with recoll with pretty good results. I’ve
written this up for worg, but I have my ssh key on a different
machine, so I can’t push now. Here is the info for the record.

** Recoll
In order to index using the [[http://www.lesbonscomptes.com/recoll/][recoll]] 
search engine, you will want to add
the following to your =~/.recoll/mimeinfo= file:

#+BEGIN_SRC
.org  = text/x-org
.org_archive  = text/x-org
#+END_SRC

You will also need a shell script to convert your org mode files to
HTML in batch mode. The script takes as an argument the file to
convert and prints the output to stdout. Here is an example:

#+BEGIN_SRC sh
#!/bin/sh
emacs --batch --eval (progn (find-file \$1\) (org-html-export-as-html) 
(set-buffer \*Org HTML Export*\) (princ (buffer-string)))
#+END_SRC

You will also need the following in your =~/.recoll/mimeconf=:

#+BEGIN_SRC
[index]
text/x-org = exec /home/egh/.recoll/rclorg ;
  mimetype = text/html
#+END_SRC

Now, rebuild your recoll index. Org mode files should be converted to
HTML and indexed. It will take some time, because emacs will be
launched for each conversion. An alternative is to use 
[[http://pandoc.org][pandoc]] to do
the conversion. It can be configured as follows in your
=~/.recoll/mimeconf= file:

#+BEGIN_SRC
[index]
text/x-org = exec pandoc -s -f org -t html5 ;
  mimetype = text/html
#+END_SRC

If you want, you might change the pandoc template or org mode output
to generate =meta= tags that will be recognized by recoll. See
http://www.lesbonscomptes.com/recoll/usermanual/RCL.PROGRAM.html#RCL.PROGRAM.FILTERS.HTML
for details.

On Mon, 13 Jul 2015 07:31:31 -0700,
John Kitchin jkitc...@andrew.cmu.edu wrote:
 
 Thanks Matt,
 
 That is also my impression of where this will go. Eventually this will
 move towards a database search engine, e.g. like Oleg's project at
 https://github.com/wvxvw/sphinx-mode. I am not sure precisely which
 direction though. Swish-e is nice, but at the moment you cannot
 incrementally update the database, and full indexing is required every
 time. I am not sure that is fixable, and swish-e does not do
 unicode. There are half a dozen or so candidates to go forward on, and
 they all have some pros and cons to think about.
 
 It has a lot of other applications in org too, e.g. a file-system wide
 agenda, tag search, etc...
 
 
 Matt Price writes:
 
  Not sure if everyone has seen John's latest post about indexing org files
  with swish-e:
 
  http://kitchingroup.cheme.cmu.edu/blog/2015/07/06/Indexing-headlines-in-org-files-with-swish-e-with-laser-sharp-results/
 
  It's very impressive.  It strikes me as a step towards an incredibly
  ambitious project that would bring file indexing inside of Emacs -- so it
  would not longer be necessary to go out to a shell or a Desktop Search tool
  in order to find files that contain particular search terms.  I'm looking
  forward to your next steps, John!
 
  Matt
 
 --
 Professor John Kitchin
 Doherty Hall A207F
 Department of Chemical Engineering
 Carnegie Mellon University
 Pittsburgh, PA 15213
 412-268-7803
 @johnkitchin
 http://kitchingroup.cheme.cmu.edu
 
 



[O] [PATCH] org-attach.el: fix check for git annex

2015-05-16 Thread Erik Hetzner
* lisp/org-attach.el (org-attach-commit): Check for .git/annex dir in
addition to annex dir in root git dir to ensure that git annex is used
---
 lisp/org-attach.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1737ec1..7f61910 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -283,7 +283,8 @@ This checks for the existence of a \.git\ directory in 
that directory.
(cd dir)
(let ((have-annex
   (and org-attach-git-annex-cutoff
-   (file-exists-p (expand-file-name annex git-dir)
+   (or (file-exists-p (expand-file-name annex git-dir))
+   (file-exists-p (expand-file-name .git/annex 
git-dir))
  (dolist (new-or-modified
   (split-string
(shell-command-to-string
-- 
2.1.4




[O] org-attach + git annex not working

2015-05-02 Thread Erik Hetzner
Hi all,

I am trying to get org-attach to work with git-annex, but there is a
bug that prevents it working.

org-attach checks if there is an annex directory in the results of
(vc-git-root org-attach-directory) in order to decide whether to use
git-annex. But the annex directory is a subdir of the .git dir, and
vc-git-root returns the path to the directory that contains .git, not
the .git path itself, e.g. /foo not /foo/.git

I don’t know if the behavior of vc-git-root has changed, but I don’t
see anything in the emacs git log for vc/vc-git.el and it seems to
have the same behavior in 24  25.

The following patch fixes this issue.

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1737ec1..b843d48 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -276,7 +276,7 @@ the ATTACH_DIR property) their own attachment directory.
   Commit changes to git if `org-attach-directory' is properly initialized.
 This checks for the existence of a \.git\ directory in that directory.
   (let* ((dir (expand-file-name org-attach-directory))
-(git-dir (vc-git-root dir))
+(git-dir (expand-file-name .git (vc-git-root dir)))
 (changes 0))
 (when (and git-dir (executable-find git))
   (with-temp-buffer

--
Sent from my free software system http://fsf.org/.



Re: [O] Citations, continued

2015-02-04 Thread Erik Hetzner
On Wed,  4 Feb 2015 at 07:59:46 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 
 Erik Hetzner e...@e6h.org writes:
 
  The ideal would be if citeproc would take care of proper formatting
  of all such citation types, given just an ordered list of the fields
  that should appear.  I don't know if CSL supports this, though; do
  you?
 
  I’m not entirely sure what you mean. The authors of citeproc have come
  up with a huge number of styles which seem to satisfy people’s needs.
  What appears in the in-text citation is configurable, see:
 

  http://citationstyles.org/downloads/specification-csl101-20120903.html#citation
 
 Sorry, I wasn't clear.  What I mean is, is there a way to tell an
 implementation of CSL hey, this particular citation right here should
 only contain the author (or year, or journal...) of the referenced work,
 even though the citation style for this document is (e.g.) numeric?
 
 The link you referenced makes it seem like the citation element
 describes how citations should be formatted for a whole document, but
 maybe I don't understand it.  (Can there be multiple citation formatting
 styles specified by a CSL stylesheet? or multiple stylesheets used to
 format the citations in a document?)
 
 The idea is, a citation like As Doe says in @Doe99:title, ... should
 render like As Doe says in /The Title/, ..., not like As Doe says in
 Doe (1999), ..., even if @Doe99 citations in the document generally
 render like the latter.  I suspect this must be possible with
 citeproc/CSL, but I don't actually know, since Pandoc doesn't provide
 syntax for this kind of case.

Hi Richard,

Thanks for the reply. I believe there is some discussion of this here:

  https://groups.google.com/d/msg/pandoc-discuss/QcAnk7hsZD8/e9MYHu0BA5IJ

and probably elsewhere on the pandoc-discuss list if you search the
archives.

It’s not supported in existing citeproc implementations, but I think
it would be possible to support something like this. On the other
hand, this is also something that is easily done by hand, so I don’t
know if it’s worth the trouble.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] Citations, continued

2015-02-04 Thread Erik Hetzner
On Wed,  4 Feb 2015 at 04:06:36 PST,
Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 
 Hello,
 
 Erik Hetzner e...@e6h.org writes:
 
  I concentrated on getting the parser to recognize valid citations
  first. I have now finished this part (excepting any bugs, of course :)
  and will need to add code to generate a proper parse tree. Then it can
  be integrated into org-element.el.
 
 The point of org-element.el is to generate a parse tree. If you
 generate it yourself, you do not need the library. Therefore, I'm not
 sure to understand the integration part.
 
 Also, AFAIU, the syntax for valid citations is not defined explicitly so
 far. For example, I don't think it was discussed if any subset of Org
 objects (e.g., macros or bold text) is allowed in a citation. Is there
 any document we could merge into Org syntax document?

Hi Nicolas,

I didn’t mean to push too far ahead. I’m hoping that when we have
working code, we can work out some of these tricky issues and get the
syntax properly documented. Embedding italic text and links in
citations is, for instance, something that I think is important to
support.

Regarding org-element.el, I meant that this code would extend
org-element to generate org-element.el compatible objects for the
citations. Does that make sense? I admit that I have not read
org-element.el carefully, so I might be wrong about how to proceed.

The pandoc grammar is, I believe, more complicated than any structure
currently present in org-mode, and so the parser was a little
trickier.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] Citations, continued

2015-02-03 Thread Erik Hetzner
Hi Richard,

On Tue,  3 Feb 2015 at 08:11:19 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 

[…]

 Yes.  I'll have to take a look at the Pandoc citeproc code and see how
 easy it would be to add support for something like this.  If there are
 Org people that need citation types that select specific fields, I
 imagine there are Pandoc people who do as well.  The ideal would be if
 citeproc would take care of proper formatting of all such citation
 types, given just an ordered list of the fields that should appear.  I
 don't know if CSL supports this, though; do you?

I’m not entirely sure what you mean. The authors of citeproc have come
up with a huge number of styles which seem to satisfy people’s needs.
What appears in the in-text citation is configurable, see:

  
http://citationstyles.org/downloads/specification-csl101-20120903.html#citation

 The +title@doe syntax would work, but I don't personally think that's
 any easier to read (or parse) than @doe:title, or @doe+title (which
 actually is another option I had thought of, given the +/- syntax for
 tag matching in Org).  

The only advantage of it is that it doesn’t break existing cite keys,
which can contain :, and it is closer to existing syntax. But for the
time being it’s something I wouldn’t worry about.

 Thanks for taking the first step on this!  I had a brief look at your
 parser code when you posted it the other day.
 
 I don't know if you are familiar with Org's parser, in org-element.el.
 The important thing will be to have a parser for citations return a data
 structure in the format used by org-element.  In the language of
 org-element, I think a citation is an object (as opposed to an element).
 I am somewhat (but not super-) familiar with org-element and Elisp, so
 if you want some help with this, let me know.

I concentrated on getting the parser to recognize valid citations
first. I have now finished this part (excepting any bugs, of course :)
and will need to add code to generate a proper parse tree. Then it can
be integrated into org-element.el.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] Citations, continued

2015-02-02 Thread Erik Hetzner
On Mon,  2 Feb 2015 at 10:02:41 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 
 Hi all,
 
 Here is the citation syntax proposal I have mentioned in a couple of
 posts now.  I have attached it as an Org document for better
 readability, and also reproduced the text below.  Let me know what you
 think!

Hi Richard,

I am really, really glad to see people discussing citations in
org-mode. But I have some concerns about this proposal.

Before extensions are proposed to the pandoc format, I think it is
important to understand how flexible the combination of pandoc, and
what citeproc provides. I believe that pandoc can cover most of what
you want.

I also believe it would be a mistake to start from the idea of a
pandoc-style citation syntax that deviates from pandoc. Better instead
to start from what pandoc does now and find out what isn’t working for
org-mode users before extending pandoc, especially in ways that are
not compatible with pandoc.

And if extensions are proposed, it would be best to propose them on
the pandoc-discuss mailing list. It would be wonderful for users if
the syntax in pandoc-markdown and org-mode could stay aligned.

For more info on the flexibility of pandoc+citeproc, see
http://johnmacfarlane.net/pandoc/README.html#citations and
http://johnmacfarlane.net/pandoc/demos.html. It is also important to
distinguish what are features of the citeproc style (e.g. inline v.
footnote citations) and what are determined by the author and thus
should be present in the syntax (e.g. use or do not use a suffix or
locator).

From the example document:

1.   @item1 says blah.
2.   @item1 [p. 30] says blah.
3.   @item1 [p. 30, with suffix] says blah.
4.   @item1 [-@item2 p. 30; see also @item3] says blah.
5.   A citation group [see @item1 p. 34-35; also @item3 chap. 3].
6.   Another one [see @item1 p. 34-35].
7.   Citation with a suffix and locator [@item1 pp. 33, 35-37, and nowhere 
else].
8.   A citation without locators [@item3].
9.   Citation with suffix only [@item1 and nowhere else].
10.  Like a citation without author: [-@item1], and now Doe with a locator 
[-@item2 p. 44].

How this is rendered depends on the note style. In chicago author date it will 
have:

1.   Doe (2005) says blah.
2.   Doe (2005, 30) says blah.
3.   Doe (2005, 30, with suffix) says blah.
4.   Doe (2005; 2006, 30; see also Doe and Roe 2007) says blah.
5.   A citation group (see Doe 2005, 34–35; also Doe and Roe 2007, chap. 3).
6.   Another one (see Doe 2005, 34–35).
7.   Citation with a suffix and locator (Doe 2005, 33, 35–37, and nowhere else).
8.   A citation without locators (Doe and Roe 2007).
9.   Citation with suffix only (Doe 2005 and nowhere else).
10.  Like a citation without author: (2005), and now Doe with a locator (2006, 
44).

with a bibliography, while in chicago fullnote bibliography everything
will be in footnotes (this is easier to see in HTML:
http://johnmacfarlane.net/pandoc/demo/example24b.html) or attached.

best, Erik





Pandoc with citeproc-hs

1
2
John Doe3 says blah.
ibid.4 says blah.
ibid.5 says blah.
ibid.6 says blah.
In a note.7
A citation group.8
Another one.9
And another one in a note.10
Citation with a suffix and locator.11
Citation with suffix only.12
Now some modifiers.13
With some markup.14


References
Doe, John. “Article.” Journal of Generic Studies 6 (2006): 33–34.
———. First Book. Cambridge: Cambridge University Press, 2005.
Doe, John, and Jenny Roe. “Why Water Is Wet.” In Third Book, edited by Sam Smith. Oxford: Oxford University Press, 2007.




??? ↩
??? ↩
First Book (Cambridge: Cambridge University Press, 2005).↩
30.↩
30, with suffix.↩
“Article,” Journal of Generic Studies 6 (2006): 30; see also John Doe and Jenny Roe, “Why Water Is Wet,” in Third Book, ed. Sam Smith (Oxford: Oxford University Press, 2007).↩
A citation without locators Doe and Roe, “Why Water Is Wet..↩
See Doe, First Book, 34–35; also Doe and Roe, “Why Water Is Wet,” chap. 3. ↩
See Doe, First Book, 34–35. ↩
Some citations see Doe, “Article,” chap. 3; Doe and Roe, “Why Water Is Wet”; Doe, First Book.↩
Doe, First Book, 33, 35–37, and nowhere else. ↩
Ibid. and nowhere else. ↩
Like a citation without author: , and now Doe with a locator “Article,” 44.↩
See Doe, First Book, 32. ↩




--
Sent from my free software system http://fsf.org/.


Re: [O] Citations, continued

2015-02-02 Thread Erik Hetzner
On Sat, 31 Jan 2015 at 10:26:05 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 
 Hi all,

 […]

 As I mentioned in the earlier thread, I think the Pandoc syntax is a
 good place to start, and I think it would be valuable to have the two
 syntaxes be compatible.  But even Pandoc's citation syntax might not be
 general enough to satisfy everyone's needs, so the first step for
 introducing citation syntax to Org should be compiling a list of all the
 things such a syntax should represent.

Hi Richard,

It would probably be worth reviewing the discussions that led to the
pandoc citation syntax:

  https://groups.google.com/d/msg/pandoc-discuss/v54VxMXtoWM/7ezu4xDSN8gJ

Of the requirements you later mentioned:

   1) a database key that references the cited work
   2) prefix / pre-text
   3) suffix / post-text
   4) references to page/chapter/section/whatever numbers and ranges.
  This is likely part of the prefix or suffix, but might be worth
  parsing separately for localization or link-following behavior.
   5) a way of indicating backend-agnostic formatting properties.
  Examples of some properties users might want to specify are:
  - displaying only some fields (or suppressing some fields) from a
reference record (e.g., journal, date, author)
  - indicating that the referenced works should *only* appear in
the bibliography of the exported document (equivalent of LaTeX
\nocite)

pandoc syntax handles 1, 2, 3, 4 (locator, which is separate from
suffix) and some of 5 (author suppression; I’m not sure the use cases
for journal/date/etc. suppression). It does not handle \nocite, but
this is something that they have discussed in the past and could
easily be supported in org-mode using, e.g. a #+NO_CITE block.
Personally I feel this covers the 99% of uses while being human
readable and writable.

I agree that citekey management is something that should be handle
separately, as this will depend on the backend (bibtex file, zotero,
etc.) Whether these citekeys are also links doesn’t really matter that
much either and could depend on the backend.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] Citations, continued

2015-02-02 Thread Erik Hetzner
Hi Richard,

On Mon,  2 Feb 2015 at 20:41:06 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 
 Hi Erik and all,
 
 Actually, I totally agree.  For my own use, I would be completely happy
 with just using the Pandoc syntax for citations in Org, without any
 modifications.

Great!

 The only reason I proposed anything else was that it seemed like other
 people already know that they need more than the Pandoc syntax provides.
 I think the main realistic cases are those where, in LaTeX, you'd use
 commands like \citetitle, \citedate, or \citejournal -- citation
 commands that pull in just a particular field from the reference,
 because that is what the context around the citation requires.  I don't
 see a way to do that in the Pandoc syntax.  (But am I missing
 something?)  Hence my proposed field-selectors extension.

If this is needed (and I still have a hard time seeing the use cases,
but I am not an academic) perhaps it could mimic the -@doe (suppress
author) syntax already used in pandoc (e.g. +title@doe). But
citeproc-js/hs only support suppress author or author only, so these
would not work in a pandoc export, nor any other that might depend on
citeproc-js.

 Personally, I need commands like these so little that I am happy to do
 without them.  So maybe my proposal was a bit hasty.  Could we hear from
 other people about how badly they need what such commands provide?
 
  And if extensions are proposed, it would be best to propose them on
  the pandoc-discuss mailing list. It would be wonderful for users if
  the syntax in pandoc-markdown and org-mode could stay aligned.
 
 Yes, I again totally agree.  If people here settle on a syntax that is
 close, but not quite the same as, Pandoc's, I will certainly do that.

Again, this is great. I really do appreciate your getting this
proposal out there. I hope that I can finish porting my pandoc parser
to elisp within a week or so, so we can have an implementation to
start with.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] exporting zotxt or orgref links to HTML and ODF

2015-01-31 Thread Erik Hetzner
On Tue, 27 Jan 2015 at 22:37:20 PST,
Erik Hetzner e...@e6h.org wrote:

 […]
 
 I wrote a parser for pandoc citations (that assumes you start with a
 citation string, that is, it doesn’t work unless you have extracted
 the citation string from the document):
 
   https://bitbucket.org/egh/zot4rst/src/master/xciterst/parser.py
 
 but it doesn’t seem that org-element.el uses a grammar, so I’m not
 sure how much that would help. There is also, of course, the pandoc
 parser.

I have started porting this parser to elisp. So far it can’t parse
much, but it shouldn’t be too hard to finish.

  https://gitlab.com/egh/org-pdcite

This includes parser combinator functionality for elisp.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] exporting zotxt or orgref links to HTML and ODF

2015-01-27 Thread Erik Hetzner
On Tue, 27 Jan 2015 at 09:24:00 PST,
Richard Lawrence richard.lawre...@berkeley.edu wrote:
 
 
 Although my home-baked solution presently works for me, I am inclined to
 agree.
 
 I've just had a glance at: http://pandoc.org/README.html#citations
 
 It looks to me like Pandoc has a quite general solution, and it also
 looks like Org could use Pandoc's citation syntax as-is.  I would
 suggest borrowing this syntax as a starting point for building citation
 support into Org.

Hi all,

I agree completely. For what it’s worth, using pandoc citations now
will work right now if you output to markdown and then parse in
pandoc. e.g.

  [see @doe:2006article, p. 10]

will work.

I wrote a parser for pandoc citations (that assumes you start with a
citation string, that is, it doesn’t work unless you have extracted
the citation string from the document):

  https://bitbucket.org/egh/zot4rst/src/master/xciterst/parser.py

but it doesn’t seem that org-element.el uses a grammar, so I’m not
sure how much that would help. There is also, of course, the pandoc
parser.

best, Erik
--
Sent from my free software system http://fsf.org/.



Re: [O] TODO keyword highlighting for headings with properties broken

2014-09-04 Thread Erik Hetzner
At Wed, 3 Sep 2014 21:30:11 -0500,
wtm wrote:
 
 Trevor,
 
 Thanks so much for mentioning this. I considered using these to roll
 back to 8/25 but I wasn't sure how much performance I would lose if
 I used the .el files instead of the compiled .elc versions. Or
 perhaps my assumption is incorrect? Is it ok to just byte-compile
 all of the .el files manually? I'm still very new to org-mode so
 please forgive my ignorance.

Hi Will,

You can install those packages using M-x package-install-file and you
will get a byte-compiled version.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] TODO keyword highlighting for headings with properties broken

2014-09-04 Thread Erik Hetzner
Hi Nicholas,

At Wed, 03 Sep 2014 19:58:58 +0200,
Nicolas Goaziou wrote:
 
 Hello,
 
 Erik Hetzner e...@e6h.org writes:
 
  Highlighting of TODO keywords for headings with properties in my org
  files seems to have broken since I upgraded to org 20140901 (via org
  mode ELPA). Rolling back to 20140825 fixes the problem. Here is a
  sample file I tested after loading the new org-mode using emacs -Q:
 
  * TODO foo
:PROPERTIES:
:bar:  baz
:END:
 
  If you remove the properties, the TODO highlights correctly.
 
 I think I fixed it yesterday. Please update if you can.

Just for the record, this problem seems to have caused some stray
`nil`s to be inserted in my entries.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] TODO keyword highlighting for headings with properties broken

2014-09-03 Thread Erik Hetzner
Hi,

Highlighting of TODO keywords for headings with properties in my org
files seems to have broken since I upgraded to org 20140901 (via org
mode ELPA). Rolling back to 20140825 fixes the problem. Here is a
sample file I tested after loading the new org-mode using emacs -Q:

* TODO foo
  :PROPERTIES:
  :bar:  baz
  :END:

If you remove the properties, the TODO highlights correctly.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [RFC] Rewrite `org-entry-properties' using parser

2014-08-04 Thread Erik Hetzner
At Mon, 04 Aug 2014 00:07:46 -0400,
Aaron Ecay wrote:
 
 Hi Erik,
 
 2014ko abuztuak 3an, Erik Hetzner-ek idatzi zuen:
  
  […]
 
  This allows me to search with subject={Bar}, which is very helpful.
  But it would be nice if org supported multi-valued properties. 
 
 It does, at least to a first approximation.  Look at the functions
 described in:
 
 (info (org) Using the property API)
 
 I’m not sure how well this feature is integrated with agenda
 search/filtering, though – maybe you should give it a try.

Hi Aaron,

Unfortunately those functions (org-entry-get-multivalued-property,
etc.) are completely isolated from all other property related code, so
search and filtering does not recognize them. Furthermore, they simply
split properties string on whitespace.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [RFC] Rewrite `org-entry-properties' using parser

2014-08-03 Thread Erik Hetzner
Hi John,

Thanks for the tips! I have been using this:

* Foo
  :PROPERTIES:
  :subject:  Bar; Baz
  :END:

This allows me to search with subject={Bar}, which is very helpful.
But it would be nice if org supported multi-valued properties. Again,
though, I don’t know how hard this would be.

best, Erik

At Sun, 03 Aug 2014 14:59:02 -0400,
John Kitchin wrote:
 
 I have used the following approaches in the past:
 
 Lisp lists, and use read later to get them.
 * Some heading
   :PROPERTIES:
   :SUBJECT:  '(subject1 subject2 subject3)
   :END:
 
 #+BEGIN_SRC emacs-lisp 
 (read (org-entry-get (point) SUBJECT))
 #+END_SRC
 
 #+RESULTS:
 | quote | (subject1 subject2 subject3) |
 
 
 * Second heading 
   :PROPERTIES:
   :SUBJECT:  subject1 subject2 subject3
   :END:
 
 delimited strings. You have to split them them yourself later if you
 are using the properties in code. You can delimit on spaces, commas, etc... 
 depending on your subjects.
 
 #+BEGIN_SRC emacs-lisp
 (split-string (org-entry-get (point) SUBJECT))
 #+END_SRC
 
 #+RESULTS:
 | subject1 | subject2 | subject3 |
 
 They are both pretty flexible.

 
 Erik Hetzner e...@e6h.org writes:
 
  At Fri, 01 Aug 2014 01:21:47 +0200,
  Thorsten Jolitz wrote:
  
  Hi List,
  
  here is my first take of rewriting `org-entry-properties'.
  
  The existing function predates the new parser and some Org variables,
  and thus does the parsing and the property classification itself. The
  new version leaves parsing to the parser and property classification
  (mostly) to existing Org variables, resulting in much simpler code. 
 
  […]
 
  Hi Thorsten,
 
  This doesn’t directly related to this work, but I have been trying to
  come up with a workflow for using org-mode for research and have had
  trouble with the fact that user properties cannot be multi-valued. So
  if a user wants to assign subjects to an entry, they need to figure
  some way to assign multiple subjects.
 
  There are workarounds, but it would be helpful if user properties
  could be multivalued. I don’t know if this is feasible given the
  current codebase; when I looked into it, it seemed pretty difficult.
 
  best, Erik
 
 -- 
 ---
 John Kitchin
 Professor
 Doherty Hall A207F
 Department of Chemical Engineering
 Carnegie Mellon University
 Pittsburgh, PA 15213
 412-268-7803
 http://kitchingroup.cheme.cmu.edu

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [RFC] Rewrite `org-entry-properties' using parser

2014-08-01 Thread Erik Hetzner
At Fri, 01 Aug 2014 01:21:47 +0200,
Thorsten Jolitz wrote:
 
 Hi List,
 
 here is my first take of rewriting `org-entry-properties'.
 
 The existing function predates the new parser and some Org variables,
 and thus does the parsing and the property classification itself. The
 new version leaves parsing to the parser and property classification
 (mostly) to existing Org variables, resulting in much simpler code. 

 […]

Hi Thorsten,

This doesn’t directly related to this work, but I have been trying to
come up with a workflow for using org-mode for research and have had
trouble with the fact that user properties cannot be multi-valued. So
if a user wants to assign subjects to an entry, they need to figure
some way to assign multiple subjects.

There are workarounds, but it would be helpful if user properties
could be multivalued. I don’t know if this is feasible given the
current codebase; when I looked into it, it seemed pretty difficult.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [PATCH] org-capture, :default-time and ...

2014-07-29 Thread Erik Hetzner
Hi Bastien,

At Tue, 29 Jul 2014 17:10:51 +0200,
Bastien wrote:
 
 Hi Erik,
 
 Erik Hetzner e...@e6h.org writes:
 
  What I would like to do is have something a capture template string
  similar to %^t, but with a custom date format string, e.g.
  %^%Y/%m/%d. Is this possible in some way?
 
 I'd use this in the capture template:
 
 %(format-time-string %Y/%m/%d (org-time-string-to-time (org-read-date)))
 
 but %^... would make sense to, I'll add it to the requested features.

Of course! Thank you so much, again, for your help.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [PATCH] org-capture, :default-time and ...

2014-07-28 Thread Erik Hetzner
At Mon, 28 Jul 2014 18:13:04 +0200,
Bastien wrote:
 
 Hi Erik,
 
 using a custom date is done via `org-overriding-default-time' (within
 a let construct) instead of (org-capture-put :default-time date).
 
 Yes, the details are obscure and we need to better document this.
 
 Let us know if you achieve something,

Hi Bastien,

Thanks so much for your reply.

What I would like to do is have something a capture template string
similar to %^t, but with a custom date format string, e.g.
%^%Y/%m/%d. Is this possible in some way? I was using
org-capture-put because that is how org-capture-set-target-location
uses it for the file+datetree+prompt method.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] [PATCH] org-capture, :default-time and ...

2014-07-08 Thread Erik Hetzner
Hi all,

I am pretty sure that the following org-capture setup used to work,
but it doesn’t seem to anymore. The intention is to manually select a
date and use this with a custom date format (e.g. %%Y/%m/%d). (The
custom date format is for ledger; I use this to capture ledger
transations.)

But it doesn’t work now (if it ever did – looking at git blame doesn’t
help me figure out why it might have worked) without the attached
patch, with passes along the custom time to format-time-string. Would
it be a problem if this patch were applied? Thank you.

best, Erik

(defun egh:org-capture-ledger-file ()
  (let* ((date (org-read-date nil t))
 (filename (format ~/c/finances/%s.lgr
   (format-time-string %Y date
(org-capture-put :default-time date)
(set-buffer (org-capture-target-buffer filename))
(goto-char (point-max

(setq org-capture-templates
'((c Cash plain
 (function egh:org-capture-ledger-file)
 %%Y/%m/%d * %^{Payee}
  Expenses:Erik:Cash
  Expenses:%^{Account}  $%^{Amount}
 :empty-lines 1)))


-- 
Sent from my free software system http://fsf.org/.
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index cbdf6f7..54f207d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1612,7 +1612,7 @@ The template may still contain \%?\ for cursor 
positioning.
   ;; The current time
   (goto-char (point-min))
   (while (re-search-forward %\\([^\n]+\\) nil t)
-   (replace-match (format-time-string (match-string 1)) t t))
+   (replace-match (format-time-string (match-string 1) ct) t t))
 
   ;; Simple %-escapes
   (goto-char (point-min))


Re: [O] org-cook

2014-03-17 Thread Erik Hetzner
At Mon, 17 Mar 2014 10:34:55 -0400,
Ken Mankoff wrote:
 
 Hi,
 
 This isn't directly related to Org, but I'll mention it anyway since
 people are discussing quantities and scale for their
 recipes. Various programming languages have physical units packages
 that can make working with units quite fun. I use the python
 Quantities package
 http://pythonhosted.org/quantities/user/tutorial.html . It lets you
 define custom quantities such as how many grams of butter are in a
 stick, etc. A wrapper to this would let you convert Org recipe
 shopping lists from units of g and teaspoon to units of sticks
 and fluid oz.

Hi Ken,

emacs calc also handles units. For org-cook [1] I extended the
definitions as follows (calc already has definitions for fluid oz):

  (setq math-additional-units
'((pinch tsp / 8 Pinch)
  (drop tsp / 76 Drop)
  (dash drop * 6 Dash)
  (jigger floz * 1.5 Jigger)
  (gill floz * 4 Gill)))

best, Erik

1. https://gitorious.org/org-cook/org-cook/

-- 
Sent from my free software system http://fsf.org/.



Re: [O] org-cook

2014-03-15 Thread Erik Hetzner
At Sat, 15 Mar 2014 09:24:23 +0200,
Xebar Saram wrote:
 
 Dear Eric and org users
 
 i am a new(ish) org user and an avid cooker. i have started using
 orgmodeas my recipe notebook and stumbled upon the old org-cook
 thread.
 Is there so documentation on this? do you still use it?
 are there any other ideas/suggestions on using orgmode as a recipe notebook?
 what i would mainly love is a way to scrape recipes off websites into org

Hi Xebar,

I still use org to manage my recipes, but I don’t use the org-cook
features. It was kind of a proof of concept, and I think it could
prove useful, but it turns out I don’t often need to convert between
units.

I have been trying out the format described in [1]. I used to use a
format like:

  Grate zest from 3 of them. Combine. Add:
  - 2 tbsp peanut oil
  - 2 chicken bouillon cubes, crumbled
  - 5 onions, thinly julienned
  - salt and pepper

But the new one looks like:

  Grate zest from 3 of them. Combine. Add:
  | 2 tbsp  | peanut oil   |  |
  | 2 cubes | chicken bouillon | crumbled |
  | 5   | onions,  | thinly julienned |
  | | salt and pepper  |  |
  
I think the table structure should make it easier to manipulate,
change units, or create shopping lists. (But I create shopping lists
by hand.)

One hack I do use is the following function:

(defun org-random-element ()
  Choose a random element from the buffer.
  (interactive)
  (let ((element-start -1)
(count 1))
(while (not (org-first-sibling-p))
  (org-goto-sibling t))
(save-excursion
  (while (org-goto-sibling)
  (setq count (+ 1 count
(org-forward-heading-same-level (random count

This chooses a random element from a list of headings. I use this to
plan meals. I just keep running the function until I see something
that I feel like cooking.

Hope that helps!

best, Erik

1. http://sachachua.com/blog/2012/06/emacs-org-grocery-lists-batch-cooking/

-- 
Sent from my free software system http://fsf.org/.



Re: [O] org-cook

2014-03-15 Thread Erik Hetzner
At Sat, 15 Mar 2014 20:03:33 +0200,
Xebar Saram wrote:
 
 Thanks so much for the tips Erik
 
 i will explore the ingredients in table idea as suggested. do you know
 perhaps of a way to quick format online recipes to an org table (that is
 webpage html to org table) or perhaps a way to convert already entered
 recipes in my org files to tables

Hi Xebar,

Sadly, no. I like my recipes in a pretty terse style so when I put a
recipe in my org file I end up rewriting a good deal of the content,
so any automated translation probably wouldn’t work very well for me.
As for the translation to tables, I imagine a keybord macro could do a
lot of that work.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [ANN] Firefox extension for org-protocol and org-capture

2014-02-22 Thread Erik Hetzner
At Sat, 22 Feb 2014 17:27:26 +0100,
Olivier Schwander wrote:
 
 Le 21 Feb 2014 18:22, Erik Hetzner a écrit:
  I had to start emacsclient in a terminal, probably because my emacs
  was run with emacs --daemon ? I made a little wrapper script that runs
  emacsclient in a terminal.
 
 Are you happy with the wrapper ? The other solution would be to give
 full control on the command line launched, but I think I will be too
 complex.

Hi Olivier,

I did a little more debugging. I think the issue I had is that if the
user starts emacs with `emacs --daemon` and has no current frame for
that emacs, your extension will not work, because the behavior of
emacsclient when no frame exists is to run in the terminal, and this
doesn’t work from Firefox.

Maybe the solution is to use the `-c` option to emacsclient by
default to create a new frame?

best, Erik

-- 
Sent from my free software system http://fsf.org/.


Re: [O] [ANN] Firefox extension for org-protocol and org-capture

2014-02-21 Thread Erik Hetzner
At Fri, 21 Feb 2014 18:34:17 -0500,
Peter Salazar wrote:
 
 I'm having the same issue as Nick: the command line invocation works, but
 the button in Firefox has no effect. I changed the emacs binary path to
 /usr/bin/aquamacs

I had to start emacsclient in a terminal, probably because my emacs
was run with emacs --daemon ? I made a little wrapper script that runs
emacsclient in a terminal.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] Weaving a budget with Org ledger

2014-02-20 Thread Erik Hetzner
Hi,

Users of ledger and Org may be interested in this tutorial on how I
manage an envelope style budget with those two excellent tools.

  http://orgmode.org/worg/org-tutorials/weaving-a-budget.html

Thanks!

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to

2014-02-12 Thread Erik Hetzner
At Wed, 12 Feb 2014 14:02:12 +0100,
Nicolas Goaziou wrote:
 
 Hello,
 
 Erik Hetzner e...@e6h.org writes:
 
  I have been looking at publishing to HTML using pandoc. Because pandoc
  requires post-processing to transform the org-mode markdown output to
  other formats, it is necessary to use the post-process parameter of
  org-export-to-file. 
 
  I think this patch makes sense; let me know what you think.
 
 Thanks for your patch.
 
 Though, it is not necessary. `post-process' is meant for processing
 after an asynchronous export (e.g., prepare a buffer in the current
 process).
 
 You're looking after a filter.  See
 
   (info (org) Advanced configuration)
 
 for more information.

Hi Nicholas,

Thanks very much for your response (and ox.el)! I looked at filters,
but concluded they were not appropriate, because pandoc operates on
the file as a whole, and writes to a file, and can return binary
content (for example, if it is generating PDFs). It seemed equivalent
to the way that the latex exporter uses pdflatex to generate a PDF,
and the latex exported uses a post-process function.

I could be wrong, though. It would also be convenient to have access
to the info plist; in fact, I was going to write another email about
having access to the info plist in a post-process filter.

Is there a way to define a filter that operates on the entire content,
is guaranteed to run after everything else, and can handle binary
content? Thanks.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] export to temporary HTML file and open

2014-02-12 Thread Erik Hetzner
Hi all,

This may be of some interest to list members, and possibly for org
mode itself.

I find myself wanting to get a nice view of org files, for printing or
otherwise, and would like to export to HTML. But I don’t want to have
a bunch of HTML files in my org directory. Here is a hack to allow you
to export to a temporary HTML file and open in a browser, for when you
don’t want to create an HTML file in your org directory.

best, Erik

(defun org-html-export-to-temp-file
  (optional async subtreep visible-only body-only ext-plist)
Export current buffer to a temporary HTML file.

If narrowing is active in the current buffer, only export its
narrowed part.

If a region is active, export that region.

A non-nil optional argument ASYNC means the process should happen
asynchronously.  The resulting file should be accessible through
the `org-export-stack' interface.

When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.

When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.

When optional argument BODY-ONLY is non-nil, only write code
between \body\ and \/body\ tags.

EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.

Return output file's name.
  (interactive)
  (let* ((extension (concat . org-html-extension))
 (file (make-temp-file org-export nil extension))
 (org-export-coding-system org-html-coding-system))
(org-export-to-file 'html file
  async subtreep visible-only body-only ext-plist)))

(org-export-define-derived-backend 'html-temp 'html
   :menu-entry 
   '(?h 2
((?t As temporary HTML file and open
(lambda (a s v b)
  (if a (org-html-export-to-temp-file t s v b)
(org-open-file (org-html-export-to-temp-file nil s v b

-- 
Sent from my free software system http://fsf.org/.



Re: [O] [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to

2014-02-12 Thread Erik Hetzner
At Wed, 12 Feb 2014 23:55:52 +0100,
Nicolas Goaziou wrote:
 
 Not really. If you look at `org-latex-publish-to-pdf' you will see that
 publishing is done differently: the binary file is generated, then
 published as an attachment.

Hi Nicolas,

Thanks so much for your help. This looks like exactly what I need.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to

2014-02-11 Thread Erik Hetzner
Hi,

I have been looking at publishing to HTML using pandoc. Because pandoc
requires post-processing to transform the org-mode markdown output to
other formats, it is necessary to use the post-process parameter of
org-export-to-file. Unfortunately, it is not currently possible to
pass post-process through to org-export-to-file via
org-publish-org-to. The attached patch allows this.

I think this patch makes sense; let me know what you think.

best, Erik
---
 lisp/ox-publish.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 9669bf0..9840bb6 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -558,7 +558,7 @@ matching filenames.
 
 ;;; Tools for publishing functions in back-ends
 
-(defun org-publish-org-to (backend filename extension plist optional pub-dir)
+(defun org-publish-org-to (backend filename extension plist optional pub-dir 
post-process)
   Publish an Org file to a specified back-end.
 
 BACKEND is a symbol representing the back-end used for
@@ -592,7 +592,8 @@ Return output file name.
  `(:filter-final-output
,(cons 'org-publish-collect-numbering
   (cons 'org-publish-collect-index
-(plist-get plist :filter-final-output
+(plist-get plist :filter-final-output)
+post-process)))
   ;; Remove opened buffer in the process.
   (unless visitingp (kill-buffer work-buffer)
 
-- 
1.8.3.2

-- 
Sent from my free software system http://fsf.org/.



Re: [O] How to not show repetitive tasks in agenda view of TODO

2014-01-23 Thread Erik Hetzner
At Thu, 23 Jan 2014 11:59:31 +0100,
Chaitanya Krishna wrote:
 
 Hello there,
 
 Maybe someone has already come across this problem. Any help is appreciated.
 
 I have some repetitive tasks which I schedule using the deadline approach.
 
 TODO Search for house
 DEADLINE: 2014-01-26 Sun +1w
 
 * Birthdays
 TODO Abc Abc
 DEADLINE: 2014-01-26 Sun +1y
 
 The problem is that all the birthdays and repetitive tasks are cluttering
 my view in agenda TODO items (C-c a t).
 
 Is it possible to make these items show up only in the agenda view (C-c a
 a) and not in the TODO items list (C-c a t)

Hi Chai,

I use a special keyword, REPEATING, so that repeating tasks are
filtered out of my TODO lists. But perhaps there is a better way.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] ox-md conforming pandoc-markdown

2014-01-22 Thread Erik Hetzner
Hi Michel,

At Tue, 21 Jan 2014 12:00:01 +0100,
Michel Kuhlmann wrote:
 
 Hi,
 I often convert files with `pandoc`. Currently there is no
 pandoc-org-mode-reader, so I'm using markdown as an intermediate step.
 
 I'm aware of https://github.com/robtillotson/org-pandoc.git; this
 also uses `ox-md`, so the issue applies also there.
 
 I found these issues inconvenient:
 
 - Listings create blank-lines in between
 + Currently
 - uno
- uno
- dos-  - dos
- tres
 - tres
 + Desired
- uno- uno
- dos-  - dos
- tres   - tres

This seems easy enough to fix, we simply need to add:

  (org-element-put-property item :post-blank nil)

to the org-md-item function. Can anybody tell me if this is a bad
idea? Otherwise I will send a patch.

 - customisable meta-data export (currently nothing exported) of, say,

 […]
 * pandoc header
 
 % myTitle
 % meMyself
 % 2014-01-21

Basic support for this is in the org-pandoc project, which bases its
export on ox-md but adds some additional features.

I’d like to expand org-pandoc to support more pandoc features,
including those you mention. I just pushed up a (very rudimentary)
change to my fork of this project to support proper table export for
pandoc as well.

  https://github.com/egh/org-pandoc

best, Erik
-- 
Sent from my free software system http://fsf.org/.



Re: [O] How to write medical journal articles with org-mode

2014-01-20 Thread Erik Hetzner
At Mon, 20 Jan 2014 02:54:08 -0500,
regcl wrote:
 
 
 I am looking for advice regarding how to write medical journal
 articles using org-mode.
 
 My primary motivations are the desire to ... automate the flow of data
 from computation to publication, avoid clerical errors, speed up the
 conversion of computational results to manuscript, and do 99.9% of my
 typing in emacs ;)

 […]

 So here are my questions...
 
 1) Has anyone out there used org-mode to produce medical journal
 articles (other than demonstration of reproducible research)?
 
 2) I am mystified by all of these org-reftex-... functions.  Can
 someone please point me to an overview of how to use
 bibtex/reftex/orgmode/emacs/etc as reference manager?
 
 3) How do I get references into MS word?
 
 Any other comments or suggestions would be most welcome.

Hi George,

For question 3, you might have a look at pandoc
(http://johnmacfarlane.net/pandoc/), which can convert from markdown
to docx (MS Word) with citation support. You might find it simpler to
export from org-mode to markdown and use pandoc to produce your docx
files, thus saving some steps above.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] How to write medical journal articles with org-mode

2014-01-20 Thread Erik Hetzner
At Mon, 20 Jan 2014 14:04:24 -0500,
regcl wrote:
 
 Erik Hetzner e...@e6h.org writes:
 
  At Mon, 20 Jan 2014 02:54:08 -0500,
  regcl wrote:
  
  3) How do I get references into MS word?
  
  Hi George,
 
  For question 3, you might have a look at pandoc
  (http://johnmacfarlane.net/pandoc/), which can convert from markdown
  to docx (MS Word) with citation support. You might find it simpler to
  export from org-mode to markdown and use pandoc to produce your docx
  files, thus saving some steps above.
 
  best, Erik
 
 Hi Erik, Thank you for the suggestion.  
 
 WRT this approach, I see that Rick Frankel has said ...
 
  From:Rick Frankel
  Subject: Re: [O] Org Table Export to Markdown Table Question
  Date:Thu, 09 Jan 2014 11:58:37 -0500
 
   On 2014-01-08 15:41, Aric wrote:
   I am trying to use org-mode now with R code in it to write
   manuscripts. That does unfortunately mean that it must be eventually
   exported to some doc format. I have been able to export to markdown and
   everything looks good in markdown (even previewed on github) with the
   exception of latex code which is not converted. However, using pandoc to
   convert the markdown to docx, the tables are not converted properly (all
   a single column).
  
  I'm not sure why you are using markdown as an intermediate file
  format. Org will export to latex, pdf (via latex) and openoffice odt
  (which can be exported from open/libre office to doc/docx.).
  
  Both the above exporters are much more mature that the markdown
  exporter.
  
  rick
  
 
 ... which makes me wonder... Has anyone out there tried this for a
 journal manuscript with figures, tables, and citations?
 
 If I want go with pandoc, would I be ahead to do ...
 
 org  latex  pandoc  docx ?
 
 Thanks, George

Hi George,

pandoc has very rich citation citation support, much better than
org-mode as far as I know. If you are exporting to LaTeX you can use
BibTeX or BibLaTeX which of course work well, but pandoc can handle
citation export to docx, odt, etc. using any citation style supported
by citeproc.

The problem is that org-mode exports tables in markdown as HTML
tables, not pandoc tables. It should be possible to modify the ox-md
exporter to support pandoc tables, but it looks a little tricky.

pandoc’s standard input is markdown, so you’re probably best sticking
with that, but you might be able to get org - latex - pandoc - docx
to work.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] Timestamps for a whole year, or a year and month

2013-12-30 Thread Erik Hetzner
At Sun, 29 Dec 2013 14:23:32 -0800,
Erik Hetzner wrote:
 
 Hi,
 
 I am trying to get together a configuration for taking notes for
 historical research using org mode. I think org mode could be very
 useful for this, with its many ways of presenting, sorting and
 searching information in orgmode files.
 
 One thing that has me a bit stuck, though, is timestamps that might
 represent a year. For instance, it would be nice to write:
 
   By 1849 the California Gold Rush had ...

Well, I think I’ve decided that my best bet here is to do the
following:

  By 1849 1849-01-01 the California Gold Rush had ...

This preserves the information that we are talking about the year
while giving me a time stamp I can use. Alternately one could use a
drawer to hide this information, or put it in the headline.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] Timestamps for a whole year, or a year and month

2013-12-30 Thread Erik Hetzner
At Mon, 30 Dec 2013 20:11:17 +,
Eric S Fraga wrote:
 
 Erik,
 
 I am not sure but I remember having a discussion about the problems with
 dates that precede time 0 in Unix which corresponds to 1 January
 1970.  See man page for ctime(3) for instance.
 
 I am currently offline (in the tunnel under the North Sea :-) so cannot
 find out what the conclusions of our discussion may have been.  Please
 search the mailing list on Worg.

Hi Eric,

This looks to be the main thread on the issue:

http://thread.gmane.org/gmane.emacs.orgmode/39206

I have set org-read-date-force-compatible-dates to nil and tested on
two different emacs, one 32 bit and one 64 bit:

  GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4) of 2013-10-03 on 
menkib, modified by Debian
  GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.6.4) of 2013-10-03 on 
elnath, modified by Debian

For the 64 bit system, I can get accurate dates back until 1583
(comparing with the calendar here:
http://www.arc.id.au/Calendar.html). This is just before the Gregorian
calendar was introduced. (Of course this depends on your locale :)
since some countries were a little slower introducing it.)

Using dates before that generates the wrong day of the week, but
doesn’t seem to cause an error. It seems that I am also able to enter
dates up until year  and get the correct day of the week (as
compared with the output of the cal command).

On the 32 bit machine using dates before 14 Dec 1901 or after 18 Jan
2038 throws an error:

  Debugger entered--Lisp error: (error Specified time is not representable)
encode-time(0 0 0 13 12 1901 (nil nil nil))

So using 32 bit emacs does seem to be a problem.

It is strange to me that dates before 1970 seem to work fine on both
machines.

best, Erik

-- 
Sent from my free software system http://fsf.org/.



[O] Timestamps for a whole year, or a year and month

2013-12-29 Thread Erik Hetzner
Hi,

I am trying to get together a configuration for taking notes for
historical research using org mode. I think org mode could be very
useful for this, with its many ways of presenting, sorting and
searching information in orgmode files.

One thing that has me a bit stuck, though, is timestamps that might
represent a year. For instance, it would be nice to write:

  By 1849 the California Gold Rush had ...

I’ve tried:

  By 1849-00-00 the California Gold Rush had ...

and this at least registers as a time stamp, but it doesn’t seem to
work (at least running M-x org-timeline on the file doesn’t seem to
find the entry).

I’ve tried ranges too:

  By 1849-01-01--1849-12-31 the California Gold Rush had ...

And this kind of works, but it’s pretty awkward. I’m also not sure I
want to see that entry for every date in 1849.

Is there any way to represent this in orgmode? I guess what I am
looking for is something that would show up on the first of the year
in a timeline, but would represent the fact that the year is being
treated as whole unit, and not a specific date.

Any ideas are welcome! Thanks.

best, Erik Hetzner

-- 
Sent from my free software system http://fsf.org/.



Re: [O] date next year

2013-12-23 Thread Erik Hetzner
At Fri, 20 Dec 2013 12:34:43 + (UTC),
Rene wrote:
 
 How can I set org-agenda-custom-commands so that I can get the tasks past a
 date in the coming year?
 
 Suppose I'm interested in things past next september.  This
 
   (y
Next year's appointments
tags TIMESTAMP=\2014-09-01\)
 
 works alright as long as we are before that date but won't work anymore next
 october.  I would have to modify my org config file each year.
 
 Is there a generic way to indicate next year?
 
 Thanks.

Hi Rene,

I don’t think there is a generic way, but you can use something like
this for your agenda view:

  (y
   Next year's appointments
   tags (format TIMESTAMP=\%s-09-01\  (+ 1 (calendar-extract-year 
(calendar-current-date)

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] org2blog problems.

2013-12-19 Thread Erik Hetzner
At Wed, 18 Dec 2013 18:03:19 +,
Sharon Kimble wrote:
 
 I have been attempting to use emacs org2blog but am now consistently
 getting this error report - 
 Contacting host: www.sharons.org.uk:80
 xml-rpc-xml-to-response: XML-RPC fault `Incorrect username or password.'
 
 I'm using '.netrc' and this is -
 machine host100
 myblog A taste of linux
 login boudiccas
 password rhubarbandcustard

Possibly this bug?

http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-09/msg01226.html

best, Erik

-- 
Sent from my free software system http://fsf.org/.



Re: [O] some movement on zotero!

2013-09-18 Thread Erik Hetzner
At Tue, 17 Sep 2013 03:59:36 -0400, Matt Price wrote:
 
 hi,
 
 Just found this:
 
 http://zotero-odf-scan.github.io/zotero-odf-scan/
 
 don't havetime to look thorugh it yet, but it looks like a way to
 write in org-mode and still use a zotero bibliography. It wil mean
 that odt is the only really usable export, though.
 
 I'd be interested to hear what other people think -- as I say,
 rushing to get some work done right now!

You can also export to markdown, and use the extractcites.py script
included with the zotxt extension [1] to generate a JSON bib file,
then process via pandoc. A little complicated, but it works. Just use
citations in pandoc format.

best, Erik

1. https://bitbucket.org/egh/zotxt
Sent from my free software system http://fsf.org/.


Re: [O] Let's discuss citation and Org syntax

2013-05-21 Thread Erik Hetzner
At Tue, 21 May 2013 19:55:53 +0200,
Viktor Rosenfeld wrote:
 
 Hi,
 
 Rasmus wrote:
 
  Hi, 
  
  Now that 8.0 has shipped let's talk bibliography support.  This
  follows directly upon the discussion around March[1].
 
 I did not follow the discussion in March and only skimmed through the
 recent discussion in May [2]. But I was wondering if bibliography
 support in the LaTeX exporter would be BibTex-only or if it would also
 support biblatex, for example.

And to further confuse the issue, why not consider pandoc style
citations [1]?

This works right now. Create an org file:

  See [@citekey, p. 10] for more info.

(assuming a bibtex, endnote, ris, ... file that contains a cite with
key “citekey”). Export to markdown. Process in pandoc, either to
latex:

  ❤ pandoc --natbib test.md -t latex -s --biblio test.bib

or to HTML, etc:

  ❤ pandoc test.md -s --biblio test.bib

While it would be nice to make this work natively with org, especially
with latex output, it would be great if compatibility with pandoc
could be obtained.

best, Erik

1. http://johnmacfarlane.net/pandoc/README.html#citation-rendering
Sent from my free software system http://fsf.org/.


Re: [O] Question regarding link text in HTML export

2013-04-24 Thread Erik Hetzner
At Wed, 24 Apr 2013 09:37:57 +0200,
Sebastien Vauban wrote:
 
 Hello Nicolas,
 
 Nicolas Goaziou wrote:
 
  This is not a bug. This is how cross references work: any link to an
  internal target without a description will become a number referring to
  the target. It works for headlines and many other things,
 
 He does well have a description part, doesn't he?

Thanks, Sebastien and Nicholas.

I should have checked the source first, of course. There is a very
helpful comment:

  ;; Case 1: Headline is numbered and LINK has no
  ;; description or LINK's description matches
  ;; headline's title.  Display section number.

Clearly the behavior is intended (“LINK’s description matches
headline’s title”. However, it does not seem expected behavior to me.
It differs from latex output, for instance.

best, Erik
Sent from my free software system http://fsf.org/.


[O] Question regarding link text in HTML export

2013-04-23 Thread Erik Hetzner
Hi,

When trying to export the following org file as HTML (C-e h o), using
out of the box latest org-mode:

```
* Foo
  :PROPERTIES:
  :ID:   aaccd0f3-3eff-4f38-ad83-bc51b8444d73
  :END:
* Bar
  :PROPERTIES:
  :ID:   0a428695-b829-4f8b-a689-1bc22491d13f
  :END:
Link to [[id:aaccd0f3-3eff-4f38-ad83-bc51b8444d73][Foo]].
```

the HTML looks like:

  ...
  Link to 1.

while I would expect it to say: “Link to Foo.”.

If I change the link text to anything other than “Foo”, e.g.,
[[id:aaccd0f3-3eff-4f38-ad83-bc51b8444d73][Baz]],
the link text is as expected.

This seems like a bug to me, but I may be mistaken! Thanks for any
help you can provide.

org-version = Org-mode version 8.0.1 (release_8.0.1-22-gfea4b5 @ 
/home/egh/.emacs.d/el-get-24.3.1/org-mode/lisp/)
emacs-version = GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.4) of 
2013-04-14 on marid, modified by Debian

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] Can I refile into a journal with file+datetree?

2013-02-23 Thread Erik Hetzner
At Fri, 22 Feb 2013 22:42:25 +0100,
Martin Stemplinger wrote:
 
 Hello Org wizards,
 
 I use org-capture with file+datetree for keeping a journal which
 works fine. I also use mobile-org to take notes while I'm on the go.
 After syncing them back I'd like to refile them into my journal with
 an appropriate date attached. Mobile org doesn't record the date I
 took the note so I'd just have all entries collected under the date
 I refile.
 
 Is there a way to do that? 

Hi Martin,

Maybe this will help?

http://punchagan.wordpress.com/2010/07/30/refile-to-date-tree/

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] org-gnome-calendar

2012-12-06 Thread Erik Hetzner
At Thu, 06 Dec 2012 09:51:07 -0600,
Christopher Allan Webber wrote:
 
 OH MY GOODNESS, this is VERY exciting to me!
 
 Do you have any screenshots of this in action?  I've been thinking of
 similar things for some time!

This can also be accomplished using org-caldav + setting up evolution
to sync with a caldav server.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] Bug in org-log-into-drawer

2012-10-29 Thread Erik Hetzner
At Mon, 29 Oct 2012 06:41:39 +0100,
Bastien wrote:
 
 Hi Erik and Sébastien,
 
 Erik Hetzner e...@e6h.org writes:
 
  The function org-log-into-drawer called the function org-entry-get
  with the inherit argument before I got there. (Maybe it needs to be
  added to that list?)
 
 I don't have time to look deeper in this issue.  Can one of you have a
 closer look at the manual and see if there is any inconsistency?

Hi Bastien,

org mode manual says:

  You can also overrule the setting of this variable for a subtree by
  setting a `LOG_INTO_DRAWER' property.

This sounds to me that LOG_INTO_DRAWER inheritance is intended. Even
if it is not, I would argue that LOG_INTO_DRAWER *should* apply to
subtrees, because otherwise one would have to set that property on
every TODO item.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] Bug in org-log-into-drawer

2012-10-29 Thread Erik Hetzner
At Mon, 29 Oct 2012 17:07:23 +0100,
Sebastien Vauban wrote:
 
 Hello Erik and Bastien,

 […]

 I share your point...
 
 But do we all agree that your original example had to fail when
 LOG_INTO_DRAWER is not inherited?[1]
 
 Or do I miss some point?
 
 Seb

Hi Sebastien,

Yes, I had a bad example. But the function org-log-into-drawer would
not work (before my patch) on the following example either:

  * TODO Foo
:PROPERTIES:
:LOG_INTO_DRAWER: nil
:END:

The issue was with the distinction between the value nil and string
nil. org-entry-get (without an additional arg) will return the value
nil in the above example, which meant that the value of
org-log-into-drawer (t) was not being overidden.

best, Erik

Sent from my free software system http://fsf.org/.


[O] Bug in org-log-into-drawer

2012-10-27 Thread Erik Hetzner
Hi,

Current the org-log-into-drawer function does not honor the value of
the LOG_INTO_DRAWER property if the property has the value nil. For
example, if the org-log-into-drawer variable is set to t, but we have
the file:

  * Foo
:PROPERTIES:
:LOG_INTO_DRAWER: nil
:END:
  ** TODO Bar

org-mode will log changes to the TODO entry into a drawer. The
attached patch fixes the issue, allowing a nil value of the
LOG_INTO_DRAWER property to override a t value of the
org-log-into-drawer variable.

best, Erik

diff --git a/lisp/org.el b/lisp/org.el
index 4e79125..2aa70bd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2519,9 +2519,10 @@ a subtree.
   Return the value of `org-log-into-drawer', but let properties overrule.
 If the current entry has or inherits a LOG_INTO_DRAWER property, it will be
 used instead of the default value.
-  (let ((p (org-entry-get nil LOG_INTO_DRAWER 'inherit)))
+  (let ((p (org-entry-get nil LOG_INTO_DRAWER 'inherit t)))
 (cond
- ((or (not p) (equal p nil)) org-log-into-drawer)
+ ((not p) org-log-into-drawer)
+ ((equal p nil) nil)
  ((equal p t) LOGBOOK)
  (t p
 
Sent from my free software system http://fsf.org/.


Re: [O] Bug in org-log-into-drawer

2012-10-27 Thread Erik Hetzner
At Sat, 27 Oct 2012 11:00:40 +0200,
Sebastien Vauban wrote:
 
 Hello Erik,
 
 I would have said that this does make sense, as the property LOG_INTO_DRAWER
 is not inherited by the TODO entry, does it?
 
 See http://orgmode.org/manual/Property-inheritance.html for the few Org
 properties for which inheritance is hard-coded.
 
  The attached patch fixes the issue, allowing a nil value of the
  LOG_INTO_DRAWER property to override a t value of the org-log-into-drawer
  variable.

Hi Seb,

The function org-log-into-drawer called the function org-entry-get
with the inherit argument before I got there. (Maybe it needs to be
added to that list?) This issue had to do with the difference between
the string nil (as supplied in the property) and the value nil
(meaning no property was found).

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] New user, my use case, request basic advice

2012-09-26 Thread Erik Hetzner
At Mon, 17 Sep 2012 12:03:58 -0700,
David Rogers wrote:
 
 Hi
 
 I'm gradually getting accustomed to org-mode; thanks to all those whose
 work makes this great software keep getting even better.
 
 I've been trying to figure out how to integrate org-mode into my
 gadgets and my situation, and realize that I've been thinking about
 it upside down. The missing piece of the puzzle, for me, the thing I
 don't know how to accomplish, is the most important one to have. So,
 here's what I've got and what I'm trying to do:

 […]

 Thanks for any thoughts or advice on how this might be done.

Hi David,

My setup, for slightly different goals, but which could probably meet
your needs, is as follows.

I keep my computers (laptop, work desktop,  server) notes directory
(which contain my org files) synced using gitdocs [1]. This means that
I always have the same org files on each machine. You could use the
same setup to keep your org files synced with a server and use the
rest of the setup below to accomplish mobile syncing.

(Some remarks on gitdocs follow. Disadvantages: if I leave an org file
open on one machine, and it gets updated on another, emacs complains
because the file has changed. Alternatives: sync using dropbox.)

I have an android phone, on which I use mobileorg. I use this, as near
as I can tell, in the ordinary way, except that I run
org-mobile-pull/push in crontabs on a server (actually, I just set
this up, but it seems to work). Because my notes are synced (via
gitdocs) across computers, this works fine.

  15 * * * * emacs24 --batch -l /home/egh/.emacs --eval (org-mobile-pull)
  20 * * * * emacs24 --batch -l /home/egh/.emacs --eval (org-mobile-push)

I use org-caldav to sync my events to a google calendar. This is
connected to my calendar on android. I suppose that I could use the
mobileorg sync calendar function, but this seemed safer. My phone has
a widget on the main screen that displays my next appointment. I
assume that getting audible notifications is just a matter of
settings.

I run the caldav sync on my server [2] every hour, using the
following:

  10 * * * * emacs24 --batch -l /home/egh/.emacs --eval (load-library 
\org-caldav\) --eval (org-caldav-sync)  /dev/null 21

Because my server’s notes dir is synced (using gitdocs) with my laptop
 desktop, if I add an appointment on my laptop or desktop, it should
be pushed to my google calendar in an hour at most.

For the record, I also run the following:

  0 5 * * * emacs --batch -l /home/egh/.emacs --eval 
(org-batch-store-agenda-views)  /dev/null 21  mailx -s Agenda 
e...@e6h.org  /tmp/agenda_schedule_day

This generates an agenda  emails it to me daily. Furthermore, my
agenda is pushed to an HTTP server, and I use it as my home page. So I
look at it every time I see a new browser window.

Hope that helps!

best, Erik

1. https://github.com/bazaarlabs/gitdocs
2. Note that getting credentials set up is a little tricky. See
https://github.com/dengste/org-caldav/issues/2
Sent from my free software system http://fsf.org/.


Re: [O] org-capture-templates file+datetree+prompt question

2011-12-11 Thread Erik Hetzner
At Tue, 6 Dec 2011 09:26:03 +0100,
Carsten Dominik wrote:
 
 Hi Erik,
 
 if yout get the latest git version, this is how it is working now.
 I agree that it is more consistent this way.

Hi Carten,

Thanks again for this fix.

I have noticed that using k c ... (where ... is a capture template
utilizing file+datetree+prompt) in the agenda now prompts for a
date. Is this intended behavior?

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] org-capture-templates file+datetree+prompt question

2011-12-11 Thread Erik Hetzner
At Mon, 12 Dec 2011 00:18:34 +0100,
Bastien wrote:
 
 Hi Erik,
 
 Erik Hetzner e...@e6h.org writes:
 
  Thanks again for this fix.
 
  I have noticed that using k c ... (where ... is a capture template
  utilizing file+datetree+prompt) in the agenda now prompts for a
  date. Is this intended behavior?
 
 I can't reproduce this -- I used the capture setting you mentioned
 earlier in this thread.  Can you provide a minimal test/config file 
 and the steps to reproduce with latest Org from git?

Hi Bastien,

My apologies, you are correct. I made two errors:

1. My calendar capture template actually looked like this:

  (c Calendar entry (file+datetree+prompt ~/s/notes/calendar.org Inbox)
   * %^{What?}\n%t\n%?)

The “Inbox” part was accidentally copied from another template. This
seems to have caused the problem.

2. My other capture template that used file+datetree+prompt that
experienced this behavior actually had a %^t in the template. Whoops!

Thank you so much for looking into this.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] org-capture-templates file+datetree+prompt question

2011-12-06 Thread Erik Hetzner
At Tue, 6 Dec 2011 08:43:34 +0100,
Carsten Dominik wrote:
 
 
 On 6.12.2011, at 07:04, Erik Hetzner wrote:
 
  Hi all,
  
  I would like to use a capture template to capture calendar entries 
  file them to a date tree organized calendar.org file.

 […]

 I tried to reproduce this.  When I do this and enter the date two
 days into the future (8 December), I get
 
 * 2011
 ** 2011-12 Dezember
 *** 2011-12-08 Donnerstag
  Test
  2011-12-06 Di
 
 So the headline uses in fact the date that was entered at the prompt,
 only the %t is replaced by the current date.  I would think this
 all works as expected.  Maybe I am missing something?
 
 I see that when I do k c from the agenda, then indeed also the %t
 is replaced with the cursor date.  So indeed, this is a bit
 inconsistent.  What would be the right behavior?

Hi Carsten,

Maybe it does work as expected (although it should probably be
consistent, as you say). What I am looking for is some way to get the
date I was prompted for to use in the timestamp, so I get:

* 2011
** 2011-12 December
*** 2011-12-08 Thursday
 Test
 2011-12-08 Thursday

the idea being that I am entering a scheduled event.

I can’t figure a template replacement string (%-something) to make
this work.

Thanks for your help!

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] org-capture-templates file+datetree+prompt question

2011-12-06 Thread Erik Hetzner
At Tue, 6 Dec 2011 09:26:03 +0100,
Carsten Dominik wrote:
 
 Hi Erik,
 
 if yout get the latest git version, this is how it is working now.
 I agree that it is more consistent this way.

Thanks, Carsten! I haven’t upgraded, but I copied the diff into my
org-capture.el, and it works great.

best, Erik
Sent from my free software system http://fsf.org/.


[O] org-capture-templates file+datetree+prompt question

2011-12-05 Thread Erik Hetzner
Hi all,

I would like to use a capture template to capture calendar entries 
file them to a date tree organized calendar.org file.

Specifically, what I want to happen is this: the template prompts me
for a date, then prompts me for headline. The date should be used for
the datetree  used as a datestamp in the headline.

I have tried the following template:

  (setq org-capture-templates
'((c Calendar entry (file+datetree+prompt ~/s/notes/calendar.org)
   * %^{What?}\n%t\n%?)))

What happens with this is that I get prompted for a date, which is
used to file the entry in the datetree, but the date in the headline
is always today’s date.

If I use `k c` in the agenda (org-agenda-action) this works as
expected, with no prompting for a date, the entry filed properly in
the datetree, and the date in the headline set properly.

Any thoughts on how to fix this?

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] org-capture-templates file+datetree+prompt question

2011-12-05 Thread Erik Hetzner
At Mon, 05 Dec 2011 22:04:33 -0800,
Erik Hetzner wrote:
 
 Hi all,
 
 I would like to use a capture template to capture calendar entries 
 file them to a date tree organized calendar.org file.

Sorry, this is with org-mode 7.7, emacs 23.2.1, Ubuntu 11.04.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] How to say I did that yesterday?

2011-11-22 Thread Erik Hetzner
At Tue, 22 Nov 2011 11:40:35 -0800,
Dave Abrahams wrote:
 
 
 I often discover that I completed something a few days ago and I would
 like to mark it done with the appropriate date as though I had marked it
 done in the past.  That means, e.g., for a repeating event it might
 repeat sooner than if it had been done today.  Is there a way?

M-x org-todo-yesterday ?

If there is a way to do this for days further in the past, I would
welcome it! I also find myself wanting to do this often. Right now I
just mark it done, then manually adjust the log entries.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] HTML export and Zotero-friendly headers

2011-11-21 Thread Erik Hetzner
At Mon, 21 Nov 2011 13:14:02 -0800,
Erik L. Arneson wrote:
 
 On Mon, 21 Nov 2011, Christian Moe wrote:
  Hi,
 
  Does Erik Hetzner's zotero-plain work for you?
 
 I thought zotero-plain was used to add citations.  What I'm trying to do
 is use org-mode to export HTML files with Zotero-friendly headers that
 the Zotero plugin will pick-up on in the browser.
 
 I can make the COinS span snippets myself using the tool available on
 the COinS website, but it would be handy if org-mode could do that
 automatically using the org header data that already exists.

Hi Erik,

There has been some discussion recently of export to ODT with
citations. Jambunathan K has outlined a way of doing this using a
binary added to zotero-plain, zotcite. This might be repurposed for an
HTML export.

best, Erik

Sent from my free software system http://fsf.org/.


Re: [O] zotero-cite (A Proposal)

2011-11-15 Thread Erik Hetzner
Hi Jambunathan,

Sorry I took some time to reply. Some answers are below.

At Sat, 12 Nov 2011 02:04:52 +0530,
Jambunathan K wrote:
 
 Hello Erik
 
 Good news. 
 
 Getting a frugal Zotero-based citations is *definitely* possible. It is
 just a matter of time. Your libraries already provide the necessary
 plumbing to accomplish the job. 
 
 Long story
 ==
 
 For my own understanding, I tried trimming down zot4rst to it's bare
 essentials and the attached zotcite.py is the result.

That looks like the essence. Most of the code in zot4rst, as you saw,
deals with interacting with the docutils system and generating output.

 What zotcite does is this: 
 
 For two Zotero Items, it prints their Bibliogrpahic entries and their
 Citation Reference, in Text format using Chicago-Author-Date style.
 
 I believe a commandline interface could be built around this file along
 the following lines. (Will you be interested in building this interface
 for us?)
 
 $ zotcite --style chicago --format text --items I1, I2 --print biblio
 $ zotcite --style chicago --format text --items I1, I2 --print citeref

 Once this is done, Emacs/Org can do invoke zotcite and get the required
 Bibliographic definitions and references using shell-command.

I’ve adapted your script into a command line program, now included
with zotero-plain. The options are slightly different, and --format
does not work yet, but the essence is there.

Of course it requires the user to have python, etc. installed, but it
is probably easier than rewriting everything in emacs lisp.
 
 The assumption is that Emacs/Org somehow has captured zotero keys
 through org-protocol or org-zotero.el or someother means.
 
 Here is a output from zotcite.py.
 
 […]
 
 IIRC, I made two changes to the export.js in your Javascript backend.
 
 1. I had trouble understanding the organization of citation clusters. So
I modified getCitationBlock as below. Note the use of true as a
second param of the appendCitationCluster. This is OK as
registerItemIds already does updateItems().

Thanks for catching this. That might speed things up a bit.

 […]
 
 2. There should be way to set the output format form python side of
things. I had to modify instantiateCiteProc by hand to set the output
format to text. You know what output format that LibreOffice plugin
uses? I see text, html and rtf as output formats. But not ODT.
See https://bitbucket.org/fbennett/citeproc-js/src/tip/src/formats.js

Sure, this would be easy.

I don’t know how the LibreOffice plugin works. It doesn’t take much
code, however, to translate the HTML output into something else.

 […]
 
 Btw, I found that with my 2-day old zotero database and for printing the
 above 2 keys, the whole machinery takes a perceivably a lot of time. Is
 this your experience as well? I am not a netbook.

Yes, it is slow for me too. I wish it were faster. I don’t know if the
issue is jsbridge, or something else.

Ideally I would prefer to simply fetch citations information (as JSON,
for instance) from Zotero and process in an embedded citeproc-js
instance.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-15 Thread Erik Hetzner
At Sat, 12 Nov 2011 02:43:12 +0530,
Jambunathan K wrote:
 
 
 Erik

 […]

 Here is what I find:
 
 If I put the below snippet in a javascript buffer and do a M-x
 send-region, I am able to retrieve the library and key of the selected
 item.

 […]

 The problem is in zotero-js-write-to-file. The problem happens even
 after I increase the sleep out time to 1 sec.
 
 See the attached backtrace with With M-x toggle-debug-on-quit RET and a
 C-g
 
 I wonder whether the issue is related to we - Matt(?), Christian(?) and
 I - using Windows.
 
 As can be seen from the transaction log, the shell interaction is
 fine. I am inclined to think that it has something to do with zotero.el.
 
 I am wondering whether there is a way to capture the selected item as
 a zotero link through the jsbridge interface. Anyways with massaging of
 org-protocol we can get a zotero select link by viewing the report
 of the current item.
Hi,

Thanks for all the info. It appears that the file is not being
created by Zotero, but I cannot figure why.

I can’t really pursue this much, since I am unable to reproduce. If
anybody has any thoughts, I would love to hear them!

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-11 Thread Erik Hetzner
At Fri, 11 Nov 2011 10:51:22 -0500,
Matt Price wrote:
 
 Responding to just a few of the excellent points raised by J 7 E

 On Thu, Nov 10, 2011 at 12:48 PM, Erik Hetzner e...@e6h.org wrote:
 
  At Thu, 10 Nov 2011 20:47:30 +0530,
  Jambunathan K wrote:
  
  
  I should note that while the org/zotero integration in zotero-plain
  “works for me”, I would welcome changes to make it more robust and
  feature-full. But I use org for notes and todo lists, not for document
  production.

This is me you are quoting, for the record.

 I'm trying to switch to using org for most of my writing; among other
 things, I now use it for posting to wordpress and (hopefully soon) drupal,
 where most of my teaching work takes place. So I htink there's a case to
 make for org as a person's main workspace.

Definitely! Whatever works for you. I prefer the reStructuredText
syntax for longer documents, so getting real citations working in
org-mode is not a real priority for me. That’s all.

 Wouldn't the rigt target be, not the sqlite db, but the Zoteor *service*
 that runs on port 50001 when Zotero is running?  Aren't there some
 higher-level tools for working through that interface -- e.g., erik, your
 rst tool uses a python library, does it talk to Zotero that way?

the server that runs on port 50001 is undocumented, last I
checked. And there are no tools to connect to it. Frank Bennett put
together a hack of the jsbridge Firefox extension which works quite
well. [1] But that is python only, as far as I can tell.

 […]
 
 so, couldn't one think of the problem as having three parts:
 (1) get emacs to talk to the zotero server; and
 (2) figure out how org/emacs should interact with citeproc
 (3) translate the org zotero links into a syntax that LibreOffice
 recognizes and can successfully manipulate

I think that is a good summary of what needs to be done. (3) is what
zot4rst does not bother to do.

The task of weaving together the HTML output from citeproc and your
export document can be tricky.

 and am I further right that, as an interim measure, solving (1) and (3)
 properly and throwing together a quick hack for (2)  -- in which org
 supports exactly one, very simple citation style -- would make a workflow
 possible in which a person could compose in Org, and translate to ODT for
 the final processing of a document, and/or export to HTML using only the
 one citaqtion style that is supported by the aforementioned hack?

 […]

Yeah, that makes sense. I think (3) is optional as well, depending on
what your workflow looks like, and what your needs are for doing final edits.

best, Erik

1. https://github.com/mozautomation/mozmill
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-11 Thread Erik Hetzner
At Fri, 11 Nov 2011 10:37:03 -0500,
Matt Price wrote:
 
 Similar for me -- the Org buffer hangs, and MozRepl looks like it's
 just been sitting there idly.
 
 also on the most recent MozRepl, emacs 24, fairly recent org-mode, firefox
 8, ubuntu 10.10.

I was going to suggest this sounds like a problem with Emacs 24, but I
installed Emacs 24  it works for me. I am using Firefox 7, but I
doubt that is much of an issue.

I assume that you have started MozRepl and selected an item to insert
in Zotero?

best, Erik

Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-11 Thread Erik Hetzner
At Fri, 11 Nov 2011 13:45:27 -0500,
Matt Price wrote:
 
 On Fri, Nov 11, 2011 at 11:12 AM, Erik Hetzner e...@e6h.org wrote:

 […]

 if tricky for you, then likely unmanageable for me.   but I wonder if
 Zotero themselves would be interested in helping a little bit with some of
 this work?  Seems sort of strange to build this great tool and then limit
 its usefulness to two hulking word processors, when really the goal of
 portable, reformattable citations applies just as much to text and html as
 to word processing documents.

Agreed, but I think that Word, Open/LibreOffice, and LaTeX cover most
use cases. I don’t think the Zotero people have the time to do any
extra work, but they are almost helpful answering questions.

pandoc has similar support for citations and is worth taking a look
at. It requires export from Zotero, but this can be automated.

-Erik
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-10 Thread Erik Hetzner
Hi Jambunathan,

Thanks for the very detailed reply. Some responses below.

In your previous message, you asked who the author of zotero.el is. I
am. I will add author info.

At Thu, 10 Nov 2011 20:47:30 +0530,
Jambunathan K wrote:
 
 I think I now have some understanding of what Erik's library does[1]. 
 
 It creates a bibliographic entry (as in Footnotes) using Quick Copy.  It
 doesn not create a footnote reference. One can use the Firefox Zotero
 and see how Quick Copy works with both RTF and HTML formats[2].

This is correct. I should note that this method is totally inadequate,
as Frank Bennett showed me, for the generation of documents formatting
according to the various style guides. It cannot handle in-text
citations, bibliographies, or cross references. To get some idea of
how this happens in zot4rst (part of zotero-plain), see [1].

I should also note that this process is complicated, involving a
number of steps. Have a look at the python dir in zotero-plain to get
an idea.

 [Question to Erik: Can one not use Copy from Clipboard from elisp
 instead of going the mozrepl route to create a biblio.text]

Yes, but then one cannot select an item in Zotero and insert a link
into an org doc from org itself.

I should note that while the org/zotero integration in zotero-plain
“works for me”, I would welcome changes to make it more robust and
feature-full. But I use org for notes and todo lists, not for document
production.

 Instead of working with JS libraries, I think the right starting point
 would be to work with the underlying zotero.sqlite database itself. It
 is not difficult to get a key of the selected item in Zotero
 pane[3]. Once this is done the underlying zotero.sqlite database could
 be queried for the item properties[4].
 
 Fortunately there is already a GUI/Command line tool - Gnotero[5] -for
 accessing the sqlite database.

This would certainly work. However, one problem would be that gnotero
cannot generate formatted citations from a reference, that is, it
cannot use CSL [2] style rules to generate arbitrary citation
formats. This might be fine; some simple c
 
 As for exploiting the power of using zotero within libreoffice - which
 is to have the same citation presented in different citation styles -
 one need to look at how the reference marks are produced within
 OpenDocument XML.

Not only that, but how the LibreOffice plugin communicates with
Zotero, specifically the citeproc-js [1] part of Zotero, to generate
in-text citations, bibliographies, etc.

 […]

 Footnotes: 
 
 [1]  With Mozrepl 1.1 beta2 on Firefox 3.6.23, I am unable to make
 org-zotero.el work. It hangs and I have to C-g out (Christian! you are
 not alone). I am able to get as far as creating the LIBRARY_KEY for the
 selected item in the zotero pane and not further.

 […]

Have you started MozRepl from Firefox? I re-installed mozrepl, checked
that I am using the latest (and unmodified) versions of moz.el and
zotero-plain. Everything seems fine. This is with Emacs 23 - perhaps
Emacs 24 changes things?

best, Erik

1. http://gsl-nagoya-u.net/http/pub/citeproc-doc.html
2. http://www.zotero.org/styles
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-09 Thread Erik Hetzner
At Wed, 9 Nov 2011 10:28:21 -0500,
Matt Price wrote:
 
 attached is a sample odt file with Zotero citations included. It's very
 simple, actually, because I think the key to making something like this
 work would be to offload as much work as possible to zotero itself -- Erik,
 correct me if I'm wrong (quite likely).

Hi,

Thanks for the sample ODT file.

I would like to clarify a few issues that have been raised:

zotero-plain consists of 2 very separate parts: emacs/zotero
integration and docutils/zotero integration (zot4rst). zot4rst is far
more advanced.

zot4rst provides extensions for docutils that allow a user to include
zotero citations in reStructuredText documents. For example:

  :xcite:`[@item1, p. 30]` says blah.

When the user employs the zrst2{pdf,odt,...} tools, docutils connects
to a running Firefox instance (using jsbride  a custom zot4rst
Firefox plugin) and uses Zotero to format citations  bibliographies
(in this case, for @item1, p. 30). When generating an ODT file, this
does *not* use the standard OpenOffice/Zotero integration, but rather
uses Zotero to generate HTML citations, transforms the HTML citations
into docutils internal format, and then uses the rst2odt code to
transform that into an ODT document. So while it might be possible to
include the necessary information that make the standard
OpenOffice/Zotero plugin work, it would probably be difficult.

The Emacs/Zotero integration is far less advanced. It uses MozRepl,
which is flaky, and includes code to insert  update  follow links, 
generate citations into org docs. Here is an example link:

  [[zotero://select//0_83KCW6AU][Rediker, Marcus. The Slave Ship: A Human 
History. Viking Adult, 2007.]]

This link can be automatically inserted, and can be followed using C-c
C-o, which selects the item in Zotero.

This is *all* the org-mode integration does at present. This serves my
needs (note-taking) and I probably won’t do any enhancements (patches
are welcome!) Keep in mind that citations are tricky: if you want to
transform org citations into publishable documents you want to be able
to handle footnote  in-text citations (it depends on the style) and
bibliographies. Have a look at the python zot4rst code to get an idea
of what is required. If people want org - odt transformations, it is
going to be difficult.

I hope that helps!

best, Erik

PS: 

 erik, I'm having trouble making contact with mozrepl from emacs.
 given recent developments in Zotero, it would probably be better to have
 zotero.el speak directly to the Zotero server instead of working through
 firefox -- do you agree, Erik? But I imagine that is a significant
 undertaking.

There really is no Zotero server at the moment. The API at zotero.org
does not support bibliography generation, and the internal server that
Zotero provides locally is not documented.
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-09 Thread Erik Hetzner
At Wed, 09 Nov 2011 20:39:18 +0100,
Christian Moe wrote:
 
 Hi,
 
 Is zotero-plain working for others?
 
 I test drove zotero-plain back when it was just developed. Looked 
 promising, but I had uneven success with the MozRepl communication, 
 possibly something to do with being on an older and slower machine.
 
 Trying it again today (with the most recent zotero-plain, MozRepl and 
 moz.el I could find), I press `C-c z i' to insert a citation and 
 nothing happens. Well, the Org buffer hangs until I press C-g, and 
 except that the *MozRepl* buffer says Process MozRepl deleted.

Hi Christian,

It works for me, with MozRepl 1.1beta2, and the latest Zotero plain.

MozRepl communication *is* not very good.

best, Erik
Sent from my free software system http://fsf.org/.


Re: [O] zotero plain, org-odt, and citations in general

2011-11-08 Thread Erik Hetzner
At Tue, 8 Nov 2011 21:06:37 -0500,
Matt Price wrote:
 
 Hi everyone,
 
 I am about to start experimenting with Erik Hetzner's zotero-plain, which
 allows the use of zotero as a bibliographic manager in emacs  especially
 org-mode (https://bitbucket.org/egh/zotero-plain as well as a couple of
 threads on this list, I think).  I'm wonderinghow other people have used
 it, and in particular whether there's any way to preserve the zotero markup
 across exports to odt especially. That is, I'd like to keep the original
 citations embedded in the final odt, so that I can continue to use zotero
 in an odt or doc file after it's been exported from org.
 
 This would take me very , very close to a complete org-centric workflow
 that still lets me produce documents for consumption by my MS-using
 colleagues.  I really hope it's possible to do! If anyone has done it, I
 would really love to hear about it.

Hi Matt,

org-mode support in Zotero plain has not received as much work
recently as the docutils (reStructuredText) support. Basically all
that one can do in org-mode at the moment is insert  update
citations, and following citation links to the entry in Zotero.

zot4rst (docutils) support can transform rst documents into odt
documents with citations generated by Zotero. [1]

It might be possible to implement something similar in the org-mode
Zotero, but I don’t know how, and it might be difficult.

best, Erik

1. However, it should be noted that this support is different from
that provided by the OpenOffice plugin, and one cannot edit a document
generated from a rst file using the Zotero/OpenOffice plugin.

Sent from my free software system http://fsf.org/.


Re: [O] Using org-mode for recipes (i.e. cooking)

2011-07-26 Thread Erik Hetzner
At Tue, 26 Jul 2011 14:57:31 -0500,
John Hendy wrote:
 
 On Tue, Jul 26, 2011 at 2:03 PM, Eric Schulte schulte.e...@gmail.com wrote:

 […]
 
 I wouldn't mind seeing this, either. I've looked for a while at trying
 to input my wife's recipes into something for her that would be
 printable/exportable into perhaps a small binder or card box or
 something. I've played around with gourmet with varying success but
 not been entirely happy. It's been buggy for me when it comes to
 printing.[1] At the very least, someone can try it out for it's
 converting/unit suggestions, as they are fantastic.
 
 Most here may work directly from org, but if recipes *are*
 implemented, an exporter or two for half-page or index card sizes
 would be *phenomenal.*

Hi,

I can’t help with printing (which would be nice). But I have put my
code on gitorious:

  https://gitorious.org/org-cook/org-cook

It currently does metric/english conversion, and a few other
tricks. Basically I just use calc’s units code. I think scaling
recipes, or turning percentages into weights would be pretty easy.

There is also, for those interested:

  https://gitorious.org/org-brew/org-brew

for brewing beer. This is again, mostly just calc functions, including
hydrometer correction, abv calculation, priming sugar for a given CO_2
volume, etc. More integration with org-mode should be possible: for
instance it would be nice to be able to use a lookup table (of
ingredients) to calculate target original gravity, IBUs, etc.

Any thoughts or pull requests on either are appreciated!

(Please do continue to CC me, as I read the list via gmane and may
miss messages.)

best, Erik
Sent from my free software system http://fsf.org/.


  1   2   >