Re: [O] Best practice for providing an Org-based application?

2019-09-18 Thread Thorsten Jolitz
Neil Jerram  writes:

Hi,

> Is there a best practice or recommended approach for preparing and
> providing an Org-based application so that others could make use of it?
>
> I've been using Org for a few years to keep track of the membership and
> 'fixing' for my choir - where 'fixing' means finding out and recording
> who can sing in each concert, who will be there for rehearsals, and so
> on.  This involves a mix of data that is private to my choir, and
> workflows and code that are potentially generic.  I don't know how many
> people in the world are both choir organisers and Emacs users, but it
> seems to me that it could be useful to separate out and document the
> generic code and workflows, so that others could use that as well as me,
> and that it would also be an interesting technical challenge.
>
> Has anyone else done something like this?  I wonder if you have
> recommendations for how to document, structure and publish this kind of
> thing?
>
> Many thanks!
>Neil

long time ago, but I once started a little project called org-bandbook,
its on my tj64 account on github.
The interesting part about is its importing funcionality for lilypond
songs from another github repo (open book I think), where a guy
transposed hundreds of popular standard (real book) tunes to lilypond with
some Ruby framework code, which I replaced by ob-lilypond code. The idea was to 
manage songs, band, concert
rehearsals etc in Org-mode, and to be able to easily transpose songs
(its ob-lilypond) for Bb or Eb instruments or so.

OTOH isn't managing a choir or band quite similar to managing a project,
and thus (ob-)taskjuggler would be a very helpful tool here?

-- 
cheers,
Thorsten




Re: [O] [Feature request] Repeatable tasks workday

2019-03-16 Thread Thorsten Jolitz
Eric S Fraga  writes:

> On Friday,  8 Mar 2019 at 13:05, Emil Marklund wrote:
>> Hello!
>>
>> Some[1][2][3] have been asking for a method to create repeatable tasks
>> that repeats on workdays (Monday to Friday). As far as I can tell, there
>> is no "native support" for this in org-mode.  It would be neat if one
>> could specify repeatable tasks with a simple syntax, such as "+1wd" for
>> defining deadlines on tasks that should be repeated for each workday.
>
> This is non-trivial, especially as the concept of a work day is not the
> same around the world.
>
> The easiest solution, which I use, is to have weekly repeated tasks for
> each "work day"; i.e. 5 different tasks, one for Monday, one for
> Tuesday, etc.

This is normally solved by creating custom calendars that define
workdays/holydays, and then call the functionality with a specific
calendar. Even within Germany e.g. the states have different holydays,
so an enterprise with plants in different states needs to create
different calenders.

-- 
cheers,
Thorsten




Re: [O] [SOLVED]

2018-03-09 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>> Uwe Brauer <o...@mat.ucm.es> writes:
>
>> When I do M-# # writing this mail I see:
>> ,
>> | [ *unsent followup to Uwe Brauer on gmane.emacs.orgmode* ] Exit
>> | with M-#
>> | (Meta-Key and #)
>> | * --text follows this line--
>> | Uwe Brauer <o...@mat.ucm.es> writes: ...[]
>> `
>
>
> I found the culprit
>
> (setq message-yank-prefix "   > ")
>
> No idea why I had this, but may be it is ages there. Just moving it out
> my init files and everything worked as expected. Thanks

Ok, good ... ;-)

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-09 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>> Uwe Brauer <o...@mat.ucm.es> writes:
>
>> When I do M-# # writing this mail I see:
>> ,
>> | [ *unsent followup to Uwe Brauer on gmane.emacs.orgmode* ] Exit
>> | with M-#
>> | (Meta-Key and #)
>> | * --text follows this line--
>> | Uwe Brauer <o...@mat.ucm.es> writes: ...[]
>> `
>
> I almost see the same but indented since I user supercite.

Isn't that the problem already?

In an org file, this:

,
| * headline
|  * headline
| hello
`

has only one headline, indentation for the * is not allowed.

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-08 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> A good start would be to try outshine with emacs-lisp mode.
>> With your outshine config done, write a file like foo.el
>
>> ,
>> | ;;; 1st level header
>> |  Sum
>> | (+ 1 1)
>> |  Subtract
>> | (- 2 1)
>> `
>
>> or
>
>> ,
>> | ;; * 1st level header
>> | ;; ** Sum
>> | (+ 1 1)
>> | ;; ** Subtract
>> | (- 2 1)
>> `
>
>> and see if you got headline fontification and all the outshine
>> functionality.
>
> That seems to work, I opened your outorg buffer and there everything
> worked as expected.
>
>
>> If that works, its a message-mode problem.
>> If not, a genereal problem with your config.

When I do M-# # writing this mail I see:
,
| [ *unsent followup to Uwe Brauer on gmane.emacs.orgmode* ] Exit with M-#
| (Meta-Key and #)
| * --text follows this line--
| Uwe Brauer <o...@mat.ucm.es> writes: ...[]
`

I suggest edebug then, as written, this must run successfully:

,[ C-h f outorg-prepare-message-mode-buffer-for-editing RET ]
| outorg-prepare-message-mode-buffer-for-editing is a Lisp function in
| ‘outorg.el’.
| 
| (outorg-prepare-message-mode-buffer-for-editing)
| 
| Prepare an unsent-mail in a message-mode buffer for outorg.
| 
| This function assumes that ’--text follows this line--’ (or
| whatever is found inside variable ‘mail-header-separator’) is the
| first line below the message header, is always present, and never
| modified by the user. It turns this line into an ‘outshine’
| headline and out-comments all text below this line - if any.
`

>>> [...]
>>> BTW, you recommended
>>> (require 'outorg-export)
>>> 
>>> I installed your package via the package system, so I don't see that
>>> file. Where can I obtain it from?
>
>> It's an extension to outorg:
>
> Where can I find it, only in that site? It seems not to be in elpa/melpa
> and marmelade.

Only available via github I think 

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-07 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>> Uwe Brauer <o...@mat.ucm.es> writes:
>
>> Wow, emacs 27 ... I'm on Archlinux and always thought packages a
>> pretty
>> up-to-date.
>
> Right Ubuntu officially only ships 24, which is pretty old.
>
> Well it is directly form git master, so it is a pre release.
> The official release is 26.

Then Archlinux is not that much out of date.

>> Maybe outline has changed somehow between Emacs 25 and Emacs 27?
>> But I don't think so, the error you send is pretty typical for
>> incomplete configuration.
>
> I think at the weekend, I will debug the problem. It might be that there
> some parts of my init file which are in conflict with your package.

A good start would be to try outshine with emacs-lisp mode.
With your outshine config done, write a file like foo.el

,
| ;;; 1st level header
|  Sum
| (+ 1 1)
|  Subtract
| (- 2 1)
`

or

,
| ;; * 1st level header
| ;; ** Sum
| (+ 1 1)
| ;; ** Subtract
| (- 2 1)
`

and see if you got headline fontification and all the outshine
functionality.

If that works, its a message-mode problem.
If not, a genereal problem with your config.

> [...]
> BTW, you recommended
>   (require 'outorg-export)
>
> I installed your package via the package system, so I don't see that
> file. Where can I obtain it from?

It's an extension to outorg:

,
| ;;; outorg-export.el -- Automated exporting through org
| 
| ;; Author: Jonathan Leech-Pepin https://github.com/jleechpe/outorg-export
| 
|  MetaData
| ;; :PROPERTIES:
| ;; :copyright: Jonathan Leech-Pepin
| ;; :copyright-years: 2014+
| ;; :version:  0.3
| ;; :licence:  GPLv3 or later
| ;; :licence-url: http://www.gnu.org/licenses/
| ;; :part-of-emacs: no
| ;; :author:   Jonathan Leech-Pepin
| ;; :author_email: jonathan.leechpepin AT gmail DOT com
| ;; :keywords: emacs org-mode export
| ;; :END:
`

This is the README

,
| outorg-export
| =
| 
| Automated exporting of sections of source files to any format org can export 
to.
`

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-06 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Uwe Brauer <o...@mat.ucm.es> writes:
>>>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>>> 
>>> > Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
>>> > Hallo
>>> 
>>> >> I know that the subject of my email exists already.
>>> >> [[https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html]]
>>> 
>>> > This works perfectly for your subject:
>>> 
>>> I just realised that you are the author of that package. Sorry.
>>> 
>>> I set
>>> 
>>> (require 'outorg)  
>>> (require 'outshine)
>>> (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
>>> 
>>> (add-hook 'message-mode-hook 'outline-minor-mode)
>
>> ok, maybe I answered the wrong message, does not look that incomplete
>> actually. Maybe try a copy of my config.
>
>> I used outorg-edit-as-org to insert and evaluate these source blocks
>> directly in this email, so for me it works:
> I still can't
>
>> #+BEGIN_SRC emacs-lisp  
>>  (emacs-version)
>> #+END_SRC
>
>
>> #+results:
>> : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
>> :  of 2018-02-09
>
>
> GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d
> scroll bars)
>  of 2018-01-25"

Wow, emacs 27 ... I'm on Archlinux and always thought packages a pretty
up-to-date.

Maybe outline has changed somehow between Emacs 25 and Emacs 27?
But I don't think so, the error you send is pretty typical for
incomplete configuration.

> Debugger entered--Lisp error: (error "Before first heading")
>   signal(error ("Before first heading"))
>   error("Before first heading")
>   outline-back-to-heading()

is typical when 

,
| outorg-prepare-message-mode-buffer-for-editing ()
`

has not run, it turns this line into a 1st level org headline thus
converting any kind of message body into an org file.

,
| * --text follows this line--
| Uwe Brauer <o...@mat.ucm.es> writes:
`

without this, the error is justified - an org file without a single 
org headline is no org file at all.

You could try to write an email with these lines:

,
| * 1st level
| ** 2nd level
| some text
`

put point on some text an call outorg, to see if it works.

Another option would be to use edebug:
open outorg.el, put point into 'outorg-edit-as-org', and call M-x
edebug-defun. Then convert an email again, and go step-by-step with
SPACE key, and see how far you get.

When done, call 'load-library' on outorg.el to get rid of edebug
instrumentation.

>> #+BEGIN_SRC emacs-lisp  
>>  (org-version)
>> #+END_SRC
>
> Git master from June 2017 so relatively recent
>
>> #+results:
>> : 8.2.10
>
>> #+BEGIN_SRC emacs-lisp  
>>  (gnus-version)
>> #+END_SRC
>
>> #+results:
>> : Gnus v5.13
>
> The same here.
>
>>> But when I fire up outorg-edit-as-org in a reply message I obtain the
>>> error I described in my earlier message.
>>> 
>>> Uwe Brauer 
>
>
>

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-06 Thread Thorsten Jolitz
Thorsten Jolitz <tjol...@gmail.com> writes:

> Uwe Brauer <o...@mat.ucm.es> writes:
>
>>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>>
>>> Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
>>> Hallo
>>
>>>> I know that the subject of my email exists already.
>>>> 
>> [[https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html]]
>>
>>> This works perfectly for your subject:
>>
>> I just realised that you are the author of that package. Sorry.
>>
>> I set
>>
>> (require 'outorg)  
>> (require 'outshine)
>> (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
>>
>> (add-hook 'message-mode-hook 'outline-minor-mode)

PS
you do have this variable defined, right?

,
| mail-header-separator is a variable defined in ‘sendmail.el’.
| Its value is "--text follows this line--"
| 
| Documentation:
| Line used to separate headers from text in messages being composed.
| 
| You can customize this variable.
`

the value is not important, but it can't be nil.

> ok, maybe I answered the wrong message, does not look that incomplete
> actually. Maybe try a copy of my config.
>
> I used outorg-edit-as-org to insert and evaluate these source blocks
> directly in this email, so for me it works:
>
> #+BEGIN_SRC emacs-lisp  
>  (emacs-version)
> #+END_SRC
>
>
> #+results:
> : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
> :  of 2018-02-09
>
> #+BEGIN_SRC emacs-lisp  
>  (org-version)
> #+END_SRC
>
>
> #+results:
> : 8.2.10
>
> #+BEGIN_SRC emacs-lisp  
>  (gnus-version)
> #+END_SRC
>
> #+results:
> : Gnus v5.13
>
>> But when I fire up outorg-edit-as-org in a reply message I obtain the
>> error I described in my earlier message.
>>
>> Uwe Brauer 

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-06 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
>> Hallo
>
>>> I know that the subject of my email exists already.
>>> 
> [[https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html]]
>
>> This works perfectly for your subject:
>
> I just realised that you are the author of that package. Sorry.
>
> I set
>
> (require 'outorg)  
> (require 'outshine)
> (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
>
> (add-hook 'message-mode-hook 'outline-minor-mode)

ok, maybe I answered the wrong message, does not look that incomplete
actually. Maybe try a copy of my config.

I used outorg-edit-as-org to insert and evaluate these source blocks
directly in this email, so for me it works:

#+BEGIN_SRC emacs-lisp  
 (emacs-version)
#+END_SRC

#+results:
: GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
:  of 2018-02-09

#+BEGIN_SRC emacs-lisp  
 (org-version)
#+END_SRC

#+results:
: 8.2.10

#+BEGIN_SRC emacs-lisp  
 (gnus-version)
#+END_SRC

#+results:
: Gnus v5.13

> But when I fire up outorg-edit-as-org in a reply message I obtain the
> error I described in my earlier message.
>
> Uwe Brauer 


-- 
cheers,
Thorsten




Re: [O] [Error]

2018-03-06 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
>> Hallo
>
>>> I know that the subject of my email exists already.
>>> 
> [[https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html]]
>
>> This works perfectly for your subject:
>
>> ,[ C-h f outorg-edit-as-org RET ]
>
> Thanks for the pointer, but alas it does not work in a gnus message/mail
> buffer.

Hello,
I' pretty sure your outshine config is not complete:

Here is what I have:

at the top of my .emacs:

,
| ;; *** Global Keys
| 
| ;; must be set before outline is loaded
| (defvar outline-minor-mode-prefix "\M-#")
`

then somewhere inside my .emacs (don't worry about "try-require", simply
use "require" in your code). outorg-export is optional too (but useful
for special needs in outorg exporting), I would highly recomment
navi-mode though (very fast navigation in outshine buffers).

,
| ;; ** Outline
| 
| (message "\n-- entering outline --")
| 
| (when (try-require 'outline)
| (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
| (add-hook 'message-mode-hook 'outline-minor-mode))
| 
| ;; outorg-export
| (try-require 'outorg-export)
| 
| ;; outshine
| (try-require 'outshine)
| (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
| 
| (setq outshine-use-speed-commands t)
| 
| ;; navi-mode
| (try-require 'navi-mode)
`

most likely this line is missing, add it:

,
| (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
`

Note that I did this:

,
| (add-hook 'xyz-mode-hook 'outline-minor-mode)
`

for many other modes too, like ESS, picolisp, ledger, latex ... etc

HTH

> When I use that function I obtain the following error:
>
> Debugger entered--Lisp error: (error "Before first heading")
>   signal(error ("Before first heading"))
>   error("Before first heading")
>   outline-back-to-heading()
>   outline-end-of-subtree()
>   outorg-save-markers((point-marker beg-of-subtree-marker mark-marker
>   org-clock-marker org-clock-hd-marker org-clock-default-task
>   org-clock-interrupted-task selected-task org-open-link-marker
>   org-log-note-marker org-log-note-return-to
>   org-entry-property-inherited-from)) 
>   outorg-edit-as-org(nil)
>   funcall-interactively(outorg-edit-as-org nil)
>   call-interactively(outorg-edit-as-org nil nil)
>   command-execute(outorg-edit-as-org)
>
>
> Did you check this command, how do you use it?
>
> Regards
>
> Uwe Brauer
>
>
>

-- 
cheers,
Thorsten




Re: [O] Feature suggestion and code review request: org-babel-cycle-src-block-header

2018-03-04 Thread Thorsten Jolitz
John Kitchin <jkitc...@andrew.cmu.edu> writes:

> Thanks for the examples.
>
> There is an interesting issue, the following does not save-excursion!
>
> (save-excursion
> (org-dp-rewire 'src-block t t ;cont ins
> t ;aff
> nil ;elem
> :parameters ":results output"))
>
> The point gets moved. Do you know why that happens?

Hmm ... org-dp-rewire is mostly fidling around with lists, but in the
end it acts conditionally on the 'replace' parameter:

,
| (if (and (marker-position beg)
|(marker-position end))
|   (cl-case replace
| (append (save-excursion (goto-char end) (insert strg)))
| (prepend (goto-char beg) (insert strg))
| (t (if (not replace)
|strg
|  (delete-region beg end)
|  (goto-char end)
|  (set-marker beg nil)
|  (set-marker paff nil)
|  (set-marker end nil)
|  (save-excursion (insert strg)
|   (if replace (insert strg) strg
`

append or prepend result, return it as string, or replace the rewired
element.
I guess the is a save-excursion missing here ...

> John
>
> ---
> 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 Sat, Mar 3, 2018 at 12:26 PM, Thorsten Jolitz <tjol...@gmail.com>
> wrote:
>
>  Thorsten Jolitz <tjol...@gmail.com> writes:
>
>  PS
>  One more to show that one can not only easily modify a certain
>  org element, but that its just as easy to convert it to another type
>  of
>  org element.
>
>  Use this (call M-x tj/obch)
>
>  #+BEGIN_SRC emacs-lisp
>  (defun tj/obch ()
>  "docstring"
>  (interactive)
>  (org-dp-rewire 'example-block t t ;cont ins
>  '(:caption (("val2" "key2") ("val2" "key2"))
>  :attr_xyz ("val1" "val2")) ;aff
>  nil ;elem
>  :language "common-lisp"
>  :switches '(lambda (old elem) old )
>  :parameters 'tj/toggle-params
>  :value '(lambda (old elem)
>  (let ((old1
>  (string-remove-suffix "\n" old)))
>  (concat "(+ 3 " old1 " 17)\n")))
>  :preserve-indent '(lambda (old elem) old ) ) )
>  #+END_SRC
>
>  with point on this source block header
>
>  ,
>  | * test
>  |
>  | #+NAME: test1
>  | #+BEGIN_SRC emacs-lisp :tangle yes :results none
>  | (+ 1 1)
>  | #+END_SRC
>  `
>
>  to get this
>
>  ,
>  | #+NAME: test1
>  | #+CAPTION[key2]: val2
>  | #+CAPTION[key2]: val2
>  | #+ATTR_XYZ: val2
>  | #+ATTR_XYZ: val1
>  | #+BEGIN_EXAMPLE
>  | (+ 3 (+ 1 1) 17)
>  | #+END_EXAMPLE
>  `
>
>  > John Kitchin <jkitc...@andrew.cmu.edu> writes:
>  >
>  > Hallo,
>  >
>  >> This is a neat idea.
>  >
>  > This is quite a nice use/show case for org-dp too.
>  >
>  > I did not really try to solve the users feature request, just
>  wanted to
>  > demonstrate how different a possible solution looks using
>  declarative
>  > programming, leaving all the low-level parsing and interpreting
>  work to
>  > the org-element framework.
>  >
>  > 1. Example org-mode buffer
>  >
>  > ,
>  > | * test
>  > |
>  > | #+NAME: test1
>  > | #+BEGIN_SRC emacs-lisp :tangle yes :results none
>  > | (+ 1 1)
>  > | #+END_SRC
>  > |
>  > | #+NAME: test2
>  > | #+BEGIN_SRC picolisp :tangle no :results raw
>  > | (+ 2 2)
>  > | #+END_SRC
>  > `
>  >
>  > 2. Elisp to toggle the parameter values
>  >
>  > The org-dp part is this.
>  >
>  > Call the mapping cmd (M-x tj/obch-map) in the buffer (act on all
>  > src-blocks), or put point on a src-block header and call M-x
>  tj/obch to
>  > just act on that scr-block.
>  >
>  > ,
>  > | (defun tj/obch ()
>  > | "docstring"
>  > | (interactive)
>  > | (org-dp-rewire 'src-block t t ;cont ins
>  > | t ;aff
>  > | nil ;elem
>  > | :language '(lambda (old elem) old )
>  > | :switches '(lambda (old elem) old )
>  > | :parameters 'tj/toggle-params
>  > | :value '(lambda (old elem) old )
>  > | :preserve-indent '(lambda (old elem) old ) ) )
>  > |
>  > |
>  > | (defun tj/obch-map ()
>  > | "docstring"
>  > | (interactive)
>  > | (org-dp-map '(tj/obch) "#\\+BEGIN_SRC"))
>  > `
>  >
>  > You can play around with the other args to org-dp-rewire (apart
>

Re: [O] [FYI] Programming with org-dp (by example)

2018-03-04 Thread Thorsten Jolitz
Thorsten Jolitz <tjol...@gmail.com> writes:

PS
Ups ... a few little bugs in the code, here is version 2

#+BEGIN_SRC emacs-lisp  
(defconst tj/radio-rgxp "^#\\+attr_org:[[:space:]]+:radio")
(defconst tj/radio-temp "temp")
(defconst tj/radio-wind "wind")

(defvar tj/radio-rw '("temp" "wind")) ;read/write
(defvar tj/radio-r '("take-a-walk")) ;read only

(defvar tj/radio-temp-red '("freezing" "tropical"))
(defvar tj/radio-temp-yellow '("cold" "hot"))
(defvar tj/radio-temp-green '("normal" "warm"))

(defvar tj/radio-wind-red '("hurricane"))
(defvar tj/radio-wind-yellow '("storm"))
(defvar tj/radio-wind-green '("breeze"))

;; rewire function
(defun tj/radio-switch ()
  "docstring"
  (interactive)
  (let ((stmp (time-stamp-string)))
(forward-line)
(org-dp-rewire 'plain-list
   'tj/radio-cont ;cont
   t ;ins 
   `(:attr_last_changed (,stmp)) ;aff 
   nil ;elem 
   )))

;; mapping function
(defun tj/radio-map ()
  "docstring"
  (interactive)
  (let (temp wind)
  (org-dp-map '(tj/radio-switch) tj/radio-rgxp)))



;; HELPER FUNCTIONS
;; helper function to actually modify the content
(defun tj/radio-cont (cont elem)
  "docstring"
  (let ((name (org-element-property :name elem))
(prompt-options (tj/radio-get-itm-labels cont))
(new-cont)
(users-choice)
(box-checked-p))
(cond
 ((member name tj/radio-rw) ;prompt user for value
  (progn
(setq users-choice (ido-completing-read name prompt-options))
(set (intern name) users-choice)
(setq new-cont (mapcar 'tj/radio-itm-rw cont
 ((member name tj/radio-r) ;set value
  (setq new-cont
(mapcar 'tj/radio-itm-r cont)))
 (t)) ;do nothing
(or new-cont cont)))


(defun tj/radio-get-itm-labels (cont)
  "docstring"
  (mapcar #'(lambda (itm)
  (string-remove-suffix
   "\n"
   (org-dp-contents itm t t)))
   cont))

(defun tj/radio-itm-rw (itm)
  "docstring"
  (let ((label (string-remove-suffix
"\n" (org-dp-contents itm t t
(if (string-equal label users-choice)
(org-element-put-property itm :checkbox 'on)
(org-element-put-property itm :checkbox 'off))
itm))

(defun tj/radio-itm-r (itm)
  "docstring"
  (let ((label (string-remove-suffix
"\n" (org-dp-contents itm t t

(org-element-put-property itm :checkbox 'off)

(cond
 ((and (string-equal label "red")
   (not box-checked-p)
   (or (member temp tj/radio-temp-red)
   (member wind tj/radio-wind-red)))
  (org-element-put-property itm :checkbox 'on)
  (setq box-checked-p t))

 ((and (string-equal label "yellow")
   (not box-checked-p)
   (or (member temp tj/radio-temp-yellow)
   (member wind tj/radio-wind-yellow)))
  (org-element-put-property itm :checkbox 'on)
  (setq box-checked-p t))

 ((and (string-equal label "green")
   (not box-checked-p)
   (or (member temp tj/radio-temp-green)
   (member wind tj/radio-wind-green)))
  (org-element-put-property itm :checkbox 'on)
  (setq box-checked-p t)))
itm))
#+END_SRC


> Hello List,
> due to some interest in org-dp recently on this list, I actually took
> the challenge of implementing a feature request by John Kitchin (without
> actually sticking close to the specification, this is just a showcase
> for org-dp).
>
> Task: implement a radio-list with org checkboxes 
> Extra feature: a read only radio-list that changes its values
> conditional on the values of read/write radio-lists (when mapping the
> buffer)

-- 
cheers,
Thorsten




[O] [FYI] Programming with org-dp (by example)

2018-03-04 Thread Thorsten Jolitz
   nil ;elem 
   )))

;; mapping function
(defun tj/radio-map ()
  "docstring"
  (interactive)
  (let (temp wind)
  (org-dp-map '(tj/radio-switch) tj/radio-rgxp)))



;; HELPER FUNCTIONS
;; helper function to actually modify the content
(defun tj/radio-cont (cont elem)
  "docstring"
  (let ((name (org-element-property :name elem))
(prompt-options (tj/radio-get-itm-labels cont))
(new-cont)
(users-choice))
(cond
 ((member name tj/radio-rw) ;prompt user for value
  (progn
(setq users-choice (ido-completing-read name prompt-options))
(set (intern name) users-choice)
(setq new-cont (mapcar 'tj/radio-itm-rw cont
 ((member name tj/radio-r) ;set value
  (setq new-cont
(mapcar 'tj/radio-itm-r cont)))
 (t)) ;do nothing
(or new-cont cont)))


(defun tj/radio-get-itm-labels (cont)
  "docstring"
  (mapcar #'(lambda (itm)
  (string-remove-suffix
   "\n"
   (org-dp-contents itm t t)))
   cont))

(defun tj/radio-itm-rw (itm)
  "docstring"
  (let ((label (string-remove-suffix
"\n" (org-dp-contents itm t t
(if (string-equal label users-choice)
(org-element-put-property itm :checkbox 'on)
(org-element-put-property itm :checkbox 'off))
itm))

(defun tj/radio-itm-r (itm)
  "docstring"
  (let ((label (string-remove-suffix
"\n" (org-dp-contents itm t t

(org-element-put-property itm :checkbox 'off)

(cond
 ((and (string-equal label "red")
   (or (member temp tj/radio-temp-red)
   (member temp tj/radio-wind-red)))
  (org-element-put-property itm :checkbox 'on))

 ((and (string-equal label "yellow")
   (or (member temp tj/radio-temp-yellow)
   (member temp tj/radio-wind-yellow)))
  (org-element-put-property itm :checkbox 'on))

 ((and (string-equal label "green")
   (or (member temp tj/radio-temp-green)
   (member temp tj/radio-wind-green)))
  (org-element-put-property itm :checkbox 'on)))
itm))
#+END_SRC

-- 
cheers,
Thorsten





Re: [O] Feature suggestion and code review request: org-babel-cycle-src-block-header

2018-03-03 Thread Thorsten Jolitz
Thorsten Jolitz <tjol...@gmail.com> writes:

PS
One more to show that one can not only easily modify a certain
org element, but that its just as easy to convert it to another type of
org element.

Use this (call M-x tj/obch)

#+BEGIN_SRC emacs-lisp  
(defun tj/obch () 
  "docstring"
  (interactive)
  (org-dp-rewire 'example-block t t ;cont ins
 '(:caption (("val2" "key2") ("val2" "key2"))
:attr_xyz ("val1" "val2")) ;aff 
 nil ;elem 
 :language "common-lisp"
 :switches '(lambda (old elem) old )
 :parameters 'tj/toggle-params
 :value '(lambda (old elem)
   (let ((old1 
  (string-remove-suffix "\n" old)))
 (concat "(+ 3 " old1 " 17)\n")))
 :preserve-indent '(lambda (old elem) old ) ) )
#+END_SRC

with point on this source block header 

,
| * test
| 
| #+NAME: test1
| #+BEGIN_SRC emacs-lisp :tangle yes :results none
|   (+ 1 1)
| #+END_SRC
`

to get this

,
| #+NAME: test1
| #+CAPTION[key2]: val2
| #+CAPTION[key2]: val2
| #+ATTR_XYZ: val2
| #+ATTR_XYZ: val1
| #+BEGIN_EXAMPLE
| (+ 3 (+ 1 1) 17)
| #+END_EXAMPLE
`




> John Kitchin <jkitc...@andrew.cmu.edu> writes:
>
> Hallo,
>
>> This is a neat idea. 
>
> This is quite a nice use/show case for org-dp too.
>
> I did not really try to solve the users feature request, just wanted to
> demonstrate how different a possible solution looks using declarative
> programming, leaving all the low-level parsing and interpreting work to
> the org-element framework.
>
> 1. Example org-mode buffer
>
> ,
> | * test
> | 
> | #+NAME: test1
> | #+BEGIN_SRC emacs-lisp :tangle yes :results none
> |   (+ 1 1)
> | #+END_SRC
> | 
> | #+NAME: test2
> | #+BEGIN_SRC picolisp :tangle no :results raw
> |   (+ 2 2)
> | #+END_SRC
> `
>
> 2. Elisp to toggle the parameter values
>
> The org-dp part is this. 
>
> Call the mapping cmd (M-x tj/obch-map) in the buffer (act on all
> src-blocks), or put point on a src-block header and call M-x tj/obch to
> just act on that scr-block.
>
> ,
> | (defun tj/obch () 
> |   "docstring"
> |   (interactive)
> |   (org-dp-rewire 'src-block t t ;cont ins
> |  t ;aff 
> |  nil ;elem 
> |  :language '(lambda (old elem) old )
> |  :switches '(lambda (old elem) old )
> |  :parameters 'tj/toggle-params
> |  :value '(lambda (old elem) old )
> |  :preserve-indent '(lambda (old elem) old ) ) )
> | 
> | 
> | (defun tj/obch-map ()
> |   "docstring"
> |   (interactive)
> |   (org-dp-map '(tj/obch) "#\\+BEGIN_SRC"))
> ` 
>
> You can play around with the other args to org-dp-rewire (apart from
> :parameters) to find out how easy you can change (or remove/add) other
> parts of the src-block without any work on the textual representation.
>
> E.g. try this:
>
> #+BEGIN_SRC emacs-lisp  
> (defun tj/obch () 
>   "docstring"
>   (interactive)
>   (org-dp-rewire 'src-block t t ;cont ins
>nil ;aff 
>nil ;elem 
>:language "common-lisp"
>:switches '(lambda (old elem) old )
>:parameters 'tj/toggle-params
>:value '(lambda (old elem)
>  (let ((old1 
> (string-remove-suffix "\n" old)))
>  (concat "(+ 3 " old1 " 17)\n")))
>:preserve-indent '(lambda (old elem) old ) ) )
> #+END_SRC
>
>
> to see this result in the example buffer after calling M-x tj/obch-map:
>
> ,
> | * test
> | 
> | #+BEGIN_SRC common-lisp :tangle no :results raw
> |   (+ 3 (+ 1 1) 17)
> | #+END_SRC
> | 
> | #+BEGIN_SRC common-lisp :tangle yes :results none
> |   (+ 3 (+ 2 2) 17)
> | #+END_SRC
> `
>
> PS
> Here is the whole code.
> The logic in 'tj/toggle-params is not really of interest here. The
> important thing is, that all of these options are possible:
>
> - simply assign a value
> - implement a lambda function in place (with two args)
> - implement a named function (with two args) and use its name
>
> ,
> | :parameters ":tangle no"
> | :parameters '(lambda (old elem) (concat old " :results none") )
> | :parameters 'tj/toggle-params
> `
>
> #+BEGIN_SRC emacs-lisp  
> (defvar tj/change-p)
>
> ;; org-dp in a

Re: [O] Feature suggestion and code review request: org-babel-cycle-src-block-header

2018-03-03 Thread Thorsten Jolitz
ader-strings'.
>
>  `header-strings' must be a non-empty list of strings. All whitespace
>  in them is shrinked.
>
>  If UNDO-ed, cursor position is not guaranteed to be preserved."
>  (interactive)
>  (cond
>  ((not (and header-strings (listp header-strings)))
>  (error "No Org Babel header strings list found to cycle through. %S
>  found intstead." header-strings))
>  ((not (every #'stringp header-strings))
>  (error "Malformed list of Org Babel header strings: not all elements
>  are strings in %S." header-strings))
>  (t
>  (let ((initial-position (point)))
>  (org-babel-goto-src-block-head)
>  ;; here we rely on `org-babel-goto-src-block-head'
>  ;; signalling an error if not in source code block
>  (forward-char (length "#+BEGIN_SRC"))
>  (let* ((fallback-position (point))
>  (we-were-before-replacement-zone (<= initial-position
>  fallback-position)))
>  (let ((default-position-to-return-to initial-position)
>  (old-header-string (delete-and-extract-region (point)
>  (line-end-position
>  (unless we-were-before-replacement-zone
>  (incf default-position-to-return-to (- (length old-header-string
>  (let ((new-header-string
>  (concatenate 'string
>  " "
>  (shrink-whitespace
>  (or (next-maybe-cycled old-header-string
>  header-strings
>  :test #'string-equal-modulo-whitespace)
>  (car header-strings))
>  (insert new-header-string)
>  (unless we-were-before-replacement-zone
>  (incf default-position-to-return-to (length new-header-string)))
>  (goto-char (if (<= fallback-position
>  default-position-to-return-to
>  (+ fallback-position (length new-header-string)))
>  fallback-position
>  default-position-to-return-to)
>
>  ;; example for mailing list
>  ;; Common Lisp assumed!
>  (defun akater/org-babel-cycle-header nil
>  (interactive)
>  (org-babel-cycle-src-block-header-string
>  '("lisp :tangle no :results none" ;; type 2 above
>  "lisp :tangle yes :results none" ;; type 3 above
>  "lisp :results type verbatim" ;; type 1 above
>  )))
>  #+end_src
>
>  Ideally, I envision something along these lines (some specific
>  choices
>  below don't really make sense):
>  #+begin_src emacs-lisp
>  (defcustom org-babel-standard-header-sequences-alist
>  '((development-setup-1
>  (lisp
>  (((:tangle . "no")
>  (:results . "none"))
>  ((:tangle . "yes")
>  (:results . "none"))
>  ((:results . "type verbatim"
>  (python
>  (((:tangle . "no")
>  (:results . "none"))
>  ((:tangle . "yes")
>  (:results . "none"))
>  ((:results . "type output"
>  )
>  (development-setup-2
>  (C
>  (((:tangle . "no")
>  (:results . "none"))
>  ((:tangle . "yes")
>  (:results . "raw"
>  (julia
>  (((:tangle . "no")
>  (:results . "none"))
>  ((:tangle . "yes")
>  (:results . "none")))
>  #+end_src
>
>

-- 
cheers,
Thorsten




Re: [O] question on org-element-interpret-data and when it works

2018-03-03 Thread Thorsten Jolitz
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> You used the word 'discrepancy',
>
> True. I inferred it from
>
>   (funny enough, some org elements have 'value' as their content, others
>   'content').
>
> which, IMO, sounds like it is a surprising fact.
>
>> I simply needed to know for each org
>> element what is interpreted and what not. And some have a content,
>> others a :value.
>
> As in every AST, some nodes are terminal (no contents), and some are not
> (contents).
>
> This distinction is made in `org-element-greater-elements', i.e.,
> non-terminal elements. See also `org-element-recursive-objects' for
> non-terminal objects.
>
>> So if I pass 'Hello World' as content to an example
>> block, nothing happens, if I pass it via :value, it appears as the
>> blocks ... well, content.
>
> Contents imply Org syntax. This would defeat the purpose of an example
> block.

Ok, so its just a matter of wording.  

On the computer science side of things, content seems to be org elements
or objects contained in other org elements (like table rows in a table),
and on the laymans side of things the text inside of an example block
looks very much like the blocks content too (while its technically named
'value' in this case).

-- 
cheers,
Thorsten




Re: [O] Exploring picolisp

2018-03-03 Thread Thorsten Jolitz
Lawrence Bottorff <borg...@gmail.com> writes:


Hi Lawrence,

> I'm looking at picolisp -- and wondering how it works, or better, why it
> doesn't really work work with babel. First problem, I couldn't get any
> form of picolisp to work in Emacs -- until I stopped starting Emacs with
> [...]
> I don't mean to complain or sound negative, but picolisp as is can't
> really be included as a babel language, can it? Maybe it worked once,
> but doesn't now?

sometimes the bug actually sits in front of the computer, as we all know
;-)

Apparently you are not aware of the 'session' concept of org source
blocks (please refer to the org manual). 
This is nothing specific to ob-picolisp, but holds for all ob languages
that do allow for sessions:

,
| * Picolisp scr-block test
| 
| #+BEGIN_SRC picolisp  :session pil1
|  (setq X1 (+ 3 4))
| #+END_SRC
| 
| #+results:
| : 7
| 
| 
| #+BEGIN_SRC picolisp  :session pil1
| (setq X2 (+ X1 1))
| #+END_SRC
| 
| #+results:
| : 8
| 
| 
| #+BEGIN_SRC picolisp  :session pil1
| (de foo1 (X) (+ X 2))
| #+END_SRC
| 
| #+results:
| : foo1
| 
| #+BEGIN_SRC picolisp  :session pil1 :results raw
| (setq X3 (foo1 8))
| #+END_SRC
| 
| #+results:
| 10
`

And, with a session, you do have a related interactive repl buffer in
Emacs called "pil1", thats reflects all evaluations of the code blocks
in the org file, and allows for user input just like the PicoLisp repl:

,
| (setq X1 (+ 3 4))
| 'org-babel-picolisp-eoe
| : -> 7
| : -> org-babel-picolisp-eoe
| : (setq X2 (+ X1 1))
| 'org-babel-picolisp-eoe
| -> 8
| : -> org-babel-picolisp-eoe
| : (de foo1 (X) (+ X 2))
| 'org-babel-picolisp-eoe
| -> foo1
| : -> org-babel-picolisp-eoe
| : (setq X3 (foo1 8))
| 'org-babel-picolisp-eoe
| -> 10
| : -> org-babel-picolisp-eoe
| : 
`

Hope that helps

-- 
cheers,
Thorsten




Re: [O] question on org-element-interpret-data and when it works

2018-03-03 Thread Thorsten Jolitz
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> I have defined these two constants in org-dp.el to work around this
>> discrepancy (and to know which elements do not have interpreted content
>> at all):
>>
>> ,
>> | (defconst org-dp-no-content-elems
>> |   (list 'babel-call 'clock 'comment 'comment-block 'diary-sexp
>> |'example-block 'fixed-width 'horizontal-rule 'keyword
>> |'latex-environment 'node-property 'planning 'src-block)
>> |   "List of Org elements without interpreted .")
>> | 
>> | (defconst org-dp-value-blocks
>> |   (list 'comment-block 'example-block 'src-block)
>> |   "List of Org block that have a :value instead of contents.")
>> `
>
> I don't understand where you think there is a discrepancy here.

You used the word 'discrepancy', I simply needed to know for each org
element what is interpreted and what not. And some have a content,
others a :value. So if I pass 'Hello World' as content to an example
block, nothing happens, if I pass it via :value, it appears as the
blocks ... well, content.

This is no critique, and no problem, and please don't change it (since
it would be a breaking change in this context). 

With the org-dp tempo-templates, its no problem for org-dp users either,
since these are smart: they offer you a content arg (cont) to fill, if
it makes sense, they hide it, if not. And for some block types they
offer the :value parameter, since it is interpreted.

So I don't see any problem, just something an org-dp user probably
should be aware of.

-- 
cheers,
Thorsten




Re: [O] question on org-element-interpret-data and when it works

2018-03-03 Thread Thorsten Jolitz
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

Hello,

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> (funny enough, some org elements have 'value' as their content, others
>> 'content').
>
> Could you point out where there is such discrepancy in "org-element.el"?

I have defined these two constants in org-dp.el to work around this
discrepancy (and to know which elements do not have interpreted content
at all):

,
| (defconst org-dp-no-content-elems
|   (list 'babel-call 'clock 'comment 'comment-block 'diary-sexp
|   'example-block 'fixed-width 'horizontal-rule 'keyword
|   'latex-environment 'node-property 'planning 'src-block)
|   "List of Org elements without interpreted .")
| 
| (defconst org-dp-value-blocks
|   (list 'comment-block 'example-block 'src-block)
|   "List of Org block that have a :value instead of contents.")
`

PS 
should probably read "... without interpreted content" in the first
defconst

-- 
cheers,
Thorsten




Re: [O] how do you compose mails in Gnus with org-mode

2018-03-03 Thread Thorsten Jolitz
Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:

Hallo

> I know that the subject of my email exists already.
> [[https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html]]

This works perfectly for your subject:

,[ C-h f outorg-edit-as-org RET ]
| outorg-edit-as-org is an interactive Lisp function in ‘outorg.el’.
| 
| It is bound to M-# #,   .
| 
| (outorg-edit-as-org  ARG)
| 
| Convert and copy to temporary Org buffer
| 
| With ARG, act conditional on the raw value of ARG:
| 
| | prefix | raw | action 1  | action 2   |
| |+-+---+|
| | C-u| (4) | edit-whole-buffer | ---|
| | C-1|   1 | edit-whole-buffer | insert default export-template |
| | C-2|   2 | edit-whole-buffer | prompt user for template-file  |
| | C-3|   3 | edit-whole-buffer | insert & keep default template |
| | C-4|   4 | edit-whole-buffer | insert & keep template-file|
| | C-5|   5 | propagate changes | ---|
| 
| [back]
`

It has already been described several time how to configure
outshine/outorg that it works with message-mode too.

Its actually quite easy. Configure outshine like described in the
README, and add outline-minor-mode to message-mode-hook in your .emacs.

,
| (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
| (add-hook 'message-mode-hook 'outline-minor-mode))
`

Then with M-# # your email (open in message-mode, gnus) will be opened
in an org-mode buffer for editing in org-mode.

Looks very similar to opening a source-block in org-mode to edit the
sources in the programming language mode.

,
| [ *unsent followup to Joseph Vidal-Rosset on gmane.emacs.orgmode* ] 
| Exit with M-# (Meta-Key and #)
| * --text follows this line--
| Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
| 
| Hallo
| 
| > I know that the subject of my email exists already.
| > https://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00855.html
| 
| This works perfectly for your subject:  [...]
`

and tells you how to exit again: M-#

-- 
cheers,
Thorsten




Re: [O] question on org-element-interpret-data and when it works

2018-03-03 Thread Thorsten Jolitz
| tempo-template-org-dp-create is an interactive Lisp function.
| 
| (tempo-template-org-dp-create  ARG)
| 
| Insert org-dp-create template.
| 
| [back]
`

or this one with explanations to get started (not so much for productive use):

,[ C-h f tempo-template-org-dp-create-with-comments RET ]
| tempo-template-org-dp-create-with-comments is an interactive Lisp
| function.
| 
| (tempo-template-org-dp-create-with-comments  ARG)
| 
| Insert org-dp-create template.
| 
| [back]
`

Example: you will be prompted for the org element (in this case I
decided to use "example-block"), you don't have to type anything, just
do this single selection when prompted.

,
| ;; Affiliated keywords: '(:kw1 val1 :kw2 val2 ...)
| ;; :name "val"
| ;; :plot "val"
| ;; :results ("val") or ("val" "key")
| ;; :header ("val") or ("val1" "val2")
| ;; :caption (("val")) or (("val" "key")) or
| ;;  (("val2" "key2") ("val2" "key2"))
| ;; :attr_xyz ("val") or ("val1" "val2")
| (org-dp-create 'example-block nil t ;cont ins
| nil ;aff 
| :switches ""
| :preserve-indent ""
| :value ""
| )
`

What you see: you can just write "Hello World" in the 

,
| :value ""
`

parameter and will get an example block with "Hello World" as content
(funny enough, some org elements have 'value' as their content, others
'content').  Check the docstring of org-dp-create for more info on its
args.  You can add affiliated keywords too, as demonstrated (as one
function arg).


REWIRE:

,[ C-h f tempo-template-org-dp-rewire RET ]
| tempo-template-org-dp-rewire is an interactive Lisp function.
| 
| (tempo-template-org-dp-rewire  ARG)
| 
| Insert org-dp-rewire template.
| 
| [back]
`

or this one, if you don't just want to set properties, but need a lambda
function to do work in calculation the new property (with access to the
old property and the whole plist of the old element you want to
rewire/modify):

,[ C-h f tempo-template-org-dp-rewire-lambda RET ]
| tempo-template-org-dp-rewire-lambda is an interactive Lisp function.
| 
| (tempo-template-org-dp-rewire-lambda  ARG)
| 
| Insert org-dp-rewire template with lambdas.
| 
| [back]
`

Examples:

,
| (org-dp-rewire 'example-block nil t ;cont ins
| nil ;aff 
| nil ;elem 
| :switches ""
| :preserve-indent ""
| :value ""
| )
`

,
| (org-dp-rewire 'example-block nil t ;cont ins
| nil ;aff 
| nil ;elem 
| :switches '(lambda (old elem)  )
| :preserve-indent '(lambda (old elem)  )
| :value '(lambda (old elem)  )
`

Again, check the docstring of org-dp-rewire for more info on its args.

I hope this helps already, feel free to ask any further questions (maybe
put me in Cc since I'm not a very frecuent visitor of the list).

If I find time and motivation I might look at your specific example/use
case, but I cannot promise that.

-- 
cheers,
Thorsten




Re: [O] function for inserting a block

2017-12-10 Thread Thorsten Jolitz

Hello,
this is a long thread so I did not read everything, just want to mention
that in org-dp.el I did something similar using

- tempo templates (for a programmer who wants to insert an
org-dp-create call in his emacs-lisp program) and 

- a universal (org) prompt function for a user who wants to insert a
src-block in his org file.

This one for productive use in emacs-lisp programs (note that there is
tab completion for values):

,[ C-h f tempo-template-org-dp-create RET ]
| tempo-template-org-dp-create is an interactive Lisp function.
| 
| (tempo-template-org-dp-create  ARG)
| 
| Insert org-dp-create template.
| 
| [back]
`

This one with comments to give a bit more explanation to the programmer:

,[ C-h f tempo-template-org-dp-create-with-comments RET ]
| tempo-template-org-dp-create-with-comments is an interactive Lisp
| function.
| 
| (tempo-template-org-dp-create-with-comments  ARG)
| 
| Insert org-dp-create template.
| 
| [back]
`

This one is on the user level (in org files), C-c w w ist just my
personnal key binding from my .emacs:

,[ C-h f org-dp-wrap-in-block RET ]
| org-dp-wrap-in-block is an interactive Lisp function in
| ‘org-dp-lib.el’.
| 
| It is bound to C-c w w.
| 
| (org-dp-wrap-in-block  LINES USER-INFO  PROMPT-SPEC)
| 
| Wrap sexp-at-point or region in Org block.
| 
| A region instead of the sexp-at-point is wrapped if either
| 
|- optional arg LINES is an (positive or negative) integer or
| 
|- the region is active
| 
| In the first case the region is determined by moving LINES lines
| up (LINES is positive) or down (LINES is negative) from point
| using ‘forward-line’, in the second case the active region is
| used.
| 
| If point is already inside of a block, modify it or unwrap its
| content/value instead of wrapping it in another block, except if
| explicitly asked for by user.
| 
| If USER-INFO is given, it should be a list in the format returned
| by ‘org-dp-prompt-all’, i.e.
| 
|  (elem-type contents replace affiliated args)
| 
| Look up that function’s docstring for more information about the
| list’s elements. A non-nil USER-INFO suppresses calls to
| ‘org-dp-prompt-all’ and is used instead of its return value.
| 
| Possible  PROMPT-SPEC should be keyword/value pairs used for
| restricting user-prompting via ‘org-dp-prompt-all’, e.g.
| 
|   :noprompt-affiliated t :noprompt-replace t
| 
| see the docstring of that function for more info.
| 
| [back]
`

org-dp-prompt-all is the universal function, with  argument
PROMPT-SPEC you can reduce the prompting and such easily create your own
specific 'wrap in block' utility commands without much programming.

Hope this is not off-topic.

-- 
cheers,
Thorsten





Re: [O] [RFC] Remove Org Struct mode

2017-09-09 Thread Thorsten Jolitz
Michael Brand <michael.ch.br...@gmail.com> writes:

Hello Micheal,

> My requirements for orgstruct-mode or its replacement are very limited
> compared to what orgstruct-mode or outshine.el do or intend to do:

> 4) Key bindings exactly like Org

> All items 3)..7) are supported in orgstruct-mode, in outshine.el I was
> not able to make them work. 

I'm not sure how orgstruct-mode does it, but since outshine is a minor
mode, it cannot use Key bindings exactly like Org, since many of these
are used in other major modes too.

It is not easy to find a prefix for a minor mode that is easy to type
but won't conflict with major modes.

-- 
cheers,
Thorsten




[O] Show all timestamps in agenda custom command

2017-05-24 Thread Thorsten Grothe
Hello,

I would like to generate a agenda custom command which shows me always
*all* timestamps (with deadline and scheduled too) of todo items.

See this examples:

For this entry it works fine:
** TODO <2017-05-29 Mo> Test entry

it looks like this:
  TODO <2017-05-29> Test entry
  
but not for scheduled entries like this with linebreak:

** TODO Test
SCHEDULED: <2017-05-24 Mi>

Org agenda only shows this:
SCHULE Test → where's the timestamp?

I would like the see the timestamp like in the example above.

This is my agenda custom command so far:

...
("s" "Schule" todo "SCHULE"
   ((org-agenda-overriding-header "Schule")
(org-agenda-prefix-format "○  %t%s")
(org-agenda-entry-types '(:scheduled))
   ))
...

what can I do to solve this problem?


Regards

Thorsten Grothe



Re: [O] manipulate org tables using emacs-lisp

2016-10-01 Thread Thorsten Jolitz
Alan Schmitt <alan.schm...@polytechnique.org> writes:

Hi Alan,

> On 2016-09-30 22:52, Thorsten Jolitz <tjol...@gmail.com> writes:
>
>>> Are there functions for manipulating org-tables using emacs-lisp? More
>>> precisely, I would like to refer to a table by its name, read some cells
>>> (either by position or by matching some given text with some text in the
>>> first row/column), and write in some cells.
>>
>> ,[ C-h f org-table-to-lisp RET ]
>> | org-table-to-lisp is an autoloaded compiled Lisp function in
>> | ‘../org-mode/lisp/org-table.el’.
>> | 
>> | (org-table-to-lisp  TXT)
>> | 
>> | Convert the table at point to a Lisp structure.
>> | The structure will be a list.  Each item is either the symbol ‘hline’
>> | for a horizontal separator line, or a list of field values as strings.
>> | The table is taken from the parameter TXT, or from the buffer at point.
>> | 
>> | [back]
>> `
>>
>> returns the table as a nested list you can map with lots of Elisp
>> functions (like mapcar). 
>>
>> Ex.:
>>
>> | my | tab |
>> |  1 |   2 |
>>
>> =>
>>
>> (("my" "tab") ("1" "2"))
>
> This is very useful, thank you. But how do I go to a named table? I
> found org-babel-goto-named-block, but nothing for tables.

you can try

,[ C-h f org-table-map-tables RET ]
| org-table-map-tables is a compiled Lisp function in
| ‘../org-mode/lisp/org.el’.
| 
| (org-table-map-tables FUNCTION  QUIETLY)
| 
| Apply FUNCTION to the start of all tables in the buffer.
| 
| [back]
`

to go to all tables in the buffer, then inside FUNCTION you would need
to check first if the table is named and is the one your are looking
for. If so, get the table as list, work on the list, and insert the new
table replacing the old one (org-dp-create-table inserts a table when
given a nested list). 
Finally move point to the end of the inserted table, so the mapping
function can continue.

PS
org-element and org-dp allow you to do these things too, maybe even
more comfortably if you are familiar with these libraries. But right now
I'm not really able to give you a working example in reasonable time.

-- 
cheers,
Thorsten




Re: [O] manipulate org tables using emacs-lisp

2016-09-30 Thread Thorsten Jolitz
Alan Schmitt <alan.schm...@polytechnique.org> writes:

Hi Alan,

> Are there functions for manipulating org-tables using emacs-lisp? More
> precisely, I would like to refer to a table by its name, read some cells
> (either by position or by matching some given text with some text in the
> first row/column), and write in some cells.

,[ C-h f org-table-to-lisp RET ]
| org-table-to-lisp is an autoloaded compiled Lisp function in
| ‘../org-mode/lisp/org-table.el’.
| 
| (org-table-to-lisp  TXT)
| 
| Convert the table at point to a Lisp structure.
| The structure will be a list.  Each item is either the symbol ‘hline’
| for a horizontal separator line, or a list of field values as strings.
| The table is taken from the parameter TXT, or from the buffer at point.
| 
| [back]
`

returns the table as a nested list you can map with lots of Elisp
functions (like mapcar). 

Ex.:

| my | tab |
|  1 |   2 |

=>

(("my" "tab") ("1" "2"))

-- 
cheers,
Thorsten




Re: [O] Count words under subtrees

2016-09-27 Thread Thorsten Jolitz
Giacomo M <jackja...@gmail.com> writes:

Hi,

> right now I manually =er/expand-region= (from expand-region.el) until
> I select a subtree, and then =count-words-region= to get number of
> words for the subtree. I was wondering whether anybody already coded
> some lisp to programmatically have this count, ideally one count per
> TOC entry (and perhaps excluding headline words in the count).

AFAIK there are two libraries that show the "weight" of a folded subtree
based on hidden lines as little headline cookies - if that helps. Not
sure about their state, they might just work:

,
| https://github.com/tj64/org-hlc
| https://github.com/pinard/org-weights
`

and org-hlc is build into outshine, so if you open (e.g.) an elisp file
that is structured with outshine headers (= outcommented org-headers),
and have outshine minor-mode enabled, you can use

,[ C-h f outshine-toggle-hidden-lines-cookies RET ]
| outshine-toggle-hidden-lines-cookies is an interactive Lisp function
| in `outshine.el'.
| 
| (outshine-toggle-hidden-lines-cookies)
| 
| Toggles status of hidden-lines cookies between shown and hidden.
`

and will see something like this, i.e. folded headers with 'hidden lines
cookies':

,
|  55:;; * Prerequisites
|  56:;; ** Start Message and Start Time [#8]
|  65:;; ** Setup Parts :mytag: [#79]
| 145:;; ** Environment [#92]
| 238:;; ** Loading Emacs Lisp Libraries
| 239:;; *** Features [#64]
| 304:;; *** Library Search [#144]
| 449:;; *** Package Manager [#39]
| 489:;; *** Autoloads [#5]
| 495:;; ** Debugging [#8]
| 504:;; * [Screen Input Keys Cmd Enter Exit] [#1]
| 506:;; ** 1 (info "(emacs)Screen") [#3]
| 510:;; *** 1.1 (info "(emacs)Point")
| 511:;; *** 1.2 (info "(emacs)Echo Area") [#4]
| 516:;; *** 1.3 (info "(emacs)Mode Line") [#4]
| 521:;; *** 1.4 (info "(emacs)Menu Bar") [#2]
`


-- 
cheers,
Thorsten




Re: [O] iOrg

2016-09-16 Thread Thorsten Jolitz
Adam Porter <a...@alphapapa.net> writes:

Hi Adam,

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> [WARNING: this is an extremely long post with lots of boxquotes that 
>> might turn out unreadable, you might want to consider this as spam 
>> and just ignore it]
>
> Hi Thorsten,
>
> I guess I have missed iOrg before, because this looks very interesting!
> If I understand correctly, iOrg runs a web server written in PicoLisp
> which presents a set of Org files as an editable wiki in a browser?

iOrg is two things:

 - the PicoLisp Wiki (which is a lightweight but complete application
   with user-, role-, document-, version-management, authentication,
   etc.) with Org-mode syntax, where you can create, edit and (full text)
   search wiki pages as Org files that are stored as BLOBS in the
   PicoLisp database and viewed as HTML in the browser.

- a database application that maps textbased Org-mode files to an
   object-oriented class hierarchy, where each headline presents an
   object (instance) of class +OrgHeadline, and each file presents an
   object (instance) of class +OrgData, and the tree structure of an Org
   file is represented by links between these objects.

> If so, this opens up a world of possibilities.  Imagine having your
> personal Org files (at least, ones without very personal data) editable
> on your personal web server from any computer, even one without Emacs
> installed (including mobile devices)!  You could edit your Org files
> from any system, then sync changes with Git when you get home and
> continue editing in Emacs.

>From my point of view, Org-mode's greatest strength (being integrated in
powerful Emacs) is kind of a weakness too. Did you ever try to write Org
syntax without any editor support? Not very comfortable ... your idea
seems perfectly valid to me when its about editing the headline
properties of an +OrgHeadline object in the browser, but not so much for
writing lengthy an syntax rich content of a headline. There you really
need Emacs for editing ... 

> I feel like I've seen a similar project before, one not based on
> PicoLisp...I think it ran from within Emacs...I'd have to google it up
> again.  But I don't think it was nearly as advanced as this.

There are several Emacs Web Servers. They can't be as advanced as this
because they would have to compete with the PicoLisp application
programming framework and its underlying object-oriented lisp database,
which is a tough task.

> Anyway, if I could make one suggestion to help get things going again,
> it would be to add a bit more info to the readme so that visitors can
> immediately understand what it's about.  :)

Thats a good suggestion, but actually I did not want that, because its a
bit too early. Its not yet version 0.9 for public announcement, maybe
0,8? I was surprised how good it worked yesterday, did not touch it for
a long time, there is not missing too much.

-- 
cheers,
Thorsten




Re: [O] iOrg

2016-09-14 Thread Thorsten Jolitz
Philip Hudson <phil.hud...@iname.com> writes:

[WARNING: this is an extremely long post with lots of boxquotes that 
might turn out unreadable, you might want to consider this as spam 
and just ignore it]

Hi Philip,

> On 12 September 2016 at 23:10, Nick Dokos <ndo...@gmail.com> wrote:
>> Thorsten Jolitz <tjol...@gmail.com> writes:
>>
>>> ...
>>>
>>> If you feel you don't need the whole parse tree, but rather want to act
>>> locally on the Org element at point, you might want to look at
>>> org-dp.el
>>> ...
>>
>> Just a note for the benefit of newcomers to the list: Thorsten's
>> org-dp.el (and many other goodies) are on his github pages:
>>
>> https://github.com/tj64/org-dp
>> https://github.com/tj64?tab=repositories
>
> Just had a look, and I think his "iOrg" looks like the Holy Grail of
> Org: round-trip web-enabled org-mode. Is that right? Has anyone used
> it? Is there a demo site somewhere? Very exciting!

I still think its a splendid idea to bring my two favorite software
systems together (Emacs(Org-mode) and PicoLisp), and iOrg is actually
very close to being usable (and, I would guess, pretty useful).
Events in my life kept me away from Emacs for more than a year, and
recently I used it only occasionally, but now winter comes and the long,
dark and cold evenings ...
I'm (slowly slowly) converting to impressive and exciting Spacemacs, I
would like to create a Spacemacs layer for the outshine-libraries - and
I would like to start again working on iOrg, its such a promising
project.

There is a lot of functionality already there, I don't even remember all
the stuff I wanted and implemented. I'm on Archlinux with tmux and no X,
so I only tried it with emacs-w3m, an it does not look too bad there.

What I can do here locally:

 - start the iOrg Server (in Production or Debug mode, the latter with
   +), this starts an Emacs daemon too

,
| [tj@arch old-picoLisp]$ ./pil iorg/main.l -main -go +
| # url> +Role redefined
| # +User em redefined
| # url> +User redefined
| 
| Warning: due to a long standing Gtk+ bug
| http://bugzilla.gnome.org/show_bug.cgi?id=85715
| Emacs might crash when run in daemon mode and the X11 connection is
| unexpectedly lost.
| Using an Emacs configured with --with-x-toolkit=lucid does not have
| this problem.
| Starting Emacs daemon.
`

 - open http://localhost:5001 in emacs-w3m and login at the iOrg Wiki
   startpage

,
| Location: http://localhost:5001/ 
| …20:15 UTC
| 
|   * iOrg
|   * Home
|   * logout
|   * 
|   * Documents
|   * Org Data
|   * Org Headlines
|   * Role Administration
|   * User Administration
|   * Upload
|   * Help
| 
| iOrg Logo
| 
| Name []
| Password []
| 
| [login]
`

 - login 

,
| Name [admin   ]
| Password []
| 
| [logout] 'admin' logged in
`

 - read and edit the wiki pages under node iOrg. 

   This is all based on the PicoLisp wiki from amazing PicoLisp creator
   Alexander Burger, I replaced the PicoLisp wiki syntax (which isn't
   bad at all and has its own Emacs mode written by me) with Org-mode.

   read:

,
| Location: 
http://localhost:43051/19189021633385603~!iorg?home?*Menu=+3&*Tab=+1&*ID=
| …00:14 UTCiOrg-Wiki Logo
| [] [Search]
| 
| Log out
| My account
| 
|   * Start Page
|
|   * FAQ
|
|   * Tutorial
|
|   + Assumptions
|   + Web UI
|   + Emacs UI
|   + PicoLisp Database
|   + Markup for DHTML
|   * Org-mode Home
|
|   * Org-mode Wiki
|
|   * PicoLisp Wiki
|
|   * Help
|
| Edit   Reply
| 
| High Level Introduction to iOrg
| 
| iOrg Application Framework
| 
| Merging two of the most exciting Lisp applications around
| into one powerful Web Application Framework
| 
| iOrg is based on the PicoLisp Wiki, a rather small but highly
| functional web-application developed with the incredibly expressive 
| PicoLisp Application Framework. By replacing the original PicoLisp
| Wiki markup with Org-mode markup, significant synergy effects are
| produced. [...]
`

   press Edit button, and you see Org syntax!

,
|   * PicoLisp Wiki
|
|   * Help
|
| home
| 
| [#+OPTIONS: toc:nil num:nil   
   ]
| [#+DESCRIPTION: start page
   ]
| [#+TITLE: High Level Introduction to iOrg 
   ]
| [ 
   ]
| [/{{{title}}}/

Re: [O] Programmatically handling org files

2016-09-12 Thread Thorsten Jolitz
Joost Kremers <joostkrem...@fastmail.fm> writes:

Hi,

> I was wondering if there is some sort of (semi)official API for handling
> org files programmatically. That's to say, is there a documented way for
> non-org Emacs packages to manipulate (the contents of) org files?
>
> Specifically, I'm wondering about creating and deleting entries (by
> entries I mean headers with their contents), changing TODO state, moving
> entries, that sort of thing.

by "non-org Emacs packages" you mean Emacs packages written in Elisp,
but not part of Org-mode? 

The org-mode parser converts an Org document into a nested list and
provides many convenience functions to work on this parse tree. So
org-element.el (and maybe ox.el too) is the core library for converting
an Org text document into an Elisp data structure and working with that,
have a look at these two functions:

,
| 3965:(defun org-element-parse-buffer ( granularity visible-only)
| 4043:(defun org-element-map
`

If you feel you don't need the whole parse tree, but rather want to act
locally on the Org element at point, you might want to look at 
org-dp.el with just two core functions (create and rewire an Org
element) and a mapping functions (plus quite a few utilities in
org-dp.el and org-dp-lib.el):

,
| 523:(cl-defun org-dp-create
|(elem-type  contents insert-p affiliated  args)
| 642:(cl-defun org-dp-rewire
|(elem-type  contents replace affiliated element  args)
| 766:(defun org-dp-map
|(fun-with-args rgxp  match-pos backward-search-p beg end
| silent-p)
`

Note that I recently added 4 "Tempo" Templates (a bit like Yasnippets)
to org-dp that make it easy to insert a 'create' or 'rewire' call with
just those parameters the interpreter uses for the element to be created
or rewired:

,
| M-x tempo-template-org-dp-create
| M-x tempo-template-org-dp-create-with-comments
| M-x tempo-template-org-dp-rewire
| M-x tempo-template-org-dp-rewire-lambda
`
 
e.g. calling the third one with elem type "headline" enters this template

#+BEGIN_SRC emacs-lisp
  (org-dp-rewire 'headline
  "\n" ;cont
  t ;ins 
  nil ;aff 
  nil ;elem 
  :level 1 ;1..8
  :priority nil ;65|66|67
  :todo-keyword TODO
  :title ""
  :tags '( )
  :commentedp nil
  :pre-blank 0
  :footnote-section-p nil
  )
#+END_SRC

while for elem type "example block" its only:

#+BEGIN_SRC emacs-lisp
  (org-dp-rewire 'example-block nil t ;cont ins
  nil ;aff 
  nil ;elem 
  :switches ""
  :preserve-indent ""
  :value ""
  )
#+END_SRC

since example-blocks have no content (:value is their content) and only
3 parameters that are actually interpreted.

Using this system, creating or rewiring an Org Element from Elisp
requires only to define the values of the interpreted parameters, all
the low level stuff (actually creating and inserting the new/modified
element in text form) is left to the interpreters (from org-element.el).

You just declare what you want and don't worry anymore how it is done
(=> dp stands for declarative programming, in this context at least ;-)

-- 
cheers,
Thorsten




Re: [O] Multipart/Alternative reply to email?

2016-03-26 Thread Thorsten Jolitz
Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "Thorsten" == Thorsten Jolitz <tjol...@gmail.com> writes:

>> Peter Davis <p...@pfdstudio.com> writes:
>>> I realize this would require somehow converting the original message
>>> to org-mode markup, and that seems very tricky. I just wondered
>>> if anyone had taken a stab at building something like this.
> hi
>
>
>> outorg.el works with message-mode too, so I currently write this
>> message
>> in Org-mode. Not related to org-mime in anyway, maybe not even to your
>> intention, but nevertheless helpful perhaps. Just install outshine and
>> outorg via package manager and follow the instructions for your .emacs
>> file, and don't forget to put
>
> I don't find these two package in the package manager, could you provide
> a pointer, please?
> Thanks 

You need to incude MELPA as package archive in your .emacs, e.g.:

,
| (setq package-archives
|   '(("gnu" . "http://elpa.gnu.org/packages/;)
|   ("marmalade" . "http://marmalade-repo.org/packages/;)
|   ("tromey" . "http://tromey.com/elpa/;)
| ("melpa"  . "http://melpa.milkbox.net/packages/;)))
`

-- 
cheers,
Thorsten




Re: [O] Multipart/Alternative reply to email?

2016-03-25 Thread Thorsten Jolitz
Peter Davis <p...@pfdstudio.com> writes:

> I realize this would require somehow converting the original message
> to org-mode markup, and that seems very tricky. I just wondered
> if anyone had taken a stab at building something like this.

outorg.el works with message-mode too, so I currently write this message
in Org-mode. Not related to org-mime in anyway, maybe not even to your
intention, but nevertheless helpful perhaps. Just install outshine and
outorg via package manager and follow the instructions for your .emacs
file, and don't forget to put

#+BEGIN_SRC emacs-lisp  
(add-hook 'message-mode-hook 'outline-minor-mode)
#+END_SRC

then this lets you edit your message-mode buffer in org-mode:

,[ C-h f outorg-edit-as-org RET ]
| outorg-edit-as-org is an interactive Lisp function in `outorg.el'.
| 
| It is bound to M-# #,   .
| 
| (outorg-edit-as-org  ARG)
| 
| Convert and copy to temporary Org buffer
| 
| With ARG, act conditional on the raw value of ARG:
| 
| | prefix | raw | action 1  | action 2   |
| |+-+---+|
| | C-u| (4) | edit-whole-buffer | ---|
| | C-1|   1 | edit-whole-buffer | insert default export-template |
| | C-2|   2 | edit-whole-buffer | prompt user for template-file  |
| | C-3|   3 | edit-whole-buffer | insert & keep default template |
| | C-4|   4 | edit-whole-buffer | insert & keep template-file|
| | C-5|   5 | propagate changes | ---|
`

and this lets you return from org-mode to message-mode (bound to M-#):

,[ C-h f outorg-copy-edits-and-exit RET ]
| outorg-copy-edits-and-exit is an interactive Lisp function in
| `outorg.el'.
| 
| (outorg-copy-edits-and-exit)
| 
| Replace code-buffer content with (converted) edit-buffer content and
|   kill edit-buffer
`----

-- 
cheers,
Thorsten




Re: [O] Treat node or subtree as source block?

2016-03-05 Thread Thorsten Jolitz
"Paul M." <pmma...@gmail.com> writes:

Hi,

> I'm interested in treating an entire node or subtree as a source block
> for the purposes of tangling.
>
> Is there some way to specify that, say with properties, without having
> to explicitly surround text to be tangled with
> "#+BEGIN_SRC...#+END_SRC" ?

It depends what you want. Tangling actually is for removing the Org
text from Org-mode files, just leaving the content of source blocks,
so your whole idea is a bit against the flow.

If you want to conserve the whole node you probably need to wrap it
in #+BEGIN_SRC org ... #+END_SRC.

If you want to transform it to a source block you could use org-dp.el:

#+BEGIN_SRC elisp
  (defun tj/node-to-src-block ()
"Transform node to src block."
(interactive)
(org-dp-rewire 'src-block t 'append nil nil
   :language '(lambda (old elem)
 (car (org-element-property :tags elem)))
   :parameters '(lambda (old elem)
  (format ":exports %s"
(cadr (org-element-property :tags elem
   :value '(lambda (old elem) (org-dp-contents 'elem t t
#+END_SRC

#+results:
: tj/node-to-src-block


Calling this function with point on the following headline appends
the (working) src-block that results from transforming the headline:

* Hello World :elisp:results:
(print "Hello World")

#+BEGIN_SRC elisp :exports results
  (print "Hello World")
#+END_SRC

-- 
cheers,
Thorsten




Re: [O] What does the _ in `(defun org-element-section-parser (_) ...)' stands for?

2016-02-11 Thread Thorsten Jolitz
John Kitchin <jkitc...@andrew.cmu.edu> writes:

> On Wed, Feb 10, 2016 at 3:13 PM, Thorsten Jolitz <tjol...@gmail.com>
> wrote:
>
> #+BEGIN_SRC emacs-lisp
> (defun my-foo (_)
> "Hello World.
> Argument _ unknown argument."
> (+ 1 1))
> #+END_SRC
>
> strange. in Emacs 25.1, I am pretty sure I get no errors from
> checkdoc.

Maybe not so strange, since I'm on:

,
| GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6)
|  of 2015-09-10 on foutrelis
`

And I thought with Archlinux I'm always up-to-date ...

-- 
cheers,
Thorsten




Re: [O] What does the _ in `(defun org-element-section-parser (_) ...)' stands for?

2016-02-10 Thread Thorsten Jolitz
John Kitchin <jkitc...@andrew.cmu.edu> writes:

> I guess it is a required signature for the function (i.e. some other
> function will call it with some argument), and _ indicates it is not
> used in the body. If you were to give it the arg a name, then checkdoc
> would complain about it not being in the docstring.

Sounds reasonable, thanks for the explanation.
But it does not seem to be a true guess, I tried it out with:

#+BEGIN_SRC emacs-lisp
(defun my-foo (_)
  "Hello World.
Argument _ unknown argument."
  (+ 1 1))
#+END_SRC

and checkdoc asked me to add the "Argument ..." part for "_" to the docstring.

I don't remember that I've seen this before, so maybe this is a rather new
feature/convention?

> Thorsten Jolitz writes:
>
>> Hi List,
>> just out of curiosity, a few functions in org-element.el contain _ in
>> their parameter list, but its not used in the body.
>> What does it stand for?
>
>
> --
> 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
>
>

-- 
cheers,
Thorsten




Re: [O] strange behaviour with org-indent-mode

2016-02-10 Thread Thorsten Jolitz
Eric S Fraga <e.fr...@ucl.ac.uk> writes:

Hello,
>
> for a very long time now, my default org setting has been to use
> org-indent-mode with visual-line-mode activated.  This has been working
> very well until sometime since the start of the new year.  I have two
> symptoms now:
>
> 1. org files, especially large ones (250kB+), do not actually indent
>automatically.
>
> 2. my org capture templates are introducing spaces at the start of lines
>in the capture buffer to line up the start of every line.  Very strange.
>
> I have org-startup-indented set to t.
>
> I am having difficulties tracking this down because a) the lack of
> indenting doesn't happen all the time, just most of the time and b) I
> don't think it happens with emacs -Q.  I'm looking for suggestions on
> how to track down the root problem or if this rings anybody's bells.
>
> Before anybody suggests bisecting, yes, bisecting my configuration would
> probably help but it is such a convoluted configuration due to my using
> emacs for 30+ years...  I guess I really should bit the bullet and clean
> up my initialisation files soon!

Maybe 

,
| C-h v org--indent TAB 
`

shows you some potential culprits?

-- 
cheers,
Thorsten




[O] What does the _ in `(defun org-element-section-parser (_) ...)' stands for?

2016-02-09 Thread Thorsten Jolitz

Hi List,
just out of curiosity, a few functions in org-element.el contain _ in
their parameter list, but its not used in the body. 
What does it stand for?

-- 
cheers,
Thorsten





Re: [O] symbol's function definition is void: org-find-property

2016-02-08 Thread Thorsten Jolitz
童俊翔 <tongjunxi...@gmail.com> writes:

> I want to use capture, the following is my configuration in .emacs
>
>
> ;;(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
> (global-set-key "\C-cl" 'org-store-link)
> (global-set-key "\C-cc" 'org-capture)
> (global-set-key "\C-ca" 'org-agenda)
> (global-set-key "\C-cb" 'org-iswitchb)
>
> ;;capture template
> (setq org-capture-templates
>   '(("t" "Todo" entry (file+headline "~/360Cloud/GTD/gtd.org" "Tasks")
>"* TODO %?\n %i\n %a")
>   ("j" "Journal" entry (file+datetree "~/360Cloud/GTD/journal.org")
>"* %?\nEntered on %U\n %i\n %a")))
>
> When I press C-cc, j,  it doesn’t work, and i promoted that: symbol's 
> function definition is void: org-find-property.
> What’s the problem?
> Thank you for your help!

What does 

,----[ C-h f org-find-property RET ]
| org-find-property is a compiled Lisp function in `org.el'.
| [...]
`

say?

Your "M-x org-version"?
Do you have more than one Org-mode installed?

-- 
cheers,
Thorsten




Re: [O] [ANN] org-dp now on MELPA

2016-02-06 Thread Thorsten Jolitz
Rasmus <ras...@gmx.us> writes:

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Its not wrong or unfair, but not what I would say
>> either. org-element does the same thing - parse the given text, work
>> on the internal representation, write the new text by interpreting
>> the modified internal representation. Only that it parses the whole
>> (maybe narrowed) buffer and has all context info, and mostly is not
>> used to write Org syntax (but rather those of the export backends). 
>
> I edited it with (almost) the suggested quote, and added a pointer
> back to your post here.  I don’t know how much advertisement it
> generates, though.

Ok, thanks!

My sales department told me I should convince/pay some popular open
source hacker to make an enthusiastic note about org-dp on hackers news
(THE NEXT BIG THING!!) 
;-)

JUST kidding, but hackers news really has a big coverage. Last year
apparently someone mentioned outshine on HN, and my number of Github
followers and stars tripled in just a few days, while I had no idea
whats going on and was pretty surprised about so much attention.

-- 
cheers,
Thorsten




[O] [ANN] org-dp now on MELPA

2016-02-06 Thread Thorsten Jolitz
al keyword arguments CONT, VAL, REPL, AFF, SRC and ARGS, if
| given, should be either `t' (to activate prompting for them) or
| of an adecuate type (see docstring of `org-dp-prompt-all') that
| will be used as default value without prompting.
| 
| [back]
`

With org-dp, its all about setting or modifying those element properties
that are used by the element's interpreter. These are significantly
fewer than those that are parsed by the element's parser.

It is possible to define a single core workhorse function that prompts
the user for all of these interpreted properties (see docstring above).
>From this workhorse function, countless convenience functions can be
derived simply by restricting/expanding the number of properties
prompted for. 

The workhorse function and its derived functions return a result list,
that can be consumed by

,[ C-h f org-dp-apply RET ]
| org-dp-apply is a Lisp function in `org-dp.el'.
| 
| (org-dp-apply LST  FUN ELEMENT)
| 
| Apply org-dp function to (full) results LST of `org-dp-prompt'.
| If FUN is non-nil, it must be `memq' of variable
| `org-dp-apply-funs'. See docstring of `org-dp-prompt' for
| more info about argument LST and docstring of `org-dp-rewire' for
| more info about argument ELEMENT.
| 
| [back]
`

So using org-dp, you never have to write your own interactive specs
anymore (within org-dp's context). Just use this construct:

,[optional] 
| (defun my-custom-org-prompt-cmd ()
|   "Call `org-dp-prompt' with certain parameter combination."
|   (interactive)
|   (org-dp-prompt [argument set]...))
`

,[ask user and create org element at point]
| (org-dp-apply (org-dp-prompt)) ; or
| (org-dp-apply (my-custom-org-prompt-cmd))
`

,[ask user and rewire(=modify) org element at point]
| (org-dp-apply (org-dp-prompt) t) ; or
| (org-dp-apply (my-custom-org-prompt-cmd) t) ;or
|
| (org-dp-apply (org-dp-prompt) 'rewire) ; or
| (org-dp-apply (my-custom-org-prompt-cmd) 'rewire)
`

The advantage of this style of programming is that the internal Org element
representation is so uniform (and the number of interpreted properties 
quite limited) that one solution might fit all (elements).

-- 
cheers,
Thorsten




Re: [O] [ANN] org-dp now on MELPA

2016-02-06 Thread Thorsten Jolitz
Rasmus <ras...@gmx.us> writes:

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Xebar Saram <zelt...@gmail.com> writes: 
>>
>> Hi Xebar, 
>>
>>> Thx Thorsten 
>>>
>>> i still use it daily :D 
>>
>> I did not know that I have a user actually, because when I announced
>> it a year ago or so it never drew much attention (a bit to my
>> surprise, I must admit). So I'm happy about the news ;-) 
>
> It's also mentioned here, though it may be a unfair characterization
> of org-dp:
>
> http://emacs.stackexchange.com/a/2885/1974

Thanks for advertising a bit! 

#+BEGIN_QUOTE
org-dp is a meant to make it easer for to use "lisp representation" to
create new "Org syntax representation" (as this it not a goal of
org-element per se).
#+END_QUOTE
 
Its not wrong or unfair, but not what I would say either. org-element
does the same thing - parse the given text, work on the internal
representation, write the new text by interpreting the modified internal
representation. Only that it parses the whole (maybe narrowed) buffer
and has all context info, and mostly is not used to write Org syntax
(but rather those of the export backends).

 Maybe this excerpt from the README is a better characteristic:

,
| Library org-dp is meant for programming at the local level,
| i.e. without any (contextual) information except those about the
| parsed element at point. It is designed to make using the Org-mode
| parser/interpreter framework at local level as convenient as using
| it at the global level (with a complete parse-tree produced by
| `org-element-parse-buffer` available). 
`

And the 'd' in 'dp' is important, since this is a different programming
style. Its more declarative (in the sense of "A program that describes
what computation should be performed and not how to compute it") because
the programmer 'declares' he wants a certain element type with certain
parameter values at a certain place. Parsing the existing element and
writing the new/modified element, the HowTo, is mostly left to the
parser framework.

Source code that uses org-dp looks quite different from the usual Elisp
sources in Emacs/Org libraries that work on the textual representation.

-- 
cheers,
Thorsten




Re: [O] [ANN] org-dp now on MELPA

2016-02-06 Thread Thorsten Jolitz
Xebar Saram <zelt...@gmail.com> writes:

Hi Xebar,

> Thx Thorsten
>
> i still use it daily :D

I did not know that I have a user actually, because when I announced it
a year ago or so it never drew much attention (a bit to my surprise, I
must admit). So I'm happy about the news ;-)

You just used a few convenience functions based on org-dp - or really
did some Elisp programming in this style? I tested and used these
functions for a while, but it would be nice to hear that they work(ed)
for other programmers too ...
 
-- 
cheers,
Thorsten




Re: [O] What happened to `org-end-of-meta-data-and-drawers'?

2016-02-06 Thread Thorsten Jolitz
Rasmus <ras...@gmx.us> writes:

Hi Rasmus,

> I’m happy to see you in this neck of the woods.

thanks, I really hope that becomes a habit again ...

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Not sure if I understand what "base your work off master" refers to,
>> but I'll try cl-lib, probably less hassle than cl. 
>
> I read it as:
>
>  If your library is targeting the master branch of
> org-mode.git, which is targeting Emacs 24.3 or 24.4, youmight as
> well use cl-lib, the replacement of cl.

I think so, I don't want to think about backward compability or so, I
use Archlinux, so my Emacs should always be pretty up to date, and Org
from Git, and thats where my stuff is tested and nowhere else (from me
at least).

-- 
cheers,
Thorsten




[O] What happened to `org-end-of-meta-data-and-drawers'?

2016-02-05 Thread Thorsten Jolitz

Hi List,
again an Org function I used in one of my libraries has disappeared.

,
| org-dp-lib.el:483:1:Warning: the function `org-end-of-meta-data-and-drawers'
| is not known to be defined.
`

Two related questions:

 - is there a replacement?
 - using Magit, how can I investigate the fate of such a lost function
   without investing too much time and effort?

PS
Another rather unrelated question:
Byte-compiling files that require package cl, I always get one of two
errors:
 - using (require 'cl), I get

,
| org-dp.el:172:1:Warning: cl package required at runtime
`

 - but, when I correctly use (eval-when-compile (require 'cl)), I see
   several of these:

,
| org-dp-lib.el:275:40:Warning: function `remove-duplicates' from cl package
| called at runtime
`

How to avoid both kinds of warnings? I'm probably not really up-to-date
here ...

-- 
cheers,
Thorsten





Re: [O] What happened to `org-end-of-meta-data-and-drawers'?

2016-02-05 Thread Thorsten Jolitz
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

Hello,

> Thorsten Jolitz <tjol...@gmail.com> writes:
>
>> Hi List,
>> again an Org function I used in one of my libraries has disappeared.
>>
>> ,
>> | org-dp-lib.el:483:1:Warning: the function
>> | `org-end-of-meta-data-and-drawers'
>> | is not known to be defined.
>> `
>>
>> Two related questions:
>>
>>  - is there a replacement?
>
> (org-end-of-meta-data t)

Ok, thanks!

>>  - using Magit, how can I investigate the fate of such a lost function
>>without investing too much time and effort?
>
> You can do a regexp search in commit messages : 
>
>   l =g org-end-of-meta-data

Cool, thanks again.

>> Another rather unrelated question:
>> Byte-compiling files that require package cl, I always get one of two
>> errors:
>>  - using (require 'cl), I get
>>
>> ,
>> | org-dp.el:172:1:Warning: cl package required at runtime
>> `
>>
>>  - but, when I correctly use (eval-when-compile (require 'cl)), I see
>>several of these:
>>
>> ,
>> | org-dp-lib.el:275:40:Warning: function `remove-duplicates' from cl
>> | package
>> | called at runtime
>> `
>>
>> How to avoid both kinds of warnings? I'm probably not really up-to-date
>> here ...
>
> If you plan to base your work off master, you can as well use
>
>   (require 'cl-lib)

Not sure if I understand what "base your work off master" refers to, but
I'll try cl-lib, probably less hassle than cl.

-- 
cheers,
Thorsten




[O] What happened to org-set-local

2016-02-03 Thread Thorsten Jolitz

Hi List,

After updating Org from Git I get this error:

,
| and: Symbol's function definition is void: org-set-local
`

Has it been replaced - with what?
TIA
-- 
cheers,
Thorsten





Re: [O] Use of deprecated org-log-note-marker variable in outshine

2016-02-03 Thread Thorsten Jolitz
Kaushal Modi <kaushal.m...@gmail.com> writes:

Hi Kaushal,

> Recently the global variable org-log-note-marker was removed from
> org.el.
>
> But it is used in outshine.el as follows:
>
> (defadvice org-store-log-note (around org-store-log-note-around
> activate)
> "Outcomment inserted log-note in Outshine buffers."
> (let ((outshine-log-note-beg-marker
> ;; stay before inserted text
> (copy-marker org-log-note-marker nil))
> (outshine-log-note-end-marker
> ;; stay after inserted text
> (copy-marker org-log-note-marker t)))
> ad-do-it
> (unless (derived-mode-p 'org-mode 'org-agenda-mode)
> (comment-region outshine-log-note-beg-marker
> outshine-log-note-end-marker))
> (move-marker outshine-log-note-beg-marker nil)
> (move-marker outshine-log-note-end-marker nil)))
>
> So right now, I am getting this warning at emacs startup:
>
> ~/.emacs.d/elpa_25_0/outshine-20151203.802/outshine.elc:Warning:
> reference to
> free variable ‘org-log-note-marker’
>
> @ Thorsten, Nicolas: What would be the best way to fix that?
>
> My org version:
> Org-mode version 8.3.2 (release_8.3.2-469-ga902c8 @
> /home/kmodi/usr_local/apps/6/emacs/emacs-25/share/emacs/site-lisp/org/)

Thanks for the bug report. Sorry for beeing so late ... but maybe better
late than never.

I pushed a first fix to origin/trunk. The outcommenting of inserted
log-notes in outshine seems to work again, but I encountered a new issue
with comment-region:

,
| ;; * WAITING foo
|  ;; - State "WAITING"from "TODO"   [2016-02-03 Mi 23:46] \\
|  ;;   waiting for bar
`

It produces this now, which is no good, since outshine expects comments
to start at beginning-of-line. I reported this on Emacs Help.

Which Org-mode version is the first one with the new org-log-note-marker
semantics (to make the advice in outshine conditional on that)?

I push this to master once its really fixed.

-- 
cheers,
Thorsten




Re: [O] Use of deprecated org-log-note-marker variable in outshine

2016-02-03 Thread Thorsten Jolitz
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> As a first approximation, I think 
>
>   (with-current-buffer (marker-buffer org-log-note-marker)
> (goto-char org-log-note-marker)
> (copy-marker (org-log-beginning)))
>
> is close to what `org-log-note-marker' used to be.

Thanks for the code example - I used it.

-- 
cheers,
Thorsten




Re: [O] What happened to org-set-local

2016-02-03 Thread Thorsten Jolitz
Kaushal Modi <kaushal.m...@gmail.com> writes:

> Has it been replaced - with what?
> 
> 
>
> Looks like setq-local can be used directly instead of org-set-local.
>
> -
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=bc0588fee4994eda9474e62313eb9925ad65dab1
> -
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=07e16c2fc5687de5e1761bbf4ba3cf1777de15eb
>  

Yes, thanks.
Only that org-set-local took a quoted first arg, while setq-local takes
an unquoted variable.

-- 
cheers,
Thorsten




Re: [O] OrgMode into Gnus buffers (message-mode included) ?

2015-12-22 Thread Thorsten Jolitz
Xavier Maillard <xav...@maillard.im> writes:

Hello,

> there is an area where I am pretty dumb: orgmode articulation with Gnus
> buffers.
>
> What do I need exactly to do to activate orgmode into Gnus both when
> reading
> posts and when writing new ones ?

I guess you mean message-mode?

For writing:

- use orgstruct or 
- use outorg/outshine, and this:
(add-hook 'message-mode-hook 'outline-minor-mode)
- use ... (there might be more options)

-- 
cheers,
Thorsten




Re: [O] Using orgstruct-mode (or just org-cycle) in emacs-lisp-mode

2015-12-01 Thread Thorsten Jolitz
Jonas Bernoulli <jo...@bernoul.li> writes:

Hi List,

> Aaron Ecay <aarone...@gmail.com> writes:
>
>> Thorsten Jolitz wrote the outshine library
>
> I know. I used it for a while and contributed a few commits.  But I
> pretty much only used the cycling functionality at the time and when
> I discovered that `org-cycle' worked for that too, I stopped using
> outshine.  It also felt a bit like re-inventing the wheel.
>
>> Sadly it’s not actively maintained ATM, but I believe it still works
>> fine,

When I was a heavy outshine user myself it was feature rich and very
stable, and I think it still should be.  So being unmaintained does not
mean you can or should not use it, it only means that I did not add any
new features the last year (and sometimes miss a bug report,
unfortunately). But the three libraries of the outshine-suite
(outshine.el, outorg.el and navi-mode.el) already have so many features
that even the main author could not remember all of them ...

> That's a bit of an understatement; if I remember correctly Thorsten
> stopped using Emacs.

Its true that events in my life kicked me out of the (enjoyable) Emacs
universe, but now I actually use Emacs again once in a while, and hope
more frequently in the future.

>> and it may be an alternative route towards the features you are
>> looking for.
>
> Well currently I am just using `org-cycle' + `outline-minor-mode', which
> works well enough for now.  But eventually I would like to also start
> using Org's navigational commands.  Unfortunately `orgstruct-mode' only
> supports org-like headings (;; * heading\n;; ** subheadng) and not
> standard Emacs headings (;;; heading\n subheading).  I hope someone
> teaches `orgstruct-mode' to support the latter too.  Otherwise I will
> probably give `outshine' another chance.

When there are problems with orgstruct - while waiting for a new
implementation based on outline-minor-mode, why not use an existing,
much more powerfull and very stable alternative based on
outline-minor-mode?

When writing an org-minor-mode (orgstruct, outshine, ...) the most
frequent FAQ is by definition:

"I want Org-mode feature XYZ in org-minor-mode too."

The org-minor-mode author then figures out quickly that

 - Org-mode is not a library engineered for reuse by other
   applications. Org functions do many things, and its often hard or
   impossible to just call them for a result or even copy them
   for reuse.
 - he does not want to rewrite Org-mode

My solution for outshine was 

,[ C-h f outshine-use-outorg RET ]
| outshine-use-outorg is a Lisp function in `outshine.el'.
| 
| (outshine-use-outorg FUN  WHOLE-BUFFER-P  FUNARGS)
| 
| Use outorg to call FUN with FUNARGS on subtree or thing at point.
| 
| FUN should be an Org-mode function that acts on the subtree or
| org-element at point. Optionally, with WHOLE-BUFFER-P non-nil,
| `outorg-edit-as-org' can be called on the whole buffer.
| 
| Sets the variable `outshine-use-outorg-last-headline-marker' so
| that it always contains a point-marker to the last headline this
| function was called upon.
`

With this function potentially all Org-mode commands can easily be made
available in outshine. In practise, some Org functions are really tricky
and need some extra care, but many work out of the box.

Here is what I more or less implemented already. Especially clocking was
tricky, don't remember if it really worked in the end:

,
| 39 matches for "^[[:space:]]*(def[maus][^eltu][a-z]*\*? " in buffer: 
outshine.el
|  30:(defun outshine-deadline ( arg)
|  40:(defun outshine-export-dispatch ( arg)
|  59:(defun outshine-insert-link ()
|  67:(defun outshine-open-at-point ( whole-buffer-p arg 
reference-buffer)
|  84:(defun outshine-set-tags-command ()
|  97:(defun outshine-schedule ( arg)
| 108:(defun outshine-todo ( arg)
| 148:(defun outshine-time-stamp-inactive ( arg)
| 213:(defun outshine-priority ()
| 228:(defun outshine-time-stamp ( arg)
| 254:(defun outshine-toggle-fixed-width ()
| 260:(defun outshine-toggle-comment ()
| 304:(defun outshine-sort-entries ( arg)
| 366:(defun outshine-previous-block ()
| 373:(defun outshine-next-block ()
| 379:(defun outshine-insert-last-stored-link ()
| 571:(defun outshine-toggle-checkbox ( arg)
| 596:(defun outshine-clock-in ()
| 606:(defun outshine-clock-goto ()
| 625:(defun outshine-next-link ()
| 632:(defun outshine-clock-out ()
| 644:(defun outshine-previous-link ()
| 651:(defun outshine-clock-cancel ()
| 662:(defun outshine-clock-report ( arg)
| 732:(defun outshine-timer-pause-or-continue ( arg)
| 738:(defun outshine-timer-item ()
| 744:(defun outshine-timer ()
| 750:(defun outshine-timer-start ()
| 756:(defun outshine-timer-cancel-timer ()
| 762:(defun outshine-timer-set-timer ()
| 768:(defun o

Re: [O] [BUG] outshine and emacs 25.0.5.1 - Was: [error] orgmode git on emacs 25 - HEAD - org-global-cycle

2015-09-10 Thread Thorsten Jolitz
Rainer M Krug <rai...@krugs.de> writes:

Hi Rainer, 

>> This might be the issue discussed earlier [1].  If so, it is solved
>> (see the linked thread).

I just applied the (hopefully relevant) patch for this on github, so
this should propagate to MELA anytime soon.

I tried to close some of the other issues around outshine/outorg on
github too, but some of them are very specific and at the moment I have
no clue how to fix them (if I understand them at all ;-)

But if I start to use Emacs more often now, I will use outshine too, and
maybe get involved a bit more in the future.

Hope that helps a bit ...

-- 
cheers,
Thorsten




Re: [O] outorg issue

2015-09-08 Thread Thorsten Jolitz
Kaushal <kaushal.m...@gmail.com> writes:

Hi all, Hi Bastien,


> I don't know the outshine and outorg code in and out. But I wouldn't
> mind keeping it maintained with the pull requests I get.
>
> That said, adding Thorsten Jolitz to this discussion.
> @Thorsten Would you mind making me (
> https://github.com/tj64/outshine/pull/46 ) a temporary maintainer of
> your outshine package on github. Or do you have anyone in mind you
> would take this up? Thanks.

sorry for being so late to the party, I didn't even notice the cc'd
messages, probably because I used to read this mailing list only via
gmane and filtered the posts from my mail inbox.

I feel bad anyway for the issues on github not taken care of, and while
I started to touch Emacs once in a while again, I'm afraid I won't be
much of a maintainer for these libraries in the future due to lack of
time and energy.
I used to simply apply patches untested on github, but that wasn't a
popular decision either.

So I'm very happy if somebody would like to take over (permanent)
maintainershisp. For me  outshine.el, outorg.el and navi-mode.el always
belonged together as the 'outshine suite', so to say, so I would prefer
to give them away as a bundle to a new maintainer (whoever that might
be, I'll leave that up to the Org Community and Maintainers).

I still find them quite usefull, I used them almost all the time when
programming or writing emails with emacs, and will do so in the future
whenever I touch Emacs.

So thanks in advance to the new maintainer, let me know (PM?) if I have
to do something in the course of changing maintainership

> I'd also like to second Bastien's suggestion, it would be
> excellent to
> see this useful extension maintained again.

1+

-- 
cheers,
Thorsten




Re: [O] Getting heading properties from org-element

2015-07-05 Thread Thorsten Jolitz
John Kitchin jkitc...@andrew.cmu.edu writes:

Hi John,

 Is there a convenient way to get the properties of a headline from
 org-element? I see they are in the parsed output, e.g. as :CATEGORIES
 emacs,org :DATE today, but I didn't see a way to get them if I don't
 already know what they are.

 I know how to get these from an org file, e.g. org-entry-properties, and
 I am looking for something like this from an element.


in my org-dp repo I have these two functions:

#+BEGIN_SRC emacs-lisp
(defun org-dp-contents (optional element interpret-p no-properties-p)
  Get contents of element-at-point or ELEMENT.
If INTERPRET-P is non-nil, call `org-element-interpret-data' on
return value. Call `org-no-properties' on result if
NO-PROPERTIES-P is non-nil too.
  (let* ((elem (cond
((and (not (booleanp element))
  (symbolp element))
 (eval element))
((stringp element)
 (let ((el (car (read-from-string element
   (when (consp el) el)))
((consp element) element)
(t (org-element-at-point
 (beg (org-element-property :begin elem))
 (end (org-element-property :end elem))
 (type (org-element-type elem)))
(if (and beg end)
(save-restriction
  (narrow-to-region beg end)
  (let ((cont (org-element-map
  (org-element-parse-buffer 'object)
  type 'org-element-contents nil t)))
(cond
 ((and interpret-p no-properties-p)
  (org-no-properties (org-element-interpret-data cont)))
 (interpret-p
  (org-element-interpret-data cont))
 (t cont
  (org-element-contents elem


(defun org-dp-filter-node-props (filter optional negate-p verbose-p)
  Return filtered node-properties.
FILTER should be either a symbol from `org-dp-prop-classes', the
symbol `org' (matching the union of all `org-dp-prop-classes' and
customizable variable `org-dp-misc-props'), a list of keys as
strings, or a (single) regexp-string. If NEGATE-P is non-nil, the
properties not matched by the filter are returned. If VERBOSE-P
is non-nil, a message is printed if no property-drawer is found,
otherwise nil is returned.
  (let ((props (save-excursion
 (and
  (or (org-at-heading-p)
  (outline-previous-heading))
  (re-search-forward
   org-property-drawer-re
   (save-excursion
 (org-end-of-meta-data-and-drawers)
 (point))
   'NOERROR 1)
  (progn
(goto-char (match-beginning 0))
(org-dp-contents)
filtered-props)
(if (not props)
(when verbose-p
  (message
   Could not find properties at point %d in buffer %s.
   (point) (current-buffer)))
  (org-element-map props 'node-property
(lambda (--prop)
  (let* ((key (org-element-property :key --prop))
 (val (org-element-property :value --prop))
 (memberp (case filter
((special custom default file global)
 (member-ignore-case
  key
  (eval
   (cdr-safe
(assoc filter
   org-dp-prop-classes)
(org (member-ignore-case
  key (org-dp-org-props)))
(t (cond
((stringp filter)
 (string-match filter key))
((consp filter)
 (member-ignore-case key filter))
(t (error Not a valid filter: %s
  filter)))
(when (or (and negate-p (not memberp))
  (and (not negate-p) memberp))
  (setq filtered-props
(cons (cons key val) filtered-props))
  filtered-props)))

#+END_SRC

maybe thats somehow related...

-- 
cheers,
Thorsten




Re: [O] Sverweis like function for orgtbl

2015-02-16 Thread Thorsten Grothe
Thank you John and Michael for your suggestions, I will see if my 
knowledge is wide enough to understand this, unfortunately I'm a emacs 
newbie :-)

Anyway I will answer after testing your suggestions!

Regards
Thorsten




[O] Sverweis like function for orgtbl

2015-02-16 Thread Thorsten Grothe
Dear Org-users,

I got this table:

| Menge (x) | P(x) |   E(x) |   K(x) |  Gewinn |
|---+--+++-|
| 0 |   20 | 0.00   | 140.00 | -140.00 |
|10 |   18 | 180.00 | 180.00 | 0.00|
|20 |   16 | 320.00 | 220.00 | 100.00  |
|30 |   14 | 420.00 | 260.00 | 160.00  |

and would like to find the highest value in the column Gewinn = 160 go 
two cells left to E(x), read out the value (420) and put this in a remote 
orgtbl. This is something similar to Sverweis in Excel.

I found no predefined function for orgtbl, is it possible?

Thanks in advance!

Regards
Thorsten




Re: [O] org links and outshine

2014-11-07 Thread Thorsten Jolitz
Alan Schmitt alan.schm...@polytechnique.org writes:

Hi Alan,

 On 2014-11-03 09:06, Thorsten Jolitz tjol...@gmail.com writes:

 Grant Rettke g...@wisdomandwonder.com writes:

 On Sat, Nov 1, 2014 at 5:58 AM, Thorsten Jolitz tjol...@gmail.com
 wrote:
 And there is a new library

 [[http://goo.gl/pYYzS6][outorg-export]]

 I just used http://goo.gl/pYYzS6 and it worked fine; that looks like
 an org mode link.

 It is an Org-mode link inserted with C-c C-l while writing the post in
 the *outorg-edit-buffer*, in case this was a question.

 I'll seize this opportunity to ask about this: I have my emacs init file
 in outshine syntax, and inside it there are several links (to info
 pages, to gnus messages, and so on). They look great and can be acted
 upon in org mode, but not so great in lisp mode. Could it be possible
 for outshine to nicely display these links?

nice display of links is done with overlays in Org-mode, see e.

#+BEGIN_SRC emacs-lisp
(defun org-toggle-link-display ()
  Toggle the literal or descriptive display of links.
  (interactive)
  (if org-descriptive-links
  (progn (org-remove-from-invisibility-spec '(org-link))
 (org-restart-font-lock)
 (setq org-descriptive-links nil))
(progn (add-to-invisibility-spec '(org-link))
   (org-restart-font-lock)
   (setq org-descriptive-links t
#+END_SRC

and it might be easy to port this to outshine, unfortunately I have _no_
time right now, maybe you could have a look yourself (patches very
welcome). 

Another requested feature is making the :ARCHIVE: tag work in outshine,
something I definitely would like to have too, maybe thats related to
'invisibility-spec' too (hide archived subtrees when doing visibility
cycling), but unfortuntely right now I cannot investigate.

--
cheers,
Thorsten




[O] Command for Set field formula in radiotables

2014-11-05 Thread Thorsten Grothe
Hello List,

I'm trying to assign a new shortcut for the function Set field formula, 
but what is the command for that function? For Set column formula it is 
org-table-eval-formula optional but I cannot find the command for the 
above function? What I'm doing wrong?

Regards
Thorsten Grothe




Re: [O] How do you interact with org src blocks for your gmane.emacs.orgmode correspondence?

2014-11-03 Thread Thorsten Jolitz
Grant Rettke g...@wisdomandwonder.com writes:

 On Sat, Nov 1, 2014 at 5:58 AM, Thorsten Jolitz tjol...@gmail.com wrote:
 And there is a new library

 [[http://goo.gl/pYYzS6][outorg-export]]

 I just used http://goo.gl/pYYzS6 and it worked fine; that looks like
 an org mode link.

It is an Org-mode link inserted with C-c C-l while writing the post in
the *outorg-edit-buffer*, in case this was a question.

-- 
cheers,
Thorsten




Re: [O] Anyone using or interested in an org to Rmarkdown exporter?

2014-11-01 Thread Thorsten Jolitz
Grant Rettke g...@wisdomandwonder.com writes:

Hi Grant,

 Last week I started learning about [RMarkdown]. It is a [literate
 programming] tool implemented in, and for, the [ℝ programming
 language]. Although I haven't dug in deep yet, I do know that (1) it is
 /basically/ [Markdown] and that (2) `org' exports both to [vanilla
 markdown] and also [GitHub flavored Markdown] and that (3) a lot of my
 peers use `RMarkdown' and not `org'. With that that in mind I got
 curious about what it would take to write an `org2rmarkdown' exporter.

 The scope of my interest is one-time exports for the most basic and
 simple `org' document. As such, right now I have no requirements beyond
 thinking about the opportunity. After doing some Internet searches,
 there does not seem to be an exporter right now. Questions:

 • Does one exist and I missed it?
 • Do you have any interest in such an exporter?
 • Has anyone else ever thought of doing this? If yes, why didn't you?
 • My guess is that doing an exporter that [builds on an existing
   exporter], mentioned above, would be a great start. Thoughts?
   • The big difference seems to be control statements passed to the
 interpreter, which may or may not be necessary to convert. If not,
 than the *stock* `markdown' exporter would provide everything

 Kind regards,

what would acutally be the benefit of using RMarkdown over Org-mode, or
put it another way - when you already use RMarkdown, why do you need
Org-mode too? And if you use Org-mode, what does RMarkdown add to the
table? 

And then there is Outshine too, which lets you switch seemlessly switch
between ESS[R] and Org-mode, so you can program in R-mode, and write and
export in Org-ode, as well as other LP modes like the old (now
overhauled) ESS multi-mode and a new multi-mode developed by Phillip
Lord, so one needs reasons to add just another tool to the tool stack IMO.

 [RMarkdown] http://rmarkdown.rstudio.com/

 [literate programming]
 https://en.wikipedia.org/wiki/Literate_programming

 [ℝ programming language] http://www.r-project.org/

 [Markdown] http://daringfireball.net/projects/markdown/syntax

 [vanilla markdown] http://orgmode.org/manual/Markdown-export.html

 [GitHub flavored Markdown]
 http://orgmode.org/cgit.cgi/org-mode.git/plain/contrib/lisp/ox-gfm.el

 [builds on an existing exporter]
 http://orgmode.org/manual/Adding-export-back_002dends.html

-- 
cheers,
Thorsten




Re: [O] OrgStruct: start with collapsed view

2014-11-01 Thread Thorsten Jolitz
Scott Randby sran...@gmail.com writes:

 What if you try navi-mode with your orgstruct init.el? It works with
 outshine and with org-mode, so maybe with orgstruct too?

 I found this on http://orgmode.org/worg/org-tutorials/org-outside-org.html.

   orgstruct currently does NOT work with outorg and navi-mode...

Ups, than I wrote this (and forgot about it). I still wonder why it
wouldn't work if 'natural' header conventions are used like

,
| ;; * 1st level
| ;; ** 2nd level
`

or 

,
| ;;; 1st level
|  2nd level
`

but I somehow remember that orgstructs default conventions are
different. 

Well, thinking about it, its probably a matter of buffer-local vars for
outline-mode, and orgstructs sets its own variables leaving the outline
vars as-is (correct?), but outshine uses the outline vars and thus does
not find regexps for Org-style headers. Or so...

-- 
cheers,
Thorsten




Re: [O] How do you interact with org src blocks for your gmane.emacs.orgmode correspondence?

2014-11-01 Thread Thorsten Jolitz
Brady Trainor algeb...@uw.edu writes:

 1. Cut some pieces from my .el or .org files, 
 2. Paste into the scratch buffer,
 3. Convert scratch buffer to Major mode org, 
 4. Add src blocks using org-mode shortcuts (s TAB org or selisp SPC),
 5. Edit as needed for email, for instance taking advantage of
 indenting etc. in C-c ' mode
 6. Cut and paste from scratch buffer to email draft
 7. Edit email
 8. If extensive editing of src blocks is needed while drafting, may
 consider switching back to scratch buffer including further cutting
 and pasting

 This seems wholly inefficient, and I'm hoping there is some obviously
 easier way to do it, no matter how much elisp is needed.

Yup. 

Outorg works with message-mode too, so I write my mails in message-mode,
and do

,
| M-# # (outorg-edit-as-org)
`

whenever I need Org-mode functionality like src-blocks, and then

,
| M-# (outorg-copy-edits-and-exit)
`

in the *outorg-edit-buffer* when I'm done with editing in
Org-mode. Makes it easy to edit you emails in full Org-mode.

There are some extra benefits, like automatic (optionally temporary)
insertion of export headers, automatic backup files in a /tmp folder
(one file for each explicit save with C-x C-s, and one saved when
killing the *outorg-edit-buffer*). 

And there is a new library

[[http://goo.gl/pYYzS6][outorg-export]]

by Jonathan Leech-Pepin that keeps source-files and (Org) exports in
sync.

-- 
cheers,
Thorsten




Re: [O] Anyone using or interested in an org to Rmarkdown exporter?

2014-11-01 Thread Thorsten Jolitz
Charles C. Berry ccbe...@ucsd.edu writes:

 As to Thorsten's query:

 ,
 | what would acutally be the benefit of using RMarkdown over Org-mode,
 | or put it another way - when you already use RMarkdown, why do you
 | need Org-mode too? And if you use Org-mode, what does RMarkdown add to
 | the table?
 `

 There is some discussion of this in the README.org...

 If you already use org-mode:

 You get access to Sweave, knitr, slidify, pander, et cetera.

 Their `chunk' options (akin to babel header args) can be easier to use
 than header args for complicated displays.

 Dependency aware caching of R objects is available in those engines
 and its lack in Babel [1] is a serious impediment to working with long
 running computations.

 bioConductor vignettes can be authored in org-mode and exported for a
 suitable vignette engine.

 If you already use Rmarkdown, etc, you get the ease of editting and
 working in org-mode - cycling visibility of headlines, lists, src
 blocks, and results, and of storing results inline, previewing latex
 fragments, and all.

 HTH,

Yes, definitely, thanks for the info. So it makes sense to add another
tool ;)

-- 
cheers,
Thorsten




Re: [O] OrgStruct: start with collapsed view

2014-10-31 Thread Thorsten Jolitz
Karl Voit devn...@karl-voit.at writes:

 Hi!

 * Thorsten Jolitz tjol...@gmail.com wrote:
 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 And now there's another problem: I'd like to have my init file
 collapsed to only headlines on opening.  Since I visit my init file
 through a custom command (which finds it and turns on orgstruct), I
 don't need to use file local variables for that - I just need a
 command to do it.  So:

 how do I (programmatically, in elisp) collapse the view of
 an orgstruct .el file?

 Try 'org-overview'. Both, 'org-overview' and 'show-all' work
 with outshine too, so they should work with org-struct.

 I also transformed my 3657 lines of init.el to OrgStruct.

 Similar to Marcin, I want to see a collapsed view of my headings
 when I open my init.el file. org-overview gives me a weird view of
 all lines that start a parenthesis on top level (defun, setq, ...)
 and not my top level OrgStruct comment lines.

 Has somebody successfully managed to get a collapsed init.el view
 when opening the file?

Not a solution, but an alternative (and an interesting experiment):

What if you try navi-mode with your orgstruct init.el? It works with
outshine and with org-mode, so maybe with orgstruct too?

I always have the source file in 'show-all' mode side-by-side with its
*Navi* buffer that give me the overview (and dozens of other views
too). Constantly changing visibility in a file is to much action and
distraction IMO, I rather have a 2nd buffer for the overview.

Let me know if it works, I did not try navi-mode with orgstruct yet.

-- 
cheers,
Thorsten




Re: [O] An Org-mode LaTeX class?

2014-10-28 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Imagine someone wrote a dedicated Org-mode LaTeX class, and the LaTeX
 exporter got an option to export to this class.  The class modifies
 LaTeX so that it supports all Org's elements and objects, and things
 like tags, timestamps, checkboxes etc.  Moreover, the look of these
 elements is configurable on the LaTeX end, and further by means of Org
 options.  This way, we drop the generic LaTeX thing (which is nice for
 people sending articles to journals etc. – so my dream should not
 replace the current LaTeX exporter, only constitute a variant!), but
 instead we gain a beautiful, configurable pdf rendering of Org buffers.

 What do you think?

Make sure to have a look at expl3 (and others like e.g. xparse and
xstring) package, i.e. upcoming LaTeX 3, before writing this class,
because as a programming language the new version seems highly superior,
and will most likely result in much cleaner and more readable code.

Its well documented, search for 'The LaTeX 3 Interface' and 'The expl3
Package and LaTeX 3 Programming'. 

-- 
cheers,
Thorsten




Re: [O] Include results in a table

2014-10-28 Thread Thorsten Jolitz
abonnements abonneme...@thierry-pelle.eu writes:

Hello,

 I have somethink like that

 #+call: gen(A)
 #+results: A
 : 10

 #+call: gen(B)
 #+results: B
 : 20

 Is there a simple mean to aggregate the results in a table, i.e to get
 | A | 10 |
 | B | 20 |

 I think some lisp can do that but as a beginner... but as I want to 
 learn you can suggest a somewhat complicated solution or a simple idea.
 Thanks.

you could define a 3rd block C that takes the results from block A and B
as variable via :vars x=A y=B (A and B must be named blocks for this,
use a #+NAME: A line) and then do (list A x B y) in block C and use the
:results format that outputs a list as a table (often it is the default,
otherwise try :results table or so).

-- 
cheers,
Thorsten




Re: [O] Include results in a table

2014-10-28 Thread Thorsten Jolitz
abonnements abonneme...@thierry-pelle.eu writes:

 Hi, thank you for your answer.

 Your solution is OK but only for the example I gave (2 or 3
 results). In practice I have about 10 results and the number of them
 may be variable...  Furthermore :vars does not work on my version (I
 must use :var x=A :var y=B)...

:vars was just a typo then 

#+NAME: A
#+BEGIN_SRC emacs-lisp :results raw
 (+ 2 2)
#+END_SRC

#+results: A
4

#+NAME: B
#+BEGIN_SRC emacs-lisp :results raw
 (/ 2 2)
#+END_SRC

#+results: B
1

#+BEGIN_SRC emacs-lisp
  (org-element-map (org-element-parse-buffer) 'src-block
(lambda (--block)
  (let ((nm (org-element-property :name --block)))
(when nm
  (let ((val (org-element-property :value --block)))
(list nm (eval (car (read-from-string val)
#+END_SRC

#+results:
| A | 4 |
| B | 1 |


 Ta.
 Thierry
  
 Hello,

 I have somethink like that

 #+call: gen(A)
 #+results: A
 : 10

 #+call: gen(B)
 #+results: B
 : 20

 Is there a simple mean to aggregate the results in a table, i.e to get
 | A | 10 |
 | B | 20 |

 I think some lisp can do that but as a beginner... but as I want to 
 learn you can suggest a somewhat complicated solution or a simple idea.
 Thanks.

 you could define a 3rd block C that takes the results from block A and B
 as variable via :vars x=A y=B (A and B must be named blocks for this,
 use a #+NAME: A line) and then do (list A x B y) in block C and use the
 :results format that outputs a list as a table (often it is the default,
 otherwise try :results table or so).

-- 
cheers,
Thorsten




Re: [O] How to extract TODOs from date-tree

2014-10-28 Thread Thorsten Jolitz
Jay Iyer jayiye...@gmail.com writes:

Hi,
 I have my Org files set up as date-trees containing a mix of notes,
 tasks and projects. I now have a need to generate a list of projects
 and tasks filed under specific date-tree or in a range of dates. Is it
 possible to get this listing from the date-trees if the entries
 themselves don't have date/time in timestamps or in properties
 settings? I couldn't find a solution in the archives. Please advise.
 Thank you.

what is a date tree? This:

,
| *  2014-10-28 Di
`

?

If the date-tree is the parent and has a timestamp, then the entries
are part of the contents of parent, and you can use this function to
map over the parents

,[ C-h f org-element-map RET ]
| org-element-map is a compiled Lisp function in `org-element.el'.
| 
| (org-element-map DATA TYPES FUN optional INFO FIRST-MATCH
| NO-RECURSION WITH-AFFILIATED)
| 
| Map a function on selected elements or objects. [...]
`

and this to get their contents

,[ C-h f org-element-contents RET ]
| org-element-contents is a compiled Lisp function in `org-element.el'.
| 
| (org-element-contents ELEMENT)
| 
| Extract contents from an ELEMENT.
`

and then 'org-element-property' and 'org-element-put-property' to get
and set timestamp info from the parent and any other info from the child
entries.

-- 
cheers,
Thorsten




Re: [O] How to extract TODOs from date-tree

2014-10-28 Thread Thorsten Jolitz
Jay Iyer jayiye...@gmail.com writes:

Hi Jay,

 The file entries are as follows and the task/note/project sub-heads generally 
 don't have active/inactive timestamps except when a scheduling/deadline is 
 specified.  Thanks.
 ** 2014-10 October
 *** 2014-10-01 Wednesday
  TODO first task
  General note entry
  Project  :prj:

puh ... it would of cause be possible to write emacs lisp to find, extract
and process the date info from the parent tree's :raw-value, but I must
admit I don't want to do it, since it is just extra work required by
un-idiomatic use of Org-mode. 

You have all the means to create a nice logical project file out-of-the
box with Org-mode, use tags, timestamps, deadlines, properties etc and
then extract selected info via the agenda. 

Otherwise you need to write custom elisp yourself or find somebody who
does it for you ...

 Jay Iyer address@hidden writes:

 Hi,
 I have my Org files set up as date-trees containing a mix of notes,
 tasks and projects. I now have a need to generate a list of projects
 and tasks filed under specific date-tree or in a range of dates. Is it
 possible to get this listing from the date-trees if the entries
 themselves don't have date/time in timestamps or in properties
 settings? I couldn't find a solution in the archives. Please advise.
 Thank you.

 what is a date tree? This:

 ,
 | *  2014-10-28 Di
 `

 ?

 If the date-tree is the parent and has a timestamp, then the entries
 are part of the contents of parent, and you can use this function to
 map over the parents

 ,[ C-h f org-element-map RET ]
 | org-element-map is a compiled Lisp function in `org-element.el'.
 | 
 | (org-element-map DATA TYPES FUN optional INFO FIRST-MATCH
 | NO-RECURSION WITH-AFFILIATED)
 | 
 | Map a function on selected elements or objects. [...]
 `

 and this to get their contents

 ,[ C-h f org-element-contents RET ]
 | org-element-contents is a compiled Lisp function in `org-element.el'.
 | 
 | (org-element-contents ELEMENT)
 | 
 | Extract contents from an ELEMENT.
 `

 and then 'org-element-property' and 'org-element-put-property' to get
 and set timestamp info from the parent and any other info from the child
 entries.

-- 
cheers,
Thorsten




Re: [O] How to extract TODOs from date-tree

2014-10-28 Thread Thorsten Jolitz
Jay Iyer jayiye...@gmail.com writes:

 Hi Thorsten,
 The file entries are as follows and the task/note/project sub-heads generally 
 don't have active/inactive timestamps except when a scheduling/deadline is 
 specified.  Thanks.
 ** 2014-10 October
 *** 2014-10-01 Wednesday
  TODO first task
  General note entry
  Project  :prj:

I just read the term 'datetree' again in another post, maybe I'm not
up-to-date and it is idiomatic Org-mode use, then sorry for the noise ...

-- 
cheers,
Thorsten




Re: [O] How to check whether the headline the point is on has some tag?

2014-10-24 Thread Thorsten Jolitz
John Kitchin jkitc...@andrew.cmu.edu writes:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:


 Check the last element of org-heading-components. 

 * Headline:tag1:

 #+BEGIN_SRC emacs-lisp
 (org-heading-components)
 #+END_SRC

 #+RESULTS:
 | 1 | 1 | nil | nil | Headline | :tag1: |




 Hi list,

 I'd like to implement splitting an org file at tagged entries in my
 org-one-to-many library (as requested on the list by Daniel Clemente).
 How do I check whether a specific headline (say, one a point is at) has
 some tag (but not inherited)?

 TIA,

alternatively you could use:

* Headline  :tag1:

#+BEGIN_SRC emacs-lisp
(let ((org-use-tag-inheritance nil))
(save-excursion
 (outline-previous-heading)
 (org-element-property :tags (org-element-at-point
#+END_SRC

#+results:
| tag1 |


-- 
cheers,
Thorsten




Re: [O] 24.4.1; Emacs hangs with Org mode when point is in LOGBOOK

2014-10-21 Thread Thorsten Jolitz
Eric Abrahamsen e...@ericabrahamsen.net writes:

 Fabrice Niessen fni-n...@pirilampo.org
 writes:

Hello,

 On Windows 8, with Emacs 24.4.1 (from Dani) and Org mode version
 8.3beta, I can very often freeze Emacs when clocking into a task, or
 when editing the timestamps found in the LOGBOOK drawer.

 I've gotten something looking like that from time to time (more often in
 the early days of the Org caching mechanism), and sending SIGUSR2 to the
 frozen emacs would reveal that it was in the midst of something
 flyspell-related. You don't appear to be running flyspell, but I'll
 guess that Org's timers are clashing with somebody else's timers.

 Not very helpful, I know.

I just crashed

,
| GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
|  of 2014-06-11 on var-lib-archbuild-staging-x86_64-jgc
`

again today while refiling an Org task, but I already reported this a
few weeks ago to the Emacs maintainers and it seems I have a stripped
binary that does not deliver useful backtrace info. I don't use
flyspell and I'm on Archlinux.

Not very helpful, I know.

-- 
cheers,
Thorsten




Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-20 Thread Thorsten Jolitz
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Thorsten Jolitz tjol...@gmail.com writes:

 ,[ C-h f yes-or-no-p RET ]
 | yes-or-no-p is an alias for `y-or-n-p'.
 | 
 | (yes-or-no-p PROMPT)
 | 
 | Ask user a y or n question.
 `

 = nil

 The interpreter produces _normalized_ syntax. It ignores indentation,
 capitalization on keywords and, obviously, specific bullets (which might
 not be allowed in the target environment). This is a feature.

Thanks for the answer.

I did not mean to point fingers, I just wanted to know if it _can_ be
done and I have to investigate further to find out how, or if I can save
me the time and effort.

PS

Your interpretation of 'obvious' seems (obviously?) be a bit overly
optimistic sometimes.

-- 
cheers,
Thorsten




[O] Example or tutorial for org-invoice.el?

2014-10-20 Thread Thorsten Jolitz

Hi List, 

I cannot find a good example file for org-invoice, does it exist
somewhere? 

And does anybody have a workflow (and maybe src-code) that uses
org-invoice report data and a (customized) latex-class to
semi-automatically create good looking invoices from Org files? I would
be interested.

-- 
cheers,
Thorsten





Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-20 Thread Thorsten Jolitz
Nick Dokos ndo...@gmail.com writes:

 Thorsten Jolitz tjol...@gmail.com writes:

 Your interpretation of 'obvious' seems (obviously?) be a bit overly
 optimistic sometimes.

 Probably apocryphal but ...

 http://mystatpage.wordpress.com/tag/g-h-hardy/

Nice.

Whats really obvious is that spelling errors in Mail Subjects become kind of
embarrassing when repeated so often ... 

-- 
cheers,
Thorsten




Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-19 Thread Thorsten Jolitz
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Thorsten Jolitz tjol...@gmail.com writes:

 Hi List,

 evaluating this
  
 #+BEGIN_SRC emacs-lisp
 (org-element-interpret-data
  '(item (:bullet 1 :tag hello :checkbox trans :counter 2)
  (section nil world)))
 #+END_SRC

 #+results:
 : 1. [@2] hello :: 
 :world

 the content is always placed on a newline, which looks strange in my
 eyes. Is that intended?

 It is. You include a `section' in an `item', which is syntactically
 wrong. Only headlines can contain sections.

I see.  

So when creating an element with interpreted content (that is given as
plain string), I use

  - headlines :: (section nil foo)  

  - others :: (paragraph nil foo)


or should it rather be

  - headlines :: (section nil (paragraph nil foo))

?  

 PS
 and checkbox is ignored, no matter if I give 'on, 'off and 'trans as
 symbols or strings.

 You should not provide 'on, 'off or 'trans, and even less strings, but
 on, off or trans since your expression is already quoted.

ups ... of course.

One more question:

the :tag property of items is parsed as list (of sec. string(s)) - is it
sufficient for interpreting to give it a plain string: tag: foo
instead of tag: (foo)? It seems to work ...

-- 
cheers,
Thorsten




Re: [O] New key binding C-Tab -- how to not use it

2014-10-19 Thread Thorsten Jolitz
Justin Gordon justin.gor...@gmail.com writes:

 I just updated emacs org-mode and when visiting org files, this
 binding takes effect: 

 C-TAB (org-force-cycle-archived)
 Cycle a tree even if it is tagged with ARCHIVE. 

 What's the best way to disable this binding?

 I use C-Tab for moving between windows.

Try

,
| (org-defkey org-mode-map \C-TAB 'undefined)
`

not sure if the TAB is correct here, maybe try TAB, tab, etc if it
does not work. 

-- 
cheers,
Thorsten




Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-19 Thread Thorsten Jolitz
Thorsten Jolitz tjol...@gmail.com writes:

 Nicolas Goaziou m...@nicolasgoaziou.fr writes:
[...]
 You should not provide 'on, 'off or 'trans, and even less strings, but
 on, off or trans since your expression is already quoted.

One more question: bullet strings are parsed 'as-is', but the
interpreter seems to have its own logic that is a bit difficult to grok
(or are there syntax errors too?):

#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
  '(item (:bullet - :tag hello  :checkbox trans :counter 2)
   (paragraph  nil world)))
#+END_SRC

#+results:
: - [@2] [-] hello  :: world

#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
  '(item (:bullet + :tag hello  :checkbox trans :counter 2)
   (paragraph  nil world)))
#+END_SRC

#+results:
: - [@2] [-] hello  :: world

#+BEGIN_SRC emacs-lisp
  (setq org-list-allow-alphabetical t)
  (when (featurep 'org-element) (load org-element t t))
  (org-element-interpret-data
   '(item (:bullet a :tag hello  :checkbox trans :counter 2)
  (paragraph  nil world)))
#+END_SRC

#+results:
: 1. [@2] [-] hello  :: world

-- 
cheers,
Thorsten




Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-19 Thread Thorsten Jolitz
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

Hello,

 Thorsten Jolitz tjol...@gmail.com writes:

 One more question: bullet strings are parsed 'as-is', but the
 interpreter seems to have its own logic that is a bit difficult to grok
 (or are there syntax errors too?):

 This is simple: ordered lists bullets are always X., where X is
 a number and unordered lists are always -.

Thx for you answers (to my other post too). 

Just to get it straight:

The conclusion of your answer above is that the item-interpreter cannot
produce the complete org-mode syntax for plain-lists that is recognized
by the parser and described in the manual?

-- 
cheers,
Thorsten




Re: [O] Exzessive newlines in org-element item interpreter?

2014-10-19 Thread Thorsten Jolitz
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Thorsten Jolitz tjol...@gmail.com writes:

 The conclusion of your answer above is that the item-interpreter cannot
 produce the complete org-mode syntax for plain-lists that is recognized
 by the parser and described in the manual?

 This question is too tricky (and closed) for me to answer.

,[ C-h f yes-or-no-p RET ]
| yes-or-no-p is an alias for `y-or-n-p'.
| 
| (yes-or-no-p PROMPT)
| 
| Ask user a y or n question.
`

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-18 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-17, at 00:19, Thorsten Jolitz wrote:

 However, here is a org-dp solution, use 't' instead of 'prepend to
 replace the links, and whatever you want instead of file+emacs as
 replacement. Of course one could easily re-search and replace [[file:
 in this simple case, but this uses the parser and allows doing more
 complex stuff in a clean way too:

 ,
 | #+BEGIN_SRC emacs-lisp :results none
 |   (require 'org-dp)
 |   (org-dp-map
 |'(org-dp-rewire
 |  'paragraph 
 |  (lambda (cont elem)
 |(let* ((link (car cont))
 |   (raw-val (org-element-property :raw-link link))
 |   (new-val (mapconcat 'identity
 |   (cons file+emacs
 | (cdr
 |  (split-string
 |   raw-val : t)))
 |   :)))
 |  (org-element-put-property link :raw-link new-val)))
 |  'prepend)
 |org-link-re-with-space t)
 | #+END_SRC
 `

Hi Marcin,

 one thing I don't quite understand yet: why is the first argument to
 org-dp-rewire `'paragraph'?  My intuition says it should rather be
 'link, though this doesn't seem to work.  How come that you say
 'paragraph, but the lambda in the second parameter gets the link data in
 `cont'?  (This might be a stupid question, but I really want to grok
 this.)

I was surprised too! But links are objects, and with point at a link
org-element-at-point return a paragraph with the link as content. So
to get the contents of a link, you take the contents of the contents
of a paragraph, but that a special case, because mostly you will work
directly with elements.

The 'paragraph' is the target element type. In this case I could have
written 
 
,
| '(org-dp-rewire nil ...)
`

instead, since then parsed and rewired element types are the same. See
examples below of how to convert a link into a src-block or a keyword
(e.g.).

For more in depth info, have a look at:

,[ C-h f org-dp-rewire RET ]
| org-dp-rewire is a Lisp function in `org-dp.el'.
| 
| (org-dp-rewire ELEM-TYPE optional CONTENTS REPLACE AFFILIATED ELEMENT
| rest ARGS)
| 
| Rewire element-at-point or ELEMENT (if given). [...]
`

Example:

When you start with the file link below and eval the
following src-blocks in order, you get:

#+BEGIN_SRC picolisp
  (println Link label: min.org)
  (println Link type: file)
#+END_SRC

#+LABEL: min.org

[[file:junk/org/minimal.org][min.org]]

#+BEGIN_SRC emacs-lisp :results none
  (require 'org-dp)
  (org-dp-map
   '(org-dp-rewire 'src-block  nil 'prepend nil nil
   :language picolisp
   :value (lambda (_old_ elem)
(format
 (concat
  (println \Link label: %s\)\n
  (println \Link type: %s\))
 (org-dp-contents
  (car (org-dp-contents elem nil t))
  t t)
 (org-element-property
  :type (car
 (org-dp-contents elem nil t))
   org-link-re-with-space t)
#+END_SRC

#+BEGIN_SRC emacs-lisp :results none
  (require 'org-dp)
  (org-dp-map
   '(org-dp-rewire 'keyword nil 'prepend nil nil
   :key LABEL
   :value (lambda (_old_ elem)
(org-dp-contents
 (car (org-dp-contents elem nil t))
 t t)))
   org-link-re-with-space t)
#+END_SRC

This should give you a better idea of what the org-dp-rewire function
arguments stand for. In generel, org-dp functions have extensive
docstrings, so C-h f 'org-dp-xyz' is you friend.

For org-dp, the (few) properties that are interpreted are most
relevant, not so much the (many) properties that are parsed. See
variable `org-dp-elem-props' for an overview. In general, when
programming with org-dp, I often look into org-element.el, especially
at the interpreters. 

 Second question: do I get it correctly that `org-element-put-property'
 returns the new version of the element (link, in this case), with
 everything as it was but the :raw-link property changed?

,[ C-h f org-element-put-property RET ]
| org-element-put-property is a compiled Lisp function in
| `org-element.el'. [...]
| Return modified element.
`

Yes!

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-18 Thread Thorsten Jolitz
Nick Dokos ndo...@gmail.com writes:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-17, at 00:19, Thorsten Jolitz wrote:

 OK, so what is the canonical way of doing this?  I don't want to use
 org-dp, since it is another dependency.

 It is a problem to add dependencies to libraries the user must install
 himself, and at the same time its a pity that there is so much
 duplication instead of reuse ...

 Very true.  I'm torn inside;).

 However, here is a org-dp solution, use 't' instead of 'prepend to
 replace the links, and whatever you want instead of file+emacs as
 replacement. Of course one could easily re-search and replace [[file:
 in this simple case, but this uses the parser and allows doing more
 complex stuff in a clean way too:

 I'll study it, thanks!


 Why not move org-dp into contrib? It's still a dependency but it's
 easier to satisfy if it's in contrib. Or, if it's deemed useful enough,
 even moved into core (perhaps after some cleanup)?

I should really make it a MELPA package, and org-dp.el seems ready,
while org-dp-lib.el still contains some experimental stuff.  But its
still v0.9, I would really prefer if some people (besides me) actually
(clone the github repo and) use it before I make it v1.0 and a package,
to avoid unpleasant surprises.

-- 
cheers,
Thorsten




[O] Exzessive newlines in org-element item interpreter?

2014-10-18 Thread Thorsten Jolitz

Hi List, 

evaluating this
 
#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
 '(item (:bullet 1 :tag hello :checkbox trans :counter 2)
 (section nil world)))
#+END_SRC

#+results:
: 1. [@2] hello :: 
:world

the content is always placed on a newline, which looks strange in my
eyes. Is that intended?

PS
and checkbox is ignored, no matter if I give 'on, 'off and 'trans as
symbols or strings.

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-16 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-15, at 23:52, Nicolas Goaziou wrote:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 I have one more question.  What I'm about to do is (basically) put
 file:some-file-name:: in front of the link, without changing the
 description.  I could use `org-element-put-property' and (AFAIU)
 org-element-link-interpreter to put it into the buffer (and probably
 delete the old one).  It would be much easier (and maybe faster) just to
 go to the point in the buffer where the link starts, go `(forward-char
 2)' (past the brackets) and `(insert (concat file name ::))'.

 But, is it safe?  Wouldn't it break something?  And is it considered a
 good practice?

 There are caveats.

 For example, as soon as you alter the buffer, your AST becomes invalid
 (buffer positions are all wrong after the insertion). If you want to
 process all the links from the same AST, you can, for example, maintain
 a counter for characters inserted so far that will fix buffer positions,
 or first get all internal links with `org-element-map', then process
 them in reverse order so buffer modifications do not invalidate them.

 OK, so what is the canonical way of doing this?  I don't want to use
 org-dp, since it is another dependency.

It is a problem to add dependencies to libraries the user must install
himself, and at the same time its a pity that there is so much
duplication instead of reuse ...

However, here is a org-dp solution, use 't' instead of 'prepend to
replace the links, and whatever you want instead of file+emacs as
replacement. Of course one could easily re-search and replace [[file:
in this simple case, but this uses the parser and allows doing more
complex stuff in a clean way too:

,
| * ORG SCRATCH
| 
| ** Level 2
| 
| [[file+emacs:~/junk/org/minimal.org][min.org]]
| 
| [[file:~/junk/org/minimal.org][min.org]]
| 
| *** Level 3
| 
| [[file+emacs:~/junk/org/trash-me.org][trash.org]]
| 
| [[file:~/junk/org/trash-me.org][trash.org]]
| 
| 
| #+BEGIN_SRC emacs-lisp :results none
|   (require 'org-dp)
|   (org-dp-map
|'(org-dp-rewire
|  'paragraph 
|  (lambda (cont elem)
|(let* ((link (car cont))
|   (raw-val (org-element-property :raw-link link))
|   (new-val (mapconcat 'identity
|   (cons file+emacs
| (cdr
|  (split-string
|   raw-val : t)))
|   :)))
|  (org-element-put-property link :raw-link new-val)))
|  'prepend)
|org-link-re-with-space t)
| #+END_SRC
`

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-15 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Hi list,

 assume that I have a link object (e.g., I'm in the ellipsis part of
 this:

 (org-element-map (org-element-parse-buffer 'object) 'link
   (lambda (elt) ... ))

 What I want to do is this:
 1. check whether it is an internal link, and
 2. if it is, change it so that it points to the analogous place in
 another file.

 Any hints about how to do these things?

 (The rationale is that I'm writing a function which splits a single Org
 file into a bunch of smaller ones, and I want to preserve links.)

[[http:www.orgmode.org][Org-mode]]

#+BEGIN_SRC emacs-lisp :results raw
(save-excursion
 (re-search-backward org-link-re-with-space)
 (goto-char (match-beginning 0))
 (org-dp-contents (org-element-at-point)))
#+END_SRC

#+results:
((link
  (:type http :path www.orgmode.org :raw-link http:www.orgmode.org
  :application nil :search-option nil :begin 609 :end 643
  :contents-begin 633 :contents-end 641 :post-blank 0 :parent ...)))

so these

,
| :type http :path www.orgmode.org :raw-link http:www.orgmode.org
`

are your candidates for getting and setting with
'org-element-property' and 'org-element-put-property'.

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-15 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-15, at 09:16, Thorsten Jolitz wrote:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Hi list,

 assume that I have a link object (e.g., I'm in the ellipsis part of
 this:

 (org-element-map (org-element-parse-buffer 'object) 'link
   (lambda (elt) ... ))

 What I want to do is this:
 1. check whether it is an internal link, and
 2. if it is, change it so that it points to the analogous place in
 another file.

 Any hints about how to do these things?

 (The rationale is that I'm writing a function which splits a single Org
 file into a bunch of smaller ones, and I want to preserve links.)

 [[http:www.orgmode.org][Org-mode]]

 #+BEGIN_SRC emacs-lisp :results raw
 (save-excursion
  (re-search-backward org-link-re-with-space)
  (goto-char (match-beginning 0))
  (org-dp-contents (org-element-at-point)))
 #+END_SRC

 #+results:
 ((link
   (:type http :path www.orgmode.org :raw-link http:www.orgmode.org
   :application nil :search-option nil :begin 609 :end 643
   :contents-begin 633 :contents-end 641 :post-blank 0 :parent ...)))

 so these

 ,
 | :type http :path www.orgmode.org :raw-link http:www.orgmode.org
 `

 are your candidates for getting and setting with
 'org-element-property' and 'org-element-put-property'.

 Thanks, but...

 1. I have no org-dp-contents function in my Org.  (Org-mode version
 8.2.5f (8.2.5f-elpa @ /home/marcin/.emacs.d/elpa/org-20140116/)).

org-dp.el (and org-dp-lib.el) are libraries of mine that aim to make
local programming with org-elements (org-element-at-point) as convenient
as global programming (org-element-parse-buffer), see
https://github.com/tj64/org-dp. I find them very useful, unfortunately
they have been widely ignored so far ;)

 2. What about internal links like

 [[My Target][Find my target]]

 (taken from the manual)?

 In fact, I don't care about /external/ links at all; I'm /only/
 interested in links pointing to the file they are in.

This was just an example (using local parsing for convenience), giving
the hint that you could put some links of interest in an Org file, parse
it, and look at the (link (:type ...)) alists in the parse tree to see
the properties you need to get and set. The internal link representation
is the same for all types anyway.

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-15 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 I see.  What is the most interesting for me is the idea of
 getting/setting properties, that's what I was looking for.

Thats exactly what org-dp (https://github.com/tj64/org-dp) is about: 
getting and setting element properties instead of working on the textual
representation in the buffer. 

Here the commentary section of org-dp.el:

,
| ** Commentary
| 
| Functions for declarative local programming with Org elements. They
| allow to declare what should be done and leave the low-level work,
| the how-to, to the Org parser/interpreter framework.
| 
| With other words, org-dp acts on the internal representation of Org
| elements rather than on their textual representation, and leaves
| the transformation between both representations to the
| parser/interpreter framework. To create or modify an element, you
| call the parser to open it up, rewire its internals, and then call
| the interpreter to build the element again based on its modified
| internals.
| 
| Since all Org elements are uniformely represented as nested lists
| internally, with their properties stored as key-val pairs in
| plists, they can be treated in a much more uniform way when dealing
| with the internal representation instead of the highly variable
| textual representations. A big advantage of plists is that only
| those properties that are actually accessed matter, so when
| transforming one Org element into another on the internal level one
| does not have to worry about not matching properties as long as
| these are not used by the interpreter when building the textual
| representation of the transformed element.
| 
| Library org-dp is meant for programming at the local level,
| i.e. without any (contextual) information except those about the
| parsed element at point. It is designed to make using the Org-mode
| parser/interpreter framework at local level as convenient as using
| it at the global level (with a complete parse-tree produced by
| `org-element-parse-buffer` available). It takes care of the
| org-element caching mechanism in that it only acts on copies of the
| locally parsed elements at point, never on the original parsed (and
| cached) object itself.
`

With just a few functions:

,
| (defun* org-dp-create (elem-type optional contents insert-p
|affiliated rest args)
| 
| (defun* org-dp-rewire (elem-type optional contents replace
|affiliated element rest args)
| 
| (defun org-dp-map (fun-with-args rgxp optional match-pos
|backward-search-p beg end silent-p)
| 
| (defun org-dp-contents (optional element interpret-p no-properties-p)
| 
| (defun* org-dp-prompt (optional elem elem-lst key noprompt- [...]
`

you can do almost all you local Org programming (i.e. doing stuff
at-point without the need for a complete parse-tree) by getting and
setting element properties, thats why I called the library

,
| org-dp.el --- Declarative Local Programming with Org Elements
`

it allows to leave most of the low-level parsing and interpreting stuff
to the parser framework, you only need to 'declare' the element-type and
the property values to create or modify elements.

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-15 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-16, at 00:28, Thorsten Jolitz wrote:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 I see.  What is the most interesting for me is the idea of
 getting/setting properties, that's what I was looking for.

 Thats exactly what org-dp (https://github.com/tj64/org-dp) is about: 
 getting and setting element properties instead of working on the textual
 representation in the buffer. 

 OK, I'm (almost) convinced now.

you can have a look at org-dp-lib.el in the same repo, it has a few
(quite useful) convenience functions written on top of org-dp.el, so
they serve as usage examples too:

,
| (defun org-dp-wrap-in-block (optional lines user-info rest prompt-spec)
| (defun org-dp-toggle-headers (optional action)
| (defun org-dp-filter-node-props (filter optional negate-p verbose-p)
| (defun org-dp-create-table (row-lst optional tblfm table-el-p insert-p)
`

 What about availability on MELPA or
 somewhere?  I'm going to release my code, and ease of installation is
 one of possible concerns.

I would actually appreciate if someone else uses it for a while before I
making it a MELPA package, but I put this on my todo list.

 (OTOH, if someone is brave enough to use Emacs, installing a package
 from git should not be too difficult...)

it shouldn't really ...

-- 
cheers,
Thorsten




Re: [O] How to change a link?

2014-10-15 Thread Thorsten Jolitz
Thorsten Jolitz tjol...@gmail.com writes:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 On 2014-10-16, at 00:28, Thorsten Jolitz wrote:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 I see.  What is the most interesting for me is the idea of
 getting/setting properties, that's what I was looking for.

 Thats exactly what org-dp (https://github.com/tj64/org-dp) is about: 
 getting and setting element properties instead of working on the textual
 representation in the buffer. 

 OK, I'm (almost) convinced now.

PS
org-dp is for local programming - if you parse the buffer anyway in your
programm then working with the parse-tree is the 'default', of course. 

There is a mapping function, 'org-dp-map', but its very lightweight - it
gathers no context information at all, just moves point to all regexp
matches in buffer and applies a (local org-dp) function at that points.

-- 
cheers,
Thorsten




[O] What about a TOC export filter?

2014-10-14 Thread Thorsten Jolitz

Hi List, 

in a derived backend it would be OK to let the parent backend (html)
export the TOC, but I need to post-process the exported html (wrap it in
extra code). 

Since I did not find suitable functionality for this, I use a kind of
workaround: 

 1. disable default with option toc:nil

 2. put a #+TOC: headlines 2 line

 3. copy and adapt (i.e. overwrite) the org-html-keyword transcoder

but wouldn't a toc-filter make more sense? Did I miss it?

-- 
cheers,
Thorsten





[O] How to refer to parsed element in export-filter?

2014-10-11 Thread Thorsten Jolitz

Hi List,

in an exporter I would like to have a filter function (for headlines)
that acts conditional on the back-end and on the headline's properties
(say its :todo-keyword). But is it possible to find the internal
representation of the filtered headline in the communication channel?

#+BEGIN_SRC emacs-lisp
  (defun org-xyz-headline-filter (headline back-end info)
Filter transcoded output for headlines.
(when (and (eq back-end 'xyz)
   (member
(org-element-property
 :todo-keyword
 (FIND-CURR-HEADLINE
  (plist-get info :parse-tree)))
(org-xyz-keywords)))...))
#+END_SRC

I cannot figure out how to implement 'FIND-CURR-HEADLINE' in the stub
above. Do I have to do the filtering directly in the transcoder function
instead, or is there a way to make references to the element's
parse-tree in a filter function?

-- 
cheers,
Thorsten




Re: [O] How to archive the whole file

2014-10-10 Thread Thorsten Jolitz
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

Hi,

 I have an Org file which should all go to the archive.  What do I do?
 Should I manually archive all level-one headlines?  Should I just append
 _archive to its filename?  What is the best practice?

there are probably build-in solution, but something on the line of 

#+BEGIN_SRC emacs-lisp
(org-map-entries 'org-archive-subtree)
#+END_SRC

might do (totally untested!)

-- 
cheers,
Thorsten




Re: [O] Possible bug, installing outshine before outorg

2014-10-10 Thread Thorsten Jolitz
Brady Trainor algeb...@uw.edu writes:

Hi,

 Newb bug report: 

 I think if I have a brand new Emacs setup, installing org with an emacs
 -q, then installing outshine.el (all with built-in package manager),
 that there is some problems created, possibly because of outorg to
 install (IIRC, a silent-notifications type of problem). 

 If I start over (deleting .emacs.d/elpa/ contents) and install org,
 then outorg, then outshine, the problem I think is resolved. 

 Can anyone confirm? 

hmm ... not sure if I understand the problem, but since Outshine 2.0 now
has the 'outshine-use-outorg' facility to call Org-mode commands
directly in well-structured (outshine) source-code buffers, it does
depend on both - outline-mode and org-mode.

Sometimes a simple action like an Emacs restart solves such problems,
i.e. you could try to first install org-mode, then restart Emacs, then
install outshine. Since outline-mode and org-mode are in Emacs core,
I've never seen this problem. 

-- 
cheers,
Thorsten




Re: [O] [BUG][babel] Tangling into directories does not add directories to org file

2014-10-10 Thread Thorsten Jolitz
Aaron Ecay aarone...@gmail.com writes:

Hi Rainer,

 2014ko urriak 10an, Rainer M Krug-ek idatzi zuen:
 It looks like this - but I am always shocked by the number of brackets
 in lisp.

 It’s a bit of an adjustment.  If you get into any serious lisp coding,
 check out paredit – it forces you to always have balanced brackets in
 the file, thus avoiding a whole class of silly but hard-to-spot mistakes
 on lines ending with and avalanche of )

 http://www.emacswiki.org/emacs/ParEdit

if you are less into bondagesubmission, smartparens.el is another option,
it *helps* to have balanced brackets w/o breaking your will ;-)

-- 
cheers,
Thorsten




Re: [O] Feature Request Bounty?

2014-10-09 Thread Thorsten Jolitz
Florian Lindner mailingli...@xgm.de writes:

Hello,

,
| * A
| ** AA
| *** AAA
| ** AB
| *** ABA
| 
| Archiving AA will remove the subtree from the original file and create
| it like that in archive target:
| 
| * AA
| ** AAA
| 
| What I want (wish for) is to create it like that in the archive target:
| 
| * A
| ** AA
| *** AAA
| 
| If I also archive AB after that, it gets inserted in the structure which
| is now identical to the structure we started with.
`

and when you simply mark the done subtrees with tag :ARCHIVE: but only
actually archivate them when the whole tree is done?

-- 
cheers,
Thorsten




Re: [O] Org-element once again

2014-10-08 Thread Thorsten Jolitz
Eric Abrahamsen e...@ericabrahamsen.net writes:

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Hi list,

 does there exist any place I could find the specs of the org-element
 data structure?  From what I can see, it is a list whose car is the type
 of the element, then a (somewhat mysterious or me) plist follows, and
 then the children.  Where could I find more info?  If the answer is
 read the source, Luke ;-) , which functions should I start with?

 Best,

 Have you looked at this page?

 http://orgmode.org/worg/dev/org-element-api.html

 That and the pages linked from it seem to cover most of what's going on.

 The mysterious plist holds all the properties for a given element. Most
 are generated by the parsing process (eg :contents-begin and
 :contents-end, see the link above for all the different properties the
 various elements/objects might get), while headlines will also have
 their actual property-drawer properties put into the list.

 The only thing that remains a little opaque to me is the section
 element, which apparently gets wrapped around a heading's subtree. I
 don't know what it does, but it's never gotten in my way so I haven't
 worried about it.

in simple terms, the data structure is just:

,
| (element-typ (plist) (section))
`

i.e. the plist describes the element itself, the section is its
content. 


* TODO Test :@home:
  DEADLINE: 2014-10-09 Do
  :PROPERTIES:
  :ARCHIVE:  foo
  :END:


org-element-at-point does not parse the contents of an element, it
thus simply returns

,
| (element-typ (plist))
`


#+NAME: foo
#+BEGIN_SRC emacs-lisp
 (save-excursion
 (outline-previous-heading)
 (org-element-at-point))
#+END_SRC

# [:results pp]
#+results:
: (headline
:  (:raw-value Test :begin 1432 :end 2214 :pre-blank 0 :contents-begin 1452 
:contents-end 2214 :level 1 :priority nil :tags
:(@home)
::todo-keyword TODO :todo-type todo :post-blank 0 
:footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 1432 
:deadline
:(timestamp
: (:type active :raw-value 2014-10-09 Do :year-start 2014 
:month-start 10 :day-start 9 :hour-start nil :minute-start nil :year-end 2014 
:month-end 10 :day-end 9 :hour-end nil :minute-end nil :begin 1464 :end 1479 
:post-blank 0))
::ARCHIVE foo :title Test))

#+NAME: bar
#+BEGIN_SRC emacs-lisp :var x=foo 
 (org-element-interpret-data x) 
#+END_SRC

#+results: bar
: * TODO Test :@home:

so this is (just) the element (headline) as specified by its plist.

You can get the contents e.g. with 

#+BEGIN_SRC emacs-lisp :results wrap
(require 'org-dp-lib)
 (save-excursion
 (outline-previous-heading)
 (org-dp-contents nil t)))
#+END_SRC

#+results:
:RESULTS:
DEADLINE: 2014-10-09 Do
:PROPERTIES:
:ARCHIVE:  foo
:END:

[...]
:END:

but the default org-element-parse-buffer parses everything (when specified), the
contents too, so it would give you 

,
| (element-typ (plist) (section))
`

with section recursively containing other elements with the same
structure - a nested list.

-- 
cheers,
Thorsten





Re: [O] Other editors supporting Org-Mode

2014-10-08 Thread Thorsten Jolitz
Manuel Schneckenreither manuel.schneckenreit...@student.uibk.ac.at
writes:

Hi,

 I couldn't find anything on the web about it. Therefore, I like to ask
 you if anyone knows a program (another editor) which supports Org mode.

I recently asked about browser editors that give some support for Org
syntax, but with no results. I think it would be really useful to have
some basic insertion/editing support for Org syntax in the Word
Prozessors used by the masses like MS Word and Clones and popular rich
text browser editiors, nothing fancy, just enough to make writing basic
Org docs comfortable.

Insertion snippets/skeletons would be a start, then maybe some 'quick
navigation' commands. To bad that we can't have this by writing a few
quick Emacs Lisp functions, somebody would need to know enough about
Java, JS, HTML5 etc. and have some insight into the popular editors to
make this happen. 

-- 
cheers,
Thorsten




Re: [O] Other editors supporting Org-Mode

2014-10-08 Thread Thorsten Jolitz
hy...@lactose.homelinux.net (hymie!) writes:

 In our last episode, the evil Dr. Lacto had captured our hero,
   Manuel Schneckenreither
 manuel.schneckenreit...@student.uibk.ac.at, who said:
Hi fellows,

I couldn't find anything on the web about it. Therefore, I like to ask
you if anyone knows a program (another editor) which supports Org mode.

 I would suggest, rather than adapting more editors to support Org,
 creating a stand-alone program that compiles and manages Org functions
 separate from the act of editing them.

but that program does exist already and is called Emacs, right?

I'm writing this email in Emacs instance

#+BEGIN_SRC emacs-lisp
 (emacs-pid)
#+END_SRC

#+results:
: 275

but external program PicoLisp can use another Emacs instance as
standalone program to execute Emacs Lisp (and thus all of Org-mode's
functionality):

#+BEGIN_SRC picolisp :results pp
 (de emx (Exe . @)
   (in
  (list 'emacs --no-site-file --batch
 (extract
'((X)
  (cond
 ((num? (car (info X)))
 (pack --load= X) )
 ((= `(char () (char X))
 (pack --eval= X) ) ) )
(rest) ) )
  (eval Exe) ) )

(emx '(read) (princ (emacs-pid)))
#+END_SRC

#+results:
: 1388

Instead of (princ (emacs-pid)) you could just as well load org-mode and
then call (org-element-parse-buffer ...) or whatever.

PicoLisp is no editor, and there is no editor written in this
language, but assume Java or JS programs can do the same - how would
that help editing Org-mode syntax in editors that are written in that
languages?

Just curious, I would like to find a way to make editing Org syntax
easier for the masses (of non Emacs users).

-- 
cheers,
Thorsten




Re: [O] Other editors supporting Org-Mode

2014-10-08 Thread Thorsten Jolitz
jorge.alfaro-muri...@yale.edu (Jorge A. Alfaro-Murillo) writes:

 hymie! writes: 

 I would suggest, rather than adapting more editors to support 
 Org, creating a stand-alone program that compiles and manages 
 Org functions separate from the act of editing them.

 Perhaps the easiest thing would be an emacs configuration that 
 makes emacs just an org editor for Word users:

My intended use-case is editing Org syntax in HTML text-areas, and it
would be a marvellous solution to give the users a pre-configured
specialized Emacs(server) and help them to configure their web-brower(s)
to call emacs(client) as an external editor when editing text-areas in
web formulas.

Marvellous, but unfortunately a bit optimistic IMO and too
dangerous. When going this route, it should rather be Zile or Nano or
another preinstalled minimal editor (what would it be on Windows? what
on Apple) without Emac's (destructive) power.

Did anybody on the list tried to extend Zile/Nano/? or their MS Windows
or Apple equivalent, and can share experiences?

Or what about extending TinyMCE (http://www.tinymce.com/) for some Org
syntax support? I don't know how hard this would be, if at all possible,
but from the user-perspective this might be the easiest solution.

-- 
cheers,
Thorsten




Re: [O] Other editors supporting Org-Mode

2014-10-08 Thread Thorsten Jolitz
gregory mitchell radiochicken...@gmail.com writes:

 My intended use-case is editing Org syntax in HTML text-areas, and it
 would be a marvellous solution to give the users a pre-configured
 specialized Emacs(server) and help them to configure their web-brower(s)
 to call emacs(client) as an external editor when editing text-areas in
 web formulas.


 I've been wanting to use ace.js for this purpose, but I haven't gotten
 around to it yet.

 https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode

This looks pretty interesting too, no idea about the proscons in
comparison with TinyMCE. 

With all this online editors, it seems to be mostly about highlighting
and indentation (and maybe folding):

,
| Defining a Mode
| 
| Every language needs a mode. A mode contains the paths to a
| language's syntax highlighting rules, indentation rules, and code
| folding rules. Without defining a mode, Ace won't know anything
| about the finer aspects of your language.
`

but with Org-mode one would need commands like C-c C-t, C-c C-x p, C-c ,
etc etc too, i.e. smart/fast tag, property, priority, timestamp,
planning, table, list ... handling (only syntax level editing of
course). 

I don't know if this could at all be implemented with these extendable
web-editors. 

-- 
cheers,
Thorsten




  1   2   3   4   5   6   7   8   9   10   >