Re: [O] Bug: Key binding M-S-up does not invoke org-move-subtree-up [9.1.2 (9.1.2-7-g027cfc-elpa @ /home/john/.emacs.d/elpa/org-20171009/)]

2017-10-11 Thread Kyle Meyer
Allen Li  writes:

> On Wed, Oct 11, 2017 at 11:53 AM, Johann Höchtl
>  wrote:
>> According to the documentation, the keys M-S-up should invoke
>> org-move-subtree-up, and M-S-down the command  org-move-subtree-down but
>> instead org-shiftmetaup or org-shiftmetadown gets executed (I am on a
>> headline and I expect the current tree to get swaped with the preceeding
>> in case of M-S-up, instead the line gets moved one up)
>
> It looks like the docs are wrong. M-up/down is
> org-move-subtree-up/down and M-S-up/down is org-shiftmetaup/down.

Thanks Johann and Allen.  Corrected in 8c44a3f23.

-- 
Kyle



Re: [O] Bug: Key binding M-S-up does not invoke org-move-subtree-up [9.1.2 (9.1.2-7-g027cfc-elpa @ /home/john/.emacs.d/elpa/org-20171009/)]

2017-10-11 Thread Allen Li
On Wed, Oct 11, 2017 at 11:53 AM, Johann Höchtl
 wrote:
> According to the documentation, the keys M-S-up should invoke
> org-move-subtree-up, and M-S-down the command  org-move-subtree-down but
> instead org-shiftmetaup or org-shiftmetadown gets executed (I am on a
> headline and I expect the current tree to get swaped with the preceeding
> in case of M-S-up, instead the line gets moved one up)

It looks like the docs are wrong. M-up/down is
org-move-subtree-up/down and M-S-up/down is org-shiftmetaup/down.



Re: [O] capture template placeholders do not work

2017-10-11 Thread Allen Li
On Wed, Oct 11, 2017 at 11:47 AM, Carl Bolduc  wrote:
> Hi,
>
> I want to use org-mode to store my bookmarks. I configured the following 
> template:
> ("b" "Bookmark" entry (file+headline "~/org/bookmarks.org" "Bookmarks") "* 
> %:url %:title %?\n”)

%:url and $:title are wrong, they should be %:link and %:description
respectively.

Check out the source code of org-protocol-do-capture.

The valid placeholders are

type
link
description
annotation



Re: [O] Lint multiple files at once

2017-10-11 Thread Nick Dokos
Luciano Passuello  writes:

> Hello all,
>
> I love org-lint, but I couldn't find an easy way to get a report on
> multiple files.
> I'd like to analyze all files in a folder, getting all problems found
> using a single command.
>
> Any suggestions?
>

Here's one way:

--8<---cut here---start->8---
(defun org-lint-dir (directory)
  (let* ((files (directory-files directory t ".*\\.org$")))
(org-lint-list files)))

(defun org-lint-list (files)
  (cond (files
 (org-lint-file (car files))
 (org-lint-list (cdr files)

(defun org-lint-file (file)
  (let ((buf)
(lint))
(setq buf (find-file-noselect file))
(with-current-buffer buf (if (setq lint (org-lint)) (print (list file 
lint))

(org-lint-dir "/home/nick/lib/org")
--8<---cut here---end--->8---

-- 
Nick




Re: [O] Custom tag exportation - Agenda export?

2017-10-11 Thread Matt Lundin
Pierre-Luc Gauthier  writes:

> So my question is,
> How can I export this tag filtered agenda view to, say a pdf with
> LaTeX customizations and all that nice stuff.
> The goal would be to be able to leave the house with a beautifully
> typeset document containing all @Errands tagged headers *and* content?
>
> If I use org-agenda-write and write a PDF file, I get basically the
> same screen as my view, no content, just the headers and in a rather
> crude layout.
>
> I guess what I need (conceptually) is a way to get all headers having
> said tag (or being a child of) be compiled in a file. Then I know all
> the cool export stuff (e.g.: HTML, LaTeX, etc) will be accessible.
>

The function org-map-entries could help here. For instance...

--8<---cut here---start->8---
(org-map-entries
 '(concat (org-get-heading) "\n" (org-get-entry))
 "@Errands" 'agenda))
--8<---cut here---end--->8---

...will return a list of strings containing the heading and entry text
for all of your entries tagged "@Errands".

Then you could iterate through that list and insert each item as a top
level heading in a new org file. The following, for instance, will
extract all relevant headings and insert them in a temporary buffer
("/tmp/export.org"):

--8<---cut here---start->8---
(with-current-buffer (find-file-noselect "/tmp/export.org")
  (delete-region (point-min) (point-max))
  (insert "* ")
  (insert (mapconcat 'identity
 (org-map-entries
  '(concat (org-get-heading) "\n" (org-get-entry))
  "@Errands" 'agenda)
 "\n* "))
  (org-align-all-tags))
--8<---cut here---end--->8---

This could be further refined. E.g., you could extract specific heading
components with the function org-heading-components and then place them
directly in a LaTeX file.

Best,
Matt



Re: [O] TODO keywords are not being exported by the markdown exporter

2017-10-11 Thread Nicolas Goaziou
Hello,

Ganesh Krishnan  writes:

> TODO status is not being exported by the markdown exporter. I first noticed
> this when I contacted the package author for the ox-gfm exporter regarding
> missing TODO keywords in my exported documents. He responded saying that
> this is an upstream problem with the org-mode markdown exporter. I don't
> know what the formal mechanism for filing a bug is, but wanted to report
> the bug.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Lint multiple files at once

2017-10-11 Thread Luciano Passuello
Hello all,

I love org-lint, but I couldn't find an easy way to get a report on
multiple files.
I'd like to analyze all files in a folder, getting all problems found
using a single command.

Any suggestions?



[O] Bug: Key binding M-S-up does not invoke org-move-subtree-up [9.1.2 (9.1.2-7-g027cfc-elpa @ /home/john/.emacs.d/elpa/org-20171009/)]

2017-10-11 Thread Johann Höchtl
To: emacs-orgmode@gnu.org
Subject: Bug: Key binding M-S-up does not invoke  org-move-subtree-up
[9.1.2 (9.1.2-7-g027cfc-elpa @ /home/john/.emacs.d/elpa/org-20171009/)]
From: john@ebola.i-did-not-set--mail-host-address--so-tickle-me (Johann
Höchtl)
--text follows this line--

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.


According to the documentation, the keys M-S-up should invoke
org-move-subtree-up, and M-S-down the command  org-move-subtree-down but
instead org-shiftmetaup or org-shiftmetadown gets executed (I am on a
headline and I expect the current tree to get swaped with the preceeding
in case of M-S-up, instead the line gets moved one up)

Emacs  : GNU Emacs 25.3.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-12
Package: Org mode version 9.1.2 (9.1.2-7-g027cfc-elpa @
/home/john/.emacs.d/elpa/org-20171009/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 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 '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local]
   5]
 #[0 "\300\301\302\303\304$\207"
   [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-refile-targets '((org-agenda-files :maxlevel . 9))
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-refile-use-outline-path t
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
   ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys")
   ("file+emacs") ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow
(lambda (path) (browse-url (concat "ftp:" path
   ("help" :follow org--open-help-link)
   ("http" :follow
(lambda (path) (browse-url (concat "http:" path
   ("https" :follow
(lambda (path) (browse-url (concat "https:" path
   ("mailto" :follow
(lambda (path) (browse-url (concat "mailto:"; path
   ("news" :follow
(lambda (path) (browse-url (concat "news:"; path
   ("shell" :follow org--open-shell-link))
 org-agenda-files '("~/Inhouse.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )


[O] capture template placeholders do not work

2017-10-11 Thread Carl Bolduc
Hi,

I want to use org-mode to store my bookmarks. I configured the following 
template:
("b" "Bookmark" entry (file+headline "~/org/bookmarks.org" "Bookmarks") "* 
%:url %:title %?\n”)

And I have the following bookmarklet in my browser:
javascript:location.href='org-protocol://capture?template=b'+'&url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection());

When I click on my bookmarklet, Emacs opens a new capture buffer and here is 
what I see:
**  

I get an empty entry, the %:url and %:title placeholders are not expanded to 
the values passed by the bookmarklet. How can I troubleshoot this?

I’m running emacs 25.3 with the emacs-25.3-mac-6.8 patch on macOS High Sierra 
with org-mode 9.1.1.

Thanks,
Carl


Re: [O] Troublesome python block

2017-10-11 Thread Kaushal Modi
On Wed, Oct 11, 2017 at 11:26 AM Roger Mason  wrote:

> hello,
>
> This python block:
>
> #+BEGIN_SRC python :session true :results output
>   import numpy as np
>   from ase import Atoms
>   from ase.calculators.gulp import GULP, Conditions
>
>   quartz = Atoms(symbols='Si3O6', pbc=np.array([True,True,True],
> dtype=bool),
>cell=np.array([[4.916, 0.0, 0.0], [-2.4573,
> 4.257380885004301, 0.0], [0.0, 0.0, 5.4054]]),
>positions=np.array([[ 2.3016712,   0.,  1.80161982],
>   [-1.1508356, 1.99330573, 3.60341982],
>   [ 1.3071644, 2.26407515, 5.40521982],
>   [ 1.3767258, 1.13288905, 1.15189074],
>   [ 3.2465264, 0.62583499, 2.95369074],
>   [ 2.7507478, 2.49865684, 4.75549074],
>   [ 0.2927478, 1.75872404, 4.25350926],
>   [-1.0812742, 3.12449183, 2.45170926],
>   [ 0.7885264, 3.63154589, 0.64990926]]))
> #+END_SRC
>
> produces this output:
>
> #+RESULTS:
> #+begin_example
> Python 2.7.13 (default, Jul  2 2017, 01:20:25)
> [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final
> 208032)] on freebsd10
> Type "help", "copyright", "credits" or "license" for more information.
> python.el: native completion setup loaded
> and
> as
> assert
> break
> class
> continue
> def
> del
> elif
> else
> [SNIPPED]
> AttributeError
> OverflowError
>
> 0__dummy_completion__  1__dummy_completion__
> #+end_example
>
> The same python script produces no errors in a python interpreter
> started from the command line and it reports no errors when run as
> 'python twaddle.py'.
>
> Any help in debugging this will be much appreciated.
>
> Roger
>
> Org mode version 9.0.3 (release_9.0.3-170-gfed1cf @
> /home/rmason/.emacs.d/org-git/org-mode/lisp/)
> GNU Emacs 25.2.1 (i386-portbld-freebsd10.3, GTK+ Version 3.22.15) of
> 2017-07-03
> Python 2.7.13 (default, Jul  2 2017, 01:20:25)
> [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final
> 208032)] on freebsd10
>

I cannot recreate that, though I am on different versions for everything:

- Emacs: 26.0.60 built from emacs-26 branch <-- This might be what actually
matters as I know that there were quite a few python.el commits in this
branch (
http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-26&qt=grep&q=python
 ).
- Org: built from Org master branch
- Python 3.6.2

I haven't used numpy or ase/scipy, so after:

> pip3 install --user numpy
> pip3 install --user scipy

I get:

#+PROPERTY: header-args:python :exports both :results output
#+BEGIN_SRC python
import numpy as np
from ase import Atoms
from ase.calculators.gulp import GULP, Conditions

quartz = Atoms(symbols='Si3O6', pbc=np.array([True,True,True], dtype=bool),
 cell=np.array([[4.916, 0.0, 0.0], [-2.4573,
4.257380885004301, 0.0], [0.0, 0.0, 5.4054]]),
 positions=np.array([[ 2.3016712,   0.,  1.80161982],
[-1.1508356, 1.99330573, 3.60341982],
[ 1.3071644, 2.26407515, 5.40521982],
[ 1.3767258, 1.13288905, 1.15189074],
[ 3.2465264, 0.62583499, 2.95369074],
[ 2.7507478, 2.49865684, 4.75549074],
[ 0.2927478, 1.75872404, 4.25350926],
[-1.0812742, 3.12449183, 2.45170926],
[ 0.7885264, 3.63154589, 0.64990926]]))
print(quartz)
#+END_SRC

#+RESULTS:
: Atoms(symbols='Si3O6', pbc=True, cell=[[4.916, 0.0, 0.0],
[-2.4573, 4.257380885004301, 0.0], [0.0, 0.0, 5.4054]])


Is that what you expected in the RESULTS?

Here is my relatively simply python setup where I default the interpreter
to python3:
https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-python.el

and my minimal ob-python setup:

(use-package ob-python
  :defer t
  :config
  (progn
(setq org-babel-python-command "python3"))) ;Default to python 3.x

-- 

Kaushal Modi


Re: [O] Bug: python code block single import line [9.0.9 (release_9.0.9-754-g940c90)]

2017-10-11 Thread Kyle Meyer
Hello,

Paul Stansell  writes:

>   #+begin_src python :session python1
> import numpy as np
>   #+end_src
>
> I get this error in my python buffer

Sorry for the delayed response.  As I just mentioned in another thread,
ob-python sessions have longstanding issues:

  https://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00198.html

-- 
Kyle



Re: [O] Troublesome python block

2017-10-11 Thread Kyle Meyer
Hello,

Roger Mason  writes:

> This python block:

[...]

> produces this output:
>
> #+RESULTS:
> #+begin_example
> Python 2.7.13 (default, Jul  2 2017, 01:20:25) 
> [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 
> 208032)] on freebsd10
> Type "help", "copyright", "credits" or "license" for more information.
> python.el: native completion setup loaded

[...]

> Any help in debugging this will be much appreciated.

ob-python sessions have been broken to some degree for quite some time.
See, e.g., 
https://lists.gnu.org/archive/html/emacs-orgmode/2015-03/msg00540.html

I dropped my attempt to fix it because 1) I was still having trouble
getting a complete understanding of what the issue was and 2) I didn't
have the motivation to spend time digging deeper because I don't use
ob-python (and in general am not a heavy Org-Babel user).  Perhaps you
or some other ob-python user could help make ob-python sessions more
robust?

In the meantime, you could try ob-ipython 
(https://github.com/gregsexton/ob-ipython).
Looking at the README, it sounds like ob-python's problems were one of
the author's motivations for writing the library.

-- 
Kyle



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

2017-10-11 Thread Nicolas Goaziou
Hello,

Pierre-André Cornillon  writes:

> what is "the parser" exactly ?

It is "org-element.el".

>> Anyway The bug probably lies in `org-fontify-meta-lines-and-blocks-1'.
>> Do you want to investigate?
>
> I agree that the regular search expression in the
> org-fontify-meta-lines-and-blocks-1 seems to match only one level of
> src block. I am not an elisp programmer but splitting
> the function in two part will allow to make it recursive (and thus to
> cope with several level of nested src block) ? Well it's pure
> speculation without testing...

It probably would. But then, there is `font-lock-multiline', which
prevents further fontification.

Regards,

-- 
Nicolas Goaziou0x80A93738



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

2017-10-11 Thread Pierre-André Cornillon
Hello,

On Tue, Oct 10, 2017 at 9:16 AM, Nicolas Goaziou  wrote:
> Hello,
>
> Pierre-André Cornillon  writes:
>
>> 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 ?
>
> Nested blocks are allowed, but the fontification system has a few
> shortcomings, including this one. Ultimately, this part of Org needs to
> be rewritten using the parser.
what is "the parser" exactly ?
>
> Anyway The bug probably lies in `org-fontify-meta-lines-and-blocks-1'.
> Do you want to investigate?

I agree that the regular search expression in the
org-fontify-meta-lines-and-blocks-1 seems to match only one level of
src block. I am not an elisp programmer but splitting
the function in two part will allow to make it recursive (and thus to
cope with several level of nested src block) ? Well it's pure
speculation without testing...

>
> Regards,
>
> --
> Nicolas Goaziou

Best regards,
Pierre-Andre



Re: [O] Custom tag exportation - Agenda export?

2017-10-11 Thread Pierre-Luc Gauthier
'thinking out loud here:
Maybe I could make a errandsExport.org file in whish I could include
all my agenda files and then filter only the Errands tag.
Then I could add all the LaTeX options I want for this export file
e.g. #+TITLE: My errands document

I do have problems including all org-agenda-files files.
I tried :
#+INCLUDE: (org-agenda-files)
which obviously does not work but I do not know how to tackle this
(I'm guessing) rather simple issue.
How could I expand this org-agenda-files variable for org to include
it's content?
Is this an OK way to go about it?

Also, I have not found a way to filter tags out of an org file at export.
I know about #+SELECT_TAGS: and  #+EXCLUDE_TAGS: but what if you
*only* want trees with the "Errands" tag?
Is there a way to exclude all and then select a specific tag?

Thanks for any pointers :-)
-- 
Pierre-Luc Gauthier

2017-10-09 14:31 GMT-04:00 Pierre-Luc Gauthier :
> Is it possible to have agenda view templates to export a specific tag
> hierarchy with all the usual org-export options (e.g.: title, toc,
> LaTeX stuff, etc) ?
>
> So my question is,
> How can I export this tag filtered agenda view to, say a pdf with
> LaTeX customizations and all that nice stuff.
> The goal would be to be able to leave the house with a beautifully
> typeset document containing all @Errands tagged headers *and* content?
>
> If I use org-agenda-write and write a PDF file, I get basically the
> same screen as my view, no content, just the headers and in a rather
> crude layout.
>
> I guess what I need (conceptually) is a way to get all headers having
> said tag (or being a child of) be compiled in a file. Then I know all
> the cool export stuff (e.g.: HTML, LaTeX, etc) will be accessible.



[O] Troublesome python block

2017-10-11 Thread Roger Mason
hello,

This python block:

#+BEGIN_SRC python :session true :results output
  import numpy as np
  from ase import Atoms
  from ase.calculators.gulp import GULP, Conditions

  quartz = Atoms(symbols='Si3O6', pbc=np.array([True,True,True], dtype=bool),
   cell=np.array([[4.916, 0.0, 0.0], [-2.4573, 
4.257380885004301, 0.0], [0.0, 0.0, 5.4054]]),
   positions=np.array([[ 2.3016712,   0.,  1.80161982],
  [-1.1508356, 1.99330573, 3.60341982],
  [ 1.3071644, 2.26407515, 5.40521982],
  [ 1.3767258, 1.13288905, 1.15189074],
  [ 3.2465264, 0.62583499, 2.95369074],
  [ 2.7507478, 2.49865684, 4.75549074],
  [ 0.2927478, 1.75872404, 4.25350926],
  [-1.0812742, 3.12449183, 2.45170926],
  [ 0.7885264, 3.63154589, 0.64990926]]))
#+END_SRC

produces this output:

#+RESULTS:
#+begin_example
Python 2.7.13 (default, Jul  2 2017, 01:20:25) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] 
on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
python.el: native completion setup loaded
and
as
assert
break
class
continue
def
del
elif
else
[SNIPPED]
AttributeError
OverflowError

0__dummy_completion__  1__dummy_completion__
#+end_example

The same python script produces no errors in a python interpreter
started from the command line and it reports no errors when run as
'python twaddle.py'.

Any help in debugging this will be much appreciated.

Roger

Org mode version 9.0.3 (release_9.0.3-170-gfed1cf @
/home/rmason/.emacs.d/org-git/org-mode/lisp/)
GNU Emacs 25.2.1 (i386-portbld-freebsd10.3, GTK+ Version 3.22.15) of 2017-07-03
Python 2.7.13 (default, Jul  2 2017, 01:20:25) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] 
on freebsd10



Re: [O] Properties lost when closing, scheduling, etc.

2017-10-11 Thread John Goerzen
And I should add - the cause of :LOGBOOK: being above :PROPERTIES: on
those particular tasks may be a bug in an Asana-to-Org converter I
wrote, rather than org itself.  So I apologize doubly for the noise.

John

On 10/11/2017 07:46 AM, John Goerzen wrote:
> On 10/11/2017 01:55 AM, Eric S Fraga wrote:
>> On Tuesday, 10 Oct 2017 at 22:01, John Goerzen wrote:
>>> I cannot make it misbehave with either SCHEDULED or CLOSED in my testing
>>> now.
>> Maybe try org-lint to see if there are more subtle errors in your
>> file(s)?
>>
> Ah ha!  So it looks like the real problem was that I had some :LOGBOOK:
> drawers above :PROPERTIES: drawers.  I think that would do it.
>
> Thanks for the help.
>
> - John
>




[O] Babel partial support for SAS language

2017-10-11 Thread Pierre-André Cornillon
Dear orgmode users

as the best way to submit a Babel support for a new language is this
mailing list, I submit this partial support for SAS
language (using ESS).

This is partial as only few header arguments are supported
:results output
:output graphics
:session
arguments are supported but one of the most important, :output value, is
not supported (as I am not able to figure out what does it really mean
with SAS).

I am not proud of it but I have added a
:results odsgraphics
for odsgraphics (which are different from sas/graph classical graphics).


If someone is interested in that support, please see the attached file
(as I don't actually know anything about the orgmode mailing list
policy about attached file, I hope it will be still attached...)

Comments and suggestions are welcome.

Best regards
Pierre-Andre
;;; ob-sas.el --- org-babel functions for sas code evaluation

;; Copyright (C) 2017 P.A. Cornillon
;; Author: P.A. Cornillon
;;  G. Jay Kerns
;;  Eric Schulte
;;  Dan Davison


;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; The file provides Org-Babel support for evaluating sas code.  It is
;; basically result of find-and-replace "sas" for "julia" in
;; ob-julia.el by G. Jay Kerns.
;; 1) Parameter ":results output" needs a
;; to give the right filename for SAS in the  Parameter ":results value"
;; does not work (I'm not sure it makes sense or is useful).  Parameter
;; ":session" works with default value using ESS
;; 

;;; Requirements:
;; Sas: http://sas.com
;; ESS: http://ess.r-project.org

;;; Code:
(require 'ob)
(require 'cl-lib)

(declare-function orgtbl-to-csv "org-table" (table params))
(declare-function sas "ext:ess-sas" (&optional start-args))
(declare-function inferior-ess-send-string "ext:ess-inf" ())
(declare-function ess-make-buffer-current "ext:ess-inf" ())
(declare-function ess-eval-buffer "ext:ess-inf" (vis))
(declare-function org-number-sequence "org-compat" (from &optional to inc))
 could be useful to increase or decrease timeout 
(defcustom org-babel-sas-timeout 1000
  "Timeout (in sec) used when waiting output from a submitted src block (to sas) with argument :session."
  :group 'org-babel
  :type 'integer)
 could be useful to tweak printing page size
(defcustom org-babel-sas-print-options "options formdlim='' pagesize=max;\n"
  "general options used to have the maximum page size"
  :group 'org-babel
  :type 'string)

 where is SAS
(defcustom org-babel-sas-command "/usr/local/bin/sas_u8"
;  inferior-SAS-program-name
  "Name of command to use for executing sas code."
  :group 'org-babel
  :type 'string)

;;;
(defvar org-babel-sas-lepoint 1)
(defvar org-babel-sas-logfile-name "log_sas.log")
(defvar org-babel-sas-eoe-indicator "data eoe_org_data;\n nbabelvareoe=1;\nrun;\nOPTIONS NODATE NONUMBER;\nTITLE1;\nTITLE2;\nproc print data=eoe_org_data;\nrun;")
(defvar org-babel-sas-eoe-output "Obs.nbabelvareoe\n\n1   1")
(defvar org-babel-sas-boe-output "$ tty\n/dev/pts/[0-9]+\n\\$")
(defconst org-babel-header-args:sas
  '((hsize		 . :any)
(vsize		 . :any)
(xpixels		 . :any)
(ypixels		 . :any)
(border		 . :any)
(width		 . :any)
(height		 . :any)
(results . ((file list vector table scalar verbatim)
			(raw org html latex code pp wrap)
			(replace silent append prepend)
;; NOTE: not sure 'value' makes sense in sas
;; we may want to remove it from the list
			(output graphics
  "sas-specific header arguments.")

(add-to-list 'org-babel-tangle-lang-exts '("sas" . "sas"))

;; session using ESS is the way to go, so make that the default
(defvar org-babel-default-header-args:sas '((:results . "output") (:session . nil)))

;; trim white space and garbage
(defun org-babel-sas-trim-white (s)
  "replace S by empty string if S is whitespace only"
  (if (string-match "\\`[ \t\n\r]+\\'" s)
  (replace-match "" t t s)
s))
;; let's go: main function
(defun org-babel-execute:sas (body params)
  "Execute a block of sas code.
This function is called by `org-babel-execute-src-block'."
  (save-excursion
(let* ((result-params (cdr (ass

Re: [O] Properties lost when closing, scheduling, etc.

2017-10-11 Thread John Goerzen
On 10/11/2017 01:55 AM, Eric S Fraga wrote:
> On Tuesday, 10 Oct 2017 at 22:01, John Goerzen wrote:
>> I cannot make it misbehave with either SCHEDULED or CLOSED in my testing
>> now.
> Maybe try org-lint to see if there are more subtle errors in your
> file(s)?
>
Ah ha!  So it looks like the real problem was that I had some :LOGBOOK:
drawers above :PROPERTIES: drawers.  I think that would do it.

Thanks for the help.

- John



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

2017-10-11 Thread Marco Wahl
Detlef Steuer  writes:

> Am Mon, 09 Oct 2017 10:29:39 +0200
> schrieb Alan Schmitt :
>
>> On 2017-10-09 09:19, Eric S Fraga  writes:
>> 
>> > On Monday,  9 Oct 2017 at 08:54, Alan Schmitt wrote:  
>> >> One thing I would really like is the timestamp behavior of
>> >> org-agenda-goto with the windows behavior of
>> >> org-agenda-switch-to.  
>> >
>> > You could "advise" the function?
>> > https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html
>> >   
>> 
>> Yes, this is something I could do. Thanks for the suggestion.
>
> ... and maybe share the solution? I would like the same as you, but
> emacs lisp is still unexplored territory to me.

I don't see how to realize the issue by using 'advise' but you could
use a new function which does it.

Put the code

--8<---cut here---start->8---
(defun org-agenda-switch-to-in-other-window (&optional delete-other-windows)
  "Go to the Org mode file which contains the item at point in other window.
When optional argument DELETE-OTHER-WINDOWS is non-nil, the
displayed Org file fills the frame."
  (interactive)
  (if (and org-return-follows-link
   (not (org-get-at-bol 'org-marker))
   (org-in-regexp org-bracket-link-regexp))
  (org-open-link-from-string (match-string 0))
(let* ((marker (or (org-get-at-bol 'org-marker)
   (org-agenda-error)))
   (buffer (marker-buffer marker))
   (pos (marker-position marker)))
  (unless buffer (user-error "Trying to switch to non-existent buffer"))
  (switch-to-buffer-other-window buffer)
  (when delete-other-windows (delete-other-windows))
  (widen)
  (goto-char pos)
  (when (derived-mode-p 'org-mode)
(org-show-context 'agenda)
(run-hooks 'org-agenda-after-show-hook)

(org-defkey org-agenda-mode-map "\C-u\C-m" 
#'org-agenda-switch-to-in-other-window)
--8<---cut here---end--->8---

into your emacs init file to get the the behavior you want with the key
C-u RET.

The function above is almost the same as `org-agenda-switch-to' which is
currently bound to RET in org agenda.


HTH
   Marco




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

2017-10-11 Thread Detlef Steuer
Am Mon, 09 Oct 2017 10:29:39 +0200
schrieb Alan Schmitt :

> On 2017-10-09 09:19, Eric S Fraga  writes:
> 
> > On Monday,  9 Oct 2017 at 08:54, Alan Schmitt wrote:  
> >> One thing I would really like is the timestamp behavior of
> >> org-agenda-goto with the windows behavior of
> >> org-agenda-switch-to.  
> >
> > You could "advise" the function?
> > https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html
> >   
> 
> Yes, this is something I could do. Thanks for the suggestion.

... and maybe share the solution? I would like the same as you, but
emacs lisp is still unexplored territory to me.

Detlef


> 
> Alan
> 


pgpUXf9T3y1DU.pgp
Description: Digitale Signatur von OpenPGP


Re: [O] Send subheading at the end of documents preserving the numbering

2017-10-11 Thread Jérémie Juste
Hello,

Many thanks to you,

Best regards,

Jeremie

On Wed, Oct 11, 2017 at 11:07 AM, Eric S Fraga  wrote:

> On Wednesday, 11 Oct 2017 at 10:03, Jeremie Juste wrote:
> > Hello,
> >
> > I'm making some exercices with answers and I'm writing the answers just
> > after the questions in the following way
>
> [...]
>
> > There is an interesting package that does something similar in latex
> > https://ctan.org/pkg/probsoln. you can access it here after unzipping.
>
> Probably the easiest way is to use this LaTeX class and enclose the
> solutions in an org special block:
>
> --8<---cut here---start->8---
> #+latex_header: \usepackage{probsoln}
> * first question
> Do something.
> #+begin_solution
> here goes your solution
> #+end_solution
> --8<---cut here---end--->8---
>
>
> --
> : Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-98-g0b8316
>



-- 
Jérémie Juste


Re: [O] Send subheading at the end of documents preserving the numbering

2017-10-11 Thread Eric S Fraga
On Wednesday, 11 Oct 2017 at 10:03, Jeremie Juste wrote:
> Hello,
>
> I'm making some exercices with answers and I'm writing the answers just
> after the questions in the following way

[...]

> There is an interesting package that does something similar in latex
> https://ctan.org/pkg/probsoln. you can access it here after unzipping.

Probably the easiest way is to use this LaTeX class and enclose the
solutions in an org special block:

--8<---cut here---start->8---
#+latex_header: \usepackage{probsoln}
* first question
Do something.
#+begin_solution
here goes your solution
#+end_solution
--8<---cut here---end--->8---


-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-98-g0b8316


signature.asc
Description: PGP signature


Re: [O] Is it possible for a TODO item not to be an outline item?

2017-10-11 Thread Angel de Vicente
Hi Florian,

Florian Beck  writes:
> On 08.10.2017 13:40, Angel de Vicente wrote:
>> So basically I would like to have that TODO item but somehow without
>> creating a new section. Is it possible?
>
> Use
>
> ---
> bla bla bla
> # TODO: fix installation
> bla bla bla
> ---
>
> and
>
> M-x org-occur-in-agenda-files (which is bound to C-a /).

Thanks for the suggestion, but this won't be considered a TO DO item by
org, so not what I'm looking for (I won't be able, for example, to
assign priorities, or look for TO DO only in this buffer, record the
date automatically when closing the TO DO item, etc.). For the moment
I'll stick with the org-inlinetask approach.

Cheers,
-- 
Ángel de Vicente
http://angel-de-vicente.blogspot.com/




Re: [O] Recent regression in Org master with parsing of verbatim code with spaces

2017-10-11 Thread Robert Klein
Hi,

On Wed, 11 Oct 2017 00:47:04 +0100
Reuben Thomas  wrote:

> On 10 October 2017 at 18:29, Kaushal Modi 
> wrote:
> 
> > On Tue, Oct 10, 2017 at 1:08 PM Kaushal Modi
> >  wrote:
> >  
> >> I scanned through recent commits, but haven't yet figured out which
> >> commit affected this. Before I end up with git bisect, does anyone
> >> know a master branch commit that could have caused this?
> >>  
> >
> > Hello,
> >
> > I found the commit causing this change:
> >
> > http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=
> > 8383f7e08b964e129b175ef1c0297b1f4a8ed235
> >  
> 
> ​I haven't seen the rest of this thread, but at a guess is the
> problem to do with [:space:] matching vertical space such as newline
> and vertical tab? Fixing that is a bit painful, since as far as I
> know there's no regex for "horizontal space"; I guess it would be a
> matter of enumerating a suitable range of code points.​

I'm fiddling with org-emphasis-regexp-components in my .emacs.  I
put all horizontal whitespace characters (Wikipedia: "whitespace
character" with Unicode character property WSpace="y") in a string and
concat org-emphasis-regexp-components.  Note, I include some extra
characters for pre, post, and borders (typographical double quotes).

(setq horizontal-whitespace
  (string
   (cdr (assoc-string "CHARACTER TABULATION" (ucs-names)))
   (cdr (assoc-string "SPACE" (ucs-names)))
   (cdr (assoc-string "NO-BREAK SPACE" (ucs-names)))
   (cdr (assoc-string "OGHAM SPACE MARK" (ucs-names)))
   (cdr (assoc-string "EN QUAD" (ucs-names)))
   (cdr (assoc-string "EM QUAD" (ucs-names)))
   (cdr (assoc-string "EN SPACE" (ucs-names)))
   (cdr (assoc-string "EM SPACE" (ucs-names)))
   (cdr (assoc-string "THREE-PER-EM SPACE" (ucs-names)))
   (cdr (assoc-string "FOUR-PER-EM SPACE" (ucs-names)))
   (cdr (assoc-string "SIX-PER-EM SPACE" (ucs-names)))
   (cdr (assoc-string "FIGURE SPACE" (ucs-names)))
   (cdr (assoc-string "PUNCTUATION SPACE" (ucs-names)))
   (cdr (assoc-string "THIN SPACE" (ucs-names)))
   (cdr (assoc-string "HAIR SPACE" (ucs-names)))
   (cdr (assoc-string "NARROW NO-BREAK SPACE" (ucs-names)))
   (cdr (assoc-string "MEDIUM MATHEMATICAL SPACE" (ucs-names)))
   (cdr (assoc-string "IDEOGRAPHIC SPACE" (ucs-names)
(setq org-emphasis-regexp-components
  `(,(concat horizontal-whitespace
 "('\"{„“")
,(concat "-"
 horizontal-whitespace
 ".,:!?;'\")}\\[“”")
,(concat horizontal-whitespace
 "[:space:],\"'„“”")
"."
10))


Best regards
Robert



[O] Send subheading at the end of documents preserving the numbering

2017-10-11 Thread Jeremie Juste
Hello,

I'm making some exercices with answers and I'm writing the answers just
after the questions in the following way


* Question


** Answer :solution



While exporting to latex, I can use  #+EXCLUDE_TAGS: solution  to remove the 
solution but a better
option in my case would be to send the solution at the end of the
document while preserving the numbering for easy access. Is there a way
to do this in org-mode?

There is an interesting package that does something similar in latex
https://ctan.org/pkg/probsoln. you can access it here after unzipping.

.../probsoln/probsoln/samples/sample5.pdf


Best regards,

Jeremie