Re: [O] [RFC] org-agenda: Jump directly to line in case of a timestamp

2017-10-07 Thread Matt Lundin
Marco Wahl  writes:

> Nicolas Goaziou  writes:
>
>> Hello,
>>
>> Marco Wahl  writes:
>>
>>>
>>> Pressing TAB in the agenda would jump to the respective plain list item.
>>>
>>> Find the concrete patch below.
>>>
>>> WDYT?
>>
>> I have the feeling that both behaviours are useful. All things being
>> equal, this is the entry being displayed in the Agenda, not necessarily
>> the line containing the timestamp. Moreover this feature could be less
>> meaningful if `org-agenda-skip-additional-timestamps-same-entry' is
>> non-nil.
>>
>> Maybe an optional argument could allow one to switch from one behaviour
>> to the other. I have no strong opinion about this, though.
>
> Thanks!
>
> I just found function `org-agenda-switch-to' which is similar to
> `org-agenda-goto' but does not the jump to the headline.
>
> I personally configure this function to be on shift-tab.
>
> (org-defkey org-agenda-mode-map [(backtab)] #'org-agenda-switch-to)

And, as a bonus, org-agenda-switch-to is bound to RET by default. I've
happily been hitting return since 2008 to jump directly to timestamps.
:)

The only difference, if I remember correctly, is that
org-agenda-switch-to replaces the agenda buffer with the target org
buffer, whereas org-agenda-goto shows the target org buffer in another
window. 

Best,
Matt




[O] Bug: C-c C-c on deadline timestamp can do nothing useful [9.1.2 (9.1.2-elpaplus @ /Users/aaronjensen/.emacs.d/elpa/26.0/org-plus-contrib-20171004/)]

2017-10-07 Thread Aaron Jensen

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


>From emacs -Q:

M-x org-mode
Insert the following:

* Test
  DEADLINE: <2017-10-06 Sat>

Place point on timestamp and hit C-c C-c

Expected:

Timestamp updated to <2017-10-06 Fri>

Actual:

This is displayed in *Messages*:

user-error: ‘C-c C-c’ can do nothing useful here


Emacs  : GNU Emacs 26.0.60 (build 1, x86_64-apple-darwin17.0.0, NS 
appkit-1561.00 Version 10.13 (Build 17A365))
 of 2017-09-30
Package: Org mode version 9.1.2 (9.1.2-elpaplus @ 
/Users/aaronjensen/.emacs.d/elpa/26.0/org-plus-contrib-20171004/)



Re: [O] asymmetry between org-backward-sentence and org-forward-sentence around headings

2017-10-07 Thread Mat Vibrys
Sorry,
my example contents does not seem to be proper. Dots are missing after all
the bodyX. correct one looks like following:

* head1

  body1.

* head2

  body2.

* head3

  body3.

calling `org-forward-sentence' from  goes to , while it should
to to somewhere after head2 and before body2. Calling
`org-backward-sentence' from  goes before body2 and after head2,
which is correct.

regards,
Mat


On Sat, Oct 7, 2017 at 11:13 PM, Mat Vibrys  wrote:

> Nicolas,
> thank You for fix, I've just did some testing on it and found some
> contents where assymetry still persists. cursor position is marked with
>  and IT IS NOT PART OF FILE CONTENTS.
>
>
> * head1
>
>   body1
>
> * head2
>
>   body2
>
> * head3.
>
>   body3
>
>
> calling `org-forward-sentence' from  will go to , while IMO it
> should not go that far, I mean it should stop somewhere BEFORE body2 line
> and AFTER head2 line. This is where cursor is stopped when You travel from
>  using `org-backward-sentence'.
>
> regards.
>
>
> On Tue, Sep 12, 2017 at 9:07 AM, Nicolas Goaziou 
> wrote:
>
>> Hello,
>>
>> Mat Vibrys  writes:
>>
>> >   Org file looks like following:
>> >
>> >   * heading
>> > my line.
>> >
>> >   when cursor is at beginning of file, `org-forward-sentence' goes to
>> the
>> > end of "my line.", which does not seem to be correct (heading is special
>> > outline). Then calling `org-backward-sentence' behaves correctly, ie it
>> > goes to the beginning of "my line.".
>>
>> Fixed. Thank you.
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>
>


Re: [O] asymmetry between org-backward-sentence and org-forward-sentence around headings

2017-10-07 Thread Mat Vibrys
Nicolas,
thank You for fix, I've just did some testing on it and found some contents
where assymetry still persists. cursor position is marked with  and
IT IS NOT PART OF FILE CONTENTS.


* head1

  body1

* head2

  body2

* head3.

  body3


calling `org-forward-sentence' from  will go to , while IMO it
should not go that far, I mean it should stop somewhere BEFORE body2 line
and AFTER head2 line. This is where cursor is stopped when You travel from
 using `org-backward-sentence'.

regards.


On Tue, Sep 12, 2017 at 9:07 AM, Nicolas Goaziou 
wrote:

> Hello,
>
> Mat Vibrys  writes:
>
> >   Org file looks like following:
> >
> >   * heading
> > my line.
> >
> >   when cursor is at beginning of file, `org-forward-sentence' goes to the
> > end of "my line.", which does not seem to be correct (heading is special
> > outline). Then calling `org-backward-sentence' behaves correctly, ie it
> > goes to the beginning of "my line.".
>
> Fixed. Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] function for inserting a block

2017-10-07 Thread Eric Abrahamsen
Nicolas Goaziou  writes:

> Hello,
>
> Eric Abrahamsen  writes:
>
>> Nicolas Goaziou  writes:
>>
>>
>> [...]
>>
>>> C-c C-x t is free, tho.
>>
>> Oops, I think that's what I meant to type. Here's the latest version of
>> the patch -- I removed the bit fooling with the location of point at the
>> end, as it seemed simpler was better. How's this look?
>
> `newline-and-indent' and `mark' shouldn't be used in the function.

This must be a personal record for number of screw-ups in a single
commit... That was an old version from a different computer.

But still, I'm not entirely confident about the indentation handling.
This is my best guess -- it seems to work, and doesn't get confused by
`org-indent-mode'.

> Otherwise, it looks good. Could you provide some tests for that in
> "test-org.el"?

How does this look?

Eric

>From d859c241053aef2dd2f2a9b04f4030de54eb330d Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen 
Date: Sat, 7 Oct 2017 13:01:14 -0700
Subject: [PATCH] New function org-insert-structure-template

* lisp/org.el (org-insert-structure-template): New function for
  wrapping region (or element at point) in a begin/end block.
* etc/ORG-NEWS: Mention in news.
* doc/org.texi (Structure of code blocks, Easy templates): And in
  manual.
* testing/lisp/test-org.el (test-org/insert-template): New test.
---
 doc/org.texi | 21 +++--
 etc/ORG-NEWS |  5 +
 lisp/org.el  | 40 
 testing/lisp/test-org.el | 36 
 4 files changed, 96 insertions(+), 6 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index fd26d9790..fd537ded4 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15215,12 +15215,14 @@ A @samp{src} block conforms to this structure:
 #+END_SRC
 @end example
 
-Org mode's templates system (@pxref{Easy templates}) speeds up creating
-@samp{src} code blocks with just three keystrokes.  Do not be put-off by
-having to remember the source block syntax.  Org also works with other
-completion systems in Emacs, some of which predate Org and have custom
-domain-specific languages for defining templates.  Regular use of templates
-reduces errors, increases accuracy, and maintains consistency.
+Do not be put off by having to remember the source block syntax.  Org mode
+offers two ways of speeding up the creation of @samp{src} code blocks: a
+templates system that can create a new block with just three keystrokes, and
+a command for wrapping existing text in a block (@pxref{Easy templates}).
+Org also works with other completion systems in Emacs, some of which predate
+Org and have custom domain-specific languages for defining templates.
+Regular use of templates reduces errors, increases accuracy, and maintains
+consistency.
 
 @cindex source code, inline
 An inline code block conforms to this structure:
@@ -17391,6 +17393,13 @@ Org comes with these pre-defined easy templates:
 More templates can added by customizing the variable
 @code{org-structure-template-alist}, whose docstring has additional details.
 
+@findex org-insert-structure-template
+Easy templates are ideal when writing new content, but sometimes it is
+necessary to mark up existing content.  For these cases, Org provides the
+function @code{org-insert-structure-template}, which prompts for a block
+type, and wraps either the active region or the current Org element in that
+block.  This command is bound to @kbd{C-c C-x t} by default.
+
 @node Speed keys
 @section Speed keys
 @cindex speed keys
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 53d604b8c..ed487b20f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -105,6 +105,11 @@ you should expect to see something like:
   ,#+STARTUP: shrink
 #+END_EXAMPLE
 
+** New Functions
+*** ~org-insert-structure-template~
+
+This function can be used to wrap existing text of Org elements in
+a #+BEGIN_FOO/#+END_FOO block.  Bound to C-c C-x t by default.
 ** Miscellaneous
 
 *** ~org-publish-resolve-external-link~ accepts a new optional argument.
diff --git a/lisp/org.el b/lisp/org.el
index 5a60e34cb..f888af09c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12199,6 +12199,45 @@ expands them."
 (insert rpl)
 (when (re-search-backward "\\?" start t) (delete-char 1
 
+(defun org-insert-structure-template (type)
+  "Insert a block structure of the type #+BEGIN_FOO/#+END_FOO.
+Prompts for a block type, and inserts the block.  With an active
+region, wrap the region in the block.  With an element under
+point, wrap the element in the block.  Otherwise, insert an empty
+block."
+  (interactive "sBlock type: ")
+  (unless (use-region-p)
+(when (org-element-at-point)
+  (org-mark-element)))
+  (let ((s (copy-marker (if (use-region-p)
+			(region-beginning)
+			  (point
+	(e (copy-marker (if (use-region-p)
+			(region-end)
+			  (point))
+			t))
+	column)
+(when 

Re: [O] S5 HTML export - org9.1.1

2017-10-07 Thread Kyle Meyer
dchechi...@gmail.com writes:

> I have evaluated the following function found in ox-html.el
> and indeed the S5 html works when this function is defined.
>
> (defun org-html-end-plain-list (type)
>   "Insert the end of the HTML list depending on TYPE."
>   (case type
> (`ordered "")
> (`unordered "")
> (`descriptive "")))

Yes, that's the function that was removed in 8855c23c6.

> I don't know if this function should appear accordly in
> ox-S5.el or elsewhere. As I don't use development environment
> I don't know how a patch has to be submitted.
>
> Anyway thank for your help. Hope it can be useful for the
> person who knows how to implement it and where.

I don't use ox-s5.el, but the I think the below fix should do.  I'll
push it in a few days if no one objects.

-- >8 --
Subject: [PATCH] ox-s5: Don't use org-html-end-plain-list

* contrib/lisp/ox-s5.el (org-s5-plain-list): Adjust for the removal of
org-html-end-plain-list.

The function org-html-end-plain-list was deleted in
8855c23c6 (ox-html: Plain list supports arbitrary attributes,
2017-02-13).

Reported-by: 

---
 contrib/lisp/ox-s5.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index 8f9501058..0496aae19 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -292,7 +292,8 @@ (defun org-s5-plain-list (plain-list contents info)
  "<%s class='org-%s%s'>" tag tag
  (if (org-export-get-node-property :INCREMENTAL plain-list t)
  " incremental" ""))
-contents (org-html-end-plain-list type
+contents
+   (format "" tag
 
 (defun org-s5-inner-template (contents info)
   "Return body of document string after HTML conversion.
-- 
2.14.2




Re: [O] Is there a way to get all agenda TODOs programmatically?

2017-10-07 Thread Matt Lundin
Marcin Borkowski  writes:

> On 2017-10-07, at 16:20, Matt Lundin  wrote:
>
>> Hi Marcin,
>>
>> Marcin Borkowski  writes:
>>
>>> I'd like to get a list of all agenda TODOs, with titles and due dates.
>>> Is there something ready in Org/contrib/blogosphere to help me?
>>
>> This functionality is built into org-mode. The simplest way to get such
>> a list is to use the agenda (specifically M-x org-todo-list). To display
>> scheduling information you can customize the variable
>> org-agenda-prefix-format.
>
> I know (and use) that.  What I want is not /display/, but a /data
> structure/ containing that info.

Ah, I see! A lisp list, not a list on the screen.

>> Finally, if you want simply to gather the todo data programmatically for
>> further processing you can use the function org-map-entries.
>
> Thanks, that seems to be a good pointer.  I'll check it out.

I think something like this would generate a such a list:

(org-map-entries '(cons (nth 4 (org-heading-components))
 (list (org-get-deadline-time nil)))
  "/!TODO" 'agenda)

Each item in the list would look something like this:

("Test" (23000 24400))

You could then feed the list to whatever function you'd like.

Best,
Matt



Re: [O] Is there a way to get all agenda TODOs programmatically?

2017-10-07 Thread Marcin Borkowski

On 2017-10-07, at 16:20, Matt Lundin  wrote:

> Hi Marcin,
>
> Marcin Borkowski  writes:
>
>> I'd like to get a list of all agenda TODOs, with titles and due dates.
>> Is there something ready in Org/contrib/blogosphere to help me?
>
> This functionality is built into org-mode. The simplest way to get such
> a list is to use the agenda (specifically M-x org-todo-list). To display
> scheduling information you can customize the variable
> org-agenda-prefix-format.

I know (and use) that.  What I want is not /display/, but a /data
structure/ containing that info.

>> The problem I'm trying to solve is to make some kind of a metric of how
>> I'm doing with my TODO list, like "how many overdue tasks do I have", or
>> even better, such a sum weighted by the time after the deadline, or
>> something similar.
>
> If you use the "DEADLINE" keyword (M-x org-deadline, bound to C-c C-d),
> then the daily/weekly agenda (M-x org-agenda-list) will display any
> overdue tasks.
>
> Finally, if you want simply to gather the todo data programmatically for
> further processing you can use the function org-map-entries.

Thanks, that seems to be a good pointer.  I'll check it out.

> Best,
> Matt

Best,

-- 
Marcin Borkowski



Re: [O] Tangling based on file level #+PROPERTY

2017-10-07 Thread Ken Mankoff
Strange, and nevermind. Restarting emacs fixed it. It must have been
something to do with stale files and the upgrade.

  -k.

On Sat, Oct 7, 2017 at 3:44 PM, Kaushal Modi  wrote:

> On Sat, Oct 7, 2017, 7:10 AM Ken Mankoff  wrote:
>
>> Hi Org List,
>>
>> I just upgraded to 9.1.2.
>>
>
> What version did you upgrade from?
>
> I have a file with this at the top:
>>
>> #+PROPERTY: header-args  :tangle filename
>>
>> And a lot of SRC blocks with this header:
>>
>> #+BEGIN_SRC emacs-lisp
>> #+END_SRC
>>
>> In the past, when I tangled the file, I got ~100 blocks exported. Now I
>> get 5, because only 5 have explicit ":tangle" arguments in the header.
>>
>> I just checked the NEWS file and did not see mention of this change. Has
>> something changed with the header-arg properties? Babel?
>>
>
> It impossible to tell what's wrong with just that information. Can you
> share a minimum working example that demonstrates this? (something that
> should probably tangle 3 files but is instead tangling just 1?)
>
> My best guess is you have this style of  incompatible properties?
>
> *** Old Babel header properties are no longer supported
>
> Using header arguments as property names is no longer possible. As
> such, the following
>
> #+BEGIN_EXAMPLE
> ,* Headline
> :PROPERTIES:
> :exports: code
> :var: a=1 b=2
> :var+: c=3
> :END:
> #+END_EXAMPLE
>
> should be written instead
>
> #+BEGIN_EXAMPLE
> ,* Headline
> :PROPERTIES:
> :header-args: :exports code
> :header-args+: :var a=1 b=2
> :header-args+: :var c=3
> :END:
> #+END_EXAMPLE
>
> Please note that, however, old properties were defined at the source
> block definition. Current ones are defined where the block is called.
>
> --
>
> Kaushal Modi
>


Re: [O] [RFC] org-agenda: Jump directly to line in case of a timestamp

2017-10-07 Thread Marco Wahl
Nicolas Goaziou  writes:

> Hello,
>
> Marco Wahl  writes:
>
>> Let's say in an Org file you have the following plain list.
>>
>> * test
>>
>> - <2017-10-07 Sat 16:25> Start writing the RFC.
>> - <2017-10-07 Sat 16:29> Thought: "Will somebody notice?"
>> - <2017-10-07 Sat 16:30> Sent the RFC to the list.
>>
>> For each list item a corresponding line appears in the day agenda.
>>
>>   .tmp   .:16:25.. test
>>   .tmp   .:16:29.. test
>>   .tmp   .:16:30.. test
>>
>> Pressing TAB in the agenda would jump to the respective plain list item.
>>
>> Find the concrete patch below.
>>
>> WDYT?
>
> I have the feeling that both behaviours are useful. All things being
> equal, this is the entry being displayed in the Agenda, not necessarily
> the line containing the timestamp. Moreover this feature could be less
> meaningful if `org-agenda-skip-additional-timestamps-same-entry' is
> non-nil.
>
> Maybe an optional argument could allow one to switch from one behaviour
> to the other. I have no strong opinion about this, though.

Thanks!

I just found function `org-agenda-switch-to' which is similar to
`org-agenda-goto' but does not the jump to the headline.

I personally configure this function to be on shift-tab.

(org-defkey org-agenda-mode-map [(backtab)] #'org-agenda-switch-to)

So no need for a change.


Thanks again and best regards
 Marco



Re: [O] S5 HTML export - org9.1.1

2017-10-07 Thread dchechin92
Hello,

I have evaluated the following function found in ox-html.el
and indeed the S5 html works when this function is defined.

(defun org-html-end-plain-list (type)
  "Insert the end of the HTML list depending on TYPE."
  (case type
(`ordered "")
(`unordered "")
(`descriptive "")))


I don't know if this function should appear accordly in
ox-S5.el or elsewhere. As I don't use development environment
I don't know how a patch has to be submitted.

Anyway thank for your help. Hope it can be useful for the
person who knows how to implement it and where.

Regards




Re: [O] S5 HTML export - org9.1.1

2017-10-07 Thread Kyle Meyer
Hello,

dchechi...@gmail.com writes:

> Since I upgrade to org-9.1.1, the export to S5 HTML seems not to work
> whereas it used to work before this upgrade.
>
> I have the following message :
> "format: Symbol's function definition is void: org-html-end-plain-list"
> I use GNU Emacs 25.1.1 (x86_64-w64-mingw32).
>
> Do someone as the same problem ? Is there something wrong in my configuration 
> ?

It looks like org-html-end-plain-list was removed in 8855c23c6 (ox-html:
Plain list supports arbitrary attributes, 2017-02-13).  ox-s5.el needs
to be adjusted accordingly (essentially following the changes that
8855c23c6 made to org-html-plain-list, I think).  Would you like to
submit a patch?

-- 
Kyle



Re: [O] [RFC] org-agenda: Jump directly to line in case of a timestamp

2017-10-07 Thread Nicolas Goaziou
Hello,

Marco Wahl  writes:

> Let's say in an Org file you have the following plain list.
>
> * test
>
> - <2017-10-07 Sat 16:25> Start writing the RFC.
> - <2017-10-07 Sat 16:29> Thought: "Will somebody notice?"
> - <2017-10-07 Sat 16:30> Sent the RFC to the list.
>
> For each list item a corresponding line appears in the day agenda.
>
>   .tmp.:16:25.. test
>   .tmp.:16:29.. test
>   .tmp.:16:30.. test
>
> Pressing TAB in the agenda would jump to the respective plain list item.
>
> Find the concrete patch below.
>
> WDYT?

I have the feeling that both behaviours are useful. All things being
equal, this is the entry being displayed in the Agenda, not necessarily
the line containing the timestamp. Moreover this feature could be less
meaningful if `org-agenda-skip-additional-timestamps-same-entry' is
non-nil.

Maybe an optional argument could allow one to switch from one behaviour
to the other. I have no strong opinion about this, though.

Regards,

-- 
Nicolas Goaziou



Re: [O] org-open-at-point fails on internal links

2017-10-07 Thread Nicolas Goaziou
Hello,

Kyle Meyer  writes:

> Hello,
>
> Scott Otterson  writes:
>
>> When I click on an internal link to an anchor, I get the error message:
>>
>> "Wrong type argument: number-or-marker-p"
>>
>> The same happens if I type C-c C-o on the link.  This is mapped
>> to org-open-at-point, which should handle internal links.
>
> [...]
>
>> This behavior is new, I believe since the last org package update.  I'm
>> currently on org mode version 9.1.2.
>>
>> -- Example Org File ---
>>
>> * headline 1
>>   <>
>> * headline 2
>> *** [[Anchor 1]]  CLICK ON THIS
>
> FWIW I'm not able to reproduce this with 9.1.2.

Ditto. Maybe a backtrace would help.

Regards,

-- 
Nicolas Goaziou



Re: [O] Can I use a custom mode for org-src-lang-modes and still get syntax highlighting?

2017-10-07 Thread Nicolas Goaziou
Hello,

david wen riccardi-zhu  writes:

> I'm trying to get syntax highlighting with org-mode source blocks
> using a custom language mode for editing JavaScript. I use js2-mode
> with a bunch of minor modes, rather than js-mode, which is what
> org-mode uses by default.
>
> I was able to get org-mode to use js2-mode for editing code by
> customizing org-src-lang-modes, where I set the Cons-cell for
> javacript to js2.
>
> However, syntax highlighting has stopped working in the org buffer (it
> works fine in the source buffer). This is with
> org-src-fontify-natively set to true, which the documentation suggests
> is the only requirement.
>
> Is there anything I'm missing?

`org-src-font-lock-fontify-block' uses the same mechanism as
`org-edit-src-code' to determine what major mode to load. IOW, it should
work out of the box.

Could you provide an ECM?

Regards,

-- 
Nicolas Goaziou



Re: [O] org-open-at-point fails on internal links

2017-10-07 Thread Kyle Meyer
Hello,

Scott Otterson  writes:

> When I click on an internal link to an anchor, I get the error message:
>
> "Wrong type argument: number-or-marker-p"
>
> The same happens if I type C-c C-o on the link.  This is mapped
> to org-open-at-point, which should handle internal links.

[...]

> This behavior is new, I believe since the last org package update.  I'm
> currently on org mode version 9.1.2.
>
> -- Example Org File ---
>
> * headline 1
>   <>
> * headline 2
> *** [[Anchor 1]]  CLICK ON THIS

FWIW I'm not able to reproduce this with 9.1.2.

-- 
Kyle



[O] [RFC] org-agenda: Jump directly to line in case of a timestamp

2017-10-07 Thread Marco Wahl
Hello,

This is a little proposition about changing the behaviour of
`org-agenda-goto' which typically gets triggered when pressing TAB on an
line in the Org agenda.

The proposition affects only the case of an agenda line due to a
timestamp outside a planning line (i.e. SCHEDULED or DEADLINE.)

Up to now `org-agenda-goto' jumps always to the corresponding headline.
With the patch `org-agenda-goto' would jump directly to the line
containing the timestamp.

If you use plain lists with timestamps this can be helpful.

Let's say in an Org file you have the following plain list.

* test

- <2017-10-07 Sat 16:25> Start writing the RFC.
- <2017-10-07 Sat 16:29> Thought: "Will somebody notice?"
- <2017-10-07 Sat 16:30> Sent the RFC to the list.

For each list item a corresponding line appears in the day agenda.

  .tmp  .:16:25.. test
  .tmp  .:16:29.. test
  .tmp  .:16:30.. test

Pressing TAB in the agenda would jump to the respective plain list item.

Find the concrete patch below.

WDYT?


Best regards
Marco


--8<---cut here---start->8---
>From e2fd5f36b33e17063cf06f8df7b5d924c751b327 Mon Sep 17 00:00:00 2001
From: Marco Wahl 
Date: Sat, 7 Oct 2017 15:57:36 +0200
Subject: [PATCH] org-agenda: Jump directly to line in case of a timestamp
 entry

* lisp/org-agenda.el (org-agenda-goto): Don't move back to heading
  when on a line with a free standing timestamp.
---
 lisp/org-agenda.el | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index fb5448ef8..6fd16b659 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8424,10 +8424,12 @@ When called with a prefix argument, include all archive 
files as well."
 (when (derived-mode-p 'org-mode)
   (org-show-context 'agenda)
   (recenter (/ (window-height) 2))
-  (org-back-to-heading t)
-  (let ((case-fold-search nil))
-   (when (re-search-forward org-complex-heading-regexp nil t)
- (goto-char (match-beginning 4)
+  (unless (and (looking-at org-ts-regexp-both)
+  (not (org-at-planning-p)))
+   (org-back-to-heading t)
+   (let ((case-fold-search nil))
+ (when (re-search-forward org-complex-heading-regexp nil t)
+   (goto-char (match-beginning 4))
 (run-hooks 'org-agenda-after-show-hook)
 (and highlight (org-highlight (point-at-bol) (point-at-eol)
 
-- 
2.14.2

--8<---cut here---end--->8---




[O] S5 HTML export - org9.1.1

2017-10-07 Thread dchechin92
Hello,

Since I upgrade to org-9.1.1, the export to S5 HTML seems not to work
whereas it used to work before this upgrade.

I have the following message :
"format: Symbol's function definition is void: org-html-end-plain-list"
I use GNU Emacs 25.1.1 (x86_64-w64-mingw32).

Do someone as the same problem ? Is there something wrong in my configuration ?

Regards




Re: [O] Is there a way to get all agenda TODOs programmatically?

2017-10-07 Thread Matt Lundin
Hi Marcin,

Marcin Borkowski  writes:

> I'd like to get a list of all agenda TODOs, with titles and due dates.
> Is there something ready in Org/contrib/blogosphere to help me?

This functionality is built into org-mode. The simplest way to get such
a list is to use the agenda (specifically M-x org-todo-list). To display
scheduling information you can customize the variable
org-agenda-prefix-format.

> The problem I'm trying to solve is to make some kind of a metric of how
> I'm doing with my TODO list, like "how many overdue tasks do I have", or
> even better, such a sum weighted by the time after the deadline, or
> something similar.

If you use the "DEADLINE" keyword (M-x org-deadline, bound to C-c C-d),
then the daily/weekly agenda (M-x org-agenda-list) will display any
overdue tasks.

Finally, if you want simply to gather the todo data programmatically for
further processing you can use the function org-map-entries.

Best,
Matt






[O] [RFC] Exclude headlines from TOC, take 2

2017-10-07 Thread Nicolas Goaziou
Hello,

Here is another take on the possibility to exclude headlines from the
table of contents.

Last attempt was rejected because users need to include /unnumbered/
headlines in the TOC. Point taken. However, I don't think it makes sense
to exclude /numbered/ headlines from the TOC. Hence, I propose to
exclude any headline with an UNNUMBERED property set to "notoc".

So basically,

  - only unnumbered headlines can be excluded
  - we do not introduce another property

Here is an example document, with the generated TOC in plain text
export:

--8<---cut here---start->8---
#+options: toc:t

* H1
:PROPERTIES:
:UNNUMBERED: t
:END:

* H2

** H2.1

** H2.2
:PROPERTIES:
:UNNUMBERED: notoc
:END:

*** H221

** H2.3

* H3
:PROPERTIES:
:UNNUMBERED: notoc
:END:


* H4

* H5
:PROPERTIES:
:UNNUMBERED: t
:END:
--8<---cut here---end--->8---

gives

  H1
  1 H2
  .. 1.1 H2.1
  .. 1.2 H2.3
  2 H4
  H5


I attach a possible implementation, with documentation and tests. Note
that this doesn't work with LaTeX export back-end, which still dutifully
ignores any unnumbered headline. Patches welcome to improve this.

WDYT?


Regards,

-- 
Nicolas Goaziou0x80A93738
>From e6c6534997e03d4817a95c6f57f9c0421810c50b Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Sat, 7 Oct 2017 16:03:17 +0200
Subject: [PATCH] ox: Implement "notoc" UNNUMBERED value

* lisp/ox.el (org-export-collect-headlines): Exclude headlines with
  UNNUMBERED property set to "notoc".

* doc/org.texi (Export settings):
(Table of contents): Document new value.

* testing/lisp/test-ox.el (test-org-export/collect-headlines): Add
  test.
---
 doc/org.texi| 24 +---
 etc/ORG-NEWS|  3 +++
 lisp/ox.el  | 14 +-
 testing/lisp/test-ox.el | 15 +++
 4 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index fd26d9790..146699b11 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10813,7 +10813,9 @@ Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
 Toggle section-numbers (@code{org-export-with-section-numbers}).  When set to
 number @samp{n}, Org numbers only those headlines at level @samp{n} or above.
 Set @code{UNNUMBERED} property to non-@code{nil} to disable numbering of
-heading and subheadings entirely.
+heading and subheadings entirely.  Moreover, when the value is @samp{notoc}
+the headline, and all its children, do not appear in the table of contents
+either (@pxref{Table of contents}.
 
 @item p:
 @vindex org-export-with-planning
@@ -10911,6 +10913,22 @@ keyword:
 #+OPTIONS: toc:nil@r{no default TOC at all}
 @end example
 
+@cindex excluding entries from table of contents
+@cindex table of contents, exclude entries
+Org includes both numbered and unnumbered headlines in the table of
+contents@footnote{At the moment, some export back-ends, notably @LaTeX{}, do
+not obey this specification.  They simply exclude every unnumbered headline
+from the table of contents.}.  If you need to exclude unnumbered headlines,
+along with all their children, set their @samp{UNNUMBERED} property to
+@samp{notoc} value.
+
+@example
+* Subtree not numbered, not in table of contents either
+  :PROPERTIES:
+  :UNNUMBERED: notoc
+  :END:
+@end example
+
 @cindex #+TOC
 Org normally inserts the table of contents directly before the first headline
 of the file.  To move the table of contents to a different location, first
@@ -10935,8 +10953,8 @@ compatibility issues, @code{titletoc} has to be loaded @emph{before}
 variable.
 
 @example
-* Section #+TOC: headlines 1 local @r{insert local TOC, with direct children
-only}
+* Section
+#+TOC: headlines 1 local @r{insert local TOC, with direct children only}
 @end example
 
 Use the @code{TOC} keyword to generate list of tables (resp.@: all listings)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 53d604b8c..86c253d9c 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -26,6 +26,9 @@ document, use =shrink= value instead, or in addition to align:
 #+END_EXAMPLE
 
 ** New features
+*** Exclude unnumbered headlines from table of contents
+Set their =UNNUMBERED= property to the special =notoc= value.  See
+manual for details.
 *** ~org-archive~ functions update status cookies
 
 Archiving headers through ~org-archive-subtree~ and
diff --git a/lisp/ox.el b/lisp/ox.el
index 4d3d7afb9..cba254d6f 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5223,12 +5223,16 @@ Footnote sections are ignored."
 	 (n (if (not (wholenump n)) limit
 	  (min (if (eq (org-element-type scope) 'org-data) n
 		 (+ (org-export-get-relative-level scope info) n))
-		   limit
+		   limit)))
+	 (skipped nil))
 (org-element-map (org-element-contents scope) 'headline
-  (lambda (headline)
-	(unless (org-element-property :footnote-section-p headline)
-	  (let ((level 

Re: [O] Tangling based on file level #+PROPERTY

2017-10-07 Thread Kaushal Modi
On Sat, Oct 7, 2017, 7:10 AM Ken Mankoff  wrote:

> Hi Org List,
>
> I just upgraded to 9.1.2.
>

What version did you upgrade from?

I have a file with this at the top:
>
> #+PROPERTY: header-args  :tangle filename
>
> And a lot of SRC blocks with this header:
>
> #+BEGIN_SRC emacs-lisp
> #+END_SRC
>
> In the past, when I tangled the file, I got ~100 blocks exported. Now I
> get 5, because only 5 have explicit ":tangle" arguments in the header.
>
> I just checked the NEWS file and did not see mention of this change. Has
> something changed with the header-arg properties? Babel?
>

It impossible to tell what's wrong with just that information. Can you
share a minimum working example that demonstrates this? (something that
should probably tangle 3 files but is instead tangling just 1?)

My best guess is you have this style of  incompatible properties?

*** Old Babel header properties are no longer supported

Using header arguments as property names is no longer possible. As
such, the following

#+BEGIN_EXAMPLE
,* Headline
:PROPERTIES:
:exports: code
:var: a=1 b=2
:var+: c=3
:END:
#+END_EXAMPLE

should be written instead

#+BEGIN_EXAMPLE
,* Headline
:PROPERTIES:
:header-args: :exports code
:header-args+: :var a=1 b=2
:header-args+: :var c=3
:END:
#+END_EXAMPLE

Please note that, however, old properties were defined at the source
block definition. Current ones are defined where the block is called.

-- 

Kaushal Modi


[O] Can I use a custom mode for org-src-lang-modes and still get syntax highlighting?

2017-10-07 Thread david wen riccardi-zhu
I'm trying to get syntax highlighting with org-mode source blocks 
using a custom language mode for editing JavaScript. I use 
js2-mode with a bunch of minor modes, rather than js-mode, which 
is what org-mode uses by default.


I was able to get org-mode to use js2-mode for editing code by 
customizing org-src-lang-modes, where I set the Cons-cell for 
javacript to js2.


However, syntax highlighting has stopped working in the org buffer 
(it works fine in the source buffer). This is with 
org-src-fontify-natively set to true, which the documentation 
suggests is the only requirement.


Is there anything I'm missing?

Thank you,
David

--
dwrz|朱为文



[O] [PATCH v2] org-clock: Fix clock report sometimes ignoring hours before :wstart

2017-10-07 Thread Georgiy Tugai
* lisp/org-clock (org-clocktable-steps): Fix weekly-step clock report
  ignoring hours between start of period and start of week, when start
  of period is on a day of week numerically less than start of week.

  Clock report now always inserts a "week" starting at the start of
  the period, if necessary; all following weeks start on the start of
  the week as expected.

TINYCHANGE
---
 lisp/org-clock.el  | 11 -
 testing/lisp/test-org-clock.el | 99 ++
 2 files changed, 108 insertions(+), 2 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 9dc501500..d4d88144b 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2725,7 +2725,9 @@ LEVEL is an integer.  Indent by two spaces per level above 1."
   (setq te (float-time (apply #'encode-time (org-parse-time-string te))
 (setq tsb
 	  (if (eq step0 'week)
-	  (- ts (* 86400 (- (nth 6 (decode-time (seconds-to-time ts))) ws)))
+	  (let ((dow (nth 6 (decode-time (seconds-to-time ts)
+		(if (< dow ws) ts
+		  (- ts (* 86400 (- dow ws)
 	ts))
 (setq p1 (plist-put p1 :header ""))
 (setq p1 (plist-put p1 :step nil))
@@ -2735,9 +2737,14 @@ LEVEL is an integer.  Indent by two spaces per level above 1."
   (setq p1 (plist-put p1 :tstart (format-time-string
   (org-time-stamp-format nil t)
   (seconds-to-time (max tsb ts)
+  (setq tsb (+ tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb)
+			 (if (or (eq step0 'day)
+ (= dow ws))
+			 step
+			   (* 86400 (- ws dow))
   (setq p1 (plist-put p1 :tend (format-time-string
 (org-time-stamp-format nil t)
-(seconds-to-time (min te (setq tsb (+ tsb step)))
+(seconds-to-time (min te tsb)
   (insert "\n" (if (eq step0 'day) "Daily report: "
 		 "Weekly report starting on: ")
 	  (plist-get p1 :tstart) "\n")
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 30a69ea45..51ca1d458 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -828,5 +828,104 @@ CLOCK: [2016-12-28 Wed 11:09]--[2016-12-28 Wed 11:09] =>  0:00
 CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 13:09] =>  0:00"
 (test-org-clock-clocktable-contents ":tcolumns 2")
 
+(ert-deftest test-org-clock/clocktable/step ()
+  "Test \":step\" parameter in Clock table."
+  ;; Regression test: week crossing month boundary before :wstart
+  ;; day-of-week.
+  (should
+   (equal "
+Weekly report starting on: [2017-09-25 Mon]
+| Headline | Time   |
+|--+|
+| *Total time* | *1:00* |
+|--+|
+| Foo  | 1:00   |"
+(org-test-with-temp-text
+	"* Foo
+CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] =>  1:00
+CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] =>  2:00
+CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] =>  3:00"
+  (test-org-clock-clocktable-contents ":step week :block 2017-09 :stepskip0 t"
+  (should
+   (equal "
+Weekly report starting on: [2017-10-01 Sun]
+| Headline | Time   |
+|--+|
+| *Total time* | *2:00* |
+|--+|
+| Foo  | 2:00   |
+
+Weekly report starting on: [2017-10-02 Mon]
+| Headline | Time   |
+|--+|
+| *Total time* | *7:00* |
+|--+|
+| Foo  | 7:00   |
+
+Weekly report starting on: [2017-10-09 Mon]
+| Headline | Time   |
+|--+|
+| *Total time* | *5:00* |
+|--+|
+| Foo  | 5:00   |
+"
+	  (org-test-with-temp-text
+	  "* Foo
+CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] =>  1:00
+CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] =>  2:00
+CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] =>  3:00
+CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] =>  4:00
+CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] =>  5:00"
+	(test-org-clock-clocktable-contents ":step week :block 2017-10 :stepskip0 t"
+  ;; :step day
+  (should
+   (equal "
+Daily report: [2017-10-02 Mon]
+| Headline | Time   |
+|--+|
+| *Total time* | *3:00* |
+|--+|
+| Foo  | 3:00   |
+
+Daily report: [2017-10-03 Tue]
+| Headline | Time   |
+|--+|
+| *Total time* | *0:00* |
+
+Daily report: [2017-10-04 Wed]
+| Headline | Time   |
+|--+|
+| *Total time* | *0:00* |
+
+Daily report: [2017-10-05 Thu]
+| Headline | Time   |
+|--+|
+| *Total time* | *0:00* |
+
+Daily report: [2017-10-06 Fri]
+| Headline | Time   |
+|--+|
+| *Total time* | *0:00* |
+
+Daily report: [2017-10-07 Sat]
+| Headline | Time   |
+|--+|
+| *Total time* | *0:00* |
+
+Daily report: [2017-10-08 Sun]
+| Headline | Time   |
+|--+|
+| *Total time* | *4:00* |
+|--+|
+| Foo   

[O] Tangling based on file level #+PROPERTY

2017-10-07 Thread Ken Mankoff
Hi Org List,

I just upgraded to 9.1.2.

I have a file with this at the top:

#+PROPERTY: header-args  :tangle filename

And a lot of SRC blocks with this header:

#+BEGIN_SRC emacs-lisp
#+END_SRC

In the past, when I tangled the file, I got ~100 blocks exported. Now I get
5, because only 5 have explicit ":tangle" arguments in the header.

I just checked the NEWS file and did not see mention of this change. Has
something changed with the header-arg properties? Babel?

Thanks,

   -k.


[O] Fontification for the inner bloc of two nested bloc

2017-10-07 Thread Pierre-André Cornillon
Dear orgmode users/gurus,

I have a question about fontification of inner src bloc.

I have two nested blocks: one special (outer bloc) and one src (inner
bloc) like this

#+begin_bloc20171001122500
#+begin_src R
  blip <- runif(2)
  test <- rnorm(2)
#+end_src
#+end_bloc20171001122500

and I want to have the native fontification property for the inner one.

I have already (setq org-src-fontify-natively t) in my .emacs and it
works like a charm for src blocks alone (not nested) but for nested
ones it breaks.

Is nested blocks are allowed and if so, is that possible to have that
fontification property ?

Best regards,
Pierre-Andre



[O] org-open-at-point fails on internal links

2017-10-07 Thread Scott Otterson
When I click on an internal link to an anchor, I get the error message:

"Wrong type argument: number-or-marker-p"

The same happens if I type C-c C-o on the link.  This is mapped
to org-open-at-point, which should handle internal links.

However, if I type C-c o on the link, then the cursor goes to the anchor.
This is mapped to org-open-at-point-global, which the org info help says is
undefined on internal links.

This behavior is new, I believe since the last org package update.  I'm
currently on org mode version 9.1.2.

-- Example Org File ---

* headline 1
  <>
* headline 2
*** [[Anchor 1]]  CLICK ON THIS


Re: [O] [PATCH] org-clock: Fix clock report sometimes ignoring hours before :wstart

2017-10-07 Thread Nicolas Goaziou
Hello,

Georgiy Tugai  writes:

> Should I flatten the commits i.e. send original + new changes as one
> patch?

Yes, please.

> Also, I have not yet signed FSF papers -- will this pose a problem for
> incorporating the test suite changes?

I don't think so.

Thank you for the work.

Regards,

-- 
Nicolas Goaziou