Re: [O] Columns with marking characters are exported to latex (Org 8)

2014-08-19 Thread Nick Dokos
Nick Dokos  writes:

> Thorsten Grothe  writes:
>
>> Hallo Nick,
>>
>> * Nick Dokos, 19.08.2014 00:13:53:
>>
>>> Sorry - disregard that. I didn't test with radio tables, I just did a
>>> straight export. I'll try radio tables later.
>>
>> the attached file is a showing the latex code after the export from
>> orgtbl -- see the result, I made some small comments on it...
>
> Yes, not only can I reproduce it, I bisected it and (surprise!)  the
> bisection fingered commit 79873390edd26a44cefc2050c7af470a7ed8fd07: my
> "fix" to your previous complaint:
>
> http://thread.gmane.org/gmane.emacs.orgmode/88634
>
> I'll take another look at org-table-clean-before-export.

OK - I have taken a closer look and I think my "fix" was wrong: I'm
going to revert it.

That will of course restore the previous behaviour where a first column
that's empty is deleted on export. There is an argument to be made that
that is "correct" behaviour: first, both the original version and
Achim's rewrite implement that behaviour, but also the relevant section
of the manual (section 3.5.10, Advanced Features) which lists the
special first column characters includes  among them.

That leaves the somewhat counterintuitive case of a completely empty
first column which is therefore deemed special and gets stripped. This
could be "fixed" as a special case but instead I propose to document that
behaviour in the above section, with a suggested workaround: if you
really, really want an empty first column, then add a second one.

WDYT?

-- 
Nick




Re: [O] How to get cookies working with TODOs?

2014-08-19 Thread Nick Dokos
Eric Abrahamsen  writes:

> Sharon Kimble  writes:
>
>> I'm trying to get cookies working with TODO items. The source document
>> is a book I'm writing and is an outline of each section and chapters so
>> that I can see what is still to be done. I'm writing it in latex but
>> doing the outline in orgs-mode.
>>
>> * TODO CHAPTER 1 - preface [0%]
>> ** DONE Disclaimer
>> CLOSED: [2014-07-30 Wed 23:49]
>> ** DONE Introduction
>> CLOSED: [2014-07-30 Wed 23:50]
>>
>>
>> Following "5.5 Breaking tasks down into subtasks" in the "org.pdf" I
>> should be able to 'C-c C-c' on the cookie and it updates the cookie,
>> except it doesn't work in this case. There are 5 sections which are all
>> completed in this chapter, but the cookie doesn't update.
>>
>> * TODO CHAPTER 2 - preamble [0/11] [0%]
>> :PROPERTIES:
>> :COOKIE_DATA: todo recursive
>> :END:
>> ** DONE An overview of the endocrine system
>> CLOSED: [2014-07-31 Thu 02:12]
>>
>> Like it shows on page 55. But the cookie doesn't update either in this case.
>
> Hmm, I just tried your example above, and it worked just fine. I didn't
> even need to hit C-c C-c, just adding TODOs and toggling their state
> updated the cookie automatically. I'm using Org-mode version 8.3beta
> (release_8.3beta-232-g644e60 @ /home/eric/.emacs.d/org-mode/lisp/)
>

That was my experience as well - there is a variable that controls the
automatic cookie setting, org-provide-todo-statistics, but it is set to
t by default, so it should just work.

> Are you using a relatively recent Org?
>

-- 
Nick




Re: [O] How to get cookies working with TODOs?

2014-08-19 Thread Eric Abrahamsen
Sharon Kimble  writes:

> I'm trying to get cookies working with TODO items. The source document
> is a book I'm writing and is an outline of each section and chapters so
> that I can see what is still to be done. I'm writing it in latex but
> doing the outline in orgs-mode.
>
> * TODO CHAPTER 1 - preface [0%]
> ** DONE Disclaimer
> CLOSED: [2014-07-30 Wed 23:49]
> ** DONE Introduction
> CLOSED: [2014-07-30 Wed 23:50]
>
>
> Following "5.5 Breaking tasks down into subtasks" in the "org.pdf" I
> should be able to 'C-c C-c' on the cookie and it updates the cookie,
> except it doesn't work in this case. There are 5 sections which are all
> completed in this chapter, but the cookie doesn't update.
>
> * TODO CHAPTER 2 - preamble [0/11] [0%]
> :PROPERTIES:
> :COOKIE_DATA: todo recursive
> :END:
> ** DONE An overview of the endocrine system
> CLOSED: [2014-07-31 Thu 02:12]
>
> Like it shows on page 55. But the cookie doesn't update either in this case.

Hmm, I just tried your example above, and it worked just fine. I didn't
even need to hit C-c C-c, just adding TODOs and toggling their state
updated the cookie automatically. I'm using Org-mode version 8.3beta
(release_8.3beta-232-g644e60 @ /home/eric/.emacs.d/org-mode/lisp/)

Are you using a relatively recent Org?

Eric




Re: [O] clock-in clock-out problems

2014-08-19 Thread Nick Dokos
hy...@lactose.homelinux.net (hymie!) writes:

> OK.
>
> I downloaded emacs v 24.4.50.1 .
>
> I think I still had the problem the first time I ran it, but now I'm not
> sure if maybe I ran the old version by mistake.
>
> Anyway, I commented out my entire .emacs file, run 24.4.50.1, and
> the clock persistence worked.  I restored my .emacs a few lines at a
> time, and it continued working the entire time.
>
> I restored my .emacs file, 24.4.50.1 was still working correctly.
> Then for giggles I tried 24.3, got the error, returned to 24.4.50.1, and
> no error.  Then I removed 24.3 completely and installed 24.4.50.1  , and I
> haven't had the error since then.
>

OK - glad it's working. It was a pretty weird bug.

-- 
Nick




Re: [O] Orgtbl, Radiotables: ":booktabs t"

2014-08-19 Thread Nicolas Goaziou
Hello,

jorge.alfaro-muri...@yale.edu (Jorge A. Alfaro-Murillo) writes:

> Are there any news on this? I was just trying to accomplish the same
> thing (get \midrule instead of \hline in a LaTeX orgtbl), but
> adding :booktabs t seems to not be enough.

Unfortunately, progress is slow. This is still in my TODO list anyway.
I'll post a patch when it's ready.


Regards,

-- 
Nicolas Goaziou



[O] Bug: Inconsistent timestamping with org-mobile-pull [8.3beta-245-g3a1fff]

2014-08-19 Thread Johannes Dahl
When I pull changes from mobileorg where I have changed multiple todo
items, I expect the state change to be logged (as it does when I change the
state manually), but that happens to only on one of them.

Steps to reproduce:
1. Create an org file with the following content:
* test-workaround
** TODO test1
:PROPERTIES:
:ID:   abc77285-41e5-4694-949e-0b2bc1db1c80
:END:
** TODO test2
:PROPERTIES:
:ID:   351fe9ee-0446-496b-9e35-3beb5706ed05
:END:

2. Create mobileorg.org in the appropriate place with the following content:
* F(edit:todo) [[id:abc77285-41e5-4694-949e-0b2bc1db1c80][test1]]
** Old value
TODO
** New value
DONE
** End of edit

* F(edit:todo) [[id:351fe9ee-0446-496b-9e35-3beb5706ed05][test2]]
** Old value
TODO
** New value
DONE
** End of edit

3. Make sure state change logging is set for at least DONE keyword and run
org-mobile-pull.
4. Observe that one of the todo items now has a timestamp, whereas the
other does not.

I'm using Org mode from git://orgmode.org/org-mode.git (master branch) with
Emacs 24.3.1

Regards,
Johannes


Re: [O] Bug: ox-texi language set to uppercase -- causes texi2pdf errors [8.2.7c (8.2.7c-44-g3fed03-elpaplus @ /home/brian/.emacs.d/elpa/org-plus-contrib-20140818/)]

2014-08-19 Thread Nicolas Goaziou
Hello,

"Brian J. Carlson"  writes:

> I exported an org document to texi. When I attempt to convert the outputted 
> texi file to pdf using texi2pdf
> the language setting in the org file gets converted to uppercase:
>
> #+LANGUAGE: en  -->  @documentlanguage EN
>
> This causes texi2pdf to encounter errors:
>
> ,
> | $ texi2pdf foo.texi
> | This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
> |  restricted \write18 enabled.
> | entering extended mode
> | (./foo.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
> | Loading texinfo [version 2013-09-11.11]: pdf, fonts, markup, glyphs,
> | page headings, tables, conditionals, indexing, sectioning, toc, 
> environments,
> | defuns, macros, cross references, insertions,
> | (/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
> | This is `epsf.tex' v2.7.4 <14 February 2011>
> | ) localization, formatting, and turning on texinfo input format.)
> | Runaway argument?
> | {EN_\finish }\else \globaldefs = 1 \input txi-EN.tex \fi \closein 1 
> \endgroup \
> | ETC.
> | ./foo.texi:9: Paragraph ended before \documentlanguagetrywithoutunderscore 
> was
> |  complete.
> | 
> |\par
> | l.9
> |
> | ?
> `

This should be fixed. Thank you for reporting it, and for the patch.


Regards,

-- 
Nicolas Goaziou



Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread Samuel Wales
i call these time spans.

to me, it would be excellent as a custom timestamp format.

this requires a patch to org at this location:

Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index b1dc1ce..4497693 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16814,6 +16814,8 @@ The command returns the inserted time stamp."
  tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats)
  time (org-fix-decoded-time t1)
  str (org-add-props
+  ;; fixme alpha make it so that you can run a function
+  ;; (alpha-org-annotate-ts-with-time-span
  (format-time-string
   (substring tf 1 -1) (apply 'encode-time time))
  nil 'mouse-face 'highlight)

then the code for the time spans is as follows.

(defun alpha-org-time-span-as-string (&optional from now)
  "Return the time span from now
to the active or inactive Org timestamp at point, or nil.

+1 means tomorrow.
 0 means today.
-1 means yesterday.

from and now are daynums.
"
  ;; (alpha-org-time-span from now)
  (let ((from (or from (alpha-org-daynum-from-ts-at-point)))
(now (or now (alpha-org-daynum-from-now
(when (and from now)
  (alpha-org-format-time-span (- from now)
(defun alpha-org-format-time-span (span)
  ;; + makes the numbers line up better
  ;; fixme emacs bug with 0
  (format " = %+-3g" span))
  ;; (format " [= %+-3g]" span))

(defun alpha-org-daynum-from-ts (ts)
  (time-to-days (org-time-string-to-time ts)))
;; (alpha-org-daynum-from-now)
(defun alpha-org-daynum-from-now ()
  (alpha-org-daynum-from-ts ""))
(defun alpha-org-daynum-from-ts-at-point ()
  ;; inactive too
  ;; (if ts
  ;; (alpha-org-daynum-from-ts ts)
  (when (org-at-timestamp-p t)
(alpha-org-daynum-from-ts
 (substring (match-string 1) 0 10





On 8/19/14, M  wrote:
> In my task lists, I'm working with scheduled and deadline dates.
> However, it would also often be very interesting, how "old" a task is, how
> long it is lurking around on my lists..
>
> Therefore it would be interesting to find the oldest timestamp below this
> heading and calculate the difference in days to today.
>
> Is that possible with org-mode already?
> Could I display this information in a tabular agenda view in a column?
>
> Kind regards
>
> Martin
>
>
>
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] clock-in clock-out problems

2014-08-19 Thread hymie!
OK.

I downloaded emacs v 24.4.50.1 .

I think I still had the problem the first time I ran it, but now I'm not
sure if maybe I ran the old version by mistake.

Anyway, I commented out my entire .emacs file, run 24.4.50.1, and
the clock persistence worked.  I restored my .emacs a few lines at a
time, and it continued working the entire time.

I restored my .emacs file, 24.4.50.1 was still working correctly.
Then for giggles I tried 24.3, got the error, returned to 24.4.50.1, and
no error.  Then I removed 24.3 completely and installed 24.4.50.1  , and I
haven't had the error since then.

In our last episode, the evil Dr. Lacto had captured our hero,
  hy...@lactose.homelinux.net (hymie!), who said:
>In our last episode, the evil Dr. Lacto had captured our hero,
>  Nick Dokos , who said:
>>hy...@lactose.homelinux.net (hymie!) writes:
>>
>>Are you sure the two instances run the same version of emacs? And what
>>version is that?
>
>Emacs  : GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13)
> of 2014-06-17 on herman
>Package: Org-mode version 8.2.7c (8.2.7c-dist @ /home/hymie/org-mode/lisp/)
>
>>FWIW, I cannot reproduce the problem either with -nw or without. In
>>fact, I'm baffled as to what could explain this: as a I pointed out
>>before, (match-string 1) says one thing and (match-end 1) says another
>>and AFAICT that's impossible. The only explanation I can come up with
>>is a bug in emacs's regexp matching code - a very unlikely scenario IMO.

Solar flares.

Anyway, thanks very much for all of the help.

--hymie!http://lactose.homelinux.net/~hymiehy...@lactose.homelinux.net




Re: [O] [bug] commit 5512bedee breaks insert diary in agenda

2014-08-19 Thread Eric S Fraga
On Tuesday, 19 Aug 2014 at 21:14, Eric S Fraga wrote:
> Hello,
>
> changes made on 28 July, commit 5512bedee, breaks insert diary
> functionality. In particular, "i d" in the agenda inserts the new entry
> in the wrong place in a date-tree diary org file.

I forgot to add that the new entry is also demoted (to use the org
terminology) relative to any previous entry in the date where it is
placed.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-237-gcc6aa4



[O] [bug] commit 5512bedee breaks insert diary in agenda

2014-08-19 Thread Eric S Fraga
Hello,

changes made on 28 July, commit 5512bedee, breaks insert diary
functionality. In particular, "i d" in the agenda inserts the new entry
in the wrong place in a date-tree diary org file.

Reverting this commit fixes the problem.

I haven't looked at the code to understand why, partly because I'm not
sure what problem this commit was meant to fix.

thanks,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-237-gcc6aa4



Re: [O] [ANN] org-dp-wrap-in-block

2014-08-19 Thread Thorsten Jolitz
Xebar Saram  writes:

Hi, 

> will use it over the next few days and report bug (if any) that i find

good, thanks.

As a hint, here the global keybindings I defined in my init.el (my
default use-case is to simply wrap in a plain emacs-lisp src-block).

You can define all kinds of functions that don't prompt the user anymore
by giving a list like

 '(elem-type contents replace affiliated args)

as second arg to `org-dp-wrap-in-block', and in that list you can
specify any kind of customized block.

#+BEGIN_SRC emacs-lisp  
(when (require 'org-dp-lib nil t)
  
  (defun tj/wrap-in-elisp-block ()
(org-dp-wrap-in-block
 nil '(src-block nil nil nil (:language "emacs-lisp"

  (global-set-key (kbd "C-c w w") 'org-dp-wrap-in-block)

  (global-set-key (kbd "C-c w l")
  (lambda ()
(interactive)
(let ((current-prefix-arg '(4)))
  (call-interactively
   'org-dp-wrap-in-block

  (global-set-key (kbd "C-c w e")
  (lambda ()
(interactive)
(beginning-of-line)
(tj/wrap-in-elisp-block)))

  (global-set-key (kbd "C-c w a")
  (lambda ()
(interactive)
(backward-sexp)
(beginning-of-line)
(tj/wrap-in-elisp-block))) )
#+END_SRC


> On Tue, Aug 19, 2014 at 5:14 PM, Thorsten Jolitz 
> wrote:
>
> Hi List,
> 
> I've written the "eierlegende Wollmilchsau" of wrap-in-block
> functions
> (i.e. the 'all-inclusive mother of all wrap-in-block functions').
> 
> To check it out, you need to
> 1. Clone or fork the git repo (https://github.com/tj64/org-dp)
> 2. (add-to-list 'load-path "/path/to/org-dp/") and
> 3. (require 'org-dp-lib') in your init file
> 
> `org-dp-wrap-in-block' works on/with all kinds of Org blocks, and
> can be
> called interactively or non-interactively.
> 
> It
> 
> - inserts a new block when called on an empty line without
> arguments
> 
> - wraps sexp or region or '+/- X lines from point' into a newly
> created
> block
> 
> - when called with point inside a block, it either
> 
> + unwraps the blocks content, i.e. deletes the surrounding block
> or
> 
> + replaces the surrounding block with a different block
> 
> It takes full account of affiliated keywords. In case of
> src-blocks,
> it puts src-block parameters on the block's headline, but with
> `org-dp-toggle-headers' its easy to toggle between parameters
> 
> ,
> | #+begin_src R :noweb yes
> `
> 
> and headers
> 
> ,
> | #+header: :noweb yes
> | #+begin_src R
> `
> 
> This function takes into account so many options that
> combinatorics hits
> you badly when trying to test all of them. Everything I tried
> works now
> with the current version, but its not unlikely that daily usage
> will
> discover some bugs or untreated corner cases. Please report them
> with
> backtrace.
> 
> The good news is that besides its complexity, its not one
> mega-convoluted monolithic function for a single task only.
> Instead I
> outfactored the core functionality into the 'org-dp.el' library
> ("Declarative Programming with Org Elements") which offers
> potentially
> massive time (and headache) savings when programming with Org
> Elements
> on the local level.
> 
> 'org-dp' acts on the internal representation of Org elements, and
> due to
> the total uniformity of this representation it is possible to do
> diverse
> actions on diverse elements in a very uniform way, thus the 3
> functions
> 
> - `org-dp-create'
> 
> - `org-dp-rewire'
> 
> - `org-dp-prompt'
> 
> should be all you need for all kinds of programming
> tasks. `org-dp-wrap-in-block' is one example of how to program
> with
> org-dp, `org-dp-toggle-headers' is another one.
> 
> Hope that this is useful.
> 
> PS
> 
> For the sake of completeness, here the docstring of
> `org-dp-wrap-in-block':
> 
> ,[ 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 &optional LINES USER-INFO)
> |
> | 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
> | forward/backward from point using `forward-line', in the second
> | case the active region is used.
> |

[O] How to get cookies working with TODOs?

2014-08-19 Thread Sharon Kimble
I'm trying to get cookies working with TODO items. The source document
is a book I'm writing and is an outline of each section and chapters so
that I can see what is still to be done. I'm writing it in latex but
doing the outline in orgs-mode.

--8<---cut here---start->8---
* TODO CHAPTER 1 - preface [0%]
** DONE Disclaimer
CLOSED: [2014-07-30 Wed 23:49]
** DONE Introduction
CLOSED: [2014-07-30 Wed 23:50]
--8<---cut here---end--->8---

Following "5.5 Breaking tasks down into subtasks" in the "org.pdf" I
should be able to 'C-c C-c' on the cookie and it updates the cookie,
except it doesn't work in this case. There are 5 sections which are all
completed in this chapter, but the cookie doesn't update.

--8<---cut here---start->8---
* TODO CHAPTER 2 - preamble [0/11] [0%]
:PROPERTIES:
:COOKIE_DATA: todo recursive
:END:
** DONE An overview of the endocrine system
CLOSED: [2014-07-31 Thu 02:12]
--8<---cut here---end--->8---

Like it shows on page 55. But the cookie doesn't update either in this case.

So how can I get the cookies working please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.3.92.1


signature.asc
Description: PGP signature


Re: [O] clock-in clock-out problems

2014-08-19 Thread hymie!
In our last episode, the evil Dr. Lacto had captured our hero,
  Nick Dokos , who said:
>hy...@lactose.homelinux.net (hymie!) writes:
>
>> IMPORTANT NEW DISCOVERY
>>
>> When I use emacs as an X program, the clock persistence works successfully
>> and I do not get any errors.
>>
>> Only when I use emacs with the -nw flag do I get the clock persistence
>> error below.
>>
>
>Are you sure the two instances run the same version of emacs? And what
>version is that?

Emacs  : GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13)
 of 2014-06-17 on herman
Package: Org-mode version 8.2.7c (8.2.7c-dist @ /home/hymie/org-mode/lisp/)

Same version with and without -nw.

I can't run the newer version of GTK at this time.

>FWIW, I cannot reproduce the problem either with -nw or without. In
>fact, I'm baffled as to what could explain this: as a I pointed out
>before, (match-string 1) says one thing and (match-end 1) says another
>and AFAICT that's impossible. The only explanation I can come up with
>is a bug in emacs's regexp matching code - a very unlikely scenario IMO.

Bummer.

>My version info:
>GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9) of
>2014-08-18

I'm not a developer by trade, so I'm not sure if I can git the dev
versions of emacs.  But maybe that will help.

--hymie!http://lactose.homelinux.net/~hymiehy...@lactose.homelinux.net




Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread Thorsten Jolitz
M  writes:

> Thanks!
> I'm using a setup based on Bert Hansen's, so I think I'm already using this
> feature and a new headline looks like that:
>
> ** new headline
> [2014-08-19 Di 18:28]
>
> however, my question is how I can search for this timestamp (I'm not
> sure if
> it is always at the same line below the headline, as sometimes there is a
> logbook inbetween) and calculate the difference to today in days and then
> display that as a separate column


M  writes:

> Thanks!
> I'm using a setup based on Bert Hansen's, so I think I'm already using this
> feature and a new headline looks like that:
>
> ** new headline
> [2014-08-19 Di 18:28]
>
> however, my question is how I can search for this timestamp (I'm not
> sure if
> it is always at the same line below the headline, as sometimes there is a
> logbook inbetween) and calculate the difference to today in days and then
> display that as a separate column

I don't know about that column stuff, but a variation of John's
solution should give you the info you want:

#+BEGIN_SRC emacs-lisp
  (defun my-time-to-now ()
(interactive)
(save-restriction
  (org-narrow-to-subtree)
  (org-time-stamp-to-now
   (org-element-map (org-element-parse-buffer) 'timestamp
 (lambda (--stamp)
   (when (eq (org-element-property :type --stamp) 'inactive)
 (org-element-property :raw-value --stamp)))
 nil 'FIRST-MATCH
#+END_SRC

#+results:
: my-time-to-now


#+BEGIN_SRC emacs-lisp  :results pp
  (save-excursion
(outline-next-heading)
(my-time-to-now))
#+END_SRC

#+results:
: -2


* ORG SCRATCH <2014-08-19 Di>
[2014-08-17 So 19:30]


> Kind regards
>
> Martin 
>
>
>> Von: Thorsten Jolitz 
>> Datum: Tue, 19 Aug 2014 17:34:25 +0200
>> An: 
>> Betreff: Re: [O] How can I calculate the "age" of a headline?
>> 
>> M  writes:
>> 
>>> In my task lists, I'm working with scheduled and deadline dates.
>>> However, it would also often be very interesting, how "old" a task
>>> is, how
>>> long it is lurking around on my lists..
>> 
>> I copied Bernt Hansens setup for toggling automatic insertion of
>> inactive timestamps at headline creation. The tj/ prefix is there only
>> for my convenience, it should really be bh/ (-> Bernt Hansen).
>> 
>> #+BEGIN_SRC emacs-lisp
>> ;; *** Timestamps
>> 
>> ;;  Configuration
>> 
>> (add-hook 'org-insert-heading-hook
>>   'tj/insert-heading-inactive-timestamp 'append)
>> 
>> ;;  Functions
>> 
>> (defvar tj/insert-inactive-timestamp t)
>> 
>> (defun tj/toggle-insert-inactive-timestamp ()
>>   (interactive)
>>   (setq tj/insert-inactive-timestamp
>> (not tj/insert-inactive-timestamp))
>>   (message "Heading timestamps are %s"
>>(if tj/insert-inactive-timestamp "ON" "OFF")))
>> 
>> (defun tj/insert-inactive-timestamp ()
>>   (interactive)
>>   (org-insert-time-stamp nil t t nil nil nil))
>> 
>> (defun tj/insert-heading-inactive-timestamp ()
>>   (save-excursion
>> (when tj/insert-inactive-timestamp
>>   (org-return)
>>   (org-cycle)
>>   (tj/insert-inactive-timestamp
>> #+END_SRC
>> 
>> -- 
>> cheers,
>> Thorsten
>> 
>> 
>
>
>
>

-- 
cheers,
Thorsten




Re: [O] Orgtbl, Radiotables: ":booktabs t"

2014-08-19 Thread Jorge A. Alfaro-Murillo

Ups... it should be midrule not midline.
--
Jorge.




Re: [O] [ANN] org-dp-wrap-in-block

2014-08-19 Thread Xebar Saram
thx Thorsten

this is great!

will use it over the next few days and report bug (if any) that i find

best

Z


On Tue, Aug 19, 2014 at 5:14 PM, Thorsten Jolitz  wrote:

>
> Hi List,
>
> I've written the "eierlegende Wollmilchsau" of wrap-in-block functions
> (i.e. the 'all-inclusive mother of all wrap-in-block functions').
>
> To check it out, you need to
>  1. Clone or fork the git repo (https://github.com/tj64/org-dp)
>  2. (add-to-list 'load-path "/path/to/org-dp/") and
>  3. (require 'org-dp-lib') in your init file
>
> `org-dp-wrap-in-block' works on/with all kinds of Org blocks, and can be
> called interactively or non-interactively.
>
> It
>
>  - inserts a new block when called on an empty line without arguments
>
>  - wraps sexp or region or '+/- X lines from point' into a newly created
>block
>
>  - when called with point inside a block, it either
>
>+ unwraps the blocks content, i.e. deletes the surrounding block or
>
>+ replaces the surrounding block with a different block
>
> It takes full account of affiliated keywords. In case of src-blocks,
> it puts src-block parameters on the block's headline, but with
> `org-dp-toggle-headers' its easy to toggle between parameters
>
> ,
> |   #+begin_src R :noweb yes
> `
>
> and headers
>
> ,
> | #+header: :noweb yes
> | #+begin_src R
> `
>
> This function takes into account so many options that combinatorics hits
> you badly when trying to test all of them. Everything I tried works now
> with the current version, but its not unlikely that daily usage will
> discover some bugs or untreated corner cases. Please report them with
> backtrace.
>
> The good news is that besides its complexity, its not one
> mega-convoluted monolithic function for a single task only. Instead I
> outfactored the core functionality into the 'org-dp.el' library
> ("Declarative Programming with Org Elements") which offers potentially
> massive time (and headache) savings when programming with Org Elements
> on the local level.
>
> 'org-dp' acts on the internal representation of Org elements, and due to
> the total uniformity of this representation it is possible to do diverse
> actions on diverse elements in a very uniform way, thus the 3 functions
>
>  - `org-dp-create'
>
>  - `org-dp-rewire'
>
>  - `org-dp-prompt'
>
> should be all you need for all kinds of programming
> tasks. `org-dp-wrap-in-block' is one example of how to program with
> org-dp, `org-dp-toggle-headers' is another one.
>
> Hope that this is useful.
>
> PS
>
> For the sake of completeness, here the docstring of
> `org-dp-wrap-in-block':
>
> ,[ 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 &optional LINES USER-INFO)
> |
> | 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
> | forward/backward 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', 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' and is used instead of its return value.
> `
>
> --
> cheers,
> Thorsten
>
>
>


Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread M
Thanks!
I'm using a setup based on Bert Hansen's, so I think I'm already using this
feature and a new headline looks like that:

** new headline
[2014-08-19 Di 18:28]

however, my question is how I can search for this timestamp (I'm not sure if
it is always at the same line below the headline, as sometimes there is a
logbook inbetween) and calculate the difference to today in days and then
display that as a separate column

Kind regards

Martin 


> Von: Thorsten Jolitz 
> Datum: Tue, 19 Aug 2014 17:34:25 +0200
> An: 
> Betreff: Re: [O] How can I calculate the "age" of a headline?
> 
> M  writes:
> 
>> In my task lists, I'm working with scheduled and deadline dates.
>> However, it would also often be very interesting, how "old" a task is, how
>> long it is lurking around on my lists..
> 
> I copied Bernt Hansens setup for toggling automatic insertion of
> inactive timestamps at headline creation. The tj/ prefix is there only
> for my convenience, it should really be bh/ (-> Bernt Hansen).
> 
> #+BEGIN_SRC emacs-lisp
> ;; *** Timestamps
> 
> ;;  Configuration
> 
> (add-hook 'org-insert-heading-hook
>   'tj/insert-heading-inactive-timestamp 'append)
> 
> ;;  Functions
> 
> (defvar tj/insert-inactive-timestamp t)
> 
> (defun tj/toggle-insert-inactive-timestamp ()
>   (interactive)
>   (setq tj/insert-inactive-timestamp
> (not tj/insert-inactive-timestamp))
>   (message "Heading timestamps are %s"
>(if tj/insert-inactive-timestamp "ON" "OFF")))
> 
> (defun tj/insert-inactive-timestamp ()
>   (interactive)
>   (org-insert-time-stamp nil t t nil nil nil))
> 
> (defun tj/insert-heading-inactive-timestamp ()
>   (save-excursion
> (when tj/insert-inactive-timestamp
>   (org-return)
>   (org-cycle)
>   (tj/insert-inactive-timestamp
> #+END_SRC
> 
> -- 
> cheers,
> Thorsten
> 
> 





Re: [O] Orgtbl, Radiotables: ":booktabs t"

2014-08-19 Thread Jorge A. Alfaro-Murillo
Well for now and until :booktabs t is incorporated this is what I 
am using:


#+BEGIN_SRC emacs-lisp 
 (defun orgtbl-to-latex-booktabs (table params) 
   "Convert the Orgtbl mode TABLE to LaTeX using booktabs 
   package."  (let* ((alignment (mapconcat (lambda (x) (if x "r" 
   "l")) 
org-table-last-alignment "")) 
  (params2 
   (list 
:tstart (concat "\\begin{tabular}{" alignment 
"}\n\\toprule") :tend "\\bottomrule\n\\end{tabular}" 
:lstart "" :lend " " :sep " & " :efmt "%s\\,(%s)" 
:hline "\\midline"))) 
 (orgtbl-to-generic table (org-combine-plists params2 
 params 

 (setq orgtbl-radio-table-templates 
   (delete-if (lambda (x) (equal (car x) 'latex-mode))  
  orgtbl-radio-table-templates)) 

 (add-to-list 'orgtbl-radio-table-templates 
  '(latex-mode "% BEGIN RECEIVE ORGTBL %n\n% END 
  RECEIVE ORGTBL %n\n\\begin{comment}\n#+ORGTBL: SEND 
  %n orgtbl-to-latex-booktabs :splice nil :skip 0\n| 
  | |\n\\end{comment}\n")) 
#+END_SRC


--
Jorge.




Re: [O] Orgtbl, Radiotables: ":booktabs t"

2014-08-19 Thread Jorge A. Alfaro-Murillo
Hi Nicolas, 

Are there any news on this? I was just trying to accomplish the 
same thing (get \midrule instead of \hline in a LaTeX orgtbl), but 
adding :booktabs t seems to not be enough.


Best,

Jorge.

On [2013-12-01 Sun 10:18], Nicolas Goaziou wrote:


Hello,

AW  writes:


 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2 :booktabs t
 | Month | Days | Nr sold | per day |
 |
 |---+--+-+-|
 |
 | Jan   |   23 |  55 | 2.4 |
 | Feb   |   21 |  16 | 0.8 |
 | March |   22 | 278 |12.6 |
 |
 |---+--+-+-|
 |
 | S:|   66 | | |

 #+TBLFM: $4=$3/$2;%.1f::@5$2=vsum(@I..II)




The parameter ":booktabs t" would be new.


[...]


So would it be possible to implement the parameter ":booktabs t"
without much trouble?


I don't think :booktabs belong to #+ORGTBL keyword because it is not
specific to radio tables.

I have a half baked patch which allows to use export framework to handle
radio tables. I'll try to complete it by the end of the year and propose
it on the ML.

Since ox-latex supports booktabs extension, radio tables will logically
inherit that feature.


Regards,




Re: [O] clock-in clock-out problems

2014-08-19 Thread Nick Dokos
hy...@lactose.homelinux.net (hymie!) writes:

> IMPORTANT NEW DISCOVERY
>
> By default, I use emacs in a terminal window (emacs -nw)
>
> When I use emacs as an X program, the clock persistence works successfully
> and I do not get any errors.
>
> Only when I use emacs with the -nw flag do I get the clock persistence
> error below.
>

Are you sure the two instances run the same version of emacs? And what
version is that?

FWIW, I cannot reproduce the problem either with -nw or without. In
fact, I'm baffled as to what could explain this: as a I pointed out
before, (match-string 1) says one thing and (match-end 1) says another
and AFAICT that's impossible. The only explanation I can come up with
is a bug in emacs's regexp matching code - a very unlikely scenario IMO.

Can anybody else reproduce the problem?

My version info:
GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9) of
2014-08-18
Org-mode version 8.2.7c (release_8.2.7c @
/home/nick/elisp/org-mode/lisp/)
(the latter only in order to work on this problem - I usually run
the latest).

--
Nick





Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread John Kitchin

I think this does what you want. I do not know if it would be easy to
get in a tabular agenda view though.

* Calculate age of this headline

#+BEGIN_SRC emacs-lisp
(org-narrow-to-subtree)
(org-time-stamp-to-now
 (car
  (cl-sort (org-element-map (org-element-parse-buffer) 'headline
 (lambda (headline)
   (org-element-property
:raw-value
(org-element-property :deadline headline
   'org-time<)))
#+END_SRC

#+RESULTS:
: -14



** task 1
   DEADLINE: <2014-08-12 Tue>


** task 2
   DEADLINE: <2014-08-05 Tue>

M  writes:

> In my task lists, I'm working with scheduled and deadline dates.
> However, it would also often be very interesting, how "old" a task is, how
> long it is lurking around on my lists..
>
> Therefore it would be interesting to find the oldest timestamp below this
> heading and calculate the difference in days to today.
>
> Is that possible with org-mode already?
> Could I display this information in a tabular agenda view in a column?
>
> Kind regards
>
> Martin
>
>
>
>

-- 
---
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread Thorsten Jolitz
M  writes:

> In my task lists, I'm working with scheduled and deadline dates.
> However, it would also often be very interesting, how "old" a task is, how
> long it is lurking around on my lists..

I copied Bernt Hansens setup for toggling automatic insertion of
inactive timestamps at headline creation. The tj/ prefix is there only
for my convenience, it should really be bh/ (-> Bernt Hansen).

#+BEGIN_SRC emacs-lisp  
;; *** Timestamps

;;  Configuration 

(add-hook 'org-insert-heading-hook
  'tj/insert-heading-inactive-timestamp 'append)

;;  Functions

(defvar tj/insert-inactive-timestamp t)

(defun tj/toggle-insert-inactive-timestamp ()
  (interactive)
  (setq tj/insert-inactive-timestamp
(not tj/insert-inactive-timestamp))
  (message "Heading timestamps are %s"
   (if tj/insert-inactive-timestamp "ON" "OFF")))

(defun tj/insert-inactive-timestamp ()
  (interactive)
  (org-insert-time-stamp nil t t nil nil nil))

(defun tj/insert-heading-inactive-timestamp ()
  (save-excursion
(when tj/insert-inactive-timestamp
  (org-return)
  (org-cycle)
  (tj/insert-inactive-timestamp
#+END_SRC

-- 
cheers,
Thorsten




[O] How can I calculate the "age" of a headline?

2014-08-19 Thread M
In my task lists, I'm working with scheduled and deadline dates.
However, it would also often be very interesting, how "old" a task is, how
long it is lurking around on my lists..

Therefore it would be interesting to find the oldest timestamp below this
heading and calculate the difference in days to today.

Is that possible with org-mode already?
Could I display this information in a tabular agenda view in a column?

Kind regards

Martin





Re: [O] clock-in clock-out problems

2014-08-19 Thread hymie!
IMPORTANT NEW DISCOVERY

By default, I use emacs in a terminal window (emacs -nw)

When I use emacs as an X program, the clock persistence works successfully
and I do not get any errors.

Only when I use emacs with the -nw flag do I get the clock persistence
error below.

--hymie!http://lactose.homelinux.net/~hymiehy...@lactose.homelinux.net

In our last episode, the evil Dr. Lacto had captured our hero,
  hy...@lactose.homelinux.net (hymie!), who said:

>Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>  goto-char(nil)
>  (cond ((and org-clock-in-resume (looking-at (concat "^[  ]*"
>org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" "
>*\\sw+.? +[012][0-9]:[0-5][0-9]\\)\\][ ]*$"))) (message "Matched %s"
>(match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char
>(match-end 1)) (setq org-clock-start-time (apply (quote encode-time)
>(org-parse-time-string (match-string 1 (setq org-clock-effort
>(org-entry-get (point) org-effort-property)) (setq org-clock-total-time
>(org-clock-sum-current-item (org-clock-get-sum-start ((eq
>org-clock-in-resume (quote auto-restart)) (message "Cannot restart clock
>because task does not contain unfinished clock") (ding) (sit-for 2)
>(throw (quote abort) nil)) (t (insert-before-markers "\n")
>(backward-char 1) (org-indent-line) (if (and (save-excursi
> on (end-of-line 0) (org-in-item-p))) (progn (beginning-of-line 1)
>(org-indent-line-to (- (org-get-indentation) 2 (insert
>org-clock-string " ") (setq org-clock-effort (org-entry-get (point)
>org-effort-property)) (setq org-clock-total-time
>(org-clock-sum-current-item (org-clock-get-sum-start))) (setq
>org-clock-start-time (or (and org-clock-continuously org-clock-out-time)
>(and leftover (y-or-n-p (format "You stopped another clock %d mins ago;
>start this one from then? " (/ ... 60))) leftover) start-time
>(org-current-time org-clock-rounding-minutes t))) (setq ts
>(org-insert-time-stamp org-clock-start-time (quote with-hm) (quote
>inactive)




[O] Import HTML tables

2014-08-19 Thread Tory S. Anderson
Hi all, 

I'm looking for a good way to import HTML tables into org-mode tables. This is 
complicated by the fact that HTML tables can include multi-line data, which 
seems to be functionality not present in org-mode. What I usually end up doing 
is a string of regexp replacements to convert  to linebreaks and  to 
vertical bars, but this is tiresome for a functionality that I'm sure is pretty 
frequently needed. I've tried pandoc, but it doesn't seem to handle html tables 
either. Is there an already-existing functionality out there for importing HTML 
tables into org? 

Thanks, 
- Tory



[O] Bug: ox-texi language set to uppercase -- causes texi2pdf errors [8.2.7c (8.2.7c-44-g3fed03-elpaplus @ /home/brian/.emacs.d/elpa/org-plus-contrib-20140818/)]

2014-08-19 Thread Brian J. Carlson
I exported an org document to texi. When I attempt to convert the outputted 
texi file to pdf using texi2pdf
the language setting in the org file gets converted to uppercase:

#+LANGUAGE: en  -->  @documentlanguage EN

This causes texi2pdf to encounter errors:

,
| $ texi2pdf foo.texi
| This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
|  restricted \write18 enabled.
| entering extended mode
| (./foo.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
| Loading texinfo [version 2013-09-11.11]: pdf, fonts, markup, glyphs,
| page headings, tables, conditionals, indexing, sectioning, toc, environments,
| defuns, macros, cross references, insertions,
| (/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
| This is `epsf.tex' v2.7.4 <14 February 2011>
| ) localization, formatting, and turning on texinfo input format.)
| Runaway argument?
| {EN_\finish }\else \globaldefs = 1 \input txi-EN.tex \fi \closein 1 \endgroup 
\
| ETC.
| ./foo.texi:9: Paragraph ended before \documentlanguagetrywithoutunderscore was
|  complete.
| 
|\par
| l.9
|
| ?
`


I believe this is because the replace-regexp-in-string is replacing all 
uppercase 'AUTO' and the FIXEDCASE argument to
replace-regexp-in-string is set to nil. I believe this should be set to t.

The following patch to ox-texinfo.el makes certain to use the value of 
"#+LANGUAGE:" without changing the case.

Patch:

--8<---cut here---start->8---
--- ox-texinfo.el.~1~   2014-08-18 15:33:00.390014736 -0400
+++ ox-texinfo.el   2014-08-18 21:31:35.615925585 -0400
@@ -541,7 +541,7 @@
 "^@documentencoding \\(AUTO\\)$"
 coding
 (replace-regexp-in-string
- "^@documentlanguage \\(AUTO\\)$" language header nil nil 1)
+ "^@documentlanguage \\(AUTO\\)$" language header t nil 1)
 nil nil 1)))
  ;; Additional header options set by #+TEXINFO_HEADER.
  (let ((texinfo-header (plist-get info :texinfo-header)))
--8<---cut here---end--->8---

Thanks,
;-b




Emacs  : GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian
Package: Org-mode version 8.2.7c (8.2.7c-44-g3fed03-elpaplus @ 
/home/brian/.emacs.d/elpa/org-plus-contrib-20140818/)

current state:
==
(setq
 org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . 
artist) ("asymptote" . asy) ("dot" . fundamental)
  ("sqlite" . sql) ("calc" . fundamental) ("C" . c) ("cpp" 
. c++) ("screen" . shell-script) ("sql" . sql))
 org-export-backends '(ascii html icalendar latex man odt texinfo)
 org-hide-leading-stars t
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-log-done t
 org-confirm-shell-link-function 'yes-or-no-p
 org-finalize-agenda-hook '((lambda nil (iimage-mode t)) org-agenda-to-appt)
 org-special-ctrl-a/e 'reversed
 org-agenda-custom-commands '(("f" "Agenda and (f)ull TODO list" ((agenda 
"Daily") (todo "TODO"
 org-use-sub-superscripts '{}
 org-todo-keyword-faces '(("TODO" . org-todo) ("PROJECT" . org-todo))
 org-capture-templates '(("c" "calfw2org" entry (file nil) "* %?\n 
%(cfw:org-capture-day)"))
 org-agenda-include-diary t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-remember-templates '(("Tasks" 116 "** TODO %? %i\n %a" "~/doc/inbox.org" 
"Tasks")
  ("Appointments" 97 "** APPOINTMENT %?\n%^T\n%i\n  
%a" "~/doc/inbox.org" "Appointments")
  ("Note" 110 "** NOTE %? %i\n  %a" "~/doc/inbox.org" 
"Notes"))
 org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook 
before-save-hook org-encrypt-entries nil t] 5]
 (lambda nil (set-face-foreground (quote org-hide) 
(frame-parameter nil (quote background-color
 (lambda nil (if org-mode-use-flyspell (flyspell-mode)))
 #[nil "\300\301\302\303\304$\207" [org-add-hook 
change-major-mode-hook org-show-block-all append local] 5]
 #[nil "\300\301\302\303\304$\207" [org-add-hook 
change-major-mode-hook org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes 
org-journal-update-auto-mode-alist)
 org-fontify-done-headline t
 org-agenda-time-grid '((daily today require-timed remove-match) 
#("" 0 16 (org-heading t))
(700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 
1800 1900 200

[O] [ANN] org-dp-wrap-in-block

2014-08-19 Thread Thorsten Jolitz

Hi List, 

I've written the "eierlegende Wollmilchsau" of wrap-in-block functions
(i.e. the 'all-inclusive mother of all wrap-in-block functions').

To check it out, you need to 
 1. Clone or fork the git repo (https://github.com/tj64/org-dp)
 2. (add-to-list 'load-path "/path/to/org-dp/") and
 3. (require 'org-dp-lib') in your init file

`org-dp-wrap-in-block' works on/with all kinds of Org blocks, and can be
called interactively or non-interactively.

It

 - inserts a new block when called on an empty line without arguments

 - wraps sexp or region or '+/- X lines from point' into a newly created
   block

 - when called with point inside a block, it either

   + unwraps the blocks content, i.e. deletes the surrounding block or

   + replaces the surrounding block with a different block

It takes full account of affiliated keywords. In case of src-blocks,
it puts src-block parameters on the block's headline, but with
`org-dp-toggle-headers' its easy to toggle between parameters

,
|   #+begin_src R :noweb yes
`

and headers

,
| #+header: :noweb yes
| #+begin_src R
`

This function takes into account so many options that combinatorics hits
you badly when trying to test all of them. Everything I tried works now
with the current version, but its not unlikely that daily usage will
discover some bugs or untreated corner cases. Please report them with
backtrace. 

The good news is that besides its complexity, its not one
mega-convoluted monolithic function for a single task only. Instead I
outfactored the core functionality into the 'org-dp.el' library
("Declarative Programming with Org Elements") which offers potentially
massive time (and headache) savings when programming with Org Elements
on the local level.

'org-dp' acts on the internal representation of Org elements, and due to
the total uniformity of this representation it is possible to do diverse
actions on diverse elements in a very uniform way, thus the 3 functions

 - `org-dp-create'

 - `org-dp-rewire'

 - `org-dp-prompt'

should be all you need for all kinds of programming
tasks. `org-dp-wrap-in-block' is one example of how to program with
org-dp, `org-dp-toggle-headers' is another one.

Hope that this is useful. 

PS 

For the sake of completeness, here the docstring of
`org-dp-wrap-in-block':

,[ 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 &optional LINES USER-INFO)
| 
| 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
| forward/backward 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', 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' and is used instead of its return value.
`

-- 
cheers,
Thorsten




[O] Bug: Org mode links not sufficiently quoted in org-link-search [8.3beta (release_8.3beta-245-g3a1fff @ /home/ruperts/.emacs.d/libraries/org-mode/lisp/)]

2014-08-19 Thread Rupert Swarbrick

When trying to jump back to some links that I'd saved in make logs, I
got what appeared to be a hang in Emacs. Here's an example link (with
the identifying bits taken out, I'm afraid)

[[file:/some/where/build.log::make%5B3%5D:%20***%20%5Bfoo.o%5D%20Error%201][My 
message]]


The problem seems to be that ORG-LINK-SEARCH gets an input with regex
special characters in ("***" in this case). Then the WORDS variable, set
on line 11054 by splitting the input on whitespace, is used in re4 and
re5 without quoting.

Rewriting line 11054 to set WORDS to

   (mapcar #'regexp-quote (org-split-string s "[ \n\r\t]+"))

seems to fix things for me.


Rupert


Emacs  : GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll 
bars)
 of 2014-06-27 on xl-cam-rhel6test
Package: Org-mode version 8.3beta (release_8.3beta-245-g3a1fff @ 
/home/ruperts/.emacs.d/libraries/org-mode/lisp/)




Re: [O] clock-in clock-out problems

2014-08-19 Thread Nick Dokos
Sebastien Vauban 
writes:

> Nick Dokos wrote:
>> I added the following to my .emacs
>>
>> (require 'org-clock)
>> (setq org-clock-persist t)
>> (org-clock-persistence-insinuate)
>>
>> I then start a clock, exit, restart emacs, get asked the "Resume
>> clock" question, say "y", work for a while, stop the clock and
>> everything seems OK.
>
> FWIW, what I don't like with this approach is that requiring org-clock
> requires the full Org, and that can take a (little) while, depending on
> the number of files we do have in `org-agenda-files', a.o.
>
> Remember that Carsten was advocating me to remove the call
> `(org-agenda-list)' from my .emacs file, mainly for making Emacs more
> usable for command-line usage, etc.
>
> The approach I'd rather like to follow is to call the persistence
> functions as soon as the first Org buffer gets opened (in a new Emacs
> session).
>
> Maybe the following is enough -- I didn't test it yet:
>
> (add-hook 'org-mode-hook
>   (lambda ()
> (require 'org-clock)
> (setq org-clock-persist t)
> (org-clock-persistence-insinuate)))
>

There may indeed be cleverer ways of loading it: I didn't worry about that.
I was more interested in seeing whether I could reproduce the OP's
problem (FWIW, I'm not using clocking).

-- 
Nick




Re: [O] Orgmode/Koma script letter

2014-08-19 Thread Rasmus
Hi Vikas,

Vikas Rawal  writes:

> I am trying to create a custom template for my letterhead. The
> documentation suggests that by default title should be used as subject
> of the letter.

Cool.  Let us know how it goes.

> ox-koma-letter.el has this:
> (defcustom org-koma-letter-subject-format t
>   "Use the title as the subject of the letter.

That's a bug in the documentation, if anything.  The rest of the
docstring is fine.  It gives you a mean of formatting the subject
line, e.g. center it and make it bold.

I'll correct it later.

I'm kind of busy now, but check the docstring of
`org-koma-letter-use-title' and `org-koma-letter-prefer-subject'.
Hopefully setting the latter to non-nil will give you what you want.

> Byt when I export a file, 
>
> #+TITLE: A simple letter
>
> is exported as 
>
> \setkomavar{title}{A simple letter}
>
> rather than as 
>
> \setkomavar{subject}{A simple letter}
>
> Accordingly, title appears separately as a badly formatted title.
>
> If I have a separate #+Subject: line, that is correctly exported as a subject.

This is a feature.

> Is there something wrong in what I am doing or is there a problem?

I don't think there is a code bug.  There is a potentially a
documentation bug in the first line of the doc string you mentioned.

> Org version: Org-mode version 8.3beta (release_8.3beta-167-g003edd @
> /Users/vikas/.emacs.d/src/org/lisp/)

Hope it helps,
Rasmus

-- 
It was you, Jezebel, it was you




Re: [O] Custom todo-like thing in agenda?

2014-08-19 Thread Joe Corneli
On Sat, Aug 16, 2014 at 3:15 AM, Marcin Borkowski  wrote:
> Hi all,
>
> I was wondering whether something like this is possible.  (Well, I'm
> pretty sure it is, what I don't know whether I'm competent enough to
> pull it off...)  I'd like to be able to create a special agenda view
> (or block in a "normal" agenda, this shouldn't make much difference,
> since I may use block agenda instead of the usual C-c a a), in which
> the lines would behave much like TODOs, with the exception that their
> source would not be an Org file, but something else.

One possible idea would be to check out org-weather-metno
from https://github.com/ruediger/weather-metno-el

-- 
RMS: "I am not on vacation, but I am at the end of a long time delay.
I am located somewhere on Earth, but as far as responding to email is
concerned, I appear to be well outside the solar system."



Re: [O] clock-in clock-out problems

2014-08-19 Thread Sebastien Vauban
Nick Dokos wrote:
> I added the following to my .emacs
>
> (require 'org-clock)
> (setq org-clock-persist t)
> (org-clock-persistence-insinuate)
>
> I then start a clock, exit, restart emacs, get asked the "Resume
> clock" question, say "y", work for a while, stop the clock and
> everything seems OK.

FWIW, what I don't like with this approach is that requiring org-clock
requires the full Org, and that can take a (little) while, depending on
the number of files we do have in `org-agenda-files', a.o.

Remember that Carsten was advocating me to remove the call
`(org-agenda-list)' from my .emacs file, mainly for making Emacs more
usable for command-line usage, etc.

The approach I'd rather like to follow is to call the persistence
functions as soon as the first Org buffer gets opened (in a new Emacs
session).

Maybe the following is enough -- I didn't test it yet:

--8<---cut here---start->8---
(add-hook 'org-mode-hook
  (lambda ()
(require 'org-clock)
(setq org-clock-persist t)
(org-clock-persistence-insinuate)))
--8<---cut here---end--->8---

Best regards,
  Seb

-- 
Sebastien Vauban