Re: [O] Capture template issue ?

2019-09-19 Thread Jean-Christophe Helary
The issue is systematic.

I have changed my settings to:

 org-hide-leading-stars nil
 org-startup-folded nil 

But that doesn't change anything.

I have quasi systematically the issue I described when the file that will be 
modified by the capture is not visible when I capture, and generally I don't 
have it when it is visible when I do.

Currently, the place where that happens most (?) is when I add captured text in 
a "file+datetree" structure right over a "file+headline" structure.

Jean-Christophe Helary 

> On Sep 17, 2019, at 8:48, Jean-Christophe Helary 
>  wrote:
> 
> I have an issue with my capture templates where if I add an item at the end 
> of list, the item seems to "eat" the following line break and merges with the 
> item that follows:
> 
> * List 1
> ** item 1
> ** item 2
> * List 2
> ** item 3
> ** item 4
> 
> displayed
> 
> * List 1 ...
> * List 2 ...
> 
> I add item 5 to List 1, I should get:
> 
> * List 1
> ** item 1
> ** item 2
> ** item 5
> * List 2 ...
> 
> But instead I get
> 
> * List 1
> ** item 1
> ** item 2
> ** item 5 * List 2 ...
> 
> which makes List 2 disappear for all practical purposes.
> 
> That's pretty systematic, and very annoying.
> 
> Nearly all my templates show a similar behavior.
> 
> This one was:
> 
>  (file+headline "~/org/journal.org" "Dictionnaire")
>   "* %? :%^{tag}:\n")
> 
> I'm using the built-in 9.1.9 version, with an emacs from master built a few 
> days ago, on macos.
> 
> And my org setup is this:
> 
> (setq org-use-speed-commands t
>  org-directory "~/org"
>  org-default-notes-file (concat org-directory "/notes.org")
>  org-refile-targets '((org-agenda-files :maxlevel . 3))
>  org-refile-use-outline-path 'file
>  org-outline-path-complete-in-steps nil
>  org-refile-allow-creating-parent-nodes 'confirm
>  org-startup-indented t
>  org-use-fast-todo-selection t
>  org-return-follows-link t
>  org-link-abbrev-alist '(("message" . "mailto"))
>  org-todo-keywords
>  '((sequence "TODO(t)" "|" "DONE(d)")
>   (sequence "WAIT(w)" "|" "IN-PROGRESS" "|" "CANCELED(c)"))
>  org-agenda-files
>  '("/Users/suzume/org/" "/Users/suzume/Library/Application 
> Support/Notational Data/")
>  org-indirect-buffer-display 'current-window
>  org-modules
>  '(org-bbdb org-bibtex org-docview org-habit org-info org-irc org-mhe 
> org-protocol org-rmail)
>  org-support-shift-select t
>  org-todo-keyword-faces
>  '(("IN-PROGRESS" . "orange") ("WAIT" . "magenta") ("CANCELED" . 
> "darkgreen") ("TODO" . "pink") ("DONE" . "green")))
> 
> 
> Where should I investigate to fix this ?
> 
> 
> Jean-Christophe Helary
> ---
> http://mac4translators.blogspot.com @brandelune
> 
> 
> 

Jean-Christophe Helary
---
http://mac4translators.blogspot.com @brandelune




[O] Effort estimates on repeating tasks

2019-09-19 Thread garjola
Hi,

I like the warning in the mode line when the time clocked on a task goes
beyond the effort estimates in the properties drawer.

However, I don’t know how to use this for repeating tasks or habits.
That is, I want to work on a given task every day for less than N
minutes and be warned when going beyond this amount. Of course,
using the Effort property will warn me the first time, but will be
useless after that, unless I delete the clocked time at the beginning of
each new session.

Is there a way to do that properly?

Thanks in advance for your help.

G.
-- 



[O] ox-html: add option to restore old src block behaviour?

2019-09-19 Thread Matt Price
reiterating a question I posted to an old thread that may have gotten lost.

Over the summer, commit ded3d27b1468b878197e5fe55a70c5e13350ea27 by Nik
Clayton was merged to master. It's a one-line change that adds new ~~
tags around each lin of code in html export of source blocks.  It's useful
because it allows individual lines to be addressed directly by CSS.

However, at least one very common syntax highlighter,
https://highlinghtjs.org, expects just a single  tag, as do other
common CSS frameworks. These often leave odd borders or background color
disruptions which somewhat distort the view of the code. There's also a
funny conflict with `org-re-reveal`, which expects the old behaviour (see
https://gitlab.com/oer/org-re-reveal/issues/27).  It would in principal be
possible to fix these issues directly in CSS, but it might be much more
practical to have an option -- a defvar or a file/headline-settable
property -- that restores the old behaviour when desired.  If this would be
welcome, I could do it. I know org already has a bewildering number of
options,though,and the code change would be oddly a number of times as
large as the substantive change of that commit, os thought I'd check first.
Thanks!

Matt


Re: [O] Tables: Exclude headings in Row Number?

2019-09-19 Thread Neil Jerram
Does this answer your question?

#+NAME: tt
| num | ID |
|-+|
|   1 | A  |
|   2 | B  |
|   3 | C  |
|   4 ||
|   5 | E  |

#+BEGIN_SRC emacs-lisp :var tt=tt
(length tt)
#+END_SRC

#+RESULTS:
: 5

Best wishes,
Neil


On Wed, 18 Sep 2019 at 18:39, Nathan Neff  wrote:

> Hello all,
>
> I have a table like this:
>
>
> | ID |
> ||
> |  2 |
> |  3 |
>
> and I want to know how many rows there are w/o the ID heading
> and w/o the horizontal separator.  I found the
> org-table-toggle-coordinate-overlays
> which displays an overlay showing the row number:
>
> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>
> However, the heading is included in the row number (which makes sense).
>
> Is there a way to ignore lines above a heading (or mark a heading in some
> way?
>
> I found a way to add a seq. number by using Calc [1] but I was wondering if
> there's a way to tell the org-table-toggle-coordinate-overlays not to
> count the
> heading.
>
> Thanks,
> --Nate
>
> [1]
>
>
> | num | ID |
> |-+|
> |   1 | A  |
> |   2 | B  |
> |   3 | C  |
> |   4 ||
> |   5 | E  |
> #+TBLFM: $1=vlen(@I..0)
>
>
> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>
>
>


[O] tikz and org-mode to export into html and odt

2019-09-19 Thread Joseph Vidal-Rosset
Hello,

I have a source org file that uses tikz (and venndiagram.sty based on
tikz). No problem to export into .tex, but the export into odt and
html fails.

OpenDocument export failed: Wrong type argument: listp, 71

(One more time, I'm working for a publisher who do not knows LaTeX
No comment.)

I need help, if possible.

Best wishes,

Jo.



Re: [O] org-map-entries but with arguments?

2019-09-19 Thread Matt Price
On Wed., Sep. 18, 2019, 9:42 p.m. John Kitchin, 
wrote:

> You can get an alist of all the properties in an entry with
> org-entry-properties, and then you can let-alist these, or do something
> else. Here is an example that might be related.
>
> * test
>   :PROPERTIES:
>   :some-random-property: True
>   :END:
>
> #+BEGIN_SRC emacs-lisp :results code
> (org-entry-properties)
> #+END_SRC
>
> #+RESULTS:
> #+begin_src emacs-lisp
> (("CATEGORY" . "2019-09-18 21:33")
>  ("SOME-RANDOM-PROPERTY" . "True")
>  ("BLOCKED" . "")
>  ("FILE" . "/Users/jkitchin/Box
> Sync/kitchingroup/jkitchin/journal/2019/09/18 21:33/2019-09-18 21:33.org")
>  ("PRIORITY" . "B")
>  ("ITEM" . "test"))
> #+end_src
>
> #+BEGIN_SRC emacs-lisp
> (let-alist (cl-loop for (key . value) in (org-entry-properties)
>collect (cons (intern key) value))
>  .SOME-RANDOM-PROPERTY)
> #+END_SRC
>
> #+RESULTS:
> : True
>
> John
>

Jeez, thanks John. For some reason when I first tried org-entry-properties
I thought it was only reporting back the standard properties, like ITEM.
And in any case I had forgotten how to convert strings to symbols. This is
enormously helpful.

>
> ---
> 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
>
>
>
> On Wed, Sep 18, 2019 at 9:11 PM Matt Price  wrote:
>
>>
>> Sorry, replied to Adam directly by accident.
>>
>> On Wed, Sep 18, 2019 at 8:32 PM Matt Price  wrote:
>>
>>>
>>>
>>> On Wed, Sep 18, 2019 at 5:31 PM Adam Porter  wrote:
>>>
 Matt Price  writes:

 > Is there a lisp trick for adding arguments to the function called by
 > `org-map-entries`?
 >
 > I have the following function:
 >
 > (cl-defun org-lms-return-all-assignments ( (send-all nil)
 (also-mail nil) (post-to-lms t) )
 >   "By default mail all subtrees 'READY' to student recipients, unless
 SEND-ALL is non-nil.
 > In that case, send all marked 'READY' or 'TODO'."
 >   (interactive)
 >   (message "Mailing all READY subtrees to students")
 >   (let ((send-condition
 >  (if send-all
 >  `(or (string= (org-element-property :todo-keyword item)
 "READY")
 >   (string= (org-element-property :todo-keyword item)
 "TODO") )
 >`(string= (org-element-property :todo-keyword item)
 "READY")
 >)))
 > (org-map-entries
 >  #'ol-send-just-one))
 >   (org-cycle-hide-drawers 'all))
 >
 > I'd like to relay some of hte functions arguments to the one called
 > internally to do the work.  ~(ol-send-just-one~ takes an ~also-mail~
 > and a ~post-to-lms~ parameter,just like
 > ~org-lms-return-all-assignments~, but I'm not sure how to trick
 > org-map-entries into passing those arguments on. Any hints?  Thank
 > you!

 Hi Matt,

 If I may, I think org-ql can help you here.  It should also work much
 faster than org-map-entries, because it can skip to entries with the
 desired to-do keywords (although you could also use the MATCH argument
 to org-map-entries to improve its speed).  Try this function (untested):

 #+BEGIN_SRC elisp
 (cl-defun org-lms-return-all-assignments-ql ( (send-all nil)
 (also-mail nil) (post-to-lms t))
   "By default mail all subtrees 'READY' to student recipients, unless
 SEND-ALL is non-nil.
 In that case, send all marked 'READY' or 'TODO'."
   (interactive)
   (message "Mailing all READY subtrees to students")
   (let ((todo-keywords (if send-all
'("READY" "TODO")
  '("READY"
 (org-ql-select (current-buffer)
   `(todo ,@todo-keywords)
   :action `(ol-send-just-one ,also-mail ,post-to-lms
 #+END_SRC

 OK, this is pretty cool, thank you.  I took John's excellent suggestion
>>> of using a headline property to store the appropriate actions, but it makes
>>> sense to switch to org-ql if I can master the syntax (which seems awfully
>>> powerful).  One questions: does org-ql-select respect buffer narrowing?
>>> That would be important for me.
>>>
>>> Man, hard to hold all this stuff in my head.  ANd very hard to navigate
>>> my own code now that I see how ugly it is.
>>>
>>
>> Another question.  In place of a function or sexp,  the :action key
>> accepts the keyword "element" as a value, and will return a parsed
>> headline. Is it possible to then pass that value on to a function that will
>> be evaluated? I'm asking because I have a bunch of functions with very long
>> `let` sections in which information is extracted from a headline with
>> (org-entry-get). It would be nice to use John's plist trick (from the other
>> thread we're on) to, essentially, let-plist all the properties of the
>> headline. It would declutter my