[O] [PATCH 0/3] Support week trees in datetree/capture

2015-09-02 Thread Rüdiger Sonderfeld
Hello,

this series of patches adds support for ISO week trees in org-datetree and
subsequently in org-capture.  Week trees differ from regular date trees
because they are ordered by week and not by month.

Example

* 2015
** 2015-W35
** 2015-W36
*** 2015-08-31 Monday

(I did try to send those patches on Monday.  But it appears they were lost)

Cheers,
Rüdiger

Rüdiger Sonderfeld (3):
  org-datetree.el: Code cleanup.
  org-datetree.el: Add support for ISO week trees.
  org-capture.el: Add support for week trees.

 doc/org.texi  |   7 +++
 lisp/org-capture.el   |  26 ++--
 lisp/org-datetree.el  | 129 +++---
 testing/lisp/test-org-datetree.el | 101 +
 4 files changed, 194 insertions(+), 69 deletions(-)

-- 
2.5.1




[O] [PATCH 1/3] org-datetree.el: Code cleanup.

2015-09-02 Thread Rüdiger Sonderfeld
* lisp/org-datetree.el (org-datetree--find-create): New function.
(org-datetree-find-year-create, org-datetree-find-month-create,
org-datetree-find-day-create): Removed functions
(org-datetree-find-date-create): Use `org-datetree--find-create' instead
of removed functions.  Use calendar extract functions.
(org-datetree-insert-line): Do more formatting in `format-time-string'
since we call it anyway
* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
  Test if new entries are put at the right place.
---
 lisp/org-datetree.el  | 77 +--
 testing/lisp/test-org-datetree.el |  9 +
 2 files changed, 27 insertions(+), 59 deletions(-)

diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index a97a9d0..3620bbd 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -64,67 +64,30 @@ (defun org-datetree-find-date-create (date &optional 
keep-restriction)
   (org-get-valid-level (org-current-level) 1))
(org-narrow-to-subtree)))
 (goto-char (point-min))
-(let ((year (nth 2 date))
- (month (car date))
- (day (nth 1 date)))
-  (org-datetree-find-year-create year)
-  (org-datetree-find-month-create year month)
-  (org-datetree-find-day-create year month day
-
-(defun org-datetree-find-year-create (year)
-  "Find the YEAR datetree or create it."
-  (let ((re "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ 
\t]:[[:alnum:]:_@#%]+:\\)?\\s-*$\\)")
+(let ((year (calendar-extract-year date))
+ (month (calendar-extract-month date))
+ (day (calendar-extract-day date)))
+  (org-datetree--find-create "^\\*+[ 
\t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"
+year)
+  (org-datetree--find-create "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$"
+year month)
+  (org-datetree--find-create "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
+year month day
+
+(defun org-datetree--find-create (regex year &optional month day)
+  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY."
+  (let ((re (format regex year month day))
match)
 (goto-char (point-min))
 (while (and (setq match (re-search-forward re nil t))
(goto-char (match-beginning 1))
-   (< (string-to-number (match-string 1)) year)))
+   (< (string-to-number (match-string 1)) (or day month year
 (cond
  ((not match)
   (goto-char (point-max))
-  (or (bolp) (newline))
-  (org-datetree-insert-line year))
- ((= (string-to-number (match-string 1)) year)
-  (goto-char (point-at-bol)))
- (t
-  (beginning-of-line 1)
-  (org-datetree-insert-line year)
-
-(defun org-datetree-find-month-create (year month)
-  "Find the datetree for YEAR and MONTH or create it."
-  (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$" year))
-   match)
-(goto-char (point-min))
-(while (and (setq match (re-search-forward re nil t))
-   (goto-char (match-beginning 1))
-   (< (string-to-number (match-string 1)) month)))
-(cond
- ((not match)
-  (goto-char (point-max))
-  (or (bolp) (newline))
-  (org-datetree-insert-line year month))
- ((= (string-to-number (match-string 1)) month)
-  (goto-char (point-at-bol)))
- (t
-  (beginning-of-line 1)
-  (org-datetree-insert-line year month)
-
-(defun org-datetree-find-day-create (year month day)
-  "Find the datetree for YEAR, MONTH and DAY or create it."
-  (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))
-   match)
-(goto-char (point-min))
-(while (and (setq match (re-search-forward re nil t))
-   (goto-char (match-beginning 1))
-   (< (string-to-number (match-string 1)) day)))
-(cond
- ((not match)
-  (goto-char (point-max))
-  (or (bolp) (newline))
+  (unless (bolp) (newline))
   (org-datetree-insert-line year month day))
- ((= (string-to-number (match-string 1)) day)
+ ((= (string-to-number (match-string 1)) (or day month year))
   (goto-char (point-at-bol)))
  (t
   (beginning-of-line 1)
@@ -139,13 +102,9 @@ (defun org-datetree-insert-line (year &optional month day)
   (insert (format "%d" year))
   (when month
 (insert
- (format "-%02d" month)
  (if day
-(format "-%02d %s"
-day
-(format-time-string "%A" (encode-time 0 0 0 day month year)))
-   (format " %s"
-  (format-time-string "%B" (encode-time 0 0 0 1 month year))
+(format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year))
+   (format-time-string "-%m %B" (encode-time 0 0 0 1 month year)
   (when (and day org-datetree-add-timestamp)
 (save-excursion
   (insert "\n")
di

[O] [PATCH 2/3] org-datetree.el: Add support for ISO week trees.

2015-09-02 Thread Rüdiger Sonderfeld
* lisp/org-datetree.el (org-datetree-find-iso-date-create): New function.
(org-datetree--find-create): Support fixed text for insert.
(org-datetree-insert-line): Support fixed text for insert.
* testing/lisp/test-org-datetree.el (test-org-datetree/find-iso-date-create):
New test.

ISO week trees order dates by week and not by month.
---
 lisp/org-datetree.el  | 64 ++-
 testing/lisp/test-org-datetree.el | 92 +++
 2 files changed, 145 insertions(+), 11 deletions(-)

diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index 3620bbd..a5a542e 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -74,8 +74,48 @@ (defun org-datetree-find-date-create (date &optional 
keep-restriction)
   (org-datetree--find-create "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
 year month day
 
-(defun org-datetree--find-create (regex year &optional month day)
-  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY."
+;;;###autoload
+(defun org-datetree-find-iso-week-create (date &optional keep-restriction)
+  "Find or create an ISO week entry for DATE.
+Compared to `org-datetree-find-date-create' this function creates
+entries ordered by week instead of months.
+If KEEP-RESTRICTION is non-nil, do not widen the buffer.  When it
+is nil, the buffer will be widened to make sure an existing date
+tree can be found."
+  (org-set-local 'org-datetree-base-level 1)
+  (or keep-restriction (widen))
+  (save-restriction
+(let ((prop (org-find-property "DATE_WEEK_TREE")))
+  (when prop
+   (goto-char prop)
+   (org-set-local 'org-datetree-base-level
+  (org-get-valid-level (org-current-level) 1))
+   (org-narrow-to-subtree)))
+(goto-char (point-min))
+(require 'cal-iso)
+(let* ((year (calendar-extract-year date))
+  (month (calendar-extract-month date))
+  (day (calendar-extract-day date))
+  (time (encode-time 0 0 0 day month year))
+  (iso-date (calendar-iso-from-absolute
+ (calendar-absolute-from-gregorian date)))
+  (weekyear (nth 2 iso-date))
+  (week (car iso-date))
+  (weekday (cadr iso-date)))
+  ;; ISO 8601 week format is %G-W%V(-%u)
+  (org-datetree--find-create "^\\*+[ 
\t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"
+weekyear nil nil
+(format-time-string "%G" time))
+  (org-datetree--find-create "^\\*+[ \t]+%d-W\\([0-5][0-9]\\)$"
+weekyear week nil
+(format-time-string "%G-W%V" time))
+  ;; For the actual day we use the regular date instead of ISO week.
+  (org-datetree--find-create "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
+year month day
+
+(defun org-datetree--find-create (regex year &optional month day insert)
+  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.
+If INSERT is non-nil insert the text if not found."
   (let ((re (format regex year month day))
match)
 (goto-char (point-min))
@@ -86,25 +126,27 @@ (defun org-datetree--find-create (regex year &optional 
month day)
  ((not match)
   (goto-char (point-max))
   (unless (bolp) (newline))
-  (org-datetree-insert-line year month day))
+  (org-datetree-insert-line year month day insert))
  ((= (string-to-number (match-string 1)) (or day month year))
   (goto-char (point-at-bol)))
  (t
   (beginning-of-line 1)
-  (org-datetree-insert-line year month day)
+  (org-datetree-insert-line year month day insert)
 
-(defun org-datetree-insert-line (year &optional month day)
+(defun org-datetree-insert-line (year &optional month day text)
   (delete-region (save-excursion (skip-chars-backward " \t\n") (point)) 
(point))
   (insert "\n" (make-string org-datetree-base-level ?*) " \n")
   (backward-char)
   (when month (org-do-demote))
   (when day (org-do-demote))
-  (insert (format "%d" year))
-  (when month
-(insert
- (if day
-(format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year))
-   (format-time-string "-%m %B" (encode-time 0 0 0 1 month year)
+  (if text
+  (insert text)
+(insert (format "%d" year))
+(when month
+  (insert
+   (if day
+  (format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year))
+(format-time-string "-%m %B" (encode-time 0 0 0 1 month year))
   (when (and day org-datetree-add-timestamp)
 (save-excursion
   (insert "\n")
diff --git a/testing/lisp/test-org-datetree.el 
b/testing/lisp/test-org-datetree.el
index 0135ab9..9b839ca 100644
--- a/testing/lisp/test-org-datetree.el
+++ b/testing/lisp/test-org-datetree.el
@@ -113,5 +113,97 @@ (ert-deftest test-org-datetree/find-date-create ()
(org-datetree-find-date-create '(3 29 2

[O] [PATCH 3/3] org-capture.el: Add support for week trees.

2015-09-02 Thread Rüdiger Sonderfeld
* lisp/org-capture.el (org-capture-templates): Add
  file+weektree(+prompt) options.
  (org-capture-set-target-location): Add support for week trees.
* doc/org.texi (Template elements): Document file+weektree(+prompt)
  options.
---
 doc/org.texi|  7 +++
 lisp/org-capture.el | 26 +-
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index ed808be..d894f91 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -7187,6 +7187,13 @@
 @item (file+datetree+prompt "path/to/file")
 Will create a heading in a date tree, but will prompt for the date.
 
+@item (file+weektree "path/to/file")
+Will create a heading in a week tree for today's date.  Week trees are sorted
+by week and not by month unlike datetrees.
+
+@item (file+weektree+prompt "path/to/file")
+Will create a heading in a week tree, but will prompt for the date.
+
 @item (file+function "path/to/file" function-finding-location)
 A function to find the right location in the file.
 
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 93a7f2a..320954e 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -149,6 +149,12 @@ (defcustom org-capture-templates nil
  (file+datetree+prompt \"path/to/file\")
  Will create a heading in a date tree, prompts for date
 
+ (file+weektree \"path/to/file\")
+ Will create a heading in a week tree for today's date
+
+ (file+weektree+prompt \"path/to/file\")
+ Will create a heading in a week tree, prompts for date
+
  (file+function \"path/to/file\" function-finding-location)
  A function to find the right location in the file
 
@@ -321,6 +327,12 @@ (defcustom org-capture-templates nil
  (list :tag "File & Date tree, prompt for date"
(const :format "" file+datetree+prompt)
(file :tag "  File"))
+ (list :tag "File & Week tree"
+   (const :format "" file+weektree)
+   (file :tag "  File"))
+ (list :tag "File & Week tree, prompt for date"
+   (const :format "" file+weektree+prompt)
+   (file :tag "  File"))
  (list :tag "File & function"
(const :format "" file+function)
(file :tag "  File")
@@ -895,21 +907,25 @@ (defun org-capture-set-target-location (&optional target)
  (setq target-entry-p (and (derived-mode-p 'org-mode) 
(org-at-heading-p
  (error "No match for target regexp in file %s" (nth 1 target
 
-   ((memq (car target) '(file+datetree file+datetree+prompt))
+   ((memq (car target) '(file+datetree file+datetree+prompt file+weektree 
file+weektree+prompt))
(require 'org-datetree)
(set-buffer (org-capture-target-buffer (nth 1 target)))
(org-capture-put-target-region-and-position)
(widen)
-   ;; Make a date tree entry, with the current date (or yesterday,
-   ;; if we are extending dates for a couple of hours)
-   (org-datetree-find-date-create
+   ;; Make a date/week tree entry, with the current date (or
+   ;; yesterday, if we are extending dates for a couple of hours)
+   (funcall
+(cond
+ ((memq (car target) '(file+weektree file+weektree+prompt))
+  #'org-datetree-find-iso-week-create)
+ (t #'org-datetree-find-date-create))
 (calendar-gregorian-from-absolute
  (cond
   (org-overriding-default-time
;; use the overriding default time
(time-to-days org-overriding-default-time))
 
-  ((eq (car target) 'file+datetree+prompt)
+  ((memq (car target) '(file+datetree+prompt file+weektree+prompt))
;; prompt for date
(let ((prompt-time (org-read-date
nil t nil "Date for tree entry:"
-- 
2.5.1




Re: [O] porting guide from old to new beamer export?

2015-09-02 Thread Suvayu Ali
On Tue, Sep 01, 2015 at 09:11:36PM +0200, Joseph Vidal-Rosset wrote:
> 2015-08-31 10:32 GMT+02:00 Loris Bennett :
> 
> > #+BEAMER_THEME: CambridgeUS
> >
> > If that doesn't work, you should post a minimal working example which
> > illustrates the problem.
> >
> 
> 
> I must say to the list that the code that solves my problem is given in
> Eric Fraga's tutorial:
> 
> #+latex_header:
> \mode{\usetheme{CambridgeUS}\usepackage{beamer_udl_theme}}

If using the BEAMER_THEME keyword option does not work for you, please
submit a bug report with a minimal working example demonstrating the
bug.

Thanks,

-- 
Suvayu

Open source is the future. It sets us free.



[O] Bug: Smart left single quote broken

2015-09-02 Thread T.F. Torrey
Hello all,

The smart quote code has gotten a little borked, at least in HTML.

This:

#+BEGIN_EXAMPLE
He said, "You should believe me, 'cause it's 'true'."
#+END_EXAMPLE

Exports to this:

#+BEGIN_EXAMPLE

He said, “You should believe me, ’cause it’s
’true’.”

#+END_EXAMPLE

The quote before "true" should be a left single quote, and it used to be,
like this:

#+BEGIN_EXAMPLE

He said, “You should believe me, ’cause it’s
‘true’.”

#+END_EXAMPLE

I looked at the code, but it has become more convoluted than I can
figure out in the time allotted.  Hopefully the error is obvious to
someone more familiar with it.

Emacs : GNU Emacs 24.5.1 (i586-pc-linux-gnu, GTK+ Version 3.16.4) of
 2015-06-28 on x86-csail-01, modified by Debian Package: Org-mode
 version 8.3.1 (release_8.3.1-190-g258966 @
 /home/tftorrey/T/org-mode/lisp/)

Best,
Terry
-- 
T.F. Torrey



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

2015-09-02 Thread John Kitchin
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  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 .
>>
>>

--
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] Outline DOM?

2015-09-02 Thread Lawrence Bottorff
When I do an HTML export, I notice that my headings are all converted from
stars to numbers -- rather deeply. Is there an underlying DOM-like object
that you can glean the org buffer's hierarchical structure from?

LB


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

2015-09-02 Thread Rasmus
Hi,

Erik Hetzner  writes:

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

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.

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...

> Latex v. plain text
> [...]
> But the [ox] toolchains can be fragile [...]

{{citation needed}}

> 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.

Thanks,
Rasmus

-- 
May contains speling mistake




Re: [O] Outline DOM?

2015-09-02 Thread Rasmus
Lawrence Bottorff  writes:

> When I do an HTML export, I notice that my headings are all converted from
> stars to numbers -- rather deeply. Is there an underlying DOM-like object
> that you can glean the org buffer's hierarchical structure from?

Yeah, (org-element-parse-buffer) will give you something like a DOM or an
AST.

Maybe you just want to set the H OPTION though, e.g.:

  #+options: h:3

Rasmus

-- 
A page of history is worth a volume of logic




Re: [O] porting guide from old to new beamer export?

2015-09-02 Thread Eric S Fraga
On Tuesday,  1 Sep 2015 at 21:11, Joseph Vidal-Rosset wrote:
> 2015-08-31 10:32 GMT+02:00 Loris Bennett :
>
>> #+BEAMER_THEME: CambridgeUS
>>
>> If that doesn't work, you should post a minimal working example which
>> illustrates the problem.
>>
>
>
> I must say to the list that the code that solves my problem is given in
> Eric Fraga's tutorial:
>
> #+latex_header:
> \mode{\usetheme{CambridgeUS}\usepackage{beamer_udl_theme}}

I'm glad my tutorial helped but I am surprised you needed to do
this.  Can you please post a minimal example that fails when using the
"#+beamer_theme:" construct as suggested by Loris above?  This
definitely works for me.

Also, what version of org?  (M-x org-version RET)

> Now I meet a new problem : what is the org-mode code to export this Latex
> code that customizes the frame of the title page? :
>
> \begin{frame}
> \titlepage
> \begin{center}
> \includegraphics[height=1cm,width=1cm]{cnrs_noir}~~
> \includegraphics[height=1cm,width=1cm]{logo}~
> \includegraphics[height=1cm,width=1cm]{logo-udl}
> \end{center}
> \end{frame}

For customisation of the title page, I tend to use the #+date: header
and put whatever LaTeX I want there.  For instance, for a conference I
am presenting at next week, I have done:

#+begin_src org
  ,#+date: 8 September 2015 @@latex:\\@@ Carbon dioxide utilisation 
@@latex:\\@@ Faraday Discussions
#+end_src

You could easily put your graphics within a @@latex:...@@ construct in
the DATE header.

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-188-g410ea6



[O] Helm update brings "funcall: Symbol's value as variable is void: helm-walk-ignore-directories"

2015-09-02 Thread Eduardo Mercovich
Dear all.

After updating a 7 packages yesterday, including helm, I found my
org-mode (Emacs 24.3.1 in Linux) semi-functional with this message:

"funcall: Symbol's value as variable is void: helm-walk-ignore-directories"

This is defined in https://github.com/emacs-helm/helm/blob/master/helm-lib.el
I searched, but couldn't found something that helped me and my
knowledge is not enough to troubleshoot this issue (I'm a newbie on
the Emacs world and no programmer at all).

I would appreciate very much if someone can give me a few pointers to
start with.

Thanks a lot in advance... :)

-- 
e



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

2015-09-02 Thread Xebar Saram
Hi

the slides are really nice! are they done in org and beamer?

best

z

On Wed, Sep 2, 2015 at 2:00 PM, Rasmus  wrote:

> Hi,
>
> Erik Hetzner  writes:
>
> >   http://www.e6h.org/talks/emacsconf-2015/index.html
>
> 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.
>
> 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...
>
> > Latex v. plain text
> > [...]
> > But the [ox] toolchains can be fragile [...]
>
> {{citation needed}}
>
> > 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.
>
> Thanks,
> Rasmus
>
> --
> May contains speling mistake
>
>
>


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

2015-09-02 Thread Rasmus
Hi,

Xebar Saram  writes:

> the slides are really nice! are they done in org and beamer?

Not my slides, but: Reveal.js

http://lab.hakim.se/reveal-js/

It's a very capable program¹ as long as you don't require too complicated
math.

There's an ox exporter, with I havne't tried:

 https://github.com/yjwen/org-reveal

Rasmus

Footnotes: 
¹   The theme used in this class is really excellent BTW:
 http://www.unomaha.edu/mahbubulmajumder/data-science/fall-2014/

-- 
When the facts change, I change my mind. What do you do, sir?




[O] [BUG?] Org Mode 20150831, ob-R not working

2015-09-02 Thread thomas

Hi There,

updating from Org Mode 20150713 to 20150831 (Elpa package) gives me an 
error at startup:


#+BEGIN_EXAMPLE
Warning (initialization): An error occurred while loading 
`/home/thomas/.emacs':


Invalid function: org-babel-header-args-safe-fn

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.
#+END_EXAMPLE

And ~emacs --debug-init~ says:

#+BEGIN_EXAMPLE
Debugger entered--Lisp error: (invalid-function 
org-babel-header-args-safe-fn)
  org-babel-header-args-safe-fn((:cache :colnames :comments :exports 
:epilogue :hlines :noeval :noweb :noweb-ref :noweb-sep :padline 
:prologue :rownames :sep :session :tangle :wrap (:eval "never" "query") 
(:results lambda (str) (not (string-match "file" str))) :width :height 
:bg :units :pointsize :antialias :quality :compression :res :type 
:family :title :fonts :version :paper :encoding :pagecentre :colormodel 
:useDingbats :horizontal))
byte-code("\301\302\303\304!#\210\305\306\307\310\311\312\313\314\315\316& 
 \207" [ob-R-safe-header-args put org-babel-default-header-args:R 
safe-local-variable org-babel-header-args-safe-fn 
custom-declare-variable org-babel-R-command "R --slave --no-save" "Name 
of command to use for executing R code." :group org-babel :version 
"24.1" :type string] 10)

  require(ob-R)
  ...
  org-babel-do-load-languages(org-babel-load-languages ((awk . t) 
(python . t) (sql . t) (asymptote . t) (scheme \.t) (sh . t) (lilypond . 
t) (R . t) (ditaa . t) (dot . t) (plantuml . t) (C . t) (java \.t) 
(sqlite . t)))
  eval-buffer(# nil "/home/thomas/.emacs" nil t)  ; 
Reading at buffer position 3634
  load-with-code-conversion("/home/thomas/.emacs" "/home/thomas/.emacs" 
t t)

  load("~/.emacs" t t)
  ...
  command-line()
  normal-top-level()
#+END_EXAMPLE

I'm having a problem with R. In my .emacs I load R like this:

#+BEGIN_SRC emacs-lisp
(require 'ess-site) ;; see 
http://orgmode.org/worg/org-tutorials/org-R/org-R.html

(org-babel-do-load-languages 'org-babel-load-languages '((R . t)))
#+END_SRC

If I remove R from babel languages, the Error disappears.

I get the same Error when I require ob-R:

#+BEGIN_SRC emacs-lisp
(require 'ob-R) ;;  Invalid function: org-babel-header-args-safe-fn
#+END_SRC

Huh, this is odd! Am I missing something?
If not, how can I revert to 20150713?



Many thanks,
thomas






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

2015-09-02 Thread Marcin Borkowski

On 2015-09-02, at 14:51, Rasmus  wrote:

> Hi,
>
> Xebar Saram  writes:
>
>> the slides are really nice! are they done in org and beamer?
>
> Not my slides, but: Reveal.js
>
> http://lab.hakim.se/reveal-js/
>
> It's a very capable program¹ as long as you don't require too complicated
> math.

Even with complicated math, it uses MathJax, which handles LaTeX math
pretty well.  (For some values of "complicated", of course.)

> There's an ox exporter, with I havne't tried:
>
>  https://github.com/yjwen/org-reveal

I have, and it's very nice.

> Rasmus
>
> Footnotes: 
> ¹   The theme used in this class is really excellent BTW:
>  http://www.unomaha.edu/mahbubulmajumder/data-science/fall-2014/

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] Bug: Smart left single quote broken

2015-09-02 Thread Nicolas Goaziou
Hello,

"T.F. Torrey"  writes:

> The smart quote code has gotten a little borked, at least in HTML.
>
> This:
>
> #+BEGIN_EXAMPLE
> He said, "You should believe me, 'cause it's 'true'."
> #+END_EXAMPLE
>
> Exports to this:
>
> #+BEGIN_EXAMPLE
> 
> He said, “You should believe me, ’cause it’s
> ’true’.”
> 
> #+END_EXAMPLE
>
> The quote before "true" should be a left single quote, and it used to
> be,

There is indeed a bug, thank you. I'm going to fix it.

> like this:
>
> #+BEGIN_EXAMPLE
> 
> He said, “You should believe me, ’cause it’s
> ‘true’.”
> 
> #+END_EXAMPLE

I don't think we ever achieved this result. At best, we can obtain:

  He said, “You should believe me, ‘cause it’s
  ‘true’.”

I doubt it is possible to tell that 'cause begins with an apostrophe and
not an opening single quote without grammatical analysis.


Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG?] Org Mode 20150831, ob-R not working

2015-09-02 Thread Kyle Meyer
Hello,

thomas  writes:

> Hi There,
>
> updating from Org Mode 20150713 to 20150831 (Elpa package) gives me an
> error at startup:
>
> #+BEGIN_EXAMPLE
> Warning (initialization): An error occurred while loading
> `/home/thomas/.emacs':
>
> Invalid function: org-babel-header-args-safe-fn

When this error has been reported in the past, it has been due to
another version of Org being loaded during the update.  Please uninstall
and then reinstall before any version of Org is loaded.

http://orgmode.org/manual/Installation.html

--
Kyle



Re: [O] Helm update brings "funcall: Symbol's value as variable is void: helm-walk-ignore-directories"

2015-09-02 Thread Eduardo Mercovich
Hi all.

> After updating a 7 packages yesterday, including helm, I found my
> org-mode (Emacs 24.3.1 in Linux) semi-functional with this message:
> "funcall: Symbol's value as variable is void: helm-walk-ignore-directories"

Just found it. The new installed version was not included in .emacs in the
(add-to-list 'load-path "[snip]")
part.

Is this the expected behavior when we update through the package manager?

Thanks... :)

--
e



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

2015-09-02 Thread Jorge A. Alfaro-Murillo
Rasmus writes: 

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. 


That is reveal.js standard, left to right are "sections" and top 
to bottom are slides. It is good if one has to go back to a slide, 
you can press ESC and see the sections and search for the slide. 
To pass the slides you can use SPACE, which goes top to bottom and 
them right when there are no more slides below.


Best,
--
Jorge.




[O] Get editing window back?

2015-09-02 Thread Lawrence Bottorff
If I do a quick entry with C-c C-z, I get a nice separate window to do my
entry in. Then I do C-c C-c to "commit" my entry. Q: Is there any way to
get that separate editing window back to do more changes?

LB


[O] the (old) remember

2015-09-02 Thread Uwe Brauer


Hello

I am over the years very acquainted with remember.el. In the old
version, compatible with org-mode <8, regions could be installed the old
unix mailbox format. I have zillons of information in that format and
would like to keep it that way.


However it seems that starting with org-mode => 8 this is no longer
possible, I must use org-capture instead, a functionality I like very
much and use in different context, but a functionality which seems
incompatible with the old mailbox format.

Can somebody please confirm this, or tell me how to keep the mailbox
format?

Thanks

Uwe Brauer



Re: [O] Bug: Smart left single quote broken

2015-09-02 Thread T.F. Torrey
> I doubt it is possible to tell that 'cause begins with an apostrophe and 
> not an opening single quote without grammatical analysis. 
 
Indeed. I pointed it out because it was unexpectedly doing the right thing.

Thank you.

T.


[O] Bug: html export [8.3.1 (8.3.1-95-g1dbb25-elpa @ /Volumes/passchaos/.emacs.d/elpa/org-20150831/)]

2015-09-02 Thread Greedwolf DSS


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See


 http://orgmode.org/manual/Feedback.html#Feedback


Your bug report will be posted to the Org-mode mailing list.



I can't get the right exported hyperlinks when there is "&" character,
but it work correctly in org-mode version 8.2.10.
The testing hyperlink: 
http://7xib25.com1.z0.glb.clouddn.com/Class&MetaClass.001.jpg


Emacs  : GNU Emacs 25.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 
Version 10.9.5 (Build 13F1112))
 of 2015-09-02
Package: Org-mode version 8.3.1 (8.3.1-95-g1dbb25-elpa @ 
/Volumes/passchaos/.emacs.d/elpa/org-20150831/)


current state:
==
(setq
 org-src-lang-modes '(("dot" . graphviz-dot) ("ocaml" . tuareg) ("elisp" . 
emacs-lisp) ("ditaa" . artist)
  ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . 
sql) ("calc" . fundamental)
  ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" . 
shell-script) ("shell" . sh)
  ("bash" . sh))
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-log-done 'time
 org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" 
browse-url file)
 ("\\.pdf\\'" . default))
 org-export-with-sub-superscripts '{}
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook org-show-block-all 
append local] 5]
 #[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook 
org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point 
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-plantuml-jar-path "~/Dropbox/backup/plantuml.jar"
 org-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("haskell" . "hs") 
("latex" . "tex")
  ("ruby" . "rb") ("python" . "py") ("emacs-lisp" . 
"el") ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-startup-truncated nil
 org-completion-use-ido t
 org-babel-load-languages '((emacs-lisp . t) (python . t) (ruby . t) (sh . t) 
(latex . t) (plantuml . t)
(dot . t) (scheme . t) (R . t) (haskell . t) (C . 
t))
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-confirm-babel-evaluate nil
 org-publish-project-alist '(("iOSNotes" :base-directory "~/org/iOS/" 
:base-extension "org" :recursive t
  :auto-sitemap t :setupfile
  
"~/Desktop/org-html-themes/setup/theme-readtheorg-local.setup"
  :publishing-directory "~/org/iOSHTML/" 
:publishing-function
  (org-html-publish-to-html) :html-head:  :html-head-extra:  :html-head-extra:  :html-head-extra:  :html-head-extra:  :html-head-extra: )
 )
 org-after-todo-statistics-hook '(org-summary-todo)
 )



Re: [O] [PATCH] org-mime: make plain/text mime export a choice

2015-09-02 Thread Will O'Brien
On 1 Sep 2015 08:18, "Nicolas Goaziou"  wrote:
>
> Is there any reason to keep using "org" exporter if "ascii" is superior?
> I.e., what about simply replacing 'org with 'ascii?
>

FWIW

There's a nice use case for exporting as org. If I compose an email which
includes source code and I send it to a mixed audience, some of whom use
gnus, and others an html based mua, then I get best of both worlds in terms
of syntax highlighting, since gnus recognises org src blocks and applies
appropriate highlighting and those using some other mua get the html
highlighting as dictated by my own scheme.

This also applies for a single recipient who may access email through gnus
when available but needs the html version for viewing on, e.g. a handheld
device.

Cheers,

Will


Re: [O] Bug: Smart left single quote broken

2015-09-02 Thread Nicolas Goaziou
Hello,

"T.F. Torrey"  writes:
>
> The smart quote code has gotten a little borked, at least in HTML.
>
> This:
>
> #+BEGIN_EXAMPLE
> He said, "You should believe me, 'cause it's 'true'."
> #+END_EXAMPLE
>
> Exports to this:
>
> #+BEGIN_EXAMPLE
> 
> He said, “You should believe me, ’cause it’s
> ’true’.”
> 
> #+END_EXAMPLE
>
> The quote before "true" should be a left single quote, and it used to be,
> like this:
>
> #+BEGIN_EXAMPLE
> 
> He said, “You should believe me, ’cause it’s
> ‘true’.”
> 
> #+END_EXAMPLE

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] org-mac-link to Mail.app doesn't work as expected

2015-09-02 Thread Tobias Frischholz
Hi there,

I’m using org-mac-link.el 
(http://orgmode.org/worg/org-contrib/org-mac-link.html 
), which is a fantastic 
tool for grabbing links from various Mac apps.

But somehow it isn’t correctly linking to mails in Mail.app: The links work as 
long as the mails are in my Inbox.
The link stops working when I’m moving them to my Archive.

Also, fresh links to mails in the Archive also try to open them in my Inbox - 
where they aren’t any more of course.

Is this a bug?


Best regards,
Tobias Frischholz

PGP PUBLIC KEY: http://pgp.mit.edu/pks/lookup?search=0xCD463AC1&op=index



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] Bug: html export [8.3.1 (8.3.1-95-g1dbb25-elpa @ /Volumes/passchaos/.emacs.d/elpa/org-20150831/)]

2015-09-02 Thread Nicolas Goaziou
Hello,

"Greedwolf DSS"  writes:

> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
>
>  http://orgmode.org/manual/Feedback.html#Feedback
>
>
> Your bug report will be posted to the Org-mode mailing list.
> 
>
>
> I can't get the right exported hyperlinks when there is "&" character,
> but it work correctly in org-mode version 8.2.10.
> The testing hyperlink:
> http://7xib25.com1.z0.glb.clouddn.com/Class&MetaClass.001.jpg

Fixed. Thank you.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH 1/3] org-datetree.el: Code cleanup.

2015-09-02 Thread Nicolas Goaziou
Hello,

Rüdiger Sonderfeld  writes:

> * lisp/org-datetree.el (org-datetree--find-create): New function.
> (org-datetree-find-year-create, org-datetree-find-month-create,
> org-datetree-find-day-create): Removed functions
> (org-datetree-find-date-create): Use `org-datetree--find-create' instead
> of removed functions.  Use calendar extract functions.
> (org-datetree-insert-line): Do more formatting in `format-time-string'
> since we call it anyway
> * testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
>   Test if new entries are put at the right place.

Thank you. Minor comments follow.

> ---
>  lisp/org-datetree.el  | 77 
> +--
>  testing/lisp/test-org-datetree.el |  9 +
>  2 files changed, 27 insertions(+), 59 deletions(-)
>
> diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
> index a97a9d0..3620bbd 100644
> --- a/lisp/org-datetree.el
> +++ b/lisp/org-datetree.el
> @@ -64,67 +64,30 @@ (defun org-datetree-find-date-create (date &optional 
> keep-restriction)
>  (org-get-valid-level (org-current-level) 1))
>   (org-narrow-to-subtree)))
>  (goto-char (point-min))
> -(let ((year (nth 2 date))
> -   (month (car date))
> -   (day (nth 1 date)))
> -  (org-datetree-find-year-create year)
> -  (org-datetree-find-month-create year month)
> -  (org-datetree-find-day-create year month day
> -
> -(defun org-datetree-find-year-create (year)
> -  "Find the YEAR datetree or create it."
> -  (let ((re "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ 
> \t]:[[:alnum:]:_@#%]+:\\)?\\s-*$\\)")
> +(let ((year (calendar-extract-year date))
> +   (month (calendar-extract-month date))
> +   (day (calendar-extract-day date)))
> +  (org-datetree--find-create "^\\*+[ 
> \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"
> +  year)
> +  (org-datetree--find-create "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$"
> +  year month)
> +  (org-datetree--find-create "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
> +  year month day
> +
> +(defun org-datetree--find-create (regex year &optional month day)
> +  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY."

You should add you are expecting something special in matching group 1,
for comparison.

> +  (let ((re (format regex year month day))
>   match)
>  (goto-char (point-min))
>  (while (and (setq match (re-search-forward re nil t))
>   (goto-char (match-beginning 1))
> - (< (string-to-number (match-string 1)) year)))
> + (< (string-to-number (match-string 1)) (or day month year
>  (cond
>   ((not match)
>(goto-char (point-max))
> -  (or (bolp) (newline))
> -  (org-datetree-insert-line year))
> - ((= (string-to-number (match-string 1)) year)
> -  (goto-char (point-at-bol)))
> - (t
> -  (beginning-of-line 1)
> -  (org-datetree-insert-line year)
> -
> -(defun org-datetree-find-month-create (year month)
> -  "Find the datetree for YEAR and MONTH or create it."
> -  (org-narrow-to-subtree)
> -  (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$" year))
> - match)
> -(goto-char (point-min))
> -(while (and (setq match (re-search-forward re nil t))
> - (goto-char (match-beginning 1))
> - (< (string-to-number (match-string 1)) month)))
> -(cond
> - ((not match)
> -  (goto-char (point-max))
> -  (or (bolp) (newline))
> -  (org-datetree-insert-line year month))
> - ((= (string-to-number (match-string 1)) month)
> -  (goto-char (point-at-bol)))
> - (t
> -  (beginning-of-line 1)
> -  (org-datetree-insert-line year month)
> -
> -(defun org-datetree-find-day-create (year month day)
> -  "Find the datetree for YEAR, MONTH and DAY or create it."
> -  (org-narrow-to-subtree)
> -  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" year month))
> - match)
> -(goto-char (point-min))
> -(while (and (setq match (re-search-forward re nil t))
> - (goto-char (match-beginning 1))
> - (< (string-to-number (match-string 1)) day)))
> -(cond
> - ((not match)
> -  (goto-char (point-max))
> -  (or (bolp) (newline))
> +  (unless (bolp) (newline))

While you're at it:

  (unless (bolp) (insert "\n"))

> diff --git a/testing/lisp/test-org-datetree.el 
> b/testing/lisp/test-org-datetree.el
> index d500130..0135ab9 100644
> --- a/testing/lisp/test-org-datetree.el
> +++ b/testing/lisp/test-org-datetree.el
> @@ -55,6 +55,15 @@ (ert-deftest test-org-datetree/find-date-create ()
>(let ((org-datetree-add-timestamp nil))
>   (org-datetree-find-date-create '(3 29 2012)))
>(org-trim (buffer-string)
> +  ;; Sort new entry in right place

Missing full stop.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH 2/3] org-datetree.el: Add support for ISO week trees.

2015-09-02 Thread Nicolas Goaziou
Rüdiger Sonderfeld  writes:

> +(defun org-datetree-find-iso-week-create (date &optional keep-restriction)
> +  "Find or create an ISO week entry for DATE.
> +Compared to `org-datetree-find-date-create' this function creates
> +entries ordered by week instead of months.
> +If KEEP-RESTRICTION is non-nil, do not widen the buffer.  When it
> +is nil, the buffer will be widened to make sure an existing date
> +tree can be found."
> +  (org-set-local 'org-datetree-base-level 1)
> +  (or keep-restriction (widen))
> +  (save-restriction
> +(let ((prop (org-find-property "DATE_WEEK_TREE")))

I don't think we need to introduce a new property for that. DATE_TREE is
enough.

> +  (when prop
> + (goto-char prop)
> + (org-set-local 'org-datetree-base-level
> +(org-get-valid-level (org-current-level) 1))
> + (org-narrow-to-subtree)))
> +(goto-char (point-min))
> +(require 'cal-iso)
> +(let* ((year (calendar-extract-year date))
> +(month (calendar-extract-month date))
> +(day (calendar-extract-day date))
> +(time (encode-time 0 0 0 day month year))
> +(iso-date (calendar-iso-from-absolute
> +   (calendar-absolute-from-gregorian date)))
> +(weekyear (nth 2 iso-date))
> +(week (car iso-date))
> +(weekday (cadr iso-date)))

Nitpick, since you used (nth 2 ...):

  car  -> nth 0
  cadr -> nth 1

> +  ;; ISO 8601 week format is %G-W%V(-%u)
> +  (org-datetree--find-create "^\\*+[ 
> \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"

Isn't this line too long?

> +  weekyear nil nil
> +  (format-time-string "%G" time))
> +  (org-datetree--find-create "^\\*+[ \t]+%d-W\\([0-5][0-9]\\)$"
> +  weekyear week nil
> +  (format-time-string "%G-W%V" time))
> +  ;; For the actual day we use the regular date instead of ISO week.
> +  (org-datetree--find-create "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
> +  year month day
> +
> +(defun org-datetree--find-create (regex year &optional month day insert)
> +  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.

Here you have expectations about REGEX, since you use

  (format regex year month day)

Could you clarify that it should have three format placeholders in the
docstring?

> +If INSERT is non-nil insert the text if not found."

Insert where? What text? Could you tweak docstring to specify that
INSERT is a string and where it is going to be inserted?

>(let ((re (format regex year month day))
>   match)
>  (goto-char (point-min))
> @@ -86,25 +126,27 @@ (defun org-datetree--find-create (regex year &optional 
> month day)
>   ((not match)
>(goto-char (point-max))
>(unless (bolp) (newline))
> -  (org-datetree-insert-line year month day))
> +  (org-datetree-insert-line year month day insert))
>   ((= (string-to-number (match-string 1)) (or day month year))
>(goto-char (point-at-bol)))

While you're at it:

  (beginning-of-line)


Regards,



Re: [O] [PATCH 3/3] org-capture.el: Add support for week trees.

2015-09-02 Thread Nicolas Goaziou
Rüdiger Sonderfeld  writes:

> * lisp/org-capture.el (org-capture-templates): Add
>   file+weektree(+prompt) options.
>   (org-capture-set-target-location): Add support for week trees.
> * doc/org.texi (Template elements): Document file+weektree(+prompt)
>   options.

Looks good.

Regards,



[O] org-do-**mote does not work properly on empty headings

2015-09-02 Thread Konstantin Kliakhandler
Hello,

When I start a new heading and don't add text yet but click M-right/M-left,
new spaces are tacked to the end so that when I do begin to write,
sometimes there are too many spaces at the front.

I tracked this down to org-do-demote/promote, since calling org-promote and
org-demote does not appear to suffer from this. I will investigate further
and report.

Versions:
Org-mode version 8.3.1 (8.3.1-95-g1dbb25-elpa @
/Users/kosta/.emacs.d/elpa/org-20150831/)
GNU Emacs 24.5.1 (x86_64-apple-darwin14.3.0, Carbon Version 157 AppKit
1347.57) of 2015-06-01 on Singularity-2.local

Steps to reproduce:
1. Make a heading with some text underneath
2. M-Return to create a new heading
3. M-Right, M-Left would get you to the same heading level, but the cursor
would be further to the right than started with.

-- 
Konstantin Kliakhandler
http://slumpy.org
  )°) )°( (°(


Re: [O] [PATCH 2/3] org-datetree.el: Add support for ISO week trees.

2015-09-02 Thread Rüdiger Sonderfeld
On Wednesday 02 September 2015 21:58:17 Nicolas Goaziou wrote:
> Rüdiger Sonderfeld  writes:
> > +(let ((prop (org-find-property "DATE_WEEK_TREE")))
> 
> I don't think we need to introduce a new property for that. DATE_TREE is
> enough.

Since DATE_TREE and DATE_WEEK_TREE (or WEEK_TREE instead?) are structured 
differently it might make sense to keep the property separated.

> > +  ;; ISO 8601 week format is %G-W%V(-%u)
> > +  (org-datetree--find-create "^\\*+[
> > \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([
> > \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"
> Isn't this line too long?

What's the limit?  Because if it's 80 char then I'd need to do some `concat' 
ugliness because the regex is over 80 char long.

I've fixed the rest and will send updated patches.

Cheers,

Rüdiger




Re: [O] org-do-**mote does not work properly on empty headings

2015-09-02 Thread Kyle Meyer
Hello,

Konstantin Kliakhandler  writes:

> Hello,
>
> When I start a new heading and don't add text yet but click M-right/M-left,
> new spaces are tacked to the end so that when I do begin to write,
> sometimes there are too many spaces at the front.

[...]

> Steps to reproduce:
> 1. Make a heading with some text underneath
> 2. M-Return to create a new heading
> 3. M-Right, M-Left would get you to the same heading level, but the cursor
> would be further to the right than started with.

I'm unable to reproduce this running 'emacs -Q' with either
release_8.3.1-194-ga2d0cd9 or release_8.3.1.  The cursor remains one
space from the last star.

--
Kyle



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  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  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 .
> >>
> >>
> 
> --
> 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-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] org-do-**mote does not work properly on empty headings

2015-09-02 Thread Konstantin Kliakhandler
Thanks Kyle,

First, I apologise for the poorly chosen subject. I indeed looks like
something in my setup - I am also unable to reproduce with emacs -Q.


Since I posted this, I looked further and found that the place where the
problem occurs for me is in the function `org-fix-position-after-promote'.
I will paste it here for your convenience:

```

> (defun org-fix-position-after-promote ()
>   "Make sure that after pro/demotion cursor position is right."
>   (let ((pos (point)))
> (when (save-excursion
>(beginning-of-line 1)
>(looking-at org-todo-line-regexp)
>(or (equal pos (match-end 1)) (equal pos (match-end 2
>   (cond ((eobp) (insert " "))
>((eolp) (insert " "))
>((equal (char-after) ?\ ) (forward-char 1))

```

Specifically, (equal pos (match-end 2)) evals to t here and to nil on a
clean system. I examined the difference between the the two setups.

In my setup, the variable `org-todo-line-regexp' is set to:
"^\\(\\*+\\)\\(?:
+\\(\\(?:C\\(?:ANCELLED\\|OMPLETE\\|REDENTIAL\\)\\|DONE\\|EVENT\\|FUTURE\\|HABIT\\|N\\(?:OTE\\|UMBER\\)\\|OBJECT\\|PROJECT\\|STARTED\\|T\\(?:EMP\\|ODO\\)\\|WAITING\\)?\\)\\)?\\(?:
+\\(.*?\\)\\)?[ ]*$"

(yes, I know - I have too many labels...)

In the clean system, the variable is set as follows:
"^\\(\\*+\\)\\(?: +\\(TODO\\|DONE\\)\\)?\\(?: +\\(.*?\\)\\)?[ ]*$"

Incidentally, the *only* difference between the two is in group 2 which
matches in my setup and does not match in the default setup. Just in case
it isn't obvious, this variable appears to get autogenerated from my
settings.
If I'm not mistaken, it looks like the group in my case matches the empty
string and then the function decides to add a space since we are at the end
of the line. The question then is, why does the empty get matched?

Well, I know why; my `org-todo-keywords' is setup as follows:

  (setq org-todo-keywords
> '((type "TODO(t!)" "|" "DONE(d!)" "CANCELLED(c@)")
>   (type "HABIT(h!)" "|" "DONE(d!)")
>   (type "WAITING(w@/!)" "FUTURE(f!/@)" "STARTED(s@/!)" "|"
> "DONE(d!)")
>   (type "|" "NOTE(n)" "NUMBER(#)" "CREDENTIAL($)" "OBJECT(o)"
> "TEMP(e)")
>   (type "EVENT(n)")
>   (type "PROJECT(p!)" "|" "COMPLETE(m@)")
>   (type "(-)")
> ))


Disregard that there are key collisions, and notice the last entry, which I
made to be able to easily remove the TODO tags altogether. Well, I guess
I'll have to lose it.

Thanks for the attention!
Kosta


-- 
Konstantin Kliakhandler
http://slumpy.org
  )°) )°( (°(

On 2 September 2015 at 20:20, Kyle Meyer  wrote:

> Hello,
>
> Konstantin Kliakhandler  writes:
>
> > Hello,
> >
> > When I start a new heading and don't add text yet but click
> M-right/M-left,
> > new spaces are tacked to the end so that when I do begin to write,
> > sometimes there are too many spaces at the front.
>
> [...]
>
> > Steps to reproduce:
> > 1. Make a heading with some text underneath
> > 2. M-Return to create a new heading
> > 3. M-Right, M-Left would get you to the same heading level, but the
> cursor
> > would be further to the right than started with.
>
> I'm unable to reproduce this running 'emacs -Q' with either
> release_8.3.1-194-ga2d0cd9 or release_8.3.1.  The cursor remains one
> space from the last star.
>
> --
> Kyle
>


Re: [O] org-do-**mote does not work properly on empty headings

2015-09-02 Thread Kyle Meyer
Konstantin Kliakhandler  writes:

>(setq org-todo-keywords
>  '((type "TODO(t!)" "|" "DONE(d!)" "CANCELLED(c@)")
>(type "HABIT(h!)" "|" "DONE(d!)")
>(type "WAITING(w@/!)" "FUTURE(f!/@)" "STARTED(s@/!)" "|"
>  "DONE(d!)")
>(type "|" "NOTE(n)" "NUMBER(#)" "CREDENTIAL($)" "OBJECT(o)"
>  "TEMP(e)")
>(type "EVENT(n)")
>(type "PROJECT(p!)" "|" "COMPLETE(m@)")
>(type "(-)")
>  ))
> Disregard that there are key collisions, and notice the last entry, which I
> made to be able to easily remove the TODO tags altogether.

One way to remove the TODO state is to give a numeric prefix higher than
the number of states you have.  You have a lot of states, but something
like 'C-99 C-c C-t' should work and is only a little harder to type than
'C-c C-t -'.

--
Kyle



Re: [O] org-do-**mote does not work properly on empty headings

2015-09-02 Thread Konstantin Kliakhandler
Good to know, thanks!

-- 
Konstantin Kliakhandler
http://slumpy.org
  )°) )°( (°(

On 2 September 2015 at 22:22, Kyle Meyer  wrote:

> Konstantin Kliakhandler  writes:
>
> >(setq org-todo-keywords
> >  '((type "TODO(t!)" "|" "DONE(d!)" "CANCELLED(c@)")
> >(type "HABIT(h!)" "|" "DONE(d!)")
> >(type "WAITING(w@/!)" "FUTURE(f!/@)" "STARTED(s@/!)" "|"
> >  "DONE(d!)")
> >(type "|" "NOTE(n)" "NUMBER(#)" "CREDENTIAL($)" "OBJECT(o)"
> >  "TEMP(e)")
> >(type "EVENT(n)")
> >(type "PROJECT(p!)" "|" "COMPLETE(m@)")
> >(type "(-)")
> >  ))
> > Disregard that there are key collisions, and notice the last entry,
> which I
> > made to be able to easily remove the TODO tags altogether.
>
> One way to remove the TODO state is to give a numeric prefix higher than
> the number of states you have.  You have a lot of states, but something
> like 'C-99 C-c C-t' should work and is only a little harder to type than
> 'C-c C-t -'.
>
> --
> Kyle
>


Re: [O] [PATCH 2/3] org-datetree.el: Add support for ISO week trees.

2015-09-02 Thread Nicolas Goaziou
Rüdiger Sonderfeld  writes:

> On Wednesday 02 September 2015 21:58:17 Nicolas Goaziou wrote:
>> Rüdiger Sonderfeld  writes:
>> > +(let ((prop (org-find-property "DATE_WEEK_TREE")))
>> 
>> I don't think we need to introduce a new property for that. DATE_TREE is
>> enough.
>
> Since DATE_TREE and DATE_WEEK_TREE (or WEEK_TREE instead?) are structured 
> differently it might make sense to keep the property separated.

If you want both a date tree and a week tree in the same, you probably
want them to start at the same level, don't you?

>> > +  ;; ISO 8601 week format is %G-W%V(-%u)
>> > +  (org-datetree--find-create "^\\*+[
>> > \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\\([
>> > \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)"
>> Isn't this line too long?
>
> What's the limit?  Because if it's 80 char then I'd need to do some `concat' 
> ugliness because the regex is over 80 char long.

You can use continuation markup, i.e., "\\n".


Regards,